mirror of
https://github.com/roundcube/roundcubemail.git
synced 2025-12-28 07:55:07 +00:00
Refer native constants unambiguously (#9275)
* Fix "native_constant_invocation" CS * "self_accessor" was fixed in 9269 PR * "php_unit_strict" was fixed in 9268 PR
This commit is contained in:
parent
9ea87a14b2
commit
3e458fa5fd
@ -31,7 +31,25 @@ return (new PhpCsFixer\Config())
|
||||
'equal' => false,
|
||||
'identical' => false,
|
||||
],
|
||||
'native_constant_invocation' => true,
|
||||
'native_constant_invocation' => [
|
||||
'include' => [
|
||||
// https://github.com/php/php-src/commit/2475337bd8a0fad0dac03db3f5e7e9d331d53653
|
||||
'LOG_LOCAL0',
|
||||
'LOG_LOCAL1',
|
||||
'LOG_LOCAL2',
|
||||
'LOG_LOCAL3',
|
||||
'LOG_LOCAL4',
|
||||
'LOG_LOCAL5',
|
||||
'LOG_LOCAL6',
|
||||
'LOG_LOCAL7',
|
||||
// https://github.com/php/php-src/blob/php-8.3.0/ext/ldap/ldap.stub.php#L104
|
||||
'LDAP_OPT_PROTOCOL_VERSION',
|
||||
// https://github.com/php/pecl-text-pspell/blob/1.0.1/pspell.stub.php#L24
|
||||
'PSPELL_FAST',
|
||||
// https://github.com/websupport-sk/pecl-memcache/blob/8.2/src/memcache.c#L755
|
||||
'MEMCACHE_COMPRESSED',
|
||||
],
|
||||
],
|
||||
'native_function_invocation' => false,
|
||||
'void_return' => false,
|
||||
'blank_line_before_statement' => [
|
||||
@ -78,7 +96,6 @@ return (new PhpCsFixer\Config())
|
||||
'increment_style' => false,
|
||||
'method_argument_space' => false,
|
||||
'modernize_types_casting' => false,
|
||||
'native_constant_invocation' => false,
|
||||
'new_with_parentheses' => false,
|
||||
'no_blank_lines_after_phpdoc' => false,
|
||||
'no_break_comment' => false,
|
||||
@ -94,10 +111,8 @@ return (new PhpCsFixer\Config())
|
||||
// TODO - risky
|
||||
'no_unset_on_property' => false,
|
||||
'php_unit_data_provider_name' => false,
|
||||
'php_unit_strict' => false,
|
||||
'php_unit_test_case_static_method_calls' => false,
|
||||
'random_api_migration' => false,
|
||||
'self_accessor' => false,
|
||||
'strict_param' => false,
|
||||
])
|
||||
->setFinder($finder)
|
||||
|
||||
@ -33,7 +33,7 @@ function print_usage()
|
||||
|
||||
function _die($msg, $usage = false)
|
||||
{
|
||||
fwrite(STDERR, $msg . "\n");
|
||||
fwrite(\STDERR, $msg . "\n");
|
||||
if ($usage) {
|
||||
print_usage();
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ function add_identity($options)
|
||||
}
|
||||
if (isset($options['is_default'])) {
|
||||
validate_boolean($options['is_default'], 'is default identity (S)');
|
||||
$setAsDefault = filter_var($options['is_default'], FILTER_VALIDATE_BOOLEAN);
|
||||
$setAsDefault = filter_var($options['is_default'], \FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
$new_identity['email'] = get_option_value($options, 'email', '', false, true, "Enter the email e.g. -e somemail@example.com");
|
||||
@ -241,7 +241,7 @@ function update_identity($options)
|
||||
$setAsDefault = false;
|
||||
if (isset($options['is_default'])) {
|
||||
validate_boolean($options['is_default'], 'is default identity (S)');
|
||||
$setAsDefault = filter_var($options['is_default'], FILTER_VALIDATE_BOOLEAN);
|
||||
$setAsDefault = filter_var($options['is_default'], \FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
$email = get_option_value($options, 'email', null, false, false);
|
||||
@ -324,7 +324,7 @@ function get_option_value($options, $key, $fallback, $isBoolean, $isMandatory, $
|
||||
|
||||
function validate_email($email, $fieldName)
|
||||
{
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
if (!filter_var($email, \FILTER_VALIDATE_EMAIL)) {
|
||||
rcube::raise_error("invalid {$fieldName} format", false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ if (!file_exists($opts['dir'])) {
|
||||
$db = rcmail_utils::db();
|
||||
|
||||
if (!empty($opts['update']) && in_array($db->table_name('system'), (array) $db->list_tables())) {
|
||||
echo "Checking for database schema updates..." . PHP_EOL;
|
||||
echo "Checking for database schema updates..." . \PHP_EOL;
|
||||
rcmail_utils::db_update($opts['dir'], 'roundcube', null, ['errors' => true]);
|
||||
} else {
|
||||
rcmail_utils::db_init($opts['dir']);
|
||||
|
||||
@ -159,7 +159,7 @@ function extract_filetype($package, &$filetype = null)
|
||||
{
|
||||
global $CACHEDIR;
|
||||
|
||||
$filetype = pathinfo(preg_replace('/[?&].*$/', '', $package['url']), PATHINFO_EXTENSION) ?: 'tmp';
|
||||
$filetype = pathinfo(preg_replace('/[?&].*$/', '', $package['url']), \PATHINFO_EXTENSION) ?: 'tmp';
|
||||
$cache_file = $CACHEDIR . '/' . $package['lib'] . '-' . $package['version'] . '.' . $filetype;
|
||||
|
||||
// Make sure it is a zip file
|
||||
@ -241,7 +241,7 @@ function extract_zipfile($package, $srcfile)
|
||||
// map source to dest files/directories
|
||||
if (!empty($package['map'])) {
|
||||
// get the root folder of the extracted package
|
||||
$extract_tree = glob("$extract/*", GLOB_ONLYDIR);
|
||||
$extract_tree = glob("$extract/*", \GLOB_ONLYDIR);
|
||||
$sourcedir = count($extract_tree) ? $extract_tree[0] : $extract;
|
||||
|
||||
foreach ($package['map'] as $src => $dest) {
|
||||
@ -308,7 +308,7 @@ function delete_destfile($package)
|
||||
$destdir = INSTALL_PATH . (!empty($package['rm']) ? $package['rm'] : $package['dest']);
|
||||
|
||||
if (file_exists($destdir)) {
|
||||
if (PHP_OS === 'Windows') {
|
||||
if (\PHP_OS === 'Windows') {
|
||||
exec(sprintf("rd /s /q %s", escapeshellarg($destdir)));
|
||||
}
|
||||
else {
|
||||
|
||||
@ -53,7 +53,7 @@ else {
|
||||
echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
|
||||
}
|
||||
|
||||
$input = $accept ?: trim(fgets(STDIN));
|
||||
$input = $accept ?: trim(fgets(\STDIN));
|
||||
|
||||
if (strtolower($input) == 'y') {
|
||||
echo "Copying files to target location...";
|
||||
|
||||
@ -31,7 +31,7 @@ function print_usage()
|
||||
|
||||
function vputs($str)
|
||||
{
|
||||
$out = !empty($GLOBALS['args']['file']) ? STDOUT : STDERR;
|
||||
$out = !empty($GLOBALS['args']['file']) ? \STDOUT : \STDERR;
|
||||
fwrite($out, $str);
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ function export_mailbox($mbox, $filename)
|
||||
vputs("Writing to $filename\n");
|
||||
}
|
||||
else {
|
||||
$out = STDOUT;
|
||||
$out = \STDOUT;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
@ -100,7 +100,7 @@ elseif (!$args['host']) {
|
||||
// prompt for username if not set
|
||||
if (empty($args['user'])) {
|
||||
vputs("IMAP user: ");
|
||||
$args['user'] = trim(fgets(STDIN));
|
||||
$args['user'] = trim(fgets(\STDIN));
|
||||
}
|
||||
|
||||
// prompt for password
|
||||
|
||||
@ -50,7 +50,7 @@ elseif (!is_file($args['file'])) {
|
||||
if (empty($args['user'])) {
|
||||
//fwrite(STDOUT, "Please enter your name\n");
|
||||
echo "IMAP user: ";
|
||||
$args['user'] = trim(fgets(STDIN));
|
||||
$args['user'] = trim(fgets(\STDIN));
|
||||
}
|
||||
|
||||
// prompt for password
|
||||
|
||||
@ -30,7 +30,7 @@ $opts = rcube_utils::get_opt(['v' => 'version', 'y' => 'accept:bool']);
|
||||
if (empty($opts['version'])) {
|
||||
echo "What version are you upgrading from? Type '?' if you don't know.\n";
|
||||
|
||||
if (($input = trim(fgets(STDIN))) && preg_match('/^[0-9.]+[a-z0-9-]*$/', $input)) {
|
||||
if (($input = trim(fgets(\STDIN))) && preg_match('/^[0-9.]+[a-z0-9-]*$/', $input)) {
|
||||
$opts['version'] = $input;
|
||||
}
|
||||
else {
|
||||
@ -82,7 +82,7 @@ if ($RCI->configured) {
|
||||
if ($err) {
|
||||
if (empty($opts['accept'])) {
|
||||
echo "Do you want me to fix your local configuration? (y/N)\n";
|
||||
$input = trim(fgets(STDIN));
|
||||
$input = trim(fgets(\STDIN));
|
||||
}
|
||||
|
||||
// positive: merge the local config with the defaults
|
||||
@ -248,7 +248,7 @@ if ($RCI->configured) {
|
||||
$composer_data['repositories'] = array_values($composer_data['repositories']);
|
||||
}
|
||||
|
||||
$composer_json = json_encode($composer_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
$composer_json = json_encode($composer_data, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES);
|
||||
|
||||
// write updated composer.json back to disk
|
||||
if ($composer_json && is_writable(INSTALL_PATH . 'composer.json')) {
|
||||
|
||||
@ -30,8 +30,8 @@ if (empty($opts['dir'])) {
|
||||
|
||||
$dir = INSTALL_PATH . 'skins';
|
||||
$dir_p = INSTALL_PATH . 'plugins';
|
||||
$skins = glob("$dir/*", GLOB_ONLYDIR);
|
||||
$skins_p = glob("$dir_p/*/skins/*", GLOB_ONLYDIR);
|
||||
$skins = glob("$dir/*", \GLOB_ONLYDIR);
|
||||
$skins_p = glob("$dir_p/*/skins/*", \GLOB_ONLYDIR);
|
||||
|
||||
$dirs = array_merge($skins, $skins_p);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ $config['syslog_id'] = 'roundcube';
|
||||
|
||||
// Syslog facility to use, if using the 'syslog' log driver.
|
||||
// For possible values see installer or http://php.net/manual/en/function.openlog.php
|
||||
$config['syslog_facility'] = LOG_USER;
|
||||
$config['syslog_facility'] = \LOG_USER;
|
||||
|
||||
// Activate this option if logs should be written to per-user directories.
|
||||
// Data will only be logged if a directory <log_dir>/<username>/ exists and is writable.
|
||||
|
||||
@ -107,11 +107,11 @@ echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 3 : 2) .
|
||||
<?php
|
||||
|
||||
define('MIN_PHP_VERSION', '7.3.0');
|
||||
if (version_compare(PHP_VERSION, MIN_PHP_VERSION, '>=')) {
|
||||
$RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
|
||||
if (version_compare(\PHP_VERSION, MIN_PHP_VERSION, '>=')) {
|
||||
$RCI->pass('Version', 'PHP ' . \PHP_VERSION . ' detected');
|
||||
}
|
||||
else {
|
||||
$RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
|
||||
$RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . \PHP_VERSION . ' detected');
|
||||
}
|
||||
?>
|
||||
|
||||
@ -122,13 +122,13 @@ else {
|
||||
// get extensions location
|
||||
$ext_dir = ini_get('extension_dir');
|
||||
|
||||
$prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
|
||||
$prefix = \PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
|
||||
foreach ($required_php_exts as $name => $ext) {
|
||||
if (extension_loaded($ext)) {
|
||||
$RCI->pass($name);
|
||||
}
|
||||
else {
|
||||
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
|
||||
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . \PHP_SHLIB_SUFFIX;
|
||||
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
|
||||
$RCI->fail($name, $msg, $source_urls[$name]);
|
||||
}
|
||||
@ -145,7 +145,7 @@ foreach ($optional_php_exts as $name => $ext) {
|
||||
$RCI->pass($name);
|
||||
}
|
||||
else {
|
||||
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
|
||||
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . \PHP_SHLIB_SUFFIX;
|
||||
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
|
||||
$RCI->na($name, $msg, $source_urls[$name]);
|
||||
}
|
||||
@ -159,14 +159,14 @@ foreach ($optional_php_exts as $name => $ext) {
|
||||
|
||||
<?php
|
||||
|
||||
$prefix = PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
|
||||
$prefix = \PHP_SHLIB_SUFFIX === 'dll' ? 'php_' : '';
|
||||
foreach ($RCI->supported_dbs as $database => $ext) {
|
||||
if (extension_loaded($ext)) {
|
||||
$RCI->pass($database);
|
||||
$found_db_driver = true;
|
||||
}
|
||||
else {
|
||||
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
|
||||
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . \PHP_SHLIB_SUFFIX;
|
||||
$msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
|
||||
$RCI->na($database, $msg, $source_urls[$ext]);
|
||||
}
|
||||
@ -220,7 +220,7 @@ foreach ($ini_checks as $var => $val) {
|
||||
$RCI->pass($var);
|
||||
}
|
||||
}
|
||||
elseif (filter_var($status, FILTER_VALIDATE_BOOLEAN) == $val) {
|
||||
elseif (filter_var($status, \FILTER_VALIDATE_BOOLEAN) == $val) {
|
||||
$RCI->pass($var);
|
||||
}
|
||||
else {
|
||||
@ -260,7 +260,7 @@ foreach ($optional_checks as $var => $val) {
|
||||
$RCI->pass($var);
|
||||
}
|
||||
}
|
||||
elseif (filter_var($status, FILTER_VALIDATE_BOOLEAN) == $val) {
|
||||
elseif (filter_var($status, \FILTER_VALIDATE_BOOLEAN) == $val) {
|
||||
$RCI->pass($var);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -235,21 +235,21 @@ echo $input_syslogid->show($RCI->getprop('syslog_id', 'roundcube'));
|
||||
<?php
|
||||
|
||||
$input_syslogfacility = new html_select(['name' => '_syslog_facility', 'id' => 'cfgsyslogfacility']);
|
||||
$input_syslogfacility->add('user-level messages', LOG_USER);
|
||||
$input_syslogfacility->add('user-level messages', \LOG_USER);
|
||||
if (defined('LOG_MAIL')) {
|
||||
$input_syslogfacility->add('mail subsystem', LOG_MAIL);
|
||||
$input_syslogfacility->add('mail subsystem', \LOG_MAIL);
|
||||
}
|
||||
if (defined('LOG_LOCAL0')) {
|
||||
$input_syslogfacility->add('local level 0', LOG_LOCAL0);
|
||||
$input_syslogfacility->add('local level 1', LOG_LOCAL1);
|
||||
$input_syslogfacility->add('local level 2', LOG_LOCAL2);
|
||||
$input_syslogfacility->add('local level 3', LOG_LOCAL3);
|
||||
$input_syslogfacility->add('local level 4', LOG_LOCAL4);
|
||||
$input_syslogfacility->add('local level 5', LOG_LOCAL5);
|
||||
$input_syslogfacility->add('local level 6', LOG_LOCAL6);
|
||||
$input_syslogfacility->add('local level 7', LOG_LOCAL7);
|
||||
$input_syslogfacility->add('local level 0', \LOG_LOCAL0);
|
||||
$input_syslogfacility->add('local level 1', \LOG_LOCAL1);
|
||||
$input_syslogfacility->add('local level 2', \LOG_LOCAL2);
|
||||
$input_syslogfacility->add('local level 3', \LOG_LOCAL3);
|
||||
$input_syslogfacility->add('local level 4', \LOG_LOCAL4);
|
||||
$input_syslogfacility->add('local level 5', \LOG_LOCAL5);
|
||||
$input_syslogfacility->add('local level 6', \LOG_LOCAL6);
|
||||
$input_syslogfacility->add('local level 7', \LOG_LOCAL7);
|
||||
}
|
||||
echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), LOG_USER);
|
||||
echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), \LOG_USER);
|
||||
|
||||
?>
|
||||
<div>What ID to use when logging with syslog. Note that this only applies if you are using the 'syslog' log_driver.</div>
|
||||
|
||||
@ -52,7 +52,7 @@ $RCI->load_config();
|
||||
if (isset($_GET['_getconfig'])) {
|
||||
$filename = 'config.inc.php';
|
||||
if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) {
|
||||
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
|
||||
$path = sys_get_temp_dir() . \DIRECTORY_SEPARATOR . $filename;
|
||||
@unlink($path);
|
||||
file_put_contents($path, $_SESSION['config']);
|
||||
exit;
|
||||
|
||||
@ -128,7 +128,7 @@ class acl extends rcube_plugin
|
||||
|
||||
if (count($users)) {
|
||||
// sort users index
|
||||
asort($keys, SORT_LOCALE_STRING);
|
||||
asort($keys, \SORT_LOCALE_STRING);
|
||||
// re-sort users according to index
|
||||
foreach ($keys as $idx => $val) {
|
||||
$keys[$idx] = $users[$idx];
|
||||
|
||||
@ -107,7 +107,7 @@ class enigma extends rcube_plugin
|
||||
$this->env_loaded = true;
|
||||
|
||||
// Add include path for Enigma classes and drivers
|
||||
$include_path = $this->home . '/lib' . PATH_SEPARATOR;
|
||||
$include_path = $this->home . '/lib' . \PATH_SEPARATOR;
|
||||
$include_path .= ini_get('include_path');
|
||||
set_include_path($include_path);
|
||||
|
||||
|
||||
@ -633,7 +633,7 @@ class enigma_driver_gnupg extends enigma_driver
|
||||
|
||||
$tmpfile = $file . '.tmp';
|
||||
|
||||
if (file_put_contents($tmpfile, $data, LOCK_EX) === strlen($data)) {
|
||||
if (file_put_contents($tmpfile, $data, \LOCK_EX) === strlen($data)) {
|
||||
rename($tmpfile, $file);
|
||||
touch($file, $record['mtime']);
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ class enigma_driver_phpssl extends enigma_driver
|
||||
|
||||
if ($sig !== true) {
|
||||
// try without certificate verification
|
||||
$sig = openssl_pkcs7_verify($msg_file, PKCS7_NOVERIFY, $cert_file);
|
||||
$sig = openssl_pkcs7_verify($msg_file, \PKCS7_NOVERIFY, $cert_file);
|
||||
$validity = enigma_error::UNVERIFIED;
|
||||
}
|
||||
|
||||
|
||||
@ -1059,7 +1059,7 @@ class enigma_engine
|
||||
|
||||
// Use the most recent one
|
||||
if (count($found) > 1) {
|
||||
ksort($found, SORT_NUMERIC);
|
||||
ksort($found, \SORT_NUMERIC);
|
||||
}
|
||||
|
||||
$ret = count($found) > 0 ? array_pop($found) : null;
|
||||
@ -1409,7 +1409,7 @@ class enigma_engine
|
||||
public function delete_user_data($username)
|
||||
{
|
||||
$homedir = $this->rc->config->get('enigma_pgp_homedir', INSTALL_PATH . 'plugins/enigma/home');
|
||||
$homedir .= DIRECTORY_SEPARATOR . $username;
|
||||
$homedir .= \DIRECTORY_SEPARATOR . $username;
|
||||
|
||||
return file_exists($homedir) ? self::delete_dir($homedir) : true;
|
||||
}
|
||||
@ -1431,7 +1431,7 @@ class enigma_engine
|
||||
if ($content = scandir($dir)) {
|
||||
foreach ($content as $filename) {
|
||||
if ($filename != '.' && $filename != '..') {
|
||||
$filename = $dir . DIRECTORY_SEPARATOR . $filename;
|
||||
$filename = $dir . \DIRECTORY_SEPARATOR . $filename;
|
||||
|
||||
if (is_dir($filename)) {
|
||||
self::delete_dir($filename);
|
||||
@ -1506,7 +1506,7 @@ class enigma_engine
|
||||
$fqdn = sha1($local) . '._woat.' . $domain;
|
||||
|
||||
// Fetch the TXT record(s)
|
||||
if (($records = dns_get_record($fqdn, DNS_TXT)) === false) {
|
||||
if (($records = dns_get_record($fqdn, \DNS_TXT)) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -196,7 +196,7 @@ class filesystem_attachments extends rcube_plugin
|
||||
|
||||
$rcmail = rcube::get_instance();
|
||||
$temp_dir = $rcmail->config->get('temp_dir');
|
||||
$file_path = pathinfo($path, PATHINFO_DIRNAME);
|
||||
$file_path = pathinfo($path, \PATHINFO_DIRNAME);
|
||||
|
||||
if ($temp_dir !== $file_path) {
|
||||
// When the configured directory is not writable, or out of open_basedir path
|
||||
|
||||
@ -175,7 +175,7 @@ class identicon_engine
|
||||
|
||||
// generate an image and save it to a variable
|
||||
ob_start();
|
||||
imagepng($image, null, 6, PNG_ALL_FILTERS);
|
||||
imagepng($image, null, 6, \PNG_ALL_FILTERS);
|
||||
$this->binary = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
@ -538,7 +538,7 @@ class rcube_sieve_engine
|
||||
]);
|
||||
|
||||
// check request size limit
|
||||
if ($max_post && count($_POST, COUNT_RECURSIVE) >= $max_post) {
|
||||
if ($max_post && count($_POST, \COUNT_RECURSIVE) >= $max_post) {
|
||||
rcube::raise_error([
|
||||
'code' => 500, 'file' => __FILE__, 'line' => __LINE__,
|
||||
'message' => "Request size limit exceeded (one of max_input_vars/suhosin.request.max_vars/suhosin.post.max_vars)",
|
||||
@ -607,7 +607,7 @@ class rcube_sieve_engine
|
||||
if (!$error && empty($this->errors)) {
|
||||
// Find position of the new script on the list
|
||||
$list[] = $name;
|
||||
asort($list, SORT_LOCALE_STRING);
|
||||
asort($list, \SORT_LOCALE_STRING);
|
||||
$list = array_values($list);
|
||||
$index = array_search($name, $list);
|
||||
|
||||
@ -1341,7 +1341,7 @@ class rcube_sieve_engine
|
||||
$list = $this->list_scripts();
|
||||
|
||||
if ($list) {
|
||||
asort($list, SORT_LOCALE_STRING);
|
||||
asort($list, \SORT_LOCALE_STRING);
|
||||
}
|
||||
|
||||
if (!empty($attrib['type']) && $attrib['type'] == 'list') {
|
||||
@ -1482,7 +1482,7 @@ class rcube_sieve_engine
|
||||
$select = new html_select(['name' => '_copy', 'id' => '_copy', 'class' => 'custom-select']);
|
||||
|
||||
if (is_array($list)) {
|
||||
asort($list, SORT_LOCALE_STRING);
|
||||
asort($list, \SORT_LOCALE_STRING);
|
||||
|
||||
if (!$copy && isset($_SESSION['managesieve_current'])) {
|
||||
$copy = $_SESSION['managesieve_current'];
|
||||
@ -3101,7 +3101,7 @@ class rcube_sieve_engine
|
||||
$list[] = $name;
|
||||
|
||||
// Sort and find current script position
|
||||
asort($list, SORT_LOCALE_STRING);
|
||||
asort($list, \SORT_LOCALE_STRING);
|
||||
$list = array_values($list);
|
||||
$index = array_search($name, $list);
|
||||
|
||||
|
||||
@ -1278,7 +1278,7 @@ class rcube_sieve_script
|
||||
*/
|
||||
static function escape_multiline_string($str)
|
||||
{
|
||||
$str = preg_split('/(\r?\n)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$str = preg_split('/(\r?\n)/', $str, -1, \PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
foreach ($str as $idx => $line) {
|
||||
// dot-stuffing
|
||||
@ -1397,7 +1397,7 @@ class rcube_sieve_script
|
||||
}
|
||||
|
||||
// tag/identifier/number
|
||||
if (preg_match('/[a-zA-Z0-9:_]+/', $str, $m, PREG_OFFSET_CAPTURE, $position)
|
||||
if (preg_match('/[a-zA-Z0-9:_]+/', $str, $m, \PREG_OFFSET_CAPTURE, $position)
|
||||
&& $m[0][1] == $position
|
||||
) {
|
||||
$atom = $m[0][0];
|
||||
|
||||
@ -284,7 +284,7 @@ class managesieve extends rcube_plugin
|
||||
{
|
||||
if (!$this->engine) {
|
||||
// Add include path for internal classes
|
||||
$include_path = $this->home . '/lib' . PATH_SEPARATOR;
|
||||
$include_path = $this->home . '/lib' . \PATH_SEPARATOR;
|
||||
$include_path .= ini_get('include_path');
|
||||
set_include_path($include_path);
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class markasjunk_cmd_learn
|
||||
}
|
||||
|
||||
if (strpos($command, '%h') !== false) {
|
||||
preg_match_all('/%h:([\w_-]+)/', $command, $header_names, PREG_SET_ORDER);
|
||||
preg_match_all('/%h:([\w_-]+)/', $command, $header_names, \PREG_SET_ORDER);
|
||||
$header_names = array_column($header_names, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -124,14 +124,14 @@ class rcube_cpanel_password
|
||||
$postfields = http_build_query($postdata, '', '&');
|
||||
|
||||
// see http://php.net/manual/en/function.curl-setopt.php
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_BUFFERSIZE, 131072);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $userpwd);
|
||||
curl_setopt($ch, \CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, \CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, \CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, \CURLOPT_BUFFERSIZE, 131072);
|
||||
curl_setopt($ch, \CURLOPT_URL, $url);
|
||||
curl_setopt($ch, \CURLOPT_POST, 1);
|
||||
curl_setopt($ch, \CURLOPT_POSTFIELDS, $postfields);
|
||||
curl_setopt($ch, \CURLOPT_USERPWD, $userpwd);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
$error = curl_error($ch);
|
||||
|
||||
@ -245,30 +245,30 @@ class HTTPSocket
|
||||
$ch = curl_init($this->remote_host . ':' . $this->remote_port . $request);
|
||||
|
||||
if ($is_ssl) {
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //1
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //2
|
||||
curl_setopt($ch, \CURLOPT_SSL_VERIFYPEER, false); //1
|
||||
curl_setopt($ch, \CURLOPT_SSL_VERIFYHOST, false); //2
|
||||
//curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "HTTPSocket/$this->version");
|
||||
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_1_1);
|
||||
curl_setopt($ch, \CURLOPT_RETURNTRANSFER,1);
|
||||
curl_setopt($ch, \CURLOPT_USERAGENT, "HTTPSocket/$this->version");
|
||||
curl_setopt($ch, \CURLOPT_FORBID_REUSE, 1);
|
||||
curl_setopt($ch, \CURLOPT_TIMEOUT, 100);
|
||||
curl_setopt($ch, \CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, \CURLOPT_HEADER, 1);
|
||||
|
||||
curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 512);
|
||||
curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, 120);
|
||||
curl_setopt($ch, \CURLOPT_LOW_SPEED_LIMIT, 512);
|
||||
curl_setopt($ch, \CURLOPT_LOW_SPEED_TIME, 120);
|
||||
|
||||
// instance connection
|
||||
if ($this->bind_host) {
|
||||
curl_setopt($ch, CURLOPT_INTERFACE, $this->bind_host);
|
||||
curl_setopt($ch, \CURLOPT_INTERFACE, $this->bind_host);
|
||||
}
|
||||
|
||||
// if we have a username and password, add the header
|
||||
if (isset($this->remote_uname) && isset($this->remote_passwd)) {
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $this->remote_uname . ':' . $this->remote_passwd);
|
||||
curl_setopt($ch, \CURLOPT_USERPWD, $this->remote_uname . ':' . $this->remote_passwd);
|
||||
}
|
||||
|
||||
// for DA skins: if $this->remote_passwd is NULL, try to use the login key system
|
||||
@ -278,25 +278,25 @@ class HTTPSocket
|
||||
|
||||
// if method is POST, add content length & type headers
|
||||
if ($this->method == 'POST') {
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
|
||||
curl_setopt($ch, \CURLOPT_POST, 1);
|
||||
curl_setopt($ch, \CURLOPT_POSTFIELDS, $content);
|
||||
|
||||
//$array_headers['Content-type'] = 'application/x-www-form-urlencoded';
|
||||
$array_headers['Content-length'] = strlen($content);
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $array_headers);
|
||||
curl_setopt($ch, \CURLOPT_HTTPHEADER, $array_headers);
|
||||
|
||||
if (!($this->result = curl_exec($ch))) {
|
||||
$this->error[] = curl_error($ch);
|
||||
$OK = false;
|
||||
}
|
||||
|
||||
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$header_size = curl_getinfo($ch, \CURLINFO_HEADER_SIZE);
|
||||
$this->result_header = substr($this->result, 0, $header_size);
|
||||
$this->result_body = substr($this->result, $header_size);
|
||||
$this->result_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$this->lastTransferSpeed = curl_getinfo($ch, CURLINFO_SPEED_DOWNLOAD) / 1024;
|
||||
$this->result_status_code = curl_getinfo($ch, \CURLINFO_HTTP_CODE);
|
||||
$this->lastTransferSpeed = curl_getinfo($ch, \CURLINFO_SPEED_DOWNLOAD) / 1024;
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
@ -35,10 +35,10 @@ class rcube_domainfactory_password
|
||||
if ($ch = curl_init()) {
|
||||
// initial login
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_URL => 'https://ssl.df.eu/chmail.php',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => http_build_query([
|
||||
\CURLOPT_RETURNTRANSFER => true,
|
||||
\CURLOPT_URL => 'https://ssl.df.eu/chmail.php',
|
||||
\CURLOPT_POST => true,
|
||||
\CURLOPT_POSTFIELDS => http_build_query([
|
||||
'login' => $username,
|
||||
'pwd' => $curpass,
|
||||
'action' => 'change',
|
||||
@ -60,7 +60,7 @@ class rcube_domainfactory_password
|
||||
|
||||
// change password
|
||||
$ch = curl_copy_handle($ch);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
|
||||
curl_setopt($ch, \CURLOPT_POSTFIELDS, http_build_query($postfields));
|
||||
if ($result = curl_exec($ch)) {
|
||||
// has the password been changed?
|
||||
if (strpos($result, 'Einstellungen erfolgreich') !== false) {
|
||||
|
||||
@ -61,7 +61,7 @@ class rcube_dovecot_passwdfile_password
|
||||
return PASSWORD_CONNECT_ERROR;
|
||||
}
|
||||
|
||||
if (flock($fp, LOCK_EX)) {
|
||||
if (flock($fp, \LOCK_EX)) {
|
||||
// Read the file and replace the user password
|
||||
while (($line = fgets($fp, 40960)) !== false) {
|
||||
if (strpos($line, "$username:") === 0) {
|
||||
@ -75,7 +75,7 @@ class rcube_dovecot_passwdfile_password
|
||||
|
||||
// Write back the entire file
|
||||
if (file_put_contents($mailuserfile, $content)) {
|
||||
flock($fp, LOCK_UN);
|
||||
flock($fp, \LOCK_UN);
|
||||
fclose($fp);
|
||||
|
||||
return PASSWORD_SUCCESS;
|
||||
|
||||
@ -142,7 +142,7 @@ class rcube_ldap_simple_password
|
||||
$this->_debug("S: OK");
|
||||
|
||||
// Set protocol version
|
||||
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION,
|
||||
ldap_set_option($ds, \LDAP_OPT_PROTOCOL_VERSION,
|
||||
$rcmail->config->get('password_ldap_version', '3'));
|
||||
|
||||
// Start TLS
|
||||
|
||||
@ -48,14 +48,14 @@ class rcube_modoboa_password
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://" . $IMAPhost . "/api/v1/accounts/?search=" . urlencode($RoudCubeUsername),
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "GET",
|
||||
CURLOPT_HTTPHEADER => [
|
||||
\CURLOPT_URL => "https://" . $IMAPhost . "/api/v1/accounts/?search=" . urlencode($RoudCubeUsername),
|
||||
\CURLOPT_RETURNTRANSFER => true,
|
||||
\CURLOPT_ENCODING => "",
|
||||
\CURLOPT_MAXREDIRS => 10,
|
||||
\CURLOPT_TIMEOUT => 30,
|
||||
\CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_1_1,
|
||||
\CURLOPT_CUSTOMREQUEST => "GET",
|
||||
\CURLOPT_HTTPHEADER => [
|
||||
"Authorization: Token " . $ModoboaToken,
|
||||
"Cache-Control: no-cache",
|
||||
"Content-Type: application/json",
|
||||
@ -92,15 +92,15 @@ class rcube_modoboa_password
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://" . $IMAPhost . "/api/v1/accounts/" . $userid . "/",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "PUT",
|
||||
CURLOPT_POSTFIELDS => "" . $encoded . "",
|
||||
CURLOPT_HTTPHEADER => [
|
||||
\CURLOPT_URL => "https://" . $IMAPhost . "/api/v1/accounts/" . $userid . "/",
|
||||
\CURLOPT_RETURNTRANSFER => true,
|
||||
\CURLOPT_ENCODING => "",
|
||||
\CURLOPT_MAXREDIRS => 10,
|
||||
\CURLOPT_TIMEOUT => 30,
|
||||
\CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_1_1,
|
||||
\CURLOPT_CUSTOMREQUEST => "PUT",
|
||||
\CURLOPT_POSTFIELDS => "" . $encoded . "",
|
||||
\CURLOPT_HTTPHEADER => [
|
||||
"Authorization: Token " . $ModoboaToken,
|
||||
"Cache-Control: no-cache",
|
||||
"Content-Type: application/json",
|
||||
|
||||
@ -117,11 +117,11 @@ class plesk_rpc
|
||||
$url = sprintf("https://%s:%s/%s", $host, $port, $path);
|
||||
$this->curl = curl_init();
|
||||
|
||||
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT , 5);
|
||||
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST , 0);
|
||||
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER , false);
|
||||
curl_setopt($this->curl, CURLOPT_HTTPHEADER , $headers);
|
||||
curl_setopt($this->curl, CURLOPT_URL , $url);
|
||||
curl_setopt($this->curl, \CURLOPT_CONNECTTIMEOUT , 5);
|
||||
curl_setopt($this->curl, \CURLOPT_SSL_VERIFYHOST , 0);
|
||||
curl_setopt($this->curl, \CURLOPT_SSL_VERIFYPEER , false);
|
||||
curl_setopt($this->curl, \CURLOPT_HTTPHEADER , $headers);
|
||||
curl_setopt($this->curl, \CURLOPT_URL , $url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,8 +133,8 @@ class plesk_rpc
|
||||
*/
|
||||
function send_request($packet)
|
||||
{
|
||||
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($this->curl, CURLOPT_POSTFIELDS, $packet);
|
||||
curl_setopt($this->curl, \CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($this->curl, \CURLOPT_POSTFIELDS, $packet);
|
||||
$result = curl_exec($this->curl);
|
||||
|
||||
return $result && strpos($result, '<?xml') === 0 ? $result : null;
|
||||
|
||||
@ -175,10 +175,10 @@ class rcube_pwned_password
|
||||
function retrieve_curl($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, \CURLOPT_URL, $url);
|
||||
curl_setopt($ch, \CURLOPT_RETURNTRANSFER, 1);
|
||||
if (self::ENHANCED_PRIVACY_CURL == 1) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Add-Padding: true']);
|
||||
curl_setopt($ch, \CURLOPT_HTTPHEADER, ['Add-Padding: true']);
|
||||
}
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
@ -88,7 +88,7 @@ class XMail
|
||||
function send($msg)
|
||||
{
|
||||
socket_write($this->socket,$msg);
|
||||
if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") {
|
||||
if (substr(socket_read($this->socket, 512, \PHP_BINARY_READ),0,1) != "+") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -96,7 +96,7 @@ class XMail
|
||||
|
||||
function connect()
|
||||
{
|
||||
$this->socket = socket_create(AF_INET, SOCK_STREAM, 0);
|
||||
$this->socket = socket_create(\AF_INET, \SOCK_STREAM, 0);
|
||||
if ($this->socket < 0) {
|
||||
return false;
|
||||
}
|
||||
@ -107,7 +107,7 @@ class XMail
|
||||
return false;
|
||||
}
|
||||
|
||||
if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") {
|
||||
if (substr(socket_read($this->socket, 512, \PHP_BINARY_READ),0,1) != "+") {
|
||||
socket_close($this->socket);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -764,17 +764,17 @@ class password extends rcube_plugin
|
||||
break;
|
||||
|
||||
case 'hash-bcrypt':
|
||||
$crypted = password_hash($password, PASSWORD_BCRYPT, $options);
|
||||
$crypted = password_hash($password, \PASSWORD_BCRYPT, $options);
|
||||
$prefix = '{BLF-CRYPT}';
|
||||
break;
|
||||
|
||||
case 'hash-argon2i':
|
||||
$crypted = password_hash($password, PASSWORD_ARGON2I, $options);
|
||||
$crypted = password_hash($password, \PASSWORD_ARGON2I, $options);
|
||||
$prefix = '{ARGON2I}';
|
||||
break;
|
||||
|
||||
case 'hash-argon2id':
|
||||
$crypted = password_hash($password, PASSWORD_ARGON2ID, $options);
|
||||
$crypted = password_hash($password, \PASSWORD_ARGON2ID, $options);
|
||||
$prefix = '{ARGON2ID}';
|
||||
break;
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ class squirrelmail_usercopy extends rcube_plugin
|
||||
foreach ($this->abook as $rec) {
|
||||
// #1487096: handle multi-address and/or too long items
|
||||
// #1487858: convert multi-address contacts into groups
|
||||
$emails = preg_split('/[;,]/', $rec['email'], -1, PREG_SPLIT_NO_EMPTY);
|
||||
$emails = preg_split('/[;,]/', $rec['email'], -1, \PREG_SPLIT_NO_EMPTY);
|
||||
$group_id = null;
|
||||
|
||||
// create group for addresses
|
||||
|
||||
@ -408,6 +408,6 @@ class zipdownload_mbox_filter extends php_user_filter
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
|
||||
return PSFS_PASS_ON;
|
||||
return \PSFS_PASS_ON;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ class rcmail_action_contacts_delete extends rcmail_action_contacts_index
|
||||
// get records from the next page to add to the list
|
||||
elseif ($pages > 1 && $page < $pages) {
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
$first += $page_size;
|
||||
// create resultset object
|
||||
|
||||
@ -139,7 +139,7 @@ class rcmail_action_contacts_edit extends rcmail_action_contacts_index
|
||||
$addr_tpl = $rcmail->config->get('address_template', '');
|
||||
|
||||
// copy (parsed) address template to client
|
||||
if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $addr_tpl, $templ, PREG_SET_ORDER)) {
|
||||
if (preg_match_all('/\{([a-z0-9]+)\}([^{]*)/i', $addr_tpl, $templ, \PREG_SET_ORDER)) {
|
||||
$rcmail->output->set_env('address_template', $templ);
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ class rcmail_action_contacts_export extends rcmail_action_contacts_index
|
||||
}
|
||||
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
// create resultset object
|
||||
$count = count($records);
|
||||
@ -97,7 +97,7 @@ class rcmail_action_contacts_export extends rcmail_action_contacts_index
|
||||
}
|
||||
}
|
||||
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
// create resultset object
|
||||
$count = count($records);
|
||||
|
||||
@ -126,7 +126,7 @@ class rcmail_action_contacts_import extends rcmail_action_contacts_index
|
||||
$csvs[] = $temp_csv;
|
||||
}
|
||||
else {
|
||||
$upload_error = UPLOAD_ERR_CANT_WRITE;
|
||||
$upload_error = \UPLOAD_ERR_CANT_WRITE;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
@ -427,7 +427,7 @@ class rcmail_action_contacts_index extends rcmail_action
|
||||
$name = $rcmail->gettext('personaladrbook');
|
||||
}
|
||||
|
||||
$rcmail->output->set_env('sourcename', html_entity_decode($name, ENT_COMPAT, 'UTF-8'));
|
||||
$rcmail->output->set_env('sourcename', html_entity_decode($name, \ENT_COMPAT, 'UTF-8'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class rcmail_action_contacts_list extends rcmail_action_contacts_index
|
||||
// Use search result
|
||||
if (($records = self::search_update(true)) !== false) {
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
// create resultset object
|
||||
$count = count($records);
|
||||
|
||||
@ -182,7 +182,7 @@ class rcmail_action_contacts_move extends rcmail_action_contacts_index
|
||||
// get records from the next page to add to the list
|
||||
elseif ($pages > 1 && $page < $pages) {
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
$first += $page_size;
|
||||
// create resultset object
|
||||
|
||||
@ -95,7 +95,7 @@ class rcmail_action_contacts_photo extends rcmail_action_contacts_index
|
||||
$data = $plugin['data'];
|
||||
|
||||
// detect if photo data is a URL
|
||||
if ($data && strlen($data) < 1024 && filter_var($data, FILTER_VALIDATE_URL)) {
|
||||
if ($data && strlen($data) < 1024 && filter_var($data, \FILTER_VALIDATE_URL)) {
|
||||
$rcmail->output->redirect($data);
|
||||
}
|
||||
|
||||
|
||||
@ -148,7 +148,7 @@ class rcmail_action_contacts_search extends rcmail_action_contacts_index
|
||||
}
|
||||
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
// create resultset object
|
||||
$count = count($records);
|
||||
|
||||
@ -133,7 +133,7 @@ class rcmail_action_mail_attachment_upload extends rcmail_action_mail_index
|
||||
self::attachment_success($attachment, $uploadid);
|
||||
}
|
||||
else { // upload failed
|
||||
if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) {
|
||||
if ($err == \UPLOAD_ERR_INI_SIZE || $err == \UPLOAD_ERR_FORM_SIZE) {
|
||||
$size = self::show_bytes(rcube_utils::max_upload_size());
|
||||
$msg = $rcmail->gettext(['name' => 'filesizeerror', 'vars' => ['size' => $size]]);
|
||||
}
|
||||
@ -144,7 +144,7 @@ class rcmail_action_mail_attachment_upload extends rcmail_action_mail_index
|
||||
$msg = $rcmail->gettext('fileuploaderror');
|
||||
}
|
||||
|
||||
if (!empty($attachment['error']) || $err != UPLOAD_ERR_NO_FILE) {
|
||||
if (!empty($attachment['error']) || $err != \UPLOAD_ERR_NO_FILE) {
|
||||
if (!in_array($msg, $errors)) {
|
||||
$rcmail->output->command('display_message', $msg, 'error');
|
||||
$rcmail->output->command('remove_from_attachment_list', $uploadid);
|
||||
|
||||
@ -161,7 +161,7 @@ class rcmail_action_mail_autocomplete extends rcmail_action
|
||||
|
||||
if (count($contacts)) {
|
||||
// sort contacts index
|
||||
asort($sort_keys, SORT_LOCALE_STRING);
|
||||
asort($sort_keys, \SORT_LOCALE_STRING);
|
||||
// re-sort contacts according to index
|
||||
foreach ($sort_keys as $idx => $val) {
|
||||
$sort_keys[$idx] = $contacts[$idx];
|
||||
|
||||
@ -1348,7 +1348,7 @@ class rcmail_action_mail_compose extends rcmail_action_mail_index
|
||||
public static function basename($filename)
|
||||
{
|
||||
// basename() is not unicode safe and locale dependent
|
||||
if (stristr(PHP_OS, 'win') || stristr(PHP_OS, 'netware')) {
|
||||
if (stristr(\PHP_OS, 'win') || stristr(\PHP_OS, 'netware')) {
|
||||
return preg_replace('/^.*[\\\\\\/]/', '', $filename);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -132,7 +132,7 @@ class rcmail_action_mail_get extends rcmail_action_mail_index
|
||||
|
||||
// compare file mimetype with the stated content-type headers and file extension to avoid malicious operations
|
||||
if (!empty($_REQUEST['_embed']) && empty($_REQUEST['_nocheck'])) {
|
||||
$file_extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$file_extension = strtolower(pathinfo($filename, \PATHINFO_EXTENSION));
|
||||
|
||||
// 1. compare filename suffix with expected suffix derived from mimetype
|
||||
$valid = $file_extension && in_array($file_extension, (array) $extensions)
|
||||
@ -267,7 +267,7 @@ class rcmail_action_mail_get extends rcmail_action_mail_index
|
||||
}
|
||||
|
||||
// add filename extension if missing
|
||||
if (!pathinfo($filename, PATHINFO_EXTENSION) && ($extensions = rcube_mime::get_mime_extensions($mimetype))) {
|
||||
if (!pathinfo($filename, \PATHINFO_EXTENSION) && ($extensions = rcube_mime::get_mime_extensions($mimetype))) {
|
||||
$filename .= '.' . $extensions[0];
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class rcmail_action_mail_headers extends rcmail_action_mail_index
|
||||
|
||||
if ($source !== false) {
|
||||
$source = trim(rcube_charset::clean($source));
|
||||
$source = htmlspecialchars($source, ENT_COMPAT | ENT_HTML401, RCUBE_CHARSET);
|
||||
$source = htmlspecialchars($source, \ENT_COMPAT | \ENT_HTML401, RCUBE_CHARSET);
|
||||
$source = preg_replace(
|
||||
[
|
||||
'/\n[\t\s]+/',
|
||||
|
||||
@ -1264,7 +1264,7 @@ class rcmail_action_mail_index extends rcmail_action
|
||||
if (preg_match('/#' . preg_quote($cont_id, '/') . '\s+\{([^}]+)}/i', $body, $m)) {
|
||||
// get background related style
|
||||
$regexp = '/(background-position|background-repeat)\s*:\s*([^;]+);/i';
|
||||
if (preg_match_all($regexp, $m[1], $matches, PREG_SET_ORDER)) {
|
||||
if (preg_match_all($regexp, $m[1], $matches, \PREG_SET_ORDER)) {
|
||||
foreach ($matches as $m) {
|
||||
$style[$m[1]] = $m[2];
|
||||
}
|
||||
@ -1327,7 +1327,7 @@ class rcmail_action_mail_index extends rcmail_action
|
||||
$content = null;
|
||||
}
|
||||
elseif (preg_match('/^mailto:(.+)/i', $attrib['href'], $mailto)) {
|
||||
$url_parts = explode('?', html_entity_decode($mailto[1], ENT_QUOTES, 'UTF-8'), 2);
|
||||
$url_parts = explode('?', html_entity_decode($mailto[1], \ENT_QUOTES, 'UTF-8'), 2);
|
||||
$mailto = $url_parts[0];
|
||||
$url = $url_parts[1] ?? '';
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class rcmail_action_mail_list_contacts extends rcmail_action_mail_index
|
||||
}
|
||||
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
// create resultset object
|
||||
$count = count($records);
|
||||
|
||||
@ -70,7 +70,7 @@ class rcmail_action_mail_search_contacts extends rcmail_action_mail_list_contact
|
||||
$group_count = count($jsresult);
|
||||
|
||||
// sort the records
|
||||
ksort($records, SORT_LOCALE_STRING);
|
||||
ksort($records, \SORT_LOCALE_STRING);
|
||||
|
||||
// create resultset object
|
||||
$count = count($records);
|
||||
|
||||
@ -96,7 +96,7 @@ class rcmail_action_settings_about extends rcmail_action
|
||||
return '';
|
||||
}
|
||||
|
||||
ksort($plugin_info, SORT_LOCALE_STRING);
|
||||
ksort($plugin_info, \SORT_LOCALE_STRING);
|
||||
|
||||
$table = new html_table($attrib);
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ class rcmail_action_settings_identity_edit extends rcmail_action
|
||||
$form['signature']['content']['signature']['is_escaped'] = true;
|
||||
|
||||
// Correctly handle HTML entities in HTML editor (#1488483)
|
||||
self::$record['signature'] = htmlspecialchars(self::$record['signature'], ENT_NOQUOTES, RCUBE_CHARSET);
|
||||
self::$record['signature'] = htmlspecialchars(self::$record['signature'], \ENT_NOQUOTES, RCUBE_CHARSET);
|
||||
}
|
||||
|
||||
// hide "default" checkbox if only one identity is allowed
|
||||
|
||||
@ -1089,7 +1089,7 @@ class rcmail_action_settings_index extends rcmail_action
|
||||
|
||||
if (!empty($books)) {
|
||||
foreach ($books as $book) {
|
||||
$select->add(html_entity_decode($book['name'], ENT_COMPAT, 'UTF-8'), $book['id']);
|
||||
$select->add(html_entity_decode($book['name'], \ENT_COMPAT, 'UTF-8'), $book['id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1223,7 +1223,7 @@ class rcmail_action_settings_index extends rcmail_action
|
||||
$select->add($rcmail->gettext('collectedrecipients'), (string) rcube_addressbook::TYPE_RECIPIENT);
|
||||
|
||||
foreach ($books as $book) {
|
||||
$select->add(html_entity_decode($book['name'], ENT_COMPAT, 'UTF-8'), $book['id']);
|
||||
$select->add(html_entity_decode($book['name'], \ENT_COMPAT, 'UTF-8'), $book['id']);
|
||||
}
|
||||
|
||||
$selected = $config['collected_recipients'];
|
||||
@ -1256,7 +1256,7 @@ class rcmail_action_settings_index extends rcmail_action
|
||||
$select->add($rcmail->gettext('trustedsenders'), (string) rcube_addressbook::TYPE_TRUSTED_SENDER);
|
||||
|
||||
foreach ($books as $book) {
|
||||
$select->add(html_entity_decode($book['name'], ENT_COMPAT, 'UTF-8'), $book['id']);
|
||||
$select->add(html_entity_decode($book['name'], \ENT_COMPAT, 'UTF-8'), $book['id']);
|
||||
}
|
||||
|
||||
$selected = $config['collected_senders'];
|
||||
|
||||
@ -104,7 +104,7 @@ class rcmail_action_settings_response_edit extends rcmail_action_settings_respon
|
||||
$text_attr['is_escaped'] = true;
|
||||
|
||||
// Correctly handle HTML entities in HTML editor (#1488483)
|
||||
self::$response['data'] = htmlspecialchars(self::$response['data'], ENT_NOQUOTES, RCUBE_CHARSET);
|
||||
self::$response['data'] = htmlspecialchars(self::$response['data'], \ENT_NOQUOTES, RCUBE_CHARSET);
|
||||
}
|
||||
|
||||
$table = new html_table(['cols' => 2]);
|
||||
|
||||
@ -39,7 +39,7 @@ class rcmail_action_utils_spell extends rcmail_action
|
||||
$left = strpos($data, '<text>');
|
||||
$right = strrpos($data, '</text>');
|
||||
$data = substr($data, $left + 6, $right - ($left + 6));
|
||||
$data = html_entity_decode($data, ENT_QUOTES, RCUBE_CHARSET);
|
||||
$data = html_entity_decode($data, \ENT_QUOTES, RCUBE_CHARSET);
|
||||
|
||||
$spellchecker = new rcube_spellchecker($lang);
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class rcmail_action_utils_spell_html extends rcmail_action
|
||||
}
|
||||
else {
|
||||
$data = rcube_utils::get_input_string('text', rcube_utils::INPUT_POST, true);
|
||||
$data = html_entity_decode($data, ENT_QUOTES, RCUBE_CHARSET);
|
||||
$data = html_entity_decode($data, \ENT_QUOTES, RCUBE_CHARSET);
|
||||
|
||||
if ($data && !$spellchecker->check($data)) {
|
||||
$result['words'] = $spellchecker->get();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
+-----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (PHP_SAPI != 'cli') {
|
||||
if (\PHP_SAPI != 'cli') {
|
||||
exit('Not on the "shell" (php-cli).');
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
+-----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (PHP_VERSION_ID < 70300) {
|
||||
if (\PHP_VERSION_ID < 70300) {
|
||||
exit("Unsupported PHP version. Required PHP >= 7.3.");
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ register_shutdown_function('rcmail_error_handler');
|
||||
// RC include folders MUST be included FIRST to avoid other
|
||||
// possible not compatible libraries (i.e PEAR) to be included
|
||||
// instead the ones provided by RC
|
||||
$include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
|
||||
$include_path = INSTALL_PATH . 'program/lib' . \PATH_SEPARATOR;
|
||||
$include_path .= ini_get('include_path');
|
||||
|
||||
if (set_include_path($include_path) === false) {
|
||||
@ -109,7 +109,7 @@ function rcmail_error_handler()
|
||||
{
|
||||
$error = error_get_last();
|
||||
|
||||
if ($error && ($error['type'] === E_ERROR || $error['type'] === E_PARSE)) {
|
||||
if ($error && ($error['type'] === \E_ERROR || $error['type'] === \E_PARSE)) {
|
||||
rcmail_fatal_error();
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,7 @@ function rcmail_error_handler()
|
||||
*/
|
||||
function rcmail_fatal_error()
|
||||
{
|
||||
if (PHP_SAPI === 'cli') {
|
||||
if (\PHP_SAPI === 'cli') {
|
||||
echo "Fatal error: Please check the Roundcube error log and/or server error logs for more information.\n";
|
||||
}
|
||||
elseif (!empty($_REQUEST['_remote'])) {
|
||||
|
||||
@ -84,7 +84,7 @@ class rcmail extends rcube
|
||||
{
|
||||
if (!self::$instance || !is_a(self::$instance, 'rcmail')) {
|
||||
// In cli-server mode env=test
|
||||
if ($env === null && PHP_SAPI == 'cli-server') {
|
||||
if ($env === null && \PHP_SAPI == 'cli-server') {
|
||||
$env = 'test';
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class rcmail extends rcube
|
||||
}
|
||||
|
||||
// init output class
|
||||
if (PHP_SAPI == 'cli') {
|
||||
if (\PHP_SAPI == 'cli') {
|
||||
$this->output = new rcmail_output_cli();
|
||||
}
|
||||
elseif (!empty($_REQUEST['_remote'])) {
|
||||
@ -167,7 +167,7 @@ class rcmail extends rcube
|
||||
*/
|
||||
public function set_task($task)
|
||||
{
|
||||
if (PHP_SAPI == 'cli') {
|
||||
if (\PHP_SAPI == 'cli') {
|
||||
$task = 'cli';
|
||||
}
|
||||
elseif (!$this->user || !$this->user->ID) {
|
||||
@ -209,14 +209,14 @@ class rcmail extends rcube
|
||||
$_SESSION['language'] = $this->user->language = $lang;
|
||||
|
||||
// set localization
|
||||
setlocale(LC_ALL, $lang . '.utf8', $lang . '.UTF-8', 'en_US.utf8', 'en_US.UTF-8');
|
||||
setlocale(\LC_ALL, $lang . '.utf8', $lang . '.UTF-8', 'en_US.utf8', 'en_US.UTF-8');
|
||||
ini_set('intl.default_locale', $lang);
|
||||
|
||||
// Workaround for http://bugs.php.net/bug.php?id=18556
|
||||
// Also strtoupper/strtolower and other methods are locale-aware
|
||||
// for these locales it is problematic (#1490519)
|
||||
if (in_array($lang, ['tr_TR', 'ku', 'az_AZ'])) {
|
||||
setlocale(LC_CTYPE, 'en_US.utf8', 'en_US.UTF-8', 'C');
|
||||
setlocale(\LC_CTYPE, 'en_US.utf8', 'en_US.UTF-8', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,7 +530,7 @@ class rcmail extends rcube
|
||||
}
|
||||
|
||||
if (!empty($additional)) {
|
||||
ksort($additional, SORT_LOCALE_STRING);
|
||||
ksort($additional, \SORT_LOCALE_STRING);
|
||||
$responses = array_merge(array_values($additional), $responses);
|
||||
}
|
||||
}
|
||||
@ -1207,7 +1207,7 @@ class rcmail extends rcube
|
||||
|
||||
// In CLI stop here, prevent from errors when the console.log might exist,
|
||||
// but be not accessible
|
||||
if (PHP_SAPI == 'cli') {
|
||||
if (\PHP_SAPI == 'cli') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1217,7 +1217,7 @@ class rcmail extends rcube
|
||||
$this->config->set('per_user_logging', false);
|
||||
|
||||
// make sure logged numbers use unified format
|
||||
setlocale(LC_NUMERIC, 'en_US.utf8', 'en_US.UTF-8', 'en_US', 'C');
|
||||
setlocale(\LC_NUMERIC, 'en_US.utf8', 'en_US.UTF-8', 'en_US', 'C');
|
||||
|
||||
if (function_exists('memory_get_usage')) {
|
||||
$mem = round(memory_get_usage() / 1024 / 1024, 1);
|
||||
|
||||
@ -590,7 +590,7 @@ abstract class rcmail_action
|
||||
elseif ($attachment && !empty($attachment['error'])) {
|
||||
$msg = $attachment['error'];
|
||||
}
|
||||
elseif ($php_error == UPLOAD_ERR_INI_SIZE || $php_error == UPLOAD_ERR_FORM_SIZE) {
|
||||
elseif ($php_error == \UPLOAD_ERR_INI_SIZE || $php_error == \UPLOAD_ERR_FORM_SIZE) {
|
||||
$post_size = self::show_bytes(rcube_utils::max_upload_size());
|
||||
$msg = $rcmail->gettext(['name' => 'filesizeerror', 'vars' => ['size' => $post_size]]);
|
||||
}
|
||||
|
||||
@ -160,16 +160,16 @@ class rcmail_install
|
||||
|
||||
for ($i = 0; $i < count($tokens); $i++) {
|
||||
$token = $tokens[$i];
|
||||
if ($token[0] == T_VARIABLE && ($token[1] == '$config' || $token[1] == '$rcmail_config')) {
|
||||
if ($token[0] == \T_VARIABLE && ($token[1] == '$config' || $token[1] == '$rcmail_config')) {
|
||||
$in_config = true;
|
||||
if ($buffer && $tokens[$i + 1] == '[' && $tokens[$i + 2][0] == T_CONSTANT_ENCAPSED_STRING) {
|
||||
if ($buffer && $tokens[$i + 1] == '[' && $tokens[$i + 2][0] == \T_CONSTANT_ENCAPSED_STRING) {
|
||||
$propname = trim($tokens[$i + 2][1], "'\"");
|
||||
$this->comments[$propname] = preg_replace('/\n\n/', "\n", $buffer);
|
||||
$buffer = '';
|
||||
$i += 3;
|
||||
}
|
||||
}
|
||||
elseif ($in_config && $token[0] == T_COMMENT) {
|
||||
elseif ($in_config && $token[0] == \T_COMMENT) {
|
||||
$buffer .= strtr($token[1], ['\n' => "\n"]) . "\n";
|
||||
}
|
||||
}
|
||||
@ -926,7 +926,7 @@ class rcmail_install
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$filename = $zip->getNameIndex($i);
|
||||
if (substr($filename, -1, 1) != '/') {
|
||||
copy("zip://" . $zipfile . "#" . $filename, $destdir . '/' . pathinfo($filename, PATHINFO_BASENAME));
|
||||
copy("zip://" . $zipfile . "#" . $filename, $destdir . '/' . pathinfo($filename, \PATHINFO_BASENAME));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -972,7 +972,7 @@ class rcmail_install
|
||||
|
||||
if ($flat) {
|
||||
// In flat mode remove all directories
|
||||
$extract_tree = glob("$destdir/*", GLOB_ONLYDIR);
|
||||
$extract_tree = glob("$destdir/*", \GLOB_ONLYDIR);
|
||||
foreach ($extract_tree as $dir) {
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ class rcmail_output_html extends rcmail_output
|
||||
// add cookie info
|
||||
$this->set_env('cookie_domain', ini_get('session.cookie_domain'));
|
||||
$this->set_env('cookie_path', ini_get('session.cookie_path'));
|
||||
$this->set_env('cookie_secure', filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN));
|
||||
$this->set_env('cookie_secure', filter_var(ini_get('session.cookie_secure'), \FILTER_VALIDATE_BOOLEAN));
|
||||
|
||||
// Easy way to change skin via GET argument, for developers
|
||||
if ($this->devel_mode && !empty($_GET['skin']) && preg_match('/^[a-z0-9-_]+$/i', $_GET['skin'])) {
|
||||
@ -1105,7 +1105,7 @@ class rcmail_output_html extends rcmail_output
|
||||
$pos = 0;
|
||||
|
||||
// Find IF tags and process them
|
||||
while ($pos < strlen($input) && preg_match($regexp1, $input, $conditions, PREG_OFFSET_CAPTURE, $pos)) {
|
||||
while ($pos < strlen($input) && preg_match($regexp1, $input, $conditions, \PREG_OFFSET_CAPTURE, $pos)) {
|
||||
$pos = $start = $conditions[0][1];
|
||||
|
||||
// Process the 'condition' attribute
|
||||
@ -1121,7 +1121,7 @@ class rcmail_output_html extends rcmail_output
|
||||
$n = $pos + 1;
|
||||
|
||||
// Process the code until the closing tag (for the processed IF tag)
|
||||
while (preg_match($regexp2, $input, $matches, PREG_OFFSET_CAPTURE, $n)) {
|
||||
while (preg_match($regexp2, $input, $matches, \PREG_OFFSET_CAPTURE, $n)) {
|
||||
$tag_start = $matches[0][1];
|
||||
$tag_end = $tag_start + strlen($matches[0][0]);
|
||||
$tag_name = strtolower($matches[1][0]);
|
||||
@ -1295,7 +1295,7 @@ class rcmail_output_html extends rcmail_output
|
||||
$value = $_SESSION[$name] ?? '';
|
||||
break;
|
||||
case 'cookie':
|
||||
$value = htmlspecialchars($_COOKIE[$name], ENT_COMPAT | ENT_HTML401, RCUBE_CHARSET);
|
||||
$value = htmlspecialchars($_COOKIE[$name], \ENT_COMPAT | \ENT_HTML401, RCUBE_CHARSET);
|
||||
break;
|
||||
case 'browser':
|
||||
$value = $this->browser->{$name} ?? '';
|
||||
@ -2463,7 +2463,7 @@ class rcmail_output_html extends rcmail_output
|
||||
*/
|
||||
protected function preloader($attrib)
|
||||
{
|
||||
$images = preg_split('/[\s\t\n,]+/', $attrib['images'], -1, PREG_SPLIT_NO_EMPTY);
|
||||
$images = preg_split('/[\s\t\n,]+/', $attrib['images'], -1, \PREG_SPLIT_NO_EMPTY);
|
||||
$images = array_map([$this, 'abs_url'], $images);
|
||||
$images = array_map([$this, 'asset_url'], $images);
|
||||
|
||||
@ -2742,7 +2742,7 @@ class rcmail_output_html extends rcmail_output
|
||||
|
||||
if (empty($type)) {
|
||||
// If no type provided then remove those options from the list
|
||||
$template_names = preg_grep("/\]$/", $template_names, PREG_GREP_INVERT);
|
||||
$template_names = preg_grep("/\]$/", $template_names, \PREG_GREP_INVERT);
|
||||
}
|
||||
elseif ($match === null) {
|
||||
// Type specified with no special matching requirements so remove all none type specific options from the list
|
||||
@ -2751,7 +2751,7 @@ class rcmail_output_html extends rcmail_output
|
||||
|
||||
if ($match == 'template') {
|
||||
// Match only specific type or template name
|
||||
$template_names = preg_grep("/\*$/", $template_names, PREG_GREP_INVERT);
|
||||
$template_names = preg_grep("/\*$/", $template_names, \PREG_GREP_INVERT);
|
||||
}
|
||||
|
||||
foreach ($template_names as $key) {
|
||||
|
||||
@ -187,6 +187,6 @@ class rcmail_bounce_stream_filter extends php_user_filter
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
|
||||
return PSFS_PASS_ON;
|
||||
return \PSFS_PASS_ON;
|
||||
}
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ class rcmail_sendmail
|
||||
$domain = 'localhost';
|
||||
$regexp = '#img[^>]+src=[\'"](data:([^;]*);base64,([a-z0-9+/=\r\n]+))([\'"])#i';
|
||||
|
||||
if (preg_match_all($regexp, $body, $matches, PREG_OFFSET_CAPTURE)) {
|
||||
if (preg_match_all($regexp, $body, $matches, \PREG_OFFSET_CAPTURE)) {
|
||||
// get domain for the Content-ID, must be the same as in Mail_mime::get()
|
||||
if (preg_match('#@([0-9a-zA-Z\-\.]+)#', $from, $m)) {
|
||||
$domain = $m[1];
|
||||
|
||||
@ -181,7 +181,7 @@ class rcmail_utils
|
||||
$result[] = $m[1];
|
||||
}
|
||||
}
|
||||
sort($result, SORT_NUMERIC);
|
||||
sort($result, \SORT_NUMERIC);
|
||||
|
||||
foreach ($result as $v) {
|
||||
if (empty($opts['quiet'])) {
|
||||
@ -317,7 +317,7 @@ class rcmail_utils
|
||||
}
|
||||
|
||||
// host can be a URL like tls://192.168.12.44
|
||||
$host_url = parse_url($args['host'], PHP_URL_HOST);
|
||||
$host_url = parse_url($args['host'], \PHP_URL_HOST);
|
||||
if ($host_url) {
|
||||
$args['host'] = $host_url;
|
||||
}
|
||||
|
||||
@ -30,14 +30,14 @@ $config = [
|
||||
// Some users are not using Installer, so we'll check some
|
||||
// critical PHP settings here. Only these, which doesn't provide
|
||||
// an error/warning in the logs later. See (#1486307).
|
||||
if (PHP_MAJOR_VERSION < 8) {
|
||||
if (\PHP_MAJOR_VERSION < 8) {
|
||||
$config += [
|
||||
'mbstring.func_overload' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
// check these additional ini settings if not called via CLI
|
||||
if (PHP_SAPI != 'cli') {
|
||||
if (\PHP_SAPI != 'cli') {
|
||||
$config += [
|
||||
'suhosin.session.encrypt' => false,
|
||||
'file_uploads' => true,
|
||||
@ -47,14 +47,14 @@ if (PHP_SAPI != 'cli') {
|
||||
}
|
||||
|
||||
foreach ($config as $optname => $optval) {
|
||||
$ini_optval = filter_var(ini_get($optname), is_bool($optval) ? FILTER_VALIDATE_BOOLEAN : FILTER_VALIDATE_INT);
|
||||
$ini_optval = filter_var(ini_get($optname), is_bool($optval) ? \FILTER_VALIDATE_BOOLEAN : \FILTER_VALIDATE_INT);
|
||||
if ($optval != $ini_optval && @ini_set($optname, $optval) === false) {
|
||||
$optval = !is_bool($optval) ? $optval : ($optval ? 'On' : 'Off');
|
||||
$error = "ERROR: Wrong '$optname' option value and it wasn't possible to set it to required value ($optval).\n"
|
||||
. "Check your PHP configuration (including php_admin_flag).";
|
||||
|
||||
if (defined('STDERR')) {
|
||||
fwrite(STDERR, $error);
|
||||
fwrite(\STDERR, $error);
|
||||
} else {
|
||||
echo $error;
|
||||
}
|
||||
@ -93,12 +93,12 @@ mb_regex_encoding(RCUBE_CHARSET);
|
||||
|
||||
// make sure the Roundcube lib directory is in the include_path
|
||||
$rcube_path = realpath(RCUBE_LIB_DIR . '..');
|
||||
$sep = PATH_SEPARATOR;
|
||||
$sep = \PATH_SEPARATOR;
|
||||
$regexp = "!(^|$sep)" . preg_quote($rcube_path, '!') . "($sep|\$)!";
|
||||
$path = ini_get('include_path');
|
||||
|
||||
if (!preg_match($regexp, $path)) {
|
||||
set_include_path($path . PATH_SEPARATOR . $rcube_path);
|
||||
set_include_path($path . \PATH_SEPARATOR . $rcube_path);
|
||||
}
|
||||
|
||||
// Register autoloader
|
||||
|
||||
2
program/lib/Roundcube/cache/db.php
vendored
2
program/lib/Roundcube/cache/db.php
vendored
@ -126,7 +126,7 @@ class rcube_cache_db extends rcube_cache
|
||||
|
||||
// don't attempt to write too big data sets
|
||||
if ($size > $this->max_packet_size()) {
|
||||
trigger_error("rcube_cache: max_packet_size ($this->max_packet) exceeded for key $key. Tried to write $size bytes", E_USER_WARNING);
|
||||
trigger_error("rcube_cache: max_packet_size ($this->max_packet) exceeded for key $key. Tried to write $size bytes", \E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
4
program/lib/Roundcube/cache/memcache.php
vendored
4
program/lib/Roundcube/cache/memcache.php
vendored
@ -167,10 +167,10 @@ class rcube_cache_memcache extends rcube_cache
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = self::$memcache->replace($key, $data, MEMCACHE_COMPRESSED, $this->ttl);
|
||||
$result = self::$memcache->replace($key, $data, \MEMCACHE_COMPRESSED, $this->ttl);
|
||||
|
||||
if (!$result) {
|
||||
$result = self::$memcache->set($key, $data, MEMCACHE_COMPRESSED, $this->ttl);
|
||||
$result = self::$memcache->set($key, $data, \MEMCACHE_COMPRESSED, $this->ttl);
|
||||
}
|
||||
|
||||
if ($this->debug) {
|
||||
|
||||
@ -396,7 +396,7 @@ class html
|
||||
return (string) $str;
|
||||
}
|
||||
|
||||
return @htmlspecialchars($str, ENT_COMPAT | ENT_SUBSTITUTE, RCUBE_CHARSET);
|
||||
return @htmlspecialchars($str, \ENT_COMPAT | \ENT_SUBSTITUTE, RCUBE_CHARSET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -127,8 +127,8 @@ class rcube
|
||||
// initialize syslog
|
||||
if ($this->config->get('log_driver') == 'syslog') {
|
||||
$syslog_id = $this->config->get('syslog_id', 'roundcube');
|
||||
$syslog_facility = $this->config->get('syslog_facility', LOG_USER);
|
||||
openlog($syslog_id, LOG_ODELAY, $syslog_facility);
|
||||
$syslog_facility = $this->config->get('syslog_facility', \LOG_USER);
|
||||
openlog($syslog_id, \LOG_ODELAY, $syslog_facility);
|
||||
}
|
||||
|
||||
// connect to database
|
||||
@ -619,13 +619,13 @@ class rcube
|
||||
|
||||
// case folding
|
||||
if ((!empty($attrib['uppercase']) && strtolower($attrib['uppercase']) == 'first') || !empty($attrib['ucfirst'])) {
|
||||
$case_mode = MB_CASE_TITLE;
|
||||
$case_mode = \MB_CASE_TITLE;
|
||||
}
|
||||
elseif (!empty($attrib['uppercase'])) {
|
||||
$case_mode = MB_CASE_UPPER;
|
||||
$case_mode = \MB_CASE_UPPER;
|
||||
}
|
||||
elseif (!empty($attrib['lowercase'])) {
|
||||
$case_mode = MB_CASE_LOWER;
|
||||
$case_mode = \MB_CASE_LOWER;
|
||||
}
|
||||
|
||||
if (isset($case_mode)) {
|
||||
@ -910,10 +910,10 @@ class rcube
|
||||
// This distinction is for PHP 7.3 which throws a warning when
|
||||
// we use $tag argument with non-AEAD cipher method here
|
||||
if (!preg_match('/-(gcm|ccm|poly1305)$/i', $method)) {
|
||||
$cipher = openssl_encrypt($clear, $method, $ckey, OPENSSL_RAW_DATA, $iv);
|
||||
$cipher = openssl_encrypt($clear, $method, $ckey, \OPENSSL_RAW_DATA, $iv);
|
||||
}
|
||||
else {
|
||||
$cipher = openssl_encrypt($clear, $method, $ckey, OPENSSL_RAW_DATA, $iv, $tag);
|
||||
$cipher = openssl_encrypt($clear, $method, $ckey, \OPENSSL_RAW_DATA, $iv, $tag);
|
||||
}
|
||||
|
||||
if ($cipher === false) {
|
||||
@ -975,7 +975,7 @@ class rcube
|
||||
}
|
||||
|
||||
$cipher = substr($cipher, $iv_size);
|
||||
$clear = openssl_decrypt($cipher, $method, $ckey, OPENSSL_RAW_DATA, $iv, $tag);
|
||||
$clear = openssl_decrypt($cipher, $method, $ckey, \OPENSSL_RAW_DATA, $iv, $tag);
|
||||
|
||||
return $clear;
|
||||
}
|
||||
@ -1233,7 +1233,7 @@ class rcube
|
||||
$values += (array) $arg;
|
||||
}
|
||||
|
||||
preg_match_all('/({(-?)([a-z]\w*)})/', $cmd, $matches, PREG_SET_ORDER);
|
||||
preg_match_all('/({(-?)([a-z]\w*)})/', $cmd, $matches, \PREG_SET_ORDER);
|
||||
foreach ($matches as $tags) {
|
||||
[, $tag, $option, $key] = $tags;
|
||||
$parts = [];
|
||||
@ -1335,7 +1335,7 @@ class rcube
|
||||
}
|
||||
|
||||
if ($log_driver == 'syslog') {
|
||||
$prio = $name == 'errors' ? LOG_ERR : LOG_INFO;
|
||||
$prio = $name == 'errors' ? \LOG_ERR : \LOG_INFO;
|
||||
return syslog($prio, $line);
|
||||
}
|
||||
|
||||
@ -1343,7 +1343,7 @@ class rcube
|
||||
if ($log_driver == 'stdout') {
|
||||
$stdout = "php://stdout";
|
||||
$line = "$name: $line\n";
|
||||
return file_put_contents($stdout, $line, FILE_APPEND) !== false;
|
||||
return file_put_contents($stdout, $line, \FILE_APPEND) !== false;
|
||||
}
|
||||
|
||||
// log_driver == 'file' is assumed here
|
||||
@ -1380,7 +1380,7 @@ class rcube
|
||||
$name .= '.log';
|
||||
}
|
||||
|
||||
return file_put_contents("$log_dir/$name", $line, FILE_APPEND) !== false;
|
||||
return file_put_contents("$log_dir/$name", $line, \FILE_APPEND) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1421,7 +1421,7 @@ class rcube
|
||||
$arg['code'] = 500;
|
||||
}
|
||||
|
||||
$cli = PHP_SAPI == 'cli';
|
||||
$cli = \PHP_SAPI == 'cli';
|
||||
|
||||
$arg['cli'] = $cli;
|
||||
$arg['log'] = $log;
|
||||
@ -1449,7 +1449,7 @@ class rcube
|
||||
}
|
||||
|
||||
if ($cli) {
|
||||
fwrite(STDERR, 'ERROR: ' . trim($arg['message']) . "\n");
|
||||
fwrite(\STDERR, 'ERROR: ' . trim($arg['message']) . "\n");
|
||||
}
|
||||
elseif ($terminate && is_object(self::$instance->output)) {
|
||||
self::$instance->output->raise_error($arg['code'], $arg['message']);
|
||||
@ -1504,7 +1504,7 @@ class rcube
|
||||
|
||||
if (!self::write_log('errors', $log_entry)) {
|
||||
// send error to PHPs error handler if write_log didn't succeed
|
||||
trigger_error($arg_arr['message'], E_USER_WARNING);
|
||||
trigger_error($arg_arr['message'], \E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ class rcube_base_replacer
|
||||
// strip './' because its the same as ''
|
||||
$path = preg_replace('/^\.\//', '', $path);
|
||||
|
||||
if (preg_match_all('/\.\.\//', $path, $matches, PREG_SET_ORDER)) {
|
||||
if (preg_match_all('/\.\.\//', $path, $matches, \PREG_SET_ORDER)) {
|
||||
$cnt = count($matches);
|
||||
while ($cnt--) {
|
||||
if ($pos = strrpos($base_url, '/')) {
|
||||
|
||||
@ -479,7 +479,7 @@ class rcube_cache
|
||||
|
||||
// don't attempt to write too big data sets
|
||||
if ($size > $this->max_packet_size()) {
|
||||
trigger_error("rcube_cache: max_packet_size ($this->max_packet) exceeded for key $key. Tried to write $size bytes", E_USER_WARNING);
|
||||
trigger_error("rcube_cache: max_packet_size ($this->max_packet) exceeded for key $key. Tried to write $size bytes", \E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -301,7 +301,7 @@ class rcube_charset
|
||||
// FIXME: Is this really true with substitute character 'none'?
|
||||
// A warning is thrown in PHP<8 also on unsupported encoding, in PHP>=8 ValueError
|
||||
// is thrown instead (therefore we catch Throwable below)
|
||||
set_error_handler($error_handler, E_WARNING);
|
||||
set_error_handler($error_handler, \E_WARNING);
|
||||
|
||||
try {
|
||||
$out = mb_convert_encoding($str, $to, $from);
|
||||
@ -338,7 +338,7 @@ class rcube_charset
|
||||
// If iconv reports an illegal character in input it means that input string
|
||||
// has been truncated. It's reported as E_NOTICE.
|
||||
// PHP8 will also throw E_WARNING on unsupported encoding.
|
||||
set_error_handler($error_handler, E_NOTICE | E_WARNING);
|
||||
set_error_handler($error_handler, \E_NOTICE | \E_WARNING);
|
||||
|
||||
try {
|
||||
$out = iconv($from, $to . $iconv_options, $str);
|
||||
|
||||
@ -66,7 +66,7 @@ class rcube_config
|
||||
$this->env = $env;
|
||||
|
||||
if ($paths = getenv('RCUBE_CONFIG_PATH')) {
|
||||
$this->paths = explode(PATH_SEPARATOR, $paths);
|
||||
$this->paths = explode(\PATH_SEPARATOR, $paths);
|
||||
// make all paths absolute
|
||||
foreach ($this->paths as $i => $path) {
|
||||
if (!rcube_utils::is_absolute_path($path)) {
|
||||
@ -202,7 +202,7 @@ class rcube_config
|
||||
$this->errors[] = 'config.inc.php was not found.';
|
||||
}
|
||||
elseif (rand(1,100) == 10) { // log warning on every 100th request (average)
|
||||
trigger_error("config.inc.php was not found. Please migrate your config by running bin/update.sh", E_USER_WARNING);
|
||||
trigger_error("config.inc.php was not found. Please migrate your config by running bin/update.sh", \E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ class rcube_config
|
||||
}
|
||||
}
|
||||
|
||||
$php_os = strtolower(substr(PHP_OS, 0, 3));
|
||||
$php_os = strtolower(substr(\PHP_OS, 0, 3));
|
||||
|
||||
if ($php_os == 'win') {
|
||||
return "\r\n";
|
||||
|
||||
@ -39,7 +39,7 @@ class rcube_content_filter extends php_user_filter
|
||||
|
||||
// check for evil content and abort
|
||||
if (preg_match('/<(script|iframe|object)/i', $this->buffer)) {
|
||||
return PSFS_ERR_FATAL;
|
||||
return \PSFS_ERR_FATAL;
|
||||
}
|
||||
|
||||
// keep buffer small enough
|
||||
@ -51,6 +51,6 @@ class rcube_content_filter extends php_user_filter
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
|
||||
return PSFS_PASS_ON;
|
||||
return \PSFS_PASS_ON;
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ class rcube_db
|
||||
$regex = '/(?:^|\s)(from|update|into|join)\s+' . $start . '?([a-z0-9._]+)' . $end . '?\s+/i';
|
||||
|
||||
// find tables involved in this query
|
||||
if (preg_match_all($regex, $query, $matches, PREG_SET_ORDER)) {
|
||||
if (preg_match_all($regex, $query, $matches, \PREG_SET_ORDER)) {
|
||||
foreach ($matches as $m) {
|
||||
$table = $m[2];
|
||||
|
||||
|
||||
@ -526,7 +526,7 @@ class rcube_html2text
|
||||
$text = preg_replace($this->ent_search, $this->ent_replace, $text);
|
||||
|
||||
// Replace known html entities
|
||||
$text = html_entity_decode($text, ENT_QUOTES, $this->charset);
|
||||
$text = html_entity_decode($text, \ENT_QUOTES, $this->charset);
|
||||
|
||||
// Replace unicode nbsp to regular spaces
|
||||
$text = preg_replace('/\xC2\xA0/', ' ', $text);
|
||||
@ -722,7 +722,7 @@ class rcube_html2text
|
||||
|
||||
// Add citation markers and create <pre> block
|
||||
$body = preg_replace_callback('/((?:^|\n)>*)([^\n]*)/', [$this, 'blockquote_citation_callback'], trim($body));
|
||||
$body = '<pre>' . htmlspecialchars($body, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, $this->charset) . '</pre>';
|
||||
$body = '<pre>' . htmlspecialchars($body, \ENT_COMPAT | \ENT_HTML401 | \ENT_SUBSTITUTE, $this->charset) . '</pre>';
|
||||
|
||||
$text = substr_replace($text, $body . "\n", $start, $end + 13 - $start);
|
||||
$offset = 0;
|
||||
@ -792,7 +792,7 @@ class rcube_html2text
|
||||
private function _toupper($str)
|
||||
{
|
||||
// string can containing HTML tags
|
||||
$chunks = preg_split('/(<[^>]*>)/', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
$chunks = preg_split('/(<[^>]*>)/', $str, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
// convert toupper only the text between HTML tags
|
||||
foreach ($chunks as $idx => $chunk) {
|
||||
@ -813,9 +813,9 @@ class rcube_html2text
|
||||
*/
|
||||
private function _strtoupper($str)
|
||||
{
|
||||
$str = html_entity_decode($str, ENT_COMPAT, $this->charset);
|
||||
$str = html_entity_decode($str, \ENT_COMPAT, $this->charset);
|
||||
$str = mb_strtoupper($str);
|
||||
$str = htmlspecialchars($str, ENT_COMPAT, $this->charset);
|
||||
$str = htmlspecialchars($str, \ENT_COMPAT, $this->charset);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
@ -206,21 +206,21 @@ class rcube_image
|
||||
}
|
||||
|
||||
// do we have enough memory? (#1489937)
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && !$this->mem_check($props)) {
|
||||
if (strtoupper(substr(\PHP_OS, 0, 3)) == 'WIN' && !$this->mem_check($props)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// use GD extension
|
||||
if ($props['gd_type'] && $props['width'] > 0 && $props['height'] > 0) {
|
||||
if ($props['gd_type'] == IMAGETYPE_JPEG && function_exists('imagecreatefromjpeg')) {
|
||||
if ($props['gd_type'] == \IMAGETYPE_JPEG && function_exists('imagecreatefromjpeg')) {
|
||||
$image = @imagecreatefromjpeg($this->image_file);
|
||||
$type = 'jpg';
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_GIF && function_exists('imagecreatefromgif')) {
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_GIF && function_exists('imagecreatefromgif')) {
|
||||
$image = @imagecreatefromgif($this->image_file);
|
||||
$type = 'gif';
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')) {
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_PNG && function_exists('imagecreatefrompng')) {
|
||||
$image = @imagecreatefrompng($this->image_file);
|
||||
$type = 'png';
|
||||
}
|
||||
@ -251,7 +251,7 @@ class rcube_image
|
||||
}
|
||||
|
||||
// Fix transparency of gif/png image
|
||||
if ($props['gd_type'] != IMAGETYPE_JPEG) {
|
||||
if ($props['gd_type'] != \IMAGETYPE_JPEG) {
|
||||
imagealphablending($new_image, false);
|
||||
imagesavealpha($new_image, true);
|
||||
$transparent = imagecolorallocatealpha($new_image, 255, 255, 255, 127);
|
||||
@ -279,14 +279,14 @@ class rcube_image
|
||||
}
|
||||
}
|
||||
|
||||
if ($props['gd_type'] == IMAGETYPE_JPEG) {
|
||||
if ($props['gd_type'] == \IMAGETYPE_JPEG) {
|
||||
$result = imagejpeg($image, $filename, 75);
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_GIF) {
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_GIF) {
|
||||
$result = imagegif($image, $filename);
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_PNG) {
|
||||
$result = imagepng($image, $filename, 6, PNG_ALL_FILTERS);
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_PNG) {
|
||||
$result = imagepng($image, $filename, 6, \PNG_ALL_FILTERS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,21 +361,21 @@ class rcube_image
|
||||
$props = $this->props();
|
||||
|
||||
// do we have enough memory? (#1489937)
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' && !$this->mem_check($props)) {
|
||||
if (strtoupper(substr(\PHP_OS, 0, 3)) == 'WIN' && !$this->mem_check($props)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($props['gd_type']) {
|
||||
if ($props['gd_type'] == IMAGETYPE_JPEG && function_exists('imagecreatefromjpeg')) {
|
||||
if ($props['gd_type'] == \IMAGETYPE_JPEG && function_exists('imagecreatefromjpeg')) {
|
||||
$image = imagecreatefromjpeg($this->image_file);
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_GIF && function_exists('imagecreatefromgif')) {
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_GIF && function_exists('imagecreatefromgif')) {
|
||||
$image = imagecreatefromgif($this->image_file);
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')) {
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_PNG && function_exists('imagecreatefrompng')) {
|
||||
$image = imagecreatefrompng($this->image_file);
|
||||
}
|
||||
elseif ($props['gd_type'] == IMAGETYPE_WEBP && function_exists('imagecreatefromwebp')) {
|
||||
elseif ($props['gd_type'] == \IMAGETYPE_WEBP && function_exists('imagecreatefromwebp')) {
|
||||
$image = imagecreatefromwebp($this->image_file);
|
||||
}
|
||||
else {
|
||||
@ -390,7 +390,7 @@ class rcube_image
|
||||
$result = imagegif($image, $filename);
|
||||
}
|
||||
elseif ($type == self::TYPE_PNG) {
|
||||
$result = imagepng($image, $filename, 6, PNG_ALL_FILTERS);
|
||||
$result = imagepng($image, $filename, 6, \PNG_ALL_FILTERS);
|
||||
}
|
||||
|
||||
if (!empty($result)) {
|
||||
|
||||
@ -136,8 +136,8 @@ class rcube_imap extends rcube_storage
|
||||
$this->options['ident'] = [
|
||||
'name' => 'Roundcube',
|
||||
'version' => RCUBE_VERSION,
|
||||
'php' => PHP_VERSION,
|
||||
'os' => PHP_OS,
|
||||
'php' => \PHP_VERSION,
|
||||
'os' => \PHP_OS,
|
||||
'command' => $_SERVER['REQUEST_URI'] ?? '',
|
||||
];
|
||||
}
|
||||
@ -650,8 +650,8 @@ class rcube_imap extends rcube_storage
|
||||
$ident = $this->conn->id([
|
||||
'name' => 'Roundcube',
|
||||
'version' => RCUBE_VERSION,
|
||||
'php' => PHP_VERSION,
|
||||
'os' => PHP_OS,
|
||||
'php' => \PHP_VERSION,
|
||||
'os' => \PHP_OS,
|
||||
]);
|
||||
}
|
||||
else {
|
||||
@ -1809,7 +1809,7 @@ class rcube_imap extends rcube_storage
|
||||
public static function convert_criteria($str, $charset, $dest_charset = 'US-ASCII')
|
||||
{
|
||||
// convert strings to US_ASCII
|
||||
if (preg_match_all('/\{([0-9]+)\}\r\n/', $str, $matches, PREG_OFFSET_CAPTURE)) {
|
||||
if (preg_match_all('/\{([0-9]+)\}\r\n/', $str, $matches, \PREG_OFFSET_CAPTURE)) {
|
||||
$last = 0;
|
||||
$res = '';
|
||||
|
||||
@ -4530,7 +4530,7 @@ class rcube_imap extends rcube_storage
|
||||
|
||||
// strcoll() does not work with UTF8 locale on Windows,
|
||||
// use Collator from the intl extension
|
||||
if (stripos(PHP_OS, 'win') === 0 && function_exists('collator_compare')) {
|
||||
if (stripos(\PHP_OS, 'win') === 0 && function_exists('collator_compare')) {
|
||||
$locale = ($this->options['language'] ?? null) ?: 'en_US';
|
||||
$this->sort_folder_collator = collator_create($locale) ?: false;
|
||||
}
|
||||
|
||||
@ -924,8 +924,8 @@ class rcube_imap_cache
|
||||
return false;
|
||||
}
|
||||
|
||||
sort($uids_new, SORT_NUMERIC);
|
||||
sort($uids_old, SORT_NUMERIC);
|
||||
sort($uids_new, \SORT_NUMERIC);
|
||||
sort($uids_old, \SORT_NUMERIC);
|
||||
|
||||
if ($uids_old != $uids_new) {
|
||||
return false;
|
||||
|
||||
@ -141,7 +141,7 @@ class rcube_imap_generic
|
||||
}
|
||||
|
||||
$res = 0;
|
||||
if ($parts = preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) {
|
||||
if ($parts = preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, \PREG_SPLIT_DELIM_CAPTURE)) {
|
||||
for ($i = 0, $cnt = count($parts); $i < $cnt; $i++) {
|
||||
if ($i + 1 < $cnt && preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i + 1], $matches)) {
|
||||
// LITERAL+/LITERAL- support
|
||||
@ -677,7 +677,7 @@ class rcube_imap_generic
|
||||
$token = base64_encode($token);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
trigger_error($e->getMessage(), E_USER_WARNING);
|
||||
trigger_error($e->getMessage(), \E_USER_WARNING);
|
||||
return $this->setError(self::ERROR_BYE, "GSSAPI authentication failed");
|
||||
}
|
||||
|
||||
@ -715,7 +715,7 @@ class rcube_imap_generic
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
trigger_error($e->getMessage(), E_USER_WARNING);
|
||||
trigger_error($e->getMessage(), \E_USER_WARNING);
|
||||
return $this->setError(self::ERROR_BYE, "GSSAPI authentication failed");
|
||||
}
|
||||
|
||||
@ -1057,7 +1057,7 @@ class rcube_imap_generic
|
||||
$options = array_intersect_key($this->prefs['socket_options'], ['ssl' => 1]);
|
||||
$context = stream_context_create($options);
|
||||
$this->fp = stream_socket_client($host . ':' . $port, $errno, $errstr,
|
||||
$this->prefs['timeout'], STREAM_CLIENT_CONNECT, $context);
|
||||
$this->prefs['timeout'], \STREAM_CLIENT_CONNECT, $context);
|
||||
}
|
||||
else {
|
||||
$this->fp = @fsockopen($host, $port, $errno, $errstr, $this->prefs['timeout']);
|
||||
@ -1124,9 +1124,9 @@ class rcube_imap_generic
|
||||
else {
|
||||
// There is no flag to enable all TLS methods. Net_SMTP
|
||||
// handles enabling TLS similarly.
|
||||
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT
|
||||
| @STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
|
||||
| @STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
||||
$crypto_method = \STREAM_CRYPTO_METHOD_TLS_CLIENT
|
||||
| @\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
|
||||
| @\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
||||
}
|
||||
|
||||
if (!stream_socket_enable_crypto($this->fp, true, $crypto_method)) {
|
||||
@ -2792,11 +2792,11 @@ class rcube_imap_generic
|
||||
$index[$key] = $value;
|
||||
}
|
||||
|
||||
$sort_order = $order == 'ASC' ? SORT_ASC : SORT_DESC;
|
||||
$sort_flags = SORT_STRING | SORT_FLAG_CASE;
|
||||
$sort_order = $order == 'ASC' ? \SORT_ASC : \SORT_DESC;
|
||||
$sort_flags = \SORT_STRING | \SORT_FLAG_CASE;
|
||||
|
||||
if (in_array($field, ['arrival', 'date', 'internaldate', 'timestamp', 'size', 'uid', 'id'])) {
|
||||
$sort_flags = SORT_NUMERIC;
|
||||
$sort_flags = \SORT_NUMERIC;
|
||||
}
|
||||
|
||||
array_multisort($index, $sort_order, $sort_flags, $messages);
|
||||
@ -3309,7 +3309,7 @@ class rcube_imap_generic
|
||||
return false;
|
||||
}
|
||||
|
||||
$min_free = PHP_INT_MAX;
|
||||
$min_free = \PHP_INT_MAX;
|
||||
$result = [];
|
||||
$all = [];
|
||||
|
||||
@ -3602,7 +3602,7 @@ class rcube_imap_generic
|
||||
|
||||
// create options string
|
||||
if (is_array($options)) {
|
||||
$options = array_change_key_case($options, CASE_UPPER);
|
||||
$options = array_change_key_case($options, \CASE_UPPER);
|
||||
$opts = [];
|
||||
|
||||
if (!empty($options['MAXSIZE'])) {
|
||||
|
||||
@ -193,7 +193,7 @@ class rcube_imap_search_job // extends Stackable
|
||||
$imap = $this->worker->get_imap();
|
||||
|
||||
if (!$imap->connected()) {
|
||||
trigger_error("No IMAP connection for $this->folder", E_USER_WARNING);
|
||||
trigger_error("No IMAP connection for $this->folder", \E_USER_WARNING);
|
||||
|
||||
if ($this->threading) {
|
||||
return new rcube_result_thread($this->folder);
|
||||
|
||||
@ -1115,14 +1115,14 @@ class rcube_ldap extends rcube_addressbook
|
||||
$dn = self::dn_decode($dn);
|
||||
|
||||
if ($rec = $this->ldap->get_entry($dn, $this->prop['attributes'])) {
|
||||
$rec = array_change_key_case($rec, CASE_LOWER);
|
||||
$rec = array_change_key_case($rec, \CASE_LOWER);
|
||||
}
|
||||
|
||||
// Use ldap_list to get subentries like country (c) attribute (#1488123)
|
||||
if (!empty($rec) && $this->sub_filter) {
|
||||
if ($entries = $this->ldap->list_entries($dn, $this->sub_filter, array_keys($this->prop['sub_fields']))) {
|
||||
foreach ($entries as $entry) {
|
||||
$lrec = array_change_key_case($entry, CASE_LOWER);
|
||||
$lrec = array_change_key_case($entry, \CASE_LOWER);
|
||||
$rec = array_merge($lrec, $rec);
|
||||
}
|
||||
}
|
||||
@ -2003,7 +2003,7 @@ class rcube_ldap extends rcube_addressbook
|
||||
}
|
||||
// when using VLV the list of groups is already sorted
|
||||
else {
|
||||
array_multisort($group_sortnames, SORT_ASC, SORT_STRING, $groups);
|
||||
array_multisort($group_sortnames, \SORT_ASC, \SORT_STRING, $groups);
|
||||
}
|
||||
|
||||
// cache this
|
||||
@ -2315,7 +2315,7 @@ class rcube_ldap extends rcube_addressbook
|
||||
*/
|
||||
static function dn_decode($str)
|
||||
{
|
||||
$str = str_pad(strtr($str, '-_', '+/'), strlen($str) % 4, '=', STR_PAD_RIGHT);
|
||||
$str = str_pad(strtr($str, '-_', '+/'), strlen($str) % 4, '=', \STR_PAD_RIGHT);
|
||||
return base64_decode($str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,22 +63,22 @@ class rcube_ldap_generic extends Net_LDAP3
|
||||
$msg = implode("\n", $msg);
|
||||
|
||||
switch ($level) {
|
||||
case LOG_DEBUG:
|
||||
case LOG_INFO:
|
||||
case LOG_NOTICE:
|
||||
case \LOG_DEBUG:
|
||||
case \LOG_INFO:
|
||||
case \LOG_NOTICE:
|
||||
if (!empty($this->config['debug'])) {
|
||||
rcube::write_log('ldap', $msg);
|
||||
}
|
||||
break;
|
||||
|
||||
case LOG_EMERG:
|
||||
case LOG_ALERT:
|
||||
case LOG_CRIT:
|
||||
case \LOG_EMERG:
|
||||
case \LOG_ALERT:
|
||||
case \LOG_CRIT:
|
||||
rcube::raise_error($msg, true, true);
|
||||
break;
|
||||
|
||||
case LOG_ERR:
|
||||
case LOG_WARNING:
|
||||
case \LOG_ERR:
|
||||
case \LOG_WARNING:
|
||||
$this->error = $msg;
|
||||
rcube::raise_error($msg, true, false);
|
||||
break;
|
||||
|
||||
@ -1158,10 +1158,10 @@ class rcube_message
|
||||
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
|
||||
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
|
||||
|
||||
while (preg_match($uu_regexp_begin, $part->body, $matches, PREG_OFFSET_CAPTURE)) {
|
||||
while (preg_match($uu_regexp_begin, $part->body, $matches, \PREG_OFFSET_CAPTURE)) {
|
||||
$startpos = $matches[0][1];
|
||||
|
||||
if (!preg_match($uu_regexp_end, $part->body, $m, PREG_OFFSET_CAPTURE, $startpos)) {
|
||||
if (!preg_match($uu_regexp_end, $part->body, $m, \PREG_OFFSET_CAPTURE, $startpos)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ class rcube_mime
|
||||
$re = '/=\?([^?]+)\?([BbQq])\?([^\n]*?)\?=/';
|
||||
|
||||
// Find all RFC2047's encoded words
|
||||
if (preg_match_all($re, $input, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
if (preg_match_all($re, $input, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER)) {
|
||||
// Initialize variables
|
||||
$tmp = [];
|
||||
$out = '';
|
||||
@ -753,15 +753,15 @@ class rcube_mime
|
||||
// null as a 2nd argument should be the same as no argument
|
||||
// this however is not true on all systems/versions
|
||||
if ($mime_magic) {
|
||||
$finfo = finfo_open(FILEINFO_MIME, $mime_magic);
|
||||
$finfo = finfo_open(\FILEINFO_MIME, $mime_magic);
|
||||
}
|
||||
else {
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
$finfo = finfo_open(\FILEINFO_MIME);
|
||||
}
|
||||
|
||||
if ($finfo) {
|
||||
$func = $is_stream ? 'finfo_buffer' : 'finfo_file';
|
||||
$mime_type = $func($finfo, $path, FILEINFO_MIME_TYPE);
|
||||
$mime_type = $func($finfo, $path, \FILEINFO_MIME_TYPE);
|
||||
finfo_close($finfo);
|
||||
}
|
||||
}
|
||||
@ -798,7 +798,7 @@ class rcube_mime
|
||||
|
||||
// use file name suffix with hard-coded mime-type map
|
||||
if (!empty($mime_ext) && $filename) {
|
||||
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$ext = strtolower(pathinfo($filename, \PATHINFO_EXTENSION));
|
||||
if ($ext && !empty($mime_ext[$ext])) {
|
||||
return $mime_ext[$ext];
|
||||
}
|
||||
@ -830,7 +830,7 @@ class rcube_mime
|
||||
}
|
||||
|
||||
// try common locations
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
if (strtoupper(substr(\PHP_OS, 0, 3)) == 'WIN') {
|
||||
$file_paths[] = 'C:/xampp/apache/conf/mime.types';
|
||||
}
|
||||
else {
|
||||
@ -852,7 +852,7 @@ class rcube_mime
|
||||
|
||||
foreach ($file_paths as $fp) {
|
||||
if (@is_readable($fp)) {
|
||||
$lines = file($fp, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$lines = file($fp, \FILE_IGNORE_NEW_LINES | \FILE_SKIP_EMPTY_LINES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ abstract class rcube_output
|
||||
public function raise_error($code, $message)
|
||||
{
|
||||
// STUB: to be overloaded by specific output classes
|
||||
fwrite(STDERR, "Error $code: $message\n");
|
||||
fwrite(\STDERR, "Error $code: $message\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -374,16 +374,16 @@ abstract class rcube_output
|
||||
*/
|
||||
public static function json_serialize($input, $pretty = false, $inline = true)
|
||||
{
|
||||
$options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_IGNORE;
|
||||
$options = \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE | \JSON_INVALID_UTF8_IGNORE;
|
||||
|
||||
// JSON_HEX_TAG is needed for inlining JSON inside of the <script> tag
|
||||
// if input contains a html tag it will cause issues (#6207)
|
||||
if ($inline) {
|
||||
$options |= JSON_HEX_TAG;
|
||||
$options |= \JSON_HEX_TAG;
|
||||
}
|
||||
|
||||
if ($pretty) {
|
||||
$options |= JSON_PRETTY_PRINT;
|
||||
$options |= \JSON_PRETTY_PRINT;
|
||||
}
|
||||
|
||||
return json_encode($input, $options);
|
||||
|
||||
@ -293,7 +293,7 @@ class rcube_result_index
|
||||
$end = implode('|', ['$', preg_quote(self::SEPARATOR_ELEMENT, '/')]);
|
||||
|
||||
if (preg_match("/($begin)$msgid($end)/", $this->raw_data, $m,
|
||||
$get_index ? PREG_OFFSET_CAPTURE : 0)
|
||||
$get_index ? \PREG_OFFSET_CAPTURE : 0)
|
||||
) {
|
||||
if ($get_index) {
|
||||
$idx = 0;
|
||||
|
||||
@ -285,7 +285,7 @@ class rcube_result_thread
|
||||
]);
|
||||
|
||||
if (preg_match("/($begin)$msgid($end)/", $this->raw_data, $m,
|
||||
$get_index ? PREG_OFFSET_CAPTURE : 0)
|
||||
$get_index ? \PREG_OFFSET_CAPTURE : 0)
|
||||
) {
|
||||
if ($get_index) {
|
||||
$idx = 0;
|
||||
|
||||
@ -553,10 +553,10 @@ class rcube_smtp
|
||||
if ($rcube->config->get('smtp_xclient_addr') && in_array_nocase('addr', $opts)) {
|
||||
$ip = rcube_utils::remote_addr();
|
||||
|
||||
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
|
||||
if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
|
||||
$r = $ip;
|
||||
}
|
||||
elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
elseif (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
|
||||
$r = "IPV6:{$ip}";
|
||||
}
|
||||
else {
|
||||
|
||||
@ -238,7 +238,7 @@ class rcube_string_replacer
|
||||
[$this, 'linkref_callback'], $str, -1, $count, PREG_OFFSET_CAPTURE
|
||||
);
|
||||
*/
|
||||
if (preg_match_all($this->linkref_index, $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
if (preg_match_all($this->linkref_index, $str, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER)) {
|
||||
$diff = 0;
|
||||
foreach ($matches as $m) {
|
||||
$replace = $this->linkref_addindex($m);
|
||||
@ -247,7 +247,7 @@ class rcube_string_replacer
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match_all($this->linkref_pattern, $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
if (preg_match_all($this->linkref_pattern, $str, $matches, \PREG_OFFSET_CAPTURE | \PREG_SET_ORDER)) {
|
||||
$diff = 0;
|
||||
foreach ($matches as $m) {
|
||||
$replace = $this->linkref_callback($m);
|
||||
|
||||
@ -265,7 +265,7 @@ class rcube_text2html
|
||||
static $table;
|
||||
|
||||
if (empty($table)) {
|
||||
$table = get_html_translation_table(HTML_SPECIALCHARS);
|
||||
$table = get_html_translation_table(\HTML_SPECIALCHARS);
|
||||
unset($table['?']);
|
||||
|
||||
// replace some whitespace characters
|
||||
|
||||
@ -275,7 +275,7 @@ trait rcube_uploads
|
||||
$data = array_filter($data, static function ($v) { return $v !== null; });
|
||||
|
||||
// Convert to string
|
||||
$data = json_encode($data, JSON_INVALID_UTF8_IGNORE);
|
||||
$data = json_encode($data, \JSON_INVALID_UTF8_IGNORE);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ class rcube_utils
|
||||
*/
|
||||
public static function check_ip($ip)
|
||||
{
|
||||
return filter_var($ip, FILTER_VALIDATE_IP) !== false;
|
||||
return filter_var($ip, \FILTER_VALIDATE_IP) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,7 +197,7 @@ class rcube_utils
|
||||
// encode for HTML output
|
||||
if ($enctype == 'html') {
|
||||
if (!$html_encode_arr) {
|
||||
$html_encode_arr = get_html_translation_table(HTML_SPECIALCHARS);
|
||||
$html_encode_arr = get_html_translation_table(\HTML_SPECIALCHARS);
|
||||
unset($html_encode_arr['?']);
|
||||
}
|
||||
|
||||
@ -727,7 +727,7 @@ class rcube_utils
|
||||
if (strpos($name, '%s') !== false) {
|
||||
$user_email = self::idn_to_ascii(self::get_input_value('_user', self::INPUT_POST));
|
||||
$matches = preg_match('/(.*)@([a-z0-9\.\-\[\]\:]+)/i', $user_email, $s);
|
||||
if ($matches < 1 || filter_var($s[1] . "@" . $s[2], FILTER_VALIDATE_EMAIL) === false) {
|
||||
if ($matches < 1 || filter_var($s[1] . "@" . $s[2], \FILTER_VALIDATE_EMAIL) === false) {
|
||||
return false;
|
||||
}
|
||||
$s = $s[2];
|
||||
@ -905,7 +905,7 @@ class rcube_utils
|
||||
}
|
||||
|
||||
if (!empty($headers)) {
|
||||
$headers = array_change_key_case($headers, CASE_UPPER);
|
||||
$headers = array_change_key_case($headers, \CASE_UPPER);
|
||||
|
||||
return $headers[$key] ?? null;
|
||||
}
|
||||
@ -922,7 +922,7 @@ class rcube_utils
|
||||
public static function explode_quoted_string($delimiter, $string)
|
||||
{
|
||||
$res = [];
|
||||
$parts = preg_split('/("(?:[^"\\\\]+|\\\\.)*+(?:"|\\\\?$))/s', $string, 0, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$parts = preg_split('/("(?:[^"\\\\]+|\\\\.)*+(?:"|\\\\?$))/s', $string, 0, \PREG_SPLIT_DELIM_CAPTURE);
|
||||
$isQuoted = false;
|
||||
$tmp = '';
|
||||
foreach ($parts as $part) {
|
||||
@ -1158,7 +1158,7 @@ class rcube_utils
|
||||
|
||||
// Note that in PHP 7.2/7.3 calling idn_to_* functions with default arguments
|
||||
// throws a warning, so we have to set the variant explicitly (#6075)
|
||||
$variant = INTL_IDNA_VARIANT_UTS46;
|
||||
$variant = \INTL_IDNA_VARIANT_UTS46;
|
||||
$options = 0;
|
||||
|
||||
// Because php-intl extension lowercases domains and return false
|
||||
@ -1166,12 +1166,12 @@ class rcube_utils
|
||||
|
||||
if ($is_utf) {
|
||||
if (preg_match('/[^\x20-\x7E]/', $domain)) {
|
||||
$options = IDNA_NONTRANSITIONAL_TO_ASCII;
|
||||
$options = \IDNA_NONTRANSITIONAL_TO_ASCII;
|
||||
$domain = idn_to_ascii($domain, $options, $variant);
|
||||
}
|
||||
}
|
||||
elseif (preg_match('/(^|\.)xn--/i', $domain)) {
|
||||
$options = IDNA_NONTRANSITIONAL_TO_UNICODE;
|
||||
$options = \IDNA_NONTRANSITIONAL_TO_UNICODE;
|
||||
$domain = idn_to_utf8($domain, $options, $variant);
|
||||
}
|
||||
|
||||
@ -1364,7 +1364,7 @@ class rcube_utils
|
||||
*/
|
||||
public static function prompt_silent($prompt = "Password:")
|
||||
{
|
||||
if (preg_match('/^win/i', PHP_OS)) {
|
||||
if (preg_match('/^win/i', \PHP_OS)) {
|
||||
$vbscript = sys_get_temp_dir() . 'prompt_password.vbs';
|
||||
$vbcontent = 'wscript.echo(InputBox("' . addslashes($prompt) . '", "", "password here"))';
|
||||
file_put_contents($vbscript, $vbcontent);
|
||||
@ -1380,7 +1380,7 @@ class rcube_utils
|
||||
|
||||
if (rtrim(shell_exec($command)) !== 'OK') {
|
||||
echo $prompt;
|
||||
$pass = trim(fgets(STDIN));
|
||||
$pass = trim(fgets(\STDIN));
|
||||
echo chr(8) . "\r" . $prompt . str_repeat("*", strlen($pass)) . "\n";
|
||||
|
||||
return $pass;
|
||||
@ -1416,7 +1416,7 @@ class rcube_utils
|
||||
*/
|
||||
public static function is_absolute_path($path)
|
||||
{
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
if (strtoupper(substr(\PHP_OS, 0, 3)) == 'WIN') {
|
||||
return (bool) preg_match('!^[a-z]:[\\\\/]!i', $path);
|
||||
}
|
||||
|
||||
@ -1586,17 +1586,17 @@ class rcube_utils
|
||||
*/
|
||||
public static function preg_error($error = [], $terminate = false)
|
||||
{
|
||||
if (($preg_error = preg_last_error()) != PREG_NO_ERROR) {
|
||||
if (($preg_error = preg_last_error()) != \PREG_NO_ERROR) {
|
||||
$errstr = "PCRE Error: $preg_error.";
|
||||
|
||||
if (function_exists('preg_last_error_msg')) {
|
||||
$errstr .= ' ' . preg_last_error_msg();
|
||||
}
|
||||
|
||||
if ($preg_error == PREG_BACKTRACK_LIMIT_ERROR) {
|
||||
if ($preg_error == \PREG_BACKTRACK_LIMIT_ERROR) {
|
||||
$errstr .= " Consider raising pcre.backtrack_limit!";
|
||||
}
|
||||
if ($preg_error == PREG_RECURSION_LIMIT_ERROR) {
|
||||
if ($preg_error == \PREG_RECURSION_LIMIT_ERROR) {
|
||||
$errstr .= " Consider raising pcre.recursion_limit!";
|
||||
}
|
||||
|
||||
|
||||
@ -264,7 +264,7 @@ class rcube_washtml
|
||||
if (preg_match('/^url\(/i', $val)) {
|
||||
if (preg_match('/^url\(\s*[\'"]?([^\'"\)]*)[\'"]?\s*\)/iu', $val, $match)) {
|
||||
if ($url = $this->wash_uri($match[1])) {
|
||||
$value .= ' url(' . htmlspecialchars($url, ENT_QUOTES, $this->config['charset']) . ')';
|
||||
$value .= ' url(' . htmlspecialchars($url, \ENT_QUOTES, $this->config['charset']) . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -342,8 +342,8 @@ class rcube_washtml
|
||||
if (preg_match('/^([a-z:]*url)\(\s*[\'"]?([^\'"\)]*)[\'"]?\s*\)/iu', $value, $match)) {
|
||||
if ($url = $this->wash_uri($match[2])) {
|
||||
$result .= ' ' . $attr->nodeName . '="' . $match[1]
|
||||
. '(' . htmlspecialchars($url, ENT_QUOTES, $this->config['charset']) . ')'
|
||||
. htmlspecialchars(substr($value, strlen($match[0])), ENT_QUOTES, $this->config['charset']) . '"';
|
||||
. '(' . htmlspecialchars($url, \ENT_QUOTES, $this->config['charset']) . ')'
|
||||
. htmlspecialchars(substr($value, strlen($match[0])), \ENT_QUOTES, $this->config['charset']) . '"';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -365,15 +365,15 @@ class rcube_washtml
|
||||
}
|
||||
|
||||
if ($out !== null && $out !== '') {
|
||||
$v = htmlspecialchars($out, ENT_QUOTES | ENT_SUBSTITUTE, $this->config['charset']);
|
||||
$v = htmlspecialchars($out, \ENT_QUOTES | \ENT_SUBSTITUTE, $this->config['charset']);
|
||||
$result .= " {$attr->nodeName}=\"{$v}\"";
|
||||
}
|
||||
elseif ($value) {
|
||||
$washed[] = htmlspecialchars($attr->nodeName, ENT_QUOTES, $this->config['charset']);
|
||||
$washed[] = htmlspecialchars($attr->nodeName, \ENT_QUOTES, $this->config['charset']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$washed[] = htmlspecialchars($attr->nodeName, ENT_QUOTES, $this->config['charset']);
|
||||
$washed[] = htmlspecialchars($attr->nodeName, \ENT_QUOTES, $this->config['charset']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ class rcube_washtml
|
||||
|
||||
do {
|
||||
switch ($node->nodeType) {
|
||||
case XML_ELEMENT_NODE: //Check element
|
||||
case \XML_ELEMENT_NODE: //Check element
|
||||
$tagName = strtolower($node->nodeName);
|
||||
|
||||
if ($tagName == 'link') {
|
||||
@ -618,13 +618,13 @@ class rcube_washtml
|
||||
if ($ns->nodeName != 'xmlns:xml') {
|
||||
$dump .= sprintf(' %s="%s"',
|
||||
$ns->nodeName,
|
||||
htmlspecialchars($ns->nodeValue, ENT_QUOTES, $this->config['charset'])
|
||||
htmlspecialchars($ns->nodeValue, \ENT_QUOTES, $this->config['charset'])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($tagName == 'textarea' && strpos($content, '<') !== false) {
|
||||
$content = htmlspecialchars($content, ENT_QUOTES | ENT_SUBSTITUTE, $this->config['charset']);
|
||||
$content = htmlspecialchars($content, \ENT_QUOTES | \ENT_SUBSTITUTE, $this->config['charset']);
|
||||
}
|
||||
|
||||
$dump .= $this->wash_attribs($node);
|
||||
@ -637,20 +637,20 @@ class rcube_washtml
|
||||
}
|
||||
}
|
||||
elseif (isset($this->_ignore_elements[$tagName])) {
|
||||
$dump .= '<!-- ' . htmlspecialchars($node->nodeName, ENT_QUOTES, $this->config['charset']) . ' not allowed -->';
|
||||
$dump .= '<!-- ' . htmlspecialchars($node->nodeName, \ENT_QUOTES, $this->config['charset']) . ' not allowed -->';
|
||||
}
|
||||
else {
|
||||
$dump .= '<!-- ' . htmlspecialchars($node->nodeName, ENT_QUOTES, $this->config['charset']) . ' ignored -->';
|
||||
$dump .= '<!-- ' . htmlspecialchars($node->nodeName, \ENT_QUOTES, $this->config['charset']) . ' ignored -->';
|
||||
$dump .= $this->dumpHtml($node, $level); // ignore tags not its content
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
case XML_TEXT_NODE:
|
||||
$dump .= htmlspecialchars($node->nodeValue, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, $this->config['charset']);
|
||||
case \XML_CDATA_SECTION_NODE:
|
||||
case \XML_TEXT_NODE:
|
||||
$dump .= htmlspecialchars($node->nodeValue, \ENT_COMPAT | \ENT_HTML401 | \ENT_SUBSTITUTE, $this->config['charset']);
|
||||
break;
|
||||
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
case \XML_HTML_DOCUMENT_NODE:
|
||||
$dump .= $this->dumpHtml($node, $level);
|
||||
break;
|
||||
}
|
||||
@ -705,7 +705,7 @@ class rcube_washtml
|
||||
if (empty($node)) {
|
||||
// Charset seems to be ignored (probably if defined in the HTML document)
|
||||
$node = new DOMDocument('1.0', $this->config['charset']);
|
||||
@$node->{$method}($html, LIBXML_PARSEHUGE | LIBXML_COMPACT | LIBXML_NONET);
|
||||
@$node->{$method}($html, \LIBXML_PARSEHUGE | \LIBXML_COMPACT | \LIBXML_NONET);
|
||||
}
|
||||
|
||||
unset($html); // release some memory
|
||||
|
||||
@ -140,7 +140,7 @@ class rcube_session_memcache extends rcube_session
|
||||
}
|
||||
|
||||
$data = serialize(['changed' => time(), 'ip' => $this->ip, 'vars' => $vars]);
|
||||
$result = $this->memcache->set($key, $data, MEMCACHE_COMPRESSED, $this->lifetime + 60);
|
||||
$result = $this->memcache->set($key, $data, \MEMCACHE_COMPRESSED, $this->lifetime + 60);
|
||||
|
||||
if ($this->debug) {
|
||||
$this->debug('set', $key, $data, $result);
|
||||
@ -164,7 +164,7 @@ class rcube_session_memcache extends rcube_session
|
||||
|
||||
if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 3) {
|
||||
$data = serialize(['changed' => time(), 'ip' => $this->ip, 'vars' => $newvars]);
|
||||
$result = $this->memcache->set($key, $data, MEMCACHE_COMPRESSED, $this->lifetime + 60);
|
||||
$result = $this->memcache->set($key, $data, \MEMCACHE_COMPRESSED, $this->lifetime + 60);
|
||||
|
||||
if ($this->debug) {
|
||||
$this->debug('set', $key, $data, $result);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user