Line 199 | Line 199 |
---|
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html,
|
'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html,
|
| 'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'),
|
'VERSION' => $config['version']) );
| 'VERSION' => $config['version']) );
|
Line 237 | Line 238 |
---|
/** * Build radio fields in acp pages */
|
/** * Build radio fields in acp pages */
|
function h_radio($name, &$input_ary, $input_default = false, $id = false, $key = false)
| function h_radio($name, $input_ary, $input_default = false, $id = false, $key = false, $separator = '')
|
{ global $user;
| { global $user;
|
Line 246 | Line 247 |
---|
foreach ($input_ary as $value => $title) { $selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : '';
|
foreach ($input_ary as $value => $title) { $selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : '';
|
$html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . $user->lang[$title] . '</label>';
| $html .= '<label><input type="radio" name="' . $name . '"' . (($id && !$id_assigned) ? ' id="' . $id . '"' : '') . ' value="' . $value . '"' . $selected . (($key) ? ' accesskey="' . $key . '"' : '') . ' class="radio" /> ' . $user->lang[$title] . '</label>' . $separator;
|
$id_assigned = true; }
| $id_assigned = true; }
|
Line 262 | Line 263 |
---|
$tpl = ''; $name = 'config[' . $config_key . ']';
|
$tpl = ''; $name = 'config[' . $config_key . ']';
|
| // Make sure there is no notice printed out for non-existent config options (we simply set them) if (!isset($new[$config_key])) { $new[$config_key] = ''; }
|
switch ($tpl_type[0]) {
| switch ($tpl_type[0]) {
|
Line 270 | Line 277 |
---|
$size = (int) $tpl_type[1]; $maxlength = (int) $tpl_type[2];
|
$size = (int) $tpl_type[1]; $maxlength = (int) $tpl_type[2];
|
$tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '" />';
| $tpl = '<input id="' . $key . '" type="' . $tpl_type[0] . '"' . (($size) ? ' size="' . $size . '"' : '') . ' maxlength="' . (($maxlength) ? $maxlength : 255) . '" name="' . $name . '" value="' . $new[$config_key] . '"' . (($tpl_type[0] === 'password') ? ' autocomplete="off"' : '') . ' />';
|
break;
case 'dimension':
| break;
case 'dimension':
|
Line 396 | Line 403 |
---|
switch ($validator[$type]) { case 'string':
|
switch ($validator[$type]) { case 'string':
|
$length = strlen($cfg_array[$config_name]);
| $length = utf8_strlen($cfg_array[$config_name]);
|
// the column is a VARCHAR $validator[$max] = (isset($validator[$max])) ? min(255, $validator[$max]) : 255;
| // the column is a VARCHAR $validator[$max] = (isset($validator[$max])) ? min(255, $validator[$max]) : 255;
|
Line 425 | Line 432 |
---|
else if (isset($validator[$max]) && $cfg_array[$config_name] > $validator[$max]) { $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]);
|
else if (isset($validator[$max]) && $cfg_array[$config_name] > $validator[$max]) { $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]);
|
| }
if (strpos($config_name, '_max') !== false) { // Min/max pairs of settings should ensure that min <= max // Replace _max with _min to find the name of the minimum // corresponding configuration variable $min_name = str_replace('_max', '_min', $config_name);
if (isset($cfg_array[$min_name]) && is_numeric($cfg_array[$min_name]) && $cfg_array[$config_name] < $cfg_array[$min_name]) { // A minimum value exists and the maximum value is less than it $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], (int) $cfg_array[$min_name]); } } break;
case 'email': if (!preg_match('/^' . get_preg_expression('email') . '$/i', $cfg_array[$config_name])) { $error[] = $user->lang['EMAIL_INVALID_EMAIL'];
|
} break;
| } break;
|
Line 496 | Line 524 |
---|
$cfg_array[$config_name] = trim($destination);
|
$cfg_array[$config_name] = trim($destination);
|
| // Absolute file path case 'absolute_path': case 'absolute_path_writable':
|
// Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir... case 'path': case 'wpath':
| // Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir... case 'path': case 'wpath':
|
Line 514 | Line 545 |
---|
break; }
|
break; }
|
if (!file_exists($phpbb_root_path . $cfg_array[$config_name]))
| $path = in_array($config_definition['validate'], array('wpath', 'path', 'rpath', 'rwpath')) ? $phpbb_root_path . $cfg_array[$config_name] : $cfg_array[$config_name];
if (!file_exists($path))
|
{ $error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); }
|
{ $error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); }
|
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !is_dir($phpbb_root_path . $cfg_array[$config_name]))
| if (file_exists($path) && !is_dir($path))
|
{ $error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); }
// Check if the path is writable
|
{ $error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); }
// Check if the path is writable
|
if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath')
| if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath' || $config_definition['validate'] === 'absolute_path_writable')
|
{
|
{
|
if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !@is_writable($phpbb_root_path . $cfg_array[$config_name]))
| if (file_exists($path) && !phpbb_is_writable($path))
|
{ $error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); }
| { $error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); }
|
Line 553 | Line 586 |
---|
'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff),
|
'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff),
|
'INT' => array('php_type' => 'int', 'min' => (int) 0x80000000, 'max' => (int) 0x7fffffff),
| // Do not use (int) 0x80000000 - it evaluates to different // values on 32-bit and 64-bit systems. // Apparently -2147483648 is a float on 32-bit systems, // despite fitting in an int, thus explicit cast is needed. 'INT' => array('php_type' => 'int', 'min' => (int) -2147483648, 'max' => (int) 0x7fffffff),
|
'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255),
| 'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255),
|
Line 576 | Line 613 |
---|
{ case 'string' : $max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max'];
|
{ case 'string' : $max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max'];
|
if (strlen($value['value']) > $max)
| if (utf8_strlen($value['value']) > $max)
|
{ $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$value['lang']], $max); }
| { $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$value['lang']], $max); }
|