1
0
Fork 0
Dieser Commit ist enthalten in:
Ortwin Pinke 2019-11-04 16:57:28 +01:00 committet von GitHub
Ursprung d41e3b5158
Commit 16ad56ae48
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
41 geänderte Dateien mit 8754 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,114 @@
<?php
/**
* Plugin Advanced Mod Rewrite default settings. This file will be included if
* mod rewrite settings of an client couldn't loaded.
*
* Containing settings are taken over from CONTENIDO-4.6.15mr setup installer
* template beeing made originally by stese.
*
* NOTE:
* Changes in these Advanced Mod Rewrite settings will affect all clients, as long
* as they don't have their own configuration.
* PHP needs write permissions to the folder, where this file resides. Mod Rewrite
* configuration files will be created in this folder.
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: config.mod_rewrite_default.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $cfg;
// Use advanced mod_rewrites ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['use'] = 0;
// Path to the htaccess file with trailling slash from domain-root!
$cfg['mod_rewrite']['rootdir'] = '/';
// Check path to the htaccess file ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['checkrootdir'] = 1;
// Start TreeLocation from Root Tree (set to 1) or get location from first category (set to 0)
$cfg['mod_rewrite']['startfromroot'] = 0;
// Prevent Duplicated Content, if startfromroot is enabled ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['prevent_duplicated_content'] = 0;
// is multilanguage? ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['use_language'] = 0;
// use language name in url? ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['use_language_name'] = 0;
// is multiclient in only one directory? ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['use_client'] = 0;
// use client name in url? ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['use_client_name'] = 0;
// use lowercase url? ( 1 = yes, 0 = none )
$cfg['mod_rewrite']['use_lowercase_uri'] = 1;
// file extension for article links
$cfg['mod_rewrite']['file_extension'] = '.html';
// The percentage if the category name have to match with database names.
$cfg['mod_rewrite']['category_resolve_min_percentage'] = '75';
// Add start article name to url (1 = yes, 0 = none)
$cfg['mod_rewrite']['add_startart_name_to_url'] = 1;
// Default start article name to use, depends on active add_startart_name_to_url
$cfg['mod_rewrite']['default_startart_name'] = 'index';
// Rewrite urls on generating the code for the page. If active, the responsibility will be
// outsourced to moduleoutputs and you have to adapt the moduleoutputs manually. Each output of
// internal article/category links must be processed by using $sess->url. (1 = yes, 0 = none)
$cfg['mod_rewrite']['rewrite_urls_at_congeneratecode'] = 0;
// Rewrite urls on output of htmlcode at front_content.php. Is the old way, and doesn't require
// adapting of moduleoutputs. On the other hand usage of this way will be slower than rewriting
// option above. (1 = yes, 0 = none)
$cfg['mod_rewrite']['rewrite_urls_at_front_content_output'] = 1;
// Following five settings write urls like this one:
// www.domain.de/category1-category2.articlename.html
// Changes of these settings causes a reset of all aliases, see Advanced Mod Rewrite settings in
// backend.
// NOTE: category_seperator and article_seperator must contain different character.
// Separator for categories
$cfg['mod_rewrite']['category_seperator'] = '/';
// Separator between category and article
$cfg['mod_rewrite']['article_seperator'] = '/';
// Word seperator in category names
$cfg['mod_rewrite']['category_word_seperator'] = '-';
// Word seperator in article names
$cfg['mod_rewrite']['article_word_seperator'] = '-';
// Routing settings for incomming urls. Here you can define routing rules as follows:
// $cfg['mod_rewrite']['routing'] = array(
// '/a_incomming/url/foobar.html' => '/new_url/foobar.html', # route /a_incomming/url/foobar.html to /new_url/foobar.html
// '/cms/' => '/' # route /cms/ to / (doc root of client)
// );
$cfg['mod_rewrite']['routing'] = array();
// Redirect invalid articles to errorpage (1 = yes, 0 = none)
$cfg['mod_rewrite']['redirect_invalid_article_to_errorsite'] = 0;

167
includes/config.plugin.php Normale Datei
Datei anzeigen

@ -0,0 +1,167 @@
<?php
/**
* Plugin Advanced Mod Rewrite initialization file.
*
* This file will be included by CONTENIDO plugin loader routine, and the content
* of this file ensures that the AMR Plugin will be initialized correctly.
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: config.plugin.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $_cecRegistry, $cfg, $contenido, $area, $client, $load_client;
####################################################################################################
/**
* Chain Contenido.Frontend.CreateURL
* This chain is called inside some scripts (front_content.php) to create urls.
*
* @todo: Is added to provide downwards compatibility for the amr plugin.
* There is no need for this chain since CONTENIDO 4.8.9 contains its own Url building feature.
* @deprecated
*
* Parameters & order:
* string URL including parameter value pairs
*
* Returns:
* string Returns modified URL
*/
$_cecRegistry->registerChain("Contenido.Frontend.CreateURL", "string");
####################################################################################################
// initialize client id
if (isset($client) && (int) $client > 0) {
$clientId = (int) $client;
} elseif (isset($load_client) && (int) $load_client > 0) {
$clientId = (int) $load_client;
} else {
$clientId = '';
}
// include necessary sources
cInclude('classes', 'Debug/DebuggerFactory.class.php');
plugin_include('mod_rewrite', 'classes/controller/class.modrewrite_controller_abstract.php');
plugin_include('mod_rewrite', 'classes/controller/class.modrewrite_content_controller.php');
plugin_include('mod_rewrite', 'classes/controller/class.modrewrite_contentexpert_controller.php');
plugin_include('mod_rewrite', 'classes/controller/class.modrewrite_contenttest_controller.php');
plugin_include('mod_rewrite', 'classes/class.modrewritebase.php');
plugin_include('mod_rewrite', 'classes/class.modrewrite.php');
plugin_include('mod_rewrite', 'classes/class.modrewritecontroller.php');
plugin_include('mod_rewrite', 'classes/class.modrewritedebugger.php');
plugin_include('mod_rewrite', 'classes/class.modrewritetest.php');
plugin_include('mod_rewrite', 'classes/class.modrewriteurlstack.php');
plugin_include('mod_rewrite', 'classes/class.modrewriteurlutil.php');
plugin_include('mod_rewrite', 'includes/functions.mod_rewrite.php');
global $lngAct;
$lngAct['mod_rewrite']['mod_rewrite'] = i18n("Advanced Mod Rewrite", "mod_rewrite");
$lngAct['mod_rewrite']['mod_rewrite_expert'] = i18n("Advanced Mod Rewrite functions", "mod_rewrite");
$lngAct['mod_rewrite']['mod_rewrite_test'] = i18n("Advanced Mod Rewrite test", "mod_rewrite");
// set debug configuration
if (isset($contenido)) {
ModRewriteDebugger::setEnabled(true);
} else {
ModRewriteDebugger::setEnabled(false);
}
// initialize mr plugin
ModRewrite::initialize($clientId);
if (ModRewrite::isEnabled()) {
$aMrCfg = ModRewrite::getConfig();
$_cecRegistry = cApiCecRegistry::getInstance();
// Add new tree function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.str_newtree.AfterCall', 'mr_strNewTree');
// Add move subtree function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.str_movesubtree.AfterCall', 'mr_strMoveSubtree');
// Add new category function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.str_newcat.AfterCall', 'mr_strNewCategory');
// Add rename category function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.str_renamecat.AfterCall', 'mr_strRenameCategory');
// Add move up category function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.str_moveupcat.AfterCall', 'mr_strMoveUpCategory');
// Add move down category function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.str_movedowncat.AfterCall', 'mr_strMovedownCategory');
// Add copy category function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Category.strCopyCategory', 'mr_strCopyCategory');
// Add category sync function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Category.strSyncCategory_Loop', 'mr_strSyncCategory');
// Add save article (new and existing category) function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Action.con_saveart.AfterCall', 'mr_conSaveArticle');
// Add move article function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Article.conMoveArticles_Loop', 'mr_conMoveArticles');
// Add duplicate article function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Article.conCopyArtLang_AfterInsert', 'mr_conCopyArtLang');
// Add sync article function to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Article.conSyncArticle_AfterInsert', 'mr_conSyncArticle');
if (!isset($contenido)) {
// we are not in backend, add cec functions for rewriting
// Add mr related function for hook "after plugins loaded" to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Frontend.AfterLoadPlugins', 'mr_runFrontendController');
// Add url rewriting function to CONTENIDO Extension Chainer
// @todo: no more need since CONTENIDO 4.8.9 provides central Url building,
// but it is still available because of downwards compatibility
// @deprecated
$_cecRegistry->addChainFunction('Contenido.Frontend.CreateURL', 'mr_buildNewUrl');
// overwrite url builder configuration with own url builder
$cfg['url_builder']['name'] = 'MR';
$cfg['config'] = array();
cInclude('classes', 'Url/Contenido_Url.class.php');
cInclude('classes', 'UrlBuilder/Contenido_UrlBuilderConfig.class.php');
Contenido_UrlBuilderConfig::setConfig($cfg['url_builder']);
if ($aMrCfg['rewrite_urls_at_congeneratecode'] == 1) {
// Add url rewriting at code generation to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Content.conGenerateCode', 'mr_buildGeneratedCode');
} elseif ($aMrCfg['rewrite_urls_at_front_content_output'] == 1) {
// Add url rewriting at html output to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Frontend.HTMLCodeOutput', 'mr_buildGeneratedCode');
} else {
// Fallback solution: Add url rewriting at code generation to CONTENIDO Extension Chainer
$_cecRegistry->addChainFunction('Contenido.Content.conGenerateCode', 'mr_buildGeneratedCode');
}
}
}
if (isset($contenido) && isset($area) && $area == 'mod_rewrite_test') {
// configure url builder to enable it on test page
$cfg['url_builder']['name'] = 'MR';
$cfg['config'] = array();
Contenido_UrlBuilderConfig::setConfig($cfg['url_builder']);
ModRewrite::setEnabled(true);
}
unset($clientId, $options);

Datei anzeigen

@ -0,0 +1,102 @@
<?php
/**
* Mod Rewrite front_content.php controller. Does some preprocessing jobs, tries
* to set following variables, depending on mod rewrite configuration and if
* request part exists:
* - $client
* - $changeclient
* - $lang
* - $changelang
* - $idart
* - $idcat
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: front_content_controller.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $client, $changeclient, $cfgClient, $lang, $changelang, $idart, $idcat, $path, $mr_preprocessedPageError;
ModRewriteDebugger::add(ModRewrite::getConfig(), 'front_content_controller.php mod rewrite config');
// create an mod rewrite controller instance and execute processing
$oMRController = new ModRewriteController($_SERVER['REQUEST_URI']);
$oMRController->execute();
if ($oMRController->errorOccured()) {
// an error occured (idcat and or idart couldn't catched by controller)
$iRedirToErrPage = ModRewrite::getConfig('redirect_invalid_article_to_errorsite', 0);
// try to redirect to errorpage if desired
if ($iRedirToErrPage == 1 && (int) $client > 0 && (int) $lang > 0) {
global $errsite_idcat, $errsite_idart;
if ($cfgClient['set'] != 'set') {
rereadClients();
}
// errorpage
$aParams = array(
'client' => $client, 'idcat' => $errsite_idcat[$client], 'idart' => $errsite_idart[$client],
'lang' => $lang, 'error' => '1'
);
$errsite = 'Location: ' . Contenido_Url::getInstance()->buildRedirect($aParams);
mr_header($errsite);
exit();
}
} else {
// set some global variables
if ($oMRController->getClient()) {
$client = $oMRController->getClient();
}
if ($oMRController->getChangeClient()) {
$changeclient = $oMRController->getChangeClient();
}
if ($oMRController->getLang()) {
$lang = $oMRController->getLang();
}
if ($oMRController->getChangeLang()) {
$changelang = $oMRController->getChangeLang();
}
if ($oMRController->getIdArt()) {
$idart = $oMRController->getIdArt();
}
if ($oMRController->getIdCat()) {
$idcat = $oMRController->getIdCat();
}
if ($oMRController->getPath()) {
$path = $oMRController->getPath();
}
}
// some debugs
ModRewriteDebugger::add($mr_preprocessedPageError, 'mr $mr_preprocessedPageError', __FILE__);
if ($oMRController->getError()) {
ModRewriteDebugger::add($oMRController->getError(), 'mr error', __FILE__);
}
ModRewriteDebugger::add($idart, 'mr $idart', __FILE__);
ModRewriteDebugger::add($idcat, 'mr $idcat', __FILE__);
ModRewriteDebugger::add($lang, 'mr $lang', __FILE__);
ModRewriteDebugger::add($client, 'mr $client', __FILE__);

Datei anzeigen

@ -0,0 +1,912 @@
<?php
/**
* Mod Rewrite front_content.php controller. Does some preprocessing jobs, tries
* to set following variables, depending on mod rewrite configuration and if
* request part exists:
* - $client
* - $changeclient
* - $lang
* - $changelang
* - $idart
* - $idcat
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: functions.mod_rewrite.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Stefan Seifarth / stese
* @author Murat Purc <murat@purc.de>
* @copyright www.polycoder.de
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
cInclude('classes', 'contenido/class.articlelanguage.php');
/**
* Processes mod_rewrite related job for created new tree.
*
* Will be called by chain 'Contenido.Action.str_newtree.AfterCall'.
*
* @param array $data Assoziative array with some values
* @return array Passed parameter
*/
function mr_strNewTree(array $data) {
global $lang;
ModRewriteDebugger::log($data, 'mr_strNewTree $data');
if ((int) $data['newcategoryid'] > 0) {
$mrCatAlias = (trim($data['categoryalias']) !== '') ? trim($data['categoryalias']) : trim($data['categoryname']);
// set new urlname - because original set urlname isn''t validated for double entries in same parent category
ModRewrite::setCatWebsafeName($mrCatAlias, $data['newcategoryid'], $lang);
ModRewrite::setCatUrlPath($data['newcategoryid'], $lang);
}
return $data;
}
/**
* Processes mod_rewrite related job for created new category.
*
* Will be called by chain 'Contenido.Action.str_newcat.AfterCall'.
*
* @param array $data Assoziative array with some values
* @return array Passed parameter
*/
function mr_strNewCategory(array $data) {
global $lang;
ModRewriteDebugger::log($data, 'mr_strNewCategory $data');
if ((int) $data['newcategoryid'] > 0) {
$mrCatAlias = (trim($data['categoryalias']) !== '') ? trim($data['categoryalias']) : trim($data['categoryname']);
// set new urlname - because original set urlname isn''t validated for double entries in same parent category
ModRewrite::setCatWebsafeName($mrCatAlias, $data['newcategoryid'], $lang);
ModRewrite::setCatUrlPath($data['newcategoryid'], $lang);
}
return $data;
}
/**
* Processes mod_rewrite related job for renamed category
* 2010-02-01: and now all existing subcategories and modify their paths too...
* 2010-02-01: max 50 recursion level
*
* Will be called by chain 'Contenido.Action.str_renamecat.AfterCall'.
*
* @param array $data Assoziative array with some values
* @return array Passed parameter
*/
function mr_strRenameCategory(array $data) {
ModRewriteDebugger::log($data, 'mr_strRenameCategory $data');
// hes 20100102
// maximal 50 recursion level
$recursion = (is_int($data['recursion'])) ? $data['recursion'] : 1;
if ($recursion > 50) {
exit("#20100201-1503: sorry - maximum function nesting level of " . $recursion . " reached");
}
$mrCatAlias = (trim($data['newcategoryalias']) !== '') ? trim($data['newcategoryalias']) : trim($data['newcategoryname']);
if ($mrCatAlias != '') {
// set new urlname - because original set urlname isn''t validated for double entries in same parent category
ModRewrite::setCatWebsafeName($mrCatAlias, $data['idcat'], $data['lang']);
ModRewrite::setCatUrlPath($data['idcat'], $data['lang']);
}
// hes 20100102
// now dive into all existing subcategories and modify their paths too...
$str = 'parentid=' . $data['idcat'];
$oCatColl = new cApiCategoryCollection($str);
while ($oCat = $oCatColl->next()) {
// hes 20100102
$str = 'idcat=' . $oCat->get('idcat') . ' AND idlang=' . (int) $data['lang'];
$oCatLanColl = new cApiCategoryLanguageCollection($str);
if ($oCatLan = $oCatLanColl->next()) {
// hes 20100102
$childData = array(
'idcat' => $oCat->get('idcat'),
'lang' => (int) $data['lang'],
'newcategoryname' => $oCatLan->get('name'),
'newcategoryalias' => $oCatLan->get('urlname'),
'recursion' => $recursion + 1
);
$resData = mr_strRenameCategory($childData);
}
}
return $data;
}
/**
* Processes mod_rewrite related job after moving a category up.
*
* Will be called by chain 'Contenido.Action.str_moveupcat.AfterCall'.
*
* @todo do we really need processing of the category? there is no mr relevant data
* changes while moving the category on same level, level and name won't change
*
* @param int $idcat Category id
* @return int Category id
*/
function mr_strMoveUpCategory($idcat) {
ModRewriteDebugger::log($idcat, 'mr_strMoveUpCategory $idcat');
// category check
$cat = new cApiCategory((int) $idcat);
if (!$cat->get('preid')) {
return;
}
// get all cat languages
$aIdLang = ModRewrite::getCatLanguages($idcat);
// update ...
foreach ($aIdLang as $iIdLang) {
// get urlname
$sCatname = ModRewrite::getCatName($idcat, $iIdLang);
// set new urlname - because original set urlname isn't validated for double entries in same parent category
ModRewrite::setCatWebsafeName($sCatname, $idcat, $iIdLang);
}
return $idcat;
}
/**
* Processes mod_rewrite related job after moving a category down.
*
* Will be called by chain 'Contenido.Action.str_movedowncat.AfterCall'.
*
* @todo do we really need processing of the category? there is no mr relevant data
* changes while moving the category on same level, level and name won't change
*
* @param int $idcat Id of category beeing moved down
* @return int Category id
*/
function mr_strMovedownCategory($idcat) {
ModRewriteDebugger::log($idcat, 'mr_strMovedownCategory $idcat');
// category check
$cat = new cApiCategory((int) $idcat);
if (!$cat->get('id')) {
return;
}
// get all cat languages
$aIdLang = ModRewrite::getCatLanguages($idcat);
// update ...
foreach ($aIdLang as $iIdLang) {
// get urlname
$sCatname = ModRewrite::getCatName($idcat, $iIdLang);
// set new urlname - because original set urlname isn't validated for double entries in same parent category
ModRewrite::setCatWebsafeName($sCatname, $idcat, $iIdLang);
}
return $idcat;
}
/**
* Processes mod_rewrite related job after moving a category subtree.
*
* Will be called by chain 'Contenido.Action.str_movesubtree.AfterCall'.
*
* @param array $data Assoziative array with some values
* @return array Passed parameter
*/
function mr_strMoveSubtree(array $data) {
ModRewriteDebugger::log($data, 'mr_strMoveSubtree $data');
// category check
if ((int) $data['idcat'] <= 0) {
return;
}
// next category check
$cat = new cApiCategory($data['idcat']);
if (!$cat->get('idcat')) {
return;
}
// get all cat languages
$aIdLang = ModRewrite::getCatLanguages($data['idcat']);
// update all languages
foreach ($aIdLang as $iIdLang) {
// get urlname
$sCatname = ModRewrite::getCatName($data['idcat'], $iIdLang);
// set new urlname - because original set urlname isn't validated for double entries in same parent category
ModRewrite::setCatWebsafeName($sCatname, $data['idcat'], $iIdLang);
ModRewrite::setCatUrlPath($data['idcat'], $iIdLang);
}
// now dive into all existing subcategories and modify their paths too...
$oCatColl = new cApiCategoryCollection('parentid=' . $data['idcat']);
while ($oCat = $oCatColl->next()) {
mr_strMoveSubtree(array('idcat' => $oCat->get('idcat')));
}
return $data;
}
/**
* Processes mod_rewrite related job after copying a category subtree.
*
* Will be called by chain 'Contenido.Category.strCopyCategory'.
*
* @param array $data Assoziative array with some values
* @return array Passed parameter
*/
function mr_strCopyCategory(array $data) {
ModRewriteDebugger::log($data, 'mr_strCopyCategory $data');
$idcat = (int) $data['newcat']->get('idcat');
if ($idcat <= 0) {
return $data;
}
// get all cat languages
$aIdLang = ModRewrite::getCatLanguages($idcat);
// update ...
foreach ($aIdLang as $iIdLang) {
// get urlname
$sCatname = ModRewrite::getCatName($idcat, $iIdLang);
// set new urlname - because original set urlname isn't validated for double entries in same parent category
ModRewrite::setCatWebsafeName($sCatname, $idcat, $iIdLang);
ModRewrite::setCatUrlPath($idcat, $iIdLang);
}
}
/**
* Processes mod_rewrite related job during structure synchronisation process,
* sets the urlpath of current category.
*
* Will be called by chain 'Contenido.Category.strSyncCategory_Loop'.
*
* @param array $data Assoziative array with some values
* @return array Passed parameter
*/
function mr_strSyncCategory(array $data) {
ModRewriteDebugger::log($data, 'mr_strSyncCategory $data');
ModRewrite::setCatUrlPath($data['idcat'], $data['idlang']);
return $data;
}
/**
* Processes mod_rewrite related job for saved articles (new or modified article).
*
* Will be called by chain 'Contenido.Action.con_saveart.AfterCall'.
*
* @param array $data Assoziative array with some article properties
* @return array Passed parameter
*/
function mr_conSaveArticle(array $data) {
global $tmp_firstedit, $client;
ModRewriteDebugger::log($data, 'mr_conSaveArticle $data');
if ((int) $data['idart'] == 0) {
return $data;
}
if (strlen(trim($data['urlname'])) == 0) {
$data['urlname'] = $data['title'];
}
if (1 == $tmp_firstedit) {
// new article
$aLanguages = getLanguagesByClient($client);
foreach ($aLanguages as $iLang) {
ModRewrite::setArtWebsafeName($data['urlname'], $data['idart'], $iLang, $data['idcat']);
}
} else {
// modified article
$aArticle = ModRewrite::getArtIdByArtlangId($data['idartlang']);
if (isset($aArticle['idart']) && isset($aArticle['idlang'])) {
ModRewrite::setArtWebsafeName($data['urlname'], $aArticle['idart'], $aArticle['idlang'], $data['idcat']);
}
}
return $data;
}
/**
* Processes mod_rewrite related job for articles beeing moved.
*
* Will be called by chain 'Contenido.Article.conMoveArticles_Loop'.
*
* @param array $data Assoziative array with record entries
* @return array Loop through of arguments
*/
function mr_conMoveArticles($data) {
ModRewriteDebugger::log($data, 'mr_conMoveArticles $data');
// too defensive but secure way
if (!is_array($data)) {
return $data;
} elseif (!isset($data['idartlang'])) {
return $data;
} elseif (!isset($data['idart'])) {
return $data;
}
$arr_art = ModRewrite::getArtIds($data['idartlang']);
if (count($arr_art) == 2) {
ModRewrite::setArtWebsafeName($arr_art["urlname"], $data['idart'], $arr_art["idlang"]);
}
return $data;
}
/**
* Processes mod_rewrite related job for duplicated articles.
*
* Will be called by chain 'Contenido.Article.conCopyArtLang_AfterInsert'.
*
* @param array $data Assoziative array with record entries
* @return array Loop through of arguments
*/
function mr_conCopyArtLang($data) {
ModRewriteDebugger::log($data, 'mr_conCopyArtLang $data');
// too defensive but secure way
if (!is_array($data)) {
return $data;
} elseif (!isset($data['title'])) {
return $data;
} elseif (!isset($data['idart'])) {
return $data;
} elseif (!isset($data['idlang'])) {
return $data;
}
ModRewrite::setArtWebsafeName($data['title'], $data['idart'], $data['idlang']);
return $data;
}
/**
* Processes mod_rewrite related job for synchronized articles.
*
* Will be called by chain 'Contenido.Article.conSyncArticle_AfterInsert'.
*
* @param array $data Assoziative array with record entries as follows:
* <code>
* array(
* 'src_art_lang' => Recordset (assoziative array) of source item from con_art_lang table
* 'dest_art_lang' => Recordset (assoziative array) of inserted destination item from con_art_lang table
* );
* </code>
*
* @return array Loop through of argument
*/
function mr_conSyncArticle($data) {
ModRewriteDebugger::log($data, 'mr_conSyncArticle $data');
// too defensive but secure way
if (!is_array($data)) {
return $data;
} elseif (!isset($data['src_art_lang']) || !is_array($data['src_art_lang'])) {
return $data;
} elseif (!isset($data['dest_art_lang']) || !is_array($data['dest_art_lang'])) {
return $data;
} elseif (!isset($data['dest_art_lang']['idart'])) {
return $data;
} elseif (!isset($data['dest_art_lang']['idlang'])) {
return $data;
}
if (!isset($data['src_art_lang']['urlname'])) {
$artLang = new cApiArticleLanguage($data['src_art_lang']['idartlang']);
$urlname = $artLang->get('urlname');
} else {
$urlname = $data['src_art_lang']['urlname'];
}
if ($urlname) {
ModRewrite::setArtWebsafeName($urlname, $data['dest_art_lang']['idart'], $data['dest_art_lang']['idlang']);
}
return $data;
}
/**
* Works as a wrapper for Contenido_Url.
*
* Will also be called by chain 'Contenido.Frontend.CreateURL'.
*
* @todo: Still exists bcause of downwards compatibility (some other modules/plugins are using it)
*
* @param string $url URL to rebuild
* @return string New URL
*/
function mr_buildNewUrl($url) {
global $lang;
ModRewriteDebugger::add($url, 'mr_buildNewUrl() in -> $url');
$oUrl = Contenido_Url::getInstance();
$aUrl = $oUrl->parse($url);
// add language, if not exists
if (!isset($aUrl['params']['lang'])) {
$aUrl['params']['lang'] = $lang;
}
// build url
$newUrl = $oUrl->build($aUrl['params']);
// add existing fragment
if (isset($aUrl['fragment'])) {
$newUrl .= '#' . $aUrl['fragment'];
}
$arr = array(
'in' => $url,
'out' => $newUrl,
);
ModRewriteDebugger::add($arr, 'mr_buildNewUrl() in -> out');
return $newUrl;
}
/**
* Replaces existing ancors inside passed code, while rebuilding the urls.
*
* Will be called by chain 'Contenido.Content.conGenerateCode' or
* 'Contenido.Frontend.HTMLCodeOutput' depening on mod_rewrite settings.
*
* @param string $code Code to prepare
* @return string New code
*/
function mr_buildGeneratedCode($code) {
global $client, $cfgClient;
ModRewriteDebugger::add($code, 'mr_buildGeneratedCode() in');
// mod rewrite is activated
if (ModRewrite::isEnabled()) {
$sseStarttime = getmicrotime();
// anchor hack
$code = preg_replace_callback(
"/<a([^>]*)href\s*=\s*[\"|\'][\/]#(.?|.+?)[\"|\']([^>]*)>/i",
create_function('$matches', 'return ModRewrite::rewriteHtmlAnchor($matches);'),
$code
);
// remove tinymce single quote entities:
$code = str_replace("&#39;", "'", $code);
// get base uri
$sBaseUri = $cfgClient[$client]['path']['htmlpath'];
$sBaseUri = CEC_Hook::execute("Contenido.Frontend.BaseHrefGeneration", $sBaseUri);
// IE hack with wrong base href interpretation
$code = preg_replace_callback(
"/([\"|\'|=])upload\/(.?|.+?)([\"|\'|>])/i",
create_function('$matches', 'return stripslashes($matches[1]' . $sBaseUri . ' . "upload/" . $matches[2] . $matches[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
$aPattern = array(
'/([\"|\'|=])\/front_content\.php(.?|.+?)([\"|\'|>])/i',
'/([\"|\'|=])\.\/front_content\.php(.?|.+?)([\"|\'|>])/i'
);
$aReplace = array(
'\1front_content.php\2\3',
'\1front_content.php\2\3'
);
// perform the pre replacements
$code = preg_replace($aPattern, $aReplace, $code);
// create url stack object and fill it with found urls...
$oMRUrlStack = ModRewriteUrlStack::getInstance();
$oMRUrlStack->add('front_content.php');
$matches = null;
preg_match_all("/([\"|\'|=])front_content\.php(.?|.+?)([\"|\'|>])/i", $code, $matches, PREG_SET_ORDER);
foreach ($matches as $val) {
$oMRUrlStack->add('front_content.php' . $val[2]);
}
// ok let it beginn, build the clean urls
$code = str_replace('"front_content.php"', '"' . mr_buildNewUrl('front_content.php') . '"', $code);
$code = str_replace("'front_content.php'", "'" . mr_buildNewUrl('front_content.php') . "'", $code);
$code = preg_replace_callback(
"/([\"|\'|=])front_content\.php(.?|.+?)([\"|\'|>])/i",
create_function('$aMatches', 'return $aMatches[1] . mr_buildNewUrl("front_content.php" . $aMatches[2]) . $aMatches[3];'),
$code
);
ModRewriteDebugger::add($code, 'mr_buildGeneratedCode() out');
$sseEndtime = getmicrotime();
} else {
// anchor hack for non modrewrite websites
$code = preg_replace_callback(
"/<a([^>]*)href\s*=\s*[\"|\'][\/]#(.?|.+?)[\"|\']([^>]*)>/i",
create_function('$matches', 'return ModRewrite::contenidoHtmlAnchor($matches, $GLOBALS["is_XHTML"]);'),
$code
);
}
ModRewriteDebugger::add(($sseEndtime - $sseStarttime), 'mr_buildGeneratedCode() total spend time');
if ($debug = mr_debugOutput(false)) {
$code = cString::iReplaceOnce("</body>", $debug . "\n</body>", $code);
}
return $code;
// print "\n\n<!-- modrewrite generation time: " . ($sseEndtime - $sseStarttime) . " seconds -->";
}
/**
* Sets language of client, like done in front_content.php
*
* @param int $client Client id
*/
function mr_setClientLanguageId($client) {
global $lang, $load_lang, $cfg;
if ((int) $lang > 0) {
// there is nothing to do
return;
} elseif ($load_lang) {
// load_client is set in frontend/config.php
$lang = $load_lang;
return;
}
// try to get clients language from table
$sql = "SELECT B.idlang FROM "
. $cfg['tab']['clients_lang'] . " AS A, "
. $cfg['tab']['lang'] . " AS B "
. "WHERE "
. "A.idclient='" . ((int) $client) . "' AND A.idlang=B.idlang"
. "LIMIT 0,1";
if ($aData = mr_queryAndNextRecord($sql)) {
$lang = $aData['idlang'];
}
}
/**
* Loads Advanced Mod Rewrite configuration for passed client using serialized
* file containing the settings.
*
* File is placed in /contenido/mod_rewrite/includes/and is named like
* config.mod_rewrite_{client_id}.php.
*
* @param int $clientId Id of client
* @param bool $forceReload Flag to force to reload configuration, e. g. after
* done changes on it
*/
function mr_loadConfiguration($clientId, $forceReload = false) {
global $cfg;
static $aLoaded;
$clientId = (int) $clientId;
if (!isset($aLoaded)) {
$aLoaded = array();
} elseif (isset($aLoaded[$clientId]) && $forceReload == false) {
return;
}
$mrConfig = mr_getConfiguration($clientId);
if (is_array($mrConfig)) {
// merge mod rewrite configuration with global cfg array
$cfg = array_merge($cfg, $mrConfig);
} else {
// couldn't load configuration, set defaults
include_once($cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/includes/config.mod_rewrite_default.php');
}
$aLoaded[$clientId] = true;
}
/**
* Returns the mod rewrite configuration array of an client.
*
* File is placed in /contenido/mod_rewrite/includes/and is named like
* config.mod_rewrite_{client_id}.php.
*
* @param int $clientId Id of client
* @return array|null
*/
function mr_getConfiguration($clientId) {
global $cfg;
$file = $cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/includes/config.mod_rewrite_' . $clientId . '.php';
if (!is_file($file) || !is_readable($file)) {
return null;
}
if ($content = file_get_contents($file)) {
return unserialize($content);
} else {
return null;
}
}
/**
* Saves the mod rewrite configuration array of an client.
*
* File is placed in /contenido/mod_rewrite/includes/and is named like
* config.mod_rewrite_{client_id}.php.
*
* @param int $clientId Id of client
* @param array $config Configuration to save
* @return bool
*/
function mr_setConfiguration($clientId, array $config) {
global $cfg;
$file = $cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/includes/config.mod_rewrite_' . $clientId . '.php';
$result = file_put_contents($file, serialize($config));
return ($result) ? true : false;
}
/**
* Includes the frontend controller script which parses the url and extacts
* needed data like idcat, idart, lang and client from it.
*
* Will be called by chain 'Contenido.Frontend.AfterLoadPlugins' at front_content.php.
*
* @return bool Just a return value
*/
function mr_runFrontendController() {
$iStartTime = getmicrotime();
plugin_include('mod_rewrite', 'includes/config.plugin.php');
if (ModRewrite::isEnabled() == true) {
plugin_include('mod_rewrite', 'includes/front_content_controller.php');
$totalTime = sprintf('%.4f', (getmicrotime() - $iStartTime));
ModRewriteDebugger::add($totalTime, 'mr_runFrontendController() total time');
}
return true;
}
/**
* Cleanups passed string from characters beeing repeated two or more times
*
* @param string $char Character to remove
* @param string $string String to clean from character
* @return string Cleaned string
*/
function mr_removeMultipleChars($char, $string) {
while (strpos($string, $char . $char) !== false) {
$string = str_replace($char . $char, $char, $string);
}
return $string;
}
/**
* Returns amr related translation text
*
* @param string $key The message id as string
* @return string Related message
*/
function mr_i18n($key) {
global $lngAMR;
return (is_array($lngAMR) && isset($lngAMR[$key])) ? $lngAMR[$key] : 'n. a.';
}
################################################################################
### Some helper functions, which are not plugin specific
/**
* Database query helper. Used to execute a select statement and to return the
* result of first recordset.
*
* Minimizes following code:
* <code>
* // default way
* $db = new DB_Contenido();
* $sql = "SELECT * FROM foo WHERE bar='foobar'";
* $db->query($sql);
* $db->next_record();
* $data = $db->Record;
*
* // new way
* $sql = "SELECT * FROM foo WHERE bar='foobar'";
* $data = mr_queryAndNextRecord($sql);
* </code>
*
* @param string $query Query to execute
* @return mixed Assoziative array including recordset or null
*/
function mr_queryAndNextRecord($query) {
static $db;
if (!isset($db)) {
$db = new DB_Contenido();
}
if (!$db->query($query)) {
return null;
}
return ($db->next_record()) ? $db->Record : null;
}
/**
* Returns value of an array key (assoziative or indexed).
*
* Shortcut function for some ways to access to arrays:
* <code>
* // old way
* if (is_array($foo) && isset($foo['bar']) && $foo['bar'] == 'yieeha') {
* // do something
* }
*
* // new, more readable way:
* if (mr_arrayValue($foo, 'bar') == 'yieeha') {
* // do something
* }
*
* // old way
* if (is_array($foo) && isset($foo['bar'])) {
* $jep = $foo['bar'];
* } else {
* $jep = 'yummy';
* }
*
* // new way
* $jep = mr_arrayValue($foo, 'bar', 'yummy');
* </code>
*
* @param array $array The array
* @param mixed $key Position of an indexed array or key of an assoziative array
* @param mixed $default Default value to return
* @return mixed Either the found value or the default value
*/
function mr_arrayValue($array, $key, $default = null) {
if (!is_array($array)) {
return $default;
} elseif (!isset($array[$key])) {
return $default;
} else {
return $array[$key];
}
}
/**
* Request cleanup function. Request data is allways tainted and must be filtered.
* Pass the array to cleanup using several options.
* Emulates array_walk_recursive().
*
* @param mixed $data Data to cleanup
* @param array $options Default options array, provides only 'filter' key with several
* filter functions which are to execute as follows:
* <code>
* $options['filter'] = array('trim', 'myFilterFunc');
* </code>
* If no filter functions are set, 'trim', 'strip_tags' and 'stripslashes'
* will be used by default.
* A userdefined function must accept the value as a parameter and must return
* the filtered parameter, e. g.
* <code>
* function myFilter($data) {
* // do what you want with the data, e. g. cleanup of xss content
* return $data;
* }
* </code>
*
* @return mixed Cleaned data
*/
function mr_requestCleanup(&$data, $options = null) {
if (!mr_arrayValue($options, 'filter')) {
$options['filter'] = array('trim', 'strip_tags', 'stripslashes');
}
if (is_array($data)) {
foreach ($data as $p => $v) {
$data[$p] = mr_requestCleanup($v, $options);
}
} else {
foreach ($options['filter'] as $filter) {
if ($filter == 'trim') {
$data = trim($data);
} elseif ($filter == 'strip_tags') {
$data = strip_tags($data);
} elseif ($filter == 'stripslashes') {
$data = stripslashes($data);
} elseif (function_exists($filter)) {
$data = call_user_func($filter, $data);
}
}
}
return $data;
}
/**
* Minimalistic'n simple way to get request variables.
*
* Checks occurance in $_GET, then in $_POST. Uses trim() and strip_tags() to preclean data.
*
* @param string $key Name of var to get
* @param mixed $default Default value to return
* @return mixed The value
*/
function mr_getRequest($key, $default = null) {
static $cache;
if (!isset($cache)) {
$cache = array();
}
if (isset($cache[$key])) {
return $cache[$key];
}
if (isset($_GET[$key])) {
$val = $_GET[$key];
} elseif (isset($_POST[$key])) {
$val = $_POST[$key];
} else {
$val = $default;
}
$cache[$key] = strip_tags(trim($val));
return $cache[$key];
}
/**
* Replaces calling of header method for redirects in front_content.php,
* used during development.
*
* @param $header Header value for redirect
*/
function mr_header($header) {
header($header);
return;
$header = str_replace('Location: ', '', $header);
echo '<html>
<head></head>
<body>
<p><a href="' . $header . '">' . $header . '</a></p>';
mr_debugOutput();
echo '</body></html>';
exit();
}
/**
* Debug output only during development
*
* @param bool $print Flag to echo the debug data
* @return mixed Either the debug data, if parameter $print is set to true, or nothing
*/
function mr_debugOutput($print = true) {
global $DB_Contenido_QueryCache;
if (isset($DB_Contenido_QueryCache) && is_array($DB_Contenido_QueryCache) &&
count($DB_Contenido_QueryCache) > 0) {
ModRewriteDebugger::add($DB_Contenido_QueryCache, 'sql statements');
// calculate total time consumption of queries
$timeTotal = 0;
foreach ($DB_Contenido_QueryCache as $pos => $item) {
$timeTotal += $item['time'];
}
ModRewriteDebugger::add($timeTotal, 'sql total time');
}
$sOutput = ModRewriteDebugger::getAll();
if ($print == true) {
echo $sOutput;
} else {
return $sOutput;
}
}

Datei anzeigen

@ -0,0 +1,312 @@
<?php
/**
* Plugin mod_rewrite backend include file to administer settings (in content frame)
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: include.mod_rewrite_content.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $client, $cfg;
################################################################################
##### Initialization
if ((int) $client <= 0) {
// if there is no client selected, display empty page
$oPage = new cPage;
$oPage->render();
return;
}
$action = (isset($_REQUEST['mr_action'])) ? $_REQUEST['mr_action'] : 'index';
$bDebug = false;
################################################################################
##### Some variables
$oMrController = new ModRewrite_ContentController();
$aMrCfg = ModRewrite::getConfig();
// downwards compatibility to previous plugin versions
if (mr_arrayValue($aMrCfg, 'category_seperator', '') == '') {
$aMrCfg['category_seperator'] = '/';
}
if (mr_arrayValue($aMrCfg, 'category_word_seperator', '') == '') {
$aMrCfg['category_word_seperator'] = '-';
}
if (mr_arrayValue($aMrCfg, 'article_seperator', '') == '') {
$aMrCfg['article_seperator'] = '/';
}
if (mr_arrayValue($aMrCfg, 'article_word_seperator', '') == '') {
$aMrCfg['article_word_seperator'] = '-';
}
// some settings
$aSeparator = array(
'pattern' => '/^[\/\-_\.\$~]{1}$/',
'info' => '<span style="font-family:courier;font-weight:bold;">/ - . _ ~</span>'
);
$aWordSeparator = array(
'pattern' => '/^[\-_\.\$~]{1}$/',
'info' => '<span style="font-family:courier;font-weight:bold;">- . _ ~</span>'
);
$routingSeparator = '>>>';
$oMrController->setProperty('bDebug', $bDebug);
$oMrController->setProperty('aSeparator', $aSeparator);
$oMrController->setProperty('aWordSeparator', $aWordSeparator);
$oMrController->setProperty('routingSeparator', $routingSeparator);
// define basic data contents (used for template)
$oView = $oMrController->getView();
$oView->content_before = '';
$oView->idclient = $client;
$oView->use_chk = (ModRewrite::isEnabled()) ? ' checked="checked"' : '';
$oView->header_notes_css = 'display:none;';
// mr copy .htaccess
// @todo copy htacccess check into ModRewrite_ContentController->_doChecks()
$aHtaccessInfo = ModRewrite::getHtaccessInfo();
if ($aHtaccessInfo['has_htaccess']) {
$oView->htaccess_info_css = 'display:none;';
} else {
$oView->header_notes_css = 'display:table-row;';
$oView->htaccess_info_css = 'display:block;';
}
// empty aliases
$iEmptyArticleAliases = ModRewrite::getEmptyArticlesAliases();
$iEmptyCategoryAliases = ModRewrite::getEmptyCategoriesAliases();
if ($iEmptyArticleAliases > 0 || $iEmptyCategoryAliases > 0) {
$oView->header_notes_css = 'display:table-row;';
$oView->emptyaliases_info_css = 'display:block;';
} else {
$oView->emptyaliases_info_css = 'display:none;';
}
// mr root dir
$oView->rootdir = $aMrCfg['rootdir'];
$oView->rootdir_error = '';
// mr check root dir
$oView->checkrootdir_chk = ($aMrCfg['checkrootdir'] == 1) ? ' checked="checked"' : '';
// mr start from root
$oView->startfromroot_chk = ($aMrCfg['startfromroot'] == 1) ? ' checked="checked"' : '';
// mr prevent duplicated content
$oView->prevent_duplicated_content_chk = ($aMrCfg['prevent_duplicated_content'] == 1) ? ' checked="checked"' : '';
// mr language usage
$oView->use_language_chk = ($aMrCfg['use_language'] == 1) ? ' checked="checked"' : '';
$oView->use_language_name_chk = ($aMrCfg['use_language_name'] == 1) ? ' checked="checked"' : '';
$oView->use_language_name_disabled = ($aMrCfg['use_language'] == 1) ? '' : ' disabled="disabled"';
// mr client usage
$oView->use_client_chk = ($aMrCfg['use_client'] == 1) ? ' checked="checked"' : '';
$oView->use_client_name_chk = ($aMrCfg['use_client_name'] == 1) ? ' checked="checked"' : '';
$oView->use_client_name_disabled = ($aMrCfg['use_client'] == 1) ? '' : ' disabled="disabled"';
// mr lowecase uri
$oView->use_lowercase_uri_chk = ($aMrCfg['use_lowercase_uri'] == 1) ? ' checked="checked"' : '';
// mr category/category word separator
$oView->category_separator = $aMrCfg['category_seperator'];
$oView->category_separator_attrib = '';
$oView->category_word_separator = $aMrCfg['category_word_seperator'];
$oView->category_word_separator_attrib = '';
$oView->category_separator_error = '';
$oView->category_word_separator_error = '';
// mr article/article word separator
$oView->article_separator = $aMrCfg['article_seperator'];
$oView->article_separator_attrib = '';
$oView->article_word_separator = $aMrCfg['article_word_seperator'];
$oView->article_word_separator_attrib = '';
$oView->article_separator_error = '';
$oView->article_word_separator_error = '';
// mr file extension
$oView->file_extension = $aMrCfg['file_extension'];
$oView->file_extension_error = '';
// mr category name resolve percentage
$oView->category_resolve_min_percentage = $aMrCfg['category_resolve_min_percentage'];
$oView->category_resolve_min_percentage_error = '';
// mr add start article name to url
$oView->add_startart_name_to_url_chk = ($aMrCfg['add_startart_name_to_url'] == 1) ? ' checked="checked"' : '';
$oView->add_startart_name_to_url_error = '';
$oView->default_startart_name = $aMrCfg['default_startart_name'];
// mr rewrite urls at
$oView->rewrite_urls_at_congeneratecode_chk = ($aMrCfg['rewrite_urls_at_congeneratecode'] == 1) ? ' checked="checked"' : '';
$oView->rewrite_urls_at_front_content_output_chk = ($aMrCfg['rewrite_urls_at_front_content_output'] == 1) ? ' checked="checked"' : '';
$oView->content_after = '';
// mr rewrite routing
$data = '';
if (is_array($aMrCfg['routing'])) {
foreach ($aMrCfg['routing'] as $uri => $route) {
$data .= $uri . $routingSeparator . $route . "\n";
}
}
$oView->rewrite_routing = $data;
// mr redirect invalid article
$oView->redirect_invalid_article_to_errorsite_chk = ($aMrCfg['redirect_invalid_article_to_errorsite'] == 1) ? ' checked="checked"' : '';
$oView->lng_version = i18n("Version", "mod_rewrite");
$oView->lng_author = i18n("Author", "mod_rewrite");
$oView->lng_mail_to_author = i18n("E-Mail to author", "mod_rewrite");
$oView->lng_pluginpage = i18n("Plugin page", "mod_rewrite");
$oView->lng_visit_pluginpage = i18n("Visit plugin page", "mod_rewrite");
$oView->lng_opens_in_new_window = i18n("opens page in new window", "mod_rewrite");
$oView->lng_contenido_forum = i18n("CONTENIDO forum", "mod_rewrite");
$oView->lng_pluginthread_in_contenido_forum = i18n("Plugin thread in CONTENIDO forum", "mod_rewrite");
$oView->lng_plugin_settings = i18n("Plugin settings", "mod_rewrite");
$oView->lng_note = i18n("Note", "mod_rewrite");
// @todo copy htacccess check into ModRewrite_ContentController->_doChecks()
$sMsg = i18n("The .htaccess file could not found either in CONTENIDO installation directory nor in client directory.<br>It should set up in %sFunctions%s area, if needed.", "mod_rewrite");
$oView->lng_msg_no_htaccess_found = sprintf($sMsg, '<a href="main.php?area=mod_rewrite_expert&frame=4&contenido=' . $oView->sessid . '&idclient=' . $client . '" onclick="parent.right_top.sub.clicked(parent.right_top.document.getElementById(\'c_1\').firstChild);">', '</a>');
$sMsg = i18n("Found", "mod_rewrite");
$oView->lng_msg_no_emptyaliases_found = sprintf($sMsg, '<a href="main.php?area=mod_rewrite_expert&frame=4&contenido=' . $oView->sessid . '&idclient=' . $client . '" onclick="parent.right_top.sub.clicked(parent.right_top.document.getElementById(\'c_1\').firstChild);">', '</a>');
$oView->lng_enable_amr = i18n("Enable Advanced Mod Rewrite", "mod_rewrite");
$oView->lng_msg_enable_amr_info = i18n("Disabling of plugin does not result in disabling mod rewrite module of the web server - This means,<br> all defined rules in the .htaccess are still active and could create unwanted side effects.<br><br>Apache mod rewrite could be enabled/disabled by setting the RewriteEngine directive.<br>Any defined rewrite rules could remain in the .htaccess and they will not processed,<br>if the mod rewrite module is disabled", "mod_rewrite");
$oView->lng_example = i18n("Example", "mod_rewrite");
$oView->lng_msg_enable_amr_info_example = i18n("# enable apache mod rewrite module\nRewriteEngine on\n\n# disable apache mod rewrite module\nRewriteEngine off", "mod_rewrite");
$oView->lng_rootdir = i18n("Path to .htaccess from DocumentRoot", "mod_rewrite");
$oView->lng_rootdir_info = i18n("Type '/' if the .htaccess file lies inside the wwwroot (DocumentRoot) folder.<br>Type the path to the subfolder fromm wwwroot, if CONTENIDO is installed in a subfolder within the wwwroot<br>(e. g. http://domain/mycontenido -&gt; path = '/mycontenido/')", "mod_rewrite");
$oView->lng_checkrootdir = i18n("Check path to .htaccess", "mod_rewrite");
$oView->lng_checkrootdir_info = i18n("The path will be checked, if this option is enabled.<br>But this could result in an error in some cases, even if the specified path is valid and<br>clients DocumentRoot differs from CONTENIDO backend DocumentRoot.", "mod_rewrite");
$oView->lng_startfromroot = i18n("Should the name of root category be displayed in the URL?", "mod_rewrite");
$oView->lng_startfromroot_lbl = i18n("Start from root category", "mod_rewrite");
$oView->lng_startfromroot_info = i18n("If enabled, the name of the root category (e. g. 'Mainnavigation' in a CONTENIDO default installation), will be preceded to the URL.", "mod_rewrite");
$oView->lng_use_client = i18n("Are several clients maintained in one directory?", "mod_rewrite");
$oView->lng_use_client_lbl = i18n("Prepend client to the URL", "mod_rewrite");
$oView->lng_use_client_name_lbl = i18n("Use client name instead of the id", "mod_rewrite");
$oView->lng_use_language = i18n("Should the language appear in the URL (required for multi language websites)?", "mod_rewrite");
$oView->lng_use_language_lbl = i18n("Prepend language to the URL", "mod_rewrite");
$oView->lng_use_language_name_lbl = i18n("Use language name instead of the id", "mod_rewrite");
$oView->lng_userdefined_separators_header = i18n("Configure your own separators with following 4 settings<br>to control generated URLs to your own taste", "mod_rewrite");
$oView->lng_userdefined_separators_example = i18n("www.domain.com/category1-category2.articlename.html\nwww.domain.com/category1/category2-articlename.html\nwww.domain.com/category.name1~category2~articlename.html\nwww.domain.com/category_name1-category2-articlename.foo", "mod_rewrite");
$oView->lng_userdefined_separators_example_a = i18n("Category separator has to be different from category-word separator", "mod_rewrite");
$oView->lng_userdefined_separators_example_a_example = i18n("# Example: Category separator (/) and category-word separator (_)\ncategory_one/category_two/articlename.html", "mod_rewrite");
$oView->lng_userdefined_separators_example_b = i18n("Category separator has to be different from article-word separator", "mod_rewrite");
$oView->lng_userdefined_separators_example_b_example = i18n("# Example: Category separator (/) and article-word separator (-)\ncategory_one/category_two/article-description.html", "mod_rewrite");
$oView->lng_userdefined_separators_example_c = i18n("Category-article separator has to be different from article-word separator", "mod_rewrite");
$oView->lng_userdefined_separators_example_c_example = i18n("# Example: Category-article separator (/) and article-word separator (-)\ncategory_one/category_two/article-description.html", "mod_rewrite");
$oView->lng_category_separator = i18n("Category separator (delemiter between single categories)", "mod_rewrite");
$oView->lng_catart_separator_info = sprintf(i18n("(possible values: %s)", "mod_rewrite"), $aSeparator['info']);
$oView->lng_word_separator_info = sprintf(i18n("(possible values: %s)", "mod_rewrite"), $aWordSeparator['info']);
$oView->lng_category_word_separator = i18n("Category-word separator (delemiter between category words)", "mod_rewrite");
$oView->lng_article_separator = i18n("Category-article separator (delemiter between category-block and article)", "mod_rewrite");
$oView->lng_article_word_separator = i18n("Article-word separator (delemiter between article words)", "mod_rewrite");
$oView->lng_add_startart_name_to_url = i18n("Append article name to URLs", "mod_rewrite");
$oView->lng_add_startart_name_to_url_lbl = i18n("Append article name always to URLs (even at URLs to categories)", "mod_rewrite");
$oView->lng_default_startart_name = i18n("Default article name without extension", "mod_rewrite");
$oView->lng_default_startart_name_info = i18n("e. g. 'index' for index.ext<br>In case of selected 'Append article name always to URLs' option and a empty field,<br>the name of the start article will be used", "mod_rewrite");
$oView->lng_file_extension = i18n("File extension at the end of the URL", "mod_rewrite");
$oView->lng_file_extension_info = i18n("Specification of file extension with a preceded dot<br>e.g. '.html' for http://host/foo/bar.html", "mod_rewrite");
$oView->lng_file_extension_info2 = i18n("It's strongly recommended to specify a extension here,<br>if the option 'Append article name always to URLs' was not selected.<br><br>Otherwise URLs to categories and articles would have the same format<br>which may result in unresolvable categories/articles in some cases.", "mod_rewrite");
$oView->lng_file_extension_info3 = i18n("It's necessary to specify a file extension at the moment, due do existing issues, which are not solved until yet. An not defined extension may result in invalid article detection in some cases.", "mod_rewrite");
$oView->lng_use_lowercase_uri = i18n("Should the URLs be written in lower case?", "mod_rewrite");
$oView->lng_use_lowercase_uri_lbl = i18n("URLs in lower case", "mod_rewrite");
$oView->lng_prevent_duplicated_content = i18n("Duplicated content", "mod_rewrite");
$oView->lng_prevent_duplicated_content_lbl = i18n("Prevent duplicated content", "mod_rewrite");
$oView->lng_prevent_duplicated_content_info = i18n("Depending on configuration, pages could be found thru different URLs.<br>Enabling of this option prevents this. Examples for duplicated content", "mod_rewrite");
$oView->lng_prevent_duplicated_content_info2 = i18n("Name of the root category in the URL: Feasible is /maincategory/subcategory/ and /subcategory/\nLanguage in the URL: Feasible is /german/category/ and /1/category/\nClient in the URL: Feasible is /client/category/ und /1/category/", "mod_rewrite");
$oView->lng_prevent_duplicated_content_info2 = '<li>' . str_replace("\n", '</li><li>', $oView->lng_prevent_duplicated_content_info2) . '</li>';
$oView->lng_category_resolve_min_percentage = i18n("Percentage for similar category paths in URLs", "mod_rewrite");
$oView->lng_category_resolve_min_percentage_info = i18n("This setting refers only to the category path of a URL. If AMR is configured<br>to prepend e. g. the root category, language and/or client to the URL,<br>the specified percentage will not applied to those parts of the URL.<br>An incoming URL will be cleaned from those values and the remaining path (urlpath of the category)<br>will be checked against similarities.", "mod_rewrite");
$oView->lng_category_resolve_min_percentage_example = i18n("100 = exact match with no tolerance\n85 = paths with little errors will match to similar ones\n0 = matching will work even for total wrong paths", "mod_rewrite");
$oView->lng_redirect_invalid_article_to_errorsite = i18n("Redirect in case of invalid articles", "mod_rewrite");
$oView->lng_redirect_invalid_article_to_errorsite_lbl = i18n("Redirect to error page in case of invaid articles", "mod_rewrite");
$oView->lng_redirect_invalid_article_to_errorsite_info = i18n("The start page will be displayed if this option is not enabled", "mod_rewrite");
$oView->lng_rewrite_urls_at = i18n("Moment of URL generation", "mod_rewrite");
$oView->lng_rewrite_urls_at_front_content_output_lbl = i18n("a.) During the output of HTML code of the page", "mod_rewrite");
$oView->lng_rewrite_urls_at_front_content_output_info = i18n("Clean-URLs will be generated during page output. Modules/Plugins are able to generate URLs to frontend<br>as usual as in previous CONTENIDO versions using a format like 'front_content.php?idcat=1&amp;idart=2'.<br>The URLs will be replaced by the plugin to Clean-URLs before sending the HTML output.", "mod_rewrite");
$oView->lng_rewrite_urls_at_front_content_output_info2 = i18n("Differences to variant b.)", "mod_rewrite");
$oView->lng_rewrite_urls_at_front_content_output_info3 = i18n("Still compatible to old modules/plugins, since no changes in codes are required\nAll occurring URLs in HTML code, even those set by wysiwyg, will be switched to Clean-URLs\nAll URLs will usually be collected and converted to Clean-URLs at once.<br>Doing it this way reduces the amount of executed database significantly.", "mod_rewrite");
$oView->lng_rewrite_urls_at_front_content_output_info3 = '<li>' . str_replace("\n", '</li><li>', $oView->rewrite_urls_at_front_content_output_info3) . '</li>';
$oView->lng_rewrite_urls_at_congeneratecode_lbl = i18n("b.) In modules or plugins", "mod_rewrite");
$oView->lng_rewrite_urls_at_congeneratecode_info = i18n("By using this option, all Clean-URLs will be generated directly in module or plugins.<br>This means, all areas in modules/plugins, who generate internal URLs to categories/articles, have to be adapted manually.<br>All Clean-URLs have to be generated by using following function:", "mod_rewrite");
$oView->lng_rewrite_urls_at_congeneratecode_example = i18n("# structure of a normal url\n\$url = 'front_content.php?idart=123&amp;lang=2&amp;client=1';\n\n# creation of a url by using the CONTENIDOs Url-Builder (since 4.8.9),\n# wich expects the parameter as a assoziative array\n\$params = array('idart'=>123, 'lang'=>2, 'client'=>1);\n\$newUrl = Contenido_Url::getInstance()->build(\$params);", "mod_rewrite");
$oView->lng_rewrite_urls_at_congeneratecode_info2 = i18n("Differences to variant a.)", "mod_rewrite");
$oView->lng_rewrite_urls_at_congeneratecode_info3 = i18n("The default way to generate URLs to fronend pages\nEach URL in modules/plugins has to be generated by UriBuilder\nEach generated Clean-Url requires a database query", "mod_rewrite");
$oView->lng_rewrite_urls_at_congeneratecode_info3 = '<li>' . str_replace("\n", '</li><li>', $oView->lng_rewrite_urls_at_congeneratecode_info3) . '</li>';
$oView->lng_rewrite_routing = i18n("Routing", "mod_rewrite");
$oView->lng_rewrite_routing_info = i18n("Routing definitions for incoming URLs", "mod_rewrite");
$oView->lng_rewrite_routing_info2 = i18n("Type one routing definition per line as follows:", "mod_rewrite");
$oView->lng_rewrite_routing_example = i18n("# {incoming_url}>>>{new_url}\n/incoming_url/name.html>>>new_url/new_name.html\n\n# route a specific incoming url to a new page\n/campaign/20_percent_on_everything_except_animal_food.html>>>front_content.php?idcat=23\n\n# route request to wwwroot to a specific page\n/>>>front_content.php?idart=16", "mod_rewrite");
$oView->lng_rewrite_routing_info3 = i18n("The routing does not sends a HTTP header redirection to the destination URL, the redirection will happen internally by<br>replacing the detected incoming URL against the new destination URL (overwriting of article- categoryid)\nIncoming URLs can point to non existing resources (category/article), but the desttination URLs should point<br>to valid CONTENIDO articles/categories\nDestination URLs should point to real URLs to categories/articles,<br>e. g.front_content.php?idcat=23 or front_content.php?idart=34\nThe language id should attached to the URL in multi language sites<br>e. g. front_content.php?idcat=23&amp;lang=1\nThe client id should attached to the URL in multi client sites sharing the same folder<br>e. g. front_content.php?idcat=23&amp;client=2\nThe destination URL should not start with '/' or './' (wrong: /front_content.php, correct: front_content.php)", "mod_rewrite");
$oView->lng_rewrite_routing_info3 = '<li>' . str_replace("\n", '</li><li>', $oView->lng_rewrite_routing_info3) . '</li>';
$oView->lng_discard_changes = i18n("Discard changes", "mod_rewrite");
$oView->lng_save_changes = i18n("Save changes", "mod_rewrite");
################################################################################
##### Action processing
if ($action == 'index') {
$oMrController->indexAction();
} elseif ($action == 'save') {
$oMrController->saveAction();
} elseif ($action == 'reset') {
$oMrController->resetAction();
} elseif ($action == 'resetempty') {
$oMrController->resetEmptyAction();
} else {
$oMrController->indexAction();
}
################################################################################
##### Output
$oMrController->render(
$cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/templates/content.html'
);

Datei anzeigen

@ -0,0 +1,18 @@
<?php
/**
* Plugin mod_rewrite backend include file (in content-top frame)
*
* @date 22.04.2008
* @author Murat Purc
* @copyright © Murat Purc 2008
* @package Contenido
* @subpackage ModRewrite
*/
defined('CON_FRAMEWORK') or die('Illegal call');
$tpl = new Template();
$tpl->generate(
$cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/templates/content_top.html', 0, 0
);

Datei anzeigen

@ -0,0 +1,119 @@
<?php
/**
* Plugin mod_rewrite backend include file to administer expert (in content frame)
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: include.mod_rewrite_contentexpert.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $client, $cfg;
################################################################################
##### Initialization
if ((int) $client <= 0) {
// if there is no client selected, display empty page
$oPage = new cPage;
$oPage->render();
return;
}
$action = (isset($_REQUEST['mr_action'])) ? $_REQUEST['mr_action'] : 'index';
$debug = false;
################################################################################
##### Some variables
$oMrController = new ModRewrite_ContentExpertController();
$aMrCfg = ModRewrite::getConfig();
$aHtaccessInfo = ModRewrite::getHtaccessInfo();
// define basic data contents (used for template)
$oView = $oMrController->getView();
// view variables
$oView->copy_htaccess_css = 'display:table-row;';
$oView->copy_htaccess_error = '';
$oView->copy_htaccess_contenido_chk = ' checked="checked"';
$oView->copy_htaccess_cms_chk = '';
$oView->contenido_full_path = $aHtaccessInfo['contenido_full_path'];
$oView->client_full_path = $aHtaccessInfo['client_full_path'];
$oView->content_after = '';
$oMrController->setProperty('htaccessInfo', $aHtaccessInfo);
// view language variables
$oView->lng_plugin_functions = i18n("Plugin functions", "mod_rewrite");
$oView->lng_copy_htaccess_type = i18n("Copy/Download .htaccess template", "mod_rewrite");
$oView->lng_copy_htaccess_type_lbl = i18n("Select .htaccess template", "mod_rewrite");
$oView->lng_copy_htaccess_type1 = i18n("Restrictive .htaccess", "mod_rewrite");
$oView->lng_copy_htaccess_type2 = i18n("Simple .htaccess", "mod_rewrite");
$oView->lng_copy_htaccess_type_info1 = i18n("Contains rules with restrictive settings.<br>All requests pointing to extension avi, css, doc, flv, gif, gzip, ico, jpeg, jpg, js, mov, <br>mp3, pdf, png, ppt, rar, txt, wav, wmv, xml, zip, will be excluded vom rewriting.<br>Remaining requests will be rewritten to front_content.php,<br>except requests to 'contenido/', 'setup/', 'cms/upload', 'cms/front_content.php', etc.<br>Each resource, which has to be excluded from rewriting must be specified explicitly.", "mod_rewrite");
$oView->lng_copy_htaccess_type_info2 = i18n("Contains a simple collection of rules. Each requests pointing to valid symlinks, folders or<br>files, will be excluded from rewriting. Remaining requests will be rewritten to front_content.php", "mod_rewrite");
$oView->lng_copy_htaccess_to = i18n("and copy to", "mod_rewrite");
$oView->lng_copy_htaccess_to_contenido = i18n("CONTENIDO installation directory", "mod_rewrite");
$oView->lng_copy_htaccess_to_contenido_info = i18n("Copy the selected .htaccess template into CONTENIDO installation directory<br><br>&nbsp;&nbsp;&nbsp;&nbsp;{CONTENIDO_FULL_PATH}.<br><br>This is the recommended option for a CONTENIDO installation with one or more clients<br>who are running on the same domain.", "mod_rewrite");
$oView->lng_copy_htaccess_to_contenido_info = str_replace('{CONTENIDO_FULL_PATH}', $oView->contenido_full_path, $oView->lng_copy_htaccess_to_contenido_info);
$oView->lng_copy_htaccess_to_client = i18n("client directory", "mod_rewrite");
$oView->lng_copy_htaccess_to_client_info = i18n("Copy the selected .htaccess template into client's directory<br><br>&nbsp;&nbsp;&nbsp;&nbsp;{CLIENT_FULL_PATH}.<br><br>This is the recommended option for a multiple client system<br>where each client has it's own domain/subdomain", "mod_rewrite");
$oView->lng_copy_htaccess_to_client_info = str_replace('{CLIENT_FULL_PATH}', $oView->client_full_path, $oView->lng_copy_htaccess_to_client_info);
$oView->lng_or = i18n("or", "mod_rewrite");
$oView->lng_download = i18n("Download", "mod_rewrite");
$oView->lng_download_info = i18n("Download selected .htaccess template to copy it to the destination folder<br>or to take over the settings manually.", "mod_rewrite");
$oView->lng_resetaliases = i18n("Reset category-/ and article aliases", "mod_rewrite");
$oView->lng_resetempty_link = i18n("Reset only empty aliases", "mod_rewrite");
$oView->lng_resetempty_info = i18n("Only empty aliases will be reset, existing aliases, e. g. manually set aliases, will not be changed.", "mod_rewrite");
$oView->lng_resetall_link = i18n("Reset all aliases", "mod_rewrite");
$oView->lng_resetall_info = i18n("Reset all category-/article aliases. Existing aliases will be overwritten.", "mod_rewrite");
$oView->lng_note = i18n("Note", "mod_rewrite");
$oView->lng_resetaliases_note = i18n("This process could require some time depending on amount of categories/articles.<br>The aliases will not contain the configured plugin separators, but the CONTENIDO default separators '/' und '-', e. g. '/category-word/article-word'.<br>Execution of this function ma be helpful to prepare all or empty aliases for the usage by the plugin.", "mod_rewrite");
$oView->lng_discard_changes = i18n("Discard changes", "mod_rewrite");
$oView->lng_save_changes = i18n("Save changes", "mod_rewrite");
################################################################################
##### Action processing
if ($action == 'index') {
$oMrController->indexAction();
} elseif ($action == 'copyhtaccess') {
$oMrController->copyHtaccessAction();
} elseif ($action == 'downloadhtaccess') {
$oMrController->downloadHtaccessAction();
exit();
} elseif ($action == 'reset') {
$oMrController->resetAction();
} elseif ($action == 'resetempty') {
$oMrController->resetEmptyAction();
} else {
$oMrController->indexAction();
}
################################################################################
##### Output
$oMrController->render(
$cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/templates/contentexpert.html'
);

Datei anzeigen

@ -0,0 +1,83 @@
<?php
/**
* Testscript for Advanced Mod Rewrite Plugin.
*
* The goal of this testscript is to provide an easy way for a variance comparison
* of created SEO URLs against their resolved parts.
*
* This testscript fetches the full category and article structure of actual
* CONTENIDO installation, creates the SEO URLs for each existing category/article
* and resolves the generated URLs.
*
* @package plugin
* @subpackage Mod Rewrite
* @version SVN Revision $Rev: 128 $
* @id $Id: include.mod_rewrite_contenttest.php 128 2019-07-03 11:58:28Z oldperl $:
* @author Murat Purc <murat@purc.de>
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*/
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
global $client, $cfg;
################################################################################
##### Initialization
if ((int) $client <= 0) {
// if there is no client selected, display empty page
$oPage = new cPage;
$oPage->render();
return;
}
################################################################################
##### Processing
$mrTestNoOptionSelected = false;
if (!mr_getRequest('idart') && !mr_getRequest('idcat') && !mr_getRequest('idcatart') && !mr_getRequest('idartlang')) {
$mrTestNoOptionSelected = true;
}
$oMrTestController = new ModRewrite_ContentTestController();
// view language variables
$oView = $oMrTestController->getView();
$oView->lng_form_info = i18n("Define options to genereate the URLs by using the form below and run the test.", "mod_rewrite");
$oView->lng_form_label = i18n("Parameter to use", "mod_rewrite");
$oView->lng_maxitems_lbl = i18n("Number of URLs to generate", "mod_rewrite");
$oView->lng_run_test = i18n("Run test", "mod_rewrite");
$oView->lng_result_item_tpl = i18n("{pref}<strong>{name}</strong><br>{pref}Builder in: {url_in}<br>{pref}Builder out: {url_out}<br>{pref}<span style='color:{color}'>Resolved URL: {url_res}</span><br>{pref}Resolver err: {err}<br>{pref}Resolved data: {data}", "mod_rewrite");
$oView->lng_result_message_tpl = i18n("Duration of test run: {time} seconds.<br>Number of processed URLs: {num_urls}<br><span style='color:green'>Successful resolved: {num_success}</span><br><span style='color:red'>Errors during resolving: {num_fail}</span></strong>", "mod_rewrite");
################################################################################
##### Action processing
if ($mrTestNoOptionSelected) {
$oMrTestController->indexAction();
} else {
$oMrTestController->testAction();
}
$oView = $oMrTestController->getView();
$oView->content .= mr_debugOutput(false);
################################################################################
##### Output
$oMrTestController->render(
$cfg['path']['contenido'] . $cfg['path']['plugins'] . 'mod_rewrite/templates/contenttest.html'
);