Fix some more notices

master
Vitaliy Filippov 2014-12-16 00:36:41 +03:00
parent 8469014d18
commit 874b7bf24a
3 changed files with 17 additions and 11 deletions

View File

@ -531,7 +531,7 @@ function fof_db_set_feedprop($user_id, $feed_id, $prop, $value)
{ {
$chg = false; $chg = false;
$prefs = fof_db_get_subscription_prefs($user_id, $feed_id); $prefs = fof_db_get_subscription_prefs($user_id, $feed_id);
if ($prefs[$prop] != $value) if (empty($prefs[$prop]) ? $value : ($prefs[$prop] != $value))
{ {
$prefs[$prop] = $value; $prefs[$prop] = $value;
$chg = true; $chg = true;
@ -550,7 +550,7 @@ function fof_db_untag_feed($user_id, $feed_id, $tag_id)
fof_db_set_subscription_prefs($user_id, $feed_id, $prefs); fof_db_set_subscription_prefs($user_id, $feed_id, $prefs);
fof_safe_query( fof_safe_query(
"delete from it using $FOF_ITEM_TAG_TABLE it, $FOF_ITEM_TABLE i". "delete from it using $FOF_ITEM_TAG_TABLE it, $FOF_ITEM_TABLE i".
" where it.item_id=i.item_id and it.user_id=%d and it.tag_id=%d and i.feed_id=%d". " where it.item_id=i.item_id and it.user_id=%d and it.tag_id=%d and i.feed_id=%d",
$user_id, $tag_id, $feed_id $user_id, $tag_id, $feed_id
); );
} }

View File

@ -669,14 +669,17 @@ function fof_apply_tags($item)
{ {
global $fof_subscription_to_tags; global $fof_subscription_to_tags;
if(!isset($fof_subscription_to_tags)) if (!isset($fof_subscription_to_tags))
$fof_subscription_to_tags = fof_db_get_subscription_to_tags(); $fof_subscription_to_tags = fof_db_get_subscription_to_tags();
// add subscription tags // add subscription tags
foreach((array)$fof_subscription_to_tags[$item['feed_id']] as $user_id => $tags) if (!empty($fof_subscription_to_tags[$item['feed_id']]))
if(is_array($tags)) {
foreach($tags as $tag) foreach ($fof_subscription_to_tags[$item['feed_id']] as $user_id => $tags)
fof_db_tag_items($user_id, $tag, $item['item_id']); if (is_array($tags))
foreach($tags as $tag)
fof_db_tag_items($user_id, $tag, $item['item_id']);
}
$filtered = array(); $filtered = array();

View File

@ -41,8 +41,11 @@ if (isset($_REQUEST['tagfeeds']))
$allow_prop = array('untag' => 1, 'tag' => 1, 'filter' => 1, 'title' => 1, 'hide' => 1, 'orighide' => 1); $allow_prop = array('untag' => 1, 'tag' => 1, 'filter' => 1, 'title' => 1, 'hide' => 1, 'orighide' => 1);
foreach ($_REQUEST as $k => $v) foreach ($_REQUEST as $k => $v)
{ {
list($prop, $feed_id) = explode('_', $k); $prop = explode('_', $k);
if (!$allow_prop[$prop]) if (count($prop) < 2)
continue;
list($prop, $feed_id) = $prop;
if (empty($allow_prop[$prop]))
continue; continue;
if (!($feed = fof_db_get_feed_by_id($feed_id))) if (!($feed = fof_db_get_feed_by_id($feed_id)))
continue; continue;
@ -87,13 +90,13 @@ if (isset($_REQUEST['tagfeeds']))
} }
} }
// show item content by default // show item content by default
else if ($prop == 'hide' && $v && !$_POST['orighide_'.$feed_id]) else if ($prop == 'hide' && $v && empty($_POST['orighide_'.$feed_id]))
{ {
if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'hide_content', true)) if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'hide_content', true))
$message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown collapsed by default'; $message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown collapsed by default';
} }
// hide item content by default // hide item content by default
else if ($prop == 'orighide' && $v && !$_POST['hide_'.$feed_id]) else if ($prop == 'orighide' && $v && empty($_POST['hide_'.$feed_id]))
{ {
if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'hide_content', false)) if (fof_db_set_feedprop(fof_current_user(), $feed_id, 'hide_content', false))
$message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown expanded by default'; $message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown expanded by default';