aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-04-08 22:04:33 +0200
committerAndreas Fischer <bantu@phpbb.com>2012-04-08 22:04:33 +0200
commit26e7dd98b71655c7e09be02ebd3ef84765ce27b8 (patch)
tree8d77283a8f8127c2a3adeddb2ca6fde3fc0305a2 /phpBB/includes
parentce4eb62b14f290efce997d6a73f0a6425fff2901 (diff)
parent156ae40d6fae2067a65a2125924e39e8dc5f35e1 (diff)
downloadforums-26e7dd98b71655c7e09be02ebd3ef84765ce27b8.tar
forums-26e7dd98b71655c7e09be02ebd3ef84765ce27b8.tar.gz
forums-26e7dd98b71655c7e09be02ebd3ef84765ce27b8.tar.bz2
forums-26e7dd98b71655c7e09be02ebd3ef84765ce27b8.tar.xz
forums-26e7dd98b71655c7e09be02ebd3ef84765ce27b8.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10561] Removed extra tabs, changes made to $db->sql_query() [ticket/10561] Changed $temp_style_id to $style_id [ticket/10561] Added function desc for phpbb_style_is_active() [ticket/10561] Casted $config['default_style'] to int [ticket/10561] Reverted to phpbb_style_is_active() [ticket/10561] Added to database_update:database_update_info() [ticket/10561] Added section in database_update.php [ticket/10561] Moved and renamed the funtion validate_style(). [ticket/10561] Fixed syntax error and renamed return variables. [ticket/10561] Changes made to $db->sql_fetchrow(). [ticket/10561] Changes made to function phpbb_style_is_active(). [ticket/10561] All users can choose deactivated styles (fixed). Conflicts: phpBB/install/database_update.php
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_user.php21
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php9
2 files changed, 29 insertions, 1 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 18452c27e9..5b05c3a78d 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1948,6 +1948,27 @@ function validate_jabber($jid)
}
/**
+* Verifies whether a style ID corresponds to an active style.
+*
+* @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;
+}
+
+/**
* 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 11f2d231fe..0c9f20f266 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -60,7 +60,14 @@ class ucp_prefs
if ($submit)
{
- $data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style'];
+ if ($config['override_user_style'])
+ {
+ $data['style'] = (int) $config['default_style'];
+ }
+ else if (!phpbb_style_is_active($data['style']))
+ {
+ $data['style'] = (int) $user->data['user_style'];
+ }
$error = validate_data($data, array(
'dateformat' => array('string', false, 1, 30),