mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
[ticket/10561] Moved and renamed the funtion validate_style().
Fixed minor changes as suggested by @bantu. PHPBB3-10561
This commit is contained in:
parent
a84b97f58e
commit
018419b36c
@ -1238,26 +1238,6 @@ function style_select($default = '', $all = false)
|
||||
return $style_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Hari Sankar R <hsr@theinglorio.us>
|
||||
* @param int $style_id The style_id of a style which should be checked if activated or not.
|
||||
* @return boolean
|
||||
*/
|
||||
function phpbb_style_is_active($style_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'SELECT style_active
|
||||
FROM ' . STYLES_TABLE . "
|
||||
WHERE style_id = ". (int) $style_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$style_is_active = (bool) $db->sql_fetchfield('style_active');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $style_is_active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick a timezone
|
||||
*/
|
||||
|
@ -1948,6 +1948,25 @@ function validate_jabber($jid)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $style_id The style_id of a style which should be checked if activated or not.
|
||||
* @return boolean
|
||||
*/
|
||||
function phpbb_validate_style($style_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = 'SELECT style_active
|
||||
FROM ' . STYLES_TABLE . '
|
||||
WHERE style_id = '. (int) $style_id;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$style_is_active = (bool) $db->sql_fetchfield('style_active');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
return $style_is_active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove avatar
|
||||
*/
|
||||
|
@ -61,8 +61,14 @@ class ucp_prefs
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$data['style'] = ($config['override_user_style']) ? $config['default_style'] :
|
||||
(phpbb_style_is_active($data['style']) ? $data['style'] : ((int) $user->data['user_style']));
|
||||
if ($config['override_user_style'])
|
||||
{
|
||||
$data['style'] = $config['default_style'];
|
||||
}
|
||||
else if (!phpbb_validate_style($data['style']))
|
||||
{
|
||||
$data['style'] = (int) $user->data['user_style']);
|
||||
}
|
||||
|
||||
$error = validate_data($data, array(
|
||||
'dateformat' => array('string', false, 1, 30),
|
||||
|
Loading…
x
Reference in New Issue
Block a user