phpBB

Code Changes

File: includes/functions.php

  Unmodified   Added   Modified   Removed
Line 20Line 20
}

// Common global functions

}

// Common global functions

/**
* Load the autoloaders added by the extensions.
*
* @param string $phpbb_root_path Path to the phpbb root directory.
*/
function phpbb_load_extensions_autoloaders($phpbb_root_path)
{
$iterator = new \RecursiveIteratorIterator(
new \phpbb\recursive_dot_prefix_filter_iterator(
new \RecursiveDirectoryIterator(
$phpbb_root_path . 'ext/',
\FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS
)
),
\RecursiveIteratorIterator::SELF_FIRST
);
$iterator->setMaxDepth(2);

foreach ($iterator as $file_info)
{
if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2)
{
$filename = $file_info->getRealPath() . '/autoload.php';
if (file_exists($filename))
{
require $filename;
}
}
}
}


 
/**
* Generates an alphanumeric random string of given length
*

/**
* Generates an alphanumeric random string of given length
*

Line 295Line 264

/**
* Pick a language, any language ...


/**
* Pick a language, any language ...

 
 *
* @param string $default Language ISO code to be selected by default in the dropdown list
* @param array $langdata Language data in format of array(array('lang_iso' => string, lang_local_name => string), ...)
*
* @return string HTML options for language selection dropdown list.

*/

*/

function language_select($default = '')

function language_select($default = '', array $langdata = [])

{
global $db;


{
global $db;


 
	if (empty($langdata))
{

	$sql = 'SELECT lang_iso, lang_local_name
FROM ' . LANG_TABLE . '
ORDER BY lang_english_name';
$result = $db->sql_query($sql);

	$sql = 'SELECT lang_iso, lang_local_name
FROM ' . LANG_TABLE . '
ORDER BY lang_english_name';
$result = $db->sql_query($sql);

 
		$langdata = (array) $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
}


$lang_options = '';


$lang_options = '';

	while ($row = $db->sql_fetchrow($result))

	foreach ($langdata as $row)

	{
$selected = ($row['lang_iso'] == $default) ? ' selected="selected"' : '';
$lang_options .= '<option value="' . $row['lang_iso'] . '"' . $selected . '>' . $row['lang_local_name'] . '</option>';
}

	{
$selected = ($row['lang_iso'] == $default) ? ' selected="selected"' : '';
$lang_options .= '<option value="' . $row['lang_iso'] . '"' . $selected . '>' . $row['lang_local_name'] . '</option>';
}

	$db->sql_freeresult($result);

 

return $lang_options;
}

/**


return $lang_options;
}

/**

* Pick a template/theme combo,







 * Pick a template/theme combo
*
* @param string $default Style ID to be selected by default in the dropdown list
* @param bool $all Flag indicating if all styles data including inactive ones should be fetched
* @param array $styledata Style data in format of array(array('style_id' => int, style_name => string), ...)
*
* @return string HTML options for style selection dropdown list.

*/

*/

function style_select($default = '', $all = false)

function style_select($default = '', $all = false, array $styledata = [])

{
global $db;


{
global $db;


 
	if (empty($styledata))
{

	$sql_where = (!$all) ? 'WHERE style_active = 1 ' : '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . "
$sql_where
ORDER BY style_name";
$result = $db->sql_query($sql);

	$sql_where = (!$all) ? 'WHERE style_active = 1 ' : '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . "
$sql_where
ORDER BY style_name";
$result = $db->sql_query($sql);

 
		$styledata = (array) $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
}


$style_options = '';


$style_options = '';

	while ($row = $db->sql_fetchrow($result))

	foreach ($styledata as $row)

	{
$selected = ($row['style_id'] == $default) ? ' selected="selected"' : '';
$style_options .= '<option value="' . $row['style_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
}

	{
$selected = ($row['style_id'] == $default) ? ' selected="selected"' : '';
$style_options .= '<option value="' . $row['style_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
}

	$db->sql_freeresult($result);

 

return $style_options;
}


return $style_options;
}

Line 611Line 599
				'notification.type.post',
'notification.type.approve_topic',
'notification.type.approve_post',

				'notification.type.post',
'notification.type.approve_topic',
'notification.type.approve_post',

 
				'notification.type.forum',

			), false, $user->data['user_id'], $post_time);

if ($config['load_db_lastread'] && $user->data['is_registered'])

			), false, $user->data['user_id'], $post_time);

if ($config['load_db_lastread'] && $user->data['is_registered'])

Line 694Line 683
			'notification.type.bookmark',
'notification.type.post',
'notification.type.approve_post',

			'notification.type.bookmark',
'notification.type.post',
'notification.type.approve_post',

 
			'notification.type.forum',

		), $topic_ids, $user->data['user_id'], $post_time);

// Add 0 to forums array to mark global announcements correctly

		), $topic_ids, $user->data['user_id'], $post_time);

// Add 0 to forums array to mark global announcements correctly

Line 804Line 794
			'notification.type.bookmark',
'notification.type.post',
'notification.type.approve_post',

			'notification.type.bookmark',
'notification.type.post',
'notification.type.approve_post',

 
			'notification.type.forum',

		), $topic_id, $user->data['user_id'], $post_time);

if ($config['load_db_lastread'] && $user->data['is_registered'])

		), $topic_id, $user->data['user_id'], $post_time);

if ($config['load_db_lastread'] && $user->data['is_registered'])

Line 1103Line 1094
* @param string $sql_limit		Limits the size of unread topics list, 0 for unlimited query
* @param string $sql_limit_offset Sets the offset of the first row to search, 0 to search from the start
*

* @param string $sql_limit		Limits the size of unread topics list, 0 for unlimited query
* @param string $sql_limit_offset Sets the offset of the first row to search, 0 to search from the start
*

* @return array[int][int]		Topic ids as keys, mark_time of topic as value

* @return int[]		Topic ids as keys, mark_time of topic as value

*/
function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0)
{

*/
function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0)
{

Line 1492Line 1483
* @return string The corrected url.
*
* Examples:

* @return string The corrected url.
*
* Examples:

* <code>
* append_sid("{$phpbb_root_path}viewtopic.$phpEx?t=1&amp;f=2");
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&amp;f=2');
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2', false);

* <code> append_sid("{$phpbb_root_path}viewtopic.$phpEx?t=1");
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1');
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1', false);


* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2));
* </code>
*

* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2));
* </code>
*

Line 1822Line 1812
	// Behave as per HTTP/1.1 spec for others
header('Location: ' . $url);
exit;

	// Behave as per HTTP/1.1 spec for others
header('Location: ' . $url);
exit;

 
}

/**
* Returns the install redirect path for phpBB.
*
* @param string $phpbb_root_path The root path of the phpBB installation.
* @param string $phpEx The file extension of php files, e.g., "php".
* @return string The install redirect path.
*/
function phpbb_get_install_redirect(string $phpbb_root_path, string $phpEx): string
{
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
if (!$script_name)
{
$script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
}

// Add trailing dot to prevent dirname() from returning parent directory if $script_name is a directory
$script_name = substr($script_name, -1) === '/' ? $script_name . '.' : $script_name;

// $phpbb_root_path accounts for redirects from e.g. /adm
$script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx;
// Replace any number of consecutive backslashes and/or slashes with a single slash
// (could happen on some proxy setups and/or Windows servers)
return preg_replace('#[\\\\/]{2,}#', '/', $script_path);

}

/**

}

/**

Line 2512Line 2527
		'LOGIN_ERROR'		=> $err,
'LOGIN_EXPLAIN' => $l_explain,


		'LOGIN_ERROR'		=> $err,
'LOGIN_EXPLAIN' => $l_explain,


		'U_SEND_PASSWORD' 		=> ($config['email_enable']) ? $controller_helper->route('phpbb_ucp_forgot_password_controller') : '',

		'U_SEND_PASSWORD' 		=> ($config['email_enable'] && $config['allow_password_reset']) ? $controller_helper->route('phpbb_ucp_forgot_password_controller') : '',

		'U_RESEND_ACTIVATION'	=> ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '',
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),
'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'),

		'U_RESEND_ACTIVATION'	=> ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '',
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),
'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'),

Line 2731Line 2746
		}

// Determine first occurrence, since in values the equal sign is allowed

		}

// Determine first occurrence, since in values the equal sign is allowed

		$key = htmlspecialchars(strtolower(trim(substr($line, 0, $delim_pos))));

		$key = htmlspecialchars(strtolower(trim(substr($line, 0, $delim_pos))), ENT_COMPAT);

		$value = trim(substr($line, $delim_pos + 1));

if (in_array($value, array('off', 'false', '0')))

		$value = trim(substr($line, $delim_pos + 1));

if (in_array($value, array('off', 'false', '0')))

Line 2748Line 2763
		}
else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"'))
{

		}
else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"'))
{

			$value = htmlspecialchars(substr($value, 1, strlen($value)-2));

			$value = htmlspecialchars(substr($value, 1, strlen($value)-2), ENT_COMPAT);

		}
else
{

		}
else
{

			$value = htmlspecialchars($value);

			$value = htmlspecialchars($value, ENT_COMPAT);

		}

$parsed_items[$key] = $value;

		}

$parsed_items[$key] = $value;

Line 2785Line 2800
	foreach ($backtrace as $trace)
{
// Strip the current directory from path

	foreach ($backtrace as $trace)
{
// Strip the current directory from path

		$trace['file'] = (empty($trace['file'])) ? '(not given by php)' : htmlspecialchars(phpbb_filter_root_path($trace['file']));

		$trace['file'] = (empty($trace['file'])) ? '(not given by php)' : htmlspecialchars(phpbb_filter_root_path($trace['file']), ENT_COMPAT);

		$trace['line'] = (empty($trace['line'])) ? '(not given by php)' : $trace['line'];

// Only show function arguments for include etc.

		$trace['line'] = (empty($trace['line'])) ? '(not given by php)' : $trace['line'];

// Only show function arguments for include etc.

Line 2793Line 2808
		$argument = '';
if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once')))
{

		$argument = '';
if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once')))
{

			$argument = htmlspecialchars(phpbb_filter_root_path($trace['args'][0]));

			$argument = htmlspecialchars(phpbb_filter_root_path($trace['args'][0]), ENT_COMPAT);

		}

$trace['class'] = (!isset($trace['class'])) ? '' : $trace['class'];

		}

$trace['class'] = (!isset($trace['class'])) ? '' : $trace['class'];

Line 2803Line 2818
		$output .= '<b>FILE:</b> ' . $trace['file'] . '<br />';
$output .= '<b>LINE:</b> ' . ((!empty($trace['line'])) ? $trace['line'] : '') . '<br />';


		$output .= '<b>FILE:</b> ' . $trace['file'] . '<br />';
$output .= '<b>LINE:</b> ' . ((!empty($trace['line'])) ? $trace['line'] : '') . '<br />';


		$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']);

		$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function'], ENT_COMPAT);

		$output .= '(' . (($argument !== '') ? "'$argument'" : '') . ')<br />';
}
$output .= '</div>';

		$output .= '(' . (($argument !== '') ? "'$argument'" : '') . ')<br />';
}
$output .= '</div>';

Line 2928Line 2943

/**
* Returns the first block of the specified IPv6 address and as many additional


/**
* Returns the first block of the specified IPv6 address and as many additional

* ones as specified in the length paramater.

* ones as specified in the length parameter.

* If length is zero, then an empty string is returned.
* If length is greater than 3 the complete IP will be returned
*/

* If length is zero, then an empty string is returned.
* If length is greater than 3 the complete IP will be returned
*/

Line 2937Line 2952
	if ($length < 1)
{
return '';

	if ($length < 1)
{
return '';

 
	}

// Handle IPv4 embedded IPv6 addresses
if (preg_match('/(?:\d{1,3}\.){3}\d{1,3}$/i', $ip))
{
$binary_ip = inet_pton($ip);
$ip_v6 = $binary_ip ? inet_ntop($binary_ip) : $ip;
$ip = $ip_v6 ?: $ip;

	}

// extend IPv6 addresses

	}

// extend IPv6 addresses

Line 3004Line 3027
	global $cache, $db, $auth, $template, $config, $user, $request;
global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log;
global $phpbb_container;

	global $cache, $db, $auth, $template, $config, $user, $request;
global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log;
global $phpbb_container;

 

// https://www.php.net/manual/en/language.operators.errorcontrol.php
// error_reporting() return a different error code inside the error handler after php 8.0
$suppresed = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
if (PHP_VERSION_ID < 80000)
{
$suppresed = 0;
}


// Do not display notices if we suppress them via @


// Do not display notices if we suppress them via @

	if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE)

	if (error_reporting() == $suppresed && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE)

	{
return;
}

	{
return;
}

Line 3024Line 3055

// Check the error reporting level and return if the error level does not match
// If DEBUG is defined the default level is E_ALL


// Check the error reporting level and return if the error level does not match
// If DEBUG is defined the default level is E_ALL

			if (($errno & ($phpbb_container->getParameter('debug.show_errors') ? E_ALL : error_reporting())) == 0)

			if (($errno & ($phpbb_container != null && $phpbb_container->getParameter('debug.show_errors') ? E_ALL : error_reporting())) == 0)

			{
return;
}

			{
return;
}

Line 3268Line 3299
	{
if ($phpbb_filesystem)
{

	{
if ($phpbb_filesystem)
{

			$root_path = $phpbb_filesystem->realpath(dirname(__FILE__) . '/../');

			$root_path = $phpbb_filesystem->realpath(__DIR__ . '/../');

		}
else
{
$filesystem = new \phpbb\filesystem\filesystem();

		}
else
{
$filesystem = new \phpbb\filesystem\filesystem();

			$root_path = $filesystem->realpath(dirname(__FILE__) . '/../');

			$root_path = $filesystem->realpath(__DIR__ . '/../');

		}
}


		}
}


Line 3580Line 3611
	return $data;
}


	return $data;
}


/**
* Login using http authenticate.
*
* @param array $param Parameter array, see $param_defaults array.
*
* @return null
*/
function phpbb_http_login($param)
{
global $auth, $user, $request;
global $config;

$param_defaults = array(
'auth_message' => '',

'autologin' => false,
'viewonline' => true,
'admin' => false,
);

// Overwrite default values with passed values
$param = array_merge($param_defaults, $param);

// User is already logged in
// We will not overwrite his session
if (!empty($user->data['is_registered']))
{
return;
}

// $_SERVER keys to check
$username_keys = array(
'PHP_AUTH_USER',
'Authorization',
'REMOTE_USER', 'REDIRECT_REMOTE_USER',
'HTTP_AUTHORIZATION', 'REDIRECT_HTTP_AUTHORIZATION',
'REMOTE_AUTHORIZATION', 'REDIRECT_REMOTE_AUTHORIZATION',
'AUTH_USER',
);

$password_keys = array(
'PHP_AUTH_PW',
'REMOTE_PASSWORD',
'AUTH_PASSWORD',
);

$username = null;
foreach ($username_keys as $k)
{
if ($request->is_set($k, \phpbb\request\request_interface::SERVER))
{
$username = htmlspecialchars_decode($request->server($k));
break;
}
}

$password = null;
foreach ($password_keys as $k)
{
if ($request->is_set($k, \phpbb\request\request_interface::SERVER))
{
$password = htmlspecialchars_decode($request->server($k));
break;
}
}

// Decode encoded information (IIS, CGI, FastCGI etc.)
if (!is_null($username) && is_null($password) && strpos($username, 'Basic ') === 0)
{
list($username, $password) = explode(':', base64_decode(substr($username, 6)), 2);
}

if (!is_null($username) && !is_null($password))
{
set_var($username, $username, 'string', true);
set_var($password, $password, 'string', true);

$auth_result = $auth->login($username, $password, $param['autologin'], $param['viewonline'], $param['admin']);

if ($auth_result['status'] == LOGIN_SUCCESS)
{
return;
}
else if ($auth_result['status'] == LOGIN_ERROR_ATTEMPTS)
{
send_status_line(401, 'Unauthorized');

trigger_error('NOT_AUTHORISED');
}
}

// Prepend sitename to auth_message
$param['auth_message'] = ($param['auth_message'] === '') ? $config['sitename'] : $config['sitename'] . ' - ' . $param['auth_message'];

// We should probably filter out non-ASCII characters - RFC2616
$param['auth_message'] = preg_replace('/[\x80-\xFF]/', '?', $param['auth_message']);

header('WWW-Authenticate: Basic realm="' . $param['auth_message'] . '"');
send_status_line(401, 'Unauthorized');

trigger_error('NOT_AUTHORISED');
}

 

/**
* Escapes and quotes a string for use as an HTML/XML attribute value.


/**
* Escapes and quotes a string for use as an HTML/XML attribute value.

Line 3728Line 3657
	}

return $data;

	}

return $data;

}

/**
* Converts query string (GET) parameters in request into hidden fields.
*
* Useful for forwarding GET parameters when submitting forms with GET method.
*
* It is possible to omit some of the GET parameters, which is useful if
* they are specified in the form being submitted.
*
* sid is always omitted.
*
* @param \phpbb\request\request $request Request object
* @param array $exclude A list of variable names that should not be forwarded
* @return string HTML with hidden fields
*/
function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
{
$names = $request->variable_names(\phpbb\request\request_interface::GET);
$hidden = '';
foreach ($names as $name)
{
// Sessions are dealt with elsewhere, omit sid always
if ($name == 'sid')
{
continue;
}

// Omit any additional parameters requested
if (!empty($exclude) && in_array($name, $exclude))
{
continue;
}

$escaped_name = phpbb_quoteattr($name);

// Note: we might retrieve the variable from POST or cookies
// here. To avoid exposing cookies, skip variables that are
// overwritten somewhere other than GET entirely.
$value = $request->variable($name, '', true);
$get_value = $request->variable($name, '', true, \phpbb\request\request_interface::GET);
if ($value === $get_value)
{
$escaped_value = phpbb_quoteattr($value);
$hidden .= "<input type='hidden' name=$escaped_name value=$escaped_value />";
}
}
return $hidden;

 
}

/**

}

/**

Line 3855Line 3736
	{
if ($lazy)
{

	{
if ($lazy)
{

			// Determine board url - we may need it later
$board_url = generate_board_url() . '/';

 
			// This path is sent with the base template paths in the assign_vars()
// call below. We need to correct it in case we are accessing from a
// controller because the web paths will be incorrect otherwise.
$phpbb_path_helper = $phpbb_container->get('path_helper');

			// This path is sent with the base template paths in the assign_vars()
// call below. We need to correct it in case we are accessing from a
// controller because the web paths will be incorrect otherwise.
$phpbb_path_helper = $phpbb_container->get('path_helper');

			$corrected_path = $phpbb_path_helper->get_web_root_path();

$web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;

			$web_path = $phpbb_path_helper->get_web_root_path();




$theme = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme';



$theme = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme';


Line 4034Line 3911
		}
}


		}
}


	$forum_id = $request->variable('f', 0);
$topic_id = $request->variable('t', 0);


	// Negative forum and topic IDs are not allowed
$forum_id = max(0, $request->variable('f', 0));
$topic_id = max(0, $request->variable('t', 0));


$s_feed_news = false;



$s_feed_news = false;


Line 4050Line 3928
		$db->sql_freeresult($result);
}


		$db->sql_freeresult($result);
}


	// Determine board url - we may need it later
$board_url = generate_board_url() . '/';

 
	// This path is sent with the base template paths in the assign_vars()
// call below. We need to correct it in case we are accessing from a
// controller because the web paths will be incorrect otherwise.
/* @var $phpbb_path_helper \phpbb\path_helper */
$phpbb_path_helper = $phpbb_container->get('path_helper');

	// This path is sent with the base template paths in the assign_vars()
// call below. We need to correct it in case we are accessing from a
// controller because the web paths will be incorrect otherwise.
/* @var $phpbb_path_helper \phpbb\path_helper */
$phpbb_path_helper = $phpbb_container->get('path_helper');

	$corrected_path = $phpbb_path_helper->get_web_root_path();
$web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;

	$web_path = $phpbb_path_helper->get_web_root_path();



// Send a proper content-language to the output
$user_lang = $user->lang['USER_LANG'];


// Send a proper content-language to the output
$user_lang = $user->lang['USER_LANG'];

Line 4161Line 4036
		'_SID'				=> $_SID,
'SESSION_ID' => $user->session_id,
'ROOT_PATH' => $web_path,

		'_SID'				=> $_SID,
'SESSION_ID' => $user->session_id,
'ROOT_PATH' => $web_path,

		'BOARD_URL'			=> $board_url,

		'BOARD_URL'			=> generate_board_url() . '/',


'L_LOGIN_LOGOUT' => $l_login_logout,
'L_INDEX' => ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['FORUM_INDEX'],


'L_LOGIN_LOGOUT' => $l_login_logout,
'L_INDEX' => ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['FORUM_INDEX'],

Line 4186Line 4061
		'U_SEARCH_UNANSWERED'	=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'),
'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'),
'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'),

		'U_SEARCH_UNANSWERED'	=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'),
'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'),
'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'),

		'U_DELETE_COOKIES'		=> append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'),

		'U_DELETE_COOKIES'		=> $controller_helper->route('phpbb_ucp_delete_cookies_controller'),

		'U_CONTACT_US'			=> ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '',
'U_TEAM' => (!$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'),
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),

		'U_CONTACT_US'			=> ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '',
'U_TEAM' => (!$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'),
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),

Line 4227Line 4102
		'S_ENABLE_FEEDS_TOPICS_ACTIVE'	=> ($config['feed_topics_active']) ? true : false,
'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false,


		'S_ENABLE_FEEDS_TOPICS_ACTIVE'	=> ($config['feed_topics_active']) ? true : false,
'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false,


		'S_LOAD_UNREADS'			=> ($config['load_unreads_search'] && ($config['load_anon_lastread'] || $user->data['is_registered'])) ? true : false,

		'S_LOAD_UNREADS'			=> (bool) $config['load_unreads_search'] && ($config['load_anon_lastread'] || !empty($user->data['is_registered'])),


'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),



'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),


Line 4245Line 4120
		'T_UPLOAD_PATH'			=> "{$web_path}{$config['upload_path']}/",
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
'T_STYLESHEET_LANG_LINK'=> "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],

		'T_UPLOAD_PATH'			=> "{$web_path}{$config['upload_path']}/",
'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'],
'T_STYLESHEET_LANG_LINK'=> "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'],

 


		'T_FONT_AWESOME_LINK'	=> !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$web_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'],

		'T_FONT_AWESOME_LINK'	=> !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$web_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'],

		'T_JQUERY_LINK'			=> !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery-3.4.1.min.js?assets_version=" . $config['assets_version'],



'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery-3.7.1.min.js?assets_version=" . $config['assets_version'],

		'S_ALLOW_CDN'			=> !empty($config['allow_cdn']),
'S_COOKIE_NOTICE' => !empty($config['cookie_notice']),


		'S_ALLOW_CDN'			=> !empty($config['allow_cdn']),
'S_COOKIE_NOTICE' => !empty($config['cookie_notice']),


Line 4315Line 4192
* @param \phpbb\request\request_interface		$request	Request object
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\db\driver\driver_interface $db Database connection

* @param \phpbb\request\request_interface		$request	Request object
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\db\driver\driver_interface $db Database connection

 
 *
* @deprecated 3.3.1 (To be removed: 4.0.0-a1); use controller helper's display_sql_report()

*/
function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db)
{
global $phpbb_container;


*/
function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db)
{
global $phpbb_container;


	if ($phpbb_container->getParameter('debug.sql_explain') && $request->variable('explain', false) && $auth->acl_get('a_'))
{
$db->sql_report('display');
}

	/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');

$controller_helper->display_sql_report();

}

/**

}

/**

Line 4403Line 4282
*/
function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
{

*/
function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
{

	global $db, $config, $template, $user, $auth, $cache, $phpEx;
global $request, $phpbb_dispatcher, $phpbb_admin_path;

	global $phpbb_dispatcher, $phpbb_container, $template;



// A listener can set this variable to `true` when it overrides this function
$page_footer_override = false;


// A listener can set this variable to `true` when it overrides this function
$page_footer_override = false;

Line 4426Line 4304
		return;
}


		return;
}


	phpbb_check_and_display_sql_report($request, $auth, $db);


	/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');





	$template->assign_vars(array(
'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher),
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Limited'),

'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '')
);

// Call cron-type script
$call_cron = false;
if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check'))
{
$call_cron = true;
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();

// Any old lock present?
if (!empty($config['cron_lock']))
{
$cron_time = explode(' ', $config['cron_lock']);

// If 1 hour lock is present we do not call cron.php
if ($cron_time[0] + 3600 >= $time_now)
{
$call_cron = false;
}
}
}

// Call cron job?
if ($call_cron)
{
global $phpbb_container;

/* @var $cron \phpbb\cron\manager */
$cron = $phpbb_container->get('cron.manager');
$task = $cron->find_one_ready_task();

if ($task)
{
$url = $task->get_url();
$template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />');
}
else
{
$cache->put('_cron.lock_check', true, 60);
}
}

	$controller_helper->display_footer($run_cron);
















































/**
* Execute code and/or modify output before displaying the template.


/**
* Execute code and/or modify output before displaying the template.

Line 4625Line 4458
	}
else
{

	}
else
{

		return 'mailto:' . htmlspecialchars($config['board_contact']);

		return 'mailto:' . htmlspecialchars($config['board_contact'], ENT_COMPAT);

	}
}


	}
}