Changes for phpbb 3.3.0
This commit is contained in:
@@ -119,7 +119,7 @@ class birthday_list extends module_base
|
||||
'ORDER BY' => $order_by,
|
||||
);
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql, 300);
|
||||
$result = $this->db->sql_query($sql);
|
||||
$today = sprintf('%2d-%2d-', $now['mday'], $now['mon']);
|
||||
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
|
||||
@@ -188,8 +188,8 @@ class calendar extends module_base
|
||||
// output our general calendar bits
|
||||
$down = $this->mini_cal_month - 1;
|
||||
$up = $this->mini_cal_month + 1;
|
||||
$prev_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$down#minical$module_id" . '" rel="nofollow"><span class="portal-arrow-left-icon" title="' . $this->user->lang['VIEW_PREVIOUS_MONTH'] . '"></span></a>';
|
||||
$next_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$up#minical$module_id" . '" rel="nofollow"><span class="portal-arrow-right-icon" title="' . $this->user->lang['VIEW_NEXT_MONTH'] . '"></span></a>';
|
||||
$prev_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$down#minical$module_id" . '" rel="nofollow"><i class="fa fa-backward" aria-hidden="true" title="' . $this->user->lang['VIEW_PREVIOUS_MONTH'] . '"></i></a>';
|
||||
$next_month = '<a href="' . $this->modules_helper->route('board3_portal_controller') . "?m$module_id=$up#minical$module_id" . '" rel="nofollow"><i class="fa fa-forward" aria-hidden="true" title="' . $this->user->lang['VIEW_NEXT_MONTH'] . '"></i></a>';
|
||||
|
||||
$this->template->assign_block_vars('minical', array(
|
||||
'S_SUNDAY_FIRST' => ($this->config['board3_sunday_first_' . $module_id]) ? true : false,
|
||||
|
||||
@@ -307,7 +307,7 @@ class custom extends module_base
|
||||
default:
|
||||
if (!isset($custom_code))
|
||||
{
|
||||
$custom_code = generate_text_for_edit($portal_config['board3_custom_' . $module_id . '_code'], $this->config['board3_custom_' . $module_id . '_uid'], '');
|
||||
$custom_code = generate_text_for_edit($portal_config['board3_custom_' . $module_id . '_code'], $this->config['board3_custom_' . $module_id . '_uid'], 0);
|
||||
}
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
|
||||
148
modules/portal_tl_menu.php
Normal file
148
modules/portal_tl_menu.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package Board3 Portal v2.1
|
||||
* @copyright (c) 2013 Board3 Group ( www.board3.de )
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace board3\portal\modules;
|
||||
|
||||
/**
|
||||
* @package Links
|
||||
*/
|
||||
class portal_tl_menu extends module_base
|
||||
{
|
||||
/**
|
||||
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||
* top 1
|
||||
* left 2
|
||||
* center 4
|
||||
* right 8
|
||||
* bottom 16
|
||||
*/
|
||||
public $columns = 10;
|
||||
|
||||
/**
|
||||
* Default modulename
|
||||
*/
|
||||
public $name = 'TL_MENU';
|
||||
|
||||
/**
|
||||
* Default module-image:
|
||||
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||
*/
|
||||
public $image_src = 'portal_menu.png';
|
||||
|
||||
/**
|
||||
* module-language file
|
||||
* file must be in "language/{$user->lang}/mods/portal/"
|
||||
*/
|
||||
public $language = 'portal_tl_menu_module';
|
||||
|
||||
/**
|
||||
* custom acp template
|
||||
* file must be in "adm/style/portal/"
|
||||
*/
|
||||
public $custom_acp_tpl = 'acp_portal_links';
|
||||
|
||||
/** @var bool Can include this module multiple times */
|
||||
protected $multiple_includes = true;
|
||||
|
||||
/**
|
||||
* constants
|
||||
*/
|
||||
const LINK_INT = 1;
|
||||
const LINK_EXT = 2;
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
/** @var string PHP file extension */
|
||||
protected $php_ext;
|
||||
|
||||
/** @var string phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\log\log phpBB log */
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* Construct a links object
|
||||
*
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\db\driver\driver_interface $db phpBB db driver
|
||||
* @param \phpbb\request\request $request phpBB request
|
||||
* @param \phpbb\template\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
|
||||
* @param \phpbb\log\log phpBB log
|
||||
*/
|
||||
public function __construct($config, $db, $request, $template, $phpbb_root_path, $phpEx, $user, $log)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
$this->request = $request;
|
||||
$this->template = $template;
|
||||
$this->php_ext = $phpEx;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->user = $user;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
global $config, $template;
|
||||
|
||||
$template->assign_vars(array(
|
||||
'EXAMPLE' => $config['board3_configname2_' . $module_id],
|
||||
));
|
||||
|
||||
return 'tl_menu.html';
|
||||
}
|
||||
|
||||
public function get_template_acp($module_id)
|
||||
{
|
||||
global $phpEx, $phpbb_root_path;
|
||||
|
||||
return array(
|
||||
'title' => 'ACP_CONFIG_MODULENAME',
|
||||
'vars' => array(
|
||||
'legend1' => 'ACP_MODULENAME_CONFIGLEGEND',
|
||||
'board3_configname_' . $module_id => array('lang' => 'MODULENAME_CONFIGNAME', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => false),
|
||||
'board3_configname2_' . $module_id => array('lang' => 'MODULENAME_CONFIGNAME2', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* API functions
|
||||
*/
|
||||
public function install($module_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall($module_id, $db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,8 @@ class random_member extends module_base
|
||||
|
||||
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($row, 'user'), 'USER_AVATAR');
|
||||
|
||||
$rank_data = phpbb_get_user_rank($row, $row['user_posts']);
|
||||
$rank_title = $rank_img = $rank_img_src = '';
|
||||
get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);
|
||||
|
||||
$username = $row['username'];
|
||||
$user_id = (int) $row['user_id'];
|
||||
@@ -120,9 +121,9 @@ class random_member extends module_base
|
||||
'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour),
|
||||
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
|
||||
|
||||
'RANK_TITLE' => $rank_data['title'],
|
||||
'RANK_IMG' => $rank_data['img'],
|
||||
'RANK_IMG_SRC' => $rank_data['img_src'],
|
||||
'RANK_TITLE' => $rank_title,
|
||||
'RANK_IMG' => $rank_img,
|
||||
'RANK_IMG_SRC' => $rank_img_src,
|
||||
|
||||
'USER_POSTS' => (int) $row['user_posts'],
|
||||
'AVATAR_IMG' => $avatar_img,
|
||||
|
||||
@@ -136,7 +136,7 @@ class recent extends module_base
|
||||
AND topic_moved_id = 0
|
||||
' . $sql_where . $forum_sql . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0 , 30);
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0 , 10);
|
||||
|
||||
while (($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
|
||||
{
|
||||
@@ -162,7 +162,7 @@ class recent extends module_base
|
||||
AND topic_moved_id = 0
|
||||
' . $sql_where . $forum_sql . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 30);
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 10);
|
||||
|
||||
while (($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
|
||||
{
|
||||
@@ -189,7 +189,7 @@ class recent extends module_base
|
||||
AND topic_moved_id = 0
|
||||
' . $sql_where . $forum_sql . '
|
||||
ORDER BY topic_time DESC';
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 30);
|
||||
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 10);
|
||||
|
||||
while (($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ class user_menu extends module_base
|
||||
*/
|
||||
public function get_template_side($module_id)
|
||||
{
|
||||
if (!function_exists('phpbb_get_user_rank'))
|
||||
if (!function_exists('get_user_rank'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
|
||||
}
|
||||
@@ -147,8 +147,22 @@ class user_menu extends module_base
|
||||
$username = $this->user->data['username'];
|
||||
$colour = $this->user->data['user_colour'];
|
||||
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($this->user->data, 'user'), 'USER_AVATAR');
|
||||
$rank_data = phpbb_get_user_rank($this->user->data, $this->user->data['user_posts']);
|
||||
$rank_title = $rank_img = $rank_img_src = '';
|
||||
\get_user_rank($this->user->data['user_rank'], $this->user->data['user_posts'], $rank_title, $rank_img, $rank_img_src);
|
||||
|
||||
|
||||
$s_login_redirect = build_hidden_fields(array('redirect' => $this->path_helper->remove_web_root_path(build_url())));
|
||||
/**
|
||||
* Workaround for missing template variable in pre phpBB 3.2.6 styles.
|
||||
* @deprecated 3.2.7 (To be removed: 3.3.0-a1)
|
||||
*/
|
||||
$form_token_login = $this->template->retrieve_var('S_FORM_TOKEN_LOGIN');
|
||||
if (!empty($form_token_login))
|
||||
{
|
||||
$s_login_redirect .= $form_token_login;
|
||||
// Remove S_FORM_TOKEN_LOGIN as it's already appended to S_login_redirect
|
||||
$this->template->assign_var('S_FORM_TOKEN_LOGIN', '');
|
||||
}
|
||||
// Assign specific vars
|
||||
$this->template->assign_vars(array(
|
||||
'L_NEW_POSTS' => $this->user->lang['SEARCH_NEW'] . ' (' . $new_posts_count . ')',
|
||||
@@ -156,9 +170,9 @@ class user_menu extends module_base
|
||||
'L_UNREAD_POSTS'=> $this->user->lang['SEARCH_UNREAD'] . ' (' . $unread_posts_count . ')',
|
||||
|
||||
'B3P_AVATAR_IMG' => $avatar_img,
|
||||
'B3P_RANK_TITLE' => $rank_data['title'],
|
||||
'B3P_RANK_IMG' => $rank_data['img'],
|
||||
'RANK_IMG_SRC' => $rank_data['img_src'],
|
||||
'B3P_RANK_TITLE' => $rank_title,
|
||||
'B3P_RANK_IMG' => $rank_img,
|
||||
'RANK_IMG_SRC' => $rank_img_src,
|
||||
|
||||
'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour),
|
||||
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour),
|
||||
@@ -176,13 +190,16 @@ class user_menu extends module_base
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add form token for login box
|
||||
add_form_key('login', '_LOGIN');
|
||||
|
||||
/*
|
||||
* Assign specific vars
|
||||
* Need to remove web root path as ucp.php will do the
|
||||
* redirect
|
||||
*/
|
||||
$this->template->assign_vars(array(
|
||||
'U_PORTAL_REDIRECT' => $this->path_helper->remove_web_root_path($this->controller_helper->route('board3_portal_controller')),
|
||||
'U_login_redirect' => $this->path_helper->remove_web_root_path($this->controller_helper->route('board3_portal_controller')),
|
||||
'S_DISPLAY_FULL_LOGIN' => true,
|
||||
'S_AUTOLOGIN_ENABLED' => ($this->config['allow_autologin']) ? true : false,
|
||||
'S_LOGIN_ACTION' => append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'mode=login'),
|
||||
|
||||
Reference in New Issue
Block a user