Source for file index_controller.php

Documentation is available at index_controller.php

  1. <?php
  2.  
  3. /**
  4.  * Index controller. Does some preprocessing jobs, tries to set following variables, depending
  5.  * on mod rewrite configuration and if request part exists:
  6.  * - $client
  7.  * - $changeclient
  8.  * - $lang
  9.  * - $changelang
  10.  * - $idart
  11.  * - $idcat
  12.  *
  13.  * @author      Murat Purc <murat@purc.de>
  14.  * @copyright   © Murat Purc 2008
  15.  * @package     Contenido
  16.  * @subpackage  ModRewrite
  17.  */
  18.  
  19.  
  20. if (!defined("CON_FRAMEWORK")) {
  21.     define("CON_FRAMEWORK"true);
  22. }
  23.  
  24. // include security class and check request variables
  25. include_once ('../contenido/classes/class.security.php');
  26. Contenido_Security::checkRequests();
  27.  
  28. // include the config file of the frontend to init the Client and Language Id
  29. include_once('config.php');
  30. // Contenido startup process
  31. include_once($contenido_path.'includes/startup.php');
  32.  
  33. $ModRewriteStartTime getmicrotime();
  34.  
  35. cInclude('includes''functions.con.php');
  36. cInclude('includes''functions.con2.php');
  37. cInclude('includes''functions.api.php');
  38. cInclude('includes''functions.pathresolver.php');
  39.  
  40. plugin_include('mod_rewrite''includes/config.plugin.php');
  41.  
  42. $GLOBALS['mpDebug']->addDebug($cfg['mod_rewrite']'index_controller.php mod rewrite config');
  43.  
  44. if (ModRewrite::is_enabled(== false{
  45.     // mod rewrite is disabled, include front_content.php and get out from here
  46.     include_once('front_content.php');
  47.     _mr_debugOutput();
  48.     return;
  49. }
  50.  
  51. #$GLOBALS['mpDebug']->addDebug($_SERVER['REQUEST_URI'], 'index_controller.php $_SERVER["REQUEST_URI"]');
  52.  
  53. // create an mod rewrite controller instance and execute processing
  54. $oMRController new ModRewriteController($_SERVER['REQUEST_URI']);
  55. $oMRController->execute();
  56.  
  57. if ($oMRController->errorOccured()) {
  58.  
  59.     // an error occured (idcat and or idart couldn't catched by controller)
  60.     $mr_preprocessedPageError true;
  61.  
  62. else {
  63.  
  64.     // set some global variables
  65.  
  66.     if ($oMRController->getClient()) {
  67.         $client $oMRController->getClient();
  68.     }
  69.  
  70.     if ($oMRController->getChangeClient()) {
  71.         $changeclient $oMRController->getChangeClient();
  72.     }
  73.  
  74.     if ($oMRController->getLang()) {
  75.         $lang $oMRController->getLang();
  76.     }
  77.  
  78.     if ($oMRController->getChangeLang()) {
  79.         $changelang $oMRController->getChangeLang();
  80.     }
  81.  
  82.     if ($oMRController->getIdArt()) {
  83.         $idart $oMRController->getIdArt();
  84.     }
  85.  
  86.     if ($oMRController->getIdCat()) {
  87.         $idcat $oMRController->getIdCat();
  88.     }
  89.  
  90.     if ($oMRController->getPath()) {
  91.         $path $oMRController->getPath();
  92.     }
  93.  
  94. }
  95.  
  96. // some debugs
  97. $GLOBALS['mpDebug']->addDebug($mr_preprocessedPageError'mr $mr_preprocessedPageError'__FILE__);
  98. $GLOBALS['mpDebug']->addDebug($idart'mr $idart'__FILE__);
  99. $GLOBALS['mpDebug']->addDebug($idcat'mr $idcat'__FILE__);
  100. $GLOBALS['mpDebug']->addDebug($lang'mr $lang'__FILE__);
  101. $GLOBALS['mpDebug']->addDebug($client'mr $client'__FILE__);
  102.  
  103.  
  104. /**
  105.  * Loading of Mod Rewrite plugin well done, include front_content.php
  106.  */
  107. include_once('front_content.php');
  108.  
  109.  
  110. /**
  111.  * Display debug toolbar.
  112.  *
  113.  * NOTE:
  114.  * used during development, comment following line if you want to play save
  115.  * and no debug info should be displayed
  116.  */
  117. _mr_debugOutput()//{%DEPLOY_MR_DEBUGOUTPUT%}
  118.  
  119.  
  120. ##########################################################################################
  121.  
  122. /**
  123.  * Replaces calling of header method for redirects in front_content.php,
  124.  * used during development.
  125.  *
  126.  * @param  $header  Header value for redirect
  127.  */
  128. function mr_header($header{
  129. #    header($header);return;
  130.  
  131.     $header str_replace('Location: '''$header);
  132.     echo '<html>
  133.         <head></head>
  134.         <body>
  135.         <p><a href="'.$header.'">'.$header.'</a></p>';
  136.     _mr_debugOutput();
  137.     echo '</body></html>';
  138.     exit();
  139. }
  140.  
  141. /**
  142.  * Debug output only during development
  143.  */
  144. function _mr_debugOutput({
  145.     if (is_array($GLOBALS['DB_Contenido_QueryCache']&& count($GLOBALS['DB_Contenido_QueryCache']0{
  146.         $GLOBALS['mpDebug']->addDebug($GLOBALS['DB_Contenido_QueryCache']'sql statements');
  147.     }
  148.     $time sprintf('%.4f'(getmicrotime($GLOBALS['ModRewriteStartTime']));
  149.        $GLOBALS['mpDebug']->addDebug($time'index_controller.php total time');
  150.     echo $GLOBALS['mpDebug']->getResults();
  151. }

Documentation generated on Tue, 12 Aug 2008 00:06:43 +0200 by phpDocumentor 1.4.0