mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/avatars
Conflicts: phpBB/includes/ucp/ucp_groups.php
This commit is contained in:
commit
5d091e2d8f
53 changed files with 731 additions and 288 deletions
|
@ -11,8 +11,7 @@
|
||||||
<property name="versions" value="${oldversions}, ${newversion}" />
|
<property name="versions" value="${oldversions}, ${newversion}" />
|
||||||
|
|
||||||
<!-- These are the main targets which you will probably want to use -->
|
<!-- These are the main targets which you will probably want to use -->
|
||||||
<target name="package" depends="clean,prepare,composer,create-package" />
|
<target name="all" depends="clean,prepare,composer,test,docs,package" />
|
||||||
<target name="all" depends="clean,prepare,composer,test,docs,create-package" />
|
|
||||||
<target name="build" depends="clean,prepare,composer,test,docs" />
|
<target name="build" depends="clean,prepare,composer,test,docs" />
|
||||||
|
|
||||||
<target name="prepare">
|
<target name="prepare">
|
||||||
|
@ -43,9 +42,15 @@
|
||||||
<delete dir="build/save" />
|
<delete dir="build/save" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="composer" depends="clean,prepare">
|
<!--
|
||||||
<exec dir="./phpBB/"
|
This target basically just runs composer in the phpBB tree to ensure
|
||||||
command="php ../composer.phar install"
|
all dependencies are loaded. Additional development dependencies are
|
||||||
|
loaded because testing framework may depend on them.
|
||||||
|
-->
|
||||||
|
<target name="composer">
|
||||||
|
<exec dir="phpBB"
|
||||||
|
command="php ../composer.phar install --dev"
|
||||||
|
checkreturn="true"
|
||||||
passthru="true" />
|
passthru="true" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
@ -122,7 +127,7 @@
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="create-package" depends="prepare-new-version,old-version-diffs">
|
<target name="package" depends="clean,prepare,prepare-new-version,old-version-diffs">
|
||||||
<exec dir="build" command="php -f package.php '${versions}' > logs/package.log" escape="false" />
|
<exec dir="build" command="php -f package.php '${versions}' > logs/package.log" escape="false" />
|
||||||
<exec dir="build" command="php -f build_diff.php '${prevversion}' '${newversion}' > logs/build_diff.log" escape="false" />
|
<exec dir="build" command="php -f build_diff.php '${prevversion}' '${newversion}' > logs/build_diff.log" escape="false" />
|
||||||
|
|
||||||
|
@ -162,9 +167,27 @@
|
||||||
command="git archive ${revision} | tar -xf - -C ../${dir}"
|
command="git archive ${revision} | tar -xf - -C ../${dir}"
|
||||||
checkreturn="true" />
|
checkreturn="true" />
|
||||||
|
|
||||||
<exec dir="${dir}"
|
<!--
|
||||||
command="php ../composer.phar install"
|
If composer.phar exists in this version of the tree, also export
|
||||||
passthru="true" />
|
it into ${dir}, install dependencies, then delete it again.
|
||||||
|
-->
|
||||||
|
<exec dir="."
|
||||||
|
command="git ls-tree ${revision} composer.phar"
|
||||||
|
checkreturn="true"
|
||||||
|
outputProperty='composer-ls-tree-output' />
|
||||||
|
<if>
|
||||||
|
<not><equals arg1="${composer-ls-tree-output}" arg2="" trim="true" /></not>
|
||||||
|
<then>
|
||||||
|
<exec dir="."
|
||||||
|
command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
|
||||||
|
checkreturn="true" />
|
||||||
|
<exec dir="${dir}"
|
||||||
|
command="php composer.phar install"
|
||||||
|
checkreturn="true"
|
||||||
|
passthru="true" />
|
||||||
|
<delete file="${dir}/composer.phar" />
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
|
||||||
<delete file="${dir}/config.php" />
|
<delete file="${dir}/config.php" />
|
||||||
<delete dir="${dir}/develop" />
|
<delete dir="${dir}/develop" />
|
||||||
|
@ -187,6 +210,7 @@
|
||||||
<delete dir="${dir}/files" />
|
<delete dir="${dir}/files" />
|
||||||
<delete dir="${dir}/install" />
|
<delete dir="${dir}/install" />
|
||||||
<delete dir="${dir}/store" />
|
<delete dir="${dir}/store" />
|
||||||
|
<delete dir="${dir}/vendor" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -42,7 +42,6 @@ if (!$auth->acl_get('a_'))
|
||||||
|
|
||||||
// We define the admin variables now, because the user is now able to use the admin related features...
|
// We define the admin variables now, because the user is now able to use the admin related features...
|
||||||
define('IN_ADMIN', true);
|
define('IN_ADMIN', true);
|
||||||
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './';
|
|
||||||
|
|
||||||
// Some oft used variables
|
// Some oft used variables
|
||||||
$safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false;
|
$safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<!-- IF META -->{META}<!-- ENDIF -->
|
<!-- IF META -->{META}<!-- ENDIF -->
|
||||||
<title>{PAGE_TITLE}</title>
|
<title>{PAGE_TITLE}</title>
|
||||||
|
|
||||||
<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
<link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<!-- IF META -->{META}<!-- ENDIF -->
|
<!-- IF META -->{META}<!-- ENDIF -->
|
||||||
<title>{PAGE_TITLE}</title>
|
<title>{PAGE_TITLE}</title>
|
||||||
|
|
||||||
<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
<link href="{T_TEMPLATE_PATH}/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
|
|
|
@ -21,8 +21,6 @@ $user->session_begin(false);
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
$user->setup();
|
$user->setup();
|
||||||
|
|
||||||
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : './';
|
|
||||||
|
|
||||||
// Set custom template for admin area
|
// Set custom template for admin area
|
||||||
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ var keymap = {
|
||||||
|
|
||||||
var dark = $('#darkenwrapper');
|
var dark = $('#darkenwrapper');
|
||||||
var loading_alert = $('#loadingalert');
|
var loading_alert = $('#loadingalert');
|
||||||
|
var phpbbAlertTimer = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +31,7 @@ phpbb.loading_alert = function() {
|
||||||
loading_alert.show();
|
loading_alert.show();
|
||||||
dark.fadeIn(phpbb.alert_time, function() {
|
dark.fadeIn(phpbb.alert_time, function() {
|
||||||
// Wait five seconds and display an error if nothing has been returned by then.
|
// Wait five seconds and display an error if nothing has been returned by then.
|
||||||
setTimeout(function() {
|
phpbbAlertTimer = setTimeout(function() {
|
||||||
if (loading_alert.is(':visible'))
|
if (loading_alert.is(':visible'))
|
||||||
{
|
{
|
||||||
phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req'));
|
phpbb.alert($('#phpbb_alert').attr('data-l-err'), $('#phpbb_alert').attr('data-l-timeout-processing-req'));
|
||||||
|
@ -42,6 +43,16 @@ phpbb.loading_alert = function() {
|
||||||
return loading_alert;
|
return loading_alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear loading alert timeout
|
||||||
|
*/
|
||||||
|
phpbb.clearLoadingTimeout = function() {
|
||||||
|
if (phpbbAlertTimer != null) {
|
||||||
|
clearTimeout(phpbbAlertTimer);
|
||||||
|
phpbbAlertTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a simple alert similar to JSs native alert().
|
* Display a simple alert similar to JSs native alert().
|
||||||
*
|
*
|
||||||
|
@ -271,6 +282,8 @@ phpbb.ajaxify = function(options) {
|
||||||
{
|
{
|
||||||
var alert;
|
var alert;
|
||||||
|
|
||||||
|
phpbb.clearLoadingTimeout();
|
||||||
|
|
||||||
// Is a confirmation required?
|
// Is a confirmation required?
|
||||||
if (typeof res.S_CONFIRM_ACTION === 'undefined')
|
if (typeof res.S_CONFIRM_ACTION === 'undefined')
|
||||||
{
|
{
|
||||||
|
@ -341,6 +354,7 @@ phpbb.ajaxify = function(options) {
|
||||||
{
|
{
|
||||||
var alert;
|
var alert;
|
||||||
|
|
||||||
|
phpbb.clearLoadingTimeout();
|
||||||
alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
|
alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +452,10 @@ phpbb.timezone_switch_date = function(keep_selection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof keep_selection !== 'undefined' && !keep_selection) {
|
if (typeof keep_selection !== 'undefined' && !keep_selection) {
|
||||||
$('#timezone > option:first').attr('selected', true);
|
var timezoneOptions = $('#timezone > optgroup option');
|
||||||
|
if (timezoneOptions.filter(':selected').length <= 0) {
|
||||||
|
timezoneOptions.filter(':first').attr('selected', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,10 @@ if (!defined('PHPBB_INSTALLED'))
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
|
||||||
|
$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
|
||||||
|
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
|
||||||
|
|
||||||
// Include files
|
// Include files
|
||||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||||
|
|
||||||
|
@ -83,18 +87,7 @@ $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_pat
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
$phpbb_container = phpbb_create_dumped_container_unless_debug(
|
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||||
array(
|
|
||||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
|
||||||
new phpbb_di_extension_core($phpbb_root_path),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
new phpbb_di_pass_collection_pass(),
|
|
||||||
new phpbb_di_pass_kernel_pass(),
|
|
||||||
),
|
|
||||||
$phpbb_root_path,
|
|
||||||
$phpEx
|
|
||||||
);
|
|
||||||
|
|
||||||
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
||||||
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
||||||
|
@ -127,8 +120,9 @@ $phpbb_style = $phpbb_container->get('style');
|
||||||
// Add own hook handler
|
// Add own hook handler
|
||||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
||||||
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display')));
|
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display')));
|
||||||
|
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
|
||||||
|
|
||||||
foreach ($cache->obtain_hooks() as $hook)
|
foreach ($phpbb_hook_finder->find() as $hook)
|
||||||
{
|
{
|
||||||
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@ services:
|
||||||
class: phpbb_cache_service
|
class: phpbb_cache_service
|
||||||
arguments:
|
arguments:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
|
- %core.root_path%
|
||||||
|
- %core.php_ext%
|
||||||
|
|
||||||
cache.driver:
|
cache.driver:
|
||||||
class: %cache.driver.class%
|
class: %cache.driver.class%
|
||||||
|
@ -138,6 +142,13 @@ services:
|
||||||
- @dispatcher
|
- @dispatcher
|
||||||
- @controller.resolver
|
- @controller.resolver
|
||||||
|
|
||||||
|
hook_finder:
|
||||||
|
class: phpbb_hook_finder
|
||||||
|
arguments:
|
||||||
|
- %core.root_path%
|
||||||
|
- .%core.php_ext%
|
||||||
|
- @cache.driver
|
||||||
|
|
||||||
kernel_request_subscriber:
|
kernel_request_subscriber:
|
||||||
class: phpbb_event_kernel_request_subscriber
|
class: phpbb_event_kernel_request_subscriber
|
||||||
arguments:
|
arguments:
|
||||||
|
|
|
@ -56,18 +56,7 @@ if (isset($_GET['avatar']))
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
$phpbb_container = phpbb_create_dumped_container_unless_debug(
|
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||||
array(
|
|
||||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
|
||||||
new phpbb_di_extension_core($phpbb_root_path),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
new phpbb_di_pass_collection_pass(),
|
|
||||||
new phpbb_di_pass_kernel_pass(),
|
|
||||||
),
|
|
||||||
$phpbb_root_path,
|
|
||||||
$phpEx
|
|
||||||
);
|
|
||||||
|
|
||||||
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
||||||
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
||||||
|
|
|
@ -206,7 +206,7 @@ class acp_forums
|
||||||
($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
|
($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
|
||||||
{
|
{
|
||||||
copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false);
|
copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false);
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
$copied_permissions = true;
|
$copied_permissions = true;
|
||||||
}
|
}
|
||||||
/* Commented out because of questionable UI workflow - re-visit for 3.0.7
|
/* Commented out because of questionable UI workflow - re-visit for 3.0.7
|
||||||
|
@ -768,7 +768,7 @@ class acp_forums
|
||||||
if (!empty($forum_perm_from) && $forum_perm_from != $forum_id)
|
if (!empty($forum_perm_from) && $forum_perm_from != $forum_id)
|
||||||
{
|
{
|
||||||
copy_forum_permissions($forum_perm_from, $forum_id, true);
|
copy_forum_permissions($forum_perm_from, $forum_id, true);
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
$auth->acl_clear_prefetch();
|
$auth->acl_clear_prefetch();
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
$cache->destroy('sql', FORUMS_TABLE);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class acp_main
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $request;
|
global $config, $db, $cache, $user, $auth, $template, $request;
|
||||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
// Show restore permissions notice
|
// Show restore permissions notice
|
||||||
|
@ -359,7 +359,7 @@ class acp_main
|
||||||
|
|
||||||
// Clear permissions
|
// Clear permissions
|
||||||
$auth->acl_clear_prefetch();
|
$auth->acl_clear_prefetch();
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
|
|
||||||
add_log('admin', 'LOG_PURGE_CACHE');
|
add_log('admin', 'LOG_PURGE_CACHE');
|
||||||
|
|
||||||
|
|
|
@ -740,15 +740,15 @@ class acp_modules
|
||||||
*/
|
*/
|
||||||
function remove_cache_file()
|
function remove_cache_file()
|
||||||
{
|
{
|
||||||
global $cache;
|
global $phpbb_container;
|
||||||
|
|
||||||
// Sanitise for future path use, it's escaped as appropriate for queries
|
// Sanitise for future path use, it's escaped as appropriate for queries
|
||||||
$p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class));
|
$p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class));
|
||||||
|
|
||||||
$cache->destroy('_modules_' . $p_class);
|
$phpbb_container->get('cache.driver')->destroy('_modules_' . $p_class);
|
||||||
|
|
||||||
// Additionally remove sql cache
|
// Additionally remove sql cache
|
||||||
$cache->destroy('sql', MODULES_TABLE);
|
$phpbb_container->get('cache.driver')->destroy('sql', MODULES_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -656,7 +656,7 @@ class acp_permissions
|
||||||
*/
|
*/
|
||||||
function set_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id)
|
function set_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id)
|
||||||
{
|
{
|
||||||
global $user, $auth;
|
global $db, $cache, $user, $auth;
|
||||||
global $request;
|
global $request;
|
||||||
|
|
||||||
$psubmit = request_var('psubmit', array(0 => array(0 => 0)));
|
$psubmit = request_var('psubmit', array(0 => array(0 => 0)));
|
||||||
|
@ -726,13 +726,13 @@ class acp_permissions
|
||||||
// Do we need to recache the moderator lists?
|
// Do we need to recache the moderator lists?
|
||||||
if ($permission_type == 'm_')
|
if ($permission_type == 'm_')
|
||||||
{
|
{
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove users who are now moderators or admins from everyones foes list
|
// Remove users who are now moderators or admins from everyones foes list
|
||||||
if ($permission_type == 'm_' || $permission_type == 'a_')
|
if ($permission_type == 'm_' || $permission_type == 'a_')
|
||||||
{
|
{
|
||||||
update_foes($group_id, $user_id);
|
phpbb_update_foes($db, $auth, $group_id, $user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id);
|
$this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id);
|
||||||
|
@ -745,7 +745,7 @@ class acp_permissions
|
||||||
*/
|
*/
|
||||||
function set_all_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id)
|
function set_all_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id)
|
||||||
{
|
{
|
||||||
global $user, $auth;
|
global $db, $cache, $user, $auth;
|
||||||
global $request;
|
global $request;
|
||||||
|
|
||||||
// User or group to be set?
|
// User or group to be set?
|
||||||
|
@ -794,13 +794,13 @@ class acp_permissions
|
||||||
// Do we need to recache the moderator lists?
|
// Do we need to recache the moderator lists?
|
||||||
if ($permission_type == 'm_')
|
if ($permission_type == 'm_')
|
||||||
{
|
{
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove users who are now moderators or admins from everyones foes list
|
// Remove users who are now moderators or admins from everyones foes list
|
||||||
if ($permission_type == 'm_' || $permission_type == 'a_')
|
if ($permission_type == 'm_' || $permission_type == 'a_')
|
||||||
{
|
{
|
||||||
update_foes($group_id, $user_id);
|
phpbb_update_foes($db, $auth, $group_id, $user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids);
|
$this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids);
|
||||||
|
@ -858,7 +858,7 @@ class acp_permissions
|
||||||
*/
|
*/
|
||||||
function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id)
|
function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id)
|
||||||
{
|
{
|
||||||
global $user, $db, $auth;
|
global $user, $db, $cache, $auth;
|
||||||
|
|
||||||
// User or group to be set?
|
// User or group to be set?
|
||||||
$ug_type = (sizeof($user_id)) ? 'user' : 'group';
|
$ug_type = (sizeof($user_id)) ? 'user' : 'group';
|
||||||
|
@ -874,7 +874,7 @@ class acp_permissions
|
||||||
// Do we need to recache the moderator lists?
|
// Do we need to recache the moderator lists?
|
||||||
if ($permission_type == 'm_')
|
if ($permission_type == 'm_')
|
||||||
{
|
{
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0)));
|
$this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0)));
|
||||||
|
@ -952,12 +952,7 @@ class acp_permissions
|
||||||
|
|
||||||
if ($user_id != $user->data['user_id'])
|
if ($user_id != $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$sql = 'SELECT user_id, username, user_permissions, user_type
|
$userdata = $auth->obtain_user_data($user_id);
|
||||||
FROM ' . USERS_TABLE . '
|
|
||||||
WHERE user_id = ' . $user_id;
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$userdata = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1172,7 +1167,7 @@ class acp_permissions
|
||||||
*/
|
*/
|
||||||
function copy_forum_permissions()
|
function copy_forum_permissions()
|
||||||
{
|
{
|
||||||
global $auth, $cache, $template, $user;
|
global $db, $auth, $cache, $template, $user;
|
||||||
|
|
||||||
$user->add_lang('acp/forums');
|
$user->add_lang('acp/forums');
|
||||||
|
|
||||||
|
@ -1187,7 +1182,7 @@ class acp_permissions
|
||||||
{
|
{
|
||||||
if (copy_forum_permissions($src, $dest))
|
if (copy_forum_permissions($src, $dest))
|
||||||
{
|
{
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
|
|
||||||
$auth->acl_clear_prefetch();
|
$auth->acl_clear_prefetch();
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
$cache->destroy('sql', FORUMS_TABLE);
|
||||||
|
|
|
@ -209,7 +209,7 @@ class acp_ranks
|
||||||
|
|
||||||
'RANK_TITLE' => (isset($ranks['rank_title'])) ? $ranks['rank_title'] : '',
|
'RANK_TITLE' => (isset($ranks['rank_title'])) ? $ranks['rank_title'] : '',
|
||||||
'S_FILENAME_LIST' => $filename_list,
|
'S_FILENAME_LIST' => $filename_list,
|
||||||
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : $phpbb_admin_path . 'images/spacer.gif',
|
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif',
|
||||||
'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false,
|
'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false,
|
||||||
'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
|
'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
|
||||||
);
|
);
|
||||||
|
|
|
@ -137,11 +137,13 @@ class acp_styles
|
||||||
*/
|
*/
|
||||||
protected function action_cache()
|
protected function action_cache()
|
||||||
{
|
{
|
||||||
|
global $db, $cache, $auth;
|
||||||
|
|
||||||
$this->cache->purge();
|
$this->cache->purge();
|
||||||
|
|
||||||
// Clear permissions
|
// Clear permissions
|
||||||
$this->auth->acl_clear_prefetch();
|
$this->auth->acl_clear_prefetch();
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
|
|
||||||
add_log('admin', 'LOG_PURGE_CACHE');
|
add_log('admin', 'LOG_PURGE_CACHE');
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,26 @@ class phpbb_auth
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves data wanted by acl function from the database for the
|
||||||
|
* specified user.
|
||||||
|
*
|
||||||
|
* @param int $user_id User ID
|
||||||
|
* @return array User attributes
|
||||||
|
*/
|
||||||
|
public function obtain_user_data($user_id)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
$sql = 'SELECT user_id, username, user_permissions, user_type
|
||||||
|
FROM ' . USERS_TABLE . '
|
||||||
|
WHERE user_id = ' . $user_id;
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
$user_data = $db->sql_fetchrow($result);
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
return $user_data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill ACL array with relevant bitstrings from user_permissions column
|
* Fill ACL array with relevant bitstrings from user_permissions column
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -191,7 +211,7 @@ class phpbb_auth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get forums with the specified permission setting
|
* Get forums with the specified permission setting
|
||||||
* if the option is prefixed with !, then the result becomes nagated
|
* if the option is prefixed with !, then the result becomes negated
|
||||||
*
|
*
|
||||||
* @param bool $clean set to true if only values needs to be returned which are set/unset
|
* @param bool $clean set to true if only values needs to be returned which are set/unset
|
||||||
*/
|
*/
|
||||||
|
|
133
phpBB/includes/cache/service.php
vendored
133
phpBB/includes/cache/service.php
vendored
|
@ -21,16 +21,57 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_service
|
class phpbb_cache_service
|
||||||
{
|
{
|
||||||
private $driver;
|
/**
|
||||||
|
* Cache driver.
|
||||||
|
*
|
||||||
|
* @var phpbb_cache_driver_interface
|
||||||
|
*/
|
||||||
|
protected $driver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The config.
|
||||||
|
*
|
||||||
|
* @var phpbb_config
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database connection.
|
||||||
|
*
|
||||||
|
* @var phpbb_db_driver
|
||||||
|
*/
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Root path.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP extension.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a cache service around a cache driver
|
* Creates a cache service around a cache driver
|
||||||
*
|
*
|
||||||
* @param phpbb_cache_driver_interface $driver The cache driver
|
* @param phpbb_cache_driver_interface $driver The cache driver
|
||||||
|
* @param phpbb_config $config The config
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @param string $phpbb_root_path Root path
|
||||||
|
* @param string $php_ext PHP extension
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_cache_driver_interface $driver = null)
|
public function __construct(phpbb_cache_driver_interface $driver, phpbb_config $config, phpbb_db_driver $db, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->set_driver($driver);
|
$this->set_driver($driver);
|
||||||
|
$this->config = $config;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->php_ext = $php_ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,21 +105,19 @@ class phpbb_cache_service
|
||||||
*/
|
*/
|
||||||
function obtain_word_list()
|
function obtain_word_list()
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
if (($censors = $this->driver->get('_word_censors')) === false)
|
if (($censors = $this->driver->get('_word_censors')) === false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT word, replacement
|
$sql = 'SELECT word, replacement
|
||||||
FROM ' . WORDS_TABLE;
|
FROM ' . WORDS_TABLE;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$censors = array();
|
$censors = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$censors['match'][] = get_censor_preg_expression($row['word']);
|
$censors['match'][] = get_censor_preg_expression($row['word']);
|
||||||
$censors['replace'][] = $row['replacement'];
|
$censors['replace'][] = $row['replacement'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->driver->put('_word_censors', $censors);
|
$this->driver->put('_word_censors', $censors);
|
||||||
}
|
}
|
||||||
|
@ -93,23 +132,21 @@ class phpbb_cache_service
|
||||||
{
|
{
|
||||||
if (($icons = $this->driver->get('_icons')) === false)
|
if (($icons = $this->driver->get('_icons')) === false)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
// Topic icons
|
// Topic icons
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . ICONS_TABLE . '
|
FROM ' . ICONS_TABLE . '
|
||||||
ORDER BY icons_order';
|
ORDER BY icons_order';
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$icons = array();
|
$icons = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$icons[$row['icons_id']]['img'] = $row['icons_url'];
|
$icons[$row['icons_id']]['img'] = $row['icons_url'];
|
||||||
$icons[$row['icons_id']]['width'] = (int) $row['icons_width'];
|
$icons[$row['icons_id']]['width'] = (int) $row['icons_width'];
|
||||||
$icons[$row['icons_id']]['height'] = (int) $row['icons_height'];
|
$icons[$row['icons_id']]['height'] = (int) $row['icons_height'];
|
||||||
$icons[$row['icons_id']]['display'] = (bool) $row['display_on_posting'];
|
$icons[$row['icons_id']]['display'] = (bool) $row['display_on_posting'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->driver->put('_icons', $icons);
|
$this->driver->put('_icons', $icons);
|
||||||
}
|
}
|
||||||
|
@ -124,15 +161,13 @@ class phpbb_cache_service
|
||||||
{
|
{
|
||||||
if (($ranks = $this->driver->get('_ranks')) === false)
|
if (($ranks = $this->driver->get('_ranks')) === false)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . RANKS_TABLE . '
|
FROM ' . RANKS_TABLE . '
|
||||||
ORDER BY rank_min DESC';
|
ORDER BY rank_min DESC';
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$ranks = array();
|
$ranks = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['rank_special'])
|
if ($row['rank_special'])
|
||||||
{
|
{
|
||||||
|
@ -150,7 +185,7 @@ class phpbb_cache_service
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->driver->put('_ranks', $ranks);
|
$this->driver->put('_ranks', $ranks);
|
||||||
}
|
}
|
||||||
|
@ -169,8 +204,6 @@ class phpbb_cache_service
|
||||||
{
|
{
|
||||||
if (($extensions = $this->driver->get('_extensions')) === false)
|
if (($extensions = $this->driver->get('_extensions')) === false)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
$extensions = array(
|
$extensions = array(
|
||||||
'_allowed_post' => array(),
|
'_allowed_post' => array(),
|
||||||
'_allowed_pm' => array(),
|
'_allowed_pm' => array(),
|
||||||
|
@ -181,9 +214,9 @@ class phpbb_cache_service
|
||||||
FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
|
FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
|
||||||
WHERE e.group_id = g.group_id
|
WHERE e.group_id = g.group_id
|
||||||
AND (g.allow_group = 1 OR g.allow_in_pm = 1)';
|
AND (g.allow_group = 1 OR g.allow_in_pm = 1)';
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$extension = strtolower(trim($row['extension']));
|
$extension = strtolower(trim($row['extension']));
|
||||||
|
|
||||||
|
@ -210,7 +243,7 @@ class phpbb_cache_service
|
||||||
$extensions['_allowed_pm'][$extension] = 0;
|
$extensions['_allowed_pm'][$extension] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->driver->put('_extensions', $extensions);
|
$this->driver->put('_extensions', $extensions);
|
||||||
}
|
}
|
||||||
|
@ -275,9 +308,7 @@ class phpbb_cache_service
|
||||||
{
|
{
|
||||||
if (($bots = $this->driver->get('_bots')) === false)
|
if (($bots = $this->driver->get('_bots')) === false)
|
||||||
{
|
{
|
||||||
global $db;
|
switch ($this->db->sql_layer)
|
||||||
|
|
||||||
switch ($db->sql_layer)
|
|
||||||
{
|
{
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
case 'mssql_odbc':
|
case 'mssql_odbc':
|
||||||
|
@ -303,14 +334,14 @@ class phpbb_cache_service
|
||||||
ORDER BY LENGTH(bot_agent) DESC';
|
ORDER BY LENGTH(bot_agent) DESC';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$bots = array();
|
$bots = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$bots[] = $row;
|
$bots[] = $row;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->driver->put('_bots', $bots);
|
$this->driver->put('_bots', $bots);
|
||||||
}
|
}
|
||||||
|
@ -323,8 +354,6 @@ class phpbb_cache_service
|
||||||
*/
|
*/
|
||||||
function obtain_cfg_items($style)
|
function obtain_cfg_items($style)
|
||||||
{
|
{
|
||||||
global $config, $phpbb_root_path;
|
|
||||||
|
|
||||||
$parsed_array = $this->driver->get('_cfg_' . $style['style_path']);
|
$parsed_array = $this->driver->get('_cfg_' . $style['style_path']);
|
||||||
|
|
||||||
if ($parsed_array === false)
|
if ($parsed_array === false)
|
||||||
|
@ -332,14 +361,14 @@ class phpbb_cache_service
|
||||||
$parsed_array = array();
|
$parsed_array = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = $phpbb_root_path . 'styles/' . $style['style_path'] . '/style.cfg';
|
$filename = $this->phpbb_root_path . 'styles/' . $style['style_path'] . '/style.cfg';
|
||||||
|
|
||||||
if (!file_exists($filename))
|
if (!file_exists($filename))
|
||||||
{
|
{
|
||||||
return $parsed_array;
|
return $parsed_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
if (!isset($parsed_array['filetime']) || (($this->config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
|
||||||
{
|
{
|
||||||
// Re-parse cfg file
|
// Re-parse cfg file
|
||||||
$parsed_array = parse_cfg_file($filename);
|
$parsed_array = parse_cfg_file($filename);
|
||||||
|
@ -358,54 +387,20 @@ class phpbb_cache_service
|
||||||
{
|
{
|
||||||
if (($usernames = $this->driver->get('_disallowed_usernames')) === false)
|
if (($usernames = $this->driver->get('_disallowed_usernames')) === false)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sql = 'SELECT disallow_username
|
$sql = 'SELECT disallow_username
|
||||||
FROM ' . DISALLOW_TABLE;
|
FROM ' . DISALLOW_TABLE;
|
||||||
$result = $db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$usernames = array();
|
$usernames = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$usernames[] = str_replace('%', '.*?', preg_quote(utf8_clean_string($row['disallow_username']), '#'));
|
$usernames[] = str_replace('%', '.*?', preg_quote(utf8_clean_string($row['disallow_username']), '#'));
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->driver->put('_disallowed_usernames', $usernames);
|
$this->driver->put('_disallowed_usernames', $usernames);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $usernames;
|
return $usernames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtain hooks...
|
|
||||||
*/
|
|
||||||
function obtain_hooks()
|
|
||||||
{
|
|
||||||
global $phpbb_root_path, $phpEx;
|
|
||||||
|
|
||||||
if (($hook_files = $this->driver->get('_hooks')) === false)
|
|
||||||
{
|
|
||||||
$hook_files = array();
|
|
||||||
|
|
||||||
// Now search for hooks...
|
|
||||||
$dh = @opendir($phpbb_root_path . 'includes/hooks/');
|
|
||||||
|
|
||||||
if ($dh)
|
|
||||||
{
|
|
||||||
while (($file = readdir($dh)) !== false)
|
|
||||||
{
|
|
||||||
if (strpos($file, 'hook_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx)
|
|
||||||
{
|
|
||||||
$hook_files[] = substr($file, 0, -(strlen($phpEx) + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($dh);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->driver->put('_hooks', $hook_files);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $hook_files;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ class phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ class phpbb_db_driver
|
||||||
$this->sql_rowseek($rownum, $query_id);
|
$this->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_object($query_id) && $cache->sql_exists($query_id))
|
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchfield($query_id, $field);
|
return $cache->sql_fetchfield($query_id, $field);
|
||||||
}
|
}
|
||||||
|
@ -822,7 +822,7 @@ class phpbb_db_driver
|
||||||
*/
|
*/
|
||||||
function sql_report($mode, $query = '')
|
function sql_report($mode, $query = '')
|
||||||
{
|
{
|
||||||
global $cache, $starttime, $phpbb_root_path, $user;
|
global $cache, $starttime, $phpbb_root_path, $phpbb_admin_path, $user;
|
||||||
global $request;
|
global $request;
|
||||||
|
|
||||||
if (is_object($request) && !$request->variable('explain', false))
|
if (is_object($request) && !$request->variable('explain', false))
|
||||||
|
@ -852,7 +852,7 @@ class phpbb_db_driver
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>SQL Report</title>
|
<title>SQL Report</title>
|
||||||
<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
<link href="' . htmlspecialchars($phpbb_admin_path) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
</head>
|
</head>
|
||||||
<body id="errorpage">
|
<body id="errorpage">
|
||||||
<div id="wrap">
|
<div id="wrap">
|
||||||
|
|
|
@ -154,7 +154,7 @@ class phpbb_db_driver_firebird extends phpbb_db_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
$this->last_query_text = $query;
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -267,7 +267,7 @@ class phpbb_db_driver_firebird extends phpbb_db_driver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -330,7 +330,7 @@ class phpbb_db_driver_firebird extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ class phpbb_db_driver_firebird extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -165,7 +165,7 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -240,7 +240,7 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ class phpbb_db_driver_mssql extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
$this->last_query_text = $query;
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -194,7 +194,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -270,7 +270,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ class phpbb_db_driver_mssqlnative extends phpbb_db_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
$this->last_query_text = $query;
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
|
|
@ -188,7 +188,7 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -203,7 +203,7 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -265,7 +265,7 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -199,7 +199,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_object($query_id) && $cache->sql_exists($query_id))
|
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_object($query_id) && $cache->sql_exists($query_id))
|
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ class phpbb_db_driver_mysqli extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_object($query_id) && $cache->sql_exists($query_id))
|
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ class phpbb_db_driver_oracle extends phpbb_db_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
$this->last_query_text = $query;
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -443,7 +443,7 @@ class phpbb_db_driver_oracle extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -498,7 +498,7 @@ class phpbb_db_driver_oracle extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ class phpbb_db_driver_oracle extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ class phpbb_db_driver_oracle extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
$this->last_query_text = $query;
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -208,7 +208,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -278,7 +278,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->query_result = ($cache_ttl) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
if ($this->query_result === false)
|
if ($this->query_result === false)
|
||||||
|
@ -149,7 +149,7 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver
|
||||||
$this->sql_report('stop', $query);
|
$this->sql_report('stop', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache_ttl)
|
if ($cache && $cache_ttl)
|
||||||
{
|
{
|
||||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||||
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
|
||||||
|
@ -210,7 +210,7 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchrow($query_id);
|
return $cache->sql_fetchrow($query_id);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
return $cache->sql_rowseek($rownum, $query_id);
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver
|
||||||
$query_id = $this->query_result;
|
$query_id = $this->query_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache->sql_exists($query_id))
|
if ($cache && $cache->sql_exists($query_id))
|
||||||
{
|
{
|
||||||
return $cache->sql_freeresult($query_id);
|
return $cache->sql_freeresult($query_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ class phpbb_di_extension_config extends Extension
|
||||||
{
|
{
|
||||||
require($this->config_file);
|
require($this->config_file);
|
||||||
|
|
||||||
|
$container->setParameter('core.adm_relative_path', (isset($phpbb_adm_relative_path) ? $phpbb_adm_relative_path : 'adm/'));
|
||||||
$container->setParameter('core.table_prefix', $table_prefix);
|
$container->setParameter('core.table_prefix', $table_prefix);
|
||||||
$container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
|
$container->setParameter('cache.driver.class', $this->convert_30_acm_type($acm_type));
|
||||||
$container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
|
$container->setParameter('dbal.driver.class', phpbb_convert_30_dbms_to_31($dbms));
|
||||||
|
|
|
@ -384,7 +384,7 @@ class phpbb_extension_manager
|
||||||
}
|
}
|
||||||
|
|
||||||
$iterator = new RecursiveIteratorIterator(
|
$iterator = new RecursiveIteratorIterator(
|
||||||
new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/'),
|
new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', FilesystemIterator::NEW_CURRENT_AND_KEY | FilesystemIterator::FOLLOW_SYMLINKS),
|
||||||
RecursiveIteratorIterator::SELF_FIRST);
|
RecursiveIteratorIterator::SELF_FIRST);
|
||||||
foreach ($iterator as $file_info)
|
foreach ($iterator as $file_info)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5339,7 +5339,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
|
function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
|
||||||
{
|
{
|
||||||
global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx;
|
global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx;
|
||||||
global $request, $phpbb_dispatcher;
|
global $request, $phpbb_dispatcher, $phpbb_admin_path;
|
||||||
|
|
||||||
// A listener can set this variable to `true` when it overrides this function
|
// A listener can set this variable to `true` when it overrides this function
|
||||||
$page_footer_override = false;
|
$page_footer_override = false;
|
||||||
|
@ -5395,7 +5395,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
|
||||||
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
||||||
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'),
|
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'),
|
||||||
|
|
||||||
'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", false, true, $user->session_id) : '')
|
'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '')
|
||||||
);
|
);
|
||||||
|
|
||||||
// Call cron-type script
|
// Call cron-type script
|
||||||
|
|
|
@ -82,16 +82,16 @@ function adm_page_header($page_title)
|
||||||
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
|
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
|
||||||
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
|
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
|
||||||
|
|
||||||
'ICON_MOVE_UP' => '<img src="' . $phpbb_admin_path . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
|
'ICON_MOVE_UP' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_up.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
|
||||||
'ICON_MOVE_UP_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
|
'ICON_MOVE_UP_DISABLED' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_up_disabled.gif" alt="' . $user->lang['MOVE_UP'] . '" title="' . $user->lang['MOVE_UP'] . '" />',
|
||||||
'ICON_MOVE_DOWN' => '<img src="' . $phpbb_admin_path . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
|
'ICON_MOVE_DOWN' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_down.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
|
||||||
'ICON_MOVE_DOWN_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
|
'ICON_MOVE_DOWN_DISABLED' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_down_disabled.gif" alt="' . $user->lang['MOVE_DOWN'] . '" title="' . $user->lang['MOVE_DOWN'] . '" />',
|
||||||
'ICON_EDIT' => '<img src="' . $phpbb_admin_path . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
|
'ICON_EDIT' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_edit.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
|
||||||
'ICON_EDIT_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
|
'ICON_EDIT_DISABLED' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_edit_disabled.gif" alt="' . $user->lang['EDIT'] . '" title="' . $user->lang['EDIT'] . '" />',
|
||||||
'ICON_DELETE' => '<img src="' . $phpbb_admin_path . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
|
'ICON_DELETE' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_delete.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
|
||||||
'ICON_DELETE_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
|
'ICON_DELETE_DISABLED' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_delete_disabled.gif" alt="' . $user->lang['DELETE'] . '" title="' . $user->lang['DELETE'] . '" />',
|
||||||
'ICON_SYNC' => '<img src="' . $phpbb_admin_path . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
|
'ICON_SYNC' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_sync.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
|
||||||
'ICON_SYNC_DISABLED' => '<img src="' . $phpbb_admin_path . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
|
'ICON_SYNC_DISABLED' => '<img src="' . htmlspecialchars($phpbb_admin_path) . 'images/icon_sync_disabled.gif" alt="' . $user->lang['RESYNC'] . '" title="' . $user->lang['RESYNC'] . '" />',
|
||||||
|
|
||||||
'S_USER_LANG' => $user->lang['USER_LANG'],
|
'S_USER_LANG' => $user->lang['USER_LANG'],
|
||||||
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
|
'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
|
||||||
|
|
|
@ -2292,13 +2292,17 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username
|
* Cache moderators. Called whenever permissions are changed
|
||||||
* and group names must be carried through for the moderators table
|
* via admin_permissions. Changes of usernames and group names
|
||||||
|
* must be carried through for the moderators table.
|
||||||
|
*
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @param phpbb_cache_driver_interface Cache driver
|
||||||
|
* @param phpbb_auth $auth Authentication object
|
||||||
|
* @return null
|
||||||
*/
|
*/
|
||||||
function cache_moderators()
|
function phpbb_cache_moderators($db, $cache, $auth)
|
||||||
{
|
{
|
||||||
global $db, $cache, $auth, $phpbb_root_path, $phpEx;
|
|
||||||
|
|
||||||
// Remove cached sql results
|
// Remove cached sql results
|
||||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
||||||
|
|
||||||
|
@ -2468,6 +2472,20 @@ function cache_moderators()
|
||||||
$db->sql_multi_insert(MODERATOR_CACHE_TABLE, $sql_ary);
|
$db->sql_multi_insert(MODERATOR_CACHE_TABLE, $sql_ary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache moderators. Called whenever permissions are changed
|
||||||
|
* via admin_permissions. Changes of usernames and group names
|
||||||
|
* must be carried through for the moderators table.
|
||||||
|
*
|
||||||
|
* @deprecated 3.1
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function cache_moderators()
|
||||||
|
{
|
||||||
|
global $db, $cache, $auth;
|
||||||
|
return phpbb_cache_moderators($db, $cache, $auth);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View log
|
* View log
|
||||||
* If $log_count is set to false, we will skip counting all entries in the database.
|
* If $log_count is set to false, we will skip counting all entries in the database.
|
||||||
|
@ -2740,12 +2758,16 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update foes - remove moderators and administrators from foe lists...
|
* Removes moderators and administrators from foe lists.
|
||||||
|
*
|
||||||
|
* @param phpbb_db_driver $db Database connection
|
||||||
|
* @param phpbb_auth $auth Authentication object
|
||||||
|
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
|
||||||
|
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
|
||||||
|
* @return null
|
||||||
*/
|
*/
|
||||||
function update_foes($group_id = false, $user_id = false)
|
function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false)
|
||||||
{
|
{
|
||||||
global $db, $auth;
|
|
||||||
|
|
||||||
// update foes for some user
|
// update foes for some user
|
||||||
if (is_array($user_id) && sizeof($user_id))
|
if (is_array($user_id) && sizeof($user_id))
|
||||||
{
|
{
|
||||||
|
@ -2854,6 +2876,20 @@ function update_foes($group_id = false, $user_id = false)
|
||||||
unset($perms);
|
unset($perms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes moderators and administrators from foe lists.
|
||||||
|
*
|
||||||
|
* @deprecated 3.1
|
||||||
|
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
|
||||||
|
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function update_foes($group_id = false, $user_id = false)
|
||||||
|
{
|
||||||
|
global $db, $auth;
|
||||||
|
return phpbb_update_foes($db, $auth, $group_id, $user_id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists inactive users
|
* Lists inactive users
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -105,6 +105,15 @@ function phpbb_create_compiled_container(array $extensions, array $passes, $phpb
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a compiled and dumped ContainerBuilder object
|
||||||
|
*
|
||||||
|
* @param array $extensions Array of Container extension objects
|
||||||
|
* @param array $passes Array of Compiler Pass objects
|
||||||
|
* @param string $phpbb_root_path Root path
|
||||||
|
* @param string $php_ext PHP Extension
|
||||||
|
* @return ContainerBuilder object (compiled)
|
||||||
|
*/
|
||||||
function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
// Check for our cached container; if it exists, use it
|
// Check for our cached container; if it exists, use it
|
||||||
|
@ -129,12 +138,60 @@ function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_
|
||||||
return $container;
|
return $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an environment-specific ContainerBuilder object
|
||||||
|
*
|
||||||
|
* If debug is enabled, the container is re-compiled every time.
|
||||||
|
* This ensures that the latest changes will always be reflected
|
||||||
|
* during development.
|
||||||
|
*
|
||||||
|
* Otherwise it will get the existing dumped container and use
|
||||||
|
* that one instead.
|
||||||
|
*
|
||||||
|
* @param array $extensions Array of Container extension objects
|
||||||
|
* @param array $passes Array of Compiler Pass objects
|
||||||
|
* @param string $phpbb_root_path Root path
|
||||||
|
* @param string $php_ext PHP Extension
|
||||||
|
* @return ContainerBuilder object (compiled)
|
||||||
|
*/
|
||||||
function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container';
|
$container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container';
|
||||||
return $container_factory($extensions, $passes, $phpbb_root_path, $php_ext);
|
return $container_factory($extensions, $passes, $phpbb_root_path, $php_ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a default ContainerBuilder object
|
||||||
|
*
|
||||||
|
* Contains the default configuration of the phpBB container.
|
||||||
|
*
|
||||||
|
* @param array $extensions Array of Container extension objects
|
||||||
|
* @param array $passes Array of Compiler Pass objects
|
||||||
|
* @return ContainerBuilder object (compiled)
|
||||||
|
*/
|
||||||
|
function phpbb_create_default_container($phpbb_root_path, $php_ext)
|
||||||
|
{
|
||||||
|
return phpbb_create_dumped_container_unless_debug(
|
||||||
|
array(
|
||||||
|
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $php_ext),
|
||||||
|
new phpbb_di_extension_core($phpbb_root_path),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
new phpbb_di_pass_collection_pass(),
|
||||||
|
new phpbb_di_pass_kernel_pass(),
|
||||||
|
),
|
||||||
|
$phpbb_root_path,
|
||||||
|
$php_ext
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the filename under which the dumped container will be stored.
|
||||||
|
*
|
||||||
|
* @param string $phpbb_root_path Root path
|
||||||
|
* @param string $php_ext PHP Extension
|
||||||
|
* @return Path for dumped container
|
||||||
|
*/
|
||||||
function phpbb_container_filename($phpbb_root_path, $php_ext)
|
function phpbb_container_filename($phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path);
|
$filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path);
|
||||||
|
|
|
@ -32,6 +32,8 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => false,
|
'2.0.x' => false,
|
||||||
),
|
),
|
||||||
|
// Note: php 5.5 alpha 2 deprecated mysql.
|
||||||
|
// Keep mysqli before mysql in this list.
|
||||||
'mysqli' => array(
|
'mysqli' => array(
|
||||||
'LABEL' => 'MySQL with MySQLi Extension',
|
'LABEL' => 'MySQL with MySQLi Extension',
|
||||||
'SCHEMA' => 'mysql_41',
|
'SCHEMA' => 'mysql_41',
|
||||||
|
@ -508,6 +510,9 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test
|
||||||
'dbuser' => $data['dbuser'],
|
'dbuser' => $data['dbuser'],
|
||||||
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
|
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
|
||||||
'table_prefix' => $data['table_prefix'],
|
'table_prefix' => $data['table_prefix'],
|
||||||
|
|
||||||
|
'adm_relative_path' => 'adm/',
|
||||||
|
|
||||||
'acm_type' => 'phpbb_cache_driver_file',
|
'acm_type' => 'phpbb_cache_driver_file',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -2377,7 +2377,7 @@ function avatar_remove_db($avatar_name)
|
||||||
*/
|
*/
|
||||||
function group_delete($group_id, $group_name = false)
|
function group_delete($group_id, $group_name = false)
|
||||||
{
|
{
|
||||||
global $db, $phpbb_root_path, $phpEx, $phpbb_dispatcher;
|
global $db, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_dispatcher;
|
||||||
|
|
||||||
if (!$group_name)
|
if (!$group_name)
|
||||||
{
|
{
|
||||||
|
@ -2448,12 +2448,12 @@ function group_delete($group_id, $group_name = false)
|
||||||
extract($phpbb_dispatcher->trigger_event('core.delete_group_after', compact($vars)));
|
extract($phpbb_dispatcher->trigger_event('core.delete_group_after', compact($vars)));
|
||||||
|
|
||||||
// Re-cache moderators
|
// Re-cache moderators
|
||||||
if (!function_exists('cache_moderators'))
|
if (!function_exists('phpbb_cache_moderators'))
|
||||||
{
|
{
|
||||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
|
|
||||||
add_log('admin', 'LOG_GROUP_DELETE', $group_name);
|
add_log('admin', 'LOG_GROUP_DELETE', $group_name);
|
||||||
|
|
||||||
|
@ -2998,7 +2998,7 @@ function group_validate_groupname($group_id, $group_name)
|
||||||
*/
|
*/
|
||||||
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
|
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
|
||||||
{
|
{
|
||||||
global $cache, $db, $phpbb_dispatcher;
|
global $phpbb_container, $db, $phpbb_dispatcher;
|
||||||
|
|
||||||
if (empty($user_id_ary))
|
if (empty($user_id_ary))
|
||||||
{
|
{
|
||||||
|
@ -3114,7 +3114,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because some tables/caches use usercolour-specific data we need to purge this here.
|
// Because some tables/caches use usercolour-specific data we need to purge this here.
|
||||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
$phpbb_container->get('cache.driver')->destroy('sql', MODERATOR_CACHE_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3213,7 +3213,7 @@ function group_memberships($group_id_ary = false, $user_id_ary = false, $return_
|
||||||
*/
|
*/
|
||||||
function group_update_listings($group_id)
|
function group_update_listings($group_id)
|
||||||
{
|
{
|
||||||
global $auth;
|
global $db, $cache, $auth;
|
||||||
|
|
||||||
$hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_'));
|
$hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_'));
|
||||||
|
|
||||||
|
@ -3255,22 +3255,22 @@ function group_update_listings($group_id)
|
||||||
|
|
||||||
if ($mod_permissions)
|
if ($mod_permissions)
|
||||||
{
|
{
|
||||||
if (!function_exists('cache_moderators'))
|
if (!function_exists('phpbb_cache_moderators'))
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
}
|
}
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mod_permissions || $admin_permissions)
|
if ($mod_permissions || $admin_permissions)
|
||||||
{
|
{
|
||||||
if (!function_exists('update_foes'))
|
if (!function_exists('phpbb_update_foes'))
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
}
|
}
|
||||||
update_foes(array($group_id));
|
phpbb_update_foes($db, $auth, array($group_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
84
phpBB/includes/hook/finder.php
Normal file
84
phpBB/includes/hook/finder.php
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package extension
|
||||||
|
* @copyright (c) 2013 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The hook finder locates installed hooks.
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
*/
|
||||||
|
class phpbb_hook_finder
|
||||||
|
{
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
protected $cache;
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new finder instance.
|
||||||
|
*
|
||||||
|
* @param string $phpbb_root_path Path to the phpbb root directory
|
||||||
|
* @param string $php_ext php file extension
|
||||||
|
* @param phpbb_cache_driver_interface $cache A cache instance or null
|
||||||
|
*/
|
||||||
|
public function __construct($phpbb_root_path, $php_ext, phpbb_cache_driver_interface $cache = null)
|
||||||
|
{
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->cache = $cache;
|
||||||
|
$this->php_ext = $php_ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds all hook files.
|
||||||
|
*
|
||||||
|
* @param bool $cache Whether the result should be cached
|
||||||
|
* @return array An array of paths to found hook files
|
||||||
|
*/
|
||||||
|
public function find($cache = true)
|
||||||
|
{
|
||||||
|
if (!defined('DEBUG') && $cache && $this->cache)
|
||||||
|
{
|
||||||
|
$hook_files = $this->cache->get('_hooks');
|
||||||
|
if ($hook_files !== false)
|
||||||
|
{
|
||||||
|
return $hook_files;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$hook_files = array();
|
||||||
|
|
||||||
|
// Now search for hooks...
|
||||||
|
$dh = @opendir($this->phpbb_root_path . 'includes/hooks/');
|
||||||
|
|
||||||
|
if ($dh)
|
||||||
|
{
|
||||||
|
while (($file = readdir($dh)) !== false)
|
||||||
|
{
|
||||||
|
if (strpos($file, 'hook_') === 0 && substr($file, -(strlen($this->php_ext) + 1)) === '.' . $this->php_ext)
|
||||||
|
{
|
||||||
|
$hook_files[] = substr($file, 0, -(strlen($this->php_ext) + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($dh);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cache && $this->cache)
|
||||||
|
{
|
||||||
|
$this->cache->put('_hooks', $hook_files);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $hook_files;
|
||||||
|
}
|
||||||
|
}
|
|
@ -476,10 +476,14 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
$tmp_sql_match[] = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
|
$tmp_sql_match[] = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match_column . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
|
$sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p";
|
||||||
|
$sql_where = "WHERE (" . implode(' OR ', $tmp_sql_match) . ")
|
||||||
|
$sql_where_options";
|
||||||
$sql = "SELECT $sql_select
|
$sql = "SELECT $sql_select
|
||||||
FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p
|
$sql_from
|
||||||
WHERE (" . implode(' OR ', $tmp_sql_match) . ")
|
$sql_where
|
||||||
$sql_where_options
|
|
||||||
ORDER BY $sql_sort";
|
ORDER BY $sql_sort";
|
||||||
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
||||||
|
|
||||||
|
@ -499,7 +503,12 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
// if the total result count is not cached yet, retrieve it from the db
|
// if the total result count is not cached yet, retrieve it from the db
|
||||||
if (!$result_count)
|
if (!$result_count)
|
||||||
{
|
{
|
||||||
$result_count = sizeof ($id_ary);
|
$sql_count = "SELECT COUNT(*) as result_count
|
||||||
|
$sql_from
|
||||||
|
$sql_where";
|
||||||
|
$result = $this->db->sql_query($sql_count);
|
||||||
|
$result_count = (int) $this->db->sql_fetchfield('result_count');
|
||||||
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$result_count)
|
if (!$result_count)
|
||||||
{
|
{
|
||||||
|
@ -507,6 +516,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->sql_transaction('commit');
|
||||||
|
|
||||||
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
|
||||||
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||||
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
$id_ary = array_slice($id_ary, 0, (int) $per_page);
|
||||||
|
@ -647,6 +658,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
$field = 'topic_id';
|
$field = 'topic_id';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->sql_transaction('begin');
|
||||||
|
|
||||||
// Only read one block of posts from the db and then cache it
|
// Only read one block of posts from the db and then cache it
|
||||||
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
|
||||||
|
|
||||||
|
@ -659,7 +672,35 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
// retrieve the total result count if needed
|
// retrieve the total result count if needed
|
||||||
if (!$result_count)
|
if (!$result_count)
|
||||||
{
|
{
|
||||||
$result_count = sizeof ($id_ary);
|
if ($type == 'posts')
|
||||||
|
{
|
||||||
|
$sql_count = "SELECT COUNT(*) as result_count
|
||||||
|
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||||
|
WHERE $sql_author
|
||||||
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
|
$m_approve_fid_sql
|
||||||
|
$sql_fora
|
||||||
|
$sql_sort_join
|
||||||
|
$sql_time";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql_count = "SELECT COUNT(*) as result_count
|
||||||
|
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
|
WHERE $sql_author
|
||||||
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
|
$m_approve_fid_sql
|
||||||
|
$sql_fora
|
||||||
|
AND t.topic_id = p.topic_id
|
||||||
|
$sql_sort_join
|
||||||
|
$sql_time
|
||||||
|
GROUP BY t.topic_id, $sort_by_sql[$sort_key]";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->sql_query($sql_count);
|
||||||
|
$result_count = (int) $this->db->sql_fetchfield('result_count');
|
||||||
|
|
||||||
if (!$result_count)
|
if (!$result_count)
|
||||||
{
|
{
|
||||||
|
@ -667,6 +708,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->sql_transaction('commit');
|
||||||
|
|
||||||
if (sizeof($id_ary))
|
if (sizeof($id_ary))
|
||||||
{
|
{
|
||||||
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
$this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ucp_groups
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
|
||||||
global $db, $user, $auth, $cache, $template;
|
global $db, $user, $auth, $cache, $template;
|
||||||
global $request, $phpbb_container;
|
global $request, $phpbb_container;
|
||||||
|
|
||||||
|
@ -447,8 +447,8 @@ class ucp_groups
|
||||||
'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']),
|
'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']),
|
||||||
'GROUP_TYPE' => $group_row['group_type'],
|
'GROUP_TYPE' => $group_row['group_type'],
|
||||||
|
|
||||||
'AVATAR' => (empty($avatar) ? '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />' : $avatar),
|
'AVATAR' => (empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar),
|
||||||
'AVATAR_IMAGE' => (empty($avatar) ? '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />' : $avatar),
|
'AVATAR_IMAGE' => (empty($avatar) ? '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />' : $avatar),
|
||||||
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
|
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
|
||||||
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',
|
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',
|
||||||
));
|
));
|
||||||
|
@ -720,7 +720,7 @@ class ucp_groups
|
||||||
'GROUP_CLOSED' => $type_closed,
|
'GROUP_CLOSED' => $type_closed,
|
||||||
'GROUP_HIDDEN' => $type_hidden,
|
'GROUP_HIDDEN' => $type_hidden,
|
||||||
|
|
||||||
'U_SWATCH' => append_sid("{$phpbb_root_path}adm/swatch.$phpEx", 'form=ucp&name=group_colour'),
|
'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=ucp&name=group_colour'),
|
||||||
'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id",
|
'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id",
|
||||||
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
|
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
|
||||||
));
|
));
|
||||||
|
|
|
@ -73,6 +73,10 @@ if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
|
||||||
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
|
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
|
||||||
|
$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
|
||||||
|
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
|
||||||
|
|
||||||
// Include files
|
// Include files
|
||||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||||
|
|
||||||
|
@ -105,18 +109,7 @@ $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_pat
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
$phpbb_container = phpbb_create_dumped_container_unless_debug(
|
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||||
array(
|
|
||||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
|
||||||
new phpbb_di_extension_core($phpbb_root_path),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
new phpbb_di_pass_collection_pass(),
|
|
||||||
new phpbb_di_pass_kernel_pass(),
|
|
||||||
),
|
|
||||||
$phpbb_root_path,
|
|
||||||
$phpEx
|
|
||||||
);
|
|
||||||
|
|
||||||
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
||||||
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
||||||
|
@ -140,7 +133,8 @@ if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
||||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
||||||
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
||||||
|
|
||||||
foreach ($cache->obtain_hooks() as $hook)
|
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
|
||||||
|
foreach ($phpbb_hook_finder->find() as $hook)
|
||||||
{
|
{
|
||||||
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +187,7 @@ include($phpbb_root_path . 'language/' . $language . '/install.' . $phpEx);
|
||||||
$inline_update = (request_var('type', 0)) ? true : false;
|
$inline_update = (request_var('type', 0)) ? true : false;
|
||||||
|
|
||||||
// To let set_config() calls succeed, we need to make the config array available globally
|
// To let set_config() calls succeed, we need to make the config array available globally
|
||||||
$config = new phpbb_config_db($db, $cache->get_driver(), CONFIG_TABLE);
|
$config = new phpbb_config_db($db, $phpbb_container->get('cache.driver'), CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -231,7 +225,7 @@ if ($has_global && !$ga_forum_id)
|
||||||
|
|
||||||
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
||||||
|
|
||||||
<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
<link href="<?php echo htmlspecialchars($phpbb_admin_path); ?>style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -281,7 +275,7 @@ header('Content-type: text/html; charset=UTF-8');
|
||||||
|
|
||||||
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
|
||||||
|
|
||||||
<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
<link href="<?php echo htmlspecialchars($phpbb_admin_path); ?>style/admin.css" rel="stylesheet" type="text/css" media="screen" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -580,7 +574,7 @@ else
|
||||||
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
|
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
|
||||||
|
|
||||||
// Now we purge the session table as well as all cache files
|
// Now we purge the session table as well as all cache files
|
||||||
$cache->purge();
|
$phpbb_container->get('cache.driver')->purge();
|
||||||
|
|
||||||
_print_footer();
|
_print_footer();
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,10 @@ else
|
||||||
}
|
}
|
||||||
@ini_set('memory_limit', $mem_limit);
|
@ini_set('memory_limit', $mem_limit);
|
||||||
|
|
||||||
|
// In case $phpbb_adm_relative_path is not set (in case of an update), use the default.
|
||||||
|
$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/';
|
||||||
|
$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path;
|
||||||
|
|
||||||
// Include essential scripts
|
// Include essential scripts
|
||||||
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
require($phpbb_root_path . 'includes/class_loader.' . $phpEx);
|
||||||
|
|
||||||
|
@ -97,9 +101,6 @@ $phpbb_container = phpbb_create_install_container($phpbb_root_path, $phpEx);
|
||||||
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver'));
|
||||||
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver'));
|
||||||
|
|
||||||
// set up caching
|
|
||||||
$cache = $phpbb_container->get('cache');
|
|
||||||
|
|
||||||
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
|
$phpbb_dispatcher = $phpbb_container->get('dispatcher');
|
||||||
$request = $phpbb_container->get('request');
|
$request = $phpbb_container->get('request');
|
||||||
|
|
||||||
|
@ -195,7 +196,8 @@ if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
||||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
||||||
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
|
||||||
|
|
||||||
foreach ($cache->obtain_hooks() as $hook)
|
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
|
||||||
|
foreach ($phpbb_hook_finder->find() as $hook)
|
||||||
{
|
{
|
||||||
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
@ -215,9 +217,9 @@ $phpbb_style_path_provider = new phpbb_style_path_provider();
|
||||||
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context());
|
$template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context());
|
||||||
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
|
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
|
||||||
$phpbb_style->set_ext_dir_prefix('adm/');
|
$phpbb_style->set_ext_dir_prefix('adm/');
|
||||||
$phpbb_style->set_custom_style('admin', '../adm/style', array(), '');
|
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
||||||
$template->assign_var('T_ASSETS_PATH', '../assets');
|
$template->assign_var('T_ASSETS_PATH', '../assets');
|
||||||
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
|
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
|
||||||
|
|
||||||
$install = new module();
|
$install = new module();
|
||||||
|
|
||||||
|
@ -361,7 +363,7 @@ class module
|
||||||
}
|
}
|
||||||
|
|
||||||
define('HEADER_INC', true);
|
define('HEADER_INC', true);
|
||||||
global $template, $lang, $stage, $phpbb_root_path;
|
global $template, $lang, $stage, $phpbb_root_path, $phpbb_admin_path;
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_CHANGE' => $lang['CHANGE'],
|
'L_CHANGE' => $lang['CHANGE'],
|
||||||
|
@ -370,7 +372,7 @@ class module
|
||||||
'L_SELECT_LANG' => $lang['SELECT_LANG'],
|
'L_SELECT_LANG' => $lang['SELECT_LANG'],
|
||||||
'L_SKIP' => $lang['SKIP'],
|
'L_SKIP' => $lang['SKIP'],
|
||||||
'PAGE_TITLE' => $this->get_page_title(),
|
'PAGE_TITLE' => $this->get_page_title(),
|
||||||
'T_IMAGE_PATH' => $phpbb_root_path . 'adm/images/',
|
'T_IMAGE_PATH' => htmlspecialchars($phpbb_admin_path) . 'images/',
|
||||||
|
|
||||||
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
|
'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
|
||||||
'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
|
'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
|
||||||
|
@ -551,7 +553,7 @@ class module
|
||||||
*/
|
*/
|
||||||
function error($error, $line, $file, $skip = false)
|
function error($error, $line, $file, $skip = false)
|
||||||
{
|
{
|
||||||
global $lang, $db, $template;
|
global $lang, $db, $template, $phpbb_admin_path;
|
||||||
|
|
||||||
if ($skip)
|
if ($skip)
|
||||||
{
|
{
|
||||||
|
@ -573,7 +575,7 @@ class module
|
||||||
echo '<head>';
|
echo '<head>';
|
||||||
echo '<meta charset="utf-8">';
|
echo '<meta charset="utf-8">';
|
||||||
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
|
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
|
||||||
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
|
echo '<link href="' . htmlspecialchars($phpbb_admin_path) . 'style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
|
||||||
echo '</head>';
|
echo '</head>';
|
||||||
echo '<body id="errorpage">';
|
echo '<body id="errorpage">';
|
||||||
echo '<div id="wrap">';
|
echo '<div id="wrap">';
|
||||||
|
|
|
@ -1538,6 +1538,7 @@ class install_convert extends module
|
||||||
function finish_conversion()
|
function finish_conversion()
|
||||||
{
|
{
|
||||||
global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template;
|
global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template;
|
||||||
|
global $cache, $auth;
|
||||||
|
|
||||||
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
|
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
|
||||||
WHERE config_name = 'convert_progress'
|
WHERE config_name = 'convert_progress'
|
||||||
|
@ -1547,7 +1548,7 @@ class install_convert extends module
|
||||||
$db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
|
$db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
|
||||||
|
|
||||||
@unlink($phpbb_root_path . 'cache/data_global.' . $phpEx);
|
@unlink($phpbb_root_path . 'cache/data_global.' . $phpEx);
|
||||||
cache_moderators();
|
phpbb_cache_moderators($db, $cache, $auth);
|
||||||
|
|
||||||
// And finally, add a note to the log
|
// And finally, add a note to the log
|
||||||
add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']);
|
add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']);
|
||||||
|
|
|
@ -52,12 +52,13 @@ class install_install extends module
|
||||||
|
|
||||||
function main($mode, $sub)
|
function main($mode, $sub)
|
||||||
{
|
{
|
||||||
global $lang, $template, $language, $phpbb_root_path, $cache;
|
global $lang, $template, $language, $phpbb_root_path, $phpEx;
|
||||||
|
global $phpbb_container, $cache;
|
||||||
|
|
||||||
switch ($sub)
|
switch ($sub)
|
||||||
{
|
{
|
||||||
case 'intro':
|
case 'intro':
|
||||||
$cache->purge();
|
$phpbb_container->get('cache.driver')->purge();
|
||||||
|
|
||||||
$this->page_title = $lang['SUB_INTRO'];
|
$this->page_title = $lang['SUB_INTRO'];
|
||||||
|
|
||||||
|
@ -101,6 +102,12 @@ class install_install extends module
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'final':
|
case 'final':
|
||||||
|
// Create a normal container now
|
||||||
|
$phpbb_container = phpbb_create_default_container($phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
|
// Sets the global $cache variable
|
||||||
|
$cache = $phpbb_container->get('cache');
|
||||||
|
|
||||||
$this->build_search_index($mode, $sub);
|
$this->build_search_index($mode, $sub);
|
||||||
$this->add_modules($mode, $sub);
|
$this->add_modules($mode, $sub);
|
||||||
$this->add_language($mode, $sub);
|
$this->add_language($mode, $sub);
|
||||||
|
@ -1807,7 +1814,7 @@ class install_install extends module
|
||||||
*/
|
*/
|
||||||
function email_admin($mode, $sub)
|
function email_admin($mode, $sub)
|
||||||
{
|
{
|
||||||
global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpEx;
|
global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
$this->page_title = $lang['STAGE_FINAL'];
|
$this->page_title = $lang['STAGE_FINAL'];
|
||||||
|
|
||||||
|
@ -1854,7 +1861,7 @@ class install_install extends module
|
||||||
'TITLE' => $lang['INSTALL_CONGRATS'],
|
'TITLE' => $lang['INSTALL_CONGRATS'],
|
||||||
'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'),
|
'BODY' => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&language=' . $data['language']), '../docs/README.html'),
|
||||||
'L_SUBMIT' => $lang['INSTALL_LOGIN'],
|
'L_SUBMIT' => $lang['INSTALL_LOGIN'],
|
||||||
'U_ACTION' => append_sid($phpbb_root_path . 'adm/index.' . $phpEx, 'i=send_statistics&mode=send_statistics'),
|
'U_ACTION' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'i=send_statistics&mode=send_statistics'),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class install_update extends module
|
||||||
function main($mode, $sub)
|
function main($mode, $sub)
|
||||||
{
|
{
|
||||||
global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
|
global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
|
||||||
global $request;
|
global $request, $phpbb_admin_path, $phpbb_adm_relative_path;
|
||||||
|
|
||||||
$this->tpl_name = 'install_update';
|
$this->tpl_name = 'install_update';
|
||||||
$this->page_title = 'UPDATE_INSTALLATION';
|
$this->page_title = 'UPDATE_INSTALLATION';
|
||||||
|
@ -132,7 +132,7 @@ class install_update extends module
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set custom template again. ;)
|
// Set custom template again. ;)
|
||||||
$phpbb_style->set_custom_style('admin', '../adm/style', array(), '');
|
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_USER_LANG' => $user->lang['USER_LANG'],
|
'S_USER_LANG' => $user->lang['USER_LANG'],
|
||||||
|
@ -217,7 +217,7 @@ class install_update extends module
|
||||||
if ($this->test_update === false)
|
if ($this->test_update === false)
|
||||||
{
|
{
|
||||||
// Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present
|
// Got the updater template itself updated? If so, we are able to directly use it - but only if all three files are present
|
||||||
if (in_array('adm/style/install_update.html', $this->update_info['files']))
|
if (in_array($phpbb_adm_relative_path . 'style/install_update.html', $this->update_info['files']))
|
||||||
{
|
{
|
||||||
$this->tpl_name = '../../install/update/new/adm/style/install_update';
|
$this->tpl_name = '../../install/update/new/adm/style/install_update';
|
||||||
}
|
}
|
||||||
|
@ -494,6 +494,7 @@ class install_update extends module
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_FILE_CHECK' => true,
|
'S_FILE_CHECK' => true,
|
||||||
'S_ALL_UP_TO_DATE' => $all_up_to_date,
|
'S_ALL_UP_TO_DATE' => $all_up_to_date,
|
||||||
|
'L_ALL_FILES_UP_TO_DATE' => $user->lang('ALL_FILES_UP_TO_DATE', append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $phpbb_adm_relative_path . 'index.php%3Fi=send_statistics%26mode=send_statistics')),
|
||||||
'S_VERSION_UP_TO_DATE' => $up_to_date,
|
'S_VERSION_UP_TO_DATE' => $up_to_date,
|
||||||
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"),
|
'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"),
|
||||||
'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"),
|
'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"),
|
||||||
|
@ -1078,12 +1079,12 @@ class install_update extends module
|
||||||
*/
|
*/
|
||||||
function show_diff(&$update_list)
|
function show_diff(&$update_list)
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $template, $user;
|
global $phpbb_root_path, $template, $user, $phpbb_adm_relative_path;
|
||||||
|
|
||||||
$this->tpl_name = 'install_update_diff';
|
$this->tpl_name = 'install_update_diff';
|
||||||
|
|
||||||
// Got the diff template itself updated? If so, we are able to directly use it
|
// Got the diff template itself updated? If so, we are able to directly use it
|
||||||
if (in_array('adm/style/install_update_diff.html', $this->update_info['files']))
|
if (in_array($phpbb_adm_relative_path . 'style/install_update_diff.html', $this->update_info['files']))
|
||||||
{
|
{
|
||||||
$this->tpl_name = '../../install/update/new/adm/style/install_update_diff';
|
$this->tpl_name = '../../install/update/new/adm/style/install_update_diff';
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,7 +374,7 @@ $lang = array_merge($lang, array(
|
||||||
|
|
||||||
// Updater
|
// Updater
|
||||||
$lang = array_merge($lang, array(
|
$lang = array_merge($lang, array(
|
||||||
'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="../ucp.php?mode=login">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="../ucp.php?mode=login&redirect=adm/index.php%3Fi=send_statistics%26mode=send_statistics">Send statistics</a> module in your ACP.',
|
'ALL_FILES_UP_TO_DATE' => 'All files are up to date with the latest phpBB version. You should now <a href="%1$s">login to your board</a> and check if everything is working fine. Do not forget to delete, rename or move your install directory! Please send us updated information about your server and board configurations from the <a href="%2$s">Send statistics</a> module in your ACP.',
|
||||||
'ARCHIVE_FILE' => 'Source file within archive',
|
'ARCHIVE_FILE' => 'Source file within archive',
|
||||||
|
|
||||||
'BACK' => 'Back',
|
'BACK' => 'Back',
|
||||||
|
|
|
@ -649,7 +649,7 @@ switch ($mode)
|
||||||
'S_GROUP_OPTIONS' => $group_options,
|
'S_GROUP_OPTIONS' => $group_options,
|
||||||
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
|
'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && sizeof($profile_fields['row'])) ? true : false,
|
||||||
|
|
||||||
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_root_path}adm/index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
|
'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '',
|
||||||
'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '',
|
'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '',
|
||||||
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',
|
'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,4 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/timezone.js"></script>
|
|
||||||
<script type="text/javascript">phpbb_preselect_tz_select();</script>
|
|
||||||
|
|
||||||
<!-- INCLUDE overall_footer.html -->
|
<!-- INCLUDE overall_footer.html -->
|
||||||
|
|
|
@ -216,7 +216,7 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
$location_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
$location_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'adm/index':
|
case $phpbb_adm_relative_path . 'index':
|
||||||
$location = $user->lang['ACP'];
|
$location = $user->lang['ACP'];
|
||||||
$location_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
$location_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -17,7 +17,27 @@ PHP extensions
|
||||||
Unit tests use several PHP extensions that board code does not use. Currently
|
Unit tests use several PHP extensions that board code does not use. Currently
|
||||||
the following PHP extensions must be installed and enabled to run unit tests:
|
the following PHP extensions must be installed and enabled to run unit tests:
|
||||||
|
|
||||||
- ctype
|
- ctype (also a PHPUnit dependency)
|
||||||
|
- dom (PHPUnit dependency)
|
||||||
|
- json (also a phpBB dependency)
|
||||||
|
|
||||||
|
Some of the functionality in phpBB and/or the test suite uses additional
|
||||||
|
PHP extensions. If these extensions are not loaded, respective tests
|
||||||
|
will be skipped:
|
||||||
|
|
||||||
|
- apc (APC cache driver)
|
||||||
|
- bz2 (compress tests)
|
||||||
|
- interbase, pdo_firebird (Firebird database driver)
|
||||||
|
- mysql, pdo_mysql (MySQL database driver)
|
||||||
|
- mysqli, pdo_mysql (MySQLi database driver)
|
||||||
|
- pcntl (flock class)
|
||||||
|
- pdo (any database tests)
|
||||||
|
- pgsql, pdo_pgsql (PostgreSQL database driver)
|
||||||
|
- redis (https://github.com/nicolasff/phpredis, Redis cache driver)
|
||||||
|
- simplexml (any database tests)
|
||||||
|
- sqlite, pdo_sqlite (SQLite database driver, requires SQLite 2.x support
|
||||||
|
in pdo_sqlite)
|
||||||
|
- zlib (compress tests)
|
||||||
|
|
||||||
Database Tests
|
Database Tests
|
||||||
--------------
|
--------------
|
||||||
|
@ -44,7 +64,7 @@ to use in the environment as follows:
|
||||||
$ PHPBB_TEST_CONFIG=tests/test_config.php phpunit
|
$ PHPBB_TEST_CONFIG=tests/test_config.php phpunit
|
||||||
|
|
||||||
Alternatively you can specify parameters in the environment, so e.g. the
|
Alternatively you can specify parameters in the environment, so e.g. the
|
||||||
following will run phpunit with the same parameters as in the shown
|
following will run PHPUnit with the same parameters as in the shown
|
||||||
test_config.php file:
|
test_config.php file:
|
||||||
|
|
||||||
$ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \
|
$ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \
|
||||||
|
|
5
tests/cache/common_test_case.php
vendored
5
tests/cache/common_test_case.php
vendored
|
@ -64,9 +64,10 @@ abstract class phpbb_cache_common_test_case extends phpbb_database_test_case
|
||||||
|
|
||||||
public function test_cache_sql()
|
public function test_cache_sql()
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $db, $cache, $phpbb_root_path, $phpEx;
|
||||||
|
$config = new phpbb_config(array());
|
||||||
$db = $this->new_dbal();
|
$db = $this->new_dbal();
|
||||||
$cache = new phpbb_cache_service($this->driver);
|
$cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
$sql = "SELECT * FROM phpbb_config
|
$sql = "SELECT * FROM phpbb_config
|
||||||
WHERE config_name = 'foo'";
|
WHERE config_name = 'foo'";
|
||||||
|
|
5
tests/cache/null_driver_test.php
vendored
5
tests/cache/null_driver_test.php
vendored
|
@ -47,9 +47,10 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case
|
||||||
|
|
||||||
public function test_cache_sql()
|
public function test_cache_sql()
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $db, $cache, $phpbb_root_path, $phpEx;
|
||||||
|
$config = new phpbb_config(array());
|
||||||
$db = $this->new_dbal();
|
$db = $this->new_dbal();
|
||||||
$cache = new phpbb_cache_service($this->driver);
|
$cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
$sql = "SELECT * FROM phpbb_config
|
$sql = "SELECT * FROM phpbb_config
|
||||||
WHERE config_name = 'foo'";
|
WHERE config_name = 'foo'";
|
||||||
|
|
128
tests/functional/acp_permissions_test.php
Normal file
128
tests/functional/acp_permissions_test.php
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package testing
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group functional
|
||||||
|
*/
|
||||||
|
class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->login();
|
||||||
|
$this->admin_login();
|
||||||
|
$this->add_lang('acp/permissions');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_permissions_tab()
|
||||||
|
{
|
||||||
|
// Permissions tab
|
||||||
|
// XXX hardcoded id
|
||||||
|
$crawler = $this->request('GET', 'adm/index.php?i=16&sid=' . $this->sid);
|
||||||
|
$this->assert_response_success();
|
||||||
|
// these language strings are html
|
||||||
|
$this->assertContains($this->lang('ACP_PERMISSIONS_EXPLAIN'), $this->client->getResponse()->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_select_user()
|
||||||
|
{
|
||||||
|
// User permissions
|
||||||
|
$crawler = $this->request('GET', 'adm/index.php?i=acp_permissions&icat=16&mode=setting_user_global&sid=' . $this->sid);
|
||||||
|
$this->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('ACP_USERS_PERMISSIONS_EXPLAIN'), $this->client->getResponse()->getContent());
|
||||||
|
|
||||||
|
// Select admin
|
||||||
|
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
|
||||||
|
$data = array('username[0]' => 'admin');
|
||||||
|
$form->setValues($data);
|
||||||
|
$crawler = $this->client->submit($form);
|
||||||
|
$this->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function permissions_data()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
// description
|
||||||
|
// permission type
|
||||||
|
// permission name
|
||||||
|
// mode
|
||||||
|
// object name
|
||||||
|
// object id
|
||||||
|
array(
|
||||||
|
'user permission',
|
||||||
|
'u_',
|
||||||
|
'u_hideonline',
|
||||||
|
'setting_user_global',
|
||||||
|
'user_id',
|
||||||
|
2,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'moderator permission',
|
||||||
|
'm_',
|
||||||
|
'm_ban',
|
||||||
|
'setting_mod_global',
|
||||||
|
'group_id',
|
||||||
|
4,
|
||||||
|
),
|
||||||
|
/* Admin does not work yet, probably because founder can do everything
|
||||||
|
array(
|
||||||
|
'admin permission',
|
||||||
|
'a_',
|
||||||
|
'a_forum',
|
||||||
|
'setting_admin_global',
|
||||||
|
'group_id',
|
||||||
|
5,
|
||||||
|
),
|
||||||
|
*/
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider permissions_data
|
||||||
|
*/
|
||||||
|
public function test_change_permission($description, $permission_type, $permission, $mode, $object_name, $object_id)
|
||||||
|
{
|
||||||
|
// Get the form
|
||||||
|
$crawler = $this->request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=$mode&${object_name}[0]=$object_id&type=$permission_type&sid=" . $this->sid);
|
||||||
|
$this->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text());
|
||||||
|
|
||||||
|
// XXX globals for phpbb_auth, refactor it later
|
||||||
|
global $db, $cache;
|
||||||
|
$db = $this->get_db();
|
||||||
|
$cache = new phpbb_mock_null_cache;
|
||||||
|
|
||||||
|
$auth = new phpbb_auth;
|
||||||
|
// XXX hardcoded id
|
||||||
|
$user_data = $auth->obtain_user_data(2);
|
||||||
|
$auth->acl($user_data);
|
||||||
|
$this->assertEquals(1, $auth->acl_get($permission));
|
||||||
|
|
||||||
|
// Set u_hideonline to never
|
||||||
|
$form = $crawler->selectButton($this->lang('APPLY_PERMISSIONS'))->form();
|
||||||
|
// initially it should be a yes
|
||||||
|
$values = $form->getValues();
|
||||||
|
$this->assertEquals(1, $values["setting[$object_id][0][$permission]"]);
|
||||||
|
// set to never
|
||||||
|
$data = array("setting[$object_id][0][$permission]" => '0');
|
||||||
|
$form->setValues($data);
|
||||||
|
$crawler = $this->client->submit($form);
|
||||||
|
$this->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('AUTH_UPDATED'), $crawler->text());
|
||||||
|
|
||||||
|
// check acl again
|
||||||
|
$auth = new phpbb_auth;
|
||||||
|
// XXX hardcoded id
|
||||||
|
$user_data = $auth->obtain_user_data(2);
|
||||||
|
$auth->acl($user_data);
|
||||||
|
$this->assertEquals(0, $auth->acl_get($permission));
|
||||||
|
}
|
||||||
|
}
|
|
@ -49,4 +49,15 @@ class phpbb_functional_auth_test extends phpbb_functional_test_case
|
||||||
$this->assert_response_success();
|
$this->assert_response_success();
|
||||||
$this->assertContains($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
|
$this->assertContains($this->lang('REGISTER'), $crawler->filter('.navbar')->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_acp_login()
|
||||||
|
{
|
||||||
|
$this->login();
|
||||||
|
$this->admin_login();
|
||||||
|
|
||||||
|
// check that we are logged in
|
||||||
|
$crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid);
|
||||||
|
$this->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('ADMIN_PANEL'), $crawler->filter('h1')->text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
$config['rand_seed_last_update'] = time() + 600;
|
$config['rand_seed_last_update'] = time() + 600;
|
||||||
|
|
||||||
// Required by user_add
|
// Required by user_add
|
||||||
global $db, $cache, $phpbb_dispatcher;
|
global $db, $cache, $phpbb_dispatcher, $phpbb_container;
|
||||||
$db = $this->get_db();
|
$db = $this->get_db();
|
||||||
if (!function_exists('phpbb_mock_null_cache'))
|
if (!function_exists('phpbb_mock_null_cache'))
|
||||||
{
|
{
|
||||||
|
@ -270,6 +270,14 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
}
|
}
|
||||||
$cache = new phpbb_mock_null_cache;
|
$cache = new phpbb_mock_null_cache;
|
||||||
|
|
||||||
|
$cache_driver = new phpbb_cache_driver_null();
|
||||||
|
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||||
|
$phpbb_container
|
||||||
|
->expects($this->any())
|
||||||
|
->method('get')
|
||||||
|
->with('cache.driver')
|
||||||
|
->will($this->returnValue($cache_driver));
|
||||||
|
|
||||||
if (!function_exists('utf_clean_string'))
|
if (!function_exists('utf_clean_string'))
|
||||||
{
|
{
|
||||||
require_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php');
|
require_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php');
|
||||||
|
@ -323,7 +331,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
* Login to the ACP
|
* Login to the ACP
|
||||||
* You must run login() before calling this.
|
* You must run login() before calling this.
|
||||||
*/
|
*/
|
||||||
protected function admin_login()
|
protected function admin_login($username = 'admin')
|
||||||
{
|
{
|
||||||
$this->add_lang('acp/common');
|
$this->add_lang('acp/common');
|
||||||
|
|
||||||
|
@ -343,7 +351,9 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
{
|
{
|
||||||
if (strpos($field, 'password_') === 0)
|
if (strpos($field, 'password_') === 0)
|
||||||
{
|
{
|
||||||
$login = $this->client->submit($form, array('username' => 'admin', $field => 'admin'));
|
$crawler = $this->client->submit($form, array('username' => $username, $field => $username));
|
||||||
|
$this->assert_response_success();
|
||||||
|
$this->assertContains($this->lang('LOGIN_ADMIN_SUCCESS'), $crawler->filter('html')->text());
|
||||||
|
|
||||||
$cookies = $this->cookieJar->all();
|
$cookies = $this->cookieJar->all();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue