/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-database/lib/Skeleton/Database/Driver/Mysqli/Proxy.php
// UNIX sockets can be used by setting host to unix(/path/to/socket)
if ($settings['host'] == 'unix(') {
$settings['socket'] = strtok($settings['path'], ')');
$settings['path'] = strtok('');
$settings['host'] = 'localhost';
} else {
$settings['socket'] = null;
}
if (!isset($settings['port'])) {
$settings['port'] = null;
}
$settings['path'] = substr($settings['path'], 1);
$this->database = @new \Mysqli($settings['host'], $settings['user'], $settings['pass'], $settings['path'], $settings['port'], $settings['socket']);
// If there is an error connecting to the database, stop doing what you're doing
if ($this->database->connect_errno != 0) {
throw new \Skeleton\Database\Exception\Connection('Could not connect to database: ' . $this->database->connect_error);
}
$this->database->set_charset(\Skeleton\Database\Config::$charset);
$this->connected = true;
return $this->connected;
}
/**
* Get the DBMS we are currently connected to
*
* @access public
* @return string $database_type
*/
public function get_dbms() : string {
return 'mysql';
}
/**
* Filter fields to insert/update table
Arguments
"Could not connect to database: Access denied for user 'tickoweb'@'10.21.0.25'"
/var/www/admin.tickoweb.be/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 \Skeleton\Database\Driver\Mysqli\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) {
$params_copy = $params;
$query_log = preg_replace_callback(
"/(\\?)/",
function($match) use (&$params) {
$param = array_shift($params);
if (is_null($param) == true) {
return 'NULL';
}
if (is_string($param) == true) {
return '"' . $param . '" ';
}
return $param;
},
$query
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-database/lib/Skeleton/Database/Driver/Mysqli/Proxy.php
array_unshift($refs, $types);
try {
call_user_func_array([$statement, 'bind_param'], array_values($refs));
} catch (\Exception $e) {
throw new \Skeleton\Database\Exception\Query($e->getMessage());
}
return $statement;
}
/**
* Get a single row from a resultset
*
* @access public
* @param string $query The query to execute
* @param array $params Optional parameters to replace in the query
* @return array $result The resulting associative array
* @throws Exception Throws an Exception when there is more than one row in a resultset
*/
public function get_row($query, $params = []) {
$statement = $this->get_statement($query, $params);
try {
$statement->execute();
} catch (\Skeleton\Database\Exception\Query $e) {
\Skeleton\Database\Driver\Mysqli\Statement\Retry::handle($statement);
}
$result = $statement->fetch_assoc();
if (count($result) == 0) {
return null;
} else if (count($result) > 1) {
throw new \Skeleton\Database\Exception\Query('Resultset has more than 1 row');
}
return $result[0];
}
/**
* Get the first column of the resultset
/var/www/admin.tickoweb.be/lib/model/Language.php
/**
* Get by name_short
*
* @access public
* @return Language
* @param string $name_short
*/
public static function get_by_name_short($name) {
if (isset(self::$cache[$name]) === true) {
return self::$cache[$name];
}
try {
$object = self::cache_get(get_class() . '_' . $name);
self::$cache[$name] = $object;
return $object;
} catch (\Exception $e) {}
$db = Database::Get();
$row = $db->get_row('SELECT * FROM language WHERE name_short=?', [$name]);
if ($row === null) {
throw new \Exception('No such language ' . $name);
}
$object = new self();
$object->id = $row['id'];
$object->details = $row;
self::cache_set(get_class() . '_' . $name, $object);
self::$cache[$name] = $object;
return $object;
}
public static function get_all($sort = null, $direction = null) {
if (self::$all_languages === null) {
self::$all_languages = parent::get_all($sort, $direction);
}
return self::$all_languages;
}
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-application-web/lib/Skeleton/Application/Web/Event/I18n.php
$languages = $language_interface::get_all();
$all_languages = [];
$available_languages = [];
foreach ($languages as $language) {
$available_languages[] = $language->name_short;
$all_languages[$language->name_short] = $language;
}
$matching_language = \Skeleton\I18n\Util::get_best_matching_language(
$_SERVER['HTTP_ACCEPT_LANGUAGE'], $available_languages
);
if ($matching_language === false) {
throw new \Exception('No matching language found');
}
$language = $all_languages[$matching_language];
} catch (\Exception $e) {
$language = $language_interface::get_by_name_short($this->application->config->default_language);
}
return $language;
}
}
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
return $this->events[strtolower($context)];
}
$event = new $default($this);
$this->events[strtolower($context)] = $event;
return $this->events[strtolower($context)];
}
throw new \Exception('There is no event found for context ' . $requested_context);
}
/**
* Call event
*
* @access public
* @param $arguments mixed[]
*/
public function call_event(string $context, string $action, array $arguments = []): mixed {
$event = $this->load_event($context);
return call_user_func_array([$event, $action], $arguments);
}
/**
* Event exists
*
* @access public
*/
public function event_exists(string $context, string $action): bool {
try {
$event = $this->load_event($context);
} catch (\Exception $e) {
return false;
}
if (is_callable([$event, $action])) {
return true;
}
return false;
}
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
return $this->events[strtolower($context)];
}
$event = new $default($this);
$this->events[strtolower($context)] = $event;
return $this->events[strtolower($context)];
}
throw new \Exception('There is no event found for context ' . $requested_context);
}
/**
* Call event
*
* @access public
* @param $arguments mixed[]
*/
public function call_event(string $context, string $action, array $arguments = []): mixed {
$event = $this->load_event($context);
return call_user_func_array([$event, $action], $arguments);
}
/**
* Event exists
*
* @access public
*/
public function event_exists(string $context, string $action): bool {
try {
$event = $this->load_event($context);
} catch (\Exception $e) {
return false;
}
if (is_callable([$event, $action])) {
return true;
}
return false;
}
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-application-web/lib/Skeleton/Application/Web.php
return;
}
if (!isset(\Skeleton\I18n\Config::$language_interface)) {
/**
* This should not happen, there is a default set
*/
return;
}
$language_interface = \Skeleton\I18n\Config::$language_interface;
if (!class_exists($language_interface)) {
throw new \Exception('The language interface does not exists: ' . $language_interface);
}
/**
* Try to set the language
*/
$_SESSION['language'] = $this->call_event('i18n', 'detect_language');
$this->language = $_SESSION['language'];
if (class_exists('\Skeleton\I18n\Translator')) {
$translator = $this->call_event('i18n', 'get_translator');
if ($translator !== null) {
$template = \Skeleton\Application\Web\Template::get();
$translation = $translator->get_translation($this->language);
$template->set_translation($translation);
}
}
}
}
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-application-web/lib/Skeleton/Application/Web.php
*/
$module = null;
try {
// Attempt to find the module by matching defined routes
$module = $this->route($this->request_relative_uri);
} catch (\Exception $e) {
try {
// Attempt to find a module by matching paths
$module = Module::resolve($this->request_relative_uri);
} catch (\Exception $e) {
$this->detect_language();
$this->call_event('module', 'not_found');
}
}
/**
* Set language
*/
if (!isset($this->language) || $this->language === null) {
$this->detect_language();
}
/**
* Validate CSRF
*/
$csrf = \Skeleton\Application\Web\Security\Csrf::get();
if ($session_properties['resumed'] === true && !$csrf->validate()) {
$this->call_event('security', 'csrf_validate_failed');
}
/**
* Check for replays
*/
$replay = \Skeleton\Application\Web\Security\Replay::get();
if ($replay->check() === false) {
$this->call_event('security', 'replay_detected');
}
if ($module !== null) {
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Application.php
*/
public function accept(): void {
/**
* If this application is launched while another application has been
* set, we need to take over the request_relative_uri
* This happens when whitin an application, another application is
* started.
*/
$application = self::get();
$this->request_relative_uri = $application->request_relative_uri;
$this->hostname = $application->hostname;
\Skeleton\Core\Application::set($this);
$continue = $this->call_event('application', 'bootstrap', []);
register_shutdown_function([$this, 'call_event'], 'application', 'teardown', []);
if ($continue) {
$this->run();
}
}
/**
* Run the application
*
* @access public
*/
abstract public function run(): void;
/**
* Load all events
*
* @access public
*/
public function load_event(string $requested_context): object {
if (isset($this->events[$requested_context])) {
return $this->events[$requested_context];
}
/var/www/admin.tickoweb.be/lib/external/packages/tigron/skeleton-core/lib/Skeleton/Core/Http/Handler.php
} 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) {
Status::code_404('application');
}
$application->accept();
}
}
/var/www/admin.tickoweb.be/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>
*/
declare(strict_types=1);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
require_once '../lib/base/Bootstrap.php';
Bootstrap::boot();
\Skeleton\Core\Http\Handler::Run();