mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/12487] Update PHP code
PHPBB3-12487
This commit is contained in:
parent
ef1be6e247
commit
63da128ee5
5 changed files with 25 additions and 89 deletions
|
@ -303,8 +303,7 @@ class acp_search
|
|||
}
|
||||
else
|
||||
{
|
||||
$starttime = explode(' ', microtime());
|
||||
$starttime = $starttime[1] + $starttime[0];
|
||||
$starttime = microtime(true);
|
||||
$row_count = 0;
|
||||
while (still_on_time() && $post_counter <= $this->max_post_id)
|
||||
{
|
||||
|
@ -336,8 +335,7 @@ class acp_search
|
|||
|
||||
if ($post_counter <= $this->max_post_id)
|
||||
{
|
||||
$mtime = explode(' ', microtime());
|
||||
$totaltime = $mtime[0] + $mtime[1] - $starttime;
|
||||
$totaltime = microtime(true) - $starttime;
|
||||
$rows_per_second = $row_count / $totaltime;
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter));
|
||||
trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second));
|
||||
|
@ -376,8 +374,7 @@ class acp_search
|
|||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$starttime = explode(' ', microtime());
|
||||
$starttime = $starttime[1] + $starttime[0];
|
||||
$starttime = microtime(true);
|
||||
$row_count = 0;
|
||||
while (still_on_time() && $post_counter <= $this->max_post_id)
|
||||
{
|
||||
|
@ -426,8 +423,7 @@ class acp_search
|
|||
|
||||
if ($post_counter <= $this->max_post_id)
|
||||
{
|
||||
$mtime = explode(' ', microtime());
|
||||
$totaltime = $mtime[0] + $mtime[1] - $starttime;
|
||||
$totaltime = microtime(true) - $starttime;
|
||||
$rows_per_second = $row_count / $totaltime;
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter));
|
||||
trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second));
|
||||
|
|
|
@ -376,8 +376,7 @@ function still_on_time($extra_time = 15)
|
|||
{
|
||||
static $max_execution_time, $start_time;
|
||||
|
||||
$time = explode(' ', microtime());
|
||||
$current_time = $time[0] + $time[1];
|
||||
$current_time = microtime(true);
|
||||
|
||||
if (empty($max_execution_time))
|
||||
{
|
||||
|
@ -802,7 +801,7 @@ function phpbb_own_realpath($path)
|
|||
|
||||
$max = sizeof($bits) - 1;
|
||||
|
||||
// Check if we are able to resolve symlinks, Windows cannot.
|
||||
// Check if we are able to resolve symlinks, Windows (prior to Vista and Server 2008) cannot.
|
||||
$symlink_resolve = (function_exists('readlink')) ? true : false;
|
||||
|
||||
foreach ($bits as $i => $bit)
|
||||
|
@ -3659,38 +3658,12 @@ function phpbb_checkdnsrr($host, $type = 'MX')
|
|||
return (@gethostbyname($host_fqdn) == $host_fqdn) ? false : true;
|
||||
}
|
||||
|
||||
// checkdnsrr() is available on Windows since PHP 5.3,
|
||||
// but until 5.3.3 it only works for MX records
|
||||
// See: http://bugs.php.net/bug.php?id=51844
|
||||
|
||||
// Call checkdnsrr() if
|
||||
// we're looking for an MX record or
|
||||
// we're not on Windows or
|
||||
// we're running a PHP version where #51844 has been fixed
|
||||
|
||||
// checkdnsrr() supports AAAA since 5.0.0
|
||||
// checkdnsrr() supports TXT since 5.2.4
|
||||
if (
|
||||
($type == 'MX' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.3', '>=')) &&
|
||||
($type != 'AAAA' || version_compare(PHP_VERSION, '5.0.0', '>=')) &&
|
||||
($type != 'TXT' || version_compare(PHP_VERSION, '5.2.4', '>=')) &&
|
||||
function_exists('checkdnsrr')
|
||||
)
|
||||
if (function_exists('checkdnsrr'))
|
||||
{
|
||||
return checkdnsrr($host_fqdn, $type);
|
||||
}
|
||||
|
||||
// dns_get_record() is available since PHP 5; since PHP 5.3 also on Windows,
|
||||
// but on Windows it does not work reliable for AAAA records before PHP 5.3.1
|
||||
|
||||
// Call dns_get_record() if
|
||||
// we're not looking for an AAAA record or
|
||||
// we're not on Windows or
|
||||
// we're running a PHP version where AAAA lookups work reliable
|
||||
if (
|
||||
($type != 'AAAA' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.1', '>=')) &&
|
||||
function_exists('dns_get_record')
|
||||
)
|
||||
if (function_exists('dns_get_record'))
|
||||
{
|
||||
// dns_get_record() expects an integer as second parameter
|
||||
// We have to convert the string $type to the corresponding integer constant.
|
||||
|
@ -3837,11 +3810,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
|||
$msg_text = $msg_long_text;
|
||||
}
|
||||
|
||||
if (!defined('E_DEPRECATED'))
|
||||
{
|
||||
define('E_DEPRECATED', 8192);
|
||||
}
|
||||
|
||||
switch ($errno)
|
||||
{
|
||||
case E_NOTICE:
|
||||
|
|
|
@ -87,8 +87,7 @@ class jabber
|
|||
*/
|
||||
static public function can_use_ssl()
|
||||
{
|
||||
// Will not work with PHP >= 5.2.1 or < 5.2.3RC2 until timeout problem with ssl hasn't been fixed (http://bugs.php.net/41236)
|
||||
return ((version_compare(PHP_VERSION, '5.2.1', '<') || version_compare(PHP_VERSION, '5.2.3RC2', '>=')) && @extension_loaded('openssl')) ? true : false;
|
||||
return @extension_loaded('openssl');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,8 +33,6 @@ class messenger
|
|||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
var $eol = "\n";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -44,10 +42,6 @@ class messenger
|
|||
|
||||
$this->use_queue = (!$config['email_package_size']) ? false : $use_queue;
|
||||
$this->subject = '';
|
||||
|
||||
// Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac)
|
||||
$this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL;
|
||||
$this->eol = (!$this->eol) ? "\n" : $this->eol;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -497,7 +491,7 @@ class messenger
|
|||
$this->from = $board_contact;
|
||||
}
|
||||
|
||||
$encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol;
|
||||
$encode_eol = ($config['smtp_delivery']) ? "\r\n" : PHP_EOL;
|
||||
|
||||
// Build to, cc and bcc strings
|
||||
$to = $cc = $bcc = '';
|
||||
|
@ -529,7 +523,7 @@ class messenger
|
|||
}
|
||||
else
|
||||
{
|
||||
$result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, $this->eol, $err_msg);
|
||||
$result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, PHP_EOL, $err_msg);
|
||||
}
|
||||
|
||||
if (!$result)
|
||||
|
@ -686,10 +680,6 @@ class queue
|
|||
|
||||
$this->data = array();
|
||||
$this->cache_file = "{$phpbb_root_path}cache/queue.$phpEx";
|
||||
|
||||
// Determine EOL character (\n for UNIX, \r\n for Windows and \r for Mac)
|
||||
$this->eol = (!defined('PHP_EOL')) ? (($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win') ? "\r\n" : (($eol == 'mac') ? "\r" : "\n") : PHP_EOL;
|
||||
$this->eol = (!$this->eol) ? "\n" : $this->eol;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -822,7 +812,7 @@ class queue
|
|||
}
|
||||
else
|
||||
{
|
||||
$result = phpbb_mail($to, $subject, $msg, $headers, $this->eol, $err_msg);
|
||||
$result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg);
|
||||
}
|
||||
|
||||
if (!$result)
|
||||
|
|
|
@ -19,10 +19,6 @@ if (!defined('IN_PHPBB'))
|
|||
}
|
||||
|
||||
// Report all errors, except notices and deprecation messages
|
||||
if (!defined('E_DEPRECATED'))
|
||||
{
|
||||
define('E_DEPRECATED', 8192);
|
||||
}
|
||||
$level = E_ALL & ~E_NOTICE & ~E_DEPRECATED;
|
||||
error_reporting($level);
|
||||
|
||||
|
@ -105,33 +101,21 @@ else
|
|||
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
|
||||
}
|
||||
|
||||
// Prevent date/time functions from throwing E_WARNING on PHP 5.3 by setting a default timezone
|
||||
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get'))
|
||||
{
|
||||
// For PHP 5.1.0 the date/time functions have been rewritten
|
||||
// and setting a timezone is required prior to calling any date/time function.
|
||||
// In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems
|
||||
// because we show E_WARNING errors and do not set a default timezone.
|
||||
// This is because we have our own timezone handling and work in UTC only anyway.
|
||||
|
||||
// Since PHP 5.2.0 calls to date/time functions without having a timezone set
|
||||
// result in E_STRICT errors being thrown.
|
||||
// Note: We already exclude E_STRICT errors
|
||||
// (to be exact: they are not included in E_ALL in PHP 5.2)
|
||||
// So what we basically want to do is set our timezone to UTC,
|
||||
// but we don't know what other scripts (such as bridges) are involved,
|
||||
// so we check whether a timezone is already set by calling date_default_timezone_get().
|
||||
|
||||
// In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems
|
||||
// because we show E_WARNING errors and do not set a default timezone.
|
||||
// This is because we have our own timezone handling and work in UTC only anyway.
|
||||
// Unfortunately, date_default_timezone_get() itself might throw E_WARNING
|
||||
// if no timezone has been set, so we have to keep it quiet with @.
|
||||
|
||||
// So what we basically want to do is set our timezone to UTC,
|
||||
// but we don't know what other scripts (such as bridges) are involved,
|
||||
// so we check whether a timezone is already set by calling date_default_timezone_get().
|
||||
|
||||
// Unfortunately, date_default_timezone_get() itself might throw E_WARNING
|
||||
// if no timezone has been set, so we have to keep it quiet with @.
|
||||
|
||||
// date_default_timezone_get() tries to guess the correct timezone first
|
||||
// and then falls back to UTC when everything fails.
|
||||
// We just set the timezone to whatever date_default_timezone_get() returns.
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
}
|
||||
// date_default_timezone_get() tries to guess the correct timezone first
|
||||
// and then falls back to UTC when everything fails.
|
||||
// We just set the timezone to whatever date_default_timezone_get() returns.
|
||||
date_default_timezone_set(@date_default_timezone_get());
|
||||
|
||||
// Autoloading of dependencies.
|
||||
// Three options are supported:
|
||||
|
@ -168,5 +152,4 @@ else
|
|||
require($phpbb_root_path . 'vendor/autoload.php');
|
||||
}
|
||||
|
||||
$starttime = explode(' ', microtime());
|
||||
$starttime = $starttime[1] + $starttime[0];
|
||||
$starttime = microtime(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue