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.php2
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php159
-rw-r--r--phpBB/includes/acp/acp_board.php49
-rw-r--r--phpBB/includes/acp/acp_database.php2
-rw-r--r--phpBB/includes/acp/acp_extensions.php187
-rw-r--r--phpBB/includes/acp/acp_forums.php1
-rw-r--r--phpBB/includes/acp/acp_main.php2
-rw-r--r--phpBB/includes/acp/acp_reasons.php2
-rw-r--r--phpBB/includes/acp/acp_users.php6
9 files changed, 164 insertions, 246 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 94e3660de8..feeccbe853 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -610,7 +610,6 @@ class acp_attachments
$cat_lang = array(
ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'],
ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'],
- ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'],
);
$group_id = $request->variable('g', 0);
@@ -1385,7 +1384,6 @@ class acp_attachments
$types = array(
ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'],
ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'],
- ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'],
);
if ($group_id)
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index bd8df6a63b..a67f3c54f9 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -446,144 +446,7 @@ class acp_bbcodes
function build_regexp(&$bbcode_match, &$bbcode_tpl)
{
$bbcode_match = trim($bbcode_match);
- $bbcode_tpl = trim($bbcode_tpl);
-
- // Allow unicode characters for URL|LOCAL_URL|RELATIVE_URL|INTTEXT tokens
- $utf8 = preg_match('/(URL|LOCAL_URL|RELATIVE_URL|INTTEXT)/', $bbcode_match);
-
- $fp_match = preg_quote($bbcode_match, '!');
- $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);
- $fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace);
-
- $sp_match = preg_quote($bbcode_match, '!');
- $sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match);
- $sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match);
- $sp_replace = $bbcode_tpl;
-
- // @todo Make sure to change this too if something changed in message parsing
- $tokens = array(
- 'URL' => array(
- '!(?:(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))!ie' => "\$this->bbcode_specialchars(('\$1') ? '\$1' : 'http://\$2')"
- ),
- 'LOCAL_URL' => array(
- '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')"
- ),
- 'RELATIVE_URL' => array(
- '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')"
- ),
- 'EMAIL' => array(
- '!(' . get_preg_expression('email') . ')!ie' => "\$this->bbcode_specialchars('$1')"
- ),
- 'TEXT' => array(
- '!(.*?)!es' => "str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', ''', '(', ')'), trim('\$1'))"
- ),
- 'SIMPLETEXT' => array(
- '!([a-zA-Z0-9-+.,_ ]+)!' => "$1"
- ),
- 'INTTEXT' => array(
- '!([\p{L}\p{N}\-+,_. ]+)!u' => "$1"
- ),
- 'IDENTIFIER' => array(
- '!([a-zA-Z0-9-_]+)!' => "$1"
- ),
- 'COLOR' => array(
- '!([a-z]+|#[0-9abcdef]+)!i' => '$1'
- ),
- 'NUMBER' => array(
- '!([0-9]+)!' => '$1'
- )
- );
-
- $sp_tokens = array(
- 'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)',
- 'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
- 'RELATIVE_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)',
- 'EMAIL' => '(' . get_preg_expression('email') . ')',
- 'TEXT' => '(.*?)',
- 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
- 'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)',
- 'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
- 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
- 'NUMBER' => '([0-9]+)',
- );
-
- $pad = 0;
- $modifiers = 'i';
- $modifiers .= ($utf8) ? 'u' : '';
-
- if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
- {
- foreach ($m[0] as $n => $token)
- {
- $token_type = $m[1][$n];
-
- reset($tokens[strtoupper($token_type)]);
- list($match, $replace) = each($tokens[strtoupper($token_type)]);
-
- // Pad backreference numbers from tokens
- if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))
- {
- $repad = $pad + count(array_unique($repad[0]));
- $replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) {
- return '${' . ($match[1] + $pad) . '}';
- }, $replace);
- $pad = $repad;
- }
-
- // Obtain pattern modifiers to use and alter the regex accordingly
- $regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match);
- $regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match);
-
- for ($i = 0, $size = strlen($regex_modifiers); $i < $size; ++$i)
- {
- if (strpos($modifiers, $regex_modifiers[$i]) === false)
- {
- $modifiers .= $regex_modifiers[$i];
-
- if ($regex_modifiers[$i] == 'e')
- {
- $fp_replace = "'" . str_replace("'", "\\'", $fp_replace) . "'";
- }
- }
-
- if ($regex_modifiers[$i] == 'e')
- {
- $replace = "'.$replace.'";
- }
- }
-
- $fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match);
- $fp_replace = str_replace($token, $replace, $fp_replace);
-
- $sp_match = str_replace(preg_quote($token, '!'), $sp_tokens[$token_type], $sp_match);
-
- // Prepend the board url to local relative links
- $replace_prepend = ($token_type === 'LOCAL_URL') ? generate_board_url() . '/' : '';
-
- $sp_replace = str_replace($token, $replace_prepend . '${' . ($n + 1) . '}', $sp_replace);
- }
-
- $fp_match = '!' . $fp_match . '!' . $modifiers;
- $sp_match = '!' . $sp_match . '!s' . (($utf8) ? 'u' : '');
-
- if (strpos($fp_match, 'e') !== false)
- {
- $fp_replace = str_replace("'.'", '', $fp_replace);
- $fp_replace = str_replace(".''.", '.', $fp_replace);
- }
- }
- else
- {
- // No replacement is present, no need for a second-pass pattern replacement
- // A simple str_replace will suffice
- $fp_match = '!' . $fp_match . '!' . $modifiers;
- $sp_match = $fp_replace;
- $sp_replace = '';
- }
-
- // Lowercase tags
$bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match);
- $bbcode_search = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match);
if (!preg_match('/^[a-zA-Z0-9_-]+$/', $bbcode_tag))
{
@@ -591,25 +454,13 @@ class acp_bbcodes
trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
- $fp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
- return strtolower($match[0]);
- }, $fp_match);
- $fp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
- return strtolower($match[0]);
- }, $fp_replace);
- $sp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
- return strtolower($match[0]);
- }, $sp_match);
- $sp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) {
- return strtolower($match[0]);
- }, $sp_replace);
-
return array(
'bbcode_tag' => $bbcode_tag,
- 'first_pass_match' => $fp_match,
- 'first_pass_replace' => $fp_replace,
- 'second_pass_match' => $sp_match,
- 'second_pass_replace' => $sp_replace
+ 'first_pass_match' => '/(?!)/',
+ 'first_pass_replace' => '',
+ // Use a non-matching, valid regexp to effectively disable this BBCode
+ 'second_pass_match' => '/(?!)/',
+ 'second_pass_replace' => ''
);
}
}
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 0730b4e285..05871e4157 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -85,34 +85,25 @@ class acp_board
$display_vars = array(
'title' => 'ACP_BOARD_FEATURES',
'vars' => array(
- 'legend1' => 'ACP_BOARD_FEATURES',
- 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'legend1' => 'ACP_BOARD_FEATURES',
+ 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
-
- 'legend2' => 'ACP_LOAD_SETTINGS',
- 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
- 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
+ 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
- 'legend3' => 'ACP_SUBMIT_CHANGES',
+ 'legend2' => 'ACP_SUBMIT_CHANGES',
)
);
break;
@@ -263,7 +254,6 @@ class acp_board
'vars' => array(
'legend1' => 'GENERAL_SETTINGS',
'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,),
- 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true),
'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
@@ -426,7 +416,6 @@ class acp_board
'remote_upload_verify' => array('lang' => 'UPLOAD_CERT_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
- 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,),
'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true),
'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true),
'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
@@ -904,13 +893,13 @@ class acp_board
}
/**
- * Maximum/Minimum password length
+ * Minimum password length
*/
function password_length($value, $key)
{
global $user;
- return '<input id="' . $key . '" type="number" min="1" max="999" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . '&nbsp;&nbsp;<input type="number" min="8" max="255" name="config[max_pass_chars]" value="' . $this->new_config['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS'];
+ return '<input id="' . $key . '" type="number" min="1" max="999" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'];
}
/**
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 677fce7217..c1c748832b 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -248,8 +248,6 @@ class acp_database
switch ($db->get_sql_layer())
{
- case 'mysql':
- case 'mysql4':
case 'mysqli':
case 'sqlite3':
while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false)
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index a1cb2108e7..6ac70ce3a8 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -38,7 +38,7 @@ class acp_extensions
private $phpbb_container;
private $php_ini;
- function main()
+ function main($id, $mode)
{
// Start the page
global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher, $phpbb_container;
@@ -172,23 +172,27 @@ class acp_extensions
}
$extension = $this->ext_manager->get_extension($ext_name);
- if (!$extension->is_enableable())
- {
- trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
+
+ $this->check_is_enableable($extension);
if ($this->ext_manager->is_enabled($ext_name))
{
redirect($this->u_action);
}
- $this->tpl_name = 'acp_ext_enable';
-
- $this->template->assign_vars(array(
- 'PRE' => true,
- 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')),
- 'U_ENABLE' => $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('enable.' . $ext_name),
- ));
+ if (confirm_box(true))
+ {
+ redirect($this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('enable.' . $ext_name));
+ }
+ else
+ {
+ confirm_box(false, $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'action' => 'enable_pre',
+ 'ext_name' => $ext_name,
+ )));
+ }
break;
case 'enable':
@@ -203,10 +207,8 @@ class acp_extensions
}
$extension = $this->ext_manager->get_extension($ext_name);
- if (!$extension->is_enableable())
- {
- trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
- }
+
+ $this->check_is_enableable($extension);
try
{
@@ -215,9 +217,8 @@ class acp_extensions
// Are we approaching the time limit? If so we want to pause the update and continue after refreshing
if ((time() - $start_time) >= $safe_time_limit)
{
- $this->template->assign_var('S_NEXT_STEP', true);
-
meta_refresh(0, $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('enable.' . $ext_name));
+ trigger_error('EXTENSION_ENABLE_IN_PROGRESS', E_USER_NOTICE);
}
}
@@ -233,14 +234,22 @@ class acp_extensions
}
catch (\phpbb\db\migration\exception $e)
{
- $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user));
+ trigger_error($this->user->lang('MIGRATION_EXCEPTION_ERROR', $e->getLocalisedMessage($this->user)), E_USER_WARNING);
}
- $this->tpl_name = 'acp_ext_enable';
-
- $this->template->assign_vars(array(
- 'U_RETURN' => $this->u_action . '&amp;action=list',
- ));
+ if ($this->request->is_ajax())
+ {
+ $actions = $this->output_actions('enabled', [
+ 'DISABLE' => $this->u_action . '&amp;action=disable_pre&amp;ext_name=' . urlencode($ext_name),
+ ]);
+
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'EXT_ENABLE_SUCCESS' => true,
+ 'ACTIONS' => $actions,
+ ));
+ }
+ trigger_error($this->user->lang('EXTENSION_ENABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE);
break;
case 'disable_pre':
@@ -249,13 +258,19 @@ class acp_extensions
redirect($this->u_action);
}
- $this->tpl_name = 'acp_ext_disable';
-
- $this->template->assign_vars(array(
- 'PRE' => true,
- 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')),
- 'U_DISABLE' => $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('disable.' . $ext_name),
- ));
+ if (confirm_box(true))
+ {
+ redirect($this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('disable.' . $ext_name));
+ }
+ else
+ {
+ confirm_box(false, $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'action' => 'disable_pre',
+ 'ext_name' => $ext_name,
+ )));
+ }
break;
case 'disable':
@@ -272,15 +287,25 @@ class acp_extensions
$this->template->assign_var('S_NEXT_STEP', true);
meta_refresh(0, $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('disable.' . $ext_name));
+ trigger_error('EXTENSION_DISABLE_IN_PROGRESS', E_USER_NOTICE);
}
}
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name));
- $this->tpl_name = 'acp_ext_disable';
-
- $this->template->assign_vars(array(
- 'U_RETURN' => $this->u_action . '&amp;action=list',
- ));
+ if ($this->request->is_ajax())
+ {
+ $actions = $this->output_actions('disabled', [
+ 'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($ext_name),
+ 'DELETE_DATA' => $this->u_action . '&amp;action=delete_data_pre&amp;ext_name=' . urlencode($ext_name),
+ ]);
+
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'EXT_DISABLE_SUCCESS' => true,
+ 'ACTIONS' => $actions,
+ ));
+ }
+ trigger_error($this->user->lang('EXTENSION_DISABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE);
break;
case 'delete_data_pre':
@@ -288,13 +313,20 @@ class acp_extensions
{
redirect($this->u_action);
}
- $this->tpl_name = 'acp_ext_delete_data';
- $this->template->assign_vars(array(
- 'PRE' => true,
- 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')),
- 'U_PURGE' => $this->u_action . '&amp;action=delete_data&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('delete_data.' . $ext_name),
- ));
+ if (confirm_box(true))
+ {
+ redirect($this->u_action . '&amp;action=delete_data&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('delete_data.' . $ext_name));
+ }
+ else
+ {
+ confirm_box(false, $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'action' => 'delete_data_pre',
+ 'ext_name' => $ext_name,
+ )));
+ }
break;
case 'delete_data':
@@ -313,20 +345,29 @@ class acp_extensions
$this->template->assign_var('S_NEXT_STEP', true);
meta_refresh(0, $this->u_action . '&amp;action=delete_data&amp;ext_name=' . urlencode($ext_name) . '&amp;hash=' . generate_link_hash('delete_data.' . $ext_name));
+ trigger_error('EXTENSION_DELETE_DATA_IN_PROGRESS', E_USER_NOTICE);
}
}
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_PURGE', time(), array($ext_name));
}
catch (\phpbb\db\migration\exception $e)
{
- $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user));
+ trigger_error($this->user->lang('MIGRATION_EXCEPTION_ERROR', $e->getLocalisedMessage($this->user)), E_USER_WARNING);
}
- $this->tpl_name = 'acp_ext_delete_data';
-
- $this->template->assign_vars(array(
- 'U_RETURN' => $this->u_action . '&amp;action=list',
- ));
+ if ($this->request->is_ajax())
+ {
+ $actions = $this->output_actions('disabled', [
+ 'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($ext_name),
+ ]);
+
+ $json_response = new \phpbb\json_response;
+ $json_response->send(array(
+ 'EXT_DELETE_DATA_SUCCESS' => true,
+ 'ACTIONS' => $actions,
+ ));
+ }
+ trigger_error($this->user->lang('EXTENSION_DELETE_DATA_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE);
break;
case 'details':
@@ -605,17 +646,37 @@ class acp_extensions
*
* @param string $block
* @param array $actions
+ * @return array List of actions to be performed on the extension
*/
private function output_actions($block, $actions)
{
- foreach ($actions as $lang => $url)
+ $vars_ary = array();
+ foreach ($actions as $lang => $options)
{
- $this->template->assign_block_vars($block . '.actions', array(
+ $url = $options;
+ if (is_array($options))
+ {
+ $url = $options['url'];
+ }
+
+ $vars = array(
'L_ACTION' => $this->user->lang('EXTENSION_' . $lang),
'L_ACTION_EXPLAIN' => (isset($this->user->lang['EXTENSION_' . $lang . '_EXPLAIN'])) ? $this->user->lang('EXTENSION_' . $lang . '_EXPLAIN') : '',
'U_ACTION' => $url,
- ));
+ 'ACTION_AJAX' => 'ext_' . strtolower($lang),
+ );
+
+ if (isset($options['color']))
+ {
+ $vars['COLOR'] = $options['color'];
+ }
+
+ $this->template->assign_block_vars($block . '.actions', $vars);
+
+ $vars_ary[] = $vars;
}
+
+ return $vars_ary;
}
/**
@@ -662,4 +723,28 @@ class acp_extensions
));
}
}
+
+ /**
+ * Checks whether the extension can be enabled. Triggers error if not.
+ * Error message can be set by the extension.
+ *
+ * @param \phpbb\extension\extension_interface $extension Extension to check
+ */
+ protected function check_is_enableable(\phpbb\extension\extension_interface $extension)
+ {
+ $message = $extension->is_enableable();
+ if ($message !== true)
+ {
+ if (empty($message))
+ {
+ $message = $this->user->lang('EXTENSION_NOT_ENABLEABLE');
+ }
+ else if (is_array($message))
+ {
+ $message = implode('<br>', $message);
+ }
+
+ trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ }
}
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index cb0593b14a..9044cd0e97 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -1878,7 +1878,6 @@ class acp_forums
switch ($db->get_sql_layer())
{
- case 'mysql4':
case 'mysqli':
// Delete everything else and thank MySQL for offering multi-table deletion
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 8f169d15a7..27fac54777 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -657,7 +657,7 @@ class acp_main
}
// Warn if install is still present
- if (file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
+ if (!defined('IN_INSTALL') && !$phpbb_container->getParameter('allow_install_dir') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
{
$template->assign_var('S_REMOVE_INSTALL', true);
}
diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php
index dfb2ccbfd3..f3f82bdfca 100644
--- a/phpBB/includes/acp/acp_reasons.php
+++ b/phpBB/includes/acp/acp_reasons.php
@@ -222,8 +222,6 @@ class acp_reasons
{
// The ugly one!
case 'mysqli':
- case 'mysql4':
- case 'mysql':
// Change the reports using this reason to 'other'
$sql = 'UPDATE ' . REPORTS_TABLE . '
SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text)
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index fd4b5e8c24..1b66943490 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -844,9 +844,9 @@ class acp_users
// Validation data - we do not check the password complexity setting here
$check_ary = array(
'new_password' => array(
- array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
+ array('string', true, $config['min_pass_chars'], 0),
array('password')),
- 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
+ 'password_confirm' => array('string', true, $config['min_pass_chars'], 0),
);
// Check username if altered
@@ -1130,7 +1130,7 @@ class acp_users
$template->assign_vars(array(
'L_NAME_CHARS_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])),
- 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])),
+ 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])),
'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']),
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,