<?php /** * The web gui initiation script. * @package zpanelx * @subpackage core * @author Bobby Allen (ballen@bobbyallen.me) * @copyright ZPanel Project (http://www.zpanelcp.com/) * @link http://www.zpanelcp.com/ * @license GPL (http://www.gnu.org/licenses/gpl.html) */ global $controller, $zdbh, $zlo; $controller = new runtime_controller(); $zlo->method = ctrl_options::GetSystemOption('logmode'); if ($zlo->hasInfo()) { $zlo->writeLog(); $zlo->reset(); } if (isset($_GET['logout'])) { ctrl_auth::KillSession(); ctrl_auth::KillCookies(); header("location: ./?loggedout"); exit; } if (isset($_GET['returnsession'])) { if (isset($_SESSION['ruid'])) { ctrl_auth::SetUserSession($_SESSION['ruid'], runtime_sessionsecurity::getSessionSecurityEnabled()); $_SESSION['ruid'] = null; } header("location: ./"); exit;
ctrl_options::SetSystemOption('daemon_hourrun', time()); runtime_hook::Execute("OnStartDaemonHour"); runtime_hook::Execute("OnDaemonHour"); runtime_hook::Execute("OnEndDaemonHour"); } if (time() >= ctrl_options::GetSystemOption('daemon_dayrun') + 24 * 3600) { ctrl_options::SetSystemOption('daemon_dayrun', time()); runtime_hook::Execute("OnStartDaemonDay"); runtime_hook::Execute("OnDaemonDay"); runtime_hook::Execute("OnEndDaemonDay"); } if (time() >= ctrl_options::GetSystemOption('daemon_weekrun') + 7 * 24 * 3600) { ctrl_options::SetSystemOption('daemon_weekrun', time()); runtime_hook::Execute("OnStartDaemonWeek"); runtime_hook::Execute("OnDaemonWeek"); runtime_hook::Execute("OnEndDaemonWeek"); } if (time() >= ctrl_options::GetSystemOption('daemon_monthrun') + 30 * 24 * 3600) { ctrl_options::SetSystemOption('daemon_monthrun', time()); runtime_hook::Execute("OnStartDaemonMonth"); runtime_hook::Execute("OnDaemonMonth"); runtime_hook::Execute("OnEndDaemonMonth"); } echo "\nDaemon run complete! (" . date($dateformat) . ")\n"; ctrl_options::SetSystemOption('daemon_lastrun', time()); $daemonLog->detail = "Daemon execution completed!"; $daemonLog->writeLog(); if (!runtime_controller::IsCLI()) { echo "</pre>"; } exit;
/** * * @param String $query * @param Array $driver_options * @return type */ public function prepare($query, $driver_options = array()) { try { $result = parent::prepare($query, $driver_options); $this->queriesExecuted[] = $query; return $result; } catch (PDOException $e) { $errormessage = $this->errorInfo(); $clean = $this->cleanexpmessage($e); if (!runtime_controller::IsCLI()) { $error_html = $this->css . "<div class=\"dbwarning\"><strong>Critical Error:</strong> [0144] - Sentora database 'prepare' error (" . $this->errorCode() . ").<p>A database query has caused an error, the details of which can be found below.</p><p><strong>Error message:</strong></p><pre> " . $errormessage[2] . "</pre><p><strong>SQL Executed:</strong></p><pre>" . $query . "</pre><p><strong>Stack trace: </strong></p><pre>" . $clean . "</pre></div>"; } else { $error_html = "SQL Error: " . $errormessage[2] . "\n"; } die($error_html); } }