mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-19 06:51:33 +02:00
Merge remote-tracking branch 'remotes/phpbb/develop' into feature/softdelete-merge-develop
# By Oleg Pudeyev (45) and others # Via Oleg Pudeyev (42) and others * remotes/phpbb/develop: (289 commits) [ticket/10865] Use code tags for install/database_update.php. [ticket/10865] Should have been a slash. [ticket/10780] Use L_COLON on LDAP page. [ticket/10780] Use L_COLON on search backend ACP pages. [ticket/10780] Use L_COLON for "download all attachments". [ticket/10780] Use colon from language in ucp_pm_compose.php where possible. [ticket/10780] Replace colons in phpBB/adm/style/acp_ext_details.html. [ticket/10780] Replace colon usage in adm template output with {L_COLON} [ticket/10780] Replace colon usage in template output with {L_COLON} [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [develop-olympus] [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [ticket/10172] Show prosilver birthday list even if there are no birthdays. [ticket/11050] make all properties protected in all search backends [ticket/11050] get_common_words() returns empty array for sphinx [ticket/11050] fix tidied search query docblock language [ticket/11050] fix min/max length docblock language [ticket/11050] multi sentences separated by period in docblocks [ticket/11050] fix separated spelling in docblock [ticket/11050] fix split words doc block language [ticket/11050] remove class word from docblocks ... Conflicts: phpBB/install/database_update.php phpBB/install/schemas/mssql_schema.sql phpBB/language/en/acp/permissions_phpbb.php phpBB/styles/prosilver/template/posting_editor.html
This commit is contained in:
@@ -1163,7 +1163,7 @@ class acp_attachments
|
||||
$template->assign_vars(array(
|
||||
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
|
||||
'U_ACTION' => $this->u_action,)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
// Make sure $start is set to the last page if it exceeds the amount
|
||||
@@ -1224,7 +1224,7 @@ class acp_attachments
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start);
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TOTAL_FILES' => $num_files,
|
||||
'TOTAL_SIZE' => get_formatted_filesize($total_size),
|
||||
|
@@ -97,7 +97,7 @@ class acp_ban
|
||||
break;
|
||||
}
|
||||
|
||||
$this->display_ban_options($mode);
|
||||
self::display_ban_options($mode);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_TITLE' => $this->page_title,
|
||||
@@ -118,7 +118,7 @@ class acp_ban
|
||||
/**
|
||||
* Display ban options
|
||||
*/
|
||||
function display_ban_options($mode)
|
||||
static public function display_ban_options($mode)
|
||||
{
|
||||
global $user, $db, $template;
|
||||
|
||||
|
@@ -53,6 +53,8 @@ class acp_board
|
||||
'legend1' => 'ACP_BOARD_SETTINGS',
|
||||
'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
|
||||
'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
|
||||
'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
||||
'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true),
|
||||
'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
|
||||
'board_disable_msg' => false,
|
||||
'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
|
||||
|
@@ -29,7 +29,8 @@ class acp_captcha
|
||||
$user->add_lang('acp/board');
|
||||
|
||||
include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
|
||||
$captchas = phpbb_captcha_factory::get_captcha_types();
|
||||
$factory = new phpbb_captcha_factory();
|
||||
$captchas = $factory->get_captcha_types();
|
||||
|
||||
$selected = request_var('select_captcha', $config['captcha_plugin']);
|
||||
$selected = (isset($captchas['available'][$selected]) || isset($captchas['unavailable'][$selected])) ? $selected : $config['captcha_plugin'];
|
||||
|
303
phpBB/includes/acp/acp_extensions.php
Normal file
303
phpBB/includes/acp/acp_extensions.php
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package acp
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @package acp
|
||||
*/
|
||||
class acp_extensions
|
||||
{
|
||||
var $u_action;
|
||||
|
||||
private $db;
|
||||
private $config;
|
||||
private $template;
|
||||
private $user;
|
||||
|
||||
function main()
|
||||
{
|
||||
// Start the page
|
||||
global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->db = $db;
|
||||
$this->config = $config;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
|
||||
$user->add_lang(array('install', 'acp/extensions'));
|
||||
|
||||
$this->page_title = 'ACP_EXTENSIONS';
|
||||
|
||||
$action = $request->variable('action', 'list');
|
||||
$ext_name = $request->variable('ext_name', '');
|
||||
|
||||
// Cancel action
|
||||
if ($request->is_set_post('cancel'))
|
||||
{
|
||||
$action = 'list';
|
||||
$ext_name = '';
|
||||
}
|
||||
|
||||
// If they've specified an extension, let's load the metadata manager and validate it.
|
||||
if ($ext_name)
|
||||
{
|
||||
$md_manager = new phpbb_extension_metadata_manager($ext_name, $db, $phpbb_extension_manager, $phpbb_root_path, ".$phpEx", $template, $config);
|
||||
|
||||
try
|
||||
{
|
||||
$md_manager->get_metadata('all');
|
||||
}
|
||||
catch(phpbb_extension_exception $e)
|
||||
{
|
||||
trigger_error($e);
|
||||
}
|
||||
}
|
||||
|
||||
// What are we doing?
|
||||
switch ($action)
|
||||
{
|
||||
case 'list':
|
||||
default:
|
||||
$this->list_enabled_exts($phpbb_extension_manager);
|
||||
$this->list_disabled_exts($phpbb_extension_manager);
|
||||
$this->list_available_exts($phpbb_extension_manager);
|
||||
|
||||
$this->tpl_name = 'acp_ext_list';
|
||||
break;
|
||||
|
||||
case 'enable_pre':
|
||||
if (!$md_manager->validate_enable())
|
||||
{
|
||||
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
if ($phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_enable';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PRE' => true,
|
||||
'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name),
|
||||
));
|
||||
break;
|
||||
|
||||
case 'enable':
|
||||
if (!$md_manager->validate_enable())
|
||||
{
|
||||
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action));
|
||||
}
|
||||
|
||||
if ($phpbb_extension_manager->enable_step($ext_name))
|
||||
{
|
||||
$template->assign_var('S_NEXT_STEP', true);
|
||||
|
||||
meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name));
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_enable';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_RETURN' => $this->u_action . '&action=list',
|
||||
));
|
||||
break;
|
||||
|
||||
case 'disable_pre':
|
||||
if (!$phpbb_extension_manager->enabled($ext_name))
|
||||
{
|
||||
redirect($this->u_action);
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_disable';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PRE' => true,
|
||||
'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name),
|
||||
));
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
if ($phpbb_extension_manager->disable_step($ext_name))
|
||||
{
|
||||
$template->assign_var('S_NEXT_STEP', true);
|
||||
|
||||
meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name));
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_disable';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_RETURN' => $this->u_action . '&action=list',
|
||||
));
|
||||
break;
|
||||
|
||||
case 'purge_pre':
|
||||
$this->tpl_name = 'acp_ext_purge';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PRE' => true,
|
||||
'U_PURGE' => $this->u_action . '&action=purge&ext_name=' . urlencode($ext_name),
|
||||
));
|
||||
break;
|
||||
|
||||
case 'purge':
|
||||
if ($phpbb_extension_manager->purge_step($ext_name))
|
||||
{
|
||||
$template->assign_var('S_NEXT_STEP', true);
|
||||
|
||||
meta_refresh(0, $this->u_action . '&action=purge&ext_name=' . urlencode($ext_name));
|
||||
}
|
||||
|
||||
$this->tpl_name = 'acp_ext_purge';
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_RETURN' => $this->u_action . '&action=list',
|
||||
));
|
||||
break;
|
||||
|
||||
case 'details':
|
||||
// Output it to the template
|
||||
$md_manager->output_template_data();
|
||||
|
||||
$template->assign_var('U_BACK', $this->u_action . '&action=list');
|
||||
|
||||
$this->tpl_name = 'acp_ext_details';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all the enabled extensions and dumps to the template
|
||||
*
|
||||
* @param $phpbb_extension_manager An instance of the extension manager
|
||||
* @return null
|
||||
*/
|
||||
public function list_enabled_exts(phpbb_extension_manager $phpbb_extension_manager)
|
||||
{
|
||||
foreach ($phpbb_extension_manager->all_enabled() as $name => $location)
|
||||
{
|
||||
$md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template);
|
||||
|
||||
try
|
||||
{
|
||||
$this->template->assign_block_vars('enabled', array(
|
||||
'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'),
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name),
|
||||
));
|
||||
|
||||
$this->output_actions('enabled', array(
|
||||
'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name),
|
||||
'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name),
|
||||
));
|
||||
}
|
||||
catch(phpbb_extension_exception $e)
|
||||
{
|
||||
$this->template->assign_block_vars('disabled', array(
|
||||
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all the disabled extensions and dumps to the template
|
||||
*
|
||||
* @param $phpbb_extension_manager An instance of the extension manager
|
||||
* @return null
|
||||
*/
|
||||
public function list_disabled_exts(phpbb_extension_manager $phpbb_extension_manager)
|
||||
{
|
||||
foreach ($phpbb_extension_manager->all_disabled() as $name => $location)
|
||||
{
|
||||
$md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template);
|
||||
|
||||
try
|
||||
{
|
||||
$this->template->assign_block_vars('disabled', array(
|
||||
'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'),
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name),
|
||||
));
|
||||
|
||||
$this->output_actions('disabled', array(
|
||||
'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name),
|
||||
'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name),
|
||||
));
|
||||
}
|
||||
catch(phpbb_extension_exception $e)
|
||||
{
|
||||
$this->template->assign_block_vars('disabled', array(
|
||||
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all the available extensions and dumps to the template
|
||||
*
|
||||
* @param $phpbb_extension_manager An instance of the extension manager
|
||||
* @return null
|
||||
*/
|
||||
public function list_available_exts(phpbb_extension_manager $phpbb_extension_manager)
|
||||
{
|
||||
$uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured());
|
||||
|
||||
foreach ($uninstalled as $name => $location)
|
||||
{
|
||||
$md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template);
|
||||
|
||||
try
|
||||
{
|
||||
$this->template->assign_block_vars('disabled', array(
|
||||
'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'),
|
||||
|
||||
'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name),
|
||||
));
|
||||
|
||||
$this->output_actions('disabled', array(
|
||||
'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name),
|
||||
));
|
||||
}
|
||||
catch(phpbb_extension_exception $e)
|
||||
{
|
||||
$this->template->assign_block_vars('disabled', array(
|
||||
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output actions to a block
|
||||
*
|
||||
* @param string $block
|
||||
* @param array $actions
|
||||
*/
|
||||
private function output_actions($block, $actions)
|
||||
{
|
||||
foreach ($actions as $lang => $url)
|
||||
{
|
||||
$this->template->assign_block_vars($block . '.actions', array(
|
||||
'L_ACTION' => $this->user->lang($lang),
|
||||
'U_ACTION' => $url,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
@@ -683,8 +683,8 @@ class acp_groups
|
||||
}
|
||||
|
||||
$base_url = $this->u_action . "&action=$action&g=$group_id";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
|
||||
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_LIST' => true,
|
||||
'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false,
|
||||
|
@@ -927,8 +927,8 @@ class acp_icons
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $item_count, $config['smilies_per_page'], $pagination_start);
|
||||
|
||||
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $item_count, $config['smilies_per_page'], $pagination_start);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -155,10 +155,7 @@ class acp_inactive
|
||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
foreach ($mark as $user_id)
|
||||
{
|
||||
user_delete('retain', $user_id, $user_affected[$user_id]);
|
||||
}
|
||||
user_delete('retain', $mark, true);
|
||||
|
||||
add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected));
|
||||
|
||||
@@ -289,8 +286,8 @@ class acp_inactive
|
||||
}
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param&users_per_page=$per_page";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
|
||||
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_INACTIVE_USERS' => true,
|
||||
'S_INACTIVE_OPTIONS' => build_select($option_ary),
|
||||
@@ -299,7 +296,6 @@ class acp_inactive
|
||||
'S_SORT_KEY' => $s_sort_key,
|
||||
'S_SORT_DIR' => $s_sort_dir,
|
||||
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $inactive_count, $per_page, $start),
|
||||
|
||||
'USERS_PER_PAGE' => $per_page,
|
||||
|
||||
'U_ACTION' => $this->u_action . "&$u_sort_param&users_per_page=$per_page&start=$start",
|
||||
|
@@ -100,11 +100,25 @@ class acp_language
|
||||
switch ($method)
|
||||
{
|
||||
case 'ftp':
|
||||
$transfer = new ftp(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
|
||||
$transfer = new ftp(
|
||||
request_var('host', ''),
|
||||
request_var('username', ''),
|
||||
htmlspecialchars_decode($request->untrimmed_variable('password', '')),
|
||||
request_var('root_path', ''),
|
||||
request_var('port', ''),
|
||||
request_var('timeout', '')
|
||||
);
|
||||
break;
|
||||
|
||||
case 'ftp_fsock':
|
||||
$transfer = new ftp_fsock(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
|
||||
$transfer = new ftp_fsock(
|
||||
request_var('host', ''),
|
||||
request_var('username', ''),
|
||||
htmlspecialchars_decode($request->untrimmed_variable('password', '')),
|
||||
request_var('root_path', ''),
|
||||
request_var('port', ''),
|
||||
request_var('timeout', '')
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -404,7 +418,14 @@ class acp_language
|
||||
trigger_error($user->lang['INVALID_UPLOAD_METHOD'], E_USER_ERROR);
|
||||
}
|
||||
|
||||
$transfer = new $method(request_var('host', ''), request_var('username', ''), request_var('password', ''), request_var('root_path', ''), request_var('port', ''), request_var('timeout', ''));
|
||||
$transfer = new $method(
|
||||
request_var('host', ''),
|
||||
request_var('username', ''),
|
||||
htmlspecialchars_decode($request->untrimmed_variable('password', '')),
|
||||
request_var('root_path', ''),
|
||||
request_var('port', ''),
|
||||
request_var('timeout', '')
|
||||
);
|
||||
|
||||
if (($result = $transfer->open_session()) !== true)
|
||||
{
|
||||
|
@@ -131,7 +131,7 @@ class acp_logs
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_TITLE' => $l_title,
|
||||
'L_EXPLAIN' => $l_title_explain,
|
||||
|
@@ -426,7 +426,7 @@ class acp_main
|
||||
// Version check
|
||||
$user->add_lang('install');
|
||||
|
||||
if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.2', '<'))
|
||||
if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.3', '<'))
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_PHP_VERSION_OLD' => true,
|
||||
|
@@ -242,8 +242,8 @@ class acp_prune
|
||||
if (confirm_box(true))
|
||||
{
|
||||
$user_ids = $usernames = array();
|
||||
$this->get_prune_users($user_ids, $usernames);
|
||||
|
||||
$this->get_prune_users($user_ids, $usernames);
|
||||
if (sizeof($user_ids))
|
||||
{
|
||||
if ($action == 'deactivate')
|
||||
@@ -255,19 +255,13 @@ class acp_prune
|
||||
{
|
||||
if ($deleteposts)
|
||||
{
|
||||
foreach ($user_ids as $user_id)
|
||||
{
|
||||
user_delete('remove', $user_id);
|
||||
}
|
||||
user_delete('remove', $user_ids);
|
||||
|
||||
$l_log = 'LOG_PRUNE_USER_DEL_DEL';
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($user_ids as $user_id)
|
||||
{
|
||||
user_delete('retain', $user_id, $usernames[$user_id]);
|
||||
}
|
||||
user_delete('retain', $user_ids, true);
|
||||
|
||||
$l_log = 'LOG_PRUNE_USER_DEL_ANON';
|
||||
}
|
||||
@@ -299,6 +293,7 @@ class acp_prune
|
||||
{
|
||||
$template->assign_block_vars('users', array(
|
||||
'USERNAME' => $usernames[$user_id],
|
||||
'USER_ID' => $user_id,
|
||||
'U_PROFILE' => append_sid($phpbb_root_path . 'memberlist.' . $phpEx, 'mode=viewprofile&u=' . $user_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) : '',
|
||||
));
|
||||
@@ -314,17 +309,7 @@ class acp_prune
|
||||
'mode' => $mode,
|
||||
'prune' => 1,
|
||||
|
||||
'users' => utf8_normalize_nfc(request_var('users', '', true)),
|
||||
'username' => utf8_normalize_nfc(request_var('username', '', true)),
|
||||
'email' => request_var('email', ''),
|
||||
'joined_select' => request_var('joined_select', ''),
|
||||
'joined' => request_var('joined', ''),
|
||||
'active_select' => request_var('active_select', ''),
|
||||
'active' => request_var('active', ''),
|
||||
'count_select' => request_var('count_select', ''),
|
||||
'count' => request_var('count', ''),
|
||||
'deleteposts' => request_var('deleteposts', 0),
|
||||
|
||||
'action' => request_var('action', ''),
|
||||
)), 'confirm_body_prune.html');
|
||||
}
|
||||
@@ -340,22 +325,29 @@ class acp_prune
|
||||
}
|
||||
|
||||
$find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']);
|
||||
$s_find_join_time = '';
|
||||
foreach ($find_time as $key => $value)
|
||||
{
|
||||
$s_find_join_time .= '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
|
||||
$s_find_active_time = '';
|
||||
foreach ($find_time as $key => $value)
|
||||
{
|
||||
$s_find_active_time .= '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
|
||||
$s_group_list = '';
|
||||
$sql = 'SELECT group_id, group_name
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_type <> ' . GROUP_SPECIAL . '
|
||||
ORDER BY group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$s_group_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</select>';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_ACTION' => $this->u_action,
|
||||
'S_JOINED_OPTIONS' => $s_find_join_time,
|
||||
'S_ACTIVE_OPTIONS' => $s_find_active_time,
|
||||
'S_GROUP_LIST' => $s_group_list,
|
||||
'S_COUNT_OPTIONS' => $s_find_count,
|
||||
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_prune&field=users'),
|
||||
));
|
||||
@@ -368,42 +360,80 @@ class acp_prune
|
||||
{
|
||||
global $user, $db;
|
||||
|
||||
$users = utf8_normalize_nfc(request_var('users', '', true));
|
||||
|
||||
if ($users)
|
||||
$users_by_name = request_var('users', '', true);
|
||||
$users_by_id = request_var('user_ids', array(0));
|
||||
$group_id = request_var('group_id', 0);
|
||||
$posts_on_queue = request_var('posts_on_queue', 0);
|
||||
|
||||
if ($users_by_name)
|
||||
{
|
||||
$users = explode("\n", $users);
|
||||
$users = explode("\n", $users_by_name);
|
||||
$where_sql = ' AND ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', $users));
|
||||
}
|
||||
else if (!empty($users_by_id))
|
||||
{
|
||||
$user_ids = $users_by_id;
|
||||
user_get_id_name($user_ids, $usernames);
|
||||
|
||||
$where_sql = ' AND ' . $db->sql_in_set('user_id', $user_ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = utf8_normalize_nfc(request_var('username', '', true));
|
||||
$username = request_var('username', '', true);
|
||||
$email = request_var('email', '');
|
||||
$website = request_var('website', '');
|
||||
|
||||
$joined_select = request_var('joined_select', 'lt');
|
||||
$active_select = request_var('active_select', 'lt');
|
||||
$count_select = request_var('count_select', 'eq');
|
||||
$joined = request_var('joined', '');
|
||||
$queue_select = request_var('queue_select', 'gt');
|
||||
$joined_before = request_var('joined_before', '');
|
||||
$joined_after = request_var('joined_after', '');
|
||||
$active = request_var('active', '');
|
||||
|
||||
$active = ($active) ? explode('-', $active) : array();
|
||||
$joined = ($joined) ? explode('-', $joined) : array();
|
||||
$count = request_var('count', 0);
|
||||
|
||||
if ((sizeof($active) && sizeof($active) != 3) || (sizeof($joined) && sizeof($joined) != 3))
|
||||
$active = ($active) ? explode('-', $active) : array();
|
||||
$joined_before = ($joined_before) ? explode('-', $joined_before) : array();
|
||||
$joined_after = ($joined_after) ? explode('-', $joined_after) : array();
|
||||
|
||||
// calculate the conditions required by the join time criteria
|
||||
$joined_sql = '';
|
||||
if (!empty($joined_before) && !empty($joined_after))
|
||||
{
|
||||
// if the two entered dates are equal, we need to adjust
|
||||
// so that our time range is a full day instead of 1 second
|
||||
if ($joined_after == $joined_before)
|
||||
{
|
||||
$joined_after[2] += 1;
|
||||
}
|
||||
|
||||
$joined_sql = ' AND user_regdate BETWEEN ' . gmmktime(0, 0, 0, (int) $joined_after[1], (int) $joined_after[2], (int) $joined_after[0]) .
|
||||
' AND ' . gmmktime(0, 0, 0, (int) $joined_before[1], (int) $joined_before[2], (int) $joined_before[0]);
|
||||
}
|
||||
else if (empty($joined_before) && !empty($joined_after))
|
||||
{
|
||||
$joined_sql = ' AND user_regdate > ' . gmmktime(0, 0, 0, (int) $joined_after[1], (int) $joined_after[2], (int) $joined_after[0]);
|
||||
}
|
||||
else if (empty($joined_after) && !empty($joined_before))
|
||||
{
|
||||
$joined_sql = ' AND user_regdate < ' . gmmktime(0, 0, 0, (int) $joined_before[1], (int) $joined_before[2], (int) $joined_before[0]);
|
||||
}
|
||||
// implicit else when both arrays are empty do nothing
|
||||
|
||||
if ((sizeof($active) && sizeof($active) != 3) || (sizeof($joined_before) && sizeof($joined_before) != 3) || (sizeof($joined_after) && sizeof($joined_after) != 3))
|
||||
{
|
||||
trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
$count = request_var('count', '');
|
||||
|
||||
$key_match = array('lt' => '<', 'gt' => '>', 'eq' => '=');
|
||||
$sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit');
|
||||
|
||||
$where_sql = '';
|
||||
$where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
|
||||
$where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
|
||||
$where_sql .= (sizeof($joined)) ? " AND user_regdate " . $key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]) : '';
|
||||
$where_sql .= ($count !== '') ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : '';
|
||||
$where_sql .= ($website) ? ' AND user_website ' . $db->sql_like_expression(str_replace('*', $db->any_char, $website)) . ' ' : '';
|
||||
$where_sql .= $joined_sql;
|
||||
$where_sql .= ($count) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : '';
|
||||
|
||||
// First handle pruning of users who never logged in, last active date is 0000-00-00
|
||||
if (sizeof($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0)
|
||||
@@ -446,7 +476,6 @@ class acp_prune
|
||||
$where_sql";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$where_sql = '';
|
||||
$user_ids = $usernames = array();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
@@ -459,5 +488,53 @@ class acp_prune
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if ($group_id)
|
||||
{
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USER_GROUP_TABLE . '
|
||||
WHERE group_id = ' . (int) $group_id . '
|
||||
AND user_pending = 0
|
||||
AND ' . $db->sql_in_set('user_id', $user_ids, false, true);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
// we're performing an intersection operation, so all the relevant users
|
||||
// come from this most recent query (which was limited to the results of the
|
||||
// previous query)
|
||||
$user_ids = $usernames = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$user_ids[] = $row['poster_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// only get usernames if they are needed (not part of some later query)
|
||||
if (!$posts_on_queue)
|
||||
{
|
||||
// this is an additional query aginst the users table
|
||||
user_get_id_name($user_ids, $usernames);
|
||||
}
|
||||
}
|
||||
|
||||
if ($posts_on_queue)
|
||||
{
|
||||
$sql = 'SELECT poster_id, COUNT(post_id) AS queue_posts
|
||||
FROM ' . POSTS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('poster_id', $user_ids, false, true) . '
|
||||
GROUP BY poster_id
|
||||
HAVING queue_posts ' . $key_match[$queue_select] . ' ' . $posts_on_queue;
|
||||
$result = $db->sql_query($result);
|
||||
|
||||
// same intersection logic as the above group ID portion
|
||||
$user_ids = $usernames = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$user_ids[] = $row['poster_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// do an additional query to get the correct set of usernames
|
||||
user_get_id_name($user_ids, $usernames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ class acp_users
|
||||
{
|
||||
global $config, $db, $user, $auth, $template, $cache;
|
||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
|
||||
global $phpbb_dispatcher;
|
||||
global $phpbb_dispatcher, $request;
|
||||
|
||||
$user->add_lang(array('posting', 'ucp', 'acp/users'));
|
||||
$this->tpl_name = 'acp_users';
|
||||
@@ -772,8 +772,8 @@ class acp_users
|
||||
'username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)),
|
||||
'user_founder' => request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0),
|
||||
'email' => strtolower(request_var('user_email', $user_row['user_email'])),
|
||||
'new_password' => request_var('new_password', '', true),
|
||||
'password_confirm' => request_var('password_confirm', '', true),
|
||||
'new_password' => $request->variable('new_password', '', true),
|
||||
'password_confirm' => $request->variable('password_confirm', '', true),
|
||||
);
|
||||
|
||||
// Validation data - we do not check the password complexity setting here
|
||||
@@ -1161,7 +1161,7 @@ class acp_users
|
||||
|
||||
$base_url = $this->u_action . "&u=$user_id&$u_sort_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_FEEDBACK' => true,
|
||||
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start),
|
||||
@@ -2077,7 +2077,7 @@ class acp_users
|
||||
|
||||
$base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
|
||||
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_ATTACHMENTS' => true,
|
||||
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start),
|
||||
|
34
phpBB/includes/acp/info/acp_extensions.php
Normal file
34
phpBB/includes/acp/info/acp_extensions.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package acp
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package module_install
|
||||
*/
|
||||
class acp_extensions_info
|
||||
{
|
||||
function module()
|
||||
{
|
||||
return array(
|
||||
'filename' => 'acp_extensions',
|
||||
'title' => 'ACP_EXTENSIONS',
|
||||
'version' => '1.0.0',
|
||||
'modes' => array(
|
||||
'main' => array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_GENERAL_TASKS')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
}
|
||||
|
||||
function uninstall()
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user