aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php20
-rw-r--r--phpBB/includes/functions_user.php19
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php10
3 files changed, 27 insertions, 22 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 70a961a744..0320230a7d 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1239,26 +1239,6 @@ function style_select($default = '', $all = false)
}
/**
-* @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
*/
function tz_select($default = '', $truncate = false)
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 10fb57ea97..7313844955 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1949,6 +1949,25 @@ function validate_jabber($jid)
}
/**
+* @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
*/
function avatar_delete($mode, $row, $clean_db = false)
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index e81bd1e1bb..5b915824d6 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -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),