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;
$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;
$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_safe_query(
"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
);
}

View File

@ -669,14 +669,17 @@ function fof_apply_tags($item)
{
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();
// add subscription tags
foreach((array)$fof_subscription_to_tags[$item['feed_id']] as $user_id => $tags)
if(is_array($tags))
foreach($tags as $tag)
fof_db_tag_items($user_id, $tag, $item['item_id']);
if (!empty($fof_subscription_to_tags[$item['feed_id']]))
{
foreach ($fof_subscription_to_tags[$item['feed_id']] as $user_id => $tags)
if (is_array($tags))
foreach($tags as $tag)
fof_db_tag_items($user_id, $tag, $item['item_id']);
}
$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);
foreach ($_REQUEST as $k => $v)
{
list($prop, $feed_id) = explode('_', $k);
if (!$allow_prop[$prop])
$prop = explode('_', $k);
if (count($prop) < 2)
continue;
list($prop, $feed_id) = $prop;
if (empty($allow_prop[$prop]))
continue;
if (!($feed = fof_db_get_feed_by_id($feed_id)))
continue;
@ -87,13 +90,13 @@ if (isset($_REQUEST['tagfeeds']))
}
}
// 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))
$message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown collapsed 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))
$message[] = 'Items of feed \''.htmlspecialchars($_REQUEST["title_$feed_id"]).'\' will be shown expanded by default';