mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-14 03:25:37 +02:00
Merge remote-tracking branch 'sadu/ticket/10561' into develop-olympus
* sadu/ticket/10561: [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).
This commit is contained in:
commit
156ae40d6f
@ -1948,6 +1948,27 @@ function validate_jabber($jid)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Remove avatar
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +61,14 @@ class ucp_prefs
|
|||||||
|
|
||||||
if ($submit)
|
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(
|
$error = validate_data($data, array(
|
||||||
'dateformat' => array('string', false, 1, 30),
|
'dateformat' => array('string', false, 1, 30),
|
||||||
|
@ -993,6 +993,8 @@ function database_update_info()
|
|||||||
'3.0.10-RC2' => array(),
|
'3.0.10-RC2' => array(),
|
||||||
// No changes from 3.0.10-RC3 to 3.0.10
|
// No changes from 3.0.10-RC3 to 3.0.10
|
||||||
'3.0.10-RC3' => array(),
|
'3.0.10-RC3' => array(),
|
||||||
|
// No changes from 3.0.10 to 3.0.11-RC1
|
||||||
|
'3.0.10' => array(),
|
||||||
|
|
||||||
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */
|
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */
|
||||||
);
|
);
|
||||||
@ -2024,6 +2026,32 @@ function change_database_data(&$no_updates, $version)
|
|||||||
// No changes from 3.0.10-RC3 to 3.0.10
|
// No changes from 3.0.10-RC3 to 3.0.10
|
||||||
case '3.0.10-RC3':
|
case '3.0.10-RC3':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Changes from 3.0.10 to 3.0.11-RC1
|
||||||
|
case '3.0.10':
|
||||||
|
// Updates users having current style a deactivated one
|
||||||
|
$sql = 'SELECT style_id
|
||||||
|
FROM ' . STYLES_TABLE . '
|
||||||
|
WHERE style_active = 0';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$deactivated_style_ids = array();
|
||||||
|
while ($style_id = $db->sql_fetchfield('style_id', false, $result))
|
||||||
|
{
|
||||||
|
$deactivated_style_ids[] = (int) $style_id;
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
if (!empty($deactivated_style_ids))
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||||
|
SET user_style = ' . (int) $config['default_style'] .'
|
||||||
|
WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids);
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
}
|
||||||
|
|
||||||
|
$no_updates = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user