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
1 geänderte Dateien mit 17 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -27,6 +27,12 @@ if (!defined('CON_FRAMEWORK')) {
*/
class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
public $_oView;
public $_client;
/**
* @var array<string, mixed>
*/
public $_cfg;
/**
* Index action
*/
@ -41,13 +47,12 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
public function saveAction() {
$bDebug = $this->getProperty('bDebug');
$aSeparator = $this->getProperty('aSeparator');
$aWordSeparator = $this->getProperty('aWordSeparator');
$routingSeparator = $this->getProperty('routingSeparator');
$bError = false;
$aMR = array();
$aMR = [];
$request = (count($_POST) > 0) ? $_POST : $_GET;
$request = ($_POST !== []) ? $_POST : $_GET;
mr_requestCleanup($request);
// use cl-mod-rewrite
@ -321,10 +326,10 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
// routing
if (isset($request['rewrite_routing'])) {
$aRouting = array();
$aRouting = [];
$items = explode("\n", $request['rewrite_routing']);
foreach ($items as $p => $v) {
$routingDef = explode($routingSeparator, $v);
foreach ($items as $item) {
$routingDef = explode($routingSeparator, $item);
if (count($routingDef) !== 2) {
continue;
}
@ -339,7 +344,7 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
$aMR['cl-mod-rewrite']['routing'] = $aRouting;
} else {
$this->_oView->rewrite_routing = '';
$aMR['cl-mod-rewrite']['routing'] = array();
$aMR['cl-mod-rewrite']['routing'] = [];
}
// redirect invalid article to errorsite
@ -385,9 +390,8 @@ class ModRewrite_ContentController extends ModRewrite_ControllerAbstract {
/**
* Checks, if any sseparators setting is modified or not
* @param array $aNewCfg New configuration send by requests.
* @return bool
*/
protected function _separatorModified($aNewCfg) {
protected function _separatorModified($aNewCfg): bool {
$aCfg = ModRewrite::getConfig();
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.
* Adds notifications, if something will went wrong...
*
* @todo review text and translations
*/
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']) {
$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);
}
// 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 = ''";
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 = 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);