Fix more notices, one of which was actually caused by a bug

master
Vitaliy Filippov 2014-12-10 13:28:29 +03:00
parent ba549ca6ef
commit 8469014d18
5 changed files with 164 additions and 157 deletions

View File

@ -482,12 +482,12 @@ function fof_db_get_subscription_to_tags()
{
$prefs = unserialize($row['subscription_prefs']);
$tags = $prefs['tags'];
if(!is_array($r[$row['feed_id']]))
if (!isset($r[$row['feed_id']]))
$r[$row['feed_id']] = array();
$r[$row['feed_id']][$row['user_id']] = $tags;
if ($prefs['filter'])
if (!empty($prefs['filter']))
{
if(!is_array($r['filter'][$row['feed_id']]))
if (!isset($r['filter'][$row['feed_id']]))
$r['filter'][$row['feed_id']] = array();
$r['filter'][$row['feed_id']][$row['user_id']] = $prefs['filter'];
}
@ -768,10 +768,11 @@ function fof_db_get_users()
$result = fof_safe_query("select user_name, user_id, user_prefs from $FOF_USER_TABLE");
while($row = fof_db_get_row($result))
$users = array();
while ($row = fof_db_get_row($result))
{
$users[$row['user_id']['user_name']] = $row['user_name'];
$users[$row['user_id']['user_prefs']] = unserialize($row['user_prefs']);
$users[$row['user_id']]['user_name'] = $row['user_name'];
$users[$row['user_id']]['user_prefs'] = unserialize($row['user_prefs']);
}
}

View File

@ -686,9 +686,12 @@ function fof_apply_tags($item)
$filtered[$user_id] = true;
// regexp filter items
foreach((array)$fof_subscription_to_tags['filter'][$item['feed_id']] as $user_id => $filter)
if ($filter && (preg_match($filter, $title) || preg_match($filter, $content)))
$filtered[$user_id] = true;
if (isset($fof_subscription_to_tags['filter'][$item['feed_id']]))
{
foreach ((array)$fof_subscription_to_tags['filter'][$item['feed_id']] as $user_id => $filter)
if ($filter && (preg_match($filter, $title) || preg_match($filter, $content)))
$filtered[$user_id] = true;
}
// mark item as unread for some users
fof_db_mark_item_unread($item['item_id'], array_keys($filtered));
@ -749,7 +752,7 @@ function fof_update_feed($id, $as_user = NULL)
$feed_id = $feed['feed_id'];
$n = 0;
if ($feed['feed_filter'])
if (!empty($feed['feed_filter']))
{
$filter = @unserialize($feed['feed_filter']);
if (!$filter || !$filter['re'] || !$filter['tags'])
@ -827,7 +830,8 @@ function fof_update_feed($id, $as_user = NULL)
$p = FoF_Prefs::instance();
$admin_prefs = $p->admin_prefs;
if($admin_prefs['purge'] != "")
$ndelete = 0;
if ($admin_prefs['purge'] != "")
{
fof_log('purge is ' . $admin_prefs['purge']);
$count = count($ids);

View File

@ -1,9 +1,10 @@
<?php
<?php
fof_add_item_prefilter('fof_enclosures');
function fof_enclosures($item, $link, $title, $content)
{
$html = '';
if ($enclosure = $item->get_enclosure(0))
{
$html = '<br><br><a href="#" onclick="show_enclosure(event); return false;">show enclosure</a><div style="display: none" align="center" width="auto">';
@ -13,17 +14,14 @@ function fof_enclosures($item, $link, $title, $content)
'mediaplayer' => 'plugins/mediaplayer.swf',
'alt' => '<img src="plugins/mini_podcast.png" class="download" border="0" title="Download the Podcast (' . $enclosure->get_extension() . '; ' . $enclosure->get_size() . ' MB)" />',
'altclass' => 'download'
)) . '</p>';
)) . '</p>';
$html .= '<i align="center">(' . $enclosure->get_type();
if ($enclosure->get_size())
{
$html .= '; ' . $enclosure->get_size() . ' MB';
}
$html .= ')</i>';
if ($enclosure->get_size())
{
$html .= '; ' . $enclosure->get_size() . ' MB';
}
$html .= ')</i>';
$html .= '</div>';
}
return array($link, $title, $content . $html);
return array($link, $title, $content . $html);
}
?>

View File

@ -1987,7 +1987,9 @@ class SimplePie
}
else
{
$file = new $this->file_class($favicon, $this->timeout / 10, 5, array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']), $this->useragent, $this->force_fsockopen);
$file = new $this->file_class($favicon, $this->timeout / 10, 5,
isset($_SERVER['REMOTE_ADDR']) ? array('X-FORWARDED-FOR' => $_SERVER['REMOTE_ADDR']) : array(),
$this->useragent, $this->force_fsockopen);
if ($file->success && ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
{

File diff suppressed because it is too large Load Diff