aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r--phpBB/includes/acp/acp_attachments.php22
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php105
-rw-r--r--phpBB/includes/acp/acp_extensions.php10
-rw-r--r--phpBB/includes/acp/acp_groups.php5
-rw-r--r--phpBB/includes/acp/acp_icons.php16
-rw-r--r--phpBB/includes/acp/acp_inactive.php7
-rw-r--r--phpBB/includes/acp/acp_logs.php7
-rw-r--r--phpBB/includes/acp/acp_main.php16
-rw-r--r--phpBB/includes/acp/acp_modules.php8
-rw-r--r--phpBB/includes/acp/acp_permission_roles.php47
-rw-r--r--phpBB/includes/acp/acp_profile.php56
-rw-r--r--phpBB/includes/acp/acp_reasons.php25
-rw-r--r--phpBB/includes/acp/acp_users.php10
13 files changed, 241 insertions, 93 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 2282863746..e710260b35 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -25,7 +25,7 @@ class acp_attachments
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache;
+ global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
@@ -1166,10 +1166,9 @@ class acp_attachments
}
// Make sure $start is set to the last page if it exceeds the amount
- if ($start < 0 || $start > $num_files)
- {
- $start = ($start < 0) ? 0 : floor(($num_files - 1) / $attachments_per_page) * $attachments_per_page;
- }
+
+ $pagination = $phpbb_container->get('pagination');
+ $start = $pagination->validate_start($start, $attachments_per_page, $num_files);
// If the user is trying to reach the second half of the attachments list, fetch it starting from the end
$store_reverse = false;
@@ -1179,15 +1178,11 @@ class acp_attachments
{
$store_reverse = true;
- if ($start + $attachments_per_page > $num_files)
- {
- $sql_limit = min($attachments_per_page, max(1, $num_files - $start));
- }
-
// Select the sort order. Add time sort anchor for non-time sorting cases
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : '';
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor;
- $sql_start = max(0, $num_files - $sql_limit - $start);
+ $sql_limit = $pagination->reverse_limit($start, $sql_limit, $num_files);
+ $sql_start = $pagination->reverse_start($start, $sql_limit, $num_files);
}
else
{
@@ -1195,7 +1190,6 @@ class acp_attachments
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : '';
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor;
$sql_start = $start;
-
}
$attachments_list = array();
@@ -1222,13 +1216,13 @@ class acp_attachments
$db->sql_freeresult($result);
$base_url = $this->u_action . "&amp;$u_sort_param";
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start);
+ $pagination->generate_template_pagination($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),
- 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_files, $attachments_per_page, $start),
+ 'S_ON_PAGE' => $pagination->on_page($base_url, $num_files, $attachments_per_page, $start),
'S_LIMIT_DAYS' => $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir)
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 575ac84012..84382b6276 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -24,7 +24,7 @@ class acp_bbcodes
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache, $request;
+ global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@@ -96,7 +96,7 @@ class acp_bbcodes
case 'edit':
case 'add':
- $template->assign_vars(array(
+ $tpl_ary = array(
'S_EDIT_BBCODE' => true,
'U_BACK' => $this->u_action,
'U_ACTION' => $this->u_action . '&amp;action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&amp;bbcode=$bbcode_id" : ''),
@@ -105,10 +105,27 @@ class acp_bbcodes
'BBCODE_MATCH' => $bbcode_match,
'BBCODE_TPL' => $bbcode_tpl,
'BBCODE_HELPLINE' => $bbcode_helpline,
- 'DISPLAY_ON_POSTING' => $display_on_posting)
+ 'DISPLAY_ON_POSTING' => $display_on_posting,
);
$bbcode_tokens = array('TEXT', 'SIMPLETEXT', 'INTTEXT', 'IDENTIFIER', 'NUMBER', 'EMAIL', 'URL', 'LOCAL_URL', 'RELATIVE_URL', 'COLOR');
+
+ /**
+ * Modify custom bbcode template data before we display the add/edit form
+ *
+ * @event core.acp_bbcodes_edit_add
+ * @var string action Type of the action: add|edit
+ * @var array tpl_ary Array with custom bbcode add/edit data
+ * @var int bbcode_id When editing: the bbcode id,
+ * when creating: 0
+ * @var array bbcode_tokens Array of bbcode tokens
+ * @since 3.1.0-a3
+ */
+ $vars = array('action', 'tpl_ary', 'bbcode_id', 'bbcode_tokens');
+ extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_edit_add', compact($vars)));
+
+ $template->assign_vars($tpl_ary);
+
foreach ($bbcode_tokens as $token)
{
$template->assign_block_vars('token', array(
@@ -124,6 +141,27 @@ class acp_bbcodes
case 'modify':
case 'create':
+ $sql_ary = $hidden_fields = array();
+
+ /**
+ * Modify custom bbcode data before the modify/create action
+ *
+ * @event core.acp_bbcodes_modify_create
+ * @var string action Type of the action: modify|create
+ * @var array sql_ary Array with new bbcode data
+ * @var int bbcode_id When editing: the bbcode id,
+ * when creating: 0
+ * @var bool display_on_posting Display bbcode on posting form
+ * @var string bbcode_match The bbcode usage string to match
+ * @var string bbcode_tpl The bbcode HTML replacement string
+ * @var string bbcode_helpline The bbcode help line string
+ * @var array hidden_fields Array of hidden fields for use when
+ * submitting form when $warn_text is true
+ * @since 3.1.0-a3
+ */
+ $vars = array('action', 'sql_ary', 'bbcode_id', 'display_on_posting', 'bbcode_match', 'bbcode_tpl', 'bbcode_helpline', 'hidden_fields');
+ extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars)));
+
$warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl);
if (!$warn_text || confirm_box(true))
{
@@ -178,7 +216,7 @@ class acp_bbcodes
trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
}
- $sql_ary = array(
+ $sql_ary = array_merge($sql_ary, array(
'bbcode_tag' => $data['bbcode_tag'],
'bbcode_match' => $bbcode_match,
'bbcode_tpl' => $bbcode_tpl,
@@ -188,7 +226,7 @@ class acp_bbcodes
'first_pass_replace' => $data['first_pass_replace'],
'second_pass_match' => $data['second_pass_match'],
'second_pass_replace' => $data['second_pass_replace']
- );
+ ));
if ($action == 'create')
{
@@ -244,14 +282,14 @@ class acp_bbcodes
}
else
{
- confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array(
+ confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array_merge($hidden_fields, array(
'action' => $action,
'bbcode' => $bbcode_id,
'bbcode_match' => $bbcode_match,
'bbcode_tpl' => htmlspecialchars($bbcode_tpl),
'bbcode_helpline' => $bbcode_helpline,
'display_on_posting' => $display_on_posting,
- ))
+ )))
, 'confirm_bbcode.html');
}
@@ -300,22 +338,57 @@ class acp_bbcodes
break;
}
- $template->assign_vars(array(
- 'U_ACTION' => $this->u_action . '&amp;action=add')
+ $u_action = $this->u_action;
+
+ $template_data = array(
+ 'U_ACTION' => $this->u_action . '&amp;action=add',
+ );
+
+ $sql_ary = array(
+ 'SELECT' => 'b.*',
+ 'FROM' => array(BBCODES_TABLE => 'b'),
+ 'ORDER_BY' => 'b.bbcode_tag',
);
- $sql = 'SELECT *
- FROM ' . BBCODES_TABLE . '
- ORDER BY bbcode_tag';
- $result = $db->sql_query($sql);
+ /**
+ * Modify custom bbcode template data before we display the form
+ *
+ * @event core.acp_bbcodes_display_form
+ * @var string action Type of the action: modify|create
+ * @var string sql_ary The SQL array to get custom bbcode data
+ * @var array template_data Array with form template data
+ * @var string u_action The u_action link
+ * @since 3.1.0-a3
+ */
+ $vars = array('action', 'sql_ary', 'template_data', 'u_action');
+ extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_form', compact($vars)));
+
+ $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
+
+ $template->assign_vars($template_data);
while ($row = $db->sql_fetchrow($result))
{
- $template->assign_block_vars('bbcodes', array(
+ $bbcodes_array = array(
'BBCODE_TAG' => $row['bbcode_tag'],
- 'U_EDIT' => $this->u_action . '&amp;action=edit&amp;bbcode=' . $row['bbcode_id'],
- 'U_DELETE' => $this->u_action . '&amp;action=delete&amp;bbcode=' . $row['bbcode_id'])
+ 'U_EDIT' => $u_action . '&amp;action=edit&amp;bbcode=' . $row['bbcode_id'],
+ 'U_DELETE' => $u_action . '&amp;action=delete&amp;bbcode=' . $row['bbcode_id'],
);
+
+ /**
+ * Modify display of custom bbcodes in the form
+ *
+ * @event core.acp_bbcodes_display_bbcodes
+ * @var array row Array with current bbcode data
+ * @var array bbcodes_array Array of bbcodes template data
+ * @var string u_action The u_action link
+ * @since 3.1.0-a3
+ */
+ $vars = array('bbcodes_array', 'row', 'u_action');
+ extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_bbcodes', compact($vars)));
+
+ $template->assign_block_vars('bbcodes', $bbcodes_array);
+
}
$db->sql_freeresult($result);
}
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index c21c9f4e9d..2ff479d824 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -88,6 +88,11 @@ class acp_extensions
break;
case 'enable_pre':
+ if (!$md_manager->validate_dir())
+ {
+ trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
if (!$md_manager->validate_enable())
{
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
@@ -108,6 +113,11 @@ class acp_extensions
break;
case 'enable':
+ if (!$md_manager->validate_dir())
+ {
+ trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
if (!$md_manager->validate_enable())
{
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index b36ea1a8d8..ec78e0b32b 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -676,6 +676,7 @@ class acp_groups
}
$this->page_title = 'GROUP_MEMBERS';
+ $pagination = $phpbb_container->get('pagination');
// Grab the leaders - always, on every page...
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
@@ -719,14 +720,14 @@ class acp_groups
}
$base_url = $this->u_action . "&amp;action=$action&amp;g=$group_id";
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
+ $pagination->generate_template_pagination($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,
'S_ACTION_OPTIONS' => $s_action_options,
- 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start),
+ 'S_ON_PAGE' => $pagination->on_page($base_url, $total_members, $config['topics_per_page'], $start),
'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'],
'U_ACTION' => $this->u_action . "&amp;g=$group_id",
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index 658be4cc6b..20b1f56182 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -27,7 +27,7 @@ class acp_icons
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
- global $request;
+ global $request, $phpbb_container;
$user->add_lang('acp/posting');
@@ -832,9 +832,10 @@ class acp_icons
WHERE {$fields}_order = $switch_order_id
AND {$fields}_id <> $icon_id";
$db->sql_query($sql);
+ $move_executed = (bool) $db->sql_affectedrows();
// Only update the other entry too if the previous entry got updated
- if ($db->sql_affectedrows())
+ if ($move_executed)
{
$sql = "UPDATE $table
SET {$fields}_order = $switch_order_id
@@ -846,6 +847,14 @@ class acp_icons
$cache->destroy('_icons');
$cache->destroy('sql', $table);
+ if ($request->is_ajax())
+ {
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'success' => $move_executed,
+ ));
+ }
+
break;
}
@@ -893,6 +902,7 @@ class acp_icons
);
$spacer = false;
+ $pagination = $phpbb_container->get('pagination');
$pagination_start = request_var('start', 0);
$item_count = $this->item_count($table);
@@ -927,7 +937,7 @@ 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);
+ $pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $item_count, $config['smilies_per_page'], $pagination_start);
}
/**
diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php
index de4679b58d..305ba9ac69 100644
--- a/phpBB/includes/acp/acp_inactive.php
+++ b/phpBB/includes/acp/acp_inactive.php
@@ -30,7 +30,7 @@ class acp_inactive
function main($id, $mode)
{
- global $config, $db, $user, $auth, $template;
+ global $config, $db, $user, $auth, $template, $phpbb_container;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
@@ -49,6 +49,7 @@ class acp_inactive
$form_key = 'acp_inactive';
add_form_key($form_key);
+ $pagination = $phpbb_container->get('pagination');
// We build the sort key and per page settings here, because they may be needed later
@@ -285,7 +286,7 @@ class acp_inactive
}
$base_url = $this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page";
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
+ $pagination->generate_template_pagination($base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
$template->assign_vars(array(
'S_INACTIVE_USERS' => true,
@@ -294,7 +295,7 @@ class acp_inactive
'S_LIMIT_DAYS' => $s_limit_days,
'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),
+ 'S_ON_PAGE' => $pagination->on_page($base_url, $inactive_count, $per_page, $start),
'USERS_PER_PAGE' => $per_page,
'U_ACTION' => $this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page&amp;start=$start",
diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php
index 229bf135ff..0ffea2737b 100644
--- a/phpBB/includes/acp/acp_logs.php
+++ b/phpBB/includes/acp/acp_logs.php
@@ -24,7 +24,7 @@ class acp_logs
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache;
+ global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $request;
@@ -46,6 +46,7 @@ class acp_logs
$this->tpl_name = 'acp_logs';
$this->log_type = constant('LOG_' . strtoupper($mode));
+ $pagination = $phpbb_container->get('pagination');
// Delete entries if requested and able
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
@@ -130,14 +131,14 @@ class acp_logs
$start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
$base_url = $this->u_action . "&amp;$u_sort_param$keywords_param";
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
+ $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'L_TITLE' => $l_title,
'L_EXPLAIN' => $l_title_explain,
'U_ACTION' => $this->u_action . "&amp;$u_sort_param$keywords_param&amp;start=$start",
- 'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start),
+ 'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
'S_LIMIT_DAYS' => $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index eecd8c72dc..f01cba0bcc 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -620,6 +620,22 @@ class acp_main
$template->assign_var('S_REMOVE_INSTALL', true);
}
+ // Warn if no search index is created
+ if ($config['num_posts'] && class_exists($config['search_type']))
+ {
+ $error = false;
+ $search_type = $config['search_type'];
+ $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user);
+
+ if (!$search->index_created())
+ {
+ $template->assign_vars(array(
+ 'S_SEARCH_INDEX_MISSING' => true,
+ 'L_NO_SEARCH_INDEX' => $user->lang('NO_SEARCH_INDEX', $search->get_name(), '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_search&amp;mode=index') . '">', '</a>'),
+ ));
+ }
+ }
+
if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx))
{
// World-Writable? (000x)
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 100e33044b..c124377ba9 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -170,6 +170,14 @@ class acp_modules
$this->remove_cache_file();
}
+ if ($request->is_ajax())
+ {
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'success' => ($move_module_name !== false),
+ ));
+ }
+
break;
case 'quickadd':
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php
index 17e48d6576..aca45575d3 100644
--- a/phpBB/includes/acp/acp_permission_roles.php
+++ b/phpBB/includes/acp/acp_permission_roles.php
@@ -27,6 +27,7 @@ class acp_permission_roles
{
global $db, $user, $auth, $template, $cache, $phpbb_container;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+ global $request;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
@@ -46,6 +47,11 @@ class acp_permission_roles
$form_name = 'acp_permissions';
add_form_key($form_name);
+ if (!$role_id && in_array($action, array('remove', 'edit', 'move_up', 'move_down')))
+ {
+ trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
switch ($mode)
{
case 'admin_roles':
@@ -85,11 +91,6 @@ class acp_permission_roles
{
case 'remove':
- if (!$role_id)
- {
- trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . '
WHERE role_id = ' . $role_id;
@@ -123,10 +124,6 @@ class acp_permission_roles
break;
case 'edit':
- if (!$role_id)
- {
- trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
// Get role we edit
$sql = 'SELECT *
@@ -273,12 +270,7 @@ class acp_permission_roles
case 'edit':
if ($action == 'edit')
- {
- if (!$role_id)
- {
- trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
+ {
$sql = 'SELECT *
FROM ' . ACL_ROLES_TABLE . '
WHERE role_id = ' . $role_id;
@@ -366,7 +358,18 @@ class acp_permission_roles
case 'move_up':
case 'move_down':
- $order = request_var('order', 0);
+ $sql = 'SELECT role_order
+ FROM ' . ACL_ROLES_TABLE . "
+ WHERE role_id = $role_id";
+ $result = $db->sql_query($sql);
+ $order = $db->sql_fetchfield('role_order');
+ $db->sql_freeresult($result);
+
+ if ($order === false || ($order == 0 && $action == 'move_up'))
+ {
+ break;
+ }
+ $order = (int) $order;
$order_total = $order * 2 + (($action == 'move_up') ? -1 : 1);
$sql = 'UPDATE ' . ACL_ROLES_TABLE . '
@@ -375,6 +378,14 @@ class acp_permission_roles
AND role_order IN ($order, " . (($action == 'move_up') ? $order - 1 : $order + 1) . ')';
$db->sql_query($sql);
+ if ($request->is_ajax())
+ {
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'success' => (bool) $db->sql_affectedrows(),
+ ));
+ }
+
break;
}
@@ -421,8 +432,8 @@ class acp_permission_roles
'U_EDIT' => $this->u_action . '&amp;action=edit&amp;role_id=' . $row['role_id'],
'U_REMOVE' => $this->u_action . '&amp;action=remove&amp;role_id=' . $row['role_id'],
- 'U_MOVE_UP' => $this->u_action . '&amp;action=move_up&amp;order=' . $row['role_order'],
- 'U_MOVE_DOWN' => $this->u_action . '&amp;action=move_down&amp;order=' . $row['role_order'],
+ 'U_MOVE_UP' => $this->u_action . '&amp;action=move_up&amp;role_id=' . $row['role_id'],
+ 'U_MOVE_DOWN' => $this->u_action . '&amp;action=move_down&amp;role_id=' . $row['role_id'],
'U_DISPLAY_ITEMS' => ($row['role_id'] == $display_item) ? '' : $this->u_action . '&amp;display_item=' . $row['role_id'] . '#assigned_to')
);
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 4e8145009f..6efd778b12 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -39,11 +39,17 @@ class acp_profile
$this->tpl_name = 'acp_profile';
$this->page_title = 'ACP_CUSTOM_PROFILE_FIELDS';
+ $field_id = $request->variable('field_id', 0);
$action = (isset($_POST['create'])) ? 'create' : request_var('action', '');
$error = array();
$s_hidden_fields = '';
+ if (!$field_id && in_array($action, array('delete','activate', 'deactivate', 'move_up', 'move_down', 'edit')))
+ {
+ trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
// Define some default values for each field type
$default_values = array(
FIELD_STRING => array('field_length' => 10, 'field_minlen' => 0, 'field_maxlen' => 20, 'field_validation' => '.*', 'field_novalue' => '', 'field_default_value' => ''),
@@ -98,12 +104,6 @@ class acp_profile
switch ($action)
{
case 'delete':
- $field_id = request_var('field_id', 0);
-
- if (!$field_id)
- {
- trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
if (confirm_box(true))
{
@@ -210,12 +210,6 @@ class acp_profile
break;
case 'activate':
- $field_id = request_var('field_id', 0);
-
- if (!$field_id)
- {
- trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "
@@ -256,12 +250,6 @@ class acp_profile
break;
case 'deactivate':
- $field_id = request_var('field_id', 0);
-
- if (!$field_id)
- {
- trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
SET field_active = 0
@@ -291,7 +279,19 @@ class acp_profile
case 'move_up':
case 'move_down':
- $field_order = request_var('order', 0);
+
+ $sql = 'SELECT field_order
+ FROM ' . PROFILE_FIELDS_TABLE . "
+ WHERE field_id = $field_id";
+ $result = $db->sql_query($sql);
+ $field_order = $db->sql_fetchfield('field_order');
+ $db->sql_freeresult($result);
+
+ if ($field_order === false || ($field_order == 0 && $action == 'move_up'))
+ {
+ break;
+ }
+ $field_order = (int) $field_order;
$order_total = $field_order * 2 + (($action == 'move_up') ? -1 : 1);
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
@@ -299,12 +299,19 @@ class acp_profile
WHERE field_order IN ($field_order, " . (($action == 'move_up') ? $field_order - 1 : $field_order + 1) . ')';
$db->sql_query($sql);
+ if ($request->is_ajax())
+ {
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'success' => (bool) $db->sql_affectedrows(),
+ ));
+ }
+
break;
case 'create':
case 'edit':
- $field_id = request_var('field_id', 0);
$step = request_var('step', 1);
$submit = (isset($_REQUEST['next']) || isset($_REQUEST['prev'])) ? true : false;
@@ -316,11 +323,6 @@ class acp_profile
// We are editing... we need to grab basic things
if ($action == 'edit')
{
- if (!$field_id)
- {
- trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
-
$sql = 'SELECT l.*, f.*
FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f
WHERE l.lang_id = ' . $this->edit_lang_id . "
@@ -919,8 +921,8 @@ class acp_profile
'U_EDIT' => $this->u_action . "&amp;action=edit&amp;field_id=$id",
'U_TRANSLATE' => $this->u_action . "&amp;action=edit&amp;field_id=$id&amp;step=3",
'U_DELETE' => $this->u_action . "&amp;action=delete&amp;field_id=$id",
- 'U_MOVE_UP' => $this->u_action . "&amp;action=move_up&amp;order={$row['field_order']}",
- 'U_MOVE_DOWN' => $this->u_action . "&amp;action=move_down&amp;order={$row['field_order']}",
+ 'U_MOVE_UP' => $this->u_action . "&amp;action=move_up&amp;field_id=$id",
+ 'U_MOVE_DOWN' => $this->u_action . "&amp;action=move_down&amp;field_id=$id",
'S_NEED_EDIT' => $s_need_edit)
);
diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php
index 71e9108c2c..569bb73ab0 100644
--- a/phpBB/includes/acp/acp_reasons.php
+++ b/phpBB/includes/acp/acp_reasons.php
@@ -26,6 +26,7 @@ class acp_reasons
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+ global $request;
$user->add_lang(array('mcp', 'acp/posting'));
@@ -280,7 +281,18 @@ class acp_reasons
case 'move_up':
case 'move_down':
- $order = request_var('order', 0);
+ $sql = 'SELECT reason_order
+ FROM ' . REPORTS_REASONS_TABLE . "
+ WHERE reason_id = $reason_id";
+ $result = $db->sql_query($sql);
+ $order = $db->sql_fetchfield('reason_order');
+ $db->sql_freeresult($result);
+
+ if ($order === false || ($order == 0 && $action == 'move_up'))
+ {
+ break;
+ }
+ $order = (int) $order;
$order_total = $order * 2 + (($action == 'move_up') ? -1 : 1);
$sql = 'UPDATE ' . REPORTS_REASONS_TABLE . '
@@ -288,6 +300,13 @@ class acp_reasons
WHERE reason_order IN (' . $order . ', ' . (($action == 'move_up') ? $order - 1 : $order + 1) . ')';
$db->sql_query($sql);
+ if ($request->is_ajax())
+ {
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'success' => (bool) $db->sql_affectedrows(),
+ ));
+ }
break;
}
@@ -363,8 +382,8 @@ class acp_reasons
'U_EDIT' => $this->u_action . '&amp;action=edit&amp;id=' . $row['reason_id'],
'U_DELETE' => (!$other_reason) ? $this->u_action . '&amp;action=delete&amp;id=' . $row['reason_id'] : '',
- 'U_MOVE_UP' => $this->u_action . '&amp;action=move_up&amp;order=' . $row['reason_order'],
- 'U_MOVE_DOWN' => $this->u_action . '&amp;action=move_down&amp;order=' . $row['reason_order'])
+ 'U_MOVE_UP' => $this->u_action . '&amp;action=move_up&amp;id=' . $row['reason_id'],
+ 'U_MOVE_DOWN' => $this->u_action . '&amp;action=move_down&amp;id=' . $row['reason_id'])
);
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 1a7bc2d186..b24adfc586 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1096,6 +1096,7 @@ class acp_users
$deleteall = (isset($_POST['delall'])) ? true : false;
$marked = request_var('mark', array(0));
$message = utf8_normalize_nfc(request_var('message', '', true));
+ $pagination = $phpbb_container->get('pagination');
// Sort keys
$sort_days = request_var('st', 0);
@@ -1166,11 +1167,11 @@ class acp_users
$start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
$base_url = $this->u_action . "&amp;u=$user_id&amp;$u_sort_param";
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
+ $pagination->generate_template_pagination($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),
+ 'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
'S_LIMIT_DAYS' => $s_limit_days,
'S_SORT_KEY' => $s_sort_key,
@@ -1998,6 +1999,7 @@ class acp_users
$start = request_var('start', 0);
$deletemark = (isset($_POST['delmarked'])) ? true : false;
$marked = request_var('mark', array(0));
+ $pagination = $phpbb_container->get('pagination');
// Sort keys
$sort_key = request_var('sk', 'a');
@@ -2134,11 +2136,11 @@ class acp_users
$db->sql_freeresult($result);
$base_url = $this->u_action . "&amp;u=$user_id&amp;sk=$sort_key&amp;sd=$sort_dir";
- phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
+ $pagination->generate_template_pagination($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),
+ 'S_ON_PAGE' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start),
'S_SORT_KEY' => $s_sort_key,
'S_SORT_DIR' => $s_sort_dir,
));