From ac476a23b5d94f55f746fab77c3b0a198537a19b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 8 May 2014 00:50:22 -0700 Subject: [PATCH] Web: send News notices containing images/video only to 7.3+ clients --- html/inc/forum_rss.inc | 14 ++++++++++++-- html/user/notices.php | 5 ++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/html/inc/forum_rss.inc b/html/inc/forum_rss.inc index 4e69026468..b7696452cb 100644 --- a/html/inc/forum_rss.inc +++ b/html/inc/forum_rss.inc @@ -22,7 +22,16 @@ require_once("../inc/util.inc"); require_once("../inc/text_transform.inc"); require_once("../project/project.inc"); -function show_forum_rss_item($thread, $userid, $threads_only) { +// return true if the given HTML may contain images or video +// +function contains_image_or_video($x) { + if (strstr($x, "id; $clause2 = " and hidden=0 "; @@ -42,6 +51,7 @@ function show_forum_rss_item($thread, $userid, $threads_only) { $options->htmlitems = false; } $t = output_transform($post->content, $options); + if ($no_images && contains_image_or_video($t)) return; echo " <![CDATA[".sanitize_tags(bb2html($thread->title))."]]> $unique_url @@ -112,7 +122,7 @@ function forum_rss($forumid, $userid, $threads_only, $ndays) { "; foreach ($threads as $thread) { - show_forum_rss_item($thread, $userid, $threads_only); + show_forum_rss_item($thread, $userid, $threads_only, false); } echo " diff --git a/html/user/notices.php b/html/user/notices.php index 6996559797..9ba828d3df 100644 --- a/html/user/notices.php +++ b/html/user/notices.php @@ -97,6 +97,9 @@ foreach ($threads as $t) { usort($items, 'notice_cmp'); +$client_version = boinc_client_version(); +$no_images = ($client_version < 73000); + notices_rss_start(); foreach ($items as $item) { switch ($item->type) { @@ -104,7 +107,7 @@ foreach ($items as $item) { show_notify_rss_item($item->val); break; case 1: - show_forum_rss_item($item->val, 0, 1, 0); + show_forum_rss_item($item->val, 0, 1, $no_images); break; } }