1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-29 21:10:31 +02:00

Merge branch 'develop' into feature/avatars

* develop: (201 commits)
  [feature/new-tz-handling] Don't use global user but make it a parameter
  [feature/new-tz-handling] Fix size of suggestion button in chrome
  [feature/new-tz-handling] Fall back to UTC, if the timezone is invalid
  [feature/new-tz-handling] Add previous selected value to validation if valid
  [feature/new-tz-handling] Display suggestion when a different value is selected
  [ticket/10998] Add border-radius to forum rules block - prosilver
  [feature/new-tz-handling] Remove additional marking of selected items
  [feature/new-tz-handling] Move update helper function to new class
  [feature/new-tz-handling] Fix unit test
  [feature/new-tz-handling] Delete old variable which is not used anymore
  [feature/new-tz-handling] Rename $user->tz back to $user->timezone
  [feature/pagination-as-list] New parameter for name of start var
  [feature/pagination-as-list] Updates for nils comments
  [feature/pagination-as-list] Rename and deprecate functions
  [feature/pagination-as-list] Various fixes and improvements
  [ticket/10968] Render pagination within the template
  [feature/new-tz-handling] Remove "timezone might be numeric"
  [feature/new-tz-handling] Add function to update the timezone
  [feature/new-tz-handling] Correctly update user and board timezones on update
  [ticket/10996] Use correct DBMS name in Travis config for PostgreSQL
  ...
This commit is contained in:
Igor Wiedler
2012-07-21 00:37:48 +02:00
179 changed files with 3781 additions and 722 deletions

View File

@@ -197,7 +197,6 @@ function user_add($user_row, $cp_data = false)
'user_lastpost_time' => 0,
'user_lastpage' => '',
'user_posts' => 0,
'user_dst' => (int) $config['board_dst'],
'user_colour' => '',
'user_occ' => '',
'user_interests' => '',
@@ -677,8 +676,10 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
if (sizeof($ban_other) == 3 && ((int)$ban_other[0] < 9999) &&
(strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2))
{
$time_offset = (isset($user->timezone) && isset($user->dst)) ? (int) $user->timezone + (int) $user->dst : 0;
$ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0]) - $time_offset);
$ban_end = max($current_time, $user->create_datetime()
->setDate((int) $ban_other[0], (int) $ban_other[1], (int) $ban_other[2])
->setTime(0, 0, 0)
->getTimestamp() + $user->timezone->getOffset(new DateTime('UTC')));
}
else
{
@@ -1247,10 +1248,21 @@ function validate_data($data, $val_ary)
$function = array_shift($validate);
array_unshift($validate, $data[$var]);
if ($result = call_user_func_array('validate_' . $function, $validate))
if (function_exists('phpbb_validate_' . $function))
{
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
if ($result = call_user_func_array('phpbb_validate_' . $function, $validate))
{
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
}
}
else
{
if ($result = call_user_func_array('validate_' . $function, $validate))
{
// Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted.
$error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var);
}
}
}
}
@@ -1395,6 +1407,22 @@ function validate_language_iso_name($lang_iso)
return ($lang_id) ? false : 'WRONG_DATA';
}
/**
* Validate Timezone Name
*
* Tests whether a timezone name is valid
*
* @param string $timezone The timezone string to test
*
* @return bool|string Either false if validation succeeded or
* a string which will be used as the error message
* (with the variable name appended)
*/
function phpbb_validate_timezone($timezone)
{
return (in_array($timezone, phpbb_get_timezone_identifiers($timezone))) ? false : 'TIMEZONE_INVALID';
}
/**
* Check to see if the username has been taken, or if it is disallowed.
* Also checks if it includes the " character, which we don't allow in usernames.