1
0
Fork 0

optimize for php8

Dieser Commit ist enthalten in:
o.pinke 2023-07-19 18:55:39 +02:00
Ursprung 8e2fdca28b
Commit e9d44453fb

Datei anzeigen

@ -27,6 +27,12 @@ if (!defined('CON_FRAMEWORK')) {
*/ */
class ModRewrite_ContentController extends ModRewrite_ControllerAbstract { class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
public $_oView;
public $_client;
/**
* @var array<string, mixed>
*/
public $_cfg;
/** /**
* Index action * Index action
*/ */
@ -41,13 +47,12 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
public function saveAction() { public function saveAction() {
$bDebug = $this->getProperty('bDebug'); $bDebug = $this->getProperty('bDebug');
$aSeparator = $this->getProperty('aSeparator'); $aSeparator = $this->getProperty('aSeparator');
$aWordSeparator = $this->getProperty('aWordSeparator');
$routingSeparator = $this->getProperty('routingSeparator'); $routingSeparator = $this->getProperty('routingSeparator');
$bError = false; $bError = false;
$aMR = array(); $aMR = [];
$request = (count($_POST) > 0) ? $_POST : $_GET; $request = ($_POST !== []) ? $_POST : $_GET;
mr_requestCleanup($request); mr_requestCleanup($request);
// use cl-mod-rewrite // use cl-mod-rewrite
@ -321,10 +326,10 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
// routing // routing
if (isset($request['rewrite_routing'])) { if (isset($request['rewrite_routing'])) {
$aRouting = array(); $aRouting = [];
$items = explode("\n", $request['rewrite_routing']); $items = explode("\n", $request['rewrite_routing']);
foreach ($items as $p => $v) { foreach ($items as $item) {
$routingDef = explode($routingSeparator, $v); $routingDef = explode($routingSeparator, $item);
if (count($routingDef) !== 2) { if (count($routingDef) !== 2) {
continue; continue;
} }
@ -339,7 +344,7 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
$aMR['cl-mod-rewrite']['routing'] = $aRouting; $aMR['cl-mod-rewrite']['routing'] = $aRouting;
} else { } else {
$this->_oView->rewrite_routing = ''; $this->_oView->rewrite_routing = '';
$aMR['cl-mod-rewrite']['routing'] = array(); $aMR['cl-mod-rewrite']['routing'] = [];
} }
// redirect invalid article to errorsite // redirect invalid article to errorsite
@ -385,9 +390,8 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
/** /**
* Checks, if any sseparators setting is modified or not * Checks, if any sseparators setting is modified or not
* @param array $aNewCfg New configuration send by requests. * @param array $aNewCfg New configuration send by requests.
* @return bool
*/ */
protected function _separatorModified($aNewCfg) { protected function _separatorModified($aNewCfg): bool {
$aCfg = ModRewrite::getConfig(); $aCfg = ModRewrite::getConfig();
if ($aCfg['category_seperator'] != $aNewCfg['category_seperator']) { if ($aCfg['category_seperator'] != $aNewCfg['category_seperator']) {
@ -405,18 +409,19 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
/** /**
* Does some checks like 'is_start_compatible' check. * Does some checks like 'is_start_compatible' check.
* Adds notifications, if something will went wrong... * Adds notifications, if something will went wrong...
*
* @todo review text and translations
*/ */
protected function _doChecks() { protected function _doChecks() {
// Check for not supported '$cfg["is_start_compatible"] = true;' mode
if (!empty($this->_cfg['is_start_compatible']) && true === $this->_cfg['is_start_compatible']) { if (!empty($this->_cfg['is_start_compatible']) && true === $this->_cfg['is_start_compatible']) {
$sMsg = i18n("Your Contenido installation runs with the setting 'is_start_compatible'. This plugin will not work properly in this mode.<br />Please check following topic in Contenido forum to change this:<br /><br /><a href='http://forum.contenido.org/viewtopic.php?t=32530' class='blue' target='_blank'>is_start_compatible auf neue Version umstellen</a>", "cl-mod-rewrite"); $sMsg = i18n("Your Contenido installation runs with the setting 'is_start_compatible'. This plugin will not work properly in this mode.<br />Please check following topic in Contenido forum to change this:<br /><br /><a href='http://forum.contenido.org/viewtopic.php?t=32530' class='blue' target='_blank'>is_start_compatible auf neue Version umstellen</a>", "cl-mod-rewrite");
$this->_oView->content_before .= $this->_notifyBox('warning', $sMsg); $this->_oView->content_before .= $this->_notifyBox('warning', $sMsg);
} }
// Check for empty urlpath entries in cat_lang table // Check for empty urlpath entries in cat_lang table
$db = new DB_Contenido(); $dbConLite = new DB_ConLite();
$sql = "SELECT idcatlang FROM " . $this->_cfg['tab']['cat_lang'] . " WHERE urlpath = ''"; $sql = "SELECT idcatlang FROM " . $this->_cfg['tab']['cat_lang'] . " WHERE urlpath = ''";
if ($db->query($sql) && $db->next_record()) { if ($dbConLite->query($sql) && $dbConLite->next_record()) {
$sMsg = i18n("It seems as if some categories don't have a set 'urlpath' entry in the database. Please reset empty aliases in %sFunctions%s area.", "cl-mod-rewrite"); $sMsg = i18n("It seems as if some categories don't have a set 'urlpath' entry in the database. Please reset empty aliases in %sFunctions%s area.", "cl-mod-rewrite");
$sMsg = sprintf($sMsg, '<a href="main.php?area=mod_rewrite_expert&frame=4&contenido=' . $this->_oView->sessid . '&idclient=' . $this->_client . '" onclick="parent.right_top.sub.clicked(parent.right_top.document.getElementById(\'c_1\').firstChild);">', '</a>'); $sMsg = sprintf($sMsg, '<a href="main.php?area=mod_rewrite_expert&frame=4&contenido=' . $this->_oView->sessid . '&idclient=' . $this->_client . '" onclick="parent.right_top.sub.clicked(parent.right_top.document.getElementById(\'c_1\').firstChild);">', '</a>');
$this->_oView->content_before .= $this->_notifyBox('warning', $sMsg); $this->_oView->content_before .= $this->_notifyBox('warning', $sMsg);