Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1afc0eb982 | ||
|
|
a7e7539911 | ||
|
|
6e3f017960 | ||
|
|
80715e5ef1 | ||
|
|
0408483aa8 | ||
|
|
02d1d03c15 | ||
| 6db87c64b0 | |||
|
|
765297d2a2 |
@@ -18,7 +18,9 @@ The active branch, which is the namespace branch
|
|||||||
|
|
||||||
### legacy
|
### legacy
|
||||||
|
|
||||||
The old non namepsace format layout. This will only get bug fixes and no new development
|
The old non namepsace format layout.
|
||||||
|
This is fully deprecated and will no longer be maintaned.
|
||||||
|
last tested PHP 5.6 and PHP 7.0
|
||||||
|
|
||||||
### namespace
|
### namespace
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ define('USE_DATABASE', true);
|
|||||||
// sample config
|
// sample config
|
||||||
require("config.inc");
|
require("config.inc");
|
||||||
// set session name
|
// set session name
|
||||||
DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
if (!defined('SET_SESSION_NAME')) {
|
||||||
|
DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
||||||
|
}
|
||||||
// define log file id
|
// define log file id
|
||||||
DEFINE('LOG_FILE_ID', 'classTest');
|
DEFINE('LOG_FILE_ID', 'classTest');
|
||||||
// set language for l10n
|
// set language for l10n
|
||||||
@@ -182,8 +184,14 @@ print "OTHER SCHEMA INSERT STATUS: ".$status." | PK NAME: ".$basic->pk_name.", P
|
|||||||
// time string thest
|
// time string thest
|
||||||
$timestamp = 5887998.33445;
|
$timestamp = 5887998.33445;
|
||||||
$time_string = $basic->timeStringFormat($timestamp);
|
$time_string = $basic->timeStringFormat($timestamp);
|
||||||
|
print "PLANE TIME STRING: ".$timestamp."<br>";
|
||||||
print "TIME STRING TEST: ".$time_string."<br>";
|
print "TIME STRING TEST: ".$time_string."<br>";
|
||||||
print "REVERSE TIME STRING: ".$basic->stringToTime($time_string);
|
print "REVERSE TIME STRING: ".$basic->stringToTime($time_string)."<br>";
|
||||||
|
if (round($timestamp, 4) == $basic->stringToTime($time_string)) {
|
||||||
|
print "REVERSE TIME STRING MATCH<br>";
|
||||||
|
} else {
|
||||||
|
print "REVERSE TRIME STRING DO NOT MATCH<br>";
|
||||||
|
}
|
||||||
|
|
||||||
// magic links test
|
// magic links test
|
||||||
print $basic->magicLinks('user@bubu.at').'<br>';
|
print $basic->magicLinks('user@bubu.at').'<br>';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2003/06/10
|
* CREATED: 2003/06/10
|
||||||
* SHORT DESCRIPTION:
|
* SHORT DESCRIPTION:
|
||||||
* configuration file
|
* configuration file
|
||||||
@@ -9,79 +9,82 @@
|
|||||||
|
|
||||||
/************* SESSION NAMES *************/
|
/************* SESSION NAMES *************/
|
||||||
// backend
|
// backend
|
||||||
DEFINE('EDIT_SESSION_NAME', "<ADMIN SESSION NAME>");
|
DEFINE('EDIT_SESSION_NAME', '<ADMIN SESSION NAME>');
|
||||||
// frontend
|
// frontend
|
||||||
DEFINE('SESSION_NAME', "<SESSION NAME>");
|
DEFINE('SESSION_NAME', '<SESSION NAME>');
|
||||||
// set the session name
|
// set the session name
|
||||||
define('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
define('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
||||||
|
|
||||||
/************* LANGUAGE / ENCODING *******/
|
/************* LANGUAGE / ENCODING *******/
|
||||||
DEFINE('DEFAULT_LANG', "en_utf8");
|
DEFINE('DEFAULT_LANG', 'en_utf8');
|
||||||
// default web page encoding setting
|
// default web page encoding setting
|
||||||
DEFINE('DEFAULT_ENCODING', "UTF-8");
|
DEFINE('DEFAULT_ENCODING', 'UTF-8');
|
||||||
|
|
||||||
/************* PATHS *********************/
|
/************* PATHS *********************/
|
||||||
|
// directory seperator
|
||||||
|
DEFINE('DS', DIRECTORY_SEPARATOR);
|
||||||
// ** NEW/BETTER DIR DECLARATIONS **
|
// ** NEW/BETTER DIR DECLARATIONS **
|
||||||
// path to original file (if symlink)
|
// path to original file (if symlink)
|
||||||
DEFINE('DIR', __DIR__."/");
|
DEFINE('DIR', __DIR__.DS);
|
||||||
// libs base path based on DIR
|
// base dir root folder level
|
||||||
DEFINE('LIBDIR', DIR.'libs/');
|
DEFINE('BASE', str_replace('configs', '', __DIR__));
|
||||||
// SMARTY path based on DIR
|
|
||||||
DEFINE('SMARTYDIR', DIR.'Smarty/');
|
|
||||||
// table arrays for Class Form
|
|
||||||
DEFINE('TABLEARRAYDIR', DIR.'table_arrays/');
|
|
||||||
|
|
||||||
// ** OLD DIR DECLARATIONS **
|
// ** OLD DIR DECLARATIONS **
|
||||||
// path to document root of file called
|
// path to document root of file called
|
||||||
DEFINE('ROOT', getcwd()."/");
|
DEFINE('ROOT', getcwd().DS);
|
||||||
// libs path
|
// libs path
|
||||||
DEFINE('LIBS', "libs/");
|
DEFINE('LIB', 'lib'.DS);
|
||||||
|
DEFINE('LIBS', 'lib'.DS);
|
||||||
// includes (strings, arrays for static, etc)
|
// includes (strings, arrays for static, etc)
|
||||||
DEFINE('INCLUDES', "includes/");
|
DEFINE('INCLUDES', 'includes'.DS);
|
||||||
// layout base path
|
// layout base path
|
||||||
DEFINE('LAYOUT', 'layout/');
|
DEFINE('LAYOUT', 'layout'.DS);
|
||||||
// pic-root (compatible to CMS)
|
// pic-root (compatible to CMS)
|
||||||
DEFINE('PICTURES', "images/");
|
DEFINE('PICTURES', 'images'.DS);
|
||||||
// images
|
// images
|
||||||
DEFINE('IMAGES', "images/");
|
DEFINE('IMAGES', 'images'.DS);
|
||||||
// icons (below the images/ folder)
|
// icons (below the images/ folder)
|
||||||
DEFINE('ICONS', 'icons/');
|
DEFINE('ICONS', 'icons'.DS);
|
||||||
// media
|
// media
|
||||||
DEFINE('MEDIA', "media/");
|
DEFINE('MEDIA', 'media'.DS);
|
||||||
// flash-root (below media)
|
// flash-root (below media)
|
||||||
DEFINE('FLASH', "flash/");
|
DEFINE('FLASH', 'flash'.DS);
|
||||||
// uploads (anything to keep)
|
// uploads (anything to keep)
|
||||||
DEFINE('UPLOADS', "uploads/");
|
DEFINE('UPLOADS', 'uploads'.DS);
|
||||||
// files (binaries) (below media)
|
// files (binaries) (below media)
|
||||||
DEFINE('BINARIES', "binaries/");
|
DEFINE('BINARIES', 'binaries'.DS);
|
||||||
// files (videos) (below media)
|
// files (videos) (below media)
|
||||||
DEFINE('VIDEOS', "videos/");
|
DEFINE('VIDEOS', 'videos'.DS);
|
||||||
// files (documents) (below media)
|
// files (documents) (below media)
|
||||||
DEFINE('DOCUMENTS', "documents/");
|
DEFINE('DOCUMENTS', 'documents'.DS);
|
||||||
// files (pdfs) (below media)
|
// files (pdfs) (below media)
|
||||||
DEFINE('PDFS', "documents/");
|
DEFINE('PDFS', 'documents'.DS);
|
||||||
|
// CSV
|
||||||
|
DEFINE('CSV', 'csv'.DS);
|
||||||
// css
|
// css
|
||||||
DEFINE('CSS', "css/");
|
DEFINE('CSS', 'css'.DS);
|
||||||
// js
|
// js
|
||||||
DEFINE('JS', "javascript/");
|
DEFINE('JS', 'javascript'.DS);
|
||||||
// table arrays
|
// table arrays
|
||||||
DEFINE('TABLE_ARRAYS', "table_arrays/");
|
DEFINE('TABLE_ARRAYS', 'table_arrays'.DS);
|
||||||
// smarty libs path
|
// smarty libs path
|
||||||
DEFINE('SMARTY', "Smarty/");
|
DEFINE('SMARTY', 'Smarty'.DS);
|
||||||
// po langs
|
// po langs
|
||||||
DEFINE('LANG', "lang/");
|
DEFINE('LANG', 'lang'.DS);
|
||||||
// cache path
|
// cache path
|
||||||
DEFINE('CACHE', "cache/");
|
DEFINE('CACHE', 'cache'.DS);
|
||||||
// temp path
|
// temp path
|
||||||
DEFINE('TMP', "tmp/");
|
DEFINE('TMP', 'tmp'.DS);
|
||||||
// log files
|
// log files
|
||||||
DEFINE('LOG', 'log/');
|
DEFINE('LOG', 'log'.DS);
|
||||||
|
// compiled template folder
|
||||||
|
DEFINE('TEMPLATES_C', 'templates_c'.DS);
|
||||||
// template base
|
// template base
|
||||||
DEFINE('TEMPLATES', "templates/");
|
DEFINE('TEMPLATES', 'templates'.DS);
|
||||||
// frontend template dir', only for admin
|
// frontend template dir', only for admin
|
||||||
DEFINE('TEMPLATES_FRONTEND', "templates_frontend/");
|
DEFINE('TEMPLATES_FRONTEND', 'templates_frontend'.DS);
|
||||||
// default template
|
// default template
|
||||||
DEFINE('DEFAULT_TEMPLATE', "default/");
|
DEFINE('DEFAULT_TEMPLATE', 'default'.DS);
|
||||||
// default template file
|
// default template file
|
||||||
DEFINE('DEFAULT_TEMPLATE_FILE', 'default.tpl');
|
DEFINE('DEFAULT_TEMPLATE_FILE', 'default.tpl');
|
||||||
|
|
||||||
@@ -99,14 +102,14 @@ DEFINE('DEFAULT_ACL_SEND', 70);
|
|||||||
DEFINE('DEFAULT_ACL_DEL', 80);
|
DEFINE('DEFAULT_ACL_DEL', 80);
|
||||||
DEFINE('DEFAULT_ACL_ADMIN', 100); */
|
DEFINE('DEFAULT_ACL_ADMIN', 100); */
|
||||||
// SSL host name
|
// SSL host name
|
||||||
// DEFINE('SSL_HOST', "ssl.host.name");
|
// DEFINE('SSL_HOST', 'ssl.host.name');
|
||||||
// error page strictness, Default is 3
|
// error page strictness, Default is 3
|
||||||
// 1: only show error page as the last mesure if really no mid & aid can be loaded and found at all
|
// 1: only show error page as the last mesure if really no mid & aid can be loaded and found at all
|
||||||
// 2: if template not found, do not search, show error template
|
// 2: if template not found, do not search, show error template
|
||||||
// 3: if default template is not found, show error template, do not fall back to default tree
|
// 3: if default template is not found, show error template, do not fall back to default tree
|
||||||
// 4: very strict, even on normal fixable errors through error
|
// 4: very strict, even on normal fixable errors through error
|
||||||
// DEFINE('ERROR_STRICT', 3);
|
// DEFINE('ERROR_STRICT', 3);
|
||||||
// allow page caching in general, set to "FALSE" if you do debugging or development!
|
// allow page caching in general, set to 'FALSE' if you do debugging or development!
|
||||||
// DEFINE('ALLOW_SMARTY_CACHE', FALSE);
|
// DEFINE('ALLOW_SMARTY_CACHE', FALSE);
|
||||||
// cache life time, in seconds, default here is 2 days (172800s)
|
// cache life time, in seconds, default here is 2 days (172800s)
|
||||||
// -1 is never expire cache
|
// -1 is never expire cache
|
||||||
@@ -131,6 +134,11 @@ DEFINE('PAGE_WIDTH', 800);
|
|||||||
// the default template name
|
// the default template name
|
||||||
DEFINE('MASTER_TEMPLATE_NAME', 'main_body.tpl');
|
DEFINE('MASTER_TEMPLATE_NAME', 'main_body.tpl');
|
||||||
|
|
||||||
|
// below two can be defined here, but they should be
|
||||||
|
// defined in either the header file or the file itself
|
||||||
|
/************* LOGGING *******************/
|
||||||
|
// DEFINE('LOG_FILE_ID', '');
|
||||||
|
|
||||||
/************* QUEUE TABLE *************/
|
/************* QUEUE TABLE *************/
|
||||||
// if we have a dev/live system
|
// if we have a dev/live system
|
||||||
// set_live is a per page/per item
|
// set_live is a per page/per item
|
||||||
@@ -142,37 +150,38 @@ DEFINE('MASTER_TEMPLATE_NAME', 'main_body.tpl');
|
|||||||
DEFINE('PUBLIC_SCHEMA', 'public');
|
DEFINE('PUBLIC_SCHEMA', 'public');
|
||||||
DEFINE('DEV_SCHEMA', 'public');
|
DEFINE('DEV_SCHEMA', 'public');
|
||||||
DEFINE('TEST_SCHEMA', 'public');
|
DEFINE('TEST_SCHEMA', 'public');
|
||||||
|
DEFINE('LIVE_SCHEMA', 'public');
|
||||||
|
|
||||||
// non constant part
|
// non constant part
|
||||||
/************* DB ACCESS *****************/
|
/************* DB ACCESS *****************/
|
||||||
// please be VERY carefull only to change the right side
|
// please be VERY carefull only to change the right side
|
||||||
$DB_CONFIG = array (
|
$DB_CONFIG = array (
|
||||||
"<db id>" => array (
|
'<db id>' => array (
|
||||||
"db_name" => "<database>",
|
'db_name' => '<database>',
|
||||||
"db_user" => "<user>",
|
'db_user' => '<user>',
|
||||||
"db_pass" => "<password>",
|
'db_pass' => '<password>',
|
||||||
"db_host" => "<host>",
|
'db_host' => '<host>',
|
||||||
"db_port" => "5432",
|
'db_port' => '5432',
|
||||||
"db_schema" => "public", // if not set, uses public
|
'db_schema' => 'public', // if not set, uses public
|
||||||
"db_type" => "pgsql",
|
'db_type' => 'pgsql',
|
||||||
"db_encoding" => '',
|
'db_encoding' => '',
|
||||||
"db_ssl" => 'disable' // allow, disable, require, prefer
|
'db_ssl' => 'disable' // allow, disable, require, prefer
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// File and Folder paths
|
// File and Folder paths
|
||||||
// ID is TARGET (first array element)
|
// ID is TARGET (first array element)
|
||||||
// $PATHS["test"]["csv_path"] = "";
|
// $PATHS['test']['csv_path'] = '';
|
||||||
// $PATHS["test"]["perl_bin"] = "";
|
// $PATHS['test']['perl_bin'] = '';
|
||||||
// $PATHS["test"]["redirect_url"] = "";
|
// $PATHS['test']['redirect_url'] = '';
|
||||||
|
|
||||||
// each host has a different db_host
|
// each host has a different db_host
|
||||||
// development host
|
// development host
|
||||||
$DB_HOST['<host>'] = "<db id>";
|
$DB_HOST['<host>'] = '<db id>';
|
||||||
// target host (live)
|
// target host (live)
|
||||||
// $DB_TARGET_HOST['<host>'] = "<DB ID>";
|
// $DB_TARGET_HOST['<host>'] = '<DB ID>';
|
||||||
// url redirect database
|
// url redirect database
|
||||||
// $DB_URL_REDIRECT_HOST['<host>'] = "<DB ID>";
|
// $DB_URL_REDIRECT_HOST['<host>'] = '<DB ID>';
|
||||||
// location flagging
|
// location flagging
|
||||||
// test/dev/live
|
// test/dev/live
|
||||||
$LOCATION['<host>'] = '<test|live|remote|etc>';
|
$LOCATION['<host>'] = '<test|live|remote|etc>';
|
||||||
@@ -188,9 +197,9 @@ $USE_DATABASE = defined('USE_DATABASE') ? USE_DATABASE : true;
|
|||||||
// live frontend pages
|
// live frontend pages
|
||||||
// ** missing live domains **
|
// ** missing live domains **
|
||||||
// get the name without the port
|
// get the name without the port
|
||||||
list($HOST_NAME, $PORT) = array_pad(explode(":", $_SERVER['HTTP_HOST'], 2), 2, null);
|
list($HOST_NAME) = array_pad(explode(':', $_SERVER['HTTP_HOST'], 2), 2, null);
|
||||||
if (!$DB_HOST[$HOST_NAME] && $USE_DATABASE) {
|
if (!$DB_HOST[$HOST_NAME] && $USE_DATABASE) {
|
||||||
echo "No matching DB config found. Contact Admin<br>";
|
echo 'No matching DB config found. Contact Admin<br>';
|
||||||
exit -1;
|
exit -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,11 +226,11 @@ DEFINE('SHOW_ALL_ERRORS', false); // show all errors if debug_all & show_error_h
|
|||||||
$G_TITLE = '<OVERALL PAGE TITLE>';
|
$G_TITLE = '<OVERALL PAGE TITLE>';
|
||||||
|
|
||||||
/************ STYLE SHEETS / JS **********/
|
/************ STYLE SHEETS / JS **********/
|
||||||
$EDIT_STYLESHEET = "edit.css";
|
$EDIT_STYLESHEET = 'edit.css';
|
||||||
$EDIT_JAVASCRIPT = "edit.js";
|
$EDIT_JAVASCRIPT = 'edit.js';
|
||||||
|
|
||||||
$STYLESHEET = "frontend.css";
|
$STYLESHEET = 'frontend.css';
|
||||||
$JAVASCRIPT = "frontend.js";
|
$JAVASCRIPT = 'frontend.js';
|
||||||
|
|
||||||
/************* CONVERT *******************/
|
/************* CONVERT *******************/
|
||||||
$paths = array (
|
$paths = array (
|
||||||
@@ -231,14 +240,14 @@ $paths = array (
|
|||||||
);
|
);
|
||||||
// find convert
|
// find convert
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
if (file_exists($path."/convert") && is_file($path."/convert")) {
|
if (file_exists($path.DS.'convert') && is_file($path.DS.'convert')) {
|
||||||
// image magick convert location
|
// image magick convert location
|
||||||
DEFINE('CONVERT', $path."/convert");
|
DEFINE('CONVERT', $path.DS.'convert');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn off debug if debug flag is OFF
|
// turn off debug if debug flag is OFF
|
||||||
if (DEBUG == false) {
|
if (defined('DEBUG') && DEBUG == false) {
|
||||||
$ECHO_ALL = 0;
|
$ECHO_ALL = 0;
|
||||||
$DEBUG_ALL = 0;
|
$DEBUG_ALL = 0;
|
||||||
$PRINT_ALL = 0;
|
$PRINT_ALL = 0;
|
||||||
@@ -249,27 +258,7 @@ if (DEBUG == false) {
|
|||||||
// any other global definitons here
|
// any other global definitons here
|
||||||
// DEFINE('SOME_ID', <SOME VALUE>);
|
// DEFINE('SOME_ID', <SOME VALUE>);
|
||||||
|
|
||||||
// function that will be called on top of each class include to load the class
|
// read auto loader
|
||||||
function _spl_autoload($include_file)
|
require BASE.LIB.'autoloader.php';
|
||||||
{
|
|
||||||
// where to search for the files to include
|
# __END__
|
||||||
$dirs = array (
|
|
||||||
LIBDIR,
|
|
||||||
SMARTYDIR,
|
|
||||||
TABLEARRAYDIR,
|
|
||||||
'',
|
|
||||||
LIBS,
|
|
||||||
SMARTY,
|
|
||||||
TABLE_ARRAYS,
|
|
||||||
__DIR__.'/'.LIBS,
|
|
||||||
__DIR__.'/'.SMARTY
|
|
||||||
);
|
|
||||||
// try to find and load the class ifle
|
|
||||||
foreach ($dirs as $folder) {
|
|
||||||
if (file_exists($folder.$include_file)) {
|
|
||||||
require_once($folder.$include_file);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2003/06/10
|
* CREATED: 2003/06/10
|
||||||
* SHORT DESCRIPTION:
|
* SHORT DESCRIPTION:
|
||||||
* configuration file
|
* configuration file
|
||||||
@@ -59,6 +59,8 @@ DEFINE('VIDEOS', "videos".DS);
|
|||||||
DEFINE('DOCUMENTS', "documents".DS);
|
DEFINE('DOCUMENTS', "documents".DS);
|
||||||
// files (pdfs) (below media)
|
// files (pdfs) (below media)
|
||||||
DEFINE('PDFS', "documents".DS);
|
DEFINE('PDFS', "documents".DS);
|
||||||
|
// CSV
|
||||||
|
DEFINE('CSV', 'csv'.DS);
|
||||||
// css
|
// css
|
||||||
DEFINE('CSS', "css".DS);
|
DEFINE('CSS', "css".DS);
|
||||||
// js
|
// js
|
||||||
@@ -75,6 +77,8 @@ DEFINE('CACHE', "cache".DS);
|
|||||||
DEFINE('TMP', "tmp".DS);
|
DEFINE('TMP', "tmp".DS);
|
||||||
// log files
|
// log files
|
||||||
DEFINE('LOG', 'log'.DS);
|
DEFINE('LOG', 'log'.DS);
|
||||||
|
// compiled template folder
|
||||||
|
DEFINE('TEMPLATES_C', 'templates_c'.DS);
|
||||||
// template base
|
// template base
|
||||||
DEFINE('TEMPLATES', "templates".DS);
|
DEFINE('TEMPLATES', "templates".DS);
|
||||||
// frontend template dir', only for admin
|
// frontend template dir', only for admin
|
||||||
@@ -141,6 +145,7 @@ DEFINE('MASTER_TEMPLATE_NAME', 'main_body.tpl');
|
|||||||
DEFINE('PUBLIC_SCHEMA', 'public');
|
DEFINE('PUBLIC_SCHEMA', 'public');
|
||||||
DEFINE('DEV_SCHEMA', 'public');
|
DEFINE('DEV_SCHEMA', 'public');
|
||||||
DEFINE('TEST_SCHEMA', 'public');
|
DEFINE('TEST_SCHEMA', 'public');
|
||||||
|
DEFINE('LIVE_SCHEMA', 'public');
|
||||||
|
|
||||||
// non constant part
|
// non constant part
|
||||||
/************* DB ACCESS *****************/
|
/************* DB ACCESS *****************/
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
|
|
||||||
// no session could be found at all
|
// no session could be found at all
|
||||||
if (!session_id()) {
|
if (!session_id()) {
|
||||||
echo "<b>Session not started!</b><br>Use 'session_start();'.<br>For less problems with other session, you can set a session name with 'session_name(\"name\");'.<br>";
|
echo "<b>Session not started!</b><br>Use 'session_start();'.<br>";
|
||||||
|
echo "For less problems with other session, you can set a session name with 'session_name(\"name\");'.<br>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +117,15 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
|
|
||||||
// if we have a search path we need to set it, to use the correct DB to login
|
// if we have a search path we need to set it, to use the correct DB to login
|
||||||
// check what schema to use. if there is a login schema use this, else check if there is a schema set in the config, or fall back to DB_SCHEMA if this exists, if this also does not exists use public schema
|
// check what schema to use. if there is a login schema use this, else check if there is a schema set in the config, or fall back to DB_SCHEMA if this exists, if this also does not exists use public schema
|
||||||
$SCHEMA = defined('LOGIN_DB_SCHEMA') ? LOGIN_DB_SCHEMA : ($db_config['db_schema'] ? $db_config['db_schema'] : (defined('DB_SCHEMA') ? DB_SCHEMA : 'public'));
|
if (defined('LOGIN_DB_SCHEMA')) {
|
||||||
|
$SCHEMA = LOGIN_DB_SCHEMA;
|
||||||
|
} elseif ($db_config['db_schema']) {
|
||||||
|
$SCHEMA = $db_config['db_schema'];
|
||||||
|
} elseif (defined('DB_SCHEMA')) {
|
||||||
|
$SCHEMA = DB_SCHEMA;
|
||||||
|
} else {
|
||||||
|
$SCHEMA = 'public';
|
||||||
|
}
|
||||||
// set schema if schema differs to schema set in db conneciton
|
// set schema if schema differs to schema set in db conneciton
|
||||||
if ($this->dbGetSchema() && $this->dbGetSchema() != $SCHEMA) {
|
if ($this->dbGetSchema() && $this->dbGetSchema() != $SCHEMA) {
|
||||||
$this->dbExec("SET search_path TO ".$SCHEMA);
|
$this->dbExec("SET search_path TO ".$SCHEMA);
|
||||||
@@ -244,6 +253,12 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
// DESC : checks if password is valid, sets internal error login variable
|
// DESC : checks if password is valid, sets internal error login variable
|
||||||
private function loginPasswordCheck($hash, $password = '')
|
private function loginPasswordCheck($hash, $password = '')
|
||||||
{
|
{
|
||||||
|
// check with what kind of prefix the password begins:
|
||||||
|
// $2a$ or $2y$: BLOWFISCH
|
||||||
|
// $1$: MD5
|
||||||
|
// $ and one alphanumeric letter, 13 chars long, but nor $ at the end: STD_DESC
|
||||||
|
// if no $ => normal password
|
||||||
|
// NOW, if we have a password encoded, but not the correct encoder available, throw special error
|
||||||
$password_ok = false;
|
$password_ok = false;
|
||||||
if (!$password) {
|
if (!$password) {
|
||||||
$password = $this->password;
|
$password = $this->password;
|
||||||
@@ -277,7 +292,7 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
!preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) &&
|
!preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) &&
|
||||||
$hash != $password
|
$hash != $password
|
||||||
) {
|
) {
|
||||||
// check old plain password, non case sensitive
|
// check old plain password, case sensitive
|
||||||
$this->login_error = 1012;
|
$this->login_error = 1012;
|
||||||
$password_ok = false;
|
$password_ok = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -300,11 +315,13 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$this->login_error = 102;
|
$this->login_error = 102;
|
||||||
} else {
|
} else {
|
||||||
// we have to get the themes in here too
|
// we have to get the themes in here too
|
||||||
$q = "SELECT eu.edit_user_id, username, password, eu.edit_group_id, eg.name AS edit_group_name, admin, eu.login_error_count, eu.login_error_date_last, eu.login_error_date_first, eu.strict, eu.locked, ";
|
$q = "SELECT eu.edit_user_id, username, password, eu.edit_group_id, eg.name AS edit_group_name, admin, ";
|
||||||
|
$q .= "eu.login_error_count, eu.login_error_date_last, eu.login_error_date_first, eu.strict, eu.locked, ";
|
||||||
$q .= "debug, db_debug, ";
|
$q .= "debug, db_debug, ";
|
||||||
$q .= "eareu.level AS user_level, eareu.type AS user_type, ";
|
$q .= "eareu.level AS user_level, eareu.type AS user_type, ";
|
||||||
$q .= "eareg.level AS group_level, eareg.type AS group_type, ";
|
$q .= "eareg.level AS group_level, eareg.type AS group_type, ";
|
||||||
$q .= "eu.enabled, el.short_name AS lang_short, el.iso_name AS lang_iso, first.header_color AS first_header_color, second.header_color AS second_header_color, second.template ";
|
$q .= "eu.enabled, el.short_name AS lang_short, el.iso_name AS lang_iso, first.header_color AS first_header_color, ";
|
||||||
|
$q .= "second.header_color AS second_header_color, second.template ";
|
||||||
$q .= "FROM edit_user eu ";
|
$q .= "FROM edit_user eu ";
|
||||||
$q .= "LEFT JOIN edit_scheme second ON (second.edit_scheme_id = eu.edit_scheme_id AND second.enabled = 1), ";
|
$q .= "LEFT JOIN edit_scheme second ON (second.edit_scheme_id = eu.edit_scheme_id AND second.enabled = 1), ";
|
||||||
$q .= "edit_language el, edit_group eg, ";
|
$q .= "edit_language el, edit_group eg, ";
|
||||||
@@ -323,13 +340,6 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
} else {
|
} else {
|
||||||
// if login errors is half of max errors and the last login error was less than 10s ago, forbid any new login try
|
// if login errors is half of max errors and the last login error was less than 10s ago, forbid any new login try
|
||||||
|
|
||||||
// check with what kind of prefix the password begins:
|
|
||||||
// $2a$ or $2y$: BLOWFISCH
|
|
||||||
// $1$: MD5
|
|
||||||
// $ and one alphanumeric letter, 13 chars long, but nor $ at the end: STD_DESC
|
|
||||||
// if no $ => normal password
|
|
||||||
// NOW, if we have a password encoded, but not the correct encoder available, throw special error
|
|
||||||
|
|
||||||
// check flow
|
// check flow
|
||||||
// - user is enabled
|
// - user is enabled
|
||||||
// - user is not locked
|
// - user is not locked
|
||||||
@@ -382,7 +392,8 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$pages = array();
|
$pages = array();
|
||||||
$edit_page_ids = array();
|
$edit_page_ids = array();
|
||||||
// set pages access
|
// set pages access
|
||||||
$q = "SELECT ep.edit_page_id, filename, ep.name AS edit_page_name, ep.order_number AS edit_page_order, menu, popup, popup_x, popup_y, online, ear.level, ear.type ";
|
$q = "SELECT ep.edit_page_id, filename, ep.name AS edit_page_name, ep.order_number AS edit_page_order, menu, ";
|
||||||
|
$q .= "popup, popup_x, popup_y, online, ear.level, ear.type ";
|
||||||
$q .= "FROM edit_page ep, edit_page_access epa, edit_access_right ear ";
|
$q .= "FROM edit_page ep, edit_page_access epa, edit_access_right ear ";
|
||||||
$q .= "WHERE ep.edit_page_id = epa.edit_page_id AND ear.edit_access_right_id = epa.edit_access_right_id ";
|
$q .= "WHERE ep.edit_page_id = epa.edit_page_id AND ear.edit_access_right_id = epa.edit_access_right_id ";
|
||||||
$q .= "AND epa.enabled = 1 AND epa.edit_group_id = ".$res["edit_group_id"]." ";
|
$q .= "AND epa.enabled = 1 AND epa.edit_group_id = ".$res["edit_group_id"]." ";
|
||||||
@@ -1069,7 +1080,9 @@ EOM;
|
|||||||
$q .= "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) ";
|
$q .= "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) ";
|
||||||
$q .= "VALUES ('".$this->dbEscapeString($username)."', 'PASSWORD', ".(($this->euid) ? $this->euid : 'NULL').", ";
|
$q .= "VALUES ('".$this->dbEscapeString($username)."', 'PASSWORD', ".(($this->euid) ? $this->euid : 'NULL').", ";
|
||||||
$q .= "NOW(), '".$this->dbEscapeString($event)."', '".$this->dbEscapeString($error)."', '".$this->dbEscapeString($data)."', '".$data_binary."', '".$this->page_name."', ";
|
$q .= "NOW(), '".$this->dbEscapeString($event)."', '".$this->dbEscapeString($error)."', '".$this->dbEscapeString($data)."', '".$data_binary."', '".$this->page_name."', ";
|
||||||
foreach (array('REMOTE_ADDR', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'SCRIPT_FILENAME', 'QUERY_STRING', 'SERVER_NAME', 'HTTP_HOST', 'HTTP_ACCEPT', 'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT_ENCODING') as $server_code) {
|
foreach (array(
|
||||||
|
'REMOTE_ADDR', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'SCRIPT_FILENAME', 'QUERY_STRING', 'SERVER_NAME', 'HTTP_HOST', 'HTTP_ACCEPT', 'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT_ENCODING'
|
||||||
|
) as $server_code) {
|
||||||
if (array_key_exists($server_code, $_SERVER)) {
|
if (array_key_exists($server_code, $_SERVER)) {
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER[$server_code])."', ";
|
$q .= "'".$this->dbEscapeString($_SERVER[$server_code])."', ";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1112,6 +1112,37 @@ class Basic
|
|||||||
return $ret_array;
|
return $ret_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// METHOD: arrayToString
|
||||||
|
// WAS : ArrayToString
|
||||||
|
// PARAMS: array, connect char
|
||||||
|
// RETRUN: string
|
||||||
|
// DESC : wrapper for join, but checks if input is an array and if not returns null
|
||||||
|
public static function arrayToString($array, $connect_char)
|
||||||
|
{
|
||||||
|
if (is_array($array)) {
|
||||||
|
return join($connect_char, $array);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// METHOD: flattenArray
|
||||||
|
// PARAMS: array in multi dimensions
|
||||||
|
// RETURN: returns a flatten array
|
||||||
|
// DESC : converts multi dimensional array to a flat array
|
||||||
|
// does NOT preserve keys
|
||||||
|
public static function flattenArray(array $array)
|
||||||
|
{
|
||||||
|
$return = array();
|
||||||
|
array_walk_recursive(
|
||||||
|
$array,
|
||||||
|
function ($a) use (&$return) {
|
||||||
|
$return[] = $a;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
// METHOD: __mbMimeEncode
|
// METHOD: __mbMimeEncode
|
||||||
// WAS : _mb_mime_encode
|
// WAS : _mb_mime_encode
|
||||||
// PARAMS: string to encode, encoding to encode in
|
// PARAMS: string to encode, encoding to encode in
|
||||||
@@ -1245,17 +1276,20 @@ class Basic
|
|||||||
// xd xh xm xs xms to a timestamp.microtime format
|
// xd xh xm xs xms to a timestamp.microtime format
|
||||||
public static function stringToTime($timestring)
|
public static function stringToTime($timestring)
|
||||||
{
|
{
|
||||||
$timestamp = '';
|
$timestamp = 0;
|
||||||
if (preg_match("/(d|h|m|s|ms)/", $timestring)) {
|
if (preg_match("/(d|h|m|s|ms)/", $timestring)) {
|
||||||
$timegroups = array (1 => 86400, 3 => 3600, 5 => 60, 7 => 1);
|
// pos for preg match read + multiply factor
|
||||||
|
$timegroups = array (2 => 86400, 4 => 3600, 6 => 60, 8 => 1);
|
||||||
|
// preg match: 0: full strsing
|
||||||
|
// 2, 4, 6, 8 are the to need values
|
||||||
preg_match("/^((\d+)d ?)?((\d+)h ?)?((\d+)m ?)?((\d+)s ?)?((\d+)ms)?$/", $timestring, $matches);
|
preg_match("/^((\d+)d ?)?((\d+)h ?)?((\d+)m ?)?((\d+)s ?)?((\d+)ms)?$/", $timestring, $matches);
|
||||||
// multiply the returned matches and sum them up. the last one (ms) is added with .
|
// multiply the returned matches and sum them up. the last one (ms) is added with .
|
||||||
for ($i = 1; $i <= 7; $i += 2) {
|
foreach ($timegroups as $i => $time_multiply) {
|
||||||
if ($matches[$i]) {
|
if (is_numeric($matches[$i])) {
|
||||||
$timestamp += ($matches[($i + 1)] * $timegroups[$i]);
|
$timestamp += $matches[$i] * $time_multiply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($matches[10]) {
|
if (is_numeric($matches[10])) {
|
||||||
$timestamp .= '.'.$matches[10];
|
$timestamp .= '.'.$matches[10];
|
||||||
}
|
}
|
||||||
return $timestamp;
|
return $timestamp;
|
||||||
@@ -1370,20 +1404,6 @@ class Basic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD: arrayToString
|
|
||||||
// WAS : ArrayToString
|
|
||||||
// PARAMS: array, connect char
|
|
||||||
// RETRUN: string
|
|
||||||
// DESC : wrapper for join, but checks if input is an array and if not returns null
|
|
||||||
public static function arrayToString($array, $connect_char)
|
|
||||||
{
|
|
||||||
if (is_array($array)) {
|
|
||||||
return join($connect_char, $array);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// METHOD: createThumbnail
|
// METHOD: createThumbnail
|
||||||
// WAS : CreateThumbnail
|
// WAS : CreateThumbnail
|
||||||
// PARAMS: pic -> picture where from we create a thumbnail
|
// PARAMS: pic -> picture where from we create a thumbnail
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ class IO extends \CoreLibs\Basic
|
|||||||
// write detailed error log
|
// write detailed error log
|
||||||
}
|
}
|
||||||
if ($this->warning_id) {
|
if ($this->warning_id) {
|
||||||
$this->__dbDebug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$this->warning_id.': '.$this->error_string[$this->warning_id].($msg ? ', '.$msg : '').'</span>', 'DB_ERROR', $where_called);
|
$this->__dbDebug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$this->warning_id.': '.$this->error_string[$this->warning_id].($msg ? ', '.$msg : '').'</span>', 'DB_WARNING', $where_called);
|
||||||
$this->had_warning = $this->warning_id;
|
$this->had_warning = $this->warning_id;
|
||||||
}
|
}
|
||||||
// unset the error/warning vars
|
// unset the error/warning vars
|
||||||
|
|||||||
Reference in New Issue
Block a user