diff --git a/root/language/en/mods/portal/portal_recent_module.php b/root/language/en/mods/portal/portal_recent_module.php new file mode 100644 index 00000000..27ea5ead --- /dev/null +++ b/root/language/en/mods/portal/portal_recent_module.php @@ -0,0 +1,52 @@ + 'Recent', + 'PORTAL_RECENT_TOPIC' => 'Recent topics', + 'PORTAL_RECENT_ANN' => 'Recent announcements', + 'PORTAL_RECENT_HOT_TOPIC' => 'Recent popular topics', + + // ACP + 'ACP_PORTAL_RECENT_SETTINGS' => 'Recent topics settings', + 'ACP_PORTAL_RECENT_SETTINGS_EXP' => 'This is where you customize the recent topics block.', + 'PORTAL_MAX_TOPIC' => 'Limit of recent announcements/hot topics', + 'PORTAL_MAX_TOPIC_EXP' => '0 means infinite', + 'PORTAL_RECENT_TITLE_LIMIT' => 'Character limit for each recent topic', + 'PORTAL_RECENT_TITLE_LIMIT_EXP' => '0 means infinite', + 'PORTAL_RECENT_FORUM' => 'Recent topics forums', + 'PORTAL_RECENT_FORUM_EXP' => 'Forum(s) we pull the topics from, leave blank to pull from all forums. If "Exclude forums" is set to "Yes", select the forums you want to exclude.
If "Exclude forums" is set to "No" select the forums you want to see.
Select/Deselect multiple forums by holding CTRL and clicking.', + 'PORTAL_EXCLUDE_FORUM' => 'Exclude Forums', + 'PORTAL_EXCLUDE_FORUM_EXP' => 'Select "Yes" if you want to exlude the selected forums from the recent topics block, and "No" if you want to see only the selected forums in the recent topics block.', +)); + +?> \ No newline at end of file diff --git a/root/portal/modules/portal_calendar.php b/root/portal/modules/portal_calendar.php index fb8397af..9fd2b2ab 100644 --- a/root/portal/modules/portal_calendar.php +++ b/root/portal/modules/portal_calendar.php @@ -298,7 +298,7 @@ class portal_calendar_module $event_end_day = trim(request_var('event_end_day', '')); $event_end_time = trim(request_var('event_end_time', '')); $event_all_day = request_var('event_all_day', false); // default to false - $event_url = request_var('event_url', ' '); // @todo: check if we need the str_replace when using serialize + $event_url = request_var('event_url', ' '); $event_permission = request_var('permission-setting', array(0 => '')); $groups_ary = array(); diff --git a/root/portal/modules/portal_recent.php b/root/portal/modules/portal_recent.php new file mode 100644 index 00000000..5c13e45d --- /dev/null +++ b/root/portal/modules/portal_recent.php @@ -0,0 +1,252 @@ +lang}/mods/portal/" + */ + var $language = 'portal_recent_module'; + + /** + * custom acp template + * file must be in "adm/style/portal/" + */ + var $custom_acp_tpl = ''; + + function get_template_center($module_id) + { + global $config, $template, $db, $auth, $phpbb_root_path, $phpEx; + + // + // Exclude forums + // + $sql_where = ''; + if ($config['board3_recent_forum_' . $module_id] > 0) + { + $exclude_forums = explode(',', $config['board3_recent_forum_' . $module_id]); + + $sql_where = ' AND ' . $db->sql_in_set('forum_id', array_map('intval', $exclude_forums), ($config['board3_exclude_forums_' . $module_id]) ? true : false); + } + + // Get a list of forums the user cannot read + $forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true))); + + // Determine first forum the user is able to read (must not be a category) + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST; + + $forum_sql = ''; + if (sizeof($forum_ary)) + { + $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true); + $forum_sql = ' AND ' . $db->sql_in_set('t.forum_id', $forum_ary, true); + } + + $result = $db->sql_query_limit($sql, 1); + $g_forum_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + // + // Recent announcements + // + $sql = 'SELECT topic_title, forum_id, topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE topic_status <> ' . FORUM_LINK . ' + AND topic_approved = 1 + AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ') + AND topic_moved_id = 0 + ' . $sql_where . '' . $forum_sql . ' + ORDER BY topic_time DESC'; + $result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]); + + while(($row = $db->sql_fetchrow($result)) && ($row['topic_title'])) + { + // auto auth + if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0')) + { + $template->assign_block_vars('latest_announcements', array( + 'TITLE' => character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]), + 'FULL_TITLE' => censor_text($row['topic_title']), + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id']) + )); + } + } + $db->sql_freeresult($result); + + // + // Recent hot topics + // + $sql = 'SELECT topic_title, forum_id, topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE topic_approved = 1 + AND topic_replies >=' . $config['hot_threshold'] . ' + AND topic_moved_id = 0 + ' . $sql_where . '' . $forum_sql . ' + ORDER BY topic_time DESC'; + $result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]); + + while(($row = $db->sql_fetchrow($result)) && ($row['topic_title'])) + { + // auto auth + if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0')) + { + $template->assign_block_vars('latest_hot_topics', array( + 'TITLE' => character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]), + 'FULL_TITLE' => censor_text($row['topic_title']), + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id'] == 0) ? $g_forum_id : $row['forum_id']) . '&t=' . $row['topic_id']) + )); + } + } + $db->sql_freeresult($result); + + // + // Recent topic (only show normal topic) + // + $sql = 'SELECT topic_title, forum_id, topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE topic_status <> ' . ITEM_MOVED . ' + AND topic_approved = 1 + AND topic_type = ' . POST_NORMAL . ' + AND topic_moved_id = 0 + ' . $sql_where . '' . $forum_sql . ' + ORDER BY topic_time DESC'; + $result = $db->sql_query_limit($sql, $config['board3_max_topics_' . $module_id]); + + while(($row = $db->sql_fetchrow($result)) && ($row['topic_title'])) + { + // auto auth + if (($auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0')) + { + $template->assign_block_vars('latest_topics', array( + 'TITLE' => character_limit($row['topic_title'], $config['board3_recent_title_limit_' . $module_id]), + 'FULL_TITLE' => censor_text($row['topic_title']), + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']) + )); + } + } + $db->sql_freeresult($result); + + return 'recent_center.html'; + } + + function get_template_acp($module_id) + { + return array( + 'title' => 'ACP_PORTAL_RECENT_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_PORTAL_RECENT_SETTINGS', + 'board3_max_topics_' . $module_id => array('lang' => 'PORTAL_MAX_TOPIC', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), + 'board3_recent_title_limit_' . $module_id => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), + 'board3_recent_forum_' . $module_id => array('lang' => 'PORTAL_RECENT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_forums', 'submit' => 'store_selected_forums'), + 'board3_recent_exclude_forums_' . $module_id => array('lang' => 'PORTAL_EXCLUDE_FORUM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + ) + ); + } + + /** + * API functions + */ + function install($module_id) + { + set_config('board3_max_topics_' . $module_id, 10); + set_config('board3_recent_title_limit_' . $module_id, 100); + set_config('board3_recent_forum_' . $module_id, ''); + set_config('board3_recent_exclude_forums_' . $module_id, 1); + return true; + } + + function uninstall($module_id) + { + global $db; + + $del_config = array( + 'board3_max_topics_' . $module_id, + 'board3_recent_title_limit_' . $module_id, + 'board3_recent_forum_' . $module_id, + 'board3_recent_exclude_forums_' . $module_id, + ); + $sql = 'DELETE FROM ' . CONFIG_TABLE . ' + WHERE ' . $db->sql_in_set('config_name', $del_config); + return $db->sql_query($sql); + } + + // Create forum select box + function select_forums($value, $key, $module_id) + { + global $user, $config; + + $forum_list = make_forum_select(false, false, true, true, true, false, true); + + $selected = array(); + if(isset($config[$key]) && strlen($config[$key]) > 0) + { + $selected = explode(',', $config[$key]); + } + // Build forum options + $s_forum_options = ''; + + return $s_forum_options; + + } + + // Store selected forums + function store_selected_forums($key, $module_id) + { + global $db, $cache; + + // Get selected extensions + $values = request_var($key, array(0 => '')); + + $news = implode(',', $values); + + set_config($key, $news); + + } +} + +?> \ No newline at end of file diff --git a/root/styles/prosilver/template/portal/modules/news_center.html b/root/styles/prosilver/template/portal/modules/news_center.html index b3d6e20e..008ac6e8 100644 --- a/root/styles/prosilver/template/portal/modules/news_center.html +++ b/root/styles/prosilver/template/portal/modules/news_center.html @@ -11,7 +11,7 @@
-

{NEWEST_POST_IMG}{READ_POST_IMG} {news_row.ATTACH_ICON_IMG} {L_POLL}: {news_row.TITLE}

+

{NEWEST_POST_IMG}{READ_POST_IMG} {news_row.ATTACH_ICON_IMG} {L_VIEW_TOPIC_POLL} {news_row.TITLE}

{news_row.PAGINATION}