diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 62f4eeb1f8..7cdaf0fec0 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -92,7 +92,7 @@
[Fix] Sorting by author or subject on viewtopic now preserves the order. (Bug #44875)
[Fix] Correctly determine writable status of files on Windows operating system. (Bug #39035)
[Fix] Show report button in prosilver for guests who are allowed to report posts. (Bug #45695 - Patch by bantu)
- [Fix] Correctly show private message history (Bug #46065 - Patch by bantu)
+ [Fix] Correctly show private message history (Bug #46065 - Patch by bantu)
[Fix] Various XHTML mistakes in prosilver, subsilver2 and the ACP. (Bugs #25545 - Patch by bantu, #26315, #38555, #45505 - Patch by Raimon, #45785, #45865)
[Fix] Move post bump information markup to the template. (Bug #34295 - Patch by bantu)
[Fix] Show error in the ACP when template folder is not readable. (Bug #45705 - Patch by bantu)
@@ -114,6 +114,7 @@
eAccelerator
+ [Feature] ATOM Feeds (Idea and diversed from RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21)
1.ii. Changes since 3.0.4
diff --git a/phpBB/feed.php b/phpBB/feed.php
new file mode 100644
index 0000000000..1d4e26aaab
--- /dev/null
+++ b/phpBB/feed.php
@@ -0,0 +1,1001 @@
+session_begin();
+$auth->acl($user->data);
+$user->setup();
+
+// Initial var setup
+$forum_id = request_var('f', 0);
+$topic_id = request_var('t', 0);
+$mode = request_var('mode', '');
+
+// Feed date format for PHP > 5 and PHP4
+$feed_date_format = (PHP_VERSION >= 5) ? 'c' : "Y-m-d\TH:i:sO";
+$params = false;
+
+// We do not use a template, therefore we simply define the global template variables here
+$global_vars = $item_vars = array();
+
+// Generate params array for use in append_sid() to correctly link back to this page
+if ($forum_id || $topic_id || $mode)
+{
+ $params = array(
+ 'f' => ($forum_id) ? $forum_id : NULL,
+ 't' => ($topic_id) ? $topic_id : NULL,
+ 'mode' => ($mode) ? $mode : NULL,
+ );
+}
+
+// This boards URL
+$board_url = generate_board_url();
+
+// Get correct feed object
+$feed = phpbb_feed_factory::init($mode, $forum_id, $topic_id);
+
+// No feed found
+if ($feed === false)
+{
+ trigger_error('NO_FEED');
+}
+
+// Open Feed
+$feed->open();
+
+// Some default assignments
+// FEED_IMAGE is not used (atom)
+$global_vars = array(
+ 'FEED_IMAGE' => ($user->img('site_logo', '', false, '', 'src')) ? $board_url . '/' . substr($user->img('site_logo', '', false, '', 'src'), strlen($phpbb_root_path)) : '',
+ 'SELF_LINK' => feed_append_sid('/feed.' . $phpEx, $params),
+ 'FEED_LINK' => $board_url . '/index.' . $phpEx,
+ 'FEED_TITLE' => $config['sitename'],
+ 'FEED_SUBTITLE' => $config['site_desc'],
+ 'FEED_UPDATED' => $user->format_date(time(), $feed_date_format, true),
+ 'FEED_LANG' => $user->lang['USER_LANG'],
+ 'FEED_AUTHOR' => $config['sitename'],
+);
+
+// Iterate through items
+while ($row = $feed->get_item())
+{
+ // BBCode options to correctly disable urls, smilies, bbcode...
+ if ($feed->get('options') === NULL)
+ {
+ // Allow all combinations
+ $options = 7;
+
+ if ($feed->get('enable_bbcode') !== NULL && $feed->get('enable_smilies') !== NULL && $feed->get('enable_magic_url') !== NULL)
+ {
+ $options = (($row[$feed->get('enable_bbcode')]) ? OPTION_FLAG_BBCODE : 0) + (($row[$feed->get('enable_smilies')]) ? OPTION_FLAG_SMILIES : 0) + (($row[$feed->get('enable_magic_url')]) ? OPTION_FLAG_LINKS : 0);
+ }
+ }
+ else
+ {
+ $options = $row[$feed->get('options')];
+ }
+
+ $title = ($row[$feed->get('title')]) ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : '');
+ $title = censor_text($title);
+
+ $item_row = array(
+ 'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
+ 'pubdate' => $user->format_date($row[$feed->get('date')], $feed_date_format, true),
+ 'link' => '',
+ 'title' => censor_text($title),
+ 'category' => ($config['feed_item_statistics']) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
+ 'category_name' => ($config['feed_item_statistics']) ? utf8_htmlspecialchars($row['forum_name']) : '',
+ 'description' => censor_text(feed_generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options)),
+ 'statistics' => '',
+ );
+
+ // Adjust items, fill link, etc.
+ $feed->adjust_item($item_row, $row);
+
+ $item_vars[] = $item_row;
+}
+
+$feed->close();
+
+// Output page
+
+// gzip_compression
+if ($config['gzip_compress'])
+{
+ if (@extension_loaded('zlib') && !headers_sent())
+ {
+ ob_start('ob_gzhandler');
+ }
+}
+
+// IF debug extra is enabled and admin want to "explain" the page we need to set other headers...
+if (!defined('DEBUG_EXTRA') || !request_var('explain', 0) || !$auth->acl_get('a_'))
+{
+ header("Content-Type: application/atom+xml; charset=UTF-8");
+ header("Last-Modified: " . gmdate('D, d M Y H:i:s', time()) . ' GMT');
+}
+else
+{
+ header('Content-type: text/html; charset=UTF-8');
+ header('Cache-Control: private, no-cache="set-cookie"');
+ header('Expires: 0');
+ header('Pragma: no-cache');
+
+ $mtime = explode(' ', microtime());
+ $totaltime = $mtime[0] + $mtime[1] - $starttime;
+
+ if (method_exists($db, 'sql_report'))
+ {
+ $db->sql_report('display');
+ }
+
+ garbage_collection();
+ exit_handler();
+}
+
+echo '' . "\n";
+echo '' . "\n";
+echo ' ' . "\n\n";
+
+echo (!empty($global_vars['FEED_TITLE'])) ? '' . $global_vars['FEED_TITLE'] . ' ' . "\n" : '';
+echo (!empty($global_vars['FEED_SUBTITLE'])) ? '' . $global_vars['FEED_SUBTITLE'] . ' ' . "\n" : '';
+echo (!empty($global_vars['FEED_LINK'])) ? ' ' . "\n" : '';
+echo '' . $global_vars['FEED_UPDATED'] . ' ' . "\n\n";
+
+echo '' . $global_vars['FEED_AUTHOR'] . ' ' . "\n";
+echo '' . $global_vars['SELF_LINK'] . ' ' . "\n";
+
+foreach ($item_vars as $row)
+{
+ echo '' . "\n";
+
+ if (!empty($row['author']))
+ {
+ echo '' . $row['author'] . ' ' . "\n";
+ }
+
+ echo '' . $row['pubdate'] . ' ' . "\n";
+ echo '' . $row['link'] . ' ' . "\n";
+ echo ' ' . "\n";
+ echo '' . $row['title'] . ' ' . "\n\n";
+
+ if (!empty($row['category']))
+ {
+ echo ' ' . "\n";
+ }
+
+ echo '' . "\n";
+ echo '' . "\n";
+ echo $row['description'];
+
+ if (!empty($row['statistics']))
+ {
+ echo '
' . $user->lang['STATISTICS'] . ': ' . $row['statistics'] . '
';
+ }
+
+ echo '
' . "\n" . ' ' . "\n";
+ echo ' ' . "\n";
+}
+
+echo ' ';
+
+garbage_collection();
+exit_handler();
+
+/**
+* Run links through append_sid(), prepend generate_board_url() and remove session id
+**/
+function feed_append_sid($url, $params)
+{
+ global $board_url;
+
+ $link = append_sid($board_url . $url, $params);
+
+ // Remove added sid - not as easy as it sounds. ;)
+ return (strpos($link, 'sid=') !== false) ? trim(preg_replace('/(&|&|\?)sid=[a-z0-9]+(&|&)?/', '\1', $link), '?& ') : $link;
+}
+
+/**
+* Generate text content
+**/
+function feed_generate_content($content, $uid, $bitfield, $options)
+{
+ global $user, $config, $phpbb_root_path, $phpEx, $board_url;
+
+ if (empty($content))
+ {
+ return '';
+ }
+
+ // Prepare some bbcodes for better parsing
+ $content = preg_replace("#\[quote(=".*?")?:$uid\]\s*(.*?)\s*\[/quote:$uid\]#si", "[quote$1:$uid] $2 [/quote:$uid]", $content);
+
+ $content = generate_text_for_display($content, $uid, $bitfield, $options);
+
+ // Relative Path to Absolute path, Windows style
+ $content = str_replace('./', $board_url . '/', $content);
+
+ // Remove "Select all" link and mouse events
+ $content = str_replace('' .$user->lang['SELECT_ALL_CODE'] . ' ', '', $content);
+ $content = preg_replace('#(onkeypress|onclick)="(.*?)"#si', '', $content);
+
+ // Remove font sizes
+ $content = preg_replace('#([^>]+) #iU', '\1', $content);
+
+ // Make text strong :P
+ $content = preg_replace('#([^<]+) #iU', '\1 ', $content);
+
+ // Italic
+ $content = preg_replace('#([^<]+) #iU', '\1 ', $content);
+
+ // Underline
+ $content = preg_replace('#([^<]+) #iU', '\1 ', $content);
+
+ // Remove embed Windows Media Streams
+ $content = preg_replace( '#<\!--\[if \!IE\]>-->([^[]+)<\!--#si', '', $content);
+
+ // Do not use < and >, because we want to retain code contained in [code][/code]
+
+ // Remove embed and objects
+ $content = preg_replace( '#<(object|embed)(.*?) (value|src)=(.*?) ([^[]+)(object|embed)>#si',' $1 ',$content);
+
+ // Remove some specials html tag, because somewhere there are a mod to allow html tags ;)
+ $content = preg_replace( '#<(script|iframe)([^[]+)\1>#siU', ' $1 ', $content);
+
+ // Remove Comments from inline attachments [ia]
+ $content = preg_replace('#(.*?)(.*?)(.*?)
#si','$4',$content);
+
+ // Replace some entities with their unicode counterpart
+ $entities = array(
+ ' ' => ' ',
+ '•' => '•',
+ '·' => '·',
+ '©' => '©',
+ );
+
+ $content = str_replace(array_keys($entities), array_values($entities), $content);
+
+ // Other control characters
+ // $content = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $content);
+
+ return $content;
+}
+
+/**
+* Factory class to return correct object
+* @package phpBB3
+*/
+class phpbb_feed_factory
+{
+ /**
+ * Return correct object for specified mode
+ *
+ * @param string $mode The feeds mode.
+ * @param int $forum_id Forum id specified by the script if forum feed provided.
+ * @param int $topic_id Topic id specified by the script if topic feed provided.
+ *
+ * @return object Returns correct feeds object for specified mode.
+ */
+ function init($mode, $forum_id, $topic_id)
+ {
+ global $config;
+
+ switch ($mode)
+ {
+ case 'forums':
+ if (!$config['feed_overall_forums'])
+ {
+ return false;
+ }
+
+ return new phpbb_feed_forums();
+ break;
+
+ case 'topics':
+ if (!$config['feed_overall_topics'])
+ {
+ return false;
+ }
+
+ return new phpbb_feed_topics();
+ break;
+
+ case 'news':
+ if (empty($config['feed_news_id']))
+ {
+ return false;
+ }
+
+ return new phpbb_feed_news();
+ break;
+
+ default:
+ // Forum and/or topic specified?
+ if ($topic_id && !$config['feed_topic'])
+ {
+ return false;
+ }
+
+ if ($forum_id && !$topic_id && !$config['feed_forum'])
+ {
+ return false;
+ }
+
+ return new phpbb_feed($forum_id, $topic_id);
+ break;
+ }
+ }
+}
+
+/**
+* Base/default Feed class if no mode is specified.
+* This can be the overall site feed or a forum/topic feed.
+* @package phpBB3
+*/
+class phpbb_feed
+{
+ /**
+ * Forum id specified for forum feed.
+ */
+ var $forum_id = 0;
+
+ /**
+ * Topic id specified for topic feed.
+ */
+ var $topic_id = 0;
+
+ /**
+ * SQL Query to be executed to get feed items
+ */
+ var $sql;
+
+ /**
+ * Keys specified for retrieval of title, content, etc.
+ */
+ var $keys = array();
+
+ /**
+ * An array of excluded forum ids.
+ */
+ var $excluded_forums_ary = NULL;
+
+ /**
+ * Number of items to fetch
+ */
+ var $num_items;
+
+ /**
+ * boolean to determine if items array is filled or not
+ */
+ var $items_filled = false;
+
+ /**
+ * array holding items
+ */
+ var $items = array();
+
+ /**
+ * Default setting for last x days
+ */
+ var $sort_days = 100;
+
+ /**
+ * Default cache time of entries in seconds
+ */
+ var $cache_time = 300;
+
+ /**
+ * Constructor. Set standard keys.
+ */
+ function phpbb_feed($forum_id = 0, $topic_id = 0)
+ {
+ global $config;
+
+ $this->forum_id = $forum_id;
+ $this->topic_id = $topic_id;
+
+ $this->sql = array();
+
+ // Set some values for pagination
+ $this->num_items = $config['feed_limit'];
+ $this->set_keys();
+ }
+
+ function set_keys()
+ {
+ // Set keys for items...
+ $this->set('title', 'post_subject');
+ $this->set('title2', 'topic_title');
+ $this->set('author_id', 'user_id');
+ $this->set('creator', 'username');
+ $this->set('text', 'post_text');
+ $this->set('bitfield', 'bbcode_bitfield');
+ $this->set('bbcode_uid','bbcode_uid');
+ $this->set('date', 'post_time');
+
+ $this->set('enable_bbcode', 'enable_bbcode');
+ $this->set('enable_smilies', 'enable_smilies');
+ $this->set('enable_magic_url', 'enable_magic_url');
+ }
+
+ function open()
+ {
+ if (!$this->forum_id && !$this->topic_id)
+ {
+ return;
+ }
+ else if ($this->forum_id && !$this->topic_id)
+ {
+ global $db, $user, $global_vars;
+
+ $sql = 'SELECT forum_name
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_id = ' . $this->forum_id;
+ $result = $db->sql_query($sql);
+
+ $global_vars['FEED_MODE'] = $user->lang['FORUM'] . ': ' . $db->sql_fetchfield('forum_name');
+
+ $db->sql_freeresult($result);
+ }
+ else if ($this->topic_id)
+ {
+ global $db, $user, $global_vars;
+
+ $sql = 'SELECT topic_title
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_id = ' . $this->topic_id;
+ $result = $db->sql_query($sql);
+
+ $global_vars['FEED_MODE'] = $user->lang['TOPIC'] . ': ' . $db->sql_fetchfield('topic_title');
+
+ $db->sql_freeresult($result);
+ }
+ }
+
+ function close()
+ {
+ if (!empty($this->result))
+ {
+ global $db;
+
+ $db->sql_freeresult($this->result);
+ }
+ }
+
+ /**
+ * Set key
+ */
+ function set($key, $value)
+ {
+ $this->keys[$key] = $value;
+ }
+
+ /**
+ * Get key
+ */
+ function get($key)
+ {
+ return (isset($this->keys[$key])) ? $this->keys[$key] : NULL;
+ }
+
+ /**
+ * Return array of excluded forums
+ */
+ function excluded_forums()
+ {
+ if ($this->excluded_forums_ary !== NULL)
+ {
+ return $this->excluded_forums_ary;
+ }
+
+ global $auth, $db, $config, $phpbb_root_path, $phpEx, $user;
+
+ // Which forums should not be searched ?
+ $exclude_forums = (!empty($config['feed_exclude_id'])) ? unserialize(trim($config['feed_exclude_id'])) : array();
+
+ // Exclude forums the user is not able to read
+ $this->excluded_forums_ary = array_keys($auth->acl_getf('!f_read', true));
+ $this->excluded_forums_ary = (sizeof($exclude_forums)) ? array_merge($exclude_forums, $this->excluded_forums_ary) : $this->excluded_forums_ary;
+
+ $not_in_fid = (sizeof($this->excluded_forums_ary)) ? 'WHERE (' . $db->sql_in_set('f.forum_id', $this->excluded_forums_ary, true) . ' AND ' . $db->sql_in_set('f.parent_id', $this->excluded_forums_ary, true) . ") OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : '';
+
+ $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, fa.user_id
+ FROM ' . FORUMS_TABLE . ' f
+ LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id
+ AND fa.session_id = '" . $db->sql_escape($user->session_id) . "')
+ $not_in_fid
+ ORDER BY f.left_id";
+ $result = $db->sql_query($sql);
+
+ $right_id = 0;
+ while ($row = $db->sql_fetchrow($result))
+ {
+ // Exclude passworded forum completely
+ if ($row['forum_password'] && $row['user_id'] != $user->data['user_id'])
+ {
+ $this->excluded_forums_ary[] = (int) $row['forum_id'];
+ continue;
+ }
+
+ if ($row['right_id'] > $right_id)
+ {
+ $right_id = (int) $row['right_id'];
+ }
+ else if ($row['right_id'] < $right_id)
+ {
+ continue;
+ }
+ }
+ $db->sql_freeresult($result);
+
+ return $this->excluded_forums_ary;
+ }
+
+ /**
+ * Get SQL query for fetching items
+ */
+ function get_sql()
+ {
+ global $db;
+
+ $post_ids = array();
+
+ // Search for topics in last 7 days
+ $last_post_time_sql = ($this->sort_days) ? ' AND t.topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : '';
+
+ // Fetch latest post, grouped by topic...
+ if (!$this->forum_id && !$this->topic_id)
+ {
+ // First of all, the post ids...
+ $not_in_fid = (sizeof($this->excluded_forums())) ? ' AND ' . $db->sql_in_set('t.forum_id', $this->excluded_forums(), true) : '';
+
+ $sql = 'SELECT t.topic_last_post_id
+ FROM ' . TOPICS_TABLE . ' t
+ WHERE t.topic_approved = 1
+ AND t.topic_moved_id = 0' .
+ $not_in_fid .
+ $last_post_time_sql . '
+ ORDER BY t.topic_last_post_time DESC';
+ $result = $db->sql_query_limit($sql, $this->num_items);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_ids[] = $row['topic_last_post_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+ // Fetch latest posts from forum
+ else if (!$this->topic_id && $this->forum_id)
+ {
+ // Make sure the forum is not listed within the forbidden ones. ;)
+ if (in_array($this->forum_id, $this->excluded_forums()))
+ {
+ return false;
+ }
+
+ // Determine which forums to fetch
+ $not_in_fid = (sizeof($this->excluded_forums())) ? ' AND ' . $db->sql_in_set('f1.forum_id', $this->excluded_forums(), true) : '';
+
+ // Determine forum childs...
+ $sql = 'SELECT f2.forum_id
+ FROM ' . FORUMS_TABLE . ' f1, ' . FORUMS_TABLE . ' f2
+ WHERE f1.forum_id = ' . $this->forum_id . '
+ AND (f2.left_id BETWEEN f1.left_id AND f1.right_id' . $not_in_fid . ')';
+ $result = $db->sql_query($sql);
+
+ $forum_ids = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forum_ids[] = $row['forum_id'];
+ }
+ $db->sql_freeresult($result);
+
+ // Now select from forums...
+ $sql = 'SELECT t.topic_last_post_id
+ FROM ' . TOPICS_TABLE . ' t
+ WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . '
+ AND t.topic_approved = 1
+ AND t.topic_moved_id = 0' .
+ $last_post_time_sql . '
+ ORDER BY t.topic_last_post_time DESC';
+ $result = $db->sql_query_limit($sql, $this->num_items);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_ids[] = $row['topic_last_post_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+ // Fetch last posts from specified topic...
+ else if ($this->topic_id)
+ {
+ // First of all, determine the forum...
+ $sql = 'SELECT forum_id
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_id = ' . $this->topic_id;
+ $result = $db->sql_query_limit($sql, 1);
+ $this->forum_id = (int) $db->sql_fetchfield('forum_id');
+ $db->sql_freeresult($result);
+
+ // non-global announcement
+ if ($this->forum_id && in_array($this->forum_id, $this->excluded_forums()))
+ {
+ return false;
+ }
+
+ $sql = 'SELECT post_id
+ FROM ' . POSTS_TABLE . '
+ WHERE topic_id = ' . $this->topic_id . '
+ AND post_approved = 1
+ ORDER BY post_time DESC';
+ $result = $db->sql_query_limit($sql, $this->num_items);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_ids[] = $row['post_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+
+ if (!sizeof($post_ids))
+ {
+ return false;
+ }
+
+ // Now build sql query for obtaining items
+ $this->sql = array(
+ 'SELECT' => 'f.forum_id, f.forum_name, f.forum_desc_options, ' .
+ 't.topic_last_post_time, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_views, ' .
+ 'p.post_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
+ 'u.username, u.user_id, u.user_email',
+ 'FROM' => array(
+ POSTS_TABLE => 'p',
+ TOPICS_TABLE => 't',
+ FORUMS_TABLE => 'f',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . '
+ AND f.forum_id = p.forum_id
+ AND t.topic_id = p.topic_id
+ AND u.user_id = p.poster_id',
+ 'ORDER_BY' => 'p.post_time DESC',
+ );
+
+ return true;
+ }
+
+ function get_item()
+ {
+ global $db, $cache;
+
+ if (!$this->cache_time)
+ {
+ if (empty($this->result))
+ {
+ if (!$this->get_sql())
+ {
+ return false;
+ }
+
+ // Query database
+ $sql = $db->sql_build_query('SELECT', $this->sql);
+ $this->result = $db->sql_query_limit($sql, $this->num_items);
+ }
+
+ return $db->sql_fetchrow($this->result);
+ }
+ else
+ {
+ if (empty($this->items_filled))
+ {
+ // Try to load result set...
+ $cache_filename = substr(get_class($this), strlen('phpbb_'));
+
+ if (($this->items = $cache->get('_' . $cache_filename)) === false)
+ {
+ $this->items = array();
+
+ if ($this->get_sql())
+ {
+ // Query database
+ $sql = $db->sql_build_query('SELECT', $this->sql);
+ $result = $db->sql_query_limit($sql, $this->num_items);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $this->items[] = $row;
+ }
+ $db->sql_freeresult($result);
+ }
+
+ $cache->put('_' . $cache_filename, $this->items, $this->cache_time);
+ }
+
+ $this->items_filled = true;
+ }
+
+ $row = array_shift($this->items);
+ return (!$row) ? false : $row;
+ }
+ }
+
+ function adjust_item(&$item_row, &$row)
+ {
+ global $phpEx, $config;
+
+ $item_row['title'] = (!$this->topic_id) ? $row['forum_name'] . ' | ' . $item_row['title'] : $item_row['title'];
+ $item_row['link'] = feed_append_sid('/viewtopic.' . $phpEx, "t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}");
+
+ if ($config['feed_item_statistics'])
+ {
+ global $user;
+
+ $user_link = '' . $row['username'] . ' ';
+
+ $time = ($this->topic_id) ? $row['post_time'] : $row['topic_time'];
+
+ $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $user_link . ' - ' . $user->format_date($time). ' - ' . $user->lang['REPLIES'] . ' ' . $row['topic_replies'] . ' - ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'];
+ }
+ }
+}
+
+class phpbb_feed_forums extends phpbb_feed
+{
+ function set_keys()
+ {
+ global $config;
+
+ $this->set('title', 'forum_name');
+ $this->set('text', 'forum_desc');
+ $this->set('bitfield', 'forum_desc_bitfield');
+ $this->set('bbcode_uid','forum_desc_uid');
+ $this->set('date', 'forum_last_post_time');
+ $this->set('options', 'forum_desc_options');
+
+ $this->num_items = $config['feed_overall_forums_limit'];
+ }
+
+ function open()
+ {
+ global $user, $global_vars;
+
+ $global_vars['FEED_MODE'] = $user->lang['FORUMS'];
+ }
+
+ function get_sql()
+ {
+ global $db;
+
+ $not_in_fid = (sizeof($this->excluded_forums())) ? ' AND ' . $db->sql_in_set('f.forum_id', $this->excluded_forums(), true) : '';
+
+ // Build SQL Query
+ $this->sql = array(
+ 'SELECT' => 'f.*',
+ 'FROM' => array(FORUMS_TABLE => 'f'),
+ 'WHERE' => 'f.forum_type = ' . FORUM_POST . '
+ AND (f.forum_last_post_id > 0' . $not_in_fid . ')',
+ 'ORDER_BY' => 'f.left_id',
+ );
+
+ return true;
+ }
+
+ function adjust_item(&$item_row, &$row)
+ {
+ global $phpEx, $config;
+
+ $item_row['link'] = feed_append_sid('/viewforum.' . $phpEx, 'f=' . $row['forum_id']);
+
+ if ($config['feed_item_statistics'])
+ {
+ global $user;
+
+ $item_row['statistics'] = sprintf($user->lang['TOTAL_TOPICS_OTHER'], $row['forum_topics']) . ' - ' . sprintf($user->lang['TOTAL_POSTS_OTHER'], $row['forum_posts']);
+ }
+ }
+}
+
+class phpbb_feed_news extends phpbb_feed
+{
+ function set_keys()
+ {
+ global $config;
+
+ $this->set('title', 'topic_title');
+ $this->set('title2', 'forum_name');
+ $this->set('author_id', 'topic_poster');
+ $this->set('creator', 'topic_first_poster_name');
+ $this->set('text', 'post_text');
+ $this->set('bitfield', 'bbcode_bitfield');
+ $this->set('bbcode_uid','bbcode_uid');
+ $this->set('date', 'topic_time');
+
+ $this->set('enable_bbcode', 'enable_bbcode');
+ $this->set('enable_smilies', 'enable_smilies');
+ $this->set('enable_magic_url', 'enable_magic_url');
+
+ $this->num_items = $config['feed_overall_forums_limit'];
+ }
+
+ function open()
+ {
+ global $user, $global_vars;
+
+ $global_vars['FEED_MODE'] = $user->lang['FEED_NEWS'];
+ }
+
+ function get_sql()
+ {
+ global $db, $config;
+
+ $in_fid_ary = unserialize(trim($config['feed_news_id']));
+
+ if (!sizeof($in_fid_ary))
+ {
+ return false;
+ }
+
+ // Build SQL Query
+ $this->sql = array(
+ 'SELECT' => 'f.forum_id, f.forum_password, f.forum_name, f.forum_topics, f.forum_posts, f.parent_id, f.left_id, f.right_id,
+ t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time,
+ p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url,
+ u.username, u.user_id, u.user_email',
+ 'FROM' => array(
+ TOPICS_TABLE => 't',
+ FORUMS_TABLE => 'f',
+ POSTS_TABLE => 'p',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => $db->sql_in_set('t.forum_id', $in_fid_ary) . '
+ AND f.forum_id = t.forum_id
+ AND p.post_id = t.topic_first_post_id
+ AND t.topic_poster = u.user_id',
+ 'ORDER_BY' => 't.topic_time DESC',
+ );
+
+ return true;
+ }
+
+ function adjust_item(&$item_row, &$row)
+ {
+ global $phpEx, $config;
+
+ $item_row['link'] = feed_append_sid('/viewtopic.' . $phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']);
+
+ if ($config['feed_item_statistics'])
+ {
+ global $user;
+
+ $user_link = '' . $row[$this->get('creator')] . ' ';
+
+ $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $user_link . ' - ' . $user->format_date($row['topic_time']). ' - ' . $user->lang['REPLIES'] . ' ' . $row['topic_replies'] . ' - ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'];
+ }
+ }
+}
+
+class phpbb_feed_topics extends phpbb_feed
+{
+ function set_keys()
+ {
+ global $config;
+
+ $this->set('title', 'topic_title');
+ $this->set('title2', 'forum_name');
+ $this->set('author_id', 'topic_poster');
+ $this->set('creator', 'topic_first_poster_name');
+ $this->set('text', 'post_text');
+ $this->set('bitfield', 'bbcode_bitfield');
+ $this->set('bbcode_uid','bbcode_uid');
+ $this->set('date', 'topic_time');
+
+ $this->set('enable_bbcode', 'enable_bbcode');
+ $this->set('enable_smilies', 'enable_smilies');
+ $this->set('enable_magic_url', 'enable_magic_url');
+
+ $this->num_items = $config['feed_overall_topics_limit'];
+ }
+
+ function open()
+ {
+ global $user, $global_vars;
+
+ $global_vars['FEED_MODE'] = $user->lang['TOPICS'];
+ }
+
+ function get_sql()
+ {
+ global $db, $config;
+
+ $post_ids = array();
+ $not_in_fid = (sizeof($this->excluded_forums())) ? ' AND ' . $db->sql_in_set('t.forum_id', $this->excluded_forums(), true) : '';
+
+ // Search for topics in last x days
+ $last_post_time_sql = ($this->sort_days) ? ' AND t.topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : '';
+
+ // Last x topics from all forums, with first post from topic...
+ $sql = 'SELECT t.topic_first_post_id
+ FROM ' . TOPICS_TABLE . ' t
+ WHERE t.topic_approved = 1
+ AND t.topic_moved_id = 0' .
+ $not_in_fid .
+ $last_post_time_sql . '
+ ORDER BY t.topic_last_post_time DESC';
+ $result = $db->sql_query_limit($sql, $this->num_items);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $post_ids[] = $row['topic_first_post_id'];
+ }
+ $db->sql_freeresult($result);
+
+ if (!sizeof($post_ids))
+ {
+ return false;
+ }
+
+ $this->sql = array(
+ 'SELECT' => 'f.forum_id, f.forum_password, f.forum_name, f.forum_topics, f.forum_posts, f.parent_id, f.left_id, f.right_id,
+ t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time,
+ p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url,
+ u.username, u.user_id, u.user_email',
+ 'FROM' => array(
+ TOPICS_TABLE => 't',
+ FORUMS_TABLE => 'f',
+ POSTS_TABLE => 'p',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . '
+ AND f.forum_id = p.forum_id
+ AND t.topic_id = p.topic_id
+ AND u.user_id = p.poster_id',
+ 'ORDER_BY' => 't.topic_last_post_time DESC',
+ );
+
+ return true;
+ }
+
+ function adjust_item(&$item_row, &$row)
+ {
+ global $phpEx, $config;
+
+ $item_row['link'] = feed_append_sid('/viewtopic.' . $phpEx, 't=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id']);
+
+ if ($config['feed_item_statistics'])
+ {
+ global $user;
+
+ $user_link = '' . $row[$this->get('creator')] . ' ';
+
+ $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $user_link . ' - ' . $user->format_date($row['topic_time']). ' - ' . $user->lang['REPLIES'] . ' ' . $row['topic_replies'] . ' - ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'];
+ }
+ }
+}
+
+
+?>
\ No newline at end of file
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index bce35ee68f..1b812a9c8f 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -64,6 +64,8 @@ class acp_board
'legend2' => 'WARNINGS',
'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
+
+ 'legend3' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -93,6 +95,8 @@ class acp_board
'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+
+ 'legend3' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -143,7 +147,9 @@ class acp_board
'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false)
+ 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+
+ 'legend3' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -182,6 +188,8 @@ class acp_board
'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
+
+ 'legend3' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -205,6 +213,8 @@ class acp_board
'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
+
+ 'legend3' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -235,6 +245,28 @@ class acp_board
'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true),
'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false),
+
+ 'legend4' => 'ACP_SUBMIT_CHANGES',
+ )
+ );
+ break;
+
+ case 'feed':
+ $display_vars = array(
+ 'title' => 'ACP_FEED_MANAGEMENT',
+ 'vars' => array(
+ 'legend1' => 'ACP_FEED_GENERAL',
+ 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
+ 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
+ 'feed_limit' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true),
+ 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
+ 'feed_overall_forums_limit' => array('lang' => 'ACP_FEED_OVERALL_FORUMS_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false),
+ 'feed_overall_topics' => array('lang' => 'ACP_FEED_OVERALL_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
+ 'feed_overall_topics_limit' => array('lang' => 'ACP_FEED_OVERALL_TOPIC_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false),
+ 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
+ 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
+ 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'select_multiple', 'method' => 'select_news_forums', 'explain' => true ),
+ 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'select_multiple', 'method' => 'select_exclude_forums', 'explain' => true),
)
);
break;
@@ -279,6 +311,8 @@ class acp_board
'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+
+ 'legend4' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -312,6 +346,8 @@ class acp_board
'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true),
'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true),
+
+ 'legend4' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -360,7 +396,9 @@ class acp_board
'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0', 'type' => 'text:4:5', 'explain' => true),
'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
- 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true)
+ 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
+
+ 'legend3' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -395,7 +433,7 @@ class acp_board
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
- if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
+ if ($null === false || strpos($config_name, 'legend') !== false)
{
continue;
}
@@ -405,6 +443,26 @@ class acp_board
continue;
}
+ // If not set, then this is a valid entry and needs to be emptied (select_multiple, checkbox)
+ if (!isset($cfg_array[$config_name]))
+ {
+ $cfg_array[$config_name] = '';
+ }
+
+
+ // Erm, we spotted an array
+ if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name]))
+ {
+ // Get config *array*
+ $cfg_ = utf8_normalize_nfc(request_var('config', array('' => array('')), true));
+
+ // Check if the variable is set and an array
+ if (isset($cfg_[$config_name]) && is_array($cfg_[$config_name]))
+ {
+ $cfg_array[$config_name] = trim(serialize($cfg_[$config_name]));
+ }
+ }
+
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($config_name == 'email_function_name')
@@ -830,6 +888,47 @@ class acp_board
return "$dateformat_options
";
}
+
+ /**
+ * Select multiple forums
+ */
+ function select_news_forums($value, $key)
+ {
+ global $user, $config;
+
+ // Determine ids to be selected
+ $select_ids = (sizeof($value)) ? $value : false;
+
+ $forum_list = make_forum_select($select_ids, false, true, true, true, false, true);
+
+ // Build forum options
+ $s_forum_options = '';
+ foreach ($forum_list as $f_id => $f_row)
+ {
+ $s_forum_options .= '' . $f_row['padding'] . $f_row['forum_name'] . ' ';
+ }
+
+ return $s_forum_options;
+ }
+
+ function select_exclude_forums($value, $key)
+ {
+ global $user, $config;
+
+ // Determine ids to be selected
+ $select_ids = (sizeof($value)) ? $value : false;
+
+ $forum_list = make_forum_select($select_ids, false, true, false, false, false, true);
+
+ // Build forum options
+ $s_forum_options = '';
+ foreach ($forum_list as $f_id => $f_row)
+ {
+ $s_forum_options .= '' . $f_row['padding'] . $f_row['forum_name'] . ' ';
+ }
+
+ return $s_forum_options;
+ }
}
?>
\ No newline at end of file
diff --git a/phpBB/includes/acp/info/acp_board.php b/phpBB/includes/acp/info/acp_board.php
index 72d86676a6..58b650650c 100644
--- a/phpBB/includes/acp/info/acp_board.php
+++ b/phpBB/includes/acp/info/acp_board.php
@@ -26,6 +26,7 @@ class acp_board_info
'message' => array('title' => 'ACP_MESSAGE_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION', 'ACP_MESSAGES')),
'post' => array('title' => 'ACP_POST_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'signature' => array('title' => 'ACP_SIGNATURE_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
+ 'feed' => array('title' => 'ACP_FEED_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'registration' => array('title' => 'ACP_REGISTER_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
'auth' => array('title' => 'ACP_AUTH_SETTINGS', 'auth' => 'acl_a_server', 'cat' => array('ACP_CLIENT_COMMUNICATION')),
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 188c8ee5e3..94f2adc5bd 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3775,6 +3775,9 @@ function page_header($page_title = '', $display_online_list = true)
$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
}
+ $forum_id = request_var('f', 0);
+ $topic_id = request_var('t', 0);
+
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
@@ -3822,6 +3825,7 @@ function page_header($page_title = '', $display_online_list = true)
'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'),
'U_TEAM' => ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=leaders'),
'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '',
+ 'U_FEED' => generate_board_url() . "/feed.$phpEx",
'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false,
'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
@@ -3843,6 +3847,15 @@ function page_header($page_title = '', $display_online_list = true)
'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0,
'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0,
'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false,
+ 'S_FORUM_ID' => $forum_id,
+ 'S_TOPIC_ID' => $topic_id,
+
+ 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false,
+ 'S_ENABLE_FEEDS_NEWS' => ($config['feed_news_id'] != '') ? true : false,
+ 'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false,
+ 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false,
+ 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_id && strpos($user->page['page_name'], 'viewforum') !== false) ? true : false,
+ 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && $topic_id && strpos($user->page['page_name'], 'viewtopic') !== false) ? true : false,
'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme',
'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template',
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 171a8f1fc6..bb48b57a13 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1022,9 +1022,69 @@ function change_database_data(&$no_updates, $version)
case '3.0.5-RC1':
break;
+ // Changes from 3.0.5 to 3.0.6-RC1
case '3.0.5':
- // TODO: smarter detection here; problem without GD.
- set_config('captcha_plugin', 'phpbb_captcha_nogd');
+ // Let's see if the GD Captcha can be enabled... we simply look for what *is* enabled...
+ if (!empty($config['captcha_gd']) && !isset($config['captcha_plugin']))
+ {
+ set_config('captcha_plugin', 'phpbb_captcha_gd');
+ }
+ else if (!isset($config['captcha_plugin']))
+ {
+ set_config('captcha_plugin', 'phpbb_captcha_nogd');
+ }
+
+ // Entries for the Feed Feature
+ set_config('feed_enable', '0');
+ set_config('feed_limit', '10');
+
+ set_config('feed_overall_forums', '1');
+ set_config('feed_overall_forums_limit', '15');
+
+ set_config('feed_overall_topics', '0');
+ set_config('feed_overall_topics_limit', '15');
+
+ set_config('feed_forum', '1');
+ set_config('feed_topic', '1');
+ set_config('feed_news_id', '');
+
+ set_config('feed_item_statistics', '1');
+ set_config('feed_exclude_id', '');
+
+ include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
+
+ $_module = new acp_modules();
+
+ // Set the module class
+ $_module->module_class = 'acp';
+
+ $sql = 'SELECT module_id
+ FROM ' . MODULES_TABLE . "
+ WHERE module_class = 'acp'
+ AND module_langname = 'ACP_BOARD_CONFIGURATION'
+ AND module_mode = ''
+ AND module_basename = ''";
+ $result = $db->sql_query($sql);
+ $category_id = (int) $db->sql_fetchfield('module_id');
+ $db->sql_freeresult($result);
+
+ if ($category_id)
+ {
+ $module_data = array(
+ 'module_basename' => 'board',
+ 'module_enabled' => 1,
+ 'module_display' => 1,
+ 'parent_id' => $category_id,
+ 'module_class' => 'acp',
+ 'module_langname' => 'ACP_FEED_SETTINGS',
+ 'module_mode' => 'feed',
+ 'module_auth' => 'acl_a_board',
+ );
+
+ $_module->update_module_data($module_data, true);
+ }
+
+ $_module->remove_cache_file();
$no_updates = false;
break;
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index e41cf6794c..aea99e3305 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -93,6 +93,17 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_queue_trigger', '0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit', '10');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_forums', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_forums_limit', '15');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_topics', '0');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_topics_limit', '15');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_forum', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topic', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_news_id', '');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_item_statistics', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_exclude_id', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval', '15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('force_server_vars', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200');
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index aac05bc8c1..e1739f229a 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -231,6 +231,38 @@ $lang = array_merge($lang, array(
'USERNAME_LENGTH_EXPLAIN' => 'Minimum and maximum number of characters in usernames.',
));
+// Feeds
+$lang = array_merge($lang, array(
+ 'ACP_FEED_MANAGEMENT' => 'General Syndication Feeds settings',
+ 'ACP_FEED_MANAGEMENT_EXPLAIN' => 'This Module makes available various ATOM Feeds, parsing any BBCode in posts to make them readable in external feeds.',
+
+ 'ACP_FEED_ENABLE' => 'Enable Feeds',
+ 'ACP_FEED_ENABLE_EXPLAIN' => 'Turns on or off ATOM Feeds for the entire board. Disabling this switches off all Feeds, no matter how the options below are set.',
+ 'ACP_FEED_LIMIT' => 'Number of items',
+ 'ACP_FEED_LIMIT_EXPLAI' => 'The maximum number of feed items to display.',
+
+ 'ACP_FEED_OVERALL_FORUMS' => 'Enable overall forums feed',
+ 'ACP_FEED_OVERALL_FORUMS_EXPLAIN' => 'This feed displays the latest posts from all forums topics.',
+ 'ACP_FEED_OVERALL_FORUMS_LIMIT' => 'Number of items per page to display in the forums feed',
+
+ 'ACP_FEED_OVERALL_TOPIC' => 'Enable overall topics feed',
+ 'ACP_FEED_OVERALL_TOPIC_EXPLAIN' => 'Enables the "All Topics" feed',
+ 'ACP_FEED_OVERALL_TOPIC_LIMIT' => 'Number of items per page to display in the topics feed',
+ 'ACP_FEED_FORUM' => 'Enable Per-Forum Feeds',
+ 'ACP_FEED_FORUM_EXPLAIN' => 'Single forum new posts.',
+ 'ACP_FEED_TOPIC' => 'Enable Per-Topic Feeds',
+ 'ACP_FEED_TOPIC_EXPLAIN' => 'Single topics new posts.',
+ 'ACP_FEED_NEWS' => 'News Feeds',
+ 'ACP_FEED_NEWS_EXPLAIN' => 'Pull the first post from these forums. Select no forums to disable news feed. Select multiple forums by holding CTRL and clicking.',
+
+ 'ACP_FEED_GENERAL' => 'General Feed Settings',
+
+ 'ACP_FEED_ITEM_STATISTICS' => 'Item statistics',
+ 'ACP_FEED_ITEM_STATISTICS_EXPLAIN' => 'Display individual statistics underneath feed items (Posted by, date and time, Replies, Views)',
+ 'ACP_FEED_EXCLUDE_ID' => 'Exclude these forums',
+ 'ACP_FEED_EXCLUDE_ID_EXPLAIN' => 'Content from these will be not included in feeds . Select no forum to pull data from all forums. Select/Deselect multiple forums by holding CTRL and clicking.',
+));
+
// Visual Confirmation Settings
$lang = array_merge($lang, array(
'ACP_VC_SETTINGS_EXPLAIN' => 'Here you are able to define visual confirmation defaults and CAPTCHA settings.',
@@ -264,6 +296,7 @@ $lang = array_merge($lang, array(
'CAPTCHA_CONFIGURE_EXPLAIN' => 'Change the settings for the selected CAPTCHA.',
'CONFIGURE' => 'Configure',
'CAPTCHA_NO_OPTIONS' => 'This CAPTCHA has no configuration options.',
+
'VISUAL_CONFIRM_POST' => 'Enable visual confirmation for guest postings',
'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires anonymous users to enter a random code matching an image to help prevent mass postings.',
'VISUAL_CONFIRM_REG' => 'Enable visual confirmation for registrations',
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 6cfcc44d21..bc569cd8ed 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -148,6 +148,9 @@ $lang = array_merge($lang, array(
'ACP_RESTORE' => 'Restore',
+ 'ACP_FEED' => 'Feed management',
+ 'ACP_FEED_SETTINGS' => 'Feed settings',
+
'ACP_SEARCH' => 'Search configuration',
'ACP_SEARCH_INDEX' => 'Search index',
'ACP_SEARCH_SETTINGS' => 'Search settings',
@@ -161,6 +164,8 @@ $lang = array_merge($lang, array(
'ACP_STYLE_MANAGEMENT' => 'Style management',
'ACP_STYLES' => 'Styles',
+ 'ACP_SUBMIT_CHANGES' => 'Submit changes',
+
'ACP_TEMPLATES' => 'Templates',
'ACP_THEMES' => 'Themes',
@@ -464,6 +469,7 @@ $lang = array_merge($lang, array(
'LOG_CONFIG_MESSAGE' => 'Altered private message settings ',
'LOG_CONFIG_POST' => 'Altered post settings ',
'LOG_CONFIG_REGISTRATION' => 'Altered user registration settings ',
+ 'LOG_CONFIG_FEED' => 'Altered syndication feeds settings ',
'LOG_CONFIG_SEARCH' => 'Altered search settings ',
'LOG_CONFIG_SECURITY' => 'Altered security settings ',
'LOG_CONFIG_SERVER' => 'Altered server settings ',
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 12510d5d5e..9e5de4d61b 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -383,6 +383,8 @@ $lang = array_merge($lang, array(
'NO_ONLINE_USERS' => 'No registered users',
'NO_POSTS' => 'No posts',
'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.',
+ 'NO_FEED_ENABLED' => 'Feeds are not enabled.',
+ 'NO_FEED' => 'Couldn\'t find Feed.',
'NO_SUBJECT' => 'No subject specified', // Used for posts having no subject defined but displayed within management pages.
'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn’t exist.',
'NO_SUPPORTED_AUTH_METHODS' => 'No supported authentication methods.',
@@ -486,6 +488,8 @@ $lang = array_merge($lang, array(
'RETURN_PAGE' => '%sReturn to the previous page%s',
'RETURN_TOPIC' => '%sReturn to the topic last visited%s',
'RETURN_TO' => 'Return to',
+ 'FEED' => 'Feed',
+ 'FEED_NEWS' => 'News',
'RULES_ATTACH_CAN' => 'You can post attachments in this forum',
'RULES_ATTACH_CANNOT' => 'You cannot post attachments in this forum',
'RULES_DELETE_CAN' => 'You can delete your posts in this forum',
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index d1bf5fb20a..5fed304568 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -15,6 +15,15 @@
{META}
{SITENAME} • {L_MCP} • {L_UCP} • {PAGE_TITLE}
+
+
+
+
+
+
+
+
+
{L_MCP} • {L_UCP} • {PAGE_TITLE}
+
+
+
+
+
+
+
+
+