Source for file include.mod_rewrite_content.php

Documentation is available at include.mod_rewrite_content.php

  1. <?php
  2. /**
  3.  * Plugin mod_rewrite backend include file to administer settings (in content frame)
  4.  *
  5.  * @date        22.04.2008
  6.  * @author      Murat Purc
  7.  * @copyright   © Murat Purc 2008
  8.  * @package     Contenido
  9.  * @subpackage  ModRewrite
  10.  */
  11.  
  12. defined('CON_FRAMEWORK'or die('Illegal call');
  13.  
  14. $action (isset($_REQUEST['mr_action'])) $_REQUEST['mr_action''index';
  15. $debug  false;
  16.  
  17. //var_dump($cfg['templates']['mod_rewrite_content']);
  18.  
  19.  
  20. ####################################################################################################
  21. ##### Some variables
  22.  
  23.  
  24. $oGlob  mpGlobals::getInstance();
  25. $oTpl   new Template();
  26. $aMrCfg ModRewrite::getConfig();
  27.  
  28. // downwards compatibility to previous plugin versions
  29. if (mr_arrayValue($aMrCfg'category_seperator'''== ''{
  30.     $aMrCfg['category_seperator''/';
  31. }
  32. if (mr_arrayValue($aMrCfg'category_word_seperator'''== ''{
  33.     $aMrCfg['category_word_seperator''-';
  34. }
  35. if (mr_arrayValue($aMrCfg'article_seperator'''== ''{
  36.     $aMrCfg['article_seperator''/';
  37. }
  38. if (mr_arrayValue($aMrCfg'article_word_seperator'''== ''{
  39.     $aMrCfg['article_word_seperator''-';
  40. }
  41.  
  42. // some settings
  43. $aBgColor array(
  44.     'enabled'  => '#ffffff',
  45.     'disabled' => '#dadada'
  46. );
  47. $aSeparator array(
  48.     'pattern'         => '/^[\/\-_\.\$~]{1}$/',
  49.     'info'            => '<span style="font-family:courier;font-weight:bold;">/ - . _ ~</span>'
  50. );
  51. $aWordSeparator array(
  52.     'pattern'         => '/^[\-_\.\$~]{1}$/',
  53.     'info'            => '<span style="font-family:courier;font-weight:bold;">- . _ ~</span>'
  54. );
  55.  
  56. $routingSeparator '>>>';
  57.  
  58. // define basic data contents (used for template)
  59. $aData array();
  60. $aData['PLUGIN_PATH']      mpGlobals::getInstance()->get('cfg/path/plugins''mod_rewrite/';
  61. $aData['CONTENT.BEFORE']   '';
  62. $aData['SESSID']           $sess->id;
  63. $aData['AREA']             $area;
  64. $aData['ACTION']           $action;
  65. $aData['IDCLIENT']         $client;
  66. $aData['USE_CHK']          (ModRewrite::isEnabled()) ' checked="checked"' '';
  67. $aData['BGCOLOR_ENABLED']  $aBgColor['enabled'];
  68. $aData['BGCOLOR_DISABLED'$aBgColor['disabled'];
  69.  
  70. // mr root dir
  71. $aData['ROOTDIR']       $aMrCfg['rootdir'];
  72. $aData['ROOTDIR_ERROR''';
  73.  
  74. // mr check root dir
  75. $aData['CHECKROOTDIR_CHK'($aMrCfg['checkrootdir'== 1' checked="checked"' '';
  76.  
  77. // mr start from root
  78. $aData['STARTFROMROOT_CHK'($aMrCfg['startfromroot'== 1' checked="checked"' '';
  79.  
  80. // mr prevent duplicated content
  81. $aData['PREVENT_DUPLICATED_CONTENT_CHK'($aMrCfg['prevent_duplicated_content'== 1' checked="checked"' '';
  82.  
  83. // mr language usage
  84. $aData['USE_LANGUAGE_CHK']           ($aMrCfg['use_language'== 1' checked="checked"' '';
  85. $aData['USE_LANGUAGE_NAME_CHK']      ($aMrCfg['use_language_name'== 1' checked="checked"' '';
  86. $aData['USE_LANGUAGE_NAME_DISABLED'($aMrCfg['use_language'== 1'' ' disabled="disabled"';
  87.  
  88. // mr client usage
  89. $aData['USE_CLIENT_CHK']           ($aMrCfg['use_client'== 1' checked="checked"' '';
  90. $aData['USE_CLIENT_NAME_CHK']      ($aMrCfg['use_client_name'== 1' checked="checked"' '';
  91. $aData['USE_CLIENT_NAME_DISABLED'($aMrCfg['use_client'== 1'' ' disabled="disabled"';
  92.  
  93. // mr lowecase uri
  94. $aData['USE_LOWERCASE_URI_CHK']         ($aMrCfg['use_lowercase_uri'== 1' checked="checked"' '';
  95.  
  96. // mr category/category word separator
  97. $aData['CATEGORY_SEPARATOR']             $aMrCfg['category_seperator'];
  98. $aData['CATEGORY_SEPARATOR_ATTRIB']      '';
  99. $aData['CATEGORY_WORD_SEPARATOR']        $aMrCfg['category_word_seperator'];
  100. $aData['CATEGORY_WORD_SEPARATOR_ATTRIB''';
  101. $aData['CATEGORY_SEPARATOR_ERROR']      '';
  102. $aData['CATEGORY_WORD_SEPARATOR_ERROR''';
  103.  
  104. // mr article/article word separator
  105. $aData['ARTICLE_SEPARATOR']             $aMrCfg['article_seperator'];
  106. $aData['ARTICLE_SEPARATOR_ATTRIB']      '';
  107. $aData['ARTICLE_WORD_SEPARATOR']        $aMrCfg['article_word_seperator'];
  108. $aData['ARTICLE_WORD_SEPARATOR_ATTRIB''';
  109. $aData['ARTICLE_SEPARATOR_ERROR']      '';
  110. $aData['ARTICLE_WORD_SEPARATOR_ERROR''';
  111.  
  112. $aData['CAT_ART_SEP_MSG']    '(Mögliche Werte: ' $aSeparator['info'')';
  113. $aData['WORD_SEPARATOR_MSG''(Mögliche Werte: ' $aWordSeparator['info'')';
  114.  
  115. // mr file extension
  116. $aData['FILE_EXTENSION']       $aMrCfg['file_extension'];
  117. $aData['FILE_EXTENSION_ERROR''';
  118.  
  119. // mr category name resolve percentage
  120. $aData['CATEGORY_RESOLVE_MIN_PERCENTAGE']       $aMrCfg['category_resolve_min_percentage'];
  121. $aData['CATEGORY_RESOLVE_MIN_PERCENTAGE_ERROR''';
  122.  
  123. // mr add start article name to url
  124. $aData['ADD_STARTART_NAME_TO_URL_CHK']   ($aMrCfg['add_startart_name_to_url'== 1' checked="checked"' '';
  125. $aData['ADD_STARTART_NAME_TO_URL_ERROR''';
  126. $aData['DEFAULT_STARTART_NAME']          $aMrCfg['default_startart_name'];
  127.  
  128. // mr rewrite urls at
  129. $aData['REWRITE_URLS_AT_CONGENERATECODE_CHK']      ($aMrCfg['rewrite_urls_at_congeneratecode'== 1' checked="checked"' '';
  130. $aData['REWRITE_URLS_AT_FRONT_CONTENT_OUTPUT_CHK'($aMrCfg['rewrite_urls_at_front_content_output'== 1' checked="checked"' '';
  131. $aData['CONTENT.AFTER''';
  132.  
  133. // mr rewrite routing
  134. $data '';
  135. if (is_array($aMrCfg['routing'])) {
  136.     foreach ($aMrCfg['routing'as $uri => $route){
  137.         $data .= $uri $routingSeparator $route "\n";
  138.     }
  139. }
  140. $aData['REWRITE_ROUTING'$data;
  141.  
  142. // mr redirect invalid article
  143. $aData['REDIRECT_INVALID_ARTICLE_TO_ERRORSITE_CHK'($aMrCfg['redirect_invalid_article_to_errorsite'== 1' checked="checked"' '';
  144.  
  145.  
  146. ####################################################################################################
  147. ##### Action processing
  148.  
  149. if ($action == 'index'{
  150.  
  151.     _actionIndex();
  152.  
  153. elseif ($action == 'save'{
  154.  
  155.     _actionSave();
  156.  
  157. elseif ($action == 'reset'{
  158.  
  159.     _actionReset();
  160.  
  161. }
  162.  
  163.  
  164. // Loop data array, fill'n output template
  165. foreach ($aData as $p => $v{
  166.     $oTpl->set('s'$p$v);
  167. }
  168. $oTpl->generate(
  169.     $oGlob->get('cfg/path/contenido'$oGlob->get('cfg/path/plugins''mod_rewrite/templates/content.html'00
  170. );
  171.  
  172.  
  173. ####################################################################################################
  174. ##### Functions
  175.  
  176. function _actionIndex(){
  177.     // donut
  178. }
  179.  
  180.  
  181. function _actionSave(){
  182.  
  183.     $oGlob  mpGlobals::getInstance();
  184.     $cfg    $oGlob->get('cfg');
  185.     $aData  $oGlob->get('aData');
  186.  
  187.     $bError false;
  188.  
  189.     $request (count($_POST0$_POST $_GET;
  190.     mr_requestCleanup($request);
  191.  
  192.     // use mod_rewrite
  193.     if (mr_arrayValue($request'use'== 1{
  194.         $aData['USE_CHK'' checked="checked"';
  195.         $aMR['mod_rewrite']['use'1;
  196.     else {
  197.         $aData['USE_CHK''';
  198.         $aMR['mod_rewrite']['use'0;
  199.     }
  200.  
  201.     // root dir
  202.     if (mr_arrayValue($request'rootdir'''!== ''{
  203.         if (!preg_match('/^[a-zA-Z0-9\-_\/\.]*$/'$request['rootdir'])) {
  204.             $aData['ROOTDIR_ERROR'_notifyBox('error''Das Rootverzeichnis hat ein ungültiges Format, erlaubt sind die Zeichen [a-zA-Z0-9\-_\/\.]');
  205.             $bError true;
  206.         elseif (!is_dir($_SERVER['DOCUMENT_ROOT'$request['rootdir'])) {
  207.  
  208.             if (mr_arrayValue($request'checkrootdir'== 1{
  209.                 // root dir check is enabled, this results in error
  210.                 $aData['ROOTDIR_ERROR'_notifyBox('error''Das angegebene Verzeichnis "' $_SERVER['DOCUMENT_ROOT'$request['rootdir''" existiert nicht');
  211.                 $bError true;
  212.             else {
  213.                 // root dir check ist disabled, take over the setting and output a warning.
  214.                 $aData['ROOTDIR_ERROR'_notifyBox('warning''Das angegebene Verzeichnis "' $request['rootdir''" existiert nicht im aktuellen DOCUMENT_ROOT "' $_SERVER['DOCUMENT_ROOT''". Das kann vorkommen, wenn das DOCUMENT_ROOT des Clients vom Contenido Backend DOCUMENT_ROOT abweicht. Die Einstellung wird dennoch &uuml;bernommen, da die &Uuml;berpr&uuml;fung abgeschaltet wurde');
  215.             }
  216.         }
  217.         $aData['ROOTDIR']              htmlentities($request['rootdir']);
  218.         $aMR['mod_rewrite']['rootdir'$request['rootdir'];
  219.     }
  220.  
  221.     // root dir check
  222.     if (mr_arrayValue($request'checkrootdir'== 1{
  223.         $aData['CHECKROOTDIR_CHK'' checked="checked"';
  224.         $aMR['mod_rewrite']['checkrootdir'1;
  225.     else {
  226.         $aData['CHECKROOTDIR_CHK''';
  227.         $aMR['mod_rewrite']['checkrootdir'0;
  228.     }
  229.  
  230.     // start from root
  231.     if (mr_arrayValue($request'startfromroot'== 1{
  232.         $aData['STARTFROMROOT_CHK']          ' checked="checked"';
  233.         $aMR['mod_rewrite']['startfromroot'1;
  234.     else {
  235.         $aData['STARTFROMROOT_CHK''';
  236.         $aMR['mod_rewrite']['startfromroot'0;
  237.     }
  238.  
  239.     // prevent duplicated content
  240.     if (mr_arrayValue($request'prevent_duplicated_content'== 1{
  241.         $aData['PREVENT_DUPLICATED_CONTENT_CHK']          ' checked="checked"';
  242.         $aMR['mod_rewrite']['prevent_duplicated_content'1;
  243.     else {
  244.         $aData['PREVENT_DUPLICATED_CONTENT_CHK']         '';
  245.         $aMR['mod_rewrite']['prevent_duplicated_content'0;
  246.     }
  247.  
  248.     // language settings
  249.     if (mr_arrayValue($request'use_language'== 1{
  250.         $aData['USE_LANGUAGE_CHK']           ' checked="checked"';
  251.         $aData['USE_LANGUAGE_NAME_DISABLED''';
  252.         $aMR['mod_rewrite']['use_language']  1;
  253.         if (mr_arrayValue($request'use_language_name'== 1{
  254.             $aData['USE_LANGUAGE_NAME_CHK']          ' checked="checked"';
  255.             $aMR['mod_rewrite']['use_language_name'1;
  256.         else {
  257.             $aData['USE_LANGUAGE_NAME_CHK']          '';
  258.             $aMR['mod_rewrite']['use_language_name'0;
  259.         }
  260.     else {
  261.         $aData['USE_LANGUAGE_CHK']               '';
  262.         $aData['USE_LANGUAGE_NAME_DISABLED']     ' disabled="disabled"';
  263.         $aMR['mod_rewrite']['use_language']      0;
  264.         $aData['USE_LANGUAGE_NAME_CHK']          '';
  265.         $aMR['mod_rewrite']['use_language_name'0;
  266.     }
  267.  
  268.     // client settings
  269.     if (mr_arrayValue($request'use_client'== 1{
  270.         $aData['USE_CLIENT_CHK']           ' checked="checked"';
  271.         $aData['USE_CLIENT_NAME_DISABLED''';
  272.         $aMR['mod_rewrite']['use_client']  1;
  273.         if (mr_arrayValue($request'use_client_name'== 1{
  274.             $aData['USE_CLIENT_NAME_CHK']          ' checked="checked"';
  275.             $aMR['mod_rewrite']['use_client_name'1;
  276.         else {
  277.             $aData['USE_CLIENT_NAME_CHK']          '';
  278.             $aMR['mod_rewrite']['use_client_name'0;
  279.         }
  280.     else {
  281.         $aData['USE_CLIENT_CHK']               '';
  282.         $aData['USE_CLIENT_NAME_DISABLED']     ' disabled="disabled"';
  283.         $aMR['mod_rewrite']['use_client']      0;
  284.         $aData['USE_CLIENT_NAME_CHK']          '';
  285.         $aMR['mod_rewrite']['use_client_name'0;
  286.     }
  287.  
  288.     // use lowercase uri
  289.     if (mr_arrayValue($request'use_lowercase_uri'== 1{
  290.         $aData['USE_LOWERCASE_URI_CHK']          ' checked="checked"';
  291.         $aMR['mod_rewrite']['use_lowercase_uri'1;
  292.     else {
  293.         $aData['USE_LOWERCASE_URI_CHK']          '';
  294.         $aMR['mod_rewrite']['use_lowercase_uri'0;
  295.     }
  296.  
  297.     $aData['CATEGORY_SEPARATOR_ATTRIB']                '';
  298.     $aData['CATEGORY_WORD_SEPARATOR_ATTRIB']           '';
  299.     $aData['ARTICLE_SEPARATOR_ATTRIB']                 '';
  300.     $aData['ARTICLE_WORD_SEPARATOR_ATTRIB']            '';
  301.  
  302.     $separatorPattern $oGlob->get('aSeparator/pattern');
  303.     $separatorInfo    $oGlob->get('aSeparator/info');
  304.  
  305.     $wordSeparatorPattern $oGlob->get('aWordSeparator/pattern');
  306.     $wordSeparatorInfo    $oGlob->get('aWordSeparator/info');
  307.  
  308.     $categorySeperator mr_arrayValue($request'category_seperator''');
  309.     $categoryWordSeperator mr_arrayValue($request'category_word_seperator''');
  310.     $articleSeperator mr_arrayValue($request'article_seperator''');
  311.     $articleWordSeperator mr_arrayValue($request'article_word_seperator''');
  312.  
  313.     // category seperator
  314.     if ($categorySeperator == ''{
  315.         $aData['CATEGORY_SEPARATOR_ERROR'_notifyBox('error''Bitte Trenner (' $separatorInfo ') für Kategorie angeben');
  316.         $bError true;
  317.     elseif (!preg_match($separatorPattern$categorySeperator)) {
  318.         $aData['CATEGORY_SEPARATOR_ERROR'_notifyBox('error''Trenner für Kategorie ist ungültig, erlaubt ist eines der Zeichen: ' $separatorInfo);
  319.         $bError true;
  320.  
  321.     // category word seperator
  322.     elseif ($categoryWordSeperator == ''{
  323.         $aData['CATEGORY_WORD_SEPARATOR_ERROR'_notifyBox('error''Bitte Trenner (' $wordSeparatorInfo ') für Kategoriewörter angeben');
  324.         $bError true;
  325.     elseif (!preg_match($wordSeparatorPattern$categoryWordSeperator)) {
  326.         $aData['CATEGORY_WORD_SEPARATOR_ERROR'_notifyBox('error''Trenner für Kategoriewörter ist ungültig, erlaubt ist eines der Zeichen: ' $wordSeparatorInfo);
  327.         $bError true;
  328.  
  329.     // article seperator
  330.     elseif ($articleSeperator == ''{
  331.         $aData['ARTICLE_SEPARATOR_ERROR'_notifyBox('error''Bitte Trenner (' $separatorInfo ') für Artikel angeben''<br>';
  332.         $bError true;
  333.     elseif (!preg_match($separatorPattern$articleSeperator)) {
  334.         $aData['ARTICLE_SEPARATOR_ERROR'_notifyBox('error''Trenner für Artikel ist ungültig, erlaubt ist eines der Zeichen: ' $separatorInfo);
  335.         $bError true;
  336.  
  337.     // article word seperator
  338.     elseif ($articleWordSeperator == ''{
  339.         $aData['ARTICLE_WORD_SEPARATOR_ERROR'_notifyBox('error''Bitte Trenner (' $wordSeparatorInfo ') für Artikelwörter angeben');
  340.         $bError true;
  341.     elseif (!preg_match($wordSeparatorPattern$articleWordSeperator)) {
  342.         $aData['ARTICLE_WORD_SEPARATOR_ERROR'_notifyBox('error''Trenner für Artikelwörter ist ungültig, erlaubt ist eines der Zeichen: ' $wordSeparatorInfo);
  343.         $bError true;
  344.  
  345.     // category_seperator - category_word_seperator
  346.     elseif ($categorySeperator == $categoryWordSeperator{
  347.         $aData['CATEGORY_SEPARATOR_ERROR'_notifyBox('error''Trenner für Kategorie und Kategoriewörter dürfen nicht identisch sein');
  348.         $bError true;
  349.     // category_seperator - article_word_seperator
  350.     elseif ($categorySeperator == $articleWordSeperator{
  351.         $aData['CATEGORY_SEPARATOR_ERROR'_notifyBox('error''Trenner für Kategorie und Artikelwörter dürfen nicht identisch sein');
  352.         $bError true;
  353.     // article_seperator - article_word_seperator
  354.     elseif ($articleSeperator == $articleWordSeperator{
  355.         $aData['ARTICLE_SEPARATOR_ERROR'_notifyBox('error''Trenner für Kategorie-Artikel und Artikelwörter dürfen nicht identisch sein');
  356.         $bError true;
  357.     }
  358.  
  359.     $aData['CATEGORY_SEPARATOR']                   htmlentities($categorySeperator);
  360.     $aMR['mod_rewrite']['category_seperator']      $categorySeperator;
  361.     $aData['CATEGORY_WORD_SEPARATOR']              htmlentities($categoryWordSeperator);
  362.     $aMR['mod_rewrite']['category_word_seperator'$categoryWordSeperator;
  363.     $aData['ARTICLE_SEPARATOR']                    htmlentities($articleSeperator);
  364.     $aMR['mod_rewrite']['article_seperator']       $articleSeperator;
  365.     $aData['ARTICLE_WORD_SEPARATOR']               htmlentities($articleWordSeperator);
  366.     $aMR['mod_rewrite']['article_word_seperator']  $articleWordSeperator;
  367.  
  368.     // file extension
  369.     if (mr_arrayValue($request'file_extension'''!== ''{
  370.         if (!preg_match('/^\.([a-zA-Z0-9\-_\/])*$/'$request['file_extension'])) {
  371.             $aData['FILE_EXTENSION_ERROR'_notifyBox('error''Die Dateiendung hat ein ungültiges Format, erlaubt sind die Zeichen \.([a-zA-Z0-9\-_\/])');
  372.             $bError true;
  373.         }
  374.         $aData['FILE_EXTENSION'htmlentities($request['file_extension']);
  375.         $aMR['mod_rewrite']['file_extension'$request['file_extension'];
  376.     else {
  377.         $aData['FILE_EXTENSION''.html';
  378.         $aMR['mod_rewrite']['file_extension''.html';
  379.     }
  380.  
  381.     // category resolve min percentage
  382.     if (isset($request['category_resolve_min_percentage'])) {
  383.         if (!is_numeric($request['category_resolve_min_percentage'])) {
  384.             $aData['CATEGORY_RESOLVE_MIN_PERCENTAGE_ERROR'_notifyBox('error''Wert muss numerisch sein.');
  385.             $bError true;
  386.         elseif ($request['category_resolve_min_percentage'|| $request['category_resolve_min_percentage'100{
  387.             $aData['CATEGORY_RESOLVE_MIN_PERCENTAGE_ERROR'_notifyBox('error''Wert muss zwischen 0 und 100 sein.');
  388.             $bError true;
  389.         }
  390.         $aData['CATEGORY_RESOLVE_MIN_PERCENTAGE'$request['category_resolve_min_percentage'];
  391.         $aMR['mod_rewrite']['category_resolve_min_percentage'$request['category_resolve_min_percentage'];
  392.     else {
  393.         $aData['CATEGORY_RESOLVE_MIN_PERCENTAGE''75';
  394.         $aMR['mod_rewrite']['category_resolve_min_percentage''75';
  395.     }
  396.  
  397.     // add start article name to url
  398.     if (mr_arrayValue($request'add_startart_name_to_url'== 1{
  399.         $aData['ADD_STARTART_NAME_TO_URL_CHK']          ' checked="checked"';
  400.         $aMR['mod_rewrite']['add_startart_name_to_url'1;
  401.         if (mr_arrayValue($request'add_startart_name_to_url'''!== ''{
  402.             if (!preg_match('/^[a-zA-Z0-9\-_\/\.]*$/'$request['default_startart_name'])) {
  403.                 $aData['ADD_STARTART_NAME_TO_URL_ERROR'_notifyBox('error''Der Artikelname hat ein ungültiges Format, erlaubt sind die Zeichen /^[a-zA-Z0-9\-_\/\.]*$/');
  404.                 $bError true;
  405.             }
  406.             $aData['DEFAULT_STARTART_NAME']              htmlentities($request['default_startart_name']);
  407.             $aMR['mod_rewrite']['default_startart_name'$request['default_startart_name'];
  408.         else {
  409.             $aData['DEFAULT_STARTART_NAME']              '';
  410.             $aMR['mod_rewrite']['default_startart_name''';
  411.         }
  412.     else {
  413.         $aData['ADD_STARTART_NAME_TO_URL_CHK']          '';
  414.         $aMR['mod_rewrite']['add_startart_name_to_url'0;
  415.         $aData['DEFAULT_STARTART_NAME']                 '';
  416.         $aMR['mod_rewrite']['default_startart_name']    '';
  417.     }
  418.  
  419.     // rewrite urls at
  420.     if (mr_arrayValue($request'rewrite_urls_at'== 'congeneratecode'{
  421.         $aData['REWRITE_URLS_AT_CONGENERATECODE_CHK']               ' checked="checked"';
  422.         $aData['REWRITE_URLS_AT_FRONT_CONTENT_OUTPUT_CHK']          '';
  423.         $aMR['mod_rewrite']['rewrite_urls_at_congeneratecode']      1;
  424.         $aMR['mod_rewrite']['rewrite_urls_at_front_content_output'0;
  425.     else {
  426.         $aData['REWRITE_URLS_AT_CONGENERATECODE_CHK']               '';
  427.         $aData['REWRITE_URLS_AT_FRONT_CONTENT_OUTPUT_CHK']          ' checked="checked"';
  428.         $aMR['mod_rewrite']['rewrite_urls_at_congeneratecode']      0;
  429.         $aMR['mod_rewrite']['rewrite_urls_at_front_content_output'1;
  430.     }
  431.  
  432.     // routing
  433.     if (isset($request['rewrite_routing'])) {
  434.         $aRouting array();
  435.         $items explode("\n"$request['rewrite_routing']);
  436.         foreach ($items as $p => $v{
  437.             $routingDef explode($oGlob->get('routingSeparator')$v);
  438.             if (count($routingDef!== 2{
  439.                 continue;
  440.             }
  441.             $routingDef[0trim($routingDef[0]);
  442.             $routingDef[1trim($routingDef[1]);
  443.             if ($routingDef[0== ''{
  444.                 continue;
  445.             }
  446.             $aRouting[$routingDef[0]] $routingDef[1];
  447.         }
  448.         $aData['REWRITE_ROUTING']      htmlentities($request['rewrite_routing']);
  449.         $aMR['mod_rewrite']['routing'$aRouting;
  450.     else {
  451.         $aData['REWRITE_ROUTING']      '';
  452.         $aMR['mod_rewrite']['routing'array();
  453.     }
  454.  
  455.     // redirect invalid article to errorsite
  456.     if (isset($request['redirect_invalid_article_to_errorsite'])) {
  457.         $aData['REDIRECT_INVALID_ARTICLE_TO_ERRORSITE_CHK']          ' checked="checked"';
  458.         $aMR['mod_rewrite']['redirect_invalid_article_to_errorsite'1;
  459.     else {
  460.         $aData['REDIRECT_INVALID_ARTICLE_TO_ERRORSITE_CHK']          '';
  461.         $aMR['mod_rewrite']['redirect_invalid_article_to_errorsite'0;
  462.     }
  463.  
  464.     if ($bError{
  465.         $aData['CONTENT.BEFORE'_notifyBox('error''Bitte überprüfen Sie ihre Eingaben');
  466.         $oGlob->set('aData'$aData);
  467.         return;
  468.     }
  469.  
  470.     if ($oGlob->get('debug'== true{
  471.         echo _notifyBox('info''Debug');
  472.         echo '<pre class="example">';print_r($aMR['mod_rewrite']);echo '</pre>';
  473.         echo _notifyBox('info''Konfiguration wurde <b>nicht</b> gespeichert, weil debugging aktiv ist');
  474.         return;
  475.     }
  476.  
  477.     $bSeparatorModified _separatorModified($aMR['mod_rewrite']);
  478.  
  479.     $options['key'$cfg['path']['contenido'$cfg['path']['plugins''mod_rewrite/includes/config.mod_rewrite_' $oGlob->get('client''.php';
  480.  
  481.     $config ConfigFactory::get('filestorage'$options);
  482.  
  483.     if ($config->set($aMR)) {
  484.         $sMsg 'Konfiguration wurde gespeichert';
  485.         if ($bSeparatorModified{
  486.             mr_loadConfiguration($oGlob->get('client')true);
  487.         }
  488.         $aData['CONTENT.BEFORE'_notifyBox('info'$sMsg);
  489.     else {
  490.         $aData['CONTENT.BEFORE'_notifyBox('error''Konfiguration konnte nicht gespeichert werden. Überprüfen Sie bitte die Schreibrechte für ' $options['key']);
  491.     }
  492.  
  493.     $oGlob->set('aData'$aData);
  494. }
  495.  
  496.  
  497. function _actionReset(){
  498.     $oGlob mpGlobals::getInstance();
  499.     $oGlob->set('aData/CONTENT.BEFORE'_notifyBox('info''Aliase wurden zurückgesetzt'));
  500. }
  501.  
  502.  
  503. function _separatorModified(&$aNewCfg){
  504.     $aCfg ModRewrite::getConfig();
  505.  
  506.     if ($aCfg['category_seperator'!= $aNewCfg['category_seperator']{
  507.         return true;
  508.     elseif ($aCfg['category_word_seperator'!= $aNewCfg['category_word_seperator']{
  509.         return true;
  510.     elseif ($aCfg['article_seperator'!= $aNewCfg['article_seperator']{
  511.         return true;
  512.     elseif ($aCfg['article_word_seperator'!= $aNewCfg['article_word_seperator']{
  513.         return true;
  514.     }
  515.     return false;
  516. }
  517.  
  518.  
  519. function _notifyBox($type$msg{
  520.     $oNotification mpGlobals::getInstance()->get('notification');
  521.     return $oNotification->returnNotification($type$msg'<br>';
  522. }

Documentation generated on Sun, 08 Feb 2009 22:01:02 +0100 by phpDocumentor 1.4.1