Removed unnecessary acp_portal_blocks files;

Added language files for announcements module; 
Converted portal.php and acp_portal.php back to using the phpBB config table;
This commit is contained in:
Marc Alexander
2010-04-06 21:17:21 +00:00
parent 6b207166e3
commit 5bcfe37930
17 changed files with 180 additions and 1409 deletions

View File

@@ -1,86 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
// Generate birthday list if required ... / borrowed from index.php 3.0.6
$birthday_list = $birthday_ahead_list = '';
if ($config['load_birthdays'] && $config['allow_birthdays'])
{
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$cache_days = $portal_config['portal_birthdays_ahead'];
$sql_days = '';
while ($cache_days > 0)
{
$day = getdate(time() + 86400 * $cache_days + $user->timezone + $user->dst - date('Z'));
$sql_days .= " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $day['mday'], $day['mon'])) . "%'";
$cache_days--;
}
switch ($db->sql_layer)
{
case 'mssql':
case 'mssql_odbc':
$order_by = 'u.user_birthday ASC';
break;
default:
$order_by = 'SUBSTRING(u.user_birthday FROM 4 FOR 2) ASC, SUBSTRING(u.user_birthday FROM 1 FOR 2) ASC, u.username_clean ASC';
break;
}
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)
WHERE (b.ban_id IS NULL
OR b.ban_exclude = 1)
AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' {$sql_days})
AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
ORDER BY ' . $order_by;
$result = $db->sql_query($sql);
$today = sprintf('%2d-%2d-', $now['mday'], $now['mon']);
while ($row = $db->sql_fetchrow($result))
{
if (substr($row['user_birthday'], 0, 6) == $today)
{
$birthday_list .= get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
$birthday_list .= '<br /><br />';
}
else
{
$birthday_ahead_list .= '<span title="' . format_birthday($user_birthday, 'd M') . '">' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) . '</span>';
if ($age = (int) substr($row['user_birthday'], -4))
{
$birthday_ahead_list .= ' (' . ($now['year'] - $age) . ')';
}
$birthday_ahead_list .= '<br /><br />';
}
}
$db->sql_freeresult($result);
}
// Assign index specific vars
$template->assign_vars(array(
'BIRTHDAY_LIST' => $birthday_list,
'BIRTHDAYS_AHEAD_LIST' => ($portal_config['portal_birthdays_ahead']) ? $birthday_ahead_list : '',
'L_BIRTHDAYS_AHEAD' => sprintf($user->lang['BIRTHDAYS_AHEAD'], $portal_config['portal_birthdays_ahead']),
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
));
?>

View File

@@ -1,33 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
if ($portal_config['portal_pay_acc'])
{
if ($portal_config['portal_pay_c_block'])
{
$template->assign_var('S_DISPLAY_PAY_C', true);
}
if ($portal_config['portal_pay_s_block'])
{
$template->assign_var('S_DISPLAY_PAY_S', true);
}
// Assign specific vars
$template->assign_var('PAY_ACC', $portal_config['portal_pay_acc']);
}
?>

View File

@@ -1,66 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
$s_display_friends = false;
// Output listing of friends online
$update_time = $config['load_online_time'] * 60;
$sql = $db->sql_build_query('SELECT_DISTINCT', array(
'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, u.user_allow_viewonline, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline',
'FROM' => array(
USERS_TABLE => 'u',
ZEBRA_TABLE => 'z'
),
'LEFT_JOIN' => array(
array(
'FROM' => array(SESSIONS_TABLE => 's'),
'ON' => 's.session_user_id = z.zebra_id'
)
),
'WHERE' => 'z.user_id = ' . $user->data['user_id'] . '
AND z.friend = 1
AND u.user_id = z.zebra_id',
'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.user_allow_viewonline, u.user_colour',
'ORDER_BY' => 'u.username_clean ASC',
));
$result = $db->sql_query_limit($sql, $portal_config['portal_max_online_friends']);
while ($row = $db->sql_fetchrow($result))
{
$which = (time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline'))) ? 'online' : 'offline';
$s_display_friends = ($row['user_id']) ? true : false;
$template->assign_block_vars("friends_{$which}", array(
'USER_ID' => $row['user_id'],
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))
);
}
$db->sql_freeresult($result);
// Assign specific vars
$template->assign_vars(array(
'S_DISPLAY_FRIENDS' => $s_display_friends,
'S_ZEBRA_ENABLED' => true,
));
?>

View File

@@ -1,8 +0,0 @@
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</html>

View File

@@ -1,55 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
// Last x visited bots
$sql = 'SELECT username, user_colour, user_lastvisit
FROM ' . USERS_TABLE . '
WHERE user_type = ' . USER_IGNORE . '
ORDER BY user_lastvisit DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_last_visited_bots_number']);
$first = true;
while ($row = $db->sql_fetchrow($result))
{
if (!$row['user_lastvisit'] && $first == TRUE)
{
$template->assign_vars(array(
'S_DISPLAY_LAST_BOTS' => false,
));
}
else
{
$template->assign_var('S_DISPLAY_LAST_BOTS', true);
if( $row['user_lastvisit'] > 0 )
{
$template->assign_block_vars('last_visited_bots', array(
'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']),
'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']),
));
}
}
$first = false;
}
$db->sql_freeresult($result);
// Assign specific vars
$template->assign_vars(array(
'LAST_VISITED_BOTS' => sprintf($user->lang['LAST_VISITED_BOTS'], $portal_config['portal_last_visited_bots_number']),
'S_LAST_VISITED_BOTS' => ($portal_config['portal_load_last_visited_bots']) ? true : false,
));
?>

View File

@@ -1,35 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
$sql = 'SELECT user_id, username, user_regdate, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_inactive_time = 0
ORDER BY user_regdate DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_last_member']);
while( ($row = $db->sql_fetchrow($result)) && ($row['username']) )
{
$template->assign_block_vars('latest_members', array(
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'JOINED' => $user->format_date($row['user_regdate'], $format = 'd M'),
));
}
$db->sql_freeresult($result);
$template->assign_var('S_DISPLAY_LATEST_MEMBERS', true);
?>

View File

@@ -1,140 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
// switch idea from phpBB2 :p
function get_db_stat($mode)
{
global $db, $user;
switch( $mode )
{
case 'announcementtotal':
$sql = 'SELECT COUNT(distinct t.topic_id) AS announcement_total
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE t.topic_type = ' . POST_ANNOUNCE . '
AND p.post_id = t.topic_first_post_id';
break;
case 'stickytotal':
$sql = 'SELECT COUNT(distinct t.topic_id) AS sticky_total
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
WHERE t.topic_type = ' . POST_STICKY . '
AND p.post_id = t.topic_first_post_id';
break;
case 'attachmentstotal':
$sql = 'SELECT COUNT(attach_id) AS attachments_total
FROM ' . ATTACHMENTS_TABLE;
break;
}
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$row = $db->sql_fetchrow($result);
switch ( $mode )
{
case 'announcementtotal':
return $row['announcement_total'];
break;
case 'stickytotal':
return $row['sticky_total'];
break;
case 'attachmentstotal':
return $row['attachments_total'];
break;
}
return false;
}
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
$total_users = $config['num_users'];
$l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
$l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
// avarage stat
$board_days = ( time() - $config['board_startdate'] ) / 86400;
$topics_per_day = ($total_topics) ? round($total_topics / $board_days, 0) : 0;
$posts_per_day = ($total_posts) ? round($total_posts / $board_days, 0) : 0;
$users_per_day = round($total_users / $board_days, 0);
$topics_per_user = ($total_topics) ? round($total_topics / $total_users, 0) : 0;
$posts_per_user = ($total_posts) ? round($total_posts / $total_users, 0) : 0;
$posts_per_topic = ($total_topics) ? round($total_posts / $total_topics, 0) : 0;
if ($topics_per_day > $total_topics)
{
$topics_per_day = $total_topics;
}
if ($posts_per_day > $total_posts)
{
$posts_per_day = $total_posts;
}
if ($users_per_day > $total_users)
{
$users_per_day = $total_users;
}
if ($topics_per_user > $total_topics)
{
$topics_per_user = $total_topics;
}
if ($posts_per_user > $total_posts)
{
$posts_per_user = $total_posts;
}
if ($posts_per_topic > $total_posts)
{
$posts_per_topic = $total_posts;
}
$l_topics_per_day_s = ($total_topics == 0) ? 'TOPICS_PER_DAY_ZERO' : 'TOPICS_PER_DAY_OTHER';
$l_posts_per_day_s = ($total_posts == 0) ? 'POSTS_PER_DAY_ZERO' : 'POSTS_PER_DAY_OTHER';
$l_users_per_day_s = ($total_users == 0) ? 'USERS_PER_DAY_ZERO' : 'USERS_PER_DAY_OTHER';
$l_topics_per_user_s = ($total_topics == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$l_posts_per_user_s = ($total_posts == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$l_posts_per_topic_s = ($total_posts == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';
// Assign specific vars
$template->assign_vars(array(
'S_DISPLAY_ADVANCED_STAT' => true,
'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
'S_ANN' => get_db_stat('announcementtotal'),
'S_SCT' => get_db_stat('stickytotal'),
'S_TOT_ATTACH' => ($config['allow_attachments']) ? get_db_stat('attachmentstotal') : 0,
// avarage stat
'TOPICS_PER_DAY' => sprintf($user->lang[$l_topics_per_day_s], $topics_per_day),
'POSTS_PER_DAY' => sprintf($user->lang[$l_posts_per_day_s], $posts_per_day),
'USERS_PER_DAY' => sprintf($user->lang[$l_users_per_day_s], $users_per_day),
'TOPICS_PER_USER' => sprintf($user->lang[$l_topics_per_user_s], $topics_per_user),
'POSTS_PER_USER' => sprintf($user->lang[$l_posts_per_user_s], $posts_per_user),
'POSTS_PER_TOPIC' => sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic),
));
?>

View File

@@ -1,39 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
/**
*/
$sql = 'SELECT user_id, username, user_posts, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_posts <> 0
ORDER BY user_posts DESC';
$result = $db->sql_query_limit($sql, $portal_config['portal_max_most_poster']);
while( ($row = $db->sql_fetchrow($result)) && ($row['username']) )
{
$template->assign_block_vars('top_poster', array(
'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&amp;sr=posts'),
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'POSTER_POSTS' => $row['user_posts'],
)
);
}
$db->sql_freeresult($result);
$template->assign_var('S_DISPLAY_TOP_POSTERS', true);
?>

View File

@@ -1,100 +0,0 @@
<?php
/**
*
* @package Board3 Portal v2
* @version $Id$
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
//
// + new posts since last visit & you post number
//
if ($user->data['is_registered'])
{
$ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true))));
if ($auth->acl_get('m_approve'))
{
$m_approve_fid_ary = array(-1);
$m_approve_fid_sql = '';
}
else if ($auth->acl_getf_global('m_approve'))
{
$m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
$m_approve_fid_sql = ' AND (p.post_approved = 1' . ((sizeof($m_approve_fid_ary)) ? ' OR ' . $db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
}
else
{
$m_approve_fid_ary = array();
$m_approve_fid_sql = ' AND p.post_approved = 1';
}
$sql = 'SELECT COUNT(distinct t.topic_id) as total
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . '
AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$result = $db->sql_query($sql);
$new_posts_count = (int) $db->sql_fetchfield('total');
// your post number
$sql = "SELECT user_posts
FROM " . USERS_TABLE . "
WHERE user_id = " . $user->data['user_id'];
$result = $db->sql_query($sql);
$you_posts_count = (int) $db->sql_fetchfield('user_posts');
}
//
// - new posts since last visit & you post number
//
// Get user...
$user_id = $user->data['user_id'];
$username = $user->data['username'];
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$avatar_img = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
$rank_title = $rank_img = '';
get_user_rank($member['user_rank'], $member['user_posts'], $rank_title, $rank_img, $rank_img_src);
$username = $member['username'];
$user_id = (int) $member['user_id'];
$colour = $member['user_colour'];
// Assign specific vars
$template->assign_vars(array(
'L_NEW_POSTS' => $user->lang['SEARCH_NEW'] . '&nbsp;(' . $new_posts_count . ')',
'L_SELF_POSTS' => $user->lang['SEARCH_SELF'] . '&nbsp;(' . $you_posts_count . ')',
'AVATAR_IMG' => $avatar_img,
'RANK_TITLE' => $rank_title,
'RANK_IMG' => $rank_img,
'RANK_IMG_SRC' => $rank_img_src,
'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour),
'USERNAME' => get_username_string('username', $user_id, $username, $colour),
'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour),
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
'U_NEW_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'),
'U_SELF_POSTS' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'),
'U_UM_BOOKMARKS' => ($config['allow_bookmarks']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&amp;mode=bookmarks') : '',
'U_UM_MAIN_SUBSCRIBED' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=main&amp;mode=subscribed'),
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&amp;mode=front', true, $user->session_id) : '',
));
?>

View File

@@ -48,7 +48,7 @@ class portal_announcements_module
function get_template_center($module_id)
{
global $config, $template, $db, $portal_config;
global $config, $template, $db;
$announcement = request_var('announcement', -1);
$announcement = ($announcement > $portal_config['portal_announcements_length'] -1) ? -1 : $announcement;
@@ -371,11 +371,18 @@ class portal_announcements_module
function get_template_acp($module_id)
{
return array(
'title' => 'ACP_CONFIG_MODULENAME',
'title' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
'vars' => array(
'legend1' => 'ACP_MODULENAME_CONFIGLEGEND',
'portal_configname' => array('lang' => 'MODULENAME_CONFIGNAME', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => false),
'portal_configname2' => array('lang' => 'MODULENAME_CONFIGNAME2', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'legend1' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
'portal_announcements_style' => array('lang' => 'PORTAL_ANNOUNCEMENTS_STYLE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_number_of_announcements' => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_announcements_day' => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_announcements_length' => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'portal_global_announcements_forum' => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_forums', 'submit' => 'store_selected_forums'),
'portal_announcements_forum_exclude' => array('lang' => 'PORTAL_ANNOUNCEMENTS_FORUM_EXCLUDE', 'validate' => 'string', 'type' => 'radio:yes_no', 'explain' => true),
'portal_announcements_archive' => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_announcements_permissions' => array('lang' => 'PORTAL_ANNOUNCEMENTS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'portal_show_announcements_replies_views' => array('lang' => 'PORTAL_SHOW_REPLIES_VIEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
),
);
}
@@ -385,8 +392,16 @@ class portal_announcements_module
*/
function install($module_id)
{
set_portal_config('portal_configname', 'Hello World!');
set_portal_config('portal_configname2', 1337);
set_config('portal_announcements_style', 0);
set_config('portal_number_of_announcements', 1);
set_config('portal_announcements_day', 0);
set_config('portal_announcements_length', 200);
set_config('portal_global_announcements_forum', '');
set_config('portal_announcements_forum_exclude', 0);
set_config('portal_announcements_archive', 1);
set_config('portal_announcements_permissions', 1);
set_config('portal_show_announcements_replies_views', 1);
return true;
}
@@ -395,13 +410,58 @@ class portal_announcements_module
global $db;
$del_config = array(
'portal_configname',
'portal_configname2',
'portal_announcements_style',
'portal_number_of_announcements',
'portal_announcements_day',
'portal_announcements_length',
'portal_global_announcements_forum',
'portal_announcements_forum_exclude',
'portal_announcements_archive',
'portal_announcements_permissions',
'portal_show_announcements_replies_views',
);
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . '
$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)
{
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(',', $[$key]);
}
// Build forum options
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
foreach ($forum_list as $f_id => $f_row)
{
$s_forum_options .= '<option value="' . $f_id . '"' . ((in_array($f_id, $selected)) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
$s_forum_options .= '</select>';
return $s_forum_options;
}
// Store selected forums
function store_selected_forums($key)
{
global $db, $cache;
// Get selected extensions
$values = request_var($key, array(0 => ''));
$news = implode(',', $values);
set_config($key, $news);
}
}
?>