Merge pull request #197 from marc1706/use/request_class
Use/request class
This commit is contained in:
@@ -23,14 +23,14 @@ class portal_module
|
||||
public $new_config = array();
|
||||
protected $c_class;
|
||||
protected $db, $user, $cache, $template, $display_vars, $config, $phpbb_root_path, $portal_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
|
||||
protected $root_path, $mod_version_check;
|
||||
protected $root_path, $mod_version_check, $request;
|
||||
|
||||
/** @var \phpbb\di\service_collection Portal modules */
|
||||
protected $modules;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $user, $cache, $template;
|
||||
global $db, $user, $cache, $request, $template;
|
||||
global $config, $phpbb_root_path, $portal_root_path, $phpbb_admin_path, $phpbb_container, $phpEx;
|
||||
|
||||
$user->add_lang_ext('board3/portal', 'portal');
|
||||
@@ -45,6 +45,7 @@ class portal_module
|
||||
$this->cache = $cache;
|
||||
$this->template = $template;
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpbb_admin_path = $phpbb_admin_path;
|
||||
$this->portal_root_path = $this->root_path . 'portal/';
|
||||
@@ -66,7 +67,7 @@ class portal_module
|
||||
|
||||
public function main($id, $mode)
|
||||
{
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$submit = ($this->request->is_set_post('submit')) ? true : false;
|
||||
|
||||
$form_key = 'acp_portal';
|
||||
add_form_key($form_key);
|
||||
@@ -97,7 +98,7 @@ class portal_module
|
||||
)
|
||||
);
|
||||
|
||||
$module_id = request_var('module_id', 0);
|
||||
$module_id = $this->request->variable('module_id', 0);
|
||||
if ($module_id)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
@@ -176,7 +177,7 @@ class portal_module
|
||||
}
|
||||
|
||||
$this->new_config = $this->config;
|
||||
$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
|
||||
$cfg_array = ($this->request->is_set('config')) ? $this->request->variable('config', array('' => ''), true) : $this->new_config;
|
||||
$error = array();
|
||||
|
||||
// We validate the complete config if whished
|
||||
@@ -193,7 +194,7 @@ class portal_module
|
||||
}
|
||||
|
||||
// Reset module
|
||||
$reset_module = request_var('module_reset', 0);
|
||||
$reset_module = $this->request->variable('module_reset', 0);
|
||||
|
||||
if($reset_module)
|
||||
{
|
||||
@@ -239,7 +240,7 @@ class portal_module
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$module_permission = request_var('permission-setting', array(0 => ''));
|
||||
$module_permission = $this->request->variable('permission-setting', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
$img_error = '';
|
||||
|
||||
@@ -258,16 +259,16 @@ class portal_module
|
||||
$module_permission = implode(',', $module_permission);
|
||||
|
||||
$sql_ary = array(
|
||||
'module_image_src' => request_var('module_image', ''),
|
||||
'module_image_width' => request_var('module_img_width', 0),
|
||||
'module_image_height' => request_var('module_img_height', 0),
|
||||
'module_image_src' => $this->request->variable('module_image', ''),
|
||||
'module_image_width' => $this->request->variable('module_img_width', 0),
|
||||
'module_image_height' => $this->request->variable('module_img_height', 0),
|
||||
'module_group_ids' => $module_permission,
|
||||
'module_status' => request_var('module_status', B3_MODULE_ENABLED),
|
||||
'module_status' => $this->request->variable('module_status', B3_MODULE_ENABLED),
|
||||
);
|
||||
|
||||
if(!(isset($this->c_class->hide_name) && $this->c_class->hide_name == true))
|
||||
{
|
||||
$sql_ary['module_name'] = utf8_normalize_nfc(request_var('module_name', '', true));
|
||||
$sql_ary['module_name'] = $this->request->variable('module_name', '', true);
|
||||
}
|
||||
|
||||
// check if module image file actually exists
|
||||
@@ -378,8 +379,8 @@ class portal_module
|
||||
}
|
||||
break;
|
||||
case 'modules':
|
||||
$action = request_var('action', '');
|
||||
$module_id = request_var('module_id', '');
|
||||
$action = $this->request->variable('action', '');
|
||||
$module_id = $this->request->variable('module_id', '');
|
||||
|
||||
// Create an array of already installed modules
|
||||
$portal_modules = obtain_portal_modules();
|
||||
@@ -413,14 +414,14 @@ class portal_module
|
||||
$this->module_delete($id, $mode, $action, $module_id);
|
||||
}
|
||||
|
||||
$add_module = key(request_var('add', array('' => '')));
|
||||
$add_column = request_var('add_column', column_string_num($add_module));
|
||||
$add_module = key($this->request->variable('add', array('' => '')));
|
||||
$add_column = $this->request->variable('add_column', column_string_num($add_module));
|
||||
if ($add_column)
|
||||
{
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$submit = ($this->request->is_set_post('submit')) ? true : false;
|
||||
if ($submit)
|
||||
{
|
||||
$module_classname = request_var('module_classname', '');
|
||||
$module_classname = $this->request->variable('module_classname', '');
|
||||
|
||||
$column_string = column_num_string($add_column);
|
||||
|
||||
@@ -751,9 +752,23 @@ class portal_module
|
||||
{
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$sql = 'SELECT module_order, module_column, module_classname
|
||||
FROM ' . PORTAL_MODULES_TABLE . '
|
||||
WHERE module_id = ' . (int) $module_id;
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!isset($this->modules[$module_data['module_classname']]))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
|
||||
$this->c_class = $this->modules[$module_data['module_classname']];
|
||||
|
||||
$sql_ary = array(
|
||||
'module_name' => $this->c_class->name,
|
||||
'module_image_src' => $this->c_class->image_src,
|
||||
'module_name' => $this->c_class->get_name(),
|
||||
'module_image_src' => $this->c_class->get_image(),
|
||||
'module_group_ids' => '',
|
||||
'module_image_height' => 16,
|
||||
'module_image_width' => 16,
|
||||
@@ -768,7 +783,7 @@ class portal_module
|
||||
if (empty($affected_rows))
|
||||
{
|
||||
// We need to return to the module config
|
||||
meta_refresh(3, reapply_sid($this->u_action . "&module_id=$module_id"));
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
trigger_error($this->user->lang['MODULE_NOT_EXISTS'] . adm_back_link($this->u_action . "&module_id=$module_id"), E_USER_WARNING);
|
||||
}
|
||||
|
||||
@@ -779,7 +794,7 @@ class portal_module
|
||||
$this->cache->purge();
|
||||
|
||||
// We need to return to the module config
|
||||
meta_refresh(3, reapply_sid($this->u_action . "&module_id=$module_id"));
|
||||
meta_refresh(3, $this->get_module_link('config', $module_id));
|
||||
|
||||
trigger_error($this->user->lang['MODULE_RESET_SUCCESS'] . adm_back_link($this->u_action . "&module_id=$module_id"));
|
||||
}
|
||||
@@ -888,16 +903,12 @@ class portal_module
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$class = 'portal_' . $module_data['module_classname'] . '_module';
|
||||
if (!class_exists($class))
|
||||
{
|
||||
include($this->root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $this->php_ex);
|
||||
}
|
||||
if (!class_exists($class))
|
||||
if (!isset($this->modules[$module_data['module_classname']]))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
$this->c_class = new $class();
|
||||
|
||||
$this->c_class = $this->modules[$module_data['module_classname']];
|
||||
|
||||
if ($module_data !== false)
|
||||
{
|
||||
@@ -1000,16 +1011,12 @@ class portal_module
|
||||
$module_data = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$class = 'portal_' . $module_data['module_classname'] . '_module';
|
||||
if (!class_exists($class))
|
||||
{
|
||||
include($this->root_path . 'portal/modules/portal_' . $module_data['module_classname'] . '.' . $this->php_ex);
|
||||
}
|
||||
if (!class_exists($class))
|
||||
if (!isset($this->modules[$module_data['module_classname']]))
|
||||
{
|
||||
trigger_error('CLASS_NOT_FOUND', E_USER_ERROR);
|
||||
}
|
||||
$this->c_class = new $class();
|
||||
|
||||
$this->c_class = $this->modules[$module_data['module_classname']];
|
||||
|
||||
if ($module_data !== false)
|
||||
{
|
||||
@@ -1117,7 +1124,7 @@ class portal_module
|
||||
|
||||
if ($module_data !== false)
|
||||
{
|
||||
$module_classname = request_var('module_classname', '');
|
||||
$module_classname = $this->request->variable('module_classname', '');
|
||||
|
||||
if (!isset($this->modules[$module_classname]))
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ services:
|
||||
- @config
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- %core.php_ext%
|
||||
- %core.root_path%
|
||||
- @user
|
||||
@@ -20,6 +21,7 @@ services:
|
||||
- @config
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- %core.php_ext%
|
||||
- %core.root_path%
|
||||
- @user
|
||||
@@ -42,6 +44,7 @@ services:
|
||||
- @config
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
@@ -60,6 +63,7 @@ services:
|
||||
- @config
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
- @user
|
||||
@@ -145,6 +149,7 @@ services:
|
||||
arguments:
|
||||
- @config
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- @template
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
@@ -157,6 +162,7 @@ services:
|
||||
arguments:
|
||||
- @config
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- @template
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
@@ -171,6 +177,7 @@ services:
|
||||
- @cache
|
||||
- @config
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- @template
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
@@ -184,6 +191,7 @@ services:
|
||||
- @auth
|
||||
- @config
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- @template
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
@@ -206,6 +214,7 @@ services:
|
||||
- @auth
|
||||
- @config
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- @template
|
||||
- %core.root_path%
|
||||
- %core.php_ext%
|
||||
@@ -238,6 +247,7 @@ services:
|
||||
- @config
|
||||
- @template
|
||||
- @dbal.conn
|
||||
- @request
|
||||
- %core.php_ext%
|
||||
- %core.root_path%
|
||||
- @user
|
||||
@@ -272,6 +282,7 @@ services:
|
||||
class: \board3\portal\modules\welcome
|
||||
arguments:
|
||||
- @config
|
||||
- @request
|
||||
- @template
|
||||
- @user
|
||||
- %core.root_path%
|
||||
|
||||
@@ -56,6 +56,9 @@ class announcements extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var php file extension */
|
||||
protected $php_ext;
|
||||
|
||||
@@ -73,17 +76,19 @@ class announcements extends module_base
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($auth, $cache, $config, $template, $db, $phpEx, $phpbb_root_path, $user)
|
||||
public function __construct($auth, $cache, $config, $template, $db, $request, $phpEx, $phpbb_root_path, $user)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->cache = $cache;
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
@@ -94,9 +99,9 @@ class announcements extends module_base
|
||||
*/
|
||||
public function get_template_center($module_id)
|
||||
{
|
||||
$announcement = request_var('announcement', -1);
|
||||
$announcement = $this->request->variable('announcement', -1);
|
||||
$announcement = ($announcement > $this->config['board3_announcements_length_' . $module_id] -1) ? -1 : $announcement;
|
||||
$start = request_var('ap', 0);
|
||||
$start = $this->request->variable('ap', 0);
|
||||
$start = ($start < 0) ? 0 : $start;
|
||||
|
||||
// Fetch announcements from portal/includes/functions.php with check if "read full" is requested.
|
||||
@@ -210,7 +215,7 @@ class announcements extends module_base
|
||||
//$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;
|
||||
$real_forum_id = ($forum_id == 0) ? $fetch_news['global_id']: $forum_id;
|
||||
$read_full_url = (isset($_GET['ap'])) ? 'ap='. $start . '&announcement=' . $i . '#a' . $i : 'announcement=' . $i . '#a' . $i;
|
||||
$read_full_url = ($this->request->is_set('ap')) ? 'ap='. $start . '&announcement=' . $i . '#a' . $i : 'announcement=' . $i . '#a' . $i;
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
|
||||
if ($this->config['board3_announcements_archive_' . $module_id])
|
||||
@@ -342,7 +347,7 @@ class announcements extends module_base
|
||||
$read_full = $this->user->lang['BACK'];
|
||||
$real_forum_id = ($forum_id == 0) ? $fetch_news['global_id']: $forum_id;
|
||||
|
||||
$read_full_url = (isset($_GET['ap'])) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "ap=$start#a$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#a$i");
|
||||
$read_full_url = ($this->request->is_set('ap')) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "ap=$start#a$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#a$i");
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($this->config['board3_announcements_archive_' . $module_id])
|
||||
{
|
||||
@@ -522,7 +527,7 @@ class announcements extends module_base
|
||||
public function store_selected_forums($key, $module_id)
|
||||
{
|
||||
// Get selected forums
|
||||
$values = request_var($key, array(0 => ''));
|
||||
$values = $this->request->variable($key, array(0 => ''));
|
||||
$news = implode(',', $values);
|
||||
set_config($key, $news);
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ class attachments extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
@@ -69,16 +72,18 @@ class attachments extends module_base
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($auth, $config, $template, $db, $phpEx, $phpbb_root_path, $user)
|
||||
public function __construct($auth, $config, $template, $db, $request, $phpEx, $phpbb_root_path, $user)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
@@ -201,7 +206,7 @@ class attachments extends module_base
|
||||
public function store_filetypes($key, $module_id)
|
||||
{
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
$values = $this->request->variable($key, array(0 => ''));
|
||||
|
||||
$filetypes = implode(',', $values);
|
||||
|
||||
@@ -250,7 +255,7 @@ class attachments extends module_base
|
||||
public function store_selected_forums($key)
|
||||
{
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
$values = $this->request->variable($key, array(0 => ''));
|
||||
$news = implode(',', $values);
|
||||
set_config($key, $news);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,9 @@ class calendar extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var php file extension */
|
||||
protected $php_ext;
|
||||
|
||||
@@ -115,16 +118,18 @@ class calendar extends module_base
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param \phpbb\path_helper $path_helper phpBB path helper
|
||||
*/
|
||||
public function __construct($config, $template, $db, $phpbb_root_path, $phpEx, $user, $path_helper)
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user, $path_helper)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
@@ -151,9 +156,9 @@ class calendar extends module_base
|
||||
|
||||
// get the calendar month
|
||||
$this->mini_cal_month = 0;
|
||||
if(isset($_GET['m' . $module_id]) || isset($_POST['m' . $module_id]))
|
||||
if ($this->request->is_set('m' . $module_id))
|
||||
{
|
||||
$this->mini_cal_month = request_var('m' . $module_id, 0);
|
||||
$this->mini_cal_month = $this->request->variable('m' . $module_id, 0);
|
||||
}
|
||||
|
||||
// initialise some variables
|
||||
@@ -401,10 +406,10 @@ class calendar extends module_base
|
||||
*/
|
||||
public function manage_events($value, $key, $module_id)
|
||||
{
|
||||
$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
|
||||
$action = $this->request->variable('action', '');
|
||||
$action = ($this->request->is_set_post('add')) ? 'add' : $action;
|
||||
$action = ($this->request->is_set_post('save')) ? 'save' : $action;
|
||||
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
$events = (strlen($portal_config['board3_calendar_events_' . $module_id]) >= 1) ? $this->utf_unserialize($portal_config['board3_calendar_events_' . $module_id]) : array();
|
||||
@@ -421,15 +426,15 @@ class calendar extends module_base
|
||||
trigger_error($this->user->lang['FORM_INVALID']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$event_title = utf8_normalize_nfc(request_var('event_title', ' ', true));
|
||||
$event_desc = utf8_normalize_nfc(request_var('event_desc', ' ', true));
|
||||
$event_start_day = trim(request_var('event_start_day', ''));
|
||||
$event_start_time = trim(request_var('event_start_time', ''));
|
||||
$event_end_day = trim(request_var('event_end_day', ''));
|
||||
$event_end_time = trim(request_var('event_end_time', ''));
|
||||
$event_all_day = request_var('event_all_day', false); // default to false
|
||||
$event_url = request_var('event_url', ' ');
|
||||
$event_permission = request_var('permission-setting-calendar', array(0 => ''));
|
||||
$event_title = $this->request->variable('event_title', ' ', true);
|
||||
$event_desc = $this->request->variable('event_desc', ' ', true);
|
||||
$event_start_day = trim($this->request->variable('event_start_day', ''));
|
||||
$event_start_time = trim($this->request->variable('event_start_time', ''));
|
||||
$event_end_day = trim($this->request->variable('event_end_day', ''));
|
||||
$event_end_time = trim($this->request->variable('event_end_time', ''));
|
||||
$event_all_day = $this->request->variable('event_all_day', false); // default to false
|
||||
$event_url = $this->request->variable('event_url', ' ');
|
||||
$event_permission = $this->request->variable('permission-setting-calendar', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
/*
|
||||
|
||||
@@ -56,6 +56,9 @@ class custom extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var php file extension */
|
||||
protected $php_ext;
|
||||
|
||||
@@ -71,15 +74,17 @@ class custom extends module_base
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($config, $template, $db, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($config, $template, $db, $request, $phpbb_root_path, $phpEx, $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
@@ -168,9 +173,9 @@ class custom extends module_base
|
||||
*/
|
||||
public function manage_custom($value, $key, $module_id)
|
||||
{
|
||||
$action = (isset($_POST['reset'])) ? 'reset' : '';
|
||||
$action = (isset($_POST['submit'])) ? 'save' : $action;
|
||||
$action = (isset($_POST['preview'])) ? 'preview' : $action;
|
||||
$action = ($this->request->is_set_post('reset')) ? 'reset' : '';
|
||||
$action = ($this->request->is_set_post('submit')) ? 'save' : $action;
|
||||
$action = ($this->request->is_set_post('preview')) ? 'preview' : $action;
|
||||
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
@@ -185,11 +190,11 @@ class custom extends module_base
|
||||
trigger_error($this->user->lang['FORM_INVALID']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$custom_code = utf8_normalize_nfc(request_var('custom_code', '', true));
|
||||
$custom_bbcode = request_var('custom_use_bbcode', 1); // default to BBCode
|
||||
$custom_permission = request_var('permission-setting', array(0 => ''));
|
||||
$custom_title = utf8_normalize_nfc(request_var('module_name', '', true));
|
||||
$custom_image_src = utf8_normalize_nfc(request_var('module_image', ''));
|
||||
$custom_code = $this->request->variable('custom_code', '', true);
|
||||
$custom_bbcode = $this->request->variable('custom_use_bbcode', 1); // default to BBCode
|
||||
$custom_permission = $this->request->variable('permission-setting', array(0 => ''));
|
||||
$custom_title = $this->request->variable('module_name', '', true);
|
||||
$custom_image_src = $this->request->variable('module_image', '', true);
|
||||
$groups_ary = array();
|
||||
$uid = $bitfield = $flags = '';
|
||||
$options = 7;
|
||||
@@ -243,11 +248,11 @@ class custom extends module_base
|
||||
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
|
||||
$custom_permission = request_var('permission-setting', array(0 => ''));
|
||||
$custom_title = utf8_normalize_nfc(request_var('module_name', ''));
|
||||
$custom_image_src = utf8_normalize_nfc(request_var('module_image', ''));
|
||||
$custom_code = $text = $this->request->variable('custom_code', '', true);
|
||||
$custom_bbcode = $this->request->variable('custom_use_bbcode', 1); // default to BBCode
|
||||
$custom_permission = $this->request->variable('permission-setting', array(0 => ''));
|
||||
$custom_title = $this->request->variable('module_name', '', true);
|
||||
$custom_image_src = $this->request->variable('module_image', '', true);
|
||||
$groups_ary = array();
|
||||
|
||||
// first check for obvious errors, we don't want to waste server resources
|
||||
|
||||
@@ -59,6 +59,9 @@ class links extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
@@ -76,15 +79,17 @@ class links extends module_base
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($config, $db, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
@@ -227,10 +232,10 @@ class links extends module_base
|
||||
*/
|
||||
public function manage_links($value, $key, $module_id)
|
||||
{
|
||||
$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
|
||||
$action = $this->request->variable('action', '');
|
||||
$action = ($this->request->is_set_post('add')) ? 'add' : $action;
|
||||
$action = ($this->request->is_set_post('save')) ? 'save' : $action;
|
||||
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
$links = array();
|
||||
@@ -248,11 +253,11 @@ class links extends module_base
|
||||
trigger_error($this->user->lang['FORM_INVALID']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$link_title = utf8_normalize_nfc(request_var('link_title', ' ', true));
|
||||
$link_type = request_var('link_type', 2); // default to B3_LINK_EXT, no categories in Links block
|
||||
$link_url = utf8_normalize_nfc(request_var('link_url', ' ', true));
|
||||
$link_title = $this->request->variable('link_title', ' ', true);
|
||||
$link_type = $this->request->variable('link_type', 2); // default to B3_LINK_EXT, no categories in Links block
|
||||
$link_url = $this->request->variable('link_url', ' ', true);
|
||||
$link_url = str_replace('&', '&', $link_url);
|
||||
$link_permission = request_var('permission-setting-link', array(0 => ''));
|
||||
$link_permission = $this->request->variable('permission-setting-link', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
|
||||
@@ -60,6 +60,9 @@ class main_menu extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
@@ -77,15 +80,17 @@ class main_menu extends module_base
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($config, $db, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
@@ -282,10 +287,10 @@ class main_menu extends module_base
|
||||
*/
|
||||
public function manage_links($value, $key, $module_id)
|
||||
{
|
||||
$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
|
||||
$action = $this->request->variable('action', '');
|
||||
$action = ($this->request->is_set_post('add')) ? 'add' : $action;
|
||||
$action = ($this->request->is_set_post('save')) ? 'save' : $action;
|
||||
$link_id = $this->request->variable('id', 99999999); // 0 will trigger unwanted behavior, therefore we set a number we should never reach
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
$links = array();
|
||||
@@ -303,12 +308,12 @@ class main_menu extends module_base
|
||||
trigger_error($this->user->lang['FORM_INVALID']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$link_title = utf8_normalize_nfc(request_var('link_title', ' ', true));
|
||||
$link_is_cat = request_var('link_is_cat', false);
|
||||
$link_type = (!$link_is_cat) ? request_var('link_type', self::LINK_INT) : self::LINK_CAT;
|
||||
$link_url = ($link_is_cat) ? ' ' : utf8_normalize_nfc(request_var('link_url', ' ', true));
|
||||
$link_title = $this->request->variable('link_title', ' ', true);
|
||||
$link_is_cat = $this->request->variable('link_is_cat', false);
|
||||
$link_type = (!$link_is_cat) ? $this->request->variable('link_type', self::LINK_INT) : self::LINK_CAT;
|
||||
$link_url = ($link_is_cat) ? ' ' : $this->request->variable('link_url', ' ', true);
|
||||
$link_url = str_replace('&', '&', $link_url);
|
||||
$link_permission = request_var('permission-setting-menu', array(0 => ''));
|
||||
$link_permission = $this->request->variable('permission-setting-menu', array(0 => ''));
|
||||
$groups_ary = array();
|
||||
|
||||
// get groups and check if the selected groups actually exist
|
||||
|
||||
@@ -53,6 +53,9 @@ class news extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
@@ -72,17 +75,19 @@ class news extends module_base
|
||||
* @param \phpbb\cache $cache phpBB cache system
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($auth, $cache, $config, $db, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($auth, $cache, $config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->cache = $cache;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
@@ -94,10 +99,10 @@ class news extends module_base
|
||||
*/
|
||||
public function get_template_center($module_id)
|
||||
{
|
||||
$news = request_var('news', -1);
|
||||
$news = $this->request->variable('news', -1);
|
||||
$news = ($news > $this->config['board3_number_of_news_' . $module_id] -1) ? -1 : $news;
|
||||
$this->user->add_lang('viewforum');
|
||||
$start = request_var('np', 0);
|
||||
$start = $this->request->variable('np', 0);
|
||||
$start = ($start < 0) ? 0 : $start;
|
||||
|
||||
// Fetch news from portal/includes/functions.php with check if "read full" is requested.
|
||||
@@ -203,7 +208,7 @@ class news extends module_base
|
||||
$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;
|
||||
$read_full_url = ($this->request->is_set('np')) ? 'np='. $start . '&news=' . $i . '#n' . $i : 'news=' . $i . '#n' . $i;
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
@@ -320,7 +325,7 @@ class news extends module_base
|
||||
$close_bracket = ' ]';
|
||||
$read_full = $this->user->lang['BACK'];
|
||||
|
||||
$read_full_url = (isset($_GET['np'])) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "np=$start#n$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#n$i");
|
||||
$read_full_url = ($this->request->is_set('np')) ? append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal", "np=$start#n$i") : append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal#n$i");
|
||||
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
|
||||
if ($this->config['board3_news_archive_' . $module_id])
|
||||
{
|
||||
@@ -504,7 +509,7 @@ class news extends module_base
|
||||
public function store_selected_forums($key, $module_id)
|
||||
{
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
$values = $this->request->variable($key, array(0 => ''));
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
|
||||
@@ -59,6 +59,9 @@ class poll extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var php file extension */
|
||||
protected $php_ext;
|
||||
|
||||
@@ -73,17 +76,19 @@ class poll extends module_base
|
||||
*
|
||||
* @param \phpbb\auth\auth $auth phpBB auth service
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $template, $phpbb_root_path, $phpEx, $user)
|
||||
public function __construct($auth, $config, $db, $request, $template, $phpbb_root_path, $phpEx, $user)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
@@ -194,7 +199,7 @@ class poll extends module_base
|
||||
public function store_selected_forums($key, $module_id)
|
||||
{
|
||||
// Get selected forums
|
||||
$values = request_var($key, array(0 => ''));
|
||||
$values = $this->request->variable($key, array(0 => ''));
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
@@ -220,17 +225,17 @@ class poll extends module_base
|
||||
include($this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext);
|
||||
}
|
||||
|
||||
$view = request_var('view', '');
|
||||
$update = request_var('update', false);
|
||||
$poll_view = request_var('polls', '');
|
||||
$view = $this->request->variable('view', '');
|
||||
$update = $this->request->variable('update', false);
|
||||
$poll_view = $this->request->variable('polls', '');
|
||||
|
||||
$poll_view_ar = (strpos($poll_view, ',') !== FALSE) ? explode(',', $poll_view) : (($poll_view != '') ? array($poll_view) : array());
|
||||
|
||||
if ($update && $this->config['board3_poll_allow_vote_' . $module_id])
|
||||
{
|
||||
$up_topic_id = request_var('t', 0);
|
||||
$up_forum_id = request_var('f', 0);
|
||||
$voted_id = request_var('vote_id', array('' => 0));
|
||||
$up_topic_id = $this->request->variable('t', 0);
|
||||
$up_forum_id = $this->request->variable('f', 0);
|
||||
$voted_id = $this->request->variable('vote_id', array('' => 0));
|
||||
|
||||
$cur_voted_id = array();
|
||||
if ($this->user->data['is_registered'])
|
||||
@@ -252,9 +257,9 @@ class poll extends module_base
|
||||
// Cookie based guest tracking ... I don't like this but hum ho
|
||||
// it's oft requested. This relies on "nice" users who don't feel
|
||||
// the need to delete cookies to mess with results.
|
||||
if (isset($_COOKIE[$this->config['cookie_name'] . '_poll_' . $up_topic_id]))
|
||||
if ($request->is_set($this->config['cookie_name'] . '_poll_' . $up_topic_id, \phpbb\request\request_interface::COOKIE))
|
||||
{
|
||||
$cur_voted_id = explode(',', request_var($this->config['cookie_name'] . '_poll_' . $up_topic_id, 0, false, true));
|
||||
$cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $up_topic_id, '', true, \phpbb\request\request_interface::COOKIE));
|
||||
$cur_voted_id = array_map('intval', $cur_voted_id);
|
||||
}
|
||||
}
|
||||
@@ -446,9 +451,9 @@ class poll extends module_base
|
||||
// Cookie based guest tracking ... I don't like this but hum ho
|
||||
// it's oft requested. This relies on "nice" users who don't feel
|
||||
// the need to delete cookies to mess with results.
|
||||
if (isset($_COOKIE[$this->config['cookie_name'] . '_poll_' . $topic_id]))
|
||||
if ($this->request->is_set($this->config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE))
|
||||
{
|
||||
$cur_voted_id = explode(',', request_var($this->config['cookie_name'] . '_poll_' . $topic_id, 0, false, true));
|
||||
$cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $topic_id, 0, false, true));
|
||||
$cur_voted_id = array_map('intval', $cur_voted_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ class recent extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
@@ -71,15 +74,17 @@ class recent extends module_base
|
||||
* @param \phpbb\auth\auth $auth phpBB auth
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $template, $phpbb_root_path, $phpEx)
|
||||
public function __construct($auth, $config, $db, $request, $template, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $phpEx;
|
||||
@@ -289,11 +294,10 @@ class recent extends module_base
|
||||
public function store_selected_forums($key, $module_id)
|
||||
{
|
||||
// Get selected extensions
|
||||
$values = request_var($key, array(0 => ''));
|
||||
$values = $this->request->variable($key, array(0 => ''));
|
||||
|
||||
$news = implode(',', $values);
|
||||
|
||||
set_config($key, $news);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ class stylechanger extends module_base
|
||||
/** @var \phpbb\db\driver */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var php file extension */
|
||||
protected $php_ext;
|
||||
|
||||
@@ -65,15 +68,17 @@ class stylechanger extends module_base
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\db\driver $db Database driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param string $phpEx php file extension
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($config, $template, $db, $phpEx, $phpbb_root_path, $user)
|
||||
public function __construct($config, $template, $db, $request, $phpEx, $phpbb_root_path, $user)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
@@ -93,7 +98,7 @@ class stylechanger extends module_base
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$style = request_var('style', 0);
|
||||
$style = $this->request->variable('style', 0);
|
||||
if (!empty($style))
|
||||
{
|
||||
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], append_sid("{$this->phpbb_root_path}app.{$this->php_ext}/portal"));
|
||||
|
||||
@@ -50,6 +50,9 @@ class welcome extends module_base
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template */
|
||||
protected $template;
|
||||
|
||||
@@ -66,14 +69,16 @@ class welcome extends module_base
|
||||
* Construct a welcome object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template $template phpBB template
|
||||
* @param \phpbb\user $user phpBB user
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx php file extension
|
||||
*/
|
||||
public function __construct($config, $template, $user, $phpbb_root_path, $phpEx)
|
||||
public function __construct($config, $request, $template, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
@@ -160,9 +165,9 @@ class welcome extends module_base
|
||||
*/
|
||||
public function manage_welcome($value, $key, $module_id)
|
||||
{
|
||||
$action = (isset($_POST['reset'])) ? 'reset' : '';
|
||||
$action = (isset($_POST['submit'])) ? 'save' : $action;
|
||||
$action = (isset($_POST['preview'])) ? 'preview' : $action;
|
||||
$action = ($this->request->is_set_post('reset')) ? 'reset' : '';
|
||||
$action = ($this->request->is_set_post('submit')) ? 'save' : $action;
|
||||
$action = ($this->request->is_set_post('preview')) ? 'preview' : $action;
|
||||
|
||||
$portal_config = obtain_portal_config();
|
||||
|
||||
@@ -177,7 +182,7 @@ class welcome extends module_base
|
||||
trigger_error($this->user->lang['FORM_INVALID']. adm_back_link($u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$welcome_message = utf8_normalize_nfc(request_var('welcome_message', '', true));
|
||||
$welcome_message = $this->request->variable('welcome_message', '', true);
|
||||
$uid = $bitfield = $flags = '';
|
||||
$options = 7;
|
||||
generate_text_for_storage($welcome_message, $uid, $bitfield, $flags, true, true, true);
|
||||
@@ -197,7 +202,7 @@ class welcome extends module_base
|
||||
break;
|
||||
|
||||
case 'preview':
|
||||
$welcome_message = $text = utf8_normalize_nfc(request_var('welcome_message', '', true));
|
||||
$welcome_message = $text = $this->request->variable('welcome_message', '', true);
|
||||
|
||||
$bbcode_options = OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS;
|
||||
$uid = (isset($this->config['board3_welcome_message_uid_' . $module_id])) ? $this->config['board3_welcome_message_uid_' . $module_id] : '';
|
||||
|
||||
@@ -562,7 +562,7 @@ function sql_table_exists($table_name)
|
||||
*/
|
||||
function get_portal_tracking_info($fetch_news)
|
||||
{
|
||||
global $config, $user;
|
||||
global $config, $request, $user;
|
||||
|
||||
$last_read = $topic_ids = $forum_ids = $tracking_info = $rev_forum_ids = array();
|
||||
|
||||
@@ -633,7 +633,21 @@ function get_portal_tracking_info($fetch_news)
|
||||
|
||||
if (!isset($tracking_topics) || !sizeof($tracking_topics))
|
||||
{
|
||||
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? ((STRIP) ? stripslashes($_COOKIE[$config['cookie_name'] . '_track']) : $_COOKIE[$config['cookie_name'] . '_track']) : '';
|
||||
if ($request->is_set($config['cookie_name'] . '_track', \phpbb\request\request_interface::COOKIE))
|
||||
{
|
||||
if (STRIP)
|
||||
{
|
||||
$tracking_topics = stripslashes($this->request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE));
|
||||
}
|
||||
else
|
||||
{
|
||||
$tracking_topics = $this->request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tracking_topics = '';
|
||||
}
|
||||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,4 +39,13 @@ class phpbb_functional_portal_vote_poll_test extends \board3\portal\tests\testfr
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_with_poll
|
||||
*/
|
||||
public function test_after_poll()
|
||||
{
|
||||
$this->logout();
|
||||
$crawler = self::request('GET', 'app.php/portal');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user