diff --git a/classes/class.modrewrite.php b/classes/class.modrewrite.php index faa259a..fdab44a 100644 --- a/classes/class.modrewrite.php +++ b/classes/class.modrewrite.php @@ -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(); } diff --git a/classes/class.modrewritecontroller.php b/classes/class.modrewritecontroller.php index aa59e24..3fb2611 100644 --- a/classes/class.modrewritecontroller.php +++ b/classes/class.modrewritecontroller.php @@ -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(); diff --git a/classes/class.modrewriteurlstack.php b/classes/class.modrewriteurlstack.php index 99713fd..f7cdc59 100644 --- a/classes/class.modrewriteurlstack.php +++ b/classes/class.modrewriteurlstack.php @@ -1,4 +1,5 @@ _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 diff --git a/includes/functions.mod_rewrite.php b/includes/functions.mod_rewrite.php index 658c81e..d3fdcb0 100644 --- a/includes/functions.mod_rewrite.php +++ b/includes/functions.mod_rewrite.php @@ -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("'", "'", $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