Merge branch 'develop-2.1.x' of github.com:board3/Board3-Portal into feature/controller
Conflicts: root/portal/modules/portal_user_menu.php
This commit is contained in:
@@ -61,7 +61,7 @@ function set_portal_config($config_name, $config_value)
|
||||
}
|
||||
|
||||
$portal_config[$config_name] = $config_value;
|
||||
|
||||
|
||||
$cache->destroy('portal_config');
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ function get_sub_taged_string($message, $bbcode_uid, $length)
|
||||
{
|
||||
include($portal_root_path . '../includes/trim_message/trim_message.' . $phpEx);
|
||||
}
|
||||
|
||||
|
||||
if(!class_exists('phpbb_trim_message_bbcodes'))
|
||||
{
|
||||
include($portal_root_path . '../includes/trim_message/bbcodes.' . $phpEx);
|
||||
@@ -590,9 +590,9 @@ function sql_table_exists($table_name)
|
||||
function get_portal_tracking_info($fetch_news)
|
||||
{
|
||||
global $config, $user;
|
||||
|
||||
|
||||
$last_read = $topic_ids = $forum_ids = $tracking_info = $rev_forum_ids = array();
|
||||
|
||||
|
||||
/**
|
||||
* group everything by the forum IDs
|
||||
*/
|
||||
@@ -604,15 +604,15 @@ function get_portal_tracking_info($fetch_news)
|
||||
$forum_ids[] = $fetch_news[$i]['forum_id'];
|
||||
$rev_forum_ids[$fetch_news[$i]['topic_id']] = $fetch_news[$i]['forum_id']; // the other way round also helps
|
||||
}
|
||||
|
||||
|
||||
foreach ($tracking_info as $forum_id => $current_forum)
|
||||
{
|
||||
if ($config['load_db_lastread'] && $user->data['is_registered'])
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$mark_time = array();
|
||||
|
||||
|
||||
$sql = 'SELECT topic_id, mark_time
|
||||
FROM ' . TOPICS_TRACK_TABLE . "
|
||||
WHERE user_id = {$user->data['user_id']}
|
||||
@@ -703,7 +703,7 @@ function get_portal_tracking_info($fetch_news)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $last_read;
|
||||
}
|
||||
|
||||
@@ -720,24 +720,24 @@ function get_portal_tracking_info($fetch_news)
|
||||
function board3_basic_install($mode = 'install', $purge_modules = true, $u_action = '')
|
||||
{
|
||||
global $db, $phpbb_root_path, $phpEx, $cache, $user, $table_prefix, $config;
|
||||
|
||||
|
||||
// Shouldn't happen but we should check this nonetheless
|
||||
if (!defined('PORTAL_MODULES_TABLE'))
|
||||
{
|
||||
include($phpbb_root_path . 'portal/includes/constants.' . $phpEx);
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 'install')
|
||||
{
|
||||
$directory = $phpbb_root_path . 'portal/modules/';
|
||||
|
||||
|
||||
if ($purge_modules)
|
||||
{
|
||||
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* this is a list of the basic modules that will be installed
|
||||
* module_name => array(module_column, module_order)
|
||||
@@ -753,7 +753,7 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
||||
'portal_topposters' => array(1, 8),
|
||||
'portal_latest_members' => array(1, 9),
|
||||
'portal_link_us' => array(1, 10),
|
||||
|
||||
|
||||
// center column
|
||||
'portal_welcome' => array(2, 1),
|
||||
'portal_recent' => array(2, 2),
|
||||
@@ -761,7 +761,7 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
||||
'portal_news' => array(2, 4),
|
||||
'portal_poll' => array(2, 5),
|
||||
'portal_whois_online' => array(2, 6),
|
||||
|
||||
|
||||
// right column
|
||||
'portal_user_menu' => array(3, 1),
|
||||
'portal_statistics' => array(3, 2),
|
||||
@@ -770,7 +770,7 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
||||
'portal_latest_bots' => array(3, 5),
|
||||
'portal_links' => array(3, 6),
|
||||
);
|
||||
|
||||
|
||||
foreach ($modules_ary as $module_name => $module_data)
|
||||
{
|
||||
$class_name = $module_name . '_module';
|
||||
@@ -782,7 +782,7 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
$c_class = new $class_name();
|
||||
|
||||
$sql_ary = array(
|
||||
@@ -801,7 +801,7 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
||||
|
||||
$c_class->install($db->sql_nextid());
|
||||
}
|
||||
|
||||
|
||||
// Make sure we get rid of old data
|
||||
$cache->destroy('portal_modules');
|
||||
|
||||
@@ -824,28 +824,28 @@ function board3_basic_install($mode = 'install', $purge_modules = true, $u_actio
|
||||
$sql = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE config_name ' . $db->sql_like_expression(utf8_clean_string('board3_') . $db->any_char) . '
|
||||
AND ' . $db->sql_in_set('config_name', $skip_entries, true);
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
||||
return $user->lang['PORTAL_BASIC_UNINSTALL'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* check if the entered source file actually exists
|
||||
*/
|
||||
function check_file_src($value, $key, $module_id, $force_error = true)
|
||||
{
|
||||
global $db, $phpbb_root_path, $phpEx, $user;
|
||||
|
||||
|
||||
$error = '';
|
||||
|
||||
|
||||
// We check if the chosen file is present in all active styles
|
||||
$sql = 'SELECT st.theme_path
|
||||
FROM ' . STYLES_THEME_TABLE . ' st
|
||||
LEFT JOIN ' . STYLES_TABLE . ' s
|
||||
ON (st.theme_id = s.style_id)
|
||||
WHERE s.style_active = 1';
|
||||
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
@@ -855,7 +855,7 @@ function check_file_src($value, $key, $module_id, $force_error = true)
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
if (!empty($error))
|
||||
{
|
||||
if ($force_error)
|
||||
|
||||
@@ -22,7 +22,7 @@ class portal_upload
|
||||
*/
|
||||
private $upload_path;
|
||||
private $u_action;
|
||||
|
||||
|
||||
/*
|
||||
* constructor function
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ class portal_upload
|
||||
$this->upload_file();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* upload module zip
|
||||
*/
|
||||
@@ -50,7 +50,7 @@ class portal_upload
|
||||
$upload = new fileupload();
|
||||
// Only allow ZIP files
|
||||
$upload->set_allowed_extensions(array('zip'));
|
||||
|
||||
|
||||
$file = $upload->form_upload('modupload');
|
||||
|
||||
// this is for module zips so don't allow anything else
|
||||
@@ -64,7 +64,7 @@ class portal_upload
|
||||
{
|
||||
$file->clean_filename('real');
|
||||
$file->move_file(str_replace($phpbb_root_path, '', $this->upload_path), true, true);
|
||||
|
||||
|
||||
if (!sizeof($file->error))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_compress.' . $phpEx);
|
||||
@@ -86,7 +86,7 @@ class portal_upload
|
||||
// We need to move that directory then
|
||||
$this->directory_move($mod_dir . '_tmp/' . $folder_contents[0], $this->upload_path . $folder_contents[0]);
|
||||
$new_mod_dir = $this->upload_path . $folder_contents[0];
|
||||
|
||||
|
||||
}
|
||||
else if (!is_dir($mod_dir))
|
||||
{
|
||||
@@ -96,24 +96,24 @@ class portal_upload
|
||||
}
|
||||
|
||||
$this->directory_delete($mod_dir . '_tmp/');
|
||||
|
||||
|
||||
// make sure we set $mod_dir to the correct folder after the above step
|
||||
$mod_dir = (isset($new_mod_dir)) ? $new_mod_dir : $mod_dir;
|
||||
|
||||
|
||||
// if we got until here set $actions['NEW_FILES']
|
||||
$actions['NEW_FILES'] = array();
|
||||
|
||||
|
||||
// Now we need to get the files inside the folders
|
||||
//$folder_contents = $this->cut_folder(scandir($mod_dir));
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($mod_dir, FilesystemIterator::SKIP_DOTS)); // requires PHP 5
|
||||
|
||||
|
||||
foreach($iterator as $cur_file)
|
||||
{
|
||||
$cur_path = $cur_file->getPathname();
|
||||
$cur_path = str_replace('\\', '/', $cur_path); // we want unix-like paths
|
||||
$cur_path = str_replace($mod_dir . '/', '', $cur_path);
|
||||
$cut_pos = strpos($cur_path, '/');
|
||||
|
||||
|
||||
// Only allow files in adm, language, portal and styles folder and a license.txt
|
||||
if(!in_array(substr($cur_path, 0, $cut_pos), array('adm', 'language', 'portal', 'styles')) && $cur_file->getFilename() != 'license.txt')
|
||||
{
|
||||
@@ -154,7 +154,7 @@ class portal_upload
|
||||
'TARGET' => $target,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_MOD_SUCCESSBOX' => true,
|
||||
'MESSAGE' => $user->lang['MODULE_UPLOADED'],
|
||||
@@ -170,10 +170,10 @@ class portal_upload
|
||||
{
|
||||
trigger_error((sizeof($file->error) ? implode('<br />', $file->error) : $user->lang['MOD_UPLOAD_INIT_FAIL']) . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
|
||||
$this->tpl_name = 'portal/acp_portal_upload_module';
|
||||
$this->page_title = $user->lang['ACP_PORTAL_UPLOAD'];
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_TITLE' => $user->lang['ACP_PORTAL_UPLOAD'],
|
||||
'L_TITLE_EXPLAIN' => '',
|
||||
@@ -185,7 +185,7 @@ class portal_upload
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cuts the unneeded '.' and '..' from the folder content info scandir returns
|
||||
*
|
||||
@@ -195,19 +195,19 @@ class portal_upload
|
||||
{
|
||||
$cut_array = array('.', '..');
|
||||
$folder_content = array_diff($folder_content, $cut_array);
|
||||
|
||||
|
||||
return $folder_content;
|
||||
}
|
||||
|
||||
private function directory_move($src, $dest)
|
||||
{
|
||||
$src_contents = scandir($src);
|
||||
|
||||
|
||||
if (!is_dir($dest) && is_dir($src))
|
||||
{
|
||||
mkdir($dest . '/', 0755);
|
||||
}
|
||||
|
||||
|
||||
foreach ($src_contents as $src_entry)
|
||||
{
|
||||
if ($src_entry != '.' && $src_entry != '..')
|
||||
@@ -224,26 +224,26 @@ class portal_upload
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* the following functions are from the AutoMOD package
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
*/
|
||||
|
||||
|
||||
private function directory_delete($dir)
|
||||
{
|
||||
if (!file_exists($dir))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!is_dir($dir) && is_file($dir))
|
||||
{
|
||||
phpbb_chmod($dir, CHMOD_ALL);
|
||||
return unlink($dir);
|
||||
}
|
||||
|
||||
|
||||
foreach (scandir($dir) as $item)
|
||||
{
|
||||
if ($item == '.' || $item == '..')
|
||||
@@ -259,10 +259,10 @@ class portal_upload
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return @rmdir($dir);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Moves files or complete directories
|
||||
*
|
||||
@@ -297,7 +297,7 @@ class portal_upload
|
||||
return sprintf($user->lang['MODULE_UPLOAD_MKDIR_FAILURE'], $dirname_check);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// leave a backup file if it already exists
|
||||
if(file_exists($to))
|
||||
{
|
||||
@@ -319,7 +319,7 @@ class portal_upload
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author Michal Nazarewicz (from the php manual)
|
||||
* Creates all non-existant directories in a path
|
||||
|
||||
@@ -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
|
||||
@@ -293,7 +293,7 @@ class portal_announcements_module
|
||||
$forum_id = $fetch_news[$i]['forum_id'];
|
||||
$topic_id = $fetch_news[$i]['topic_id'];
|
||||
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||
$open_bracket = '[ ';
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $user->lang['BACK'];
|
||||
@@ -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. ;-)
|
||||
@@ -101,7 +101,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;
|
||||
@@ -145,7 +145,7 @@ class portal_calendar_module
|
||||
|
||||
$template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array(
|
||||
'MINI_CAL_DAY' => ($mini_cal_count == 0) ? '<span style="color: ' . $config['board3_calendar_sunday_color_' . $module_id] . ';">' . $mini_cal_day . '</span>' : $mini_cal_day)
|
||||
);
|
||||
);
|
||||
$i++;
|
||||
}
|
||||
// no day
|
||||
@@ -153,7 +153,7 @@ class portal_calendar_module
|
||||
{
|
||||
$template->assign_block_vars('minical.mini_cal_row.mini_cal_days', array(
|
||||
'MINI_CAL_DAY' => ' ')
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
// is this the last day of the week?
|
||||
@@ -183,9 +183,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 ||
|
||||
@@ -194,7 +194,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
|
||||
@@ -278,7 +278,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;
|
||||
}
|
||||
@@ -286,13 +286,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(
|
||||
@@ -308,11 +308,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;
|
||||
@@ -322,7 +322,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
|
||||
@@ -342,7 +342,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
|
||||
@@ -366,7 +366,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);
|
||||
@@ -380,7 +380,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 : '';
|
||||
@@ -393,7 +393,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 . '
|
||||
@@ -404,7 +404,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);
|
||||
|
||||
@@ -423,7 +423,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,
|
||||
@@ -439,7 +439,7 @@ class portal_calendar_module
|
||||
else
|
||||
{
|
||||
$message = $user->lang['EVENT_ADDED'];
|
||||
|
||||
|
||||
$events[] = array(
|
||||
'title' => $event_title,
|
||||
'desc' => $event_desc,
|
||||
@@ -451,7 +451,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)
|
||||
{
|
||||
@@ -479,7 +479,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);
|
||||
|
||||
@@ -499,7 +499,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'] : '',
|
||||
@@ -515,9 +515,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 . '
|
||||
@@ -537,13 +537,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'] : '',
|
||||
@@ -556,14 +556,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)
|
||||
@@ -597,7 +597,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)
|
||||
{
|
||||
@@ -610,7 +610,7 @@ class portal_calendar_module
|
||||
$correct_month = $correct_month - self::MONTHS_PER_YEAR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fix incorrect months
|
||||
while (date("n", $this->stamp) != $correct_month)
|
||||
{
|
||||
@@ -629,7 +629,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");
|
||||
@@ -641,14 +641,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
|
||||
*/
|
||||
@@ -659,19 +659,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])
|
||||
@@ -275,7 +275,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])
|
||||
@@ -413,14 +413,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)
|
||||
{
|
||||
@@ -437,18 +437,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/"
|
||||
@@ -157,22 +157,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);
|
||||
@@ -184,14 +184,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('get_user_avatar'))
|
||||
{
|
||||
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