Fix some more notices

master
Vitaliy Filippov 2014-12-09 16:07:00 +03:00
parent 83c00eddc8
commit 4a68c2889f
4 changed files with 37 additions and 22 deletions

20
add.php
View File

@ -16,13 +16,13 @@
include("header.php");
$url = $_REQUEST['rss_url'];
$new_tags = $_REQUEST['new_tags'];
$login = $_REQUEST['basic_login'];
$password = $_REQUEST['basic_password'];
$opml = $_REQUEST['opml_url'];
$file = $_POST['opml_file'];
$unread = $_REQUEST['unread'];
$url = @$_REQUEST['rss_url'];
$new_tags = @$_REQUEST['new_tags'];
$login = @$_REQUEST['basic_login'];
$password = @$_REQUEST['basic_password'];
$opml = @$_REQUEST['opml_url'];
$file = @$_POST['opml_file'];
$unread = @$_REQUEST['unread'];
if ($url && !preg_match('!^[a-z0-9_]+://!is', $url))
$url = "http://$url";
@ -32,7 +32,7 @@ if ($login == '%user%')
$feeds = array();
if ($_REQUEST['do'])
if (!empty($_REQUEST['do']))
{
if ($opml)
{
@ -55,7 +55,7 @@ if ($_REQUEST['do'])
$url = preg_replace('!^([a-z0-9_]+)://([^/]*:[^/]*@)?!is', '\1://', $url);
if ($_FILES['opml_file']['tmp_name'])
if (!empty($_FILES['opml_file']['tmp_name']))
{
if(!$content_array = file($_FILES['opml_file']['tmp_name']))
{
@ -69,7 +69,7 @@ if ($_FILES['opml_file']['tmp_name'])
}
$add_feed_url = "http";
if($_SERVER["HTTPS"] == "on")
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
$add_feed_url = "https";
$add_feed_url .= "://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
?>

View File

@ -441,19 +441,25 @@ function fof_db_get_items($user_id = 1, $feed = NULL, $what = "unread",
function fof_db_get_item($user_id, $item_id)
{
global $FOF_SUBSCRIPTION_TABLE, $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $FOF_TAG_TABLE;
global $FOF_FEED_TABLE, $FOF_ITEM_TABLE, $FOF_ITEM_TAG_TABLE, $FOF_TAG_TABLE;
$query = "select $FOF_FEED_TABLE.feed_image as feed_image, $FOF_FEED_TABLE.feed_title as feed_title, $FOF_FEED_TABLE.feed_link as feed_link, $FOF_FEED_TABLE.feed_description as feed_description, $FOF_ITEM_TABLE.item_id as item_id, $FOF_ITEM_TABLE.item_link as item_link, $FOF_ITEM_TABLE.item_title as item_title, $FOF_ITEM_TABLE.item_cached, $FOF_ITEM_TABLE.item_published, $FOF_ITEM_TABLE.item_updated, $FOF_ITEM_TABLE.item_content as item_content from $FOF_FEED_TABLE, $FOF_ITEM_TABLE where $FOF_ITEM_TABLE.feed_id=$FOF_FEED_TABLE.feed_id and $FOF_ITEM_TABLE.item_id = %d";
$query = "select f.feed_image, f.feed_title, f.feed_link, f.feed_description, i.*".
" from $FOF_FEED_TABLE f, $FOF_ITEM_TABLE i where i.feed_id=f.feed_id and i.item_id = %d";
$result = fof_safe_query($query, $item_id);
$item = mysql_fetch_assoc($result);
$item['tags'] = array();
if($user_id)
if ($user_id)
{
$result = fof_safe_query("select $FOF_TAG_TABLE.tag_name from $FOF_TAG_TABLE, $FOF_ITEM_TAG_TABLE where $FOF_TAG_TABLE.tag_id = $FOF_ITEM_TAG_TABLE.tag_id and $FOF_ITEM_TAG_TABLE.item_id = %d and $FOF_ITEM_TAG_TABLE.user_id = %d", $item_id, $user_id);
while($row = fof_db_get_row($result))
$result = fof_safe_query(
"select t.tag_name from $FOF_TAG_TABLE t, $FOF_ITEM_TAG_TABLE it".
" where t.tag_id = it.tag_id and it.item_id = %d and it.user_id = %d", $item_id, $user_id
);
while ($row = fof_db_get_row($result))
{
$item['tags'][] = $row['tag_name'];
}
}
return $item;

View File

@ -380,20 +380,24 @@ function fof_get_feeds($user_id, $order = 'feed_title', $direction = 'asc')
function fof_feed_title($feed, $prefs = NULL)
{
if (!$prefs)
if (!$prefs && !empty($feed['prefs']))
{
$prefs = $feed['prefs'];
}
if (!$prefs)
{
$prefs = fof_db_get_subscription_prefs(fof_current_user(), $feed['feed_id']);
}
$t = !empty($prefs['feed_title']) ? $prefs['feed_title'] : $feed['feed_title'];
return $t;
}
function fof_view_title($feed=NULL, $what="new", $when=NULL, $start=NULL, $limit=NULL, $search=NULL)
function fof_view_title($feed = NULL, $what = "new", $when = NULL, $start = NULL, $limit = NULL, $search = NULL)
{
$prefs = fof_prefs();
$title = "feed on feeds";
if(!is_null($when) && $when != "")
if (!is_null($when) && $when != "")
{
$title .= ' - ' . $when;
}
@ -991,10 +995,12 @@ function fof_get_widgets($item)
return false;
}
foreach($fof_item_widgets as $widget)
$widgets = array();
foreach ($fof_item_widgets as $widget)
{
$w = $widget($item);
if($w) $widgets[] = $w;
if ($w)
$widgets[] = $w;
}
return $widgets;

View File

@ -17,8 +17,11 @@ include_once("fof-render.php");
fof_set_content_type();
if (empty($_GET['id']))
{
die("No post ID");
}
$row = fof_get_item(fof_current_user(), $_GET['id']);
fof_render_item($row);
?>