/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-database/lib/Skeleton/Database/Driver/Mysqli/Proxy.php
public function connect() {
mysqli_report(MYSQLI_REPORT_OFF);
$settings = parse_url($this->dsn);
// If we can't even parse the DSN, don't bother
if (!isset($settings['path']) OR !isset($settings['host']) OR !isset($settings['user'])) {
throw new \Exception('Could not connect to database: DSN incorrect');
}
// We don't support connecting to UNIX sockets the traditional way
if ($settings['host'] == 'unix(') {
throw new \Exception('Could not connect to database: UNIX socket syntax is wrong');
}
$settings['path'] = substr($settings['path'], 1);
$this->database = @new \Mysqli($settings['host'], $settings['user'], $settings['pass'], $settings['path']);
// If there is an error connecting to the database, stop doing what you're doing
if ($this->database->connect_errno != 0) {
throw new \Exception('Could not connect to database: ' . $this->database->connect_error);
}
$this->database->set_charset('utf8');
$this->connected = true;
}
/**
* Get the DBMS we are currently connected to
*
* @access public
* @return string $database_type
*/
public function get_dbms() {
return 'mysql';
}
/**
* Filter fields to insert/update table
*
* @access public
Arguments
"Could not connect to database: ProxySQL Error: Access denied for user 'chronorace'@'10.10.11.95' (using password: YES)"
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-database/lib/Skeleton/Database/Driver/Mysqli/Proxy.php
if (!$this->connected) {
$this->connect();
}
return $this->database->real_escape_string($values);
}
}
/**
* Get the prepared statement for a query and its parameters
*
* @access private
* @param string $query The query to prepare a statement for
* @param array $params Optional parameters to replace in the query
* @return Database_Statement $statement
* @throws Exception Throws an Exception when an unknown type is provided
*/
private function get_statement($query, $params = []) {
if (!$this->connected) {
$this->connect();
}
if (\Skeleton\Database\Config::$query_log) {
$query_log = [$query, $params];
$this->query_log[] = $query_log;
}
if (\Skeleton\Database\Config::$query_counter) {
$this->query_counter++;
}
$statement = new Statement($this->database, $query);
if (count($params) == 0) {
return $statement;
}
$refs = [];
$types = '';
foreach ($params as $key => $param) {
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-database/lib/Skeleton/Database/Driver/Mysqli/Proxy.php
$query .= $this->quote_identifier($key) . '= ?';
$first = false;
}
$query .= ' WHERE ' . $where;
$statement = $this->get_statement($query, $params);
$statement->execute();
}
/**
* Get the resultset with a single row for a query
*
* @access public
* @param string $query The query to execute
* @param array $params Optional parameters to replace in the query
* @throws Exception Throws an Exception when the resultset contains more than one row or column
*/
public function get_one($query, $params = []) {
$statement = $this->get_statement($query, $params);
$statement->execute();
$result = $statement->fetch_assoc();
if (count($result) == 0) {
return null;
}
if (count($result) > 1) {
throw new \Exception('Result of get_one should only contain 1 row');
}
$row = array_shift($result);
if (count($row) != 1) {
throw new \Exception('Result of get_one should only contain 1 column');
}
return array_shift($row);
}
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-i18n/lib/Skeleton/I18n/Language.php
*/
private static $language = null;
/**
* Get by name_short
*
* @access public
* @return Language
* @param string $name_short
*/
public static function get_by_name_short($name) {
if (self::trait_cache_enabled()) {
try {
$object = self::cache_get(get_class() . '_' . $name);
return $object;
} catch (\Exception $e) {}
}
$db = self::trait_get_database();
$id = $db->get_one('SELECT id FROM language WHERE name_short=?', [$name]);
if ($id === null) {
throw new \Exception('No such language');
}
$classname = Config::$language_interface;
return $classname::get_by_id($id);
}
/**
* Detect the language based on the HTTP_ACCEPT_LANGUAGE header
*
* @access public
* @return LanguageInterface $language
*/
public static function detect() {
if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
throw new \Exception('Language cannot be detected, no HTTP_ACCEPT_LANGUAGE header set');
}
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
$application_path = realpath(Config::$application_dir . '/' . $this->name);
if (!file_exists($application_path)) {
throw new \Exception('Application with name "' . $this->name . '" not found');
}
$this->path = $application_path;
$this->load_config();
$this->media_path = $application_path . '/media/';
$this->module_path = $application_path . '/module/';
$this->template_path = $application_path . '/template/';
$this->event_path = $application_path . '/event/';
if (class_exists('\Skeleton\I18n\Config') AND isset(\Skeleton\I18n\Config::$language_interface)) {
$classname = \Skeleton\I18n\Config::$language_interface;
if (!class_exists($classname)) {
throw new \Exception('The language interface does not exists: ' . \Skeleton\I18n\Config::$language_interface);
}
$this->language = $classname::get_by_name_short($this->config->default_language);
}
}
/**
* Load the config
*
* @access private
*/
private function load_config() {
if (file_exists($this->path . '/config/Config.php')) {
require_once $this->path . '/config/Config.php';
$classname = 'Config_' . ucfirst($this->name);
$config = new $classname;
} else {
throw new \Exception('No config file in application directory. Please create "' . $this->path . '/config/Config.php');
}
$this->config = $config;
}
/**
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
* @var Config $config
*/
public $config = null;
/**
* Events
*
* @access public
* @var array $events
*/
public $events = [];
/**
* Constructor
*
* @access public
*/
public function __construct($name) {
$this->name = $name;
$this->get_details();
}
/**
* Get details of application
*
* @access protected
*/
protected function get_details() {
$application_path = realpath(Config::$application_dir . '/' . $this->name);
if (!file_exists($application_path)) {
throw new \Exception('Application with name "' . $this->name . '" not found');
}
$this->path = $application_path;
$this->load_config();
$this->media_path = $application_path . '/media/';
$this->module_path = $application_path . '/module/';
$this->template_path = $application_path . '/template/';
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
}
/**
* Get all
*
* @access public
* @return array $applications
*/
public static function get_all() {
if (Config::$application_dir === null) {
throw new \Exception('No application_dir set. Please set Config::$application_dir');
}
$application_directories = scandir(Config::$application_dir);
$application = [];
foreach ($application_directories as $application_directory) {
if ($application_directory[0] == '.') {
continue;
}
$application = new self($application_directory);
$applications[] = $application;
}
return $applications;
}
/**
* Get application by name
*
* @access public
* @param string $name
* @return Application $application
*/
public static function get_by_name($name) {
return new self($name);
}
/**
* Create an app
*
* @access public
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
*
* @param string $hostname
* @param string $request_uri
* @access public
* @return Application $application
*/
public static function detect($hostname, $request_uri) {
// If we already have a cached application, return that one
if (self::$application !== null) {
return Application::get();
}
// If multiple host headers have been set, use the last one
if (strpos($hostname, ', ') !== false) {
list($hostname, $discard) = array_reverse(explode(', ', $hostname));
}
// Find matching applications
$applications = self::get_all();
$matched_applications = [];
// Match via event
foreach ($applications as $application) {
if (!$application->event_exists('application', 'detect')) {
continue;
}
if ($application->call_event('application', 'detect', [ $hostname, $request_uri ])) {
$matched_applications[] = $application;
}
}
// Regular matches
foreach ($applications as $application) {
if (in_array($hostname, $application->config->hostnames)) {
$application->matched_hostname = $hostname;
$matched_applications[] = $application;
}
}
/web/tickoweb/tickoweb.be/chronorace/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Web/Handler.php
$elements = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
$hostname = trim(end($elements));
} elseif (isset($_SERVER['HTTP_HOST'])) {
$hostname = $_SERVER['HTTP_HOST'];
} elseif (isset($_SERVER['SERVER_NAME'])) {
$hostname = $_SERVER['SERVER_NAME'];
} elseif (isset($_SERVER['SERVER_ADDR'])) {
$hostname = $_SERVER['SERVER_ADDR'];
} else {
throw new \Exception('Not a web request');
}
// Remove port number from host
$hostname = preg_replace('/:\d+$/', '', $hostname);
/**
* Define the application
*/
try {
$application = Application::detect($hostname, $request_uri);
} catch (\Skeleton\Core\Exception_Unknown_Application $e) {
HTTP\Status::code_404('application');
}
/**
* Handle the media
*/
if (isset($application->config->detect_media) AND $application->config->detect_media === true OR !isset($application->config->detect_media)) {
try {
Media::detect($application->request_relative_uri);
} catch (\Skeleton\Core\Exception\Media\Not\Found $e) {
HTTP\Status::code_404('media');
}
}
/**
* Start the session
*/
$session_properties = [];
Session::start($session_properties);
/web/tickoweb/tickoweb.be/chronorace/webroot/handler.php
<?php
/**
* Initialize the application
*
* @author Christophe Gosiau <christophe@tigron.be>
* @author Gerry Demaret <gerry@tigron.be>
* @author David Vandemaele <david@tigron.be>
*/
require_once '../config/global.php';
\Skeleton\Core\Web\Handler::Run();