php 8.2 deprecations

This commit is contained in:
oheil 2023-03-05 20:06:15 +01:00
parent a9db0daa30
commit 1812bb1056
8 changed files with 69 additions and 11 deletions

View file

@ -14,7 +14,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: class_smtp.php 3059 2023-03-05 14:27:24Z oheil $
* @version SVN: $Id: class_smtp.php 3060 2023-03-05 19:06:00Z oheil $
*/
require_once 'exception.php';
@ -98,6 +98,12 @@ class smtp {
if( isset($conf->domains[$domainnum]->smtp_verify_peer_name) && $conf->domains[$domainnum]->smtp_verify_peer_name==true ) {
stream_context_set_option($context, "ssl", "verify_peer_name", $conf->domains[$domainnum]->smtp_verify_peer_name);
}
if( isset($conf->domains[$domainnum]->smtp_peer_name) && $conf->domains[$domainnum]->smtp_peer_name!="" ) {
stream_context_set_option($context, "ssl", "peer_name", $conf->domains[$domainnum]->smtp_peer_name);
}
if( isset($conf->domains[$domainnum]->smtp_security_level) && $conf->domains[$domainnum]->smtp_security_level>=0 ) {
stream_context_set_option($context, "ssl", "security_level", $conf->domains[$domainnum]->smtp_security_level);
}
//stream_context_set_option($context, "ssl", "peer_name", "localdomain");
//stream_context_set_option($context, "ssl", "security_level", 0);

View file

@ -10,7 +10,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: nocc_languages.php 3057 2023-03-04 14:45:24Z oheil $
* @version SVN: $Id: nocc_languages.php 3060 2023-03-05 19:06:00Z oheil $
*/
/**
@ -56,6 +56,7 @@ class NOCC_Languages {
$path .= '/';
}
$this->_languages["default"]='';
//TODO: Move some code to a NOCC_Directory class?
if ($handle = opendir($path)) { //if can open the directory...
while (false !== ($name = readdir($handle))) { //for each item...

View file

@ -10,7 +10,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: nocc_theme.php 2580 2013-08-19 21:57:33Z gerundt $
* @version SVN: $Id: nocc_theme.php 3060 2023-03-05 19:06:00Z oheil $
*/
/**
@ -181,4 +181,4 @@ class NOCC_Theme {
return $body;
}
}
}

View file

@ -12,7 +12,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: user_prefs.php 2930 2021-02-03 11:08:55Z oheil $
* @version SVN: $Id: user_prefs.php 3060 2023-03-05 19:06:00Z oheil $
*/
require_once 'exception.php';
@ -186,7 +186,7 @@ class NOCCUserPrefs {
$this->_sendHtmlMail = false;
$this->_useGraphicalSmilies = false;
$this->_useSentFolder = false;
$this->_sendFolderName = '';
$this->_sentFolderName = '';
$this->_useTrashFolder = false;
$this->_trashFolderName = '';
$this->_useInboxFolder = true;

View file

@ -11,7 +11,7 @@
*
* @package NOCC
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: common.php 3057 2023-03-04 14:45:24Z oheil $
* @version SVN: $Id: common.php 3060 2023-03-05 19:06:00Z oheil $
*/
define('NOCC_DEBUG_LEVEL', 0);
@ -99,7 +99,9 @@ if (isset($_REQUEST['user']) && !isset($_SESSION['nocc_loggedin'])) {
$_SESSION['nocc_user'] = NOCC_Request::getStringValue('user');
if( ! isset($conf->utf8_decode) || $conf->utf8_decode ) {
if( mb_detect_encoding($_SESSION['nocc_user'],'UTF-8',true) == "UTF-8" ) {
$_SESSION['nocc_user'] = utf8_decode($_SESSION['nocc_user']);
//deprecated in php8.2
//$_SESSION['nocc_user'] = utf8_decode($_SESSION['nocc_user']);
$_SESSION['nocc_user'] = iconv('UTF-8', 'ISO-8859-1', $_SESSION['nocc_user']);
}
}
}
@ -108,7 +110,9 @@ if (isset($_REQUEST['passwd'])) {
$_SESSION['nocc_passwd'] = NOCC_Request::getStringValue('passwd');
if( ! isset($conf->utf8_decode) || $conf->utf8_decode ) {
if( mb_detect_encoding($_SESSION['nocc_passwd'],'UTF-8',true) == "UTF-8" ) {
$_SESSION['nocc_passwd'] = utf8_decode($_SESSION['nocc_passwd']);
//deprecated in php8.2
//$_SESSION['nocc_passwd'] = utf8_decode($_SESSION['nocc_passwd']);
$_SESSION['nocc_passwd'] = iconv('UTF-8', 'ISO-8859-1', $_SESSION['nocc_passwd']);
}
}
$pwd_to_encrypt = true;

View file

@ -14,7 +14,7 @@
* @package NOCC
* @subpackage Configuration
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: conf.php.dist 3050 2023-02-23 13:18:20Z oheil $
* @version SVN: $Id: conf.php.dist 3060 2023-03-05 19:06:00Z oheil $
*/
// ################### This is the main configuration for NOCC ########## //
@ -143,6 +143,18 @@ $conf->loaded = true;
// verify the smtp servers name
// true or false
//
// $conf->domains[$i]->smtp_peer_name = '';
// SSL certificates can be rejected because of mismatch of expected and real smtp server names.
// If you see the following error on your php log
// stream_socket_enable_crypto(): Peer certificate CN=`smtp.server.com' did not match expected CN=`some.other.name'
// set this string to 'some.other.name'
//
// $conf->domains[$i]->smtp_security_level = -1;
// See https://www.php.net/manual/de/context.ssl.php for general documentation.
// If you have problems with SSL connection to your SMTP server you try to lower
// the security level by setting this option to 0.
// Valid values are 0,1,2,3,4 or 5.
//
// $conf->domains[$i]->smtp_user = '';
// the user name, if your smtp server is configured to have a fixed, user independent, user/password authentication
// if empty, the login credentials of the NOCC user are used
@ -216,6 +228,8 @@ $conf->domains[$i]->quota_type = 'STORAGE';
$conf->domains[$i]->smtp_allow_self_signed = false;
$conf->domains[$i]->smtp_verify_peer = true;
$conf->domains[$i]->smtp_verify_peer_name = true;
$conf->domains[$i]->smtp_peer_name = '';
$conf->domains[$i]->smtp_security_level = -1;
$conf->domains[$i]->smtp_user = '';
$conf->domains[$i]->smtp_password = '';
$conf->domains[$i]->smtp_user_without_domain = false;
@ -248,6 +262,8 @@ $conf->domains[$i]->allow_rss = false;
//$conf->domains[$i]->smtp_allow_self_signed = false;
//$conf->domains[$i]->smtp_verify_peer = true;
//$conf->domains[$i]->smtp_verify_peer_name = true;
//$conf->domains[$i]->smtp_peer_name = '';
//$conf->domains[$i]->smtp_security_level = -1;
//$conf->domains[$i]->smtp_user = '';
//$conf->domains[$i]->smtp_password = '';
//$conf->domains[$i]->allow_address_change = true;
@ -275,6 +291,8 @@ $conf->domains[$i]->allow_rss = false;
//$conf->domains[$i]->smtp_allow_self_signed = false;
//$conf->domains[$i]->smtp_verify_peer = true;
//$conf->domains[$i]->smtp_verify_peer_name = true;
//$conf->domains[$i]->smtp_peer_name = '';
//$conf->domains[$i]->smtp_security_level = -1;
//$conf->domains[$i]->smtp_user = '';
//$conf->domains[$i]->smtp_password = '';
//$conf->domains[$i]->allow_address_change = true;

View file

@ -1,6 +1,20 @@
Latest version is 1.9.12
NOCC 1.9.13 FebXXXry XX, 2023
Misc
* Compatibility with PHP 8.2 (Oliver Heil).
* Integrating htmlpurifier (4.15.0-lite) (http://htmlpurifier.org) (Oliver Heil).
* New domain specific configuration options "smtp_peer_name" and
"smtp_security_level" if you encounter problems with SSL connection to the
SMTP server, see config/conf.php.dist for details or see discussion
https://sourceforge.net/p/nocc/discussion/38301/thread/daf7c51607/
(Oliver Heil).
Bugs
* Regression bugs (Oliver Heil).
NOCC 1.9.12 February 28, 2023
Misc

View file

@ -14,7 +14,7 @@
* @package NOCC
* @subpackage Utilities
* @license http://www.gnu.org/licenses/ GNU General Public License
* @version SVN: $Id: functions.php 2980 2021-12-16 10:21:02Z oheil $
* @version SVN: $Id: functions.php 3060 2023-03-05 19:06:00Z oheil $
*/
require_once './classes/class_local.php';
@ -437,6 +437,21 @@ function remove_stuff($body,$mime,$charset='UTF-8') {
$body='<span style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;">'.$body.'</span>';
}
class HTMLPurifier_URIScheme_cid extends HTMLPurifier_URIScheme {
public $browsable = true;
public $allowed_types = array(
'image/jpeg' => true,
'image/gif' => true,
'image/png' => true,
'application/octet-stream' => true,
);
public $may_omit_host = true;
public function doValidate(&$uri, $config, $context) {
return true;
}
}
HTMLPurifier_URISchemeRegistry::instance()->register("cid", new HTMLPurifier_URIScheme_cid());
$hp_config = HTMLPurifier_Config::createDefault();
$hp_config->set('Core.Encoding',$charset);
$hp_config->set('Attr.DefaultImageAlt','');