fix one notice and fof_db_mark_feed_unread
parent
72a92ba7ac
commit
b67e31022c
|
@ -14,15 +14,15 @@
|
||||||
|
|
||||||
include_once("fof-main.php");
|
include_once("fof-main.php");
|
||||||
|
|
||||||
$url = $_REQUEST['url'];
|
$url = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
|
||||||
$tags = $_REQUEST['tags'];
|
$tags = isset($_REQUEST['tags']) ? $_REQUEST['tags'] : '';
|
||||||
$unread = $_REQUEST['unread'];
|
$unread = isset($_REQUEST['unread']) ? $_REQUEST['unread'] : '';
|
||||||
|
|
||||||
list($error, $feed) = fof_subscribe(fof_current_user(), $url, $unread);
|
list($error, $feed) = fof_subscribe(fof_current_user(), $url, $unread);
|
||||||
$error .= '<br />';
|
$error .= '<br />';
|
||||||
foreach (preg_split("/[\s,]*,[\s,]*/", $tags) as $tag)
|
foreach (preg_split("/[\s,]*,[\s,]*/", $tags) as $tag)
|
||||||
{
|
{
|
||||||
if ($tag)
|
if ($tag !== '')
|
||||||
{
|
{
|
||||||
fof_tag_feed(fof_current_user(), $feed['feed_id'], $tag);
|
fof_tag_feed(fof_current_user(), $feed['feed_id'], $tag);
|
||||||
$error .= 'Tagged \''.htmlspecialchars($feed['feed_title']).'\' as '.htmlspecialchars($tag).'<br />';
|
$error .= 'Tagged \''.htmlspecialchars($feed['feed_title']).'\' as '.htmlspecialchars($tag).'<br />';
|
||||||
|
@ -30,9 +30,11 @@ foreach (preg_split("/[\s,]*,[\s,]*/", $tags) as $tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/HTTP 401/', $error))
|
if (preg_match('/HTTP 401/', $error))
|
||||||
|
{
|
||||||
print "<script>
|
print "<script>
|
||||||
document.addform.basic_login.style.backgroundColor='#FFC0C0';
|
document.addform.basic_login.style.backgroundColor='#FFC0C0';
|
||||||
document.addform.basic_password.style.backgroundColor='#FFC0C0';
|
document.addform.basic_password.style.backgroundColor='#FFC0C0';
|
||||||
document.addform.basic_password.focus();
|
document.addform.basic_password.focus();
|
||||||
</script>";
|
</script>";
|
||||||
|
}
|
||||||
print $error;
|
print $error;
|
||||||
|
|
10
fof-db.php
10
fof-db.php
|
@ -514,14 +514,20 @@ function fof_db_set_subscription_prefs($user_id, $feed_id, $prefs)
|
||||||
// tag feed and all its items
|
// tag feed and all its items
|
||||||
function fof_db_tag_feed($user_id, $feed_id, $tag_id)
|
function fof_db_tag_feed($user_id, $feed_id, $tag_id)
|
||||||
{
|
{
|
||||||
global $FOF_ITEM_TAG_TABLE, $FOF_ITEM_TABLE;
|
|
||||||
$prefs = fof_db_get_subscription_prefs($user_id, $feed_id);
|
$prefs = fof_db_get_subscription_prefs($user_id, $feed_id);
|
||||||
if(!is_array($prefs['tags']) || !in_array($tag_id, $prefs['tags']))
|
if(!is_array($prefs['tags']) || !in_array($tag_id, $prefs['tags']))
|
||||||
$prefs['tags'][] = $tag_id;
|
$prefs['tags'][] = $tag_id;
|
||||||
fof_db_set_subscription_prefs($user_id, $feed_id, $prefs);
|
fof_db_set_subscription_prefs($user_id, $feed_id, $prefs);
|
||||||
|
fof_db_tag_feed_items($user_id, $feed_id, $tag_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fof_db_tag_feed_items($user_id, $feed_id, $tag_id, $since = 0)
|
||||||
|
{
|
||||||
|
global $FOF_ITEM_TAG_TABLE, $FOF_ITEM_TABLE;
|
||||||
fof_safe_query(
|
fof_safe_query(
|
||||||
"insert into $FOF_ITEM_TAG_TABLE (tag_id, user_id, item_id, item_published, feed_id)".
|
"insert into $FOF_ITEM_TAG_TABLE (tag_id, user_id, item_id, item_published, feed_id)".
|
||||||
" select %d, %d, item_id, item_published, feed_id from $FOF_ITEM_TABLE where feed_id=%d".
|
" select %d, %d, item_id, item_published, feed_id from $FOF_ITEM_TABLE where feed_id=%d".
|
||||||
|
($since ? " and item_published >= ".$since : '').
|
||||||
" on duplicate key update item_published=values(item_published)",
|
" on duplicate key update item_published=values(item_published)",
|
||||||
$tag_id, $user_id, $feed_id
|
$tag_id, $user_id, $feed_id
|
||||||
);
|
);
|
||||||
|
@ -713,7 +719,7 @@ function fof_db_mark_feed_read($user_id, $feed_id)
|
||||||
|
|
||||||
function fof_db_mark_feed_unread($user_id, $feed_id, $what)
|
function fof_db_mark_feed_unread($user_id, $feed_id, $what)
|
||||||
{
|
{
|
||||||
fof_db_tag_feed($user_id, $feed_id, 1);
|
fof_db_tag_feed_items($user_id, $feed_id, 1, $what == 'today' ? mktime(0, 0, 0, date('n'), date('j'), date('Y')) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function fof_db_mark_item_unread($id, $except_users = array())
|
function fof_db_mark_item_unread($id, $except_users = array())
|
||||||
|
|
|
@ -322,7 +322,7 @@ foreach($feeds as $row)
|
||||||
</td>
|
</td>
|
||||||
<td><input class="editbox" type="text" name="tag_<?=$id?>" /></td>
|
<td><input class="editbox" type="text" name="tag_<?=$id?>" /></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="orighide_<?=$id?>" value="<?=$row['prefs']['hide_content'] ? 1 : 0?>" />
|
<input type="hidden" name="orighide_<?=$id?>" value="<?=!empty($row['prefs']['hide_content']) ? 1 : 0?>" />
|
||||||
<input type="checkbox" value="1" name="hide_<?=$id?>" title="Hide item content by default" <?= !empty($row['prefs']['hide_content']) ? "checked" : ""?> /><label for="hide_<?=$id?>" title="Hide item content by default">Hide</label> |
|
<input type="checkbox" value="1" name="hide_<?=$id?>" title="Hide item content by default" <?= !empty($row['prefs']['hide_content']) ? "checked" : ""?> /><label for="hide_<?=$id?>" title="Hide item content by default">Hide</label> |
|
||||||
<span id="fspan<?=$id?>" style="display:none">Filter: <input class="editbox" type="text" name="filter_<?=$id?>" value="<?=$flt?>" /></span>
|
<span id="fspan<?=$id?>" style="display:none">Filter: <input class="editbox" type="text" name="filter_<?=$id?>" value="<?=$flt?>" /></span>
|
||||||
<span id="ftspan<?=$id?>"><a id="fa<?=$id?>" href="javascript:show_filter('<?=$id?>')">Filter</a><?=$flt ? ": $flt" : ""?></span>
|
<span id="ftspan<?=$id?>"><a id="fa<?=$id?>" href="javascript:show_filter('<?=$id?>')">Filter</a><?=$flt ? ": $flt" : ""?></span>
|
||||||
|
|
Loading…
Reference in New Issue