• Main Page
  • Related Pages
  • Classes
  • Files
  • Directories
  • File List
  • File Members

index.php

Go to the documentation of this file.
00001 <?php
00002 
00003 // Setting error reporting mode
00004     error_reporting( E_ALL ^ E_NOTICE );
00005 
00006 //Know exactly where in the code the event occurred.
00007 //Zend platform only.
00008 if (function_exists('monitor_set_aggregation_hint') && isset($_REQUEST['cl'])) {
00009     $sAgregationHint = htmlentities($_REQUEST['cl'], ENT_QUOTES, 'UTF-8') . '/';
00010     if (isset($_REQUEST['fnc']))
00011         $sAgregationHint .= htmlentities($_REQUEST['fnc'], ENT_QUOTES, 'UTF-8');
00012     monitor_set_aggregation_hint($sAgregationHint);
00013 }
00014 
00015 
00016 //setting basic configuration parameters
00017 ini_set('session.name', 'sid' );
00018 ini_set('session.use_cookies', 0 );
00019 ini_set('session.use_trans_sid', 0);
00020 ini_set('url_rewriter.tags', '');
00021 ini_set('magic_quotes_runtime', 0);
00022 
00028 function getShopBasePath()
00029 {
00030     return dirname(__FILE__).'/';
00031 }
00032 
00033 
00034 if ( !function_exists( 'isAdmin' )) {
00040     function isAdmin()
00041     {
00042         return false;
00043     }
00044 }
00045 
00046 // custom functions file
00047 require getShopBasePath() . 'modules/functions.php';
00048 
00049 // Generic utility method file
00050 require_once getShopBasePath() . 'core/oxfunctions.php';
00051 
00052 
00053 // set the exception handler already here to catch everything, also uncaught exceptions from the config or utils
00054 
00055 // initializes singleton config class
00056 $myConfig = oxConfig::getInstance();
00057 
00058 // reset it so it is done with oxnew
00059 $iDebug = $myConfig->getConfigParam('iDebug');
00060 set_exception_handler(array(oxNew('oxexceptionhandler', $iDebug), 'handleUncaughtException'));
00061 // Admin handling
00062 if ( isAdmin() ) {
00063     $myConfig->setConfigParam( 'blAdmin', true );
00064     $myConfig->setConfigParam( 'blTemplateCaching', false );
00065     if ($sAdminDir)
00066         $myConfig->setConfigParam( 'sAdminDir', $sAdminDir );
00067     else
00068         $myConfig->setConfigParam( 'sAdminDir', "admin" );
00069 }
00070 
00071 //Invoked over search engine URLs
00072 if (isSearchEngineUrl()) {
00073     oxNew('oxSeoDecoder')->processSeoCall();
00074 }
00075 
00076 //Starting the shop
00077 $oShopControl = oxNew('oxShopControl');
00078 
00079 startProfile('start');
00080 $oShopControl->start();
00081 stopProfile('start');
00082 
00083 
00084 //DEBUG INFO
00085 if (!isAdmin() && $iDebug) {
00086     echo  "cl=".oxConfig::getInstance()->getActiveView()->getClassName();
00087     if ($sFnc = oxConfig::getInstance()->getActiveView()->getFncName())
00088         echo " fnc=$sFnc";
00089 
00090     echo "<br>\n";
00091 }
00092 
00093 
00094 if (!isAdmin() && $iDebug && is_array($aProfileTimes)) {
00095     echo "----------------------------------------------------------<br>".PHP_EOL;
00096     $iTotalTime = $oShopControl->getTotalTime();
00097     arsort($aProfileTimes);
00098     echo "<table cellspacing='10px' style='border: 1px solid #000'>";
00099     foreach ($aProfileTimes as $sKey => $sVal) {
00100         echo "<tr><td style='border-bottom: 1px dotted #000;min-width:300px;'>Profile $sKey: </td><td style='border-bottom: 1px dotted #000;min-width:100px;'>" . round($sVal, 5) ."s</td>" ;
00101         if ($iTotalTime) {
00102             echo "<td style='border-bottom: 1px dotted #000;min-width:100px;'>".round($sVal*100/$iTotalTime, 2)."%</td>";
00103         }
00104         if ($aExecutionCounts[$sKey]) {
00105             echo " <td style='border-bottom: 1px dotted #000;min-width:50px;padding-right:30px;' align='right'>" . $aExecutionCounts[$sKey] .  "</td>"
00106                  ."<td style='border-bottom: 1px dotted #000;min-width:15px; '>*</td>"
00107                  ."<td style='border-bottom: 1px dotted #000;min-width:100px;'>" . round($sVal / $aExecutionCounts[$sKey], 5) . "s</td></tr>" . PHP_EOL;
00108         } else {
00109             echo " <td colspan=3 style='border-bottom: 1px dotted #000;min-width:100px;'> not stopped correctly! </td></tr>" . PHP_EOL;
00110         }
00111     }
00112     echo "</table>";
00113 }
00114 
00115 if (!isAdmin() && ($iDebug == 7)) {
00116     echo "----------------------------------------------------------<br>".PHP_EOL;
00117     echo "-- oxdebugdb --<br>".PHP_EOL;
00118     $oDbgDb = oxNew('oxdebugdb');
00119     $aWarnings = $oDbgDb->getWarnings();
00120     $iNr = 1;
00121     foreach ($aWarnings as $w) {
00122         echo "{$w['check']}: {$w['time']} - <span style='color:#900000;margin:5px'>".htmlentities($w['sql'], ENT_QUOTES, 'UTF-8')."</span>";
00123         echo "<div id='dbgdb_trace_$iNr' style='display:none'>".nl2br($w['trace'])."</div>";
00124         echo "<a style='color:#00AA00;margin:5px;cursor:pointer' onclick='var el=document.getElementById(\"dbgdb_trace_$iNr\"); if (el.style.display==\"block\")el.style.display=\"none\"; else el.style.display = \"block\";'>TRACE (show/hide)</a><br><br>";
00125         ++$iNr;
00126     }
00127 }
00128 
00129 if (!isAdmin() && ($iDebug == 2 || $iDebug == 3 || $iDebug == 4)) {
00130             $oPerfMonitor = @NewPerfMonitor( oxDb::getDb() );
00131             if ( $oPerfMonitor )
00132                 $oPerfMonitor->UI( 5 );
00133 }

Generated by  doxygen 1.7.1