public static function SQLInstance() { if (self::$sqlInstance) { return self::$sqlInstance; } // already instantiated $params = null; // server, user, password etc. if (OESQLBase::isLocalSQLite()) { $params = $GLOBALS['oeLoginSQLite_LocalWebServer']; } else { if (OESQLBase::isLocalDB()) { $params = $GLOBALS['oeDBConnectionLocalAMP']; } else { $params = $GLOBALS['oeDBConnectionOnline']; } } $type = $params && !isset($params['not_set']) && isset($params['engine']) ? $params['engine'] : 'MySQL'; echo ' = = Connecting to ' . $type . '<br>'; switch ($type) { case 'SQLite': self::$sqlInstance = new OESQLite($params); break; default: self::$sqlInstance = new OEMySQL($params); break; } //var_dump(self::$sqlInstance); return self::$sqlInstance; }
function __final() { // mostly debug output global $a_tm, $tm_start_all, $oeScriptStartTime, $oephpOutputToBuffer, $oephpDebugMode, $oephpDebugModeShowExpanded, $dynManager, $oeLoginSQLite_LocalWebServer, $oeHeaderInlineCode, $oeStartBodyInlineCode; // show time performance: $a_tm['====ALL'] = round((microtime(true) - $tm_start_all) * 1000); foreach ($a_tm as $key => $value) { $a_tm[$key] = round($a_tm[$key]); } echo '<span style="font-size:7px;">'; var_dump($a_tm); echo '</span>'; // add security token - hidden form element $pageSerial = $dynManager->GetDataByFullID('AutoVals.PageID', 0); OEDynUtils::AddHiddenSecurityToken($oeStartBodyInlineCode, $pageSerial); $oeStartBodyInlineCode .= "\n"; $oeDBAdminToolCode = ''; // Link to db editor - only in local mode: if (OESQLBase::isLocalSQLite() && isset($dynManager->JSData['PageRelPath'])) { $paregelpath = $dynManager->JSData['PageRelPath']; $dbadminerlink = $paregelpath . 'WEFiles/Server/DB/dbadmin/phpliteadmin.php'; // sqlite administrator $oeDBAdminToolCode = "DB admin tool (for local test DB only!): <a href='{$dbadminerlink}?db=../../../{$oeLoginSQLite_LocalWebServer['dbname']}' target='_blanc'>PHPLiteAdmin</a><br/>"; echo '<br/>' . $oeDBAdminToolCode; } $oeMailEmulationCode = OEDynUtils::DebugMailEmulation(); if ($oeMailEmulationCode) { echo $oeMailEmulationCode; } echo '</div>'; if ($oephpOutputToBuffer || !$oephpDebugMode) { $oephpDebugBuff = ''; if ($oephpDebugMode) { // debug mode - keep all output $oephpDebugBuff = ob_get_contents(); } else { if (OESQLBase::isLocalSQLite()) { // local previsualisation mode - keep only tool output if ($oeDBAdminToolCode) { $oephpDebugBuff .= '<div id="oephpDebugDiv">' . $oeDBAdminToolCode . '</div>'; } if ($oeMailEmulationCode) { $oephpDebugBuff .= $oeMailEmulationCode; } } } if ($oephpDebugBuff) { $oeStartBodyInlineCode = !isset($oeStartBodyInlineCode) ? $oephpDebugBuff : $oeStartBodyInlineCode . $oephpDebugBuff; $oeDebugJSCode = ''; $oeDebugJSCode .= "<script> \$(document).ready(function() { \n"; // style='text-decoration:blink;-webkit-animation: blink 1s steps(5, start) infinite;' if ($oeMailEmulationCode) { $oeDebugJSCode .= <<<HDEND \t\t\t\t\t\$('body').prepend("<div id='oephpMailEmulationClick' style='cursor:pointer;background-color:#D0E8FF;color:black;font-size:12px;position:absolute;z-index:10000000;top:16px;width:100%;'>Local Debug (dbl-click to expand): <b>Mailbox (Boite Mail)</b> <b>emulation</b></div>"); \t\t\t\t\t\$('#oephpMailEmulationClick').prepend(\$('#oeDebugMailEmulation')); \t\t\t\t\t\$('#oephpMailEmulationClick').dblclick(function(){ \$('#oeDebugMailEmulation').toggle(); }); \t\t\t\t\t\$('#oeDebugMailEmulation').hide(); HDEND; } $oeScriptTime = round((microtime(true) - $oeScriptStartTime) * 1000); $oeScriptTime = $a_tm['require All DynEngine'] . '+' . ($oeScriptTime - $a_tm['require All DynEngine']) . '=' . $oeScriptTime; $oeDebugJSCode .= <<<HDEND \t\t\t\t\t\$('body').prepend("<div id='oephpDebugClick' style='cursor:pointer;background-color:#F0F0F0;color:black;font-size:12px;position:absolute;z-index:10000001;top:0px;width:100%'>Local Debug (dbl-click to expand): <b style='text-decoration:none;'>PHP + DB</b> <i>(script load+run time: <b>{$oeScriptTime}</b>ms)</i></div>"); \t\t\t\t\t\$('#oephpDebugClick').prepend(\$('#oephpDebugDiv')); \t\t\t\t\t\$('#oephpDebugClick').dblclick(function(){ \$('#oephpDebugDiv').toggle(); }); \t\t\t\t\t\$('#oephpDebugClick').fadeTo('slow', 0.25).fadeTo('slow', 1.0); \t\t\t\t\t\$('#oephpMailEmulationClick').fadeTo('slow', 0.25).fadeTo('slow', 1.0); HDEND; if (!$oephpDebugModeShowExpanded) { $oeDebugJSCode .= "\n \$('#oephpDebugDiv').hide(); \n"; } $oeDebugJSCode .= "\n});</script>"; $oeHeaderInlineCode = !isset($oeHeaderInlineCode) ? $oeDebugJSCode : $oeDebugJSCode . $oeHeaderInlineCode; } ob_end_clean(); // clear all php output } }