00001 <?php
00002
00003
00004 error_reporting( E_ALL ^ E_NOTICE );
00005
00006
00007
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
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
00038 if ( !function_exists( 'isAdmin' )) {
00039 function isAdmin()
00040 {
00041 return false;
00042 }
00043 }
00044
00045
00046 include getShopBasePath() . 'modules/functions.php';
00047
00048
00049 require_once getShopBasePath() . 'core/oxfunctions.php';
00050
00051
00052
00053 require_once getShopBasePath() . 'core/adodblite/adodb.inc.php';
00054
00055
00056
00057 $myConfig = oxConfig::getInstance();
00058
00059
00060 $iDebug = $myConfig->getConfigParam('iDebug');
00061 set_exception_handler(array(oxNew('oxexceptionhandler', $iDebug), 'handleUncaughtException'));
00062
00063 if ( isAdmin() ) {
00064 $myConfig->setConfigParam( 'blAdmin', true );
00065 $myConfig->setConfigParam( 'blTemplateCaching', false );
00066 if ($sAdminDir)
00067 $myConfig->setConfigParam( 'sAdminDir', $sAdminDir );
00068 else
00069 $myConfig->setConfigParam( 'sAdminDir', "admin" );
00070 }
00071
00072
00073 if (isSearchEngineUrl()) {
00074 oxNew('oxSeoDecoder')->processSeoCall();
00075 }
00076
00077
00078 oxUtils::getInstance()->stripGpcMagicQuotes();
00079
00080 $oShopControl = oxNew('oxShopControl');
00081
00082 startProfile('start');
00083 $oShopControl->start();
00084 stopProfile('start');
00085
00086
00087
00088 if (!isAdmin() && $iDebug) {
00089 echo "cl=".oxConfig::getInstance()->getActiveView()->getClassName();
00090 if ($sFnc = oxConfig::getInstance()->getActiveView()->getFncName())
00091 echo " fnc=$sFnc";
00092
00093 echo "<br>\n";
00094 }
00095
00096
00097 if (!isAdmin() && $iDebug && is_array($aProfileTimes)) {
00098 echo "----------------------------------------------------------<br>".PHP_EOL;
00099 $iTotalTime = $oShopControl->dTimeEnd - $oShopControl->dTimeStart;
00100 arsort($aProfileTimes);
00101 echo "<table cellspacing='10px' style='border: 1px solid #000'>";
00102 foreach ($aProfileTimes as $sKey => $sVal)
00103 {
00104 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>" ;
00105 if ($iTotalTime) {
00106 echo "<td style='border-bottom: 1px dotted #000;min-width:100px;'>".round($sVal*100/$iTotalTime, 2)."%</td>";
00107 }
00108 if ($aExecutionCounts[$sKey]) {
00109 echo " <td style='border-bottom: 1px dotted #000;min-width:50px;padding-right:30px;' align='right'>" . $aExecutionCounts[$sKey] . "</td>"
00110 ."<td style='border-bottom: 1px dotted #000;min-width:15px; '>*</td>"
00111 ."<td style='border-bottom: 1px dotted #000;min-width:100px;'>" . round($sVal / $aExecutionCounts[$sKey], 5) . "s</td></tr>" . PHP_EOL;
00112 } else {
00113 echo " <td colspan=3 style='border-bottom: 1px dotted #000;min-width:100px;'> not stopped correctly! </td></tr>" . PHP_EOL;
00114 }
00115 }
00116 echo "</table>";
00117 }
00118
00119 if (!isAdmin() && ($iDebug == 7))
00120 {
00121 echo "----------------------------------------------------------<br>".PHP_EOL;
00122 echo "-- oxdebugdb --<br>".PHP_EOL;
00123 $oDbgDb = oxNew('oxdebugdb');
00124 $aWarnings = $oDbgDb->getWarnings();
00125 $_iNr = 1;
00126 foreach ($aWarnings as $w)
00127 {
00128 echo "{$w['check']}: {$w['time']} - <span style='color:#900000;margin:5px'>".htmlentities($w['sql'], ENT_QUOTES, 'UTF-8')."</span>";
00129 echo "<div id='dbgdb_trace_$_iNr' style='display:none'>".nl2br($w['trace'])."</div>";
00130 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>";
00131 ++$_iNr;
00132 }
00133 }
00134
00135 if (!isAdmin() && ($iDebug == 2 || $iDebug == 3 || $iDebug == 4)) {
00136 $oPerfMonitor = @NewPerfMonitor( oxDb::getDb() );
00137 if ( $oPerfMonitor )
00138 $oPerfMonitor->UI( 5 );
00139 }