phpBB

Code Changes

File: phpbb/user.php

  Unmodified   Added   Modified   Removed
Line 188Line 188

/**
* Event to load language files and modify user data on every page


/**
* Event to load language files and modify user data on every page

 
		*
* Note: To load language file with this event, see description
* of lang_set_ext variable.

		*
* @event core.user_setup
* @var array user_data Array with user's data row

		*
* @event core.user_setup
* @var array user_data Array with user's data row

Line 278Line 281
			$db->sql_freeresult($result);
}


			$db->sql_freeresult($result);
}


		// User has wrong style
if (!$this->style && $style_id == $this->data['user_style'])

		// Fallback to board's default style
if (!$this->style)

		{

		{

			$style_id = $this->data['user_style'] = $config['default_style'];







			// Verify default style exists in the database
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . '
WHERE style_id = ' . (int) $config['default_style'];
$result = $db->sql_query($sql);
$style_id = (int) $db->sql_fetchfield('style_id');
$db->sql_freeresult($result);





			$sql = 'UPDATE ' . USERS_TABLE . "
SET user_style = $style_id
WHERE user_id = {$this->data['user_id']}";
$db->sql_query($sql);

			if ($style_id > 0)
{
$db->sql_transaction('begin');






 
				// Update $user row

			$sql = 'SELECT *

			$sql = 'SELECT *

				FROM ' . STYLES_TABLE . " s
WHERE s.style_id = $style_id";
$result = $db->sql_query($sql, 3600);

					FROM ' . STYLES_TABLE . '
WHERE style_id = ' . (int) $config['default_style'];
$result = $db->sql_query($sql);

			$this->style = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

			$this->style = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

 

// Update user style preference
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = ' . (int) $style_id . '
WHERE user_id = ' . (int) $this->data['user_id'];
$db->sql_query($sql);

$db->sql_transaction('commit');
}

		}


		}


 
		// This should never happen

		if (!$this->style)
{

		if (!$this->style)
{

			trigger_error('NO_STYLE_DATA', E_USER_ERROR);

			trigger_error($this->language->lang('NO_STYLE_DATA', $this->data['user_style'], $this->data['user_id']), E_USER_ERROR);

		}

// Now parse the cfg file and cache it

		}

// Now parse the cfg file and cache it

Line 358Line 377
		}

// Is board disabled and user not an admin or moderator?

		}

// Is board disabled and user not an admin or moderator?

		if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))

		if ($config['board_disable'] && !defined('IN_INSTALL') && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_'))

		{
if ($this->data['is_bot'])
{

		{
if ($this->data['is_bot'])
{

Line 588Line 607
	*/
function format_date($gmepoch, $format = false, $forcedate = false)
{

	*/
function format_date($gmepoch, $format = false, $forcedate = false)
{

 
		global $phpbb_dispatcher;

		static $utc;

if (!isset($utc))

		static $utc;

if (!isset($utc))

Line 595Line 615
			$utc = new \DateTimeZone('UTC');
}


			$utc = new \DateTimeZone('UTC');
}


 
		$format_date_override = false;
$function_arguments = func_get_args();
/**
* Execute code and/or override format_date()
*
* To override the format_date() function generated value
* set $format_date_override to new return value
*
* @event core.user_format_date_override
* @var DateTimeZone utc Is DateTimeZone in UTC
* @var array function_arguments is array comprising a function's argument list
* @var string format_date_override Shall we return custom format (string) or not (false)
* @since 3.2.1-RC1
*/
$vars = array('utc', 'function_arguments', 'format_date_override');
extract($phpbb_dispatcher->trigger_event('core.user_format_date_override', compact($vars)));

if (!$format_date_override)
{

		$time = new $this->datetime($this, '@' . (int) $gmepoch, $utc);
$time->setTimezone($this->timezone);

return $time->format($format, $forcedate);

		$time = new $this->datetime($this, '@' . (int) $gmepoch, $utc);
$time->setTimezone($this->timezone);

return $time->format($format, $forcedate);

 
		}
else
{
return $format_date_override;
}

	}

/**

	}

/**