diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 6ae1889aa..2ad94ef30 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -200,9 +200,16 @@ class Context */ function init() { - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) { - if(simplexml_load_string(file_get_contents("php://input")) !== false) $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); - if(strpos($_SERVER['CONTENT_TYPE'], 'json') || strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json')) $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); + // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above + if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) + { + $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); + + // If content is not XML JSON, unset + if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) + { + unset($GLOBALS['HTTP_RAW_POST_DATA']); + } } // set context variables in $GLOBALS (to use in display handler) diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 317ee19e1..338e6d14d 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -1089,7 +1089,7 @@ class DB * this method is protected * @return boolean */ - function _begin() + function _begin($transactionLevel = 0) { return TRUE; } @@ -1117,7 +1117,7 @@ class DB * this method is protected * @return boolean */ - function _rollback() + function _rollback($transactionLevel = 0) { return TRUE; } diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index fc977d81a..546495d53 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -144,7 +144,7 @@ class DBCubrid extends DB * this method is private * @return boolean */ - function _begin($transactionLevel) + function _begin($transactionLevel = 0) { if(__CUBRID_VERSION__ >= '8.4.0') { @@ -167,7 +167,7 @@ class DBCubrid extends DB * this method is private * @return boolean */ - function _rollback($transactionLevel) + function _rollback($transactionLevel = 0) { $connection = $this->_getConnection('master'); diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index 32adb251c..10a59b985 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -113,7 +113,7 @@ class DBMssql extends DB * this method is private * @return boolean */ - function _begin($transactionLevel) + function _begin($transactionLevel = 0) { $connection = $this->_getConnection('master'); @@ -136,7 +136,7 @@ class DBMssql extends DB * this method is private * @return boolean */ - function _rollback($transactionLevel) + function _rollback($transactionLevel = 0) { $connection = $this->_getConnection('master'); diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 2e9bf606c..545b1310a 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -147,7 +147,7 @@ class DBMysql extends DB * this method is private * @return boolean */ - function _begin() + function _begin($transactionLevel = 0) { return true; } @@ -157,7 +157,7 @@ class DBMysql extends DB * this method is private * @return boolean */ - function _rollback() + function _rollback($transactionLevel = 0) { return true; } diff --git a/classes/db/DBMysql_innodb.class.php b/classes/db/DBMysql_innodb.class.php index affa59aab..e19bcffe5 100644 --- a/classes/db/DBMysql_innodb.class.php +++ b/classes/db/DBMysql_innodb.class.php @@ -51,7 +51,7 @@ class DBMysql_innodb extends DBMysql * this method is private * @return boolean */ - function _begin($transactionLevel) + function _begin($transactionLevel = 0) { $connection = $this->_getConnection('master'); @@ -71,7 +71,7 @@ class DBMysql_innodb extends DBMysql * this method is private * @return boolean */ - function _rollback($transactionLevel) + function _rollback($transactionLevel = 0) { $connection = $this->_getConnection('master'); diff --git a/classes/db/DBMysqli_innodb.class.php b/classes/db/DBMysqli_innodb.class.php index 55422b61f..cfc9d23c1 100644 --- a/classes/db/DBMysqli_innodb.class.php +++ b/classes/db/DBMysqli_innodb.class.php @@ -85,7 +85,7 @@ class DBMysqli_innodb extends DBMysql * this method is private * @return boolean */ - function _begin($transactionLevel) + function _begin($transactionLevel = 0) { $connection = $this->_getConnection('master'); @@ -105,7 +105,7 @@ class DBMysqli_innodb extends DBMysql * this method is private * @return boolean */ - function _rollback($transactionLevel) + function _rollback($transactionLevel = 0) { $connection = $this->_getConnection('master'); diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 9485a74c4..37fffc7c6 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -86,7 +86,7 @@ class ModuleObject extends Object * @param string $type type of message (error, info, update) * @return void * */ - function setMessage($message, $type = NULL) + function setMessage($message = 'success', $type = NULL) { parent::setMessage($message); $this->setMessageType($type); @@ -370,7 +370,7 @@ class ModuleObject extends Object * set the directory path of the layout directory * @return string * */ - function getLayoutPath() + function getLayoutPath($layout_name = "", $layout_type = "P") { return $this->layout_path; } diff --git a/classes/object/Object.class.php b/classes/object/Object.class.php index ed5a76bcf..9dfea8f4f 100644 --- a/classes/object/Object.class.php +++ b/classes/object/Object.class.php @@ -94,7 +94,7 @@ class Object * @param string $message Error message * @return bool Alaways returns true. */ - function setMessage($message = 'success') + function setMessage($message = 'success', $type = NULL) { if($str = Context::getLang($message)) { diff --git a/config/func.inc.php b/config/func.inc.php index 2477458f5..9486177ac 100644 --- a/config/func.inc.php +++ b/config/func.inc.php @@ -1200,7 +1200,7 @@ function removeSrcHack($match) continue; } - $val = preg_replace('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/e', 'chr("\\1"?0x00\\1:\\2+0)', $m[3][$idx] . $m[4][$idx]); + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); if(preg_match('/^[a-z]+script:/i', $val)) diff --git a/libs/phpmailer/phpmailer.php b/libs/phpmailer/phpmailer.php index c36f7c9d8..9ac3ffde5 100644 --- a/libs/phpmailer/phpmailer.php +++ b/libs/phpmailer/phpmailer.php @@ -1724,10 +1724,10 @@ class PHPMailer { switch (strtolower($position)) { case 'phrase': - $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace_callback('/([^A-Za-z0-9!*+\/ -])/', function($n) { return '='.sprintf('%02X', ord('\\1')); }, $encoded); break; case 'comment': - $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + $encoded = preg_replace_callback('/([\(\)\"])/', function($n) { return '='.sprintf('%02X', ord('\\1')); }, $encoded); case 'text': default: // Replace every high ascii, control =, ? and _ characters diff --git a/modules/editor/editor.admin.controller.php b/modules/editor/editor.admin.controller.php index 659132bea..baf7750a3 100644 --- a/modules/editor/editor.admin.controller.php +++ b/modules/editor/editor.admin.controller.php @@ -144,7 +144,8 @@ class editorAdminController extends editor { $oModuleController = getController('module'); $configVars = Context::getRequestVars(); - + + $config = new stdClass; if($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N'; else $config->font_defined = 'Y'; diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php index 858d37400..7797edf4d 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -289,7 +289,7 @@ class layoutModel extends layout * @param string $layout_type (P : PC, M : Mobile) * @return string path of layout */ - function getLayoutPath($layout_name, $layout_type = "P") + function getLayoutPath($layout_name = "", $layout_type = "P") { $layout_parse = explode('|@|', $layout_name); if(count($layout_parse) > 1) diff --git a/modules/member/member.admin.view.php b/modules/member/member.admin.view.php index f6a59dadb..b25579b82 100644 --- a/modules/member/member.admin.view.php +++ b/modules/member/member.admin.view.php @@ -615,7 +615,7 @@ class memberAdminView extends member } $replace = array_merge($extentionReplace, $replace); - $inputTag = preg_replace('@%(\w+)%@e', '$replace[$1]', $template); + $inputTag = preg_replace_callback('@%(\w+)%@', function($n) { return $replace[$n[1]]; }, $template); if($extendForm->description) $inputTag .= '

'.$extendForm->description.'

'; diff --git a/modules/module/module.model.php b/modules/module/module.model.php index fec281b95..ca6e9cc8a 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -1381,7 +1381,7 @@ class moduleModel extends module $args->site_srl = $site_srl; $output = executeQuery('module.getModuleConfig', $args); if($output->data->config) $config = unserialize($output->data->config); - else $config = null; + else $config = new stdClass(); //insert in cache if($oCacheHandler->isSupport())