[cleanup/tabs] Remove unnecessary tabbing in portal files
This commit is contained in:
@@ -81,7 +81,7 @@ class portal_announcements_module
|
||||
|
||||
$time = ($config['board3_announcements_day_' . $module_id] == 0) ? 0 : $config['board3_announcements_day_' . $module_id];
|
||||
$post_time = ($time == 0) ? '' : 'AND topic_time > ' . (time() - $time * 86400);
|
||||
|
||||
|
||||
$str_where = '';
|
||||
|
||||
if($permissions == true)
|
||||
@@ -92,7 +92,7 @@ class portal_announcements_module
|
||||
{
|
||||
$disallow_access = array();
|
||||
}
|
||||
|
||||
|
||||
if($config['board3_announcements_forum_exclude_' . $module_id] == true)
|
||||
{
|
||||
$disallow_access = array_merge($disallow_access, $forum_from);
|
||||
@@ -142,7 +142,7 @@ class portal_announcements_module
|
||||
$total_announcements = (int) $db->sql_fetchfield('num_topics');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
||||
$topic_tracking_info = (get_portal_tracking_info($fetch_news));
|
||||
|
||||
if($announcement < 0)
|
||||
@@ -280,7 +280,7 @@ class portal_announcements_module
|
||||
// Show "read full" page
|
||||
{
|
||||
$i = $announcement;
|
||||
|
||||
|
||||
/**
|
||||
* redirect to portal page if the specified announcement does not exist
|
||||
* force #top anchor in order to get rid of the #a anchor
|
||||
@@ -305,7 +305,7 @@ class portal_announcements_module
|
||||
{
|
||||
$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_announcements, $config['board3_number_of_announcements_' . $module_id], $start, 'announcements');
|
||||
}
|
||||
|
||||
|
||||
$template->assign_block_vars('announcements_center_row', array(
|
||||
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
|
||||
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
|
||||
@@ -409,7 +409,7 @@ class portal_announcements_module
|
||||
set_config('board3_announcements_archive_' . $module_id, 1);
|
||||
set_config('board3_announcements_permissions_' . $module_id, 1);
|
||||
set_config('board3_show_announcements_replies_views_' . $module_id, 1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -432,14 +432,14 @@ class portal_announcements_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Create forum select box
|
||||
public 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)
|
||||
{
|
||||
@@ -456,18 +456,15 @@ class portal_announcements_module
|
||||
return $s_forum_options;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Store selected forums
|
||||
public function store_selected_forums($key, $module_id)
|
||||
{
|
||||
global $db, $cache;
|
||||
|
||||
|
||||
// Get selected forums
|
||||
$values = request_var($key, array(0 => ''));
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
set_config($key, $news);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class portal_attachments_module
|
||||
{
|
||||
$attach_forums_config = (strpos($config['board3_attachments_forum_ids_' . $module_id], ',') !== false) ? explode(',', $config['board3_attachments_forum_ids_' . $module_id]) : array($config['board3_attachments_forum_ids_' . $module_id]);
|
||||
$forum_list = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
||||
|
||||
|
||||
if($config['board3_attachments_forum_exclude_' . $module_id])
|
||||
{
|
||||
$forum_list = array_unique(array_diff($forum_list, $attach_forums_config));
|
||||
@@ -167,7 +167,7 @@ class portal_attachments_module
|
||||
{
|
||||
$attach_forums_config = (strpos($config['board3_attachments_forum_ids_' . $module_id], ',') !== false) ? explode(',', $config['board3_attachments_forum_ids_' . $module_id]) : array($config['board3_attachments_forum_ids_' . $module_id]);
|
||||
$forum_list = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
||||
|
||||
|
||||
if($config['board3_attachments_forum_exclude_' . $module_id])
|
||||
{
|
||||
$forum_list = array_unique(array_diff($forum_list, $attach_forums_config));
|
||||
@@ -297,29 +297,29 @@ class portal_attachments_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Create select box for attachment filetype
|
||||
public function select_filetype($value, $key, $module_id)
|
||||
{
|
||||
global $db, $user, $config;
|
||||
|
||||
|
||||
// Get extensions
|
||||
$sql = 'SELECT *
|
||||
FROM ' . EXTENSIONS_TABLE . '
|
||||
ORDER BY extension ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$extensions[] = $row;
|
||||
}
|
||||
|
||||
|
||||
$selected = array();
|
||||
if(isset($config['board3_attachments_filetype_' . $module_id]) && strlen($config['board3_attachments_filetype_' . $module_id]) > 0)
|
||||
{
|
||||
$selected = explode(',', $config['board3_attachments_filetype_' . $module_id]);
|
||||
}
|
||||
|
||||
|
||||
// Build options
|
||||
$ext_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
|
||||
foreach ($extensions as $id => $ext)
|
||||
@@ -327,31 +327,31 @@ class portal_attachments_module
|
||||
$ext_options .= '<option value="' . $ext['extension'] . '"' . ((in_array($ext['extension'], $selected)) ? ' selected="selected"' : '') . '>' . $ext['extension'] . '</option>';
|
||||
}
|
||||
$ext_options .= '</select>';
|
||||
|
||||
|
||||
return $ext_options;
|
||||
}
|
||||
|
||||
|
||||
// Store selected filetypes
|
||||
public function store_filetypes($key, $module_id)
|
||||
{
|
||||
global $db, $cache;
|
||||
|
||||
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
|
||||
|
||||
$filetypes = implode(',', $values);
|
||||
|
||||
|
||||
set_config('board3_attachments_filetype_' . $module_id, $filetypes);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Create forum select box
|
||||
public 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)
|
||||
{
|
||||
@@ -368,18 +368,15 @@ class portal_attachments_module
|
||||
return $s_forum_options;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Store selected forums
|
||||
public function store_selected_forums($key)
|
||||
{
|
||||
global $db, $cache;
|
||||
|
||||
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
set_config($key, $news);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,18 +46,18 @@ class portal_calendar_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_calendar_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_calendar';
|
||||
|
||||
|
||||
/**
|
||||
* additional variables
|
||||
*/
|
||||
private $mini_cal_fdow;
|
||||
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
@@ -68,7 +68,7 @@ class portal_calendar_module
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $user, $phpbb_root_path, $phpEx, $db;
|
||||
|
||||
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
// 0 = Sunday first - 1 = Monday first. ;-)
|
||||
@@ -98,7 +98,7 @@ class portal_calendar_module
|
||||
$mini_cal_this_month = $this->dateMM;
|
||||
$mini_cal_this_day = $this->dateDD;
|
||||
$mini_cal_month_days = $this->daysMonth;
|
||||
|
||||
|
||||
// output our general calendar bits
|
||||
$down = $this->mini_cal_month - 1;
|
||||
$up = $this->mini_cal_month + 1;
|
||||
@@ -180,9 +180,9 @@ class portal_calendar_module
|
||||
$time_ary[$key] = $cur_event['start_time'];
|
||||
}
|
||||
array_multisort($time_ary, SORT_NUMERIC, $events);
|
||||
|
||||
|
||||
$groups_ary = get_user_groups();
|
||||
|
||||
|
||||
foreach($events as $key => $cur_event)
|
||||
{
|
||||
if(($cur_event['start_time'] + $user->timezone + $user->dst) >= $today_timestamp ||
|
||||
@@ -191,7 +191,7 @@ class portal_calendar_module
|
||||
{
|
||||
$cur_permissions = explode(',', $cur_event['permission']);
|
||||
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
||||
|
||||
|
||||
if(!empty($permission_check) || $cur_event['permission'] == '')
|
||||
{
|
||||
// check if this is an external link
|
||||
@@ -275,7 +275,7 @@ class portal_calendar_module
|
||||
set_config('board3_display_events_' . $module_id, 0);
|
||||
set_config('board3_events_' . $module_id, '');
|
||||
set_config('board3_events_url_new_window_' . $module_id, 0);
|
||||
|
||||
|
||||
set_portal_config('board3_calendar_events_' . $module_id, '');
|
||||
return true;
|
||||
}
|
||||
@@ -283,13 +283,13 @@ class portal_calendar_module
|
||||
public function uninstall($module_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$del_config = array(
|
||||
'board3_calendar_events_' . $module_id,
|
||||
);
|
||||
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
|
||||
|
||||
$db->sql_query($sql);
|
||||
|
||||
$del_config = array(
|
||||
@@ -305,11 +305,11 @@ class portal_calendar_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
public function manage_events($value, $key, $module_id)
|
||||
{
|
||||
global $db, $portal_config, $config, $template, $user, $phpEx, $phpbb_admin_path;
|
||||
|
||||
|
||||
$action = request_var('action', '');
|
||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
||||
$action = (isset($_POST['save'])) ? 'save' : $action;
|
||||
@@ -319,7 +319,7 @@ class portal_calendar_module
|
||||
$events = (strlen($portal_config['board3_calendar_events_' . $module_id]) >= 1) ? $this->utf_unserialize($portal_config['board3_calendar_events_' . $module_id]) : array();
|
||||
|
||||
$u_action = append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=portal&mode=config&module_id=' . $module_id);
|
||||
|
||||
|
||||
switch($action)
|
||||
{
|
||||
// Save changes
|
||||
@@ -339,7 +339,7 @@ class portal_calendar_module
|
||||
$event_url = request_var('event_url', ' ');
|
||||
$event_permission = request_var('permission-setting-calendar', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
|
||||
/*
|
||||
* parse the event time
|
||||
* first check for obvious errors, we don't want to waste server resources
|
||||
@@ -363,7 +363,7 @@ class portal_calendar_module
|
||||
$start_year = (int) substr($event_start_day, $second_start_hyphen + 1, $start_day_length - $second_start_hyphen);
|
||||
$start_hour = (int) substr($event_start_time, 0, $start_colon_pos);
|
||||
$start_minute = (int) substr($event_start_time, $start_colon_pos + 1, ($start_time_length - $start_colon_pos) - 1);
|
||||
|
||||
|
||||
if(!$event_all_day)
|
||||
{
|
||||
$first_end_hyphen = strpos($event_end_day, '-', 0);
|
||||
@@ -377,7 +377,7 @@ class portal_calendar_module
|
||||
$end_hour = (int) substr($event_end_time, 0, $end_colon_pos);
|
||||
$end_minute = (int) substr($event_end_time, $end_colon_pos + 1, ($end_time_length - $end_colon_pos) - 1);
|
||||
}
|
||||
|
||||
|
||||
// UNIX timestamps
|
||||
$start_time = gmmktime($start_hour, $start_minute, 0, $start_month, $start_day, $start_year) - $user->timezone - $user->dst;
|
||||
$end_time = (!$event_all_day) ? gmmktime($end_hour, $end_minute, 0, $end_month, $end_day, $end_year) - $user->timezone - $user->dst : '';
|
||||
@@ -390,7 +390,7 @@ class portal_calendar_module
|
||||
{
|
||||
trigger_error($user->lang['ACP_PORTAL_CALENDAR_EVENT_START_FIRST']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -401,7 +401,7 @@ class portal_calendar_module
|
||||
$groups_ary[] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
$event_permission = array_intersect($event_permission, $groups_ary);
|
||||
$event_permission = implode(',', $event_permission);
|
||||
|
||||
@@ -420,7 +420,7 @@ class portal_calendar_module
|
||||
if (isset($link_id) && $link_id < sizeof($events))
|
||||
{
|
||||
$message = $user->lang['EVENT_UPDATED'];
|
||||
|
||||
|
||||
$events[$link_id] = array(
|
||||
'title' => $event_title,
|
||||
'desc' => $event_desc,
|
||||
@@ -436,7 +436,7 @@ class portal_calendar_module
|
||||
else
|
||||
{
|
||||
$message = $user->lang['EVENT_ADDED'];
|
||||
|
||||
|
||||
$events[] = array(
|
||||
'title' => $event_title,
|
||||
'desc' => $event_desc,
|
||||
@@ -448,7 +448,7 @@ class portal_calendar_module
|
||||
);
|
||||
add_log('admin', 'LOG_PORTAL_EVENT_ADDED', $event_title);
|
||||
}
|
||||
|
||||
|
||||
// we sort the $events array by the start time
|
||||
foreach($events as $key => $cur_event)
|
||||
{
|
||||
@@ -476,7 +476,7 @@ class portal_calendar_module
|
||||
// delete the selected link and reset the array numbering afterwards
|
||||
array_splice($events, $link_id, 1);
|
||||
$events = array_merge($events);
|
||||
|
||||
|
||||
$board3_events_array = serialize($events);
|
||||
set_portal_config('board3_calendar_events_' . $module_id, $board3_events_array);
|
||||
|
||||
@@ -496,7 +496,7 @@ class portal_calendar_module
|
||||
case 'edit':
|
||||
case 'add':
|
||||
$event_all_day = (isset($events[$link_id]['all_day']) && $events[$link_id]['all_day'] == true) ? true : false;
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'EVENT_TITLE' => (isset($events[$link_id]['title']) && $action != 'add') ? $events[$link_id]['title'] : '',
|
||||
'EVENT_DESC' => (isset($events[$link_id]['desc']) && $action != 'add') ? $events[$link_id]['desc'] : '',
|
||||
@@ -512,9 +512,9 @@ class portal_calendar_module
|
||||
|
||||
'S_EDIT' => true,
|
||||
));
|
||||
|
||||
|
||||
$groups_ary = (isset($events[$link_id]['permission'])) ? explode(',', $events[$link_id]['permission']) : array();
|
||||
|
||||
|
||||
// get group info from database and assign the block vars
|
||||
$sql = 'SELECT group_id, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -534,13 +534,13 @@ class portal_calendar_module
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for ($i = 0; $i < sizeof($events); $i++)
|
||||
{
|
||||
$event_all_day = ($events[$i]['all_day'] == true) ? true : false;
|
||||
$start_time_format = (!intval($user->format_date($events[$i]['start_time'], 'H')) && !intval($user->format_date($events[$i]['start_time'], 'i'))) ? 'j. M Y' : 'j. M Y, H:i';
|
||||
$end_time_format = (!intval($user->format_date($events[$i]['end_time'], 'H')) && !intval($user->format_date($events[$i]['end_time'], 'i'))) ? 'j. M Y' : 'j. M Y, H:i';
|
||||
|
||||
|
||||
$template->assign_block_vars('events', array(
|
||||
'EVENT_TITLE' => ($action != 'add') ? ((isset($user->lang[$events[$i]['title']])) ? $user->lang[$events[$i]['title']] : $events[$i]['title']) : '',
|
||||
'EVENT_DESC' => ($action != 'add') ? $events[$i]['desc'] : '',
|
||||
@@ -553,14 +553,14 @@ class portal_calendar_module
|
||||
'EVENT_ALL_DAY' => $event_all_day,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function update_events($key, $module_id)
|
||||
{
|
||||
$this->manage_events('', $key, $module_id);
|
||||
}
|
||||
|
||||
|
||||
private $dateYYY; // year in numeric format (YYYY)
|
||||
private $dateMM; // month in numeric format (MM)
|
||||
private $dateDD; // day in numeric format (DD)
|
||||
@@ -594,7 +594,7 @@ class portal_calendar_module
|
||||
$today_timestamp = time() + $user->timezone + $user->dst;
|
||||
$cur_month = date("n", $today_timestamp);
|
||||
$correct_month = $cur_month + $this->mini_cal_month;
|
||||
|
||||
|
||||
// move back or forth the correct number of years
|
||||
while ($correct_month < 1 || $correct_month > self::MONTHS_PER_YEAR)
|
||||
{
|
||||
@@ -607,7 +607,7 @@ class portal_calendar_module
|
||||
$correct_month = $correct_month - self::MONTHS_PER_YEAR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fix incorrect months
|
||||
while (date("n", $this->stamp) != $correct_month)
|
||||
{
|
||||
@@ -626,7 +626,7 @@ class portal_calendar_module
|
||||
$this->ext_dateMM = date("F", $this->stamp);
|
||||
$this->dateDD = date("d", $this->stamp);
|
||||
$this->daysMonth = date("t", $this->stamp);
|
||||
|
||||
|
||||
for ($i=1; $i < $this->daysMonth + 1; $i++)
|
||||
{
|
||||
$this->makeTimestamp("$i $this->ext_dateMM $this->dateYYYY");
|
||||
@@ -638,14 +638,14 @@ class portal_calendar_module
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Unserialize links array
|
||||
private function utf_unserialize($serial_str)
|
||||
{
|
||||
$out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );
|
||||
return unserialize($out);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* validate URLs and execute apppend_sid if necessary
|
||||
*/
|
||||
@@ -656,19 +656,19 @@ class portal_calendar_module
|
||||
$url = str_replace("\r\n", "\n", str_replace('\"', '"', trim($url)));
|
||||
$url = str_replace(' ', '%20', $url);
|
||||
$url = str_replace('&', '&', $url);
|
||||
|
||||
|
||||
// if there is no scheme, then add http schema
|
||||
if (!preg_match('#^[a-z][a-z\d+\-.]*:/{2}#i', $url))
|
||||
{
|
||||
$url = 'http://' . $url;
|
||||
}
|
||||
|
||||
|
||||
// Is this a link to somewhere inside this board? If so then run reapply_sid()
|
||||
if (strpos($url, generate_board_url()) !== false)
|
||||
{
|
||||
$url = reapply_sid($url);
|
||||
}
|
||||
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_custom_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_custom_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
@@ -74,7 +74,7 @@ class portal_custom_module
|
||||
{
|
||||
$assign_code = htmlspecialchars_decode($portal_config['board3_custom_' . $module_id . '_code'], ENT_QUOTES);
|
||||
}
|
||||
|
||||
|
||||
$title = (!empty($config['board3_custom_' . $module_id . '_title'])) ? ((isset($user->lang[$config['board3_custom_' . $module_id . '_title']])) ? $user->lang[$config['board3_custom_' . $module_id . '_title']] : $config['board3_custom_' . $module_id . '_title']) : $user->lang[$this->name];
|
||||
|
||||
if(!empty($assign_code))
|
||||
@@ -109,7 +109,7 @@ class portal_custom_module
|
||||
{
|
||||
$assign_code = htmlspecialchars_decode($portal_config['board3_custom_' . $module_id . '_code'], ENT_QUOTES);
|
||||
}
|
||||
|
||||
|
||||
$title = (!empty($config['board3_custom_' . $module_id . '_title'])) ? ((isset($user->lang[$config['board3_custom_' . $module_id . '_title']])) ? $user->lang[$config['board3_custom_' . $module_id . '_title']] : $config['board3_custom_' . $module_id . '_title']) : $user->lang[$this->name];
|
||||
|
||||
if(!empty($assign_code))
|
||||
@@ -159,7 +159,7 @@ class portal_custom_module
|
||||
);
|
||||
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
|
||||
|
||||
$check = $db->sql_query($sql);
|
||||
|
||||
$del_config = array(
|
||||
@@ -174,19 +174,19 @@ class portal_custom_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return ((!$check) ? $check : $db->sql_query($sql)); // if something went wrong, make sure we are aware of the first query
|
||||
}
|
||||
|
||||
|
||||
public function manage_custom($value, $key, $module_id)
|
||||
{
|
||||
global $db, $portal_config, $config, $template, $user, $phpEx, $phpbb_admin_path, $phpbb_root_path;
|
||||
|
||||
|
||||
$action = (isset($_POST['reset'])) ? 'reset' : '';
|
||||
$action = (isset($_POST['submit'])) ? 'save' : $action;
|
||||
$action = (isset($_POST['preview'])) ? 'preview' : $action;
|
||||
|
||||
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
$u_action = append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=portal&mode=config&module_id=' . $module_id);
|
||||
|
||||
|
||||
switch($action)
|
||||
{
|
||||
// Save changes
|
||||
@@ -208,14 +208,13 @@ class portal_custom_module
|
||||
{
|
||||
generate_text_for_storage($custom_code, $uid, $bitfield, $flags, true, true, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// first check for obvious errors, we don't want to waste server resources
|
||||
if(empty($custom_code))
|
||||
{
|
||||
trigger_error($user->lang['ACP_PORTAL_CUSTOM_CODE_SHORT']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -226,12 +225,12 @@ class portal_custom_module
|
||||
$groups_ary[] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
$custom_permission = array_intersect($custom_permission, $groups_ary);
|
||||
$custom_permission = implode(',', $custom_permission);
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_CONFIG', $user->lang['PORTAL_CUSTOM'] . ' - ' . $config['board3_custom_' . $module_id . '_title']);
|
||||
|
||||
|
||||
// set_portal_config will take care of escaping the welcome message
|
||||
set_portal_config('board3_custom_' . $module_id . '_code', $custom_code);
|
||||
set_config('board3_custom_' . $module_id . '_bbcode', $custom_bbcode);
|
||||
@@ -244,7 +243,7 @@ class portal_custom_module
|
||||
//trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link(($module_id) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=portal&mode=modules') : $u_action));
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'preview':
|
||||
$custom_code = $text = utf8_normalize_nfc(request_var('custom_code', '', true));
|
||||
$custom_bbcode = request_var('custom_use_bbcode', 1); // default to BBCode
|
||||
@@ -252,13 +251,13 @@ class portal_custom_module
|
||||
$custom_title = utf8_normalize_nfc(request_var('module_name', ''));
|
||||
$custom_image_src = utf8_normalize_nfc(request_var('module_image', ''));
|
||||
$groups_ary = array();
|
||||
|
||||
|
||||
// first check for obvious errors, we don't want to waste server resources
|
||||
if(empty($custom_code))
|
||||
{
|
||||
trigger_error($user->lang['ACP_PORTAL_CUSTOM_CODE_SHORT']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
if (!class_exists('parse_message'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
|
||||
@@ -270,19 +269,19 @@ class portal_custom_module
|
||||
$bitfield = (isset($config['board3_custom_' . $module_id . '_bitfield'])) ? $config['board3_custom_' . $module_id . '_bitfield'] : '';
|
||||
$options = OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS;
|
||||
generate_text_for_storage($text, $uid, $bitfield, $options, true, true, true);
|
||||
|
||||
|
||||
$text = generate_text_for_display($text, $uid, $bitfield, $options);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = htmlspecialchars_decode($text, ENT_QUOTES);
|
||||
}
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PREVIEW_TEXT' => $text,
|
||||
'S_PREVIEW' => true,
|
||||
));
|
||||
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -293,7 +292,7 @@ class portal_custom_module
|
||||
$groups_ary[] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
$temp_permissions = array_intersect($custom_permission, $groups_ary);
|
||||
|
||||
// Edit or add menu item
|
||||
@@ -317,9 +316,9 @@ class portal_custom_module
|
||||
'S_BBCODE_ALLOWED' => true,
|
||||
'MAX_FONT_SIZE' => (int) $config['max_post_font_size'],
|
||||
));
|
||||
|
||||
|
||||
$groups_ary = (isset($temp_permissions)) ? $temp_permissions : ((isset($config['board3_custom_' . $module_id . '_permission'])) ? explode(',', $config['board3_custom_' . $module_id . '_permission']) : array());
|
||||
|
||||
|
||||
// get group info from database and assign the block vars
|
||||
$sql = 'SELECT group_id, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -334,12 +333,12 @@ class portal_custom_module
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
if(!function_exists('display_forums'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
}
|
||||
|
||||
|
||||
// Build custom bbcodes array
|
||||
display_custom_bbcodes();
|
||||
$user->add_lang('posting');
|
||||
@@ -347,7 +346,7 @@ class portal_custom_module
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function update_custom($key, $module_id)
|
||||
{
|
||||
$this->manage_custom('', $key, $module_id);
|
||||
|
||||
@@ -46,13 +46,13 @@ class portal_modulename_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = '';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
*/
|
||||
public $custom_acp_tpl = '';
|
||||
|
||||
|
||||
/**
|
||||
* hide module name in ACP configuration page
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ class portal_donation_module
|
||||
public function get_template_center($module_id)
|
||||
{
|
||||
global $config, $template;
|
||||
|
||||
|
||||
$template->assign_var('PAY_ACC_CENTER', $config['board3_pay_acc_' . $module_id]);
|
||||
|
||||
return 'donation_center.html';
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_forumlist_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_forumlist_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_latest_bots_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_latest_bots_module';
|
||||
|
||||
|
||||
/**
|
||||
* hide module name in ACP configuration page
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ class portal_latest_bots_module
|
||||
AND user_lastvisit > 0
|
||||
ORDER BY user_lastvisit DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['board3_last_visited_bots_number_' . $module_id]);
|
||||
|
||||
|
||||
$show_module = false;
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
|
||||
@@ -50,7 +50,7 @@ class portal_leaders_module
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $user, $auth, $db, $phpEx, $phpbb_root_path;
|
||||
|
||||
|
||||
// Display a listing of board admins, moderators
|
||||
$user->add_lang('groups');
|
||||
|
||||
@@ -164,7 +164,7 @@ class portal_leaders_module
|
||||
));
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['group_name'] == 'ADMINISTRATORS')
|
||||
|
||||
@@ -46,13 +46,13 @@ class portal_links_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_links_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_links';
|
||||
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
@@ -65,9 +65,9 @@ class portal_links_module
|
||||
|
||||
$links = array();
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
|
||||
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
|
||||
|
||||
|
||||
// get user's groups
|
||||
$groups_ary = get_user_groups();
|
||||
|
||||
@@ -82,10 +82,10 @@ class portal_links_module
|
||||
{
|
||||
$cur_url = $links[$i]['url'];
|
||||
}
|
||||
|
||||
|
||||
$cur_permissions = explode(',', $links[$i]['permission']);
|
||||
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
||||
|
||||
|
||||
if(!empty($permission_check) || $links[$i]['permission'] == '')
|
||||
{
|
||||
$template->assign_block_vars('portallinks', array(
|
||||
@@ -119,29 +119,29 @@ class portal_links_module
|
||||
public function install($module_id)
|
||||
{
|
||||
global $phpbb_root_path, $db;
|
||||
|
||||
|
||||
$links = array();
|
||||
|
||||
|
||||
$links_titles = array(
|
||||
'Board3.de',
|
||||
'phpBB.com',
|
||||
);
|
||||
|
||||
|
||||
$links_types = array(
|
||||
self::LINK_EXT,
|
||||
self::LINK_EXT,
|
||||
);
|
||||
|
||||
|
||||
$links_urls = array(
|
||||
'http://www.board3.de/',
|
||||
'http://www.phpbb.com/',
|
||||
);
|
||||
|
||||
|
||||
$links_permissions = array(
|
||||
'',
|
||||
'',
|
||||
);
|
||||
|
||||
|
||||
foreach($links_urls as $i => $url)
|
||||
{
|
||||
$links[] = array(
|
||||
@@ -151,12 +151,12 @@ class portal_links_module
|
||||
'permission' => $links_permissions[$i],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$board3_menu_array = serialize($links);
|
||||
set_portal_config('board3_links_array_' . $module_id, $board3_menu_array);
|
||||
set_config('board3_links_' . $module_id, '');
|
||||
set_config('board3_links_url_new_window_' . $module_id, 0);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -169,9 +169,9 @@ class portal_links_module
|
||||
);
|
||||
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
|
||||
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
||||
$del_config = array(
|
||||
'board3_links_' . $module_id,
|
||||
'board3_links_url_new_window_' . $module_id
|
||||
@@ -180,18 +180,18 @@ class portal_links_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Manage the menu links
|
||||
public function manage_links($value, $key, $module_id)
|
||||
{
|
||||
global $config, $phpbb_admin_path, $user, $phpEx, $db, $template;
|
||||
|
||||
|
||||
$action = request_var('action', '');
|
||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
||||
$action = (isset($_POST['save'])) ? 'save' : $action;
|
||||
$link_id = request_var('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
|
||||
$links = array();
|
||||
|
||||
$links = $this->utf_unserialize($portal_config['board3_links_array_' . $module_id]);
|
||||
@@ -213,7 +213,7 @@ class portal_links_module
|
||||
$link_url = str_replace('&', '&', $link_url);
|
||||
$link_permission = request_var('permission-setting-link', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -224,7 +224,7 @@ class portal_links_module
|
||||
$groups_ary[] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
$link_permissions = array_intersect($link_permission, $groups_ary);
|
||||
$link_permissions = implode(',', $link_permissions);
|
||||
|
||||
@@ -243,7 +243,7 @@ class portal_links_module
|
||||
if (isset($link_id) && $link_id < sizeof($links))
|
||||
{
|
||||
$message = $user->lang['LINK_UPDATED'];
|
||||
|
||||
|
||||
$links[$link_id] = array(
|
||||
'title' => $link_title,
|
||||
'url' => htmlspecialchars_decode($link_url),
|
||||
@@ -265,7 +265,7 @@ class portal_links_module
|
||||
);
|
||||
add_log('admin', 'LOG_PORTAL_LINK_ADDED', $link_title);
|
||||
}
|
||||
|
||||
|
||||
$board3_links_array = serialize($links);
|
||||
set_portal_config('board3_links_array_' . $module_id, $board3_links_array);
|
||||
|
||||
@@ -287,7 +287,7 @@ class portal_links_module
|
||||
// delete the selected link and reset the array numbering afterwards
|
||||
array_splice($links, $link_id, 1);
|
||||
$links = array_merge($links);
|
||||
|
||||
|
||||
$board3_links_array = serialize($links);
|
||||
set_portal_config('board3_links_array_' . $module_id, $board3_links_array);
|
||||
|
||||
@@ -332,7 +332,7 @@ class portal_links_module
|
||||
'type' => $links[$link_id]['type'],
|
||||
'permission' => $links[$link_id]['permission'],
|
||||
);
|
||||
|
||||
|
||||
// move the info of the links we replace in the order
|
||||
$links[$link_id] = array(
|
||||
'title' => $links[$switch_order_id]['title'],
|
||||
@@ -340,7 +340,7 @@ class portal_links_module
|
||||
'type' => $links[$switch_order_id]['type'],
|
||||
'permission' => $links[$switch_order_id]['permission'],
|
||||
);
|
||||
|
||||
|
||||
// insert the info of the moved link
|
||||
$links[$switch_order_id] = $cur_link;
|
||||
|
||||
@@ -362,9 +362,9 @@ class portal_links_module
|
||||
'S_EDIT' => true,
|
||||
'S_LINK_IS_INT' => (isset($links[$link_id]['type']) && $links[$link_id]['type'] == self::LINK_INT) ? true : false,
|
||||
));
|
||||
|
||||
|
||||
$groups_ary = (isset($links[$link_id]['permission'])) ? explode(',', $links[$link_id]['permission']) : array();
|
||||
|
||||
|
||||
// get group info from database and assign the block vars
|
||||
$sql = 'SELECT group_id, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -398,12 +398,12 @@ class portal_links_module
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function update_links($key, $module_id)
|
||||
{
|
||||
$this->manage_links('', $key, $module_id);
|
||||
}
|
||||
|
||||
|
||||
// Unserialize links array
|
||||
private function utf_unserialize($serial_str)
|
||||
{
|
||||
|
||||
@@ -46,13 +46,13 @@ class portal_main_menu_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_main_menu_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_menu';
|
||||
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
@@ -66,7 +66,7 @@ class portal_main_menu_module
|
||||
|
||||
$links = array();
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
|
||||
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
||||
|
||||
// get user's groups
|
||||
@@ -92,10 +92,10 @@ class portal_main_menu_module
|
||||
{
|
||||
$cur_url = $links[$i]['url'];
|
||||
}
|
||||
|
||||
|
||||
$cur_permissions = explode(',', $links[$i]['permission']);
|
||||
$permission_check = array_intersect($groups_ary, $cur_permissions);
|
||||
|
||||
|
||||
if(!empty($permission_check) || $links[$i]['permission'] == '')
|
||||
{
|
||||
$template->assign_block_vars('portalmenu.links', array(
|
||||
@@ -129,19 +129,19 @@ class portal_main_menu_module
|
||||
public function install($module_id)
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $db;
|
||||
|
||||
|
||||
// get the correct group IDs from the database
|
||||
$in_ary = array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA');
|
||||
|
||||
|
||||
$sql = 'SELECT group_id, group_name FROM ' . GROUPS_TABLE . ' WHERE ' . $db->sql_in_set('group_name', $in_ary);
|
||||
$result = $db->sql_query($sql);
|
||||
while($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$groups_ary[$row['group_name']] = $row['group_id'];
|
||||
}
|
||||
|
||||
|
||||
$links = array();
|
||||
|
||||
|
||||
$links_titles = array(
|
||||
'M_CONTENT',
|
||||
'INDEX',
|
||||
@@ -155,7 +155,7 @@ class portal_main_menu_module
|
||||
'M_TERMS',
|
||||
'M_PRV',
|
||||
);
|
||||
|
||||
|
||||
$links_types = array(
|
||||
self::LINK_CAT,
|
||||
self::LINK_INT,
|
||||
@@ -169,7 +169,7 @@ class portal_main_menu_module
|
||||
self::LINK_INT,
|
||||
self::LINK_INT,
|
||||
);
|
||||
|
||||
|
||||
$links_urls = array(
|
||||
'',
|
||||
'index.' . $phpEx,
|
||||
@@ -183,7 +183,7 @@ class portal_main_menu_module
|
||||
'ucp.' . $phpEx . '?mode=terms',
|
||||
'ucp.' . $phpEx . '?mode=privacy',
|
||||
);
|
||||
|
||||
|
||||
$links_permissions = array(
|
||||
'',
|
||||
'',
|
||||
@@ -197,7 +197,7 @@ class portal_main_menu_module
|
||||
'',
|
||||
'',
|
||||
);
|
||||
|
||||
|
||||
foreach($links_urls as $i => $url)
|
||||
{
|
||||
$links[] = array(
|
||||
@@ -207,12 +207,12 @@ class portal_main_menu_module
|
||||
'permission' => $links_permissions[$i],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$board3_menu_array = serialize($links);
|
||||
set_portal_config('board3_menu_array_' . $module_id, $board3_menu_array);
|
||||
set_config('board3_menu_' . $module_id, '');
|
||||
set_config('board3_menu_url_new_window_' . $module_id, 0);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -225,9 +225,9 @@ class portal_main_menu_module
|
||||
);
|
||||
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
|
||||
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
||||
$del_config = array(
|
||||
'board3_menu_' . $module_id,
|
||||
'board3_menu_url_new_window_' . $module_id,
|
||||
@@ -236,18 +236,18 @@ class portal_main_menu_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Manage the menu links
|
||||
public function manage_links($value, $key, $module_id)
|
||||
{
|
||||
global $config, $phpbb_admin_path, $user, $phpEx, $db, $template;
|
||||
|
||||
|
||||
$action = request_var('action', '');
|
||||
$action = (isset($_POST['add'])) ? 'add' : $action;
|
||||
$action = (isset($_POST['save'])) ? 'save' : $action;
|
||||
$link_id = request_var('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
|
||||
$links = array();
|
||||
|
||||
$links = $this->utf_unserialize($portal_config['board3_menu_array_' . $module_id]);
|
||||
@@ -270,7 +270,7 @@ class portal_main_menu_module
|
||||
$link_url = str_replace('&', '&', $link_url);
|
||||
$link_permission = request_var('permission-setting-menu', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -281,7 +281,7 @@ class portal_main_menu_module
|
||||
$groups_ary[] = $row['group_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
$link_permissions = array_intersect($link_permission, $groups_ary);
|
||||
$link_permissions = implode(',', $link_permissions);
|
||||
|
||||
@@ -300,7 +300,7 @@ class portal_main_menu_module
|
||||
if (isset($link_id) && $link_id < sizeof($links))
|
||||
{
|
||||
$message = $user->lang['LINK_UPDATED'];
|
||||
|
||||
|
||||
$links[$link_id] = array(
|
||||
'title' => $link_title,
|
||||
'url' => htmlspecialchars_decode($link_url),
|
||||
@@ -326,7 +326,7 @@ class portal_main_menu_module
|
||||
);
|
||||
add_log('admin', 'LOG_PORTAL_LINK_ADDED', $link_title);
|
||||
}
|
||||
|
||||
|
||||
$board3_menu_array = serialize($links);
|
||||
set_portal_config('board3_menu_array_' . $module_id, $board3_menu_array);
|
||||
|
||||
@@ -348,7 +348,7 @@ class portal_main_menu_module
|
||||
// delete the selected link and reset the array numbering afterwards
|
||||
array_splice($links, $link_id, 1);
|
||||
$links = array_merge($links);
|
||||
|
||||
|
||||
$board3_menu_array = serialize($links);
|
||||
set_portal_config('board3_menu_array_' . $module_id, $board3_menu_array);
|
||||
|
||||
@@ -393,7 +393,7 @@ class portal_main_menu_module
|
||||
'type' => $links[$link_id]['type'],
|
||||
'permission' => $links[$link_id]['permission'],
|
||||
);
|
||||
|
||||
|
||||
// move the info of the links we replace in the order
|
||||
$links[$link_id] = array(
|
||||
'title' => $links[$switch_order_id]['title'],
|
||||
@@ -401,7 +401,7 @@ class portal_main_menu_module
|
||||
'type' => $links[$switch_order_id]['type'],
|
||||
'permission' => $links[$switch_order_id]['permission'],
|
||||
);
|
||||
|
||||
|
||||
// insert the info of the moved link
|
||||
$links[$switch_order_id] = $cur_link;
|
||||
|
||||
@@ -424,9 +424,9 @@ class portal_main_menu_module
|
||||
'S_LINK_IS_CAT' => (!isset($links[$link_id]['type']) || $links[$link_id]['type'] == self::LINK_CAT) ? true : false,
|
||||
'S_LINK_IS_INT' => (isset($links[$link_id]['type']) && $links[$link_id]['type'] == self::LINK_INT) ? true : false,
|
||||
));
|
||||
|
||||
|
||||
$groups_ary = (isset($links[$link_id]['permission'])) ? explode(',', $links[$link_id]['permission']) : array();
|
||||
|
||||
|
||||
// get group info from database and assign the block vars
|
||||
$sql = 'SELECT group_id, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
@@ -462,12 +462,12 @@ class portal_main_menu_module
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function update_links($key, $module_id)
|
||||
{
|
||||
$this->manage_links('', $key, $module_id);
|
||||
}
|
||||
|
||||
|
||||
// Unserialize links array
|
||||
private function utf_unserialize($serial_str)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ class portal_news_module
|
||||
{
|
||||
$disallow_access = array();
|
||||
}
|
||||
|
||||
|
||||
if($config['board3_news_exclude_' . $module_id] == true)
|
||||
{
|
||||
$disallow_access = array_merge($disallow_access, $forum_from);
|
||||
@@ -134,7 +134,7 @@ class portal_news_module
|
||||
$total_news = (int) $db->sql_fetchfield('num_topics');
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
||||
$topic_tracking_info = get_portal_tracking_info($fetch_news);
|
||||
|
||||
if($news < 0)
|
||||
@@ -159,7 +159,7 @@ class portal_news_module
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
|
||||
|
||||
$read_full_url = (isset($_GET['np'])) ? 'np='. $start . '&news=' . $i . '#n' . $i : 'news=' . $i . '#n' . $i;
|
||||
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($config['board3_news_archive_' . $module_id])
|
||||
@@ -274,7 +274,7 @@ class portal_news_module
|
||||
$open_bracket = '[ ';
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $user->lang['BACK'];
|
||||
|
||||
|
||||
$read_full_url = (isset($_GET['np'])) ? append_sid("{$phpbb_root_path}portal.$phpEx", "np=$start#n$i") : append_sid("{$phpbb_root_path}portal.$phpEx#n$i");
|
||||
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($config['board3_news_archive_' . $module_id])
|
||||
@@ -412,14 +412,14 @@ class portal_news_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Create forum select box
|
||||
public 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)
|
||||
{
|
||||
@@ -436,18 +436,18 @@ class portal_news_module
|
||||
return $s_forum_options;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Store selected forums
|
||||
public 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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_poll_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_poll_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
@@ -58,7 +58,7 @@ class portal_poll_module
|
||||
global $config, $template, $db, $user, $auth, $phpbb_root_path, $phpEx;
|
||||
|
||||
$user->add_lang('viewtopic');
|
||||
|
||||
|
||||
// check if we need to include the bbcode class
|
||||
if(!class_exists('bbcode'))
|
||||
{
|
||||
@@ -218,7 +218,7 @@ class portal_poll_module
|
||||
if($config['board3_poll_topic_id_' . $module_id] !== '')
|
||||
{
|
||||
$poll_forums_config = explode(',' ,$config['board3_poll_topic_id_' . $module_id]);
|
||||
|
||||
|
||||
if($config['board3_poll_exclude_id_' . $module_id])
|
||||
{
|
||||
$forum_list = array_unique(array_diff($forum_list, $poll_forums_config));
|
||||
@@ -439,7 +439,7 @@ class portal_poll_module
|
||||
global $config, $template, $db, $user, $auth, $phpbb_root_path, $phpEx;
|
||||
|
||||
$user->add_lang('viewtopic');
|
||||
|
||||
|
||||
// check if we need to include the bbcode class
|
||||
if(!class_exists('bbcode'))
|
||||
{
|
||||
@@ -599,7 +599,7 @@ class portal_poll_module
|
||||
if($config['board3_poll_topic_id_' . $module_id] !== '')
|
||||
{
|
||||
$poll_forums_config = explode(',' ,$config['board3_poll_topic_id_' . $module_id]);
|
||||
|
||||
|
||||
if($config['board3_poll_exclude_id_' . $module_id])
|
||||
{
|
||||
$forum_list = array_unique(array_diff($forum_list, $poll_forums_config));
|
||||
@@ -858,14 +858,14 @@ class portal_poll_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Create forum select box
|
||||
public 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)
|
||||
{
|
||||
@@ -882,18 +882,18 @@ class portal_poll_module
|
||||
return $s_forum_options;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Store selected forums
|
||||
public function store_selected_forums($key, $module_id)
|
||||
{
|
||||
global $db, $cache;
|
||||
|
||||
|
||||
// Get selected forums
|
||||
$values = request_var($key, array(0 => ''));
|
||||
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
|
||||
set_config($key, $news);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_random_member_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_random_member_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_recent_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_recent_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
@@ -64,7 +64,7 @@ class portal_recent_module
|
||||
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_recent_exclude_forums_' . $module_id]) ? true : false);
|
||||
}
|
||||
|
||||
@@ -210,14 +210,14 @@ class portal_recent_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return $db->sql_query($sql);
|
||||
}
|
||||
|
||||
|
||||
// Create forum select box
|
||||
public 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)
|
||||
{
|
||||
@@ -234,18 +234,18 @@ class portal_recent_module
|
||||
return $s_forum_options;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Store selected forums
|
||||
public 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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_search_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_search_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_statistics_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_statistics_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
@@ -158,22 +158,22 @@ class portal_statistics_module
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Better function with only one query
|
||||
public function get_topics_count()
|
||||
{
|
||||
global $db, $user;
|
||||
|
||||
|
||||
$return_ary = array(
|
||||
POST_ANNOUNCE => 0,
|
||||
POST_STICKY => 0,
|
||||
);
|
||||
|
||||
|
||||
$sql_in = array(
|
||||
POST_ANNOUNCE,
|
||||
POST_STICKY,
|
||||
);
|
||||
|
||||
|
||||
$sql = 'SELECT DISTINCT(topic_id) AS topic_id, topic_type AS type
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('topic_type', $sql_in, false);
|
||||
@@ -185,14 +185,14 @@ class portal_statistics_module
|
||||
case POST_ANNOUNCE:
|
||||
++$return_ary[POST_ANNOUNCE];
|
||||
break;
|
||||
|
||||
|
||||
case POST_STICKY:
|
||||
++$return_ary[POST_STICKY];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
return $return_ary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class portal_user_menu_module
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $user, $auth, $db, $phpEx, $phpbb_root_path;
|
||||
|
||||
|
||||
if (!function_exists('display_forums'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
@@ -62,7 +62,7 @@ class portal_user_menu_module
|
||||
// + new posts since last visit & you post number
|
||||
//
|
||||
$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);
|
||||
@@ -88,7 +88,7 @@ class portal_user_menu_module
|
||||
$result = $db->sql_query($sql);
|
||||
$new_posts_count = (int) $db->sql_fetchfield('total');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
// unread posts
|
||||
$sql_where = 'AND t.topic_moved_id = 0
|
||||
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_welcome_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_welcome_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
@@ -56,7 +56,7 @@ class portal_welcome_module
|
||||
public function get_template_center($module_id)
|
||||
{
|
||||
global $config, $template, $portal_config, $phpEx;
|
||||
|
||||
|
||||
// Generate text for display and assign template vars
|
||||
$uid = $config['board3_welcome_message_uid_' . $module_id];
|
||||
$bitfield = $config['board3_welcome_message_bitfield_' . $module_id];
|
||||
@@ -102,7 +102,7 @@ class portal_welcome_module
|
||||
);
|
||||
$sql = 'DELETE FROM ' . PORTAL_CONFIG_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
|
||||
|
||||
$check = $db->sql_query($sql);
|
||||
|
||||
$del_config = array(
|
||||
@@ -114,19 +114,19 @@ class portal_welcome_module
|
||||
WHERE ' . $db->sql_in_set('config_name', $del_config);
|
||||
return ((!$check) ? $check : $db->sql_query($sql)); // if something went wrong, make sure we are aware of the first query
|
||||
}
|
||||
|
||||
|
||||
public function manage_welcome($value, $key, $module_id)
|
||||
{
|
||||
global $db, $portal_config, $config, $template, $user, $phpEx, $phpbb_admin_path, $phpbb_root_path;
|
||||
|
||||
|
||||
$action = (isset($_POST['reset'])) ? 'reset' : '';
|
||||
$action = (isset($_POST['submit'])) ? 'save' : $action;
|
||||
$action = (isset($_POST['preview'])) ? 'preview' : $action;
|
||||
|
||||
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
$u_action = append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=portal&mode=config&module_id=' . $module_id);
|
||||
|
||||
|
||||
switch($action)
|
||||
{
|
||||
// Save changes
|
||||
@@ -140,22 +140,21 @@ class portal_welcome_module
|
||||
$uid = $bitfield = $flags = '';
|
||||
$options = 7;
|
||||
generate_text_for_storage($welcome_message, $uid, $bitfield, $flags, true, true, true);
|
||||
|
||||
|
||||
|
||||
// first check for obvious errors, we don't want to waste server resources
|
||||
if(empty($welcome_message))
|
||||
{
|
||||
trigger_error($user->lang['ACP_PORTAL_WELCOME_MESSAGE_SHORT']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
add_log('admin', 'LOG_PORTAL_CONFIG', $user->lang['PORTAL_WELCOME']);
|
||||
|
||||
|
||||
// set_portal_config will take care of escaping the welcome message
|
||||
set_portal_config('board3_welcome_message_' . $module_id, $welcome_message);
|
||||
set_config('board3_welcome_message_uid_' . $module_id, $uid);
|
||||
set_config('board3_welcome_message_bitfield_' . $module_id, $bitfield);
|
||||
break;
|
||||
|
||||
|
||||
case 'preview':
|
||||
$welcome_message = $text = utf8_normalize_nfc(request_var('welcome_message', '', true));
|
||||
|
||||
@@ -169,9 +168,9 @@ class portal_welcome_module
|
||||
$bitfield = (isset($config['board3_welcome_message_bitfield_' . $module_id])) ? $config['board3_welcome_message_bitfield_' . $module_id] : '';
|
||||
$options = OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS;
|
||||
generate_text_for_storage($text, $uid, $bitfield, $options, true, true, true);
|
||||
|
||||
|
||||
$text = generate_text_for_display($text, $uid, $bitfield, $options);
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PREVIEW_TEXT' => $text,
|
||||
'S_PREVIEW' => true,
|
||||
@@ -184,7 +183,7 @@ class portal_welcome_module
|
||||
{
|
||||
$welcome_message = generate_text_for_edit($portal_config['board3_welcome_message_' . $module_id], $config['board3_welcome_message_uid_' . $module_id], '');
|
||||
}
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'WELCOME_MESSAGE' => (is_array($welcome_message)) ? $welcome_message['text'] : $welcome_message,
|
||||
//'U_BACK' => $u_action,
|
||||
@@ -197,12 +196,12 @@ class portal_welcome_module
|
||||
'S_BBCODE_ALLOWED' => true,
|
||||
'MAX_FONT_SIZE' => (int) $config['max_post_font_size'],
|
||||
));
|
||||
|
||||
|
||||
if(!function_exists('display_forums'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
||||
}
|
||||
|
||||
|
||||
// Build custom bbcodes array
|
||||
display_custom_bbcodes();
|
||||
$user->add_lang('posting');
|
||||
@@ -210,7 +209,7 @@ class portal_welcome_module
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function update_welcome($key, $module_id)
|
||||
{
|
||||
$this->manage_welcome('', $key, $module_id);
|
||||
|
||||
@@ -46,7 +46,7 @@ class portal_whois_online_module
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_whois_online_module';
|
||||
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
@@ -99,12 +99,12 @@ class portal_whois_online_module
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$legend = implode(', ', $legend);
|
||||
|
||||
|
||||
$template->assign_var('PORTAL_LEGEND', $legend);
|
||||
|
||||
return 'whois_online_center.html';
|
||||
}
|
||||
|
||||
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template, $user, $auth, $db, $phpbb_root_path, $phpEx;
|
||||
|
||||
Reference in New Issue
Block a user