mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-19 15:01:33 +02:00
Merge remote-tracking branch 'phpbb/develop' into ticket/11574
* phpbb/develop: (130 commits) [ticket/11638] Changed the layout to match the other similar commits [ticket/11640] removed the space that I wonder what it was doing there. [ticket/11749] Move event after all template data has been defined [ticket/10917] Variable used only once so delete it [ticket/10917] Revert use of phpbb wrapper [ticket/11749] Template events for topic_list_row_pre/append [ticket/11749] PHP Events for viewforum.php [ticket/11749] PHP Events for search.php [ticket/11740] Update FAQ to include Ideas Centre [ticket/11062] If user's language is english there is no further work needed [ticket/11062] Load new strings from user's language file if provided [ticket/10917] Using phpbb wrapper [ticket/10917] Fixed notice that files are out of date when updating to an unreleased version [ticket/11741] Fix empty brackets and remove bullet [ticket/11638] Removed the unneeded reset. [ticket/11638] Use the $parse_flags like the other commits [ticket/11638] Reverted to use the $parse tags way as the other ones [ticket/11638] Updated: bitwise $parse_flags use optionset() [ticket/11656] Made the check for the bitfield just like other PR's [ticket/11667] Use @inheritdoc ...
This commit is contained in:
@@ -93,7 +93,7 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
|
||||
// Make sure getimagesize works...
|
||||
if (function_exists('getimagesize'))
|
||||
{
|
||||
if (($width <= 0 || $height <= 0) && (($image_data = getimagesize($url)) === false))
|
||||
if (($width <= 0 || $height <= 0) && (($image_data = @getimagesize($url)) === false))
|
||||
{
|
||||
$error[] = 'UNABLE_GET_IMAGE_SIZE';
|
||||
return false;
|
||||
|
@@ -72,7 +72,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
|
||||
),
|
||||
),
|
||||
'WHERE' => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
|
||||
AND ' . $this->content_visibility->get_visibility_sql('post', array(), 'p.') . '
|
||||
AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . '
|
||||
AND p.post_time >= ' . $min_post_time . '
|
||||
AND u.user_id = p.poster_id',
|
||||
'ORDER_BY' => 'p.post_time DESC',
|
||||
|
@@ -43,7 +43,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
|
||||
|
||||
function open()
|
||||
{
|
||||
$sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_replies, t.topic_type
|
||||
$sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type
|
||||
FROM ' . TOPICS_TABLE . ' t
|
||||
LEFT JOIN ' . FORUMS_TABLE . ' f
|
||||
ON (f.forum_id = t.forum_id)
|
||||
@@ -60,7 +60,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
|
||||
$this->forum_id = (int) $this->topic_data['forum_id'];
|
||||
|
||||
// Make sure topic is either approved or user authed
|
||||
if (!$this->topic_data['topic_approved'] && !$this->auth->acl_get('m_approve', $this->forum_id))
|
||||
if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id))
|
||||
{
|
||||
trigger_error('SORRY_AUTH_READ');
|
||||
}
|
||||
|
340
phpBB/phpbb/permissions.php
Normal file
340
phpBB/phpbb/permissions.php
Normal file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2013 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* DO NOT CHANGE
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
class phpbb_permissions
|
||||
{
|
||||
/**
|
||||
* Event dispatcher object
|
||||
* @var phpbb_event_dispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* User object
|
||||
* @var phpbb_user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher
|
||||
* @param phpbb_user $user User Object
|
||||
* @return null
|
||||
*/
|
||||
public function __construct(phpbb_event_dispatcher $phpbb_dispatcher, phpbb_user $user)
|
||||
{
|
||||
$this->dispatcher = $phpbb_dispatcher;
|
||||
$this->user = $user;
|
||||
|
||||
$categories = $this->categories;
|
||||
$types = $this->types;
|
||||
$permissions = $this->permissions;
|
||||
|
||||
/**
|
||||
* Allows to specify additional permission categories, types and permissions
|
||||
*
|
||||
* @event core.permissions
|
||||
* @var array types Array with permission types (a_, u_, m_, etc.)
|
||||
* @var array categories Array with permission categories (pm, post, settings, misc, etc.)
|
||||
* @var array permissions Array with permissions. Each Permission has the following layout:
|
||||
* '<type><permission>' => array(
|
||||
* 'lang' => 'Language Key with a Short description', // Optional, if not set,
|
||||
* // the permissions identifier '<type><permission>' is used with
|
||||
* // all uppercase.
|
||||
* 'cat' => 'Identifier of the category, the permission should be displayed in',
|
||||
* ),
|
||||
* Example:
|
||||
* 'u_viewprofile' => array(
|
||||
* 'lang' => 'ACL_U_VIEWPROFILE',
|
||||
* 'cat' => 'profile',
|
||||
* ),
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('types', 'categories', 'permissions');
|
||||
extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars)));
|
||||
|
||||
$this->categories = $categories;
|
||||
$this->types = $types;
|
||||
$this->permissions = $permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all the permission categories (pm, post, settings, misc, etc.)
|
||||
*
|
||||
* @return array Layout: cat-identifier => Language key
|
||||
*/
|
||||
public function get_categories()
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language string of a permission category
|
||||
*
|
||||
* @param string $category Identifier of the category
|
||||
* @return string Language string
|
||||
*/
|
||||
public function get_category_lang($category)
|
||||
{
|
||||
return $this->user->lang($this->categories[$category]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all the permission types (a_, u_, m_, etc.)
|
||||
*
|
||||
* @return array Layout: type-identifier => Language key
|
||||
*/
|
||||
public function get_types()
|
||||
{
|
||||
return $this->types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language string of a permission type
|
||||
*
|
||||
* @param string $type Identifier of the type
|
||||
* @param mixed $scope Scope of the type (should be 'global', 'local' or false)
|
||||
* @return string Language string
|
||||
*/
|
||||
public function get_type_lang($type, $scope = false)
|
||||
{
|
||||
if ($scope && isset($this->types[$scope][$type]))
|
||||
{
|
||||
$lang_key = $this->types[$scope][$type];
|
||||
}
|
||||
else if (isset($this->types[$type]))
|
||||
{
|
||||
$lang_key = $this->types[$type];
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang_key = 'ACL_TYPE_' . strtoupper(($scope) ? $scope . '_' . $type : $type);
|
||||
}
|
||||
|
||||
return $this->user->lang($lang_key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all the permissions.
|
||||
* Each Permission has the following layout:
|
||||
* '<type><permission>' => array(
|
||||
* 'lang' => 'Language Key with a Short description', // Optional, if not set,
|
||||
* // the permissions identifier '<type><permission>' is used with
|
||||
* // all uppercase.
|
||||
* 'cat' => 'Identifier of the category, the permission should be displayed in',
|
||||
* ),
|
||||
* Example:
|
||||
* 'u_viewprofile' => array(
|
||||
* 'lang' => 'ACL_U_VIEWPROFILE',
|
||||
* 'cat' => 'profile',
|
||||
* ),
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_permissions()
|
||||
{
|
||||
return $this->permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the category of a permission
|
||||
*
|
||||
* @param string $permission Identifier of the permission
|
||||
* @return string Returns the category identifier of the permission
|
||||
*/
|
||||
public function get_permission_category($permission)
|
||||
{
|
||||
return (isset($this->permissions[$permission]['cat'])) ? $this->permissions[$permission]['cat'] : 'misc';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language string of a permission
|
||||
*
|
||||
* @param string $permission Identifier of the permission
|
||||
* @return string Language string
|
||||
*/
|
||||
public function get_permission_lang($permission)
|
||||
{
|
||||
return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission));
|
||||
}
|
||||
|
||||
protected $types = array(
|
||||
'u_' => 'ACL_TYPE_U_',
|
||||
'a_' => 'ACL_TYPE_A_',
|
||||
'm_' => 'ACL_TYPE_M_',
|
||||
'f_' => 'ACL_TYPE_F_',
|
||||
'global' => array(
|
||||
'm_' => 'ACL_TYPE_GLOBAL_M_',
|
||||
),
|
||||
);
|
||||
|
||||
protected $categories = array(
|
||||
'actions' => 'ACL_CAT_ACTIONS',
|
||||
'content' => 'ACL_CAT_CONTENT',
|
||||
'forums' => 'ACL_CAT_FORUMS',
|
||||
'misc' => 'ACL_CAT_MISC',
|
||||
'permissions' => 'ACL_CAT_PERMISSIONS',
|
||||
'pm' => 'ACL_CAT_PM',
|
||||
'polls' => 'ACL_CAT_POLLS',
|
||||
'post' => 'ACL_CAT_POST',
|
||||
'post_actions' => 'ACL_CAT_POST_ACTIONS',
|
||||
'posting' => 'ACL_CAT_POSTING',
|
||||
'profile' => 'ACL_CAT_PROFILE',
|
||||
'settings' => 'ACL_CAT_SETTINGS',
|
||||
'topic_actions' => 'ACL_CAT_TOPIC_ACTIONS',
|
||||
'user_group' => 'ACL_CAT_USER_GROUP',
|
||||
);
|
||||
|
||||
protected $permissions = array(
|
||||
// User Permissions
|
||||
'u_viewprofile' => array('lang' => 'ACL_U_VIEWPROFILE', 'cat' => 'profile'),
|
||||
'u_chgname' => array('lang' => 'ACL_U_CHGNAME', 'cat' => 'profile'),
|
||||
'u_chgpasswd' => array('lang' => 'ACL_U_CHGPASSWD', 'cat' => 'profile'),
|
||||
'u_chgemail' => array('lang' => 'ACL_U_CHGEMAIL', 'cat' => 'profile'),
|
||||
'u_chgavatar' => array('lang' => 'ACL_U_CHGAVATAR', 'cat' => 'profile'),
|
||||
'u_chggrp' => array('lang' => 'ACL_U_CHGGRP', 'cat' => 'profile'),
|
||||
'u_chgprofileinfo' => array('lang' => 'ACL_U_CHGPROFILEINFO', 'cat' => 'profile'),
|
||||
|
||||
'u_attach' => array('lang' => 'ACL_U_ATTACH', 'cat' => 'post'),
|
||||
'u_download' => array('lang' => 'ACL_U_DOWNLOAD', 'cat' => 'post'),
|
||||
'u_savedrafts' => array('lang' => 'ACL_U_SAVEDRAFTS', 'cat' => 'post'),
|
||||
'u_chgcensors' => array('lang' => 'ACL_U_CHGCENSORS', 'cat' => 'post'),
|
||||
'u_sig' => array('lang' => 'ACL_U_SIG', 'cat' => 'post'),
|
||||
|
||||
'u_sendpm' => array('lang' => 'ACL_U_SENDPM', 'cat' => 'pm'),
|
||||
'u_masspm' => array('lang' => 'ACL_U_MASSPM', 'cat' => 'pm'),
|
||||
'u_masspm_group'=> array('lang' => 'ACL_U_MASSPM_GROUP', 'cat' => 'pm'),
|
||||
'u_readpm' => array('lang' => 'ACL_U_READPM', 'cat' => 'pm'),
|
||||
'u_pm_edit' => array('lang' => 'ACL_U_PM_EDIT', 'cat' => 'pm'),
|
||||
'u_pm_delete' => array('lang' => 'ACL_U_PM_DELETE', 'cat' => 'pm'),
|
||||
'u_pm_forward' => array('lang' => 'ACL_U_PM_FORWARD', 'cat' => 'pm'),
|
||||
'u_pm_emailpm' => array('lang' => 'ACL_U_PM_EMAILPM', 'cat' => 'pm'),
|
||||
'u_pm_printpm' => array('lang' => 'ACL_U_PM_PRINTPM', 'cat' => 'pm'),
|
||||
'u_pm_attach' => array('lang' => 'ACL_U_PM_ATTACH', 'cat' => 'pm'),
|
||||
'u_pm_download' => array('lang' => 'ACL_U_PM_DOWNLOAD', 'cat' => 'pm'),
|
||||
'u_pm_bbcode' => array('lang' => 'ACL_U_PM_BBCODE', 'cat' => 'pm'),
|
||||
'u_pm_smilies' => array('lang' => 'ACL_U_PM_SMILIES', 'cat' => 'pm'),
|
||||
'u_pm_img' => array('lang' => 'ACL_U_PM_IMG', 'cat' => 'pm'),
|
||||
'u_pm_flash' => array('lang' => 'ACL_U_PM_FLASH', 'cat' => 'pm'),
|
||||
|
||||
'u_sendemail' => array('lang' => 'ACL_U_SENDEMAIL', 'cat' => 'misc'),
|
||||
'u_sendim' => array('lang' => 'ACL_U_SENDIM', 'cat' => 'misc'),
|
||||
'u_ignoreflood' => array('lang' => 'ACL_U_IGNOREFLOOD', 'cat' => 'misc'),
|
||||
'u_hideonline' => array('lang' => 'ACL_U_HIDEONLINE', 'cat' => 'misc'),
|
||||
'u_viewonline' => array('lang' => 'ACL_U_VIEWONLINE', 'cat' => 'misc'),
|
||||
'u_search' => array('lang' => 'ACL_U_SEARCH', 'cat' => 'misc'),
|
||||
|
||||
// Forum Permissions
|
||||
'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'),
|
||||
'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'),
|
||||
'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'),
|
||||
'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'),
|
||||
'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'),
|
||||
'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'),
|
||||
'f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'),
|
||||
'f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'),
|
||||
'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'),
|
||||
'f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'),
|
||||
|
||||
'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'),
|
||||
'f_sticky' => array('lang' => 'ACL_F_STICKY', 'cat' => 'post'),
|
||||
'f_announce' => array('lang' => 'ACL_F_ANNOUNCE', 'cat' => 'post'),
|
||||
'f_reply' => array('lang' => 'ACL_F_REPLY', 'cat' => 'post'),
|
||||
'f_edit' => array('lang' => 'ACL_F_EDIT', 'cat' => 'post'),
|
||||
'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'),
|
||||
'f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'),
|
||||
'f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'),
|
||||
'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'),
|
||||
|
||||
'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'),
|
||||
'f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'),
|
||||
'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'),
|
||||
'f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'),
|
||||
'f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'),
|
||||
'f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'),
|
||||
'f_smilies' => array('lang' => 'ACL_F_SMILIES', 'cat' => 'content'),
|
||||
|
||||
'f_poll' => array('lang' => 'ACL_F_POLL', 'cat' => 'polls'),
|
||||
'f_vote' => array('lang' => 'ACL_F_VOTE', 'cat' => 'polls'),
|
||||
'f_votechg' => array('lang' => 'ACL_F_VOTECHG', 'cat' => 'polls'),
|
||||
|
||||
// Moderator Permissions
|
||||
'm_edit' => array('lang' => 'ACL_M_EDIT', 'cat' => 'post_actions'),
|
||||
'm_delete' => array('lang' => 'ACL_M_DELETE', 'cat' => 'post_actions'),
|
||||
'm_approve' => array('lang' => 'ACL_M_APPROVE', 'cat' => 'post_actions'),
|
||||
'm_report' => array('lang' => 'ACL_M_REPORT', 'cat' => 'post_actions'),
|
||||
'm_chgposter' => array('lang' => 'ACL_M_CHGPOSTER', 'cat' => 'post_actions'),
|
||||
|
||||
'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'),
|
||||
'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'),
|
||||
'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'),
|
||||
'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'),
|
||||
|
||||
'm_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'misc'),
|
||||
'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'),
|
||||
'm_ban' => array('lang' => 'ACL_M_BAN', 'cat' => 'misc'),
|
||||
|
||||
// Admin Permissions
|
||||
'a_board' => array('lang' => 'ACL_A_BOARD', 'cat' => 'settings'),
|
||||
'a_server' => array('lang' => 'ACL_A_SERVER', 'cat' => 'settings'),
|
||||
'a_jabber' => array('lang' => 'ACL_A_JABBER', 'cat' => 'settings'),
|
||||
'a_phpinfo' => array('lang' => 'ACL_A_PHPINFO', 'cat' => 'settings'),
|
||||
|
||||
'a_forum' => array('lang' => 'ACL_A_FORUM', 'cat' => 'forums'),
|
||||
'a_forumadd' => array('lang' => 'ACL_A_FORUMADD', 'cat' => 'forums'),
|
||||
'a_forumdel' => array('lang' => 'ACL_A_FORUMDEL', 'cat' => 'forums'),
|
||||
'a_prune' => array('lang' => 'ACL_A_PRUNE', 'cat' => 'forums'),
|
||||
|
||||
'a_icons' => array('lang' => 'ACL_A_ICONS', 'cat' => 'posting'),
|
||||
'a_words' => array('lang' => 'ACL_A_WORDS', 'cat' => 'posting'),
|
||||
'a_bbcode' => array('lang' => 'ACL_A_BBCODE', 'cat' => 'posting'),
|
||||
'a_attach' => array('lang' => 'ACL_A_ATTACH', 'cat' => 'posting'),
|
||||
|
||||
'a_user' => array('lang' => 'ACL_A_USER', 'cat' => 'user_group'),
|
||||
'a_userdel' => array('lang' => 'ACL_A_USERDEL', 'cat' => 'user_group'),
|
||||
'a_group' => array('lang' => 'ACL_A_GROUP', 'cat' => 'user_group'),
|
||||
'a_groupadd' => array('lang' => 'ACL_A_GROUPADD', 'cat' => 'user_group'),
|
||||
'a_groupdel' => array('lang' => 'ACL_A_GROUPDEL', 'cat' => 'user_group'),
|
||||
'a_ranks' => array('lang' => 'ACL_A_RANKS', 'cat' => 'user_group'),
|
||||
'a_profile' => array('lang' => 'ACL_A_PROFILE', 'cat' => 'user_group'),
|
||||
'a_names' => array('lang' => 'ACL_A_NAMES', 'cat' => 'user_group'),
|
||||
'a_ban' => array('lang' => 'ACL_A_BAN', 'cat' => 'user_group'),
|
||||
|
||||
'a_viewauth' => array('lang' => 'ACL_A_VIEWAUTH', 'cat' => 'permissions'),
|
||||
'a_authgroups' => array('lang' => 'ACL_A_AUTHGROUPS', 'cat' => 'permissions'),
|
||||
'a_authusers' => array('lang' => 'ACL_A_AUTHUSERS', 'cat' => 'permissions'),
|
||||
'a_fauth' => array('lang' => 'ACL_A_FAUTH', 'cat' => 'permissions'),
|
||||
'a_mauth' => array('lang' => 'ACL_A_MAUTH', 'cat' => 'permissions'),
|
||||
'a_aauth' => array('lang' => 'ACL_A_AAUTH', 'cat' => 'permissions'),
|
||||
'a_uauth' => array('lang' => 'ACL_A_UAUTH', 'cat' => 'permissions'),
|
||||
'a_roles' => array('lang' => 'ACL_A_ROLES', 'cat' => 'permissions'),
|
||||
'a_switchperm' => array('lang' => 'ACL_A_SWITCHPERM', 'cat' => 'permissions'),
|
||||
|
||||
'a_styles' => array('lang' => 'ACL_A_STYLES', 'cat' => 'misc'),
|
||||
'a_extensions' => array('lang' => 'ACL_A_EXTENSIONS', 'cat' => 'misc'),
|
||||
'a_viewlogs' => array('lang' => 'ACL_A_VIEWLOGS', 'cat' => 'misc'),
|
||||
'a_clearlogs' => array('lang' => 'ACL_A_CLEARLOGS', 'cat' => 'misc'),
|
||||
'a_modules' => array('lang' => 'ACL_A_MODULES', 'cat' => 'misc'),
|
||||
'a_language' => array('lang' => 'ACL_A_LANGUAGE', 'cat' => 'misc'),
|
||||
'a_email' => array('lang' => 'ACL_A_EMAIL', 'cat' => 'misc'),
|
||||
'a_bots' => array('lang' => 'ACL_A_BOTS', 'cat' => 'misc'),
|
||||
'a_reasons' => array('lang' => 'ACL_A_REASONS', 'cat' => 'misc'),
|
||||
'a_backup' => array('lang' => 'ACL_A_BACKUP', 'cat' => 'misc'),
|
||||
'a_search' => array('lang' => 'ACL_A_SEARCH', 'cat' => 'misc'),
|
||||
);
|
||||
}
|
@@ -1022,7 +1022,8 @@ class phpbb_session
|
||||
{
|
||||
include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx);
|
||||
}
|
||||
phpbb_captcha_factory::garbage_collect($config['captcha_plugin']);
|
||||
$captcha_factory = new phpbb_captcha_factory();
|
||||
$captcha_factory->garbage_collect($config['captcha_plugin']);
|
||||
|
||||
$sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
|
||||
WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']);
|
||||
|
@@ -126,10 +126,14 @@ class phpbb_template_twig_lexer extends Twig_Lexer
|
||||
{
|
||||
$callback = function($matches)
|
||||
{
|
||||
// Remove any quotes that may have been used in different implementations
|
||||
// E.g. DEFINE $TEST = 'blah' vs INCLUDE foo
|
||||
// Replace {} with start/end to parse variables (' ~ TEST ~ '.html)
|
||||
$matches[2] = str_replace(array('"', "'", '{', '}'), array('', '', "' ~ ", " ~ '"), $matches[2]);
|
||||
// Remove matching quotes at the beginning/end if a statement;
|
||||
// E.g. 'asdf'"' -> asdf'"
|
||||
// E.g. "asdf'"" -> asdf'"
|
||||
// E.g. 'asdf'" -> 'asdf'"
|
||||
$matches[2] = preg_replace('#^([\'"])?(.+?)\1$#', '$2', $matches[2]);
|
||||
|
||||
// Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
|
||||
$matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]);
|
||||
|
||||
// Surround the matches in single quotes ('' ~ TEST ~ '.html')
|
||||
return "<!-- {$matches[1]} '{$matches[2]}' -->";
|
||||
@@ -219,19 +223,20 @@ class phpbb_template_twig_lexer extends Twig_Lexer
|
||||
{
|
||||
$callback = function($matches)
|
||||
{
|
||||
$inner = $matches[2];
|
||||
// Replace $TEST with definition.TEST
|
||||
$matches[1] = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $matches[1]);
|
||||
$inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner);
|
||||
|
||||
// Replace .test with test|length
|
||||
$matches[1] = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $matches[1]);
|
||||
$inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)#', ' $1|length', $inner);
|
||||
|
||||
return '<!-- IF' . $matches[1] . '-->';
|
||||
return "<!-- {$matches[1]}IF{$inner}-->";
|
||||
};
|
||||
|
||||
// Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces)
|
||||
$code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code);
|
||||
|
||||
return preg_replace_callback('#<!-- IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
|
||||
return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_template_twig_node_includeasset extends Twig_Node
|
||||
abstract class phpbb_template_twig_node_includeasset extends Twig_Node
|
||||
{
|
||||
/** @var Twig_Environment */
|
||||
protected $environment;
|
||||
@@ -57,4 +57,19 @@ class phpbb_template_twig_node_includeasset extends Twig_Node
|
||||
->raw("\n');\n")
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the definition name
|
||||
*
|
||||
* @return string (e.g. 'SCRIPTS')
|
||||
*/
|
||||
abstract public function get_definition_name();
|
||||
|
||||
/**
|
||||
* Append the output code for the asset
|
||||
*
|
||||
* @param Twig_Compiler A Twig_Compiler instance
|
||||
* @return null
|
||||
*/
|
||||
abstract protected function append_asset(Twig_Compiler $compiler);
|
||||
}
|
||||
|
@@ -9,16 +9,17 @@
|
||||
|
||||
class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_definition_name()
|
||||
{
|
||||
return 'STYLESHEETS';
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles the node to PHP.
|
||||
*
|
||||
* @param Twig_Compiler A Twig_Compiler instance
|
||||
*/
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function append_asset(Twig_Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
|
@@ -9,16 +9,17 @@
|
||||
|
||||
class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_definition_name()
|
||||
{
|
||||
return 'SCRIPTS';
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles the node to PHP.
|
||||
*
|
||||
* @param Twig_Compiler A Twig_Compiler instance
|
||||
*/
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function append_asset(Twig_Compiler $compiler)
|
||||
{
|
||||
$config = $this->environment->get_phpbb_config();
|
||||
|
Reference in New Issue
Block a user