1
0
Fork 0

fixed rewriting, added further debug infos

Dieser Commit ist enthalten in:
o.pinke 2020-06-08 16:09:59 +02:00
Ursprung e11792f616
Commit d53c559871
4 geänderte Dateien mit 30 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -53,6 +53,7 @@ class ModRewrite extends ModRewriteBase {
*/
public static function initialize($clientId) {
mr_loadConfiguration($clientId, true);
parent::initialize();
self::$_db = new DB_Contenido();
self::$_lookupTable = array();
}

Datei anzeigen

@ -494,8 +494,6 @@ class ModRewriteController extends ModRewriteBase {
// load_client is set in frontend/config.php
$lang = (int) $load_lang;
} else {
// get client id from table
cInclude('classes', 'contenido/class.clientslang.php');
$clCol = new cApiClientLanguageCollection();
$clCol->setWhere('idclient', $client);
$clCol->query();

Datei anzeigen

@ -1,4 +1,5 @@
<?php
/**
* AMR url stack class
*
@ -12,7 +13,6 @@
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
@ -175,7 +175,7 @@ class ModRewriteUrlStack {
$sStackId = $this->_aUrls[$url];
if (!isset($this->_aStack[$sStackId]['urlpath'])) {
$this->_chunkSetPrettyUrlParts();
$this->_chunkSetPrettyUrlParts($sStackId);
}
$aPretty = array(
'urlpath' => $this->_aStack[$sStackId]['urlpath'],
@ -233,8 +233,11 @@ class ModRewriteUrlStack {
*
* Composes the query by looping thru stored but non processed urls, executes
* the query and adds the (urlpath and urlname) result to the stack.
*
* @param type $sStackId
* @return type
*/
private function _chunkSetPrettyUrlParts() {
private function _chunkSetPrettyUrlParts($sStackId) {
// collect stack parameter to get urlpath and urlname
$aStack = array();
foreach ($this->_aStack as $stackId => $item) {
@ -247,23 +250,26 @@ class ModRewriteUrlStack {
// now, it's time to compose the where clause of the query
$sWhere = '';
foreach ($aStack as $stackId => $item) {
$aP = $item['params'];
if ((int) mr_arrayValue($aP, 'idart') > 0) {
$sWhere .= '(al.idart = ' . $aP['idart'] . ' AND al.idlang = ' . $aP['lang'] . ') OR ';
} elseif ((int) mr_arrayValue($aP, 'idartlang') > 0) {
$sWhere .= '(al.idartlang = ' . $aP['idartlang'] . ') OR ';
} elseif ((int) mr_arrayValue($aP, 'idcat') > 0) {
$sWhere .= '(cl.idcat = ' . $aP['idcat'] . ' AND cl.idlang = ' . $aP['lang'] . ' AND cl.startidartlang = al.idartlang) OR ';
} elseif ((int) mr_arrayValue($aP, 'idcatart') > 0) {
$sWhere .= '(ca.idcatart = ' . $aP['idcatart'] . ' AND ca.idart = al.idart AND al.idlang = ' . $aP['lang'] . ') OR ';
} elseif ((int) mr_arrayValue($aP, 'idcatlang') > 0) {
$sWhere .= '(cl.idcatlang = ' . $aP['idcatlang'] . ' AND cl.startidartlang = al.idartlang) OR ';
if ($stackId == $sStackId) {
$aP = $item['params'];
if ((int) mr_arrayValue($aP, 'idart') > 0) {
$sWhere .= '(al.idart = ' . $aP['idart'] . ' AND al.idlang = ' . $aP['lang'] . ') OR ';
} elseif ((int) mr_arrayValue($aP, 'idartlang') > 0) {
$sWhere .= '(al.idartlang = ' . $aP['idartlang'] . ') OR ';
} elseif ((int) mr_arrayValue($aP, 'idcat') > 0) {
$sWhere .= '(cl.idcat = ' . $aP['idcat'] . ' AND cl.idlang = ' . $aP['lang'] . ' AND cl.startidartlang = al.idartlang) OR ';
} elseif ((int) mr_arrayValue($aP, 'idcatart') > 0) {
$sWhere .= '(ca.idcatart = ' . $aP['idcatart'] . ' AND ca.idart = al.idart AND al.idlang = ' . $aP['lang'] . ') OR ';
} elseif ((int) mr_arrayValue($aP, 'idcatlang') > 0) {
$sWhere .= '(cl.idcatlang = ' . $aP['idcatlang'] . ' AND cl.startidartlang = al.idartlang) OR ';
}
}
}
if ($sWhere == '') {
return;
}
$sWhere = substr($sWhere, 0, -4);
$sWhere = cString::getPartOfString($sWhere, 0, -4);
$sWhere = str_replace(' OR ', " OR \n", $sWhere);
// compose query and execute it

Datei anzeigen

@ -27,7 +27,7 @@ if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
cInclude('classes', 'contenido/class.articlelanguage.php');
global $_cecRegistry, $cfg, $contenido, $area, $client, $load_client;
/**
* Processes cl-mod-rewrite related job for created new tree.
@ -485,10 +485,14 @@ function mr_buildGeneratedCode($code) {
// remove tinymce single quote entities:
$code = str_replace("&#39;", "'", $code);
$baseUri = cRegistry::getFrontendUrl();
$baseUri = CEC_Hook::execute("Contenido.Frontend.BaseHrefGeneration", $baseUri);
// get base uri
$sBaseUri = $cfgClient[$client]['path']['htmlpath'];
$sBaseUri = CEC_Hook::execute("Contenido.Frontend.BaseHrefGeneration", $sBaseUri);
// CON-1389 modifier /e is deprecated as of PHP 5.5
$code = preg_replace_callback("/([\"|\'|=])upload\/(.?|.+?)([\"|\'|>])/i", function($match) use ($baseUri) {
return stripslashes($match[1] . $baseUri . 'upload/' . $match[2] . $match[3]);
}, $code);
// define some preparations to replace /front_content.php & ./front_content.php
// against front_content.php, because urls should start with front_content.php