/** * Execute query and return all rows * * @access public * @param string $sql * @return array * @throws DBQueryError */ static function executeAll($sql) { $arguments = func_get_args(); array_shift($arguments); $arguments = count($arguments) ? array_flat($arguments) : null; try { $start = microtime(true); $result = self::connection()->executeAll($sql, $arguments); $end = microtime(true); if (Env::isDebuggingDB()) { Logger::log(number_format($end - $start, 4) . " - " . DB::prepareString($sql, $arguments)); } if (Env::isDebuggingTime()) { TimeIt::add("DB", $end - $start, $start, $end); } } catch (Exception $e) { Logger::log("SQL ERROR: " . $e->getMessage() . " - " . DB::prepareString($sql, $arguments)); throw $e; } return $result; }
} // if // Remove injection from url parameters foreach ($_GET as $k => &$v) { $v = remove_css_and_scripts($v); } // Get controller and action and execute... try { if (!defined('CONSOLE_MODE')) { Env::executeAction(request_controller(), request_action()); } } catch (Exception $e) { if (Env::isDebugging()) { Logger::log($e, Logger::FATAL); Env::dumpError($e); } else { Logger::log($e, Logger::FATAL); redirect_to(get_url('error', 'execute_action')); } // if } // try if (Env::isDebuggingTime()) { TimeIt::stop(); if (array_var($_REQUEST, 'a') != 'popup_reminders') { Env::useHelper('format'); $report = TimeIt::getTimeReportByType(); $report .= "\nMemory Usage: " . format_filesize(memory_get_usage(true)); file_put_contents('cache/log.time', "Request: " . print_r($_REQUEST, 1) . "\nTime Report:\n------------\n{$report}\n--------------------------------------\n", FILE_APPEND); } }