/var/www/hh/core/application/init/Database/SleekDB.php
<?php
namespace Sucurema\Core;
require_once __DIR__ . '/traits/helpers.php';
require_once __DIR__ . '/traits/conditions.php';
require_once __DIR__ . '/traits/caching.php';
class SleekDB
{
use \HelpersTrait, \ConditionsTrait, \CacheTraits;
// Initialize the database.
function __construct($dataDir = '', $configurations = false)
{
// Define the root path of SleekDB.
$this->root = __DIR__;
if ($configurations === false) {
$configurations = [];
}
// Add data dir.
$configurations['data_directory'] = $dataDir;
// Initialize SleekDB
$this->init($configurations);
}
// Initialize the store.
public static function store($storeName = false, $dataDir = "/", $options = false)
{
if (!$storeName or empty($storeName)) throw new \Exception('Store name was not valid');
$_dbInstance = new \Sucurema\Core\SleekDB($dataDir, $options);
$_dbInstance->storeName = $storeName;
// Boot store.
$_dbInstance->bootStore();
// Initialize variables for the store.
$_dbInstance->initVariables();
return $_dbInstance;
Arguments
"Creation of dynamic property Sucurema\Core\SleekDB::$root is deprecated"
/var/www/hh/core/application/init/Database/SleekDB.php
<?php
namespace Sucurema\Core;
require_once __DIR__ . '/traits/helpers.php';
require_once __DIR__ . '/traits/conditions.php';
require_once __DIR__ . '/traits/caching.php';
class SleekDB
{
use \HelpersTrait, \ConditionsTrait, \CacheTraits;
// Initialize the database.
function __construct($dataDir = '', $configurations = false)
{
// Define the root path of SleekDB.
$this->root = __DIR__;
if ($configurations === false) {
$configurations = [];
}
// Add data dir.
$configurations['data_directory'] = $dataDir;
// Initialize SleekDB
$this->init($configurations);
}
// Initialize the store.
public static function store($storeName = false, $dataDir = "/", $options = false)
{
if (!$storeName or empty($storeName)) throw new \Exception('Store name was not valid');
$_dbInstance = new \Sucurema\Core\SleekDB($dataDir, $options);
$_dbInstance->storeName = $storeName;
// Boot store.
$_dbInstance->bootStore();
// Initialize variables for the store.
$_dbInstance->initVariables();
return $_dbInstance;
/var/www/hh/core/application/init/Database/SleekDB.php
function __construct($dataDir = '', $configurations = false)
{
// Define the root path of SleekDB.
$this->root = __DIR__;
if ($configurations === false) {
$configurations = [];
}
// Add data dir.
$configurations['data_directory'] = $dataDir;
// Initialize SleekDB
$this->init($configurations);
}
// Initialize the store.
public static function store($storeName = false, $dataDir = "/", $options = false)
{
if (!$storeName or empty($storeName)) throw new \Exception('Store name was not valid');
$_dbInstance = new \Sucurema\Core\SleekDB($dataDir, $options);
$_dbInstance->storeName = $storeName;
// Boot store.
$_dbInstance->bootStore();
// Initialize variables for the store.
$_dbInstance->initVariables();
return $_dbInstance;
}
// Read store objects.
public function fetch()
{
$fetchedData = null;
// Check if data should be provided from the cache.
if ($this->makeCache === true) {
$fetchedData = $this->reGenerateCache(); // Re-generate cache.
} else if ($this->useCache === true) {
$fetchedData = $this->useExistingCache(); // Use existing cache else re-generate.
} else {
$fetchedData = $this->findStoreDocuments(); // Returns data without looking for cached data.
}
/var/www/hh/core/application/init/Syslog/Syslog.php
public function __construct()
{
$userId = (isset($_SESSION["userId"]) ? $_SESSION["userId"] : 1);
$dataDir = get_include_path() . "/logs/" . $userId;
$this->store = \SucSleekDB::store('Syslog', $dataDir);
}
public static function writeLog(int $type, string $component, string $function, string $message, bool $persistent)
{
if (self::$instance === null) {
self::$instance = new self();
}
$date = new \DateTime();
$userId = 0;
$userId = issetor($_SESSION["userId"], "nologin");
if ($persistent) {
$storePers = \SucSleekDB::store('Syslog', get_include_path() . "/logs/persistent");
}
$data = [
"dateTime" => $date->format('d.m.Y H:i:s'),
"type" => $type,
"function" => $function,
"component" => $component,
"message" => $message,
];
if ($persistent) {
$data["user"] = issetor($_SESSION["userId"], 1);
}
$logType = \SucConfig::Get('LOG_LEVEL', \SucSyslog::CRITICAL);
if ($type >= $logType) {
if ($persistent) {
$storePers->insert($data);
}
$store = \SucSleekDB::store('Syslog', get_include_path() . "/logs/$userId");
$d = $store->insert($data);
self::$instance->current = $d["_id"];
/var/www/hh/core/application/init/log_utilities.php
}
function log_infomessage($component, $function, $message, $persistent = false)
{
log_message(\SucSyslog::MESSAGE, $component, $function, $message, $persistent);
}
function log_warning($component, $function, $message, $persistent = false)
{
log_message(\SucSyslog::WARNING, $component, $function, $message, $persistent);
}
function log_message($logLevel, $component, $function, $message, $persistent = false)
{
if ($persistent || \SucConfig::Get("FULL_PERSISTENT_ERRORLOG", false)) {
$persistent = true;
}
\SucSyslog::writeLog($logLevel, $component, $function, $message, $persistent);
// \SucSyslog::writeLog($logLevel, $component, $function, $message, $persistent);
if (\SucConfig::Get('FORCE_OLD_DEBUG_MODE', false) && ($GLOBALS['DEBUG_MODE'] || $logLevel === \SucSyslog::CRITICAL)) {
$type = 'Error';
if ($logLevel !== \SucSyslog::CRITICAL) {
$type = 'Info';
}
$component = str_replace('"', '""', $component);
$function = str_replace('"', '""', $function);
$message = str_replace('"', '""', $message);
$user_id = issetor($_SESSION['userId']);
if ($user_id == null || $user_id == '') {
$user_id = 'system';
}
/var/www/hh/core/application/init/log_utilities.php
{
$date = date($GLOBALS['SQL_DATE_FORMAT']);
$log_file = ($GLOBALS["LOG_DIR"] != "") ? fopen($GLOBALS["LOG_DIR"] . '/' . $date . '_trace.log.txt', "a") : fopen($_SERVER['DOCUMENT_ROOT'] . 'logs/' . $date . '_trace.log.txt', "a");
fwrite($log_file, $message . "\n");
fclose($log_file);
}
function issetor(&$variable, $or = NULL)
{
return $variable === NULL ? $or : $variable;
}
function log_error($component, $function, $message, $persistent = false)
{
log_message(\SucSyslog::CRITICAL, $component, $function, $message, $persistent);
}
function log_info($component, $function, $message, $persistent = false)
{
log_message(\SucSyslog::VERBOSE, $component, $function, $message, $persistent);
}
function log_infomessage($component, $function, $message, $persistent = false)
{
log_message(\SucSyslog::MESSAGE, $component, $function, $message, $persistent);
}
function log_warning($component, $function, $message, $persistent = false)
{
log_message(\SucSyslog::WARNING, $component, $function, $message, $persistent);
}
function log_message($logLevel, $component, $function, $message, $persistent = false)
{
if ($persistent || \SucConfig::Get("FULL_PERSISTENT_ERRORLOG", false)) {
$persistent = true;
}
\SucSyslog::writeLog($logLevel, $component, $function, $message, $persistent);
/var/www/hh/core/application/init/Database/Facade/pdofacade.class.php
log_error('PDOFacade', 'Constructor', 'Error by establishing database connection: '.$e);
die();
}
}
private function bind($stmt, $args) {
#bind args to query
if($args != null) {
$this->bind = $args;
foreach ($args as $name => $value) {
$stmt->bindValue($name, $value);
}
}
}
public function fetch($query, $args = null, $log = true, $byLine = false) {
assertNotNull($query);
if ($log) {
log_info('PDOFacade', 'fetch', 'call query: '.$query . $this->keyValueToString($this->lastBind));
}
$this->last_error = "";
$stmt = $this->pdo->prepare($query);
if($args != null) {
$this->bind($stmt, $args);
}
return $this->executePreparedStatement($stmt, true, $log, $byLine);
}
private function keyValueToString($args) {
if ($args == null || !is_array($args)) {
return "";
}
$bind = "";
/var/www/hh/core/application/application.class.php
public function getSecurityAdapter()
{
return $this->sa;
}
public function initialize()
{
$this->sa = null;
$tableExists = "";
if ($GLOBALS['application']->DB_DRIVER == 'mysql') {
// MySQL
$tableExists = "SHOW TABLES LIKE 'icrm_useractivities';";
} else {
// ORACLE, ...
$tableExists = "SELECT table_name as \"name\" FROM all_tables WHERE table_name LIKE 'ICRM_USERACTIVITIES'";
}
$res = $this->dbh->fetch($tableExists);
$this->tableUAExists = is_array($res) && count($res) > 0;
switch ($GLOBALS['AUTH_MODE']) {
case 'DB':
$this->sa = new SecurityAdapterDB();
break;
case 'LDAP':
$this->sa = new SecurityAdapterLDAP();
break;
case 'Custom':
$this->sa = new SecurityAdapterCustom();
break;
}
$requestHeaders = apache_request_headers_auth();
$authorizationHeader = null;
if (isset($requestHeaders['Authorization'])) {
$authorizationHeader = $requestHeaders['Authorization'];
// we may want to forcefully disable the auth header
/var/www/hh/core/application/auth/auth_header.php
if ( !isset($_SESSION['ADMINSETTINGS_BUSINESSYEAR']) ) {
$_SESSION['ADMINSETTINGS_BUSINESSYEAR'] = 1;
}
include 'core/bc/buscomp.class.php';
include 'core/ic/csvintcomp.class.php';
include 'core/applets/applet.class.php';
include 'core/toolbars/toolbar.class.php';
include 'core/drilldowns/drilldown.class.php';
include 'core/modules/logon/auth/verification.php';
include 'core/modules/logon/bc/applicationuserbuscomp.class.php';
include 'core/application/application.class.php';
// once the whole thing is setup we don't need to run it;
$GLOBALS['initDone'] = true;
#Create Application context
$application = new Application();
if ($application->initialize() == false) {
$GLOBALS["USE_CMS"] = true;
}
}
?>
/var/www/hh/index.php
<?php
//$page_title = $GLOBALS["APP_TITLE"] . "";
if ( !isset($START_LANG) ) {
$START_LANG = "DEU";
}
#Authentification/Login and open main view block
include "config/includepath.php";
include 'core/application/auth/auth_header.php';
//if(isset($_SESSION["isLogged"]) && $_SESSION["isLogged"]) {
#Check permissions
//include 'modules/logon/auth/verification.php';
//header ("Location: /modules/dashboard/views/dashboardview.php");
// exit();
//}
#Close main view block
//include "core/application/auth/auth_footer.php";
?>
Arguments
"/var/www/hh/core/application/auth/auth_header.php"