Update from PSR-2 to PSR-12
- Tabs are indent - Warning at 120, Error at 240 char length
This commit is contained in:
+3
-2
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Phan\Config;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This configuration will be read and overlaid on top of the
|
* This configuration will be read and overlaid on top of the
|
||||||
* default configuration. Command line arguments will be applied
|
* default configuration. Command line arguments will be applied
|
||||||
@@ -24,6 +22,9 @@ use Phan\Config;
|
|||||||
* of the phan executable or a path passed in via the CLI
|
* of the phan executable or a path passed in via the CLI
|
||||||
* '-d' flag.
|
* '-d' flag.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Phan\Config;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// If true, missing properties will be created when
|
// If true, missing properties will be created when
|
||||||
// they are first seen. If false, we'll report an
|
// they are first seen. If false, we'll report an
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# PHP Core Library
|
# PHP Core Library
|
||||||
|
|
||||||
|
## Code Standard
|
||||||
|
|
||||||
|
* Uses PSR-12
|
||||||
|
* tab indent instead of 4 spaces indent
|
||||||
|
* Warning at 120 character length, error at 240 character length
|
||||||
|
|
||||||
|
## General information
|
||||||
|
|
||||||
Base PHP class files to setup any project
|
Base PHP class files to setup any project
|
||||||
* login
|
* login
|
||||||
* database wrapper
|
* database wrapper
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Boostrap file for PHPstand
|
// Boostrap file for PHPstand
|
||||||
// sets the _SERVER['HTTP_HOST'] var so we can have DB detection
|
// sets the _SERVER['HTTP_HOST'] var so we can have DB detection
|
||||||
$_SERVER['HTTP_HOST'] = 'soba.tokyo.tequila.jp';
|
$_SERVER['HTTP_HOST'] = 'soba.tokyo.tequila.jp';
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
$PRINT_ALL = true;
|
$PRINT_ALL = true;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -56,13 +58,17 @@ $test_array = [
|
|||||||
|
|
||||||
echo "SOURCE ARRAY: " . DgS::printAr($test_array) . "<br>";
|
echo "SOURCE ARRAY: " . DgS::printAr($test_array) . "<br>";
|
||||||
// frist return
|
// frist return
|
||||||
echo "ARRAYSEARCHRECURSIVE(email, [array], type): ".DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array, 'type'))."<br>";
|
echo "ARRAYSEARCHRECURSIVE(email, [array], type): "
|
||||||
echo "ARRAYSEARCHRECURSIVE(email, [array]['input'], type): ".DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array['input'], 'type'))."<br>";
|
. DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array, 'type')) . "<br>";
|
||||||
|
echo "ARRAYSEARCHRECURSIVE(email, [array]['input'], type): "
|
||||||
|
. DgS::printAr(ArrayHandler::arraySearchRecursive('email', $test_array['input'], 'type')) . "<br>";
|
||||||
// all return
|
// all return
|
||||||
echo "ARRAYSEARCHRECURSIVEALL(email, [array], type): ".Dgs::printAr((array)ArrayHandler::arraySearchRecursiveAll('email', $test_array, 'type'))."<br>";
|
echo "ARRAYSEARCHRECURSIVEALL(email, [array], type): "
|
||||||
|
. Dgs::printAr((array)ArrayHandler::arraySearchRecursiveAll('email', $test_array, 'type')) . "<br>";
|
||||||
|
|
||||||
// simple search
|
// simple search
|
||||||
echo "ARRAYSEARCHSIMPLE([array], type, email): ".(string)ArrayHandler::arraySearchSimple($test_array, 'type', 'email')."<br>";
|
echo "ARRAYSEARCHSIMPLE([array], type, email): "
|
||||||
|
. (string)ArrayHandler::arraySearchSimple($test_array, 'type', 'email') . "<br>";
|
||||||
|
|
||||||
$array_1 = [
|
$array_1 = [
|
||||||
'foo' => 'bar'
|
'foo' => 'bar'
|
||||||
@@ -111,7 +117,8 @@ function rec(string $pre, string $cur, array $node = [])
|
|||||||
if (!is_array($node)) {
|
if (!is_array($node)) {
|
||||||
$node = [];
|
$node = [];
|
||||||
}
|
}
|
||||||
print "<div style='color: green;'>#### PRE: ".$pre.", CUR: ".$cur.", N-c: ".count($node)." [".join('|', array_keys($node))."]</div>";
|
print "<div style='color: green;'>#### PRE: " . $pre . ", CUR: " . $cur . ", N-c: "
|
||||||
|
. count($node) . " [" . join('|', array_keys($node)) . "]</div>";
|
||||||
if (!$pre) {
|
if (!$pre) {
|
||||||
print "** <span style='color: red;'>NEW</span><br>";
|
print "** <span style='color: red;'>NEW</span><br>";
|
||||||
$node[$cur] = [];
|
$node[$cur] = [];
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -51,11 +53,15 @@ print "S::COLOR rgb->hex: $rgb[0], $rgb[1], $rgb[2]: ".Colors::rgb2hex($rgb[0],
|
|||||||
print "S::COLOR hex->rgb: $hex: " . DgS::printAr(Colors::hex2rgb($hex)) . "<br>";
|
print "S::COLOR hex->rgb: $hex: " . DgS::printAr(Colors::hex2rgb($hex)) . "<br>";
|
||||||
print "C::S/COLOR rgb->hext: $hex: " . DgS::printAr(CoreLibs\Convert\Colors::hex2rgb($hex)) . "<br>";
|
print "C::S/COLOR rgb->hext: $hex: " . DgS::printAr(CoreLibs\Convert\Colors::hex2rgb($hex)) . "<br>";
|
||||||
// C(to hsb/hsl)
|
// C(to hsb/hsl)
|
||||||
print "S::COLOR rgb->hsb: $rgb[0], $rgb[1], $rgb[2]: ".DgS::printAr(Colors::rgb2hsb($rgb[0], $rgb[1], $rgb[2]))."<br>";
|
print "S::COLOR rgb->hsb: $rgb[0], $rgb[1], $rgb[2]: "
|
||||||
print "S::COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: ".DgS::printAr(Colors::rgb2hsl($rgb[0], $rgb[1], $rgb[2]))."<br>";
|
. DgS::printAr(Colors::rgb2hsb($rgb[0], $rgb[1], $rgb[2])) . "<br>";
|
||||||
|
print "S::COLOR rgb->hsl: $rgb[0], $rgb[1], $rgb[2]: "
|
||||||
|
. DgS::printAr(Colors::rgb2hsl($rgb[0], $rgb[1], $rgb[2])) . "<br>";
|
||||||
// D(from hsb/hsl) Note that param 2 + 3 is always 0-100 divided
|
// D(from hsb/hsl) Note that param 2 + 3 is always 0-100 divided
|
||||||
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: ".DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2]))."<br>";
|
print "S::COLOR hsb->rgb: $hsb[0], $hsb[1], $hsb[2]: "
|
||||||
print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: ".DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2]))."<br>";
|
. DgS::printAr(Colors::hsb2rgb($hsb[0], $hsb[1], $hsb[2])) . "<br>";
|
||||||
|
print "S::COLOR hsl->rgb: $hsl[0], $hsl[1], $hsl[2]: "
|
||||||
|
. DgS::printAr(Colors::hsl2rgb($hsl[0], $hsl[1], $hsl[2])) . "<br>";
|
||||||
|
|
||||||
// TODO: run compare check input must match output
|
// TODO: run compare check input must match output
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -99,7 +102,8 @@ $compare_dates = [
|
|||||||
];
|
];
|
||||||
// compareDate
|
// compareDate
|
||||||
foreach ($compare_dates as $compare_date) {
|
foreach ($compare_dates as $compare_date) {
|
||||||
print "COMPAREDATE: $compare_date[0] = $compare_date[1]: ".(string)DateTime::compareDate($compare_date[0], $compare_date[1])."<br>";
|
print "COMPAREDATE: $compare_date[0] = $compare_date[1]: "
|
||||||
|
. (string)DateTime::compareDate($compare_date[0], $compare_date[1]) . "<br>";
|
||||||
}
|
}
|
||||||
$compare_datetimes = [
|
$compare_datetimes = [
|
||||||
[ '2021-05-01', '2021-05-02', ],
|
[ '2021-05-01', '2021-05-02', ],
|
||||||
@@ -110,7 +114,8 @@ $compare_datetimes = [
|
|||||||
[ '2021-05-01 10:00:00', '2021-05-01 10:00:00', ],
|
[ '2021-05-01 10:00:00', '2021-05-01 10:00:00', ],
|
||||||
];
|
];
|
||||||
foreach ($compare_datetimes as $compare_datetime) {
|
foreach ($compare_datetimes as $compare_datetime) {
|
||||||
print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: ".(string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1])."<br>";
|
print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: "
|
||||||
|
. (string)DateTime::compareDateTime($compare_datetime[0], $compare_datetime[1]) . "<br>";
|
||||||
}
|
}
|
||||||
$compare_dates = [
|
$compare_dates = [
|
||||||
[ '2021-05-01', '2021-05-10', ],
|
[ '2021-05-01', '2021-05-10', ],
|
||||||
@@ -119,8 +124,10 @@ $compare_dates = [
|
|||||||
[ '2021-05-02', '2021-05-02', ],
|
[ '2021-05-02', '2021-05-02', ],
|
||||||
];
|
];
|
||||||
foreach ($compare_dates as $compare_date) {
|
foreach ($compare_dates as $compare_date) {
|
||||||
print "CALCDAYSINTERVAL: $compare_date[0] = $compare_date[1]: ".DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1]))."<br>";
|
print "CALCDAYSINTERVAL: $compare_date[0] = $compare_date[1]: "
|
||||||
print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true))."<br>";
|
. DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1])) . "<br>";
|
||||||
|
print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: "
|
||||||
|
. DgS::printAr(DateTime::calcDaysInterval($compare_date[0], $compare_date[1], true)) . "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
@@ -135,11 +142,14 @@ print "CHECKDATE: $check_date: ".(string)$basic->checkDate($check_date)."<br>";
|
|||||||
$check_datetime = '2021-05-01 12:13:14';
|
$check_datetime = '2021-05-01 12:13:14';
|
||||||
print "CHECKDATETIME: $check_datetime: ".(string)$basic->checkDateTime($check_datetime)."<br>";
|
print "CHECKDATETIME: $check_datetime: ".(string)$basic->checkDateTime($check_datetime)."<br>";
|
||||||
$compare_date = ['2021-05-01', '2021-05-02'];
|
$compare_date = ['2021-05-01', '2021-05-02'];
|
||||||
print "COMPAREDATE: $compare_date[0] = $compare_date[1]: ".(string)$basic->compareDate($compare_date[0], $compare_date[1])."<br>";
|
print "COMPAREDATE: $compare_date[0] = $compare_date[1]: "
|
||||||
|
. (string)$basic->compareDate($compare_date[0], $compare_date[1])."<br>";
|
||||||
$compare_datetime = ['2021-05-01 10:00:00', '2021-05-01 11:00:00'];
|
$compare_datetime = ['2021-05-01 10:00:00', '2021-05-01 11:00:00'];
|
||||||
print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: ".(string)$basic->compareDateTime($compare_datetime[0], $compare_datetime[1])."<br>";
|
print "COMPAREDATE: $compare_datetime[0] = $compare_datetime[1]: "
|
||||||
|
. (string)$basic->compareDateTime($compare_datetime[0], $compare_datetime[1])."<br>";
|
||||||
$compare_date = ['2021-05-01', '2021-05-10'];
|
$compare_date = ['2021-05-01', '2021-05-10'];
|
||||||
print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: ".DgS::printAr($basic->calcDaysInterval($compare_date[0], $compare_date[1], true))."<br>"; */
|
print "CALCDAYSINTERVAL(named): $compare_date[0] = $compare_date[1]: "
|
||||||
|
. DgS::printAr($basic->calcDaysInterval($compare_date[0], $compare_date[1], true))."<br>"; */
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
print $basic->log->printErrorMsg();
|
print $basic->log->printErrorMsg();
|
||||||
|
|||||||
+68
-13
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
$PRINT_ALL = true;
|
$PRINT_ALL = true;
|
||||||
@@ -67,7 +69,8 @@ print "DIRECT INSERT STATUS: $status | "
|
|||||||
|
|
||||||
// should throw deprecated error
|
// should throw deprecated error
|
||||||
// $db->getReturningExt();
|
// $db->getReturningExt();
|
||||||
print "DIRECT INSERT PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->dbGetInsertPK()), true)."<br>";
|
print "DIRECT INSERT PREVIOUS INSERTED: "
|
||||||
|
. print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = " . $db->dbGetInsertPK()), true) . "<br>";
|
||||||
$db->dbPrepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)");
|
$db->dbPrepare("ins_foo", "INSERT INTO foo (test) VALUES ($1)");
|
||||||
$status = $db->dbExecute("ins_foo", array('BAR TEST ' . time()));
|
$status = $db->dbExecute("ins_foo", array('BAR TEST ' . time()));
|
||||||
print "PREPARE INSERT STATUS: $status | "
|
print "PREPARE INSERT STATUS: $status | "
|
||||||
@@ -75,10 +78,23 @@ print "PREPARE INSERT STATUS: $status | "
|
|||||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||||
. "RETURNING RETURN: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
. "RETURNING RETURN: " . print_r($db->dbGetReturningArray(), true) . "<br>";
|
||||||
|
|
||||||
print "PREPARE INSERT PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->dbGetInsertPK()), true)."<br>";
|
print "PREPARE INSERT PREVIOUS INSERTED: "
|
||||||
|
. print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = " . $db->dbGetInsertPK()), true) . "<br>";
|
||||||
// returning test with multiple entries
|
// returning test with multiple entries
|
||||||
// $status = $db->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id");
|
// $status = $db->db_exec(
|
||||||
$status = $db->dbExec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test");
|
// "INSERT INTO foo (test) VALUES "
|
||||||
|
// . "('BAR 1 " . time() . "'), "
|
||||||
|
// . "('BAR 2 " . time() . "'), "
|
||||||
|
// . "('BAR 3 " . time() . "') "
|
||||||
|
// . "RETURNING foo_id"
|
||||||
|
// );
|
||||||
|
$status = $db->dbExec(
|
||||||
|
"INSERT INTO foo (test) VALUES "
|
||||||
|
. "('BAR 1 " . time() . "'), "
|
||||||
|
. "('BAR 2 " . time() . "'), "
|
||||||
|
. "('BAR 3 " . time() . "') "
|
||||||
|
. "RETURNING foo_id, test"
|
||||||
|
);
|
||||||
print "DIRECT MULTIPLE INSERT STATUS: $status | "
|
print "DIRECT MULTIPLE INSERT STATUS: $status | "
|
||||||
. "PRIMARY KEYS: " . print_r($db->dbGetInsertPK(), true) . " | "
|
. "PRIMARY KEYS: " . print_r($db->dbGetInsertPK(), true) . " | "
|
||||||
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
. "RETURNING EXT: " . print_r($db->dbGetReturningExt(), true) . " | "
|
||||||
@@ -99,7 +115,13 @@ print "UPDATE STATUS: $status | "
|
|||||||
print "</pre>";
|
print "</pre>";
|
||||||
|
|
||||||
// REEAD PREPARE
|
// REEAD PREPARE
|
||||||
if ($db->dbPrepare('sel_foo', "SELECT foo_id, test, some_bool, string_a, number_a, number_a_numeric, some_time FROM foo ORDER BY foo_id DESC LIMIT 5") === false) {
|
if (
|
||||||
|
$db->dbPrepare(
|
||||||
|
'sel_foo',
|
||||||
|
"SELECT foo_id, test, some_bool, string_a, number_a, number_a_numeric, some_time "
|
||||||
|
. "FROM foo ORDER BY foo_id DESC LIMIT 5"
|
||||||
|
) === false
|
||||||
|
) {
|
||||||
print "Error in sel_foo prepare<br>";
|
print "Error in sel_foo prepare<br>";
|
||||||
} else {
|
} else {
|
||||||
$max_rows = 6;
|
$max_rows = 6;
|
||||||
@@ -124,16 +146,44 @@ $db_write_table = array('test', 'string_a', 'number_a', 'some_bool');
|
|||||||
$object_fields_not_touch = array();
|
$object_fields_not_touch = array();
|
||||||
$object_fields_not_update = array();
|
$object_fields_not_update = array();
|
||||||
$data = array('test' => 'BOOL TEST SOMETHING ' . time(), 'string_a' => 'SOME TEXT', 'number_a' => 5);
|
$data = array('test' => 'BOOL TEST SOMETHING ' . time(), 'string_a' => 'SOME TEXT', 'number_a' => 5);
|
||||||
$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
|
$primary_key = $db->dbWriteDataExt(
|
||||||
|
$db_write_table,
|
||||||
|
$primary_key,
|
||||||
|
$table,
|
||||||
|
$object_fields_not_touch,
|
||||||
|
$object_fields_not_update,
|
||||||
|
$data
|
||||||
|
);
|
||||||
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
||||||
$data = array('test' => 'BOOL TEST ON ' . time(), 'string_a' => '', 'number_a' => 0, 'some_bool' => 1);
|
$data = array('test' => 'BOOL TEST ON ' . time(), 'string_a' => '', 'number_a' => 0, 'some_bool' => 1);
|
||||||
$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
|
$primary_key = $db->dbWriteDataExt(
|
||||||
|
$db_write_table,
|
||||||
|
$primary_key,
|
||||||
|
$table,
|
||||||
|
$object_fields_not_touch,
|
||||||
|
$object_fields_not_update,
|
||||||
|
$data
|
||||||
|
);
|
||||||
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
||||||
$data = array('test' => 'BOOL TEST OFF ' . time(), 'string_a' => null, 'number_a' => null, 'some_bool' => 0);
|
$data = array('test' => 'BOOL TEST OFF ' . time(), 'string_a' => null, 'number_a' => null, 'some_bool' => 0);
|
||||||
$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
|
$primary_key = $db->dbWriteDataExt(
|
||||||
|
$db_write_table,
|
||||||
|
$primary_key,
|
||||||
|
$table,
|
||||||
|
$object_fields_not_touch,
|
||||||
|
$object_fields_not_update,
|
||||||
|
$data
|
||||||
|
);
|
||||||
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
||||||
$data = array('test' => 'BOOL TEST UNSET ' . time());
|
$data = array('test' => 'BOOL TEST UNSET ' . time());
|
||||||
$primary_key = $db->dbWriteDataExt($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
|
$primary_key = $db->dbWriteDataExt(
|
||||||
|
$db_write_table,
|
||||||
|
$primary_key,
|
||||||
|
$table,
|
||||||
|
$object_fields_not_touch,
|
||||||
|
$object_fields_not_update,
|
||||||
|
$data
|
||||||
|
);
|
||||||
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
|
||||||
|
|
||||||
// return Array Test
|
// return Array Test
|
||||||
@@ -172,7 +222,8 @@ while (($ret = $db->dbCheckAsync()) === true)
|
|||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
print "<br>END STATUS: " . $ret . " | PK: " . $db->insert_id . "<br>";
|
print "<br>END STATUS: " . $ret . " | PK: " . $db->insert_id . "<br>";
|
||||||
print "ASYNC PREVIOUS INSERTED: ".print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = ".$db->insert_id), true)."<br>"; */
|
print "ASYNC PREVIOUS INSERTED: "
|
||||||
|
. print_r($db->dbReturnRow("SELECT foo_id, test FROM foo WHERE foo_id = " . $db->insert_id), true) . "<br>"; */
|
||||||
|
|
||||||
$to_db_version = '9.1.9';
|
$to_db_version = '9.1.9';
|
||||||
print "VERSION DB: " . $db->dbVersion() . "<br>";
|
print "VERSION DB: " . $db->dbVersion() . "<br>";
|
||||||
@@ -200,8 +251,12 @@ $data = $db->dbFetchArray($cursor)['search_path'];
|
|||||||
print "RETURN DATA FOR search_path: " . $data . "<br>";
|
print "RETURN DATA FOR search_path: " . $data . "<br>";
|
||||||
// print "RETURN DATA FOR search_path: " . DgS::printAr($data) . "<br>";
|
// print "RETURN DATA FOR search_path: " . DgS::printAr($data) . "<br>";
|
||||||
// insert something into test.schema_test and see if we get the PK back
|
// insert something into test.schema_test and see if we get the PK back
|
||||||
$status = $db->dbExec("INSERT INTO test.schema_test (contents, id) VALUES ('TIME: ".time()."', ".rand(1, 10).")");
|
$status = $db->dbExec(
|
||||||
print "OTHER SCHEMA INSERT STATUS: ".$status." | PK NAME: ".$db->pk_name.", PRIMARY KEY: ".$db->insert_id."<br>";
|
"INSERT INTO test.schema_test (contents, id) VALUES "
|
||||||
|
. "('TIME: " . time() . "', " . rand(1, 10) . ")"
|
||||||
|
);
|
||||||
|
print "OTHER SCHEMA INSERT STATUS: "
|
||||||
|
. $status . " | PK NAME: " . $db->pk_name . ", PRIMARY KEY: " . $db->insert_id . "<br>";
|
||||||
|
|
||||||
print "<b>NULL TEST DB READ</b><br>";
|
print "<b>NULL TEST DB READ</b><br>";
|
||||||
$q = "SELECT uid, null_varchar, null_int FROM test_null_data WHERE uid = 'A'";
|
$q = "SELECT uid, null_varchar, null_int FROM test_null_data WHERE uid = 'A'";
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// all the settings are overruled by config
|
// all the settings are overruled by config
|
||||||
$DEBUG_ALL_OVERRIDE = true; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = true; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
@@ -92,7 +94,8 @@ class TestR extends TestL
|
|||||||
print "** GETCALLERCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
print "** GETCALLERCLASS(INSIDE EXTND CLASS): " . \CoreLibs\Debug\Support::getCallerClass() . "<br>";
|
||||||
$this->log->debug('TESTR', 'Logging in class testR (extends testL)');
|
$this->log->debug('TESTR', 'Logging in class testR (extends testL)');
|
||||||
$this->test('TESTR INSIDE');
|
$this->test('TESTR INSIDE');
|
||||||
$this->log->debug('TESTR', 'Array: '.$this->log->prAr(['a', 'b']).', Other: '.$this->log->prAr(['a', 'b']));
|
$this->log->debug('TESTR', 'Array: '
|
||||||
|
. $this->log->prAr(['a', 'b']) . ', Other: ' . $this->log->prAr(['a', 'b']));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -62,7 +65,8 @@ foreach ($enc_strings as $_string) {
|
|||||||
print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
|
print "ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
|
||||||
print "CONV ENCODING: $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
print "CONV ENCODING: $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
||||||
print "CONV ENCODING (s): $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
print "CONV ENCODING (s): $_string: " . $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
||||||
print "CONV ENCODING (s,a-false): $_string: ".$_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false)."<br>";
|
print "CONV ENCODING (s,a-false): $_string: "
|
||||||
|
. $_encoding->convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
|
||||||
}
|
}
|
||||||
print "ERROR CHAR: " . $_encoding->getErrorChar() . "<br>";
|
print "ERROR CHAR: " . $_encoding->getErrorChar() . "<br>";
|
||||||
// static
|
// static
|
||||||
@@ -71,8 +75,10 @@ foreach ($enc_strings as $_string) {
|
|||||||
$string = $encoding_class::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
$string = $encoding_class::checkConvertEncoding($_string, 'UTF-8', 'ISO-2022-JP-MS');
|
||||||
print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
|
print "S::ENC CHECK: $_string: " . ($string === false ? '-OK-' : $string) . "<br>";
|
||||||
print "S::CONV ENCODING: $_string: " . $encoding_class::convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
print "S::CONV ENCODING: $_string: " . $encoding_class::convertEncoding($_string, 'ISO-2022-JP') . "<br>";
|
||||||
print "S::CONV ENCODING (s): $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8')."<br>";
|
print "S::CONV ENCODING (s): $_string: "
|
||||||
print "S::CONV ENCODING (s,a-false): $_string: ".$encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false)."<br>";
|
. $encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8') . "<br>";
|
||||||
|
print "S::CONV ENCODING (s,a-false): $_string: "
|
||||||
|
. $encoding_class::convertEncoding($_string, 'ISO-2022-JP', 'UTF-8', false) . "<br>";
|
||||||
}
|
}
|
||||||
print "S::ERROR CHAR: " . $encoding_class::getErrorChar() . "<br>";
|
print "S::ERROR CHAR: " . $encoding_class::getErrorChar() . "<br>";
|
||||||
// static use
|
// static use
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -46,13 +48,15 @@ $string = "Something < = > Other <br> Next line";
|
|||||||
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . "<br>";
|
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . "<br>";
|
||||||
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
|
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "<br>";
|
||||||
$date_str = [2021, 5, 1, 11, 10];
|
$date_str = [2021, 5, 1, 11, 10];
|
||||||
print "PRINTDATETIME: ".$_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."<br>";
|
print "PRINTDATETIME: "
|
||||||
|
. $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>";
|
||||||
// STATIC
|
// STATIC
|
||||||
$string = "Something < = > Other <br> Next line";
|
$string = "Something < = > Other <br> Next line";
|
||||||
print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "<br>";
|
print "S::HTMLENT: " . Html::htmlent($string) . ": " . $html_class::htmlent($string) . "<br>";
|
||||||
print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "<br>";
|
print "S::REMOVELB: " . Html::htmlent($string) . ": " . $html_class::removeLB($string) . "<br>";
|
||||||
$date_str = [2021, 5, 1, 11, 10];
|
$date_str = [2021, 5, 1, 11, 10];
|
||||||
print "S::PRINTDATETIME: ".$elements_class::printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."<br>";
|
print "S::PRINTDATETIME: "
|
||||||
|
. $elements_class::printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>";
|
||||||
|
|
||||||
// STATIC use
|
// STATIC use
|
||||||
echo "U-S::HTML ENT INT: " . Html::htmlent(5) . "<br>";
|
echo "U-S::HTML ENT INT: " . Html::htmlent(5) . "<br>";
|
||||||
@@ -89,7 +93,8 @@ foreach ($magic_links as $magic_link) {
|
|||||||
print "D/HTMLENT: $string: ".$basic->htmlent($string)."<br>";
|
print "D/HTMLENT: $string: ".$basic->htmlent($string)."<br>";
|
||||||
print "D/REMOVELB: $string: ".$basic->removeLB($string)."<br>";
|
print "D/REMOVELB: $string: ".$basic->removeLB($string)."<br>";
|
||||||
$date_str = [2021, 5, 1, 11, 10];
|
$date_str = [2021, 5, 1, 11, 10];
|
||||||
print "D/PRINTDATETIME: ".$basic->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."<br>";
|
print "D/PRINTDATETIME: "
|
||||||
|
. $basic->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4])."<br>";
|
||||||
$magic_link = 'http://www.somelink.com/?with=1234|Some Title|';
|
$magic_link = 'http://www.somelink.com/?with=1234|Some Title|';
|
||||||
print "D/MAGICLINK: ".Html::htmlent($basic->magicLinks($magic_link))."<Br>";
|
print "D/MAGICLINK: ".Html::htmlent($basic->magicLinks($magic_link))."<Br>";
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -46,13 +49,17 @@ $image = BASE.LAYOUT.CONTENT_PATH.IMAGES.'no_picture_square.jpg';
|
|||||||
// rotate image first
|
// rotate image first
|
||||||
$_image->correctImageOrientation($image);
|
$_image->correctImageOrientation($image);
|
||||||
// thumbnail tests
|
// thumbnail tests
|
||||||
echo "<div>CLASS->CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width<br><img src=".$_image->createThumbnailSimple($image, $thumb_width)."></div>";
|
echo "<div>CLASS->CREATETHUMBNAILSIMPLE: "
|
||||||
|
. basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||||
|
. $_image->createThumbnailSimple($image, $thumb_width) . "></div>";
|
||||||
// static
|
// static
|
||||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture.jpg';
|
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture.jpg';
|
||||||
// rotate image first
|
// rotate image first
|
||||||
$image_class::correctImageOrientation($image);
|
$image_class::correctImageOrientation($image);
|
||||||
// thumbnail tests
|
// thumbnail tests
|
||||||
echo "<div>S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width<br><img src=".$image_class::createThumbnailSimple($image, $thumb_width)."></div>";
|
echo "<div>S::CREATETHUMBNAILSIMPLE: "
|
||||||
|
. basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||||
|
. $image_class::createThumbnailSimple($image, $thumb_width) . "></div>";
|
||||||
|
|
||||||
echo "U-STATIC VARIOUS:<br>";
|
echo "U-STATIC VARIOUS:<br>";
|
||||||
// image thumbnail
|
// image thumbnail
|
||||||
@@ -78,15 +85,20 @@ $finfo = new finfo(FILEINFO_MIME_TYPE);
|
|||||||
foreach ($images as $image) {
|
foreach ($images as $image) {
|
||||||
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . $image;
|
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . $image;
|
||||||
list ($height, $width, $img_type) = getimagesize($image);
|
list ($height, $width, $img_type) = getimagesize($image);
|
||||||
echo "<div><b>IMAGE INFO</b>: ".$height."x".$width.", TYPE: ".$img_type." [".$finfo->file($image)."]</div>";
|
echo "<div><b>IMAGE INFO</b>: " . $height . "x" . $width . ", TYPE: "
|
||||||
|
. $img_type . " [" . $finfo->file($image) . "]</div>";
|
||||||
// rotate image first
|
// rotate image first
|
||||||
Image::correctImageOrientation($image);
|
Image::correctImageOrientation($image);
|
||||||
// thumbnail tests
|
// thumbnail tests
|
||||||
echo "<div>".basename($image).": WIDTH: $thumb_width<br><img src=".Image::createThumbnailSimple($image, $thumb_width)."></div>";
|
echo "<div>" . basename($image) . ": WIDTH: $thumb_width<br><img src="
|
||||||
echo "<div>".basename($image).": HEIGHT: $thumb_height<br><img src=".Image::createThumbnailSimple($image, 0, $thumb_height)."></div>";
|
. Image::createThumbnailSimple($image, $thumb_width) . "></div>";
|
||||||
echo "<div>".basename($image).": WIDTH/HEIGHT: $thumb_width x $thumb_height<br><img src=".Image::createThumbnailSimple($image, $thumb_width, $thumb_height)."></div>";
|
echo "<div>" . basename($image) . ": HEIGHT: $thumb_height<br><img src="
|
||||||
|
. Image::createThumbnailSimple($image, 0, $thumb_height) . "></div>";
|
||||||
|
echo "<div>" . basename($image) . ": WIDTH/HEIGHT: $thumb_width x $thumb_height<br><img src="
|
||||||
|
. Image::createThumbnailSimple($image, $thumb_width, $thumb_height) . "></div>";
|
||||||
// test with dummy
|
// test with dummy
|
||||||
echo "<div>".basename($image).": WIDTH/HEIGHT: $thumb_width x $thumb_height (+DUMMY)<br><img src=".Image::createThumbnailSimple($image, $thumb_width, $thumb_height, null, true, false)."></div>";
|
echo "<div>" . basename($image) . ": WIDTH/HEIGHT: $thumb_width x $thumb_height (+DUMMY)<br><img src="
|
||||||
|
. Image::createThumbnailSimple($image, $thumb_width, $thumb_height, null, true, false) . "></div>";
|
||||||
echo "<hr>";
|
echo "<hr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +108,8 @@ foreach ($images as $image) {
|
|||||||
// rotate image first
|
// rotate image first
|
||||||
$basic->correctImageOrientation($image);
|
$basic->correctImageOrientation($image);
|
||||||
// thumbnail tests
|
// thumbnail tests
|
||||||
echo "<div>S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width<br><img src=".$basic->createThumbnailSimple($image, $thumb_width)."></div>"; */
|
echo "<div>S::CREATETHUMBNAILSIMPLE: ".basename($image).": WIDTH: $thumb_width<br><img src="
|
||||||
|
. $basic->createThumbnailSimple($image, $thumb_width)."></div>"; */
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
print $basic->log->printErrorMsg();
|
print $basic->log->printErrorMsg();
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
$PRINT_ALL = true;
|
$PRINT_ALL = true;
|
||||||
@@ -63,7 +65,8 @@ print "<body>";
|
|||||||
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||||
|
|
||||||
print "MOBILE PHONE: " . $form->mobile_phone . "<br>";
|
print "MOBILE PHONE: " . $form->mobile_phone . "<br>";
|
||||||
print "MY PAGE NAME: ".$form->my_page_name."<br>"; // sets table array to include
|
// sets table array to include
|
||||||
|
print "MY PAGE NAME: " . $form->my_page_name . "<br>";
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
print $basic->log->printErrorMsg();
|
print $basic->log->printErrorMsg();
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
$PRINT_ALL = true;
|
$PRINT_ALL = true;
|
||||||
@@ -79,7 +81,8 @@ if (is_object($login) && isset($login->acl['unit'])) {
|
|||||||
// $basic->log->debug('SESSION', \CoreLibs\Debug\Support::printAr($_SESSION));
|
// $basic->log->debug('SESSION', \CoreLibs\Debug\Support::printAr($_SESSION));
|
||||||
|
|
||||||
print '<form method="post" name="loginlogout">';
|
print '<form method="post" name="loginlogout">';
|
||||||
print '<a href="javascript:document.loginlogout.login_logout.value=\'Logou\';document.loginlogout.submit();">Logout</a>';
|
print '<a href="javascript:document.loginlogout.login_logout.value=\'Logou\';'
|
||||||
|
. 'document.loginlogout.submit();">Logout</a>';
|
||||||
print '<input type="hidden" name="login_logout" value="">';
|
print '<input type="hidden" name="login_logout" value="">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
@@ -87,7 +90,8 @@ print '</form>';
|
|||||||
foreach (['on', 'off'] as $flag) {
|
foreach (['on', 'off'] as $flag) {
|
||||||
foreach (['debug', 'echo', 'print'] as $type) {
|
foreach (['debug', 'echo', 'print'] as $type) {
|
||||||
$prefix = $flag == 'off' ? 'NOT ' : '';
|
$prefix = $flag == 'off' ? 'NOT ' : '';
|
||||||
print $prefix.strtoupper($type).' OUT: '.\CoreLibs\Debug\Support::printAr($basic->log->getLogLevel($type, $flag)).'<br>';
|
print $prefix . strtoupper($type) . ' OUT: '
|
||||||
|
. \CoreLibs\Debug\Support::printAr($basic->log->getLogLevel($type, $flag)) . '<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (['debug', 'echo', 'print'] as $type) {
|
foreach (['debug', 'echo', 'print'] as $type) {
|
||||||
@@ -103,7 +107,16 @@ if (is_object($login)) {
|
|||||||
$basic->log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::printAr($login->acl));
|
$basic->log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::printAr($login->acl));
|
||||||
// print "DEFAULT ACL: <br>".$basic->print_ar($login->default_acl_list)."<br>";
|
// print "DEFAULT ACL: <br>".$basic->print_ar($login->default_acl_list)."<br>";
|
||||||
// print "DEFAULT ACL: <br>".$basic->print_ar($login->default_acl_list)."<br>";
|
// print "DEFAULT ACL: <br>".$basic->print_ar($login->default_acl_list)."<br>";
|
||||||
// $result = array_flip(array_filter(array_flip($login->default_acl_list), function ($key) { if (is_numeric($key)) return $key; }));
|
// $result = array_flip(
|
||||||
|
// array_filter(
|
||||||
|
// array_flip($login->default_acl_list),
|
||||||
|
// function ($key) {
|
||||||
|
// if (is_numeric($key)) {
|
||||||
|
// return $key;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// );
|
||||||
// print "DEFAULT ACL: <br>".$basic->print_ar($result)."<br>";
|
// print "DEFAULT ACL: <br>".$basic->print_ar($result)."<br>";
|
||||||
// DEPRICATED CALL
|
// DEPRICATED CALL
|
||||||
// $basic->adbSetACL($login->acl);
|
// $basic->adbSetACL($login->acl);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -49,7 +52,8 @@ print "MIN/S: $min_version_s: ".(string)$_phpv->checkPHPVersion($min_version_s).
|
|||||||
print "MIN/SS: $min_version_ss: " . (string)$_phpv->checkPHPVersion($min_version_ss) . "<br>";
|
print "MIN/SS: $min_version_ss: " . (string)$_phpv->checkPHPVersion($min_version_ss) . "<br>";
|
||||||
// static
|
// static
|
||||||
print "S::MIN: $min_version: " . (string)$phpv_class::checkPHPVersion($min_version) . "<br>";
|
print "S::MIN: $min_version: " . (string)$phpv_class::checkPHPVersion($min_version) . "<br>";
|
||||||
print "S::MIN/MAX: $min_version/$max_version: ".(string)$phpv_class::checkPHPVersion($min_version, $max_version)."<br>";
|
print "S::MIN/MAX: $min_version/$max_version: "
|
||||||
|
. (string)$phpv_class::checkPHPVersion($min_version, $max_version) . "<br>";
|
||||||
print "S::MIN/S: $min_version_s: " . (string)$phpv_class::checkPHPVersion($min_version_s) . "<br>";
|
print "S::MIN/S: $min_version_s: " . (string)$phpv_class::checkPHPVersion($min_version_s) . "<br>";
|
||||||
print "S::MIN/SS: $min_version_ss: " . (string)$phpv_class::checkPHPVersion($min_version_ss) . "<br>";
|
print "S::MIN/SS: $min_version_ss: " . (string)$phpv_class::checkPHPVersion($min_version_ss) . "<br>";
|
||||||
// use stats
|
// use stats
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = false; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
$PRINT_ALL = true;
|
$PRINT_ALL = true;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
@@ -43,7 +45,8 @@ print "GETPAGENAME(2): ".System::getPageName(2)."<br>";
|
|||||||
print "GETPAGENAMEARRAY: " . \CoreLibs\Debug\Support::printAr(System::getPageNameArray()) . "<br>";
|
print "GETPAGENAMEARRAY: " . \CoreLibs\Debug\Support::printAr(System::getPageNameArray()) . "<br>";
|
||||||
// seting errro codes file upload
|
// seting errro codes file upload
|
||||||
print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "<br>";
|
print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "<br>";
|
||||||
print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): ".System::fileUploadErrorMessage(UPLOAD_ERR_CANT_WRITE)."<br>";
|
print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): "
|
||||||
|
. System::fileUploadErrorMessage(UPLOAD_ERR_CANT_WRITE) . "<br>";
|
||||||
|
|
||||||
// error message
|
// error message
|
||||||
print $basic->log->printErrorMsg();
|
print $basic->log->printErrorMsg();
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore warning
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
* @phan-file-suppress PhanTypeSuspiciousStringExpression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
require 'config.php';
|
require 'config.php';
|
||||||
require BASE . INCLUDES . 'admin_header.php';
|
require BASE . INCLUDES . 'admin_header.php';
|
||||||
|
|||||||
@@ -21,11 +21,13 @@ $uploader = new FileUpload\qqFileUploader($allowedExtensions, $sizeLimit);
|
|||||||
$_action = $_POST['action'] ? $_POST['action'] : $_GET['action'];
|
$_action = $_POST['action'] ? $_POST['action'] : $_GET['action'];
|
||||||
$_task_uid = $_POST['task_uid'] ? $_POST['task_uid'] : $_GET['task_uid'];
|
$_task_uid = $_POST['task_uid'] ? $_POST['task_uid'] : $_GET['task_uid'];
|
||||||
$get_post['start'] = microtime(true);
|
$get_post['start'] = microtime(true);
|
||||||
$base->debug('AJAX UPLOAD', 'Action: '.$_action.', Task UID: '.$_task_uid.' => '.$base->dateStringFormat($get_post['start']));
|
$base->debug('AJAX UPLOAD', 'Action: ' . $_action . ', Task UID: '
|
||||||
|
. $_task_uid . ' => ' . $base->dateStringFormat($get_post['start']));
|
||||||
|
|
||||||
$upload_path = ROOT . MEDIA . UPLOADS;
|
$upload_path = ROOT . MEDIA . UPLOADS;
|
||||||
$get_post['result'] = $uploader->handleUpload($upload_path, false);
|
$get_post['result'] = $uploader->handleUpload($upload_path, false);
|
||||||
$base->debug('AJAX UPLOAD', 'Memory peak: '.$base->ByteStringFormat(memory_get_usage()).' | '.$base->ByteStringFormat(memory_get_peak_usage()));
|
$base->debug('AJAX UPLOAD', 'Memory peak: ' . $base->ByteStringFormat(memory_get_usage())
|
||||||
|
. ' | ' . $base->ByteStringFormat(memory_get_peak_usage()));
|
||||||
|
|
||||||
// set file name
|
// set file name
|
||||||
$get_post['filename'] = $uploader->uploadFileName;
|
$get_post['filename'] = $uploader->uploadFileName;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2018/10/11
|
* CREATED: 2018/10/11
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// please be VERY carefull only to change the right side
|
// please be VERY carefull only to change the right side
|
||||||
$DB_CONFIG = [
|
$DB_CONFIG = [
|
||||||
'test' => [
|
'test' => [
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2018/10/11
|
* CREATED: 2018/10/11
|
||||||
@@ -11,6 +12,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// other master config to attach
|
// other master config to attach
|
||||||
// $__LOCAL_CONFIG = [
|
// $__LOCAL_CONFIG = [
|
||||||
// 'db_host' => '',
|
// 'db_host' => '',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2003/06/10
|
* CREATED: 2003/06/10
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/************* PATHS *********************/
|
/************* PATHS *********************/
|
||||||
// directory seperator
|
// directory seperator
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
@@ -114,12 +117,12 @@ define('PASSWORD_UPPER', '(?=.*[A-Z])');
|
|||||||
define('PASSWORD_NUMBER', '(?=.*\d)');
|
define('PASSWORD_NUMBER', '(?=.*\d)');
|
||||||
define('PASSWORD_SPECIAL', "(?=.*[" . PASSWORD_SPECIAL_RANGE . "])");
|
define('PASSWORD_SPECIAL', "(?=.*[" . PASSWORD_SPECIAL_RANGE . "])");
|
||||||
// define full regex
|
// define full regex
|
||||||
define('PASSWORD_REGEX', "/^".
|
define('PASSWORD_REGEX', "/^"
|
||||||
(defined('PASSWORD_LOWER') ? PASSWORD_LOWER : '').
|
. (defined('PASSWORD_LOWER') ? PASSWORD_LOWER : '')
|
||||||
(defined('PASSWORD_UPPER') ? PASSWORD_UPPER : '').
|
. (defined('PASSWORD_UPPER') ? PASSWORD_UPPER : '')
|
||||||
(defined('PASSWORD_NUMBER') ? PASSWORD_NUMBER : '').
|
. (defined('PASSWORD_NUMBER') ? PASSWORD_NUMBER : '')
|
||||||
(defined('PASSWORD_SPECIAL') ? PASSWORD_SPECIAL : '').
|
. (defined('PASSWORD_SPECIAL') ? PASSWORD_SPECIAL : '')
|
||||||
"[A-Za-z\d".PASSWORD_SPECIAL_RANGE."]{".PASSWORD_MIN_LENGTH.",".PASSWORD_MAX_LENGTH."}$/");
|
. "[A-Za-z\d" . PASSWORD_SPECIAL_RANGE . "]{" . PASSWORD_MIN_LENGTH . "," . PASSWORD_MAX_LENGTH . "}$/");
|
||||||
|
|
||||||
/************* AJAX / ACCESS *************/
|
/************* AJAX / ACCESS *************/
|
||||||
// ajax request type
|
// ajax request type
|
||||||
@@ -217,7 +220,8 @@ if (!isset($SITE_CONFIG[HOST_NAME]['location'])) {
|
|||||||
// we have either no db selction for this host but have db config entries
|
// we have either no db selction for this host but have db config entries
|
||||||
// or we have a db selection but no db config as array or empty
|
// or we have a db selection but no db config as array or empty
|
||||||
// or we have a selection but no matching db config entry
|
// or we have a selection but no matching db config entry
|
||||||
if ((!isset($SITE_CONFIG[HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
|
if (
|
||||||
|
(!isset($SITE_CONFIG[HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
|
||||||
(isset($SITE_CONFIG[HOST_NAME]['db_host']) &&
|
(isset($SITE_CONFIG[HOST_NAME]['db_host']) &&
|
||||||
// missing DB CONFIG
|
// missing DB CONFIG
|
||||||
((is_array($DB_CONFIG) && !count($DB_CONFIG)) ||
|
((is_array($DB_CONFIG) && !count($DB_CONFIG)) ||
|
||||||
@@ -230,8 +234,10 @@ if ((!isset($SITE_CONFIG[HOST_NAME]['db_host']) && count($DB_CONFIG)) ||
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
// set SSL on
|
// set SSL on
|
||||||
if ((array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
|
if (
|
||||||
$_SERVER['SERVER_PORT'] == 443) {
|
(array_key_exists('HTTPS', $_SERVER) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
|
||||||
|
$_SERVER['SERVER_PORT'] == 443
|
||||||
|
) {
|
||||||
define('HOST_SSL', true);
|
define('HOST_SSL', true);
|
||||||
define('HOST_PROTOCOL', 'https://');
|
define('HOST_PROTOCOL', 'https://');
|
||||||
} else {
|
} else {
|
||||||
@@ -244,8 +250,10 @@ define('DB_CONFIG', isset($DB_CONFIG[DB_CONFIG_NAME]) ? $DB_CONFIG[DB_CONFIG_NAM
|
|||||||
// define('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
|
// define('DB_CONFIG_TARGET', SITE_CONFIG[$HOST_NAME]['db_host_target']);
|
||||||
// define('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
|
// define('DB_CONFIG_OTHER', SITE_CONFIG[$HOST_NAME]['db_host_other']);
|
||||||
// override for login and global schemas
|
// override for login and global schemas
|
||||||
// define('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA); // where the edit* tables are
|
// where the edit* tables are
|
||||||
// define('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA); // where global tables are that are used by all schemas (eg queue tables for online, etc)
|
// define('LOGIN_DB_SCHEMA', PUBLIC_SCHEMA);
|
||||||
|
// where global tables are that are used by all schemas (eg queue tables for online, etc)
|
||||||
|
// define('GLOBAL_DB_SCHEMA', PUBLIC_SCHEMA);
|
||||||
// debug settings, site lang, etc
|
// debug settings, site lang, etc
|
||||||
define('TARGET', $SITE_CONFIG[HOST_NAME]['location']);
|
define('TARGET', $SITE_CONFIG[HOST_NAME]['location']);
|
||||||
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag']);
|
define('DEBUG', $SITE_CONFIG[HOST_NAME]['debug_flag']);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2019/10/28
|
* CREATED: 2019/10/28
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// DEFINE('SOME_ID', <SOME VALUE>);
|
// DEFINE('SOME_ID', <SOME VALUE>);
|
||||||
|
|
||||||
/************* CONVERT *******************/
|
/************* CONVERT *******************/
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2018/10/11
|
* CREATED: 2018/10/11
|
||||||
@@ -8,6 +9,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// File and Folder paths
|
// File and Folder paths
|
||||||
// ID is TARGET (first array element)
|
// ID is TARGET (first array element)
|
||||||
/*$PATHS = [
|
/*$PATHS = [
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php // phpcs:ignore warning
|
<?php // phpcs:ignore warning
|
||||||
declare(strict_types=1);
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2018/10/11
|
* CREATED: 2018/10/11
|
||||||
@@ -8,6 +8,8 @@ declare(strict_types=1);
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
define('CONFIG_PATH', 'configs' . DIRECTORY_SEPARATOR);
|
define('CONFIG_PATH', 'configs' . DIRECTORY_SEPARATOR);
|
||||||
// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail
|
// config path prefix search, start with 0, got down each level __DIR__ has, if nothing found -> bail
|
||||||
$CONFIG_PATH_PREFIX = '';
|
$CONFIG_PATH_PREFIX = '';
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
require 'config.php';
|
require 'config.php';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2005/07/19
|
* CREATED: 2005/07/19
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$day_short = [
|
$day_short = [
|
||||||
1 => 'Mon',
|
1 => 'Mon',
|
||||||
2 => 'Tue',
|
2 => 'Tue',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2008/08/14
|
* CREATED: 2008/08/14
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// print debug messages
|
// print debug messages
|
||||||
echo $login->log->printErrorMsg();
|
echo $login->log->printErrorMsg();
|
||||||
echo $cms->log->printErrorMsg();
|
echo $cms->log->printErrorMsg();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2008/08/01
|
* CREATED: 2008/08/01
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
//------------------------------ variable init start
|
//------------------------------ variable init start
|
||||||
// for dev test we set full error reporting; writes everything, except E_ERROR into logs/php_error-<day>.log
|
// for dev test we set full error reporting; writes everything, except E_ERROR into logs/php_error-<day>.log
|
||||||
if ($DEBUG_ALL && $ENABLE_ERROR_HANDLING) {
|
if ($DEBUG_ALL && $ENABLE_ERROR_HANDLING) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2007/09/03
|
* CREATED: 2007/09/03
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/******
|
/******
|
||||||
NOTE THAT THIS INCLUDE IS OBSOLETE
|
NOTE THAT THIS INCLUDE IS OBSOLETE
|
||||||
USE THE BELOW FUNCTION CALL IN THE SCRIPT ITSELF
|
USE THE BELOW FUNCTION CALL IN THE SCRIPT ITSELF
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2005/07/12
|
* CREATED: 2005/07/12
|
||||||
@@ -7,11 +8,16 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/******
|
/******
|
||||||
NOTE THAT THIS INCLUDE IS OBSOLETE
|
NOTE THAT THIS INCLUDE IS OBSOLETE
|
||||||
USE THE BELOW FUNCTION CALL IN THE SCRIPT ITSELF
|
USE THE BELOW FUNCTION CALL IN THE SCRIPT ITSELF
|
||||||
*******/
|
*******/
|
||||||
trigger_error('admin_smarty.php is deprecated. Use SmartyExtended->setSmartyVarsAdmin(); or setSmartyVarsFrontend();', E_USER_DEPRECATED);
|
trigger_error(
|
||||||
|
'admin_smarty.php is deprecated. Use SmartyExtended->setSmartyVarsAdmin(); or setSmartyVarsFrontend();',
|
||||||
|
E_USER_DEPRECATED
|
||||||
|
);
|
||||||
$smarty->setSmartyVarsAdmin();
|
$smarty->setSmartyVarsAdmin();
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
+30
-13
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
|
* AUTHOR: Clemens "Gullevek" Schwaighofer (www.gullevek.org)
|
||||||
* CREATED: 2003/06/10
|
* CREATED: 2003/06/10
|
||||||
@@ -12,11 +13,16 @@
|
|||||||
* - edit_visible_group.php
|
* - edit_visible_group.php
|
||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2005/06/30 (cs) remove color settings, they are in CSS File now
|
* 2005/06/30 (cs) remove color settings, they are in CSS File now
|
||||||
* 2005/06/22 (cs) moved load of config array into form class, set lang and lang is must set var for form class; removed the page name setting, moved it into the form class, remove all HTML from main page
|
* 2005/06/22 (cs) moved load of config array into form class, set lang
|
||||||
|
* and lang is must set var for form class; removed the
|
||||||
|
* page name setting, moved it into the form class,
|
||||||
|
* emove all HTML from main page
|
||||||
* 2004/09/30 (cs) changed layout to fit default layout & changed LIBS, etc
|
* 2004/09/30 (cs) changed layout to fit default layout & changed LIBS, etc
|
||||||
* 2003-06-10: creation of this page
|
* 2003-06-10: creation of this page
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$DEBUG_ALL = true;
|
$DEBUG_ALL = true;
|
||||||
$PRINT_ALL = true;
|
$PRINT_ALL = true;
|
||||||
$DB_DEBUG = true;
|
$DB_DEBUG = true;
|
||||||
@@ -115,15 +121,20 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
// this gets temp, id before that, gets actual (moves one "down")
|
// this gets temp, id before that, gets actual (moves one "down")
|
||||||
// this gets the old before (moves one "up")
|
// this gets the old before (moves one "up")
|
||||||
// is done for every element in row
|
// is done for every element in row
|
||||||
// echo "A: ".$row_data_id[$position[$i]]." (".$row_data_order[$position[$i]].") -- ".$row_data_id[$position[$i]-1]." (".$row_data_order[$position[$i]-1].")<br>";
|
// echo "A: ".$row_data_id[$position[$i]]
|
||||||
|
// ." (".$row_data_order[$position[$i]].") -- ".$row_data_id[$position[$i]-1]
|
||||||
|
// ." (".$row_data_order[$position[$i]-1].")<br>";
|
||||||
$temp_id = $row_data_id[$position[$i]] ?? null;
|
$temp_id = $row_data_id[$position[$i]] ?? null;
|
||||||
$row_data_id[$position[$i]] = $row_data_id[$position[$i] - 1] ?? null;
|
$row_data_id[$position[$i]] = $row_data_id[$position[$i] - 1] ?? null;
|
||||||
$row_data_id[$position[$i] - 1] = $temp_id;
|
$row_data_id[$position[$i] - 1] = $temp_id;
|
||||||
// echo "A: ".$row_data_id[$position[$i]]." (".$row_data_order[$position[$i]].") -- ".$row_data_id[$position[$i]-1]." (".$row_data_order[$position[$i]-1].")<br>";
|
// echo "A: ".$row_data_id[$position[$i]]
|
||||||
|
// ." (".$row_data_order[$position[$i]].") -- "
|
||||||
|
// .$row_data_id[$position[$i]-1]." (".$row_data_order[$position[$i]-1].")<br>";
|
||||||
} // for
|
} // for
|
||||||
} // if up
|
} // if up
|
||||||
|
|
||||||
// the last position id from position array is not to be the count-1 of row_data_id array, or it is the last element
|
// the last position id from position array is not to be the count - 1 of
|
||||||
|
// row_data_id array, or it is the last element
|
||||||
if (isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1))) {
|
if (isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1))) {
|
||||||
for ($i = count($position) - 1; $i >= 0; $i--) {
|
for ($i = count($position) - 1; $i >= 0; $i--) {
|
||||||
// same as up, just up in other way, starts from bottom (last element) and moves "up"
|
// same as up, just up in other way, starts from bottom (last element) and moves "up"
|
||||||
@@ -136,12 +147,15 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
} // if down
|
} // if down
|
||||||
|
|
||||||
// write data ... (which has to be abstrackt ...)
|
// write data ... (which has to be abstrackt ...)
|
||||||
if ((isset($up) && $position[0] > 0) ||
|
if (
|
||||||
|
(isset($up) && $position[0] > 0) ||
|
||||||
(isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1)))
|
(isset($down) && ($position[count($position) - 1] != (count($row_data_id) - 1)))
|
||||||
) {
|
) {
|
||||||
for ($i = 0; $i < count($row_data_id); $i++) {
|
for ($i = 0; $i < count($row_data_id); $i++) {
|
||||||
if (isset($row_data_order[$i]) && isset($row_data_id[$i])) {
|
if (isset($row_data_order[$i]) && isset($row_data_id[$i])) {
|
||||||
$q = "UPDATE ".$table_name." SET order_number = ".$row_data_order[$i]." WHERE ".$table_name."_id = ".$row_data_id[$i];
|
$q = "UPDATE " . $table_name
|
||||||
|
. " SET order_number = " . $row_data_order[$i]
|
||||||
|
. " WHERE " . $table_name . "_id = " . $row_data_id[$i];
|
||||||
$q = $form->dbExec($q);
|
$q = $form->dbExec($q);
|
||||||
}
|
}
|
||||||
} // for all article ids ...
|
} // for all article ids ...
|
||||||
@@ -193,7 +207,8 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
// list of points to order
|
// list of points to order
|
||||||
for ($j = 0; $j < count($position); $j++) {
|
for ($j = 0; $j < count($position); $j++) {
|
||||||
// if matches, put into select array
|
// if matches, put into select array
|
||||||
if (isset($original_id[$position[$j]]) && isset($row_data[$i]['id']) &&
|
if (
|
||||||
|
isset($original_id[$position[$j]]) && isset($row_data[$i]['id']) &&
|
||||||
$original_id[$position[$j]] == $row_data[$i]['id']
|
$original_id[$position[$j]] == $row_data[$i]['id']
|
||||||
) {
|
) {
|
||||||
$options_selected[] = $i;
|
$options_selected[] = $i;
|
||||||
@@ -288,11 +303,11 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
(isset($data['hostname']) && $data['hostname'] ?
|
(isset($data['hostname']) && $data['hostname'] ?
|
||||||
$data['hostname'] :
|
$data['hostname'] :
|
||||||
''
|
''
|
||||||
).
|
)
|
||||||
// filename
|
// filename
|
||||||
($data['filename'] ?? '').
|
. ($data['filename'] ?? '')
|
||||||
// query string
|
// query string
|
||||||
(isset($data['query_string']) && $data['query_string'] ?
|
. (isset($data['query_string']) && $data['query_string'] ?
|
||||||
$data['query_string'] :
|
$data['query_string'] :
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
@@ -302,7 +317,8 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
$menu_data[$i]['splitfactor_in'] = 0;
|
$menu_data[$i]['splitfactor_in'] = 0;
|
||||||
}
|
}
|
||||||
// on matching, we also need to check if we are in the same folder
|
// on matching, we also need to check if we are in the same folder
|
||||||
if (isset($data['filename']) &&
|
if (
|
||||||
|
isset($data['filename']) &&
|
||||||
$data['filename'] == \CoreLibs\Get\System::getPageName() &&
|
$data['filename'] == \CoreLibs\Get\System::getPageName() &&
|
||||||
(!isset($data['hostname']) || (
|
(!isset($data['hostname']) || (
|
||||||
isset($data['hostname']) &&
|
isset($data['hostname']) &&
|
||||||
@@ -410,7 +426,8 @@ if ($form->my_page_name == 'edit_order') {
|
|||||||
if ($t_q) {
|
if ($t_q) {
|
||||||
$t_q .= ', ';
|
$t_q .= ', ';
|
||||||
}
|
}
|
||||||
$t_q .= "('".$form->dbEscapeString($matches[1])."', '".$form->dbEscapeString($matches[2])."')";
|
$t_q .= "('" . $form->dbEscapeString($matches[1]) . "', '"
|
||||||
|
. $form->dbEscapeString($matches[2]) . "')";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$form->dbExec($q . $t_q, 'NULL');
|
$form->dbExec($q . $t_q, 'NULL');
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_access = [
|
$edit_access = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_groups = [
|
$edit_groups = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_languages = [
|
$edit_languages = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_menu_group = [
|
$edit_menu_group = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_pages = [
|
$edit_pages = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
@@ -112,7 +114,11 @@ $edit_pages = [
|
|||||||
// "ORDER BY order_number"
|
// "ORDER BY order_number"
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'load_query' => "SELECT edit_page_id, CASE WHEN hostname IS NOT NULL THEN hostname ELSE ''::VARCHAR END || filename AS filename, name, online, menu, popup FROM edit_page ORDER BY order_number",
|
'load_query' => "SELECT edit_page_id, "
|
||||||
|
. "CASE WHEN hostname IS NOT NULL THEN hostname ELSE ''::VARCHAR END || filename AS filename, "
|
||||||
|
. "name, online, menu, popup "
|
||||||
|
. "FROM edit_page "
|
||||||
|
. "ORDER BY order_number",
|
||||||
'table_name' => 'edit_page',
|
'table_name' => 'edit_page',
|
||||||
'show_fields' => [
|
'show_fields' => [
|
||||||
[
|
[
|
||||||
@@ -146,7 +152,8 @@ $edit_pages = [
|
|||||||
'mandatory' => 1,
|
'mandatory' => 1,
|
||||||
'select_size' => 10,
|
'select_size' => 10,
|
||||||
'selected' => $GLOBALS['edit_visible_group_id'] ?? '',
|
'selected' => $GLOBALS['edit_visible_group_id'] ?? '',
|
||||||
'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_visible_group ORDER BY name"
|
'query' => "SELECT edit_visible_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag "
|
||||||
|
. "FROM edit_visible_group ORDER BY name"
|
||||||
],
|
],
|
||||||
'edit_menu_group' => [
|
'edit_menu_group' => [
|
||||||
'table_name' => 'edit_page_menu_group',
|
'table_name' => 'edit_page_menu_group',
|
||||||
@@ -155,7 +162,8 @@ $edit_pages = [
|
|||||||
'mandatory' => 1,
|
'mandatory' => 1,
|
||||||
'select_size' => 10,
|
'select_size' => 10,
|
||||||
'selected' => $GLOBALS['edit_menu_group_id'] ?? '',
|
'selected' => $GLOBALS['edit_menu_group_id'] ?? '',
|
||||||
'query' => "SELECT edit_menu_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag FROM edit_menu_group ORDER BY order_number"
|
'query' => "SELECT edit_menu_group_id, 'Name: ' || name || ', ' || 'Flag: ' || flag "
|
||||||
|
. "FROM edit_menu_group ORDER BY order_number"
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_schemes = [
|
$edit_schemes = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_users = [
|
$edit_users = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
@@ -34,7 +36,8 @@ $edit_users = [
|
|||||||
'password_change_interval' => [
|
'password_change_interval' => [
|
||||||
'value' => $GLOBALS['password_change_interval'] ?? '',
|
'value' => $GLOBALS['password_change_interval'] ?? '',
|
||||||
'output_name' => 'Password change interval',
|
'output_name' => 'Password change interval',
|
||||||
'error_check' => 'intervalshort', // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination
|
// can be any date length format. n Y/M/D [not H/M/S], only one set, no combination
|
||||||
|
'error_check' => 'intervalshort',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'interval' => 1, // interval needs NULL write for empty
|
'interval' => 1, // interval needs NULL write for empty
|
||||||
'size' => 5, // make it 5 chars long
|
'size' => 5, // make it 5 chars long
|
||||||
@@ -184,7 +187,8 @@ $edit_users = [
|
|||||||
'cols' => 60
|
'cols' => 60
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'load_query' => "SELECT edit_user_id, username, enabled, debug, db_debug, strict, locked, login_error_count FROM edit_user ORDER BY username",
|
'load_query' => "SELECT edit_user_id, username, enabled, debug, db_debug, strict, locked, login_error_count "
|
||||||
|
. "FROM edit_user ORDER BY username",
|
||||||
'table_name' => 'edit_user',
|
'table_name' => 'edit_user',
|
||||||
'show_fields' => [
|
'show_fields' => [
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
$edit_visible_group = [
|
$edit_visible_group = [
|
||||||
'table_array' => [
|
'table_array' => [
|
||||||
|
|||||||
+246
-115
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2000/06/01
|
* CREATED: 2000/06/01
|
||||||
@@ -32,16 +33,22 @@
|
|||||||
*
|
*
|
||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2010/12/21 (cs) merge back password change interface
|
* 2010/12/21 (cs) merge back password change interface
|
||||||
* 2010/12/17 (cs) change that password can be blowfish encrypted, auto detects if other encryption is used (md5, std des) and tries to use them
|
* 2010/12/17 (cs) change that password can be blowfish encrypted,
|
||||||
|
* auto detects if other encryption is used (md5, std des)
|
||||||
|
* and tries to use them
|
||||||
* 2007/05/29 (cs) BUG with assign query and visible sub arrays to pages
|
* 2007/05/29 (cs) BUG with assign query and visible sub arrays to pages
|
||||||
* 2005/09/21 (cs) if error -> unset the session vars
|
* 2005/09/21 (cs) if error -> unset the session vars
|
||||||
* 2005/07/04 (cs) add a function to write into the edit log file
|
* 2005/07/04 (cs) add a function to write into the edit log file
|
||||||
* 2005/07/01 (cs) start adepting login class to new edit interface layout
|
* 2005/07/01 (cs) start adepting login class to new edit interface layout
|
||||||
* 2005/03/31 (cs) fixed the class call with all debug vars
|
* 2005/03/31 (cs) fixed the class call with all debug vars
|
||||||
* 2004/11/17 (cs) unused var cleanup
|
* 2004/11/17 (cs) unused var cleanup
|
||||||
* 2004/11/16 (cs) rewrite login so it uses a template and not just plain html. prepare it, so it will be able to use external stuff later (some interface has to be designed for that
|
* 2004/11/16 (cs) rewrite login so it uses a template and not just plain html.
|
||||||
* 2004/11/16 (cs) removed the mobile html part from login * 2004/09/30 (cs) layout fix
|
* prepare it, so it will be able to use external stuff later
|
||||||
* 2003-11-11: if user has debug 1 unset memlimit, because there can be serious problems with the query logging
|
* (some interface has to be designed for that
|
||||||
|
* 2004/11/16 (cs) removed the mobile html part from login
|
||||||
|
* 2004/09/30 (cs) layout fix
|
||||||
|
* 2003-11-11: if user has debug 1 unset memlimit, because there can be serious
|
||||||
|
* problems with the query logging
|
||||||
* 2003-06-12: added flag to PAGES array
|
* 2003-06-12: added flag to PAGES array
|
||||||
* changed the get vars from GLOBALS to _POST
|
* changed the get vars from GLOBALS to _POST
|
||||||
* changed the session registration. no more GLOBAL vars are registered
|
* changed the session registration. no more GLOBAL vars are registered
|
||||||
@@ -57,6 +64,8 @@
|
|||||||
* 2000-06-01: created basic idea and functions
|
* 2000-06-01: created basic idea and functions
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\ACL;
|
namespace CoreLibs\ACL;
|
||||||
|
|
||||||
use CoreLibs\Check\Password;
|
use CoreLibs\Check\Password;
|
||||||
@@ -64,16 +73,19 @@ use CoreLibs\Check\Password;
|
|||||||
class Login extends \CoreLibs\DB\IO
|
class Login extends \CoreLibs\DB\IO
|
||||||
{
|
{
|
||||||
private $euid; // the user id var
|
private $euid; // the user id var
|
||||||
private $permission_okay = false; // is set to one if login okay, or EUID is set and user is okay to access this page
|
// is set to one if login okay, or EUID is set and user is okay to access this page
|
||||||
|
private $permission_okay = false;
|
||||||
public $login; // pressed login
|
public $login; // pressed login
|
||||||
private $action; // master action command
|
private $action; // master action command
|
||||||
private $username; // login name
|
private $username; // login name
|
||||||
private $password; // login password
|
private $password; // login password
|
||||||
private $logout; // logout button
|
private $logout; // logout button
|
||||||
private $login_error = 0; // login error code, can be matched to the array login_error_msg, which holds the string
|
// login error code, can be matched to the array login_error_msg, which holds the string
|
||||||
|
private $login_error = 0;
|
||||||
private $password_change = false; // if this is set to true, the user can change passwords
|
private $password_change = false; // if this is set to true, the user can change passwords
|
||||||
private $password_change_ok = false; // password change was successful
|
private $password_change_ok = false; // password change was successful
|
||||||
private $password_forgot = false; // can we reset password and mail to user with new password set screen
|
// can we reset password and mail to user with new password set screen
|
||||||
|
private $password_forgot = false;
|
||||||
private $password_forgot_ok = false; // password forgot mail send ok
|
private $password_forgot_ok = false; // password forgot mail send ok
|
||||||
private $change_password;
|
private $change_password;
|
||||||
private $pw_username;
|
private $pw_username;
|
||||||
@@ -161,7 +173,9 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$this->l = new \CoreLibs\Language\L10n($lang);
|
$this->l = new \CoreLibs\Language\L10n($lang);
|
||||||
|
|
||||||
// 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
|
||||||
if (defined('LOGIN_DB_SCHEMA') && LOGIN_DB_SCHEMA) {
|
if (defined('LOGIN_DB_SCHEMA') && LOGIN_DB_SCHEMA) {
|
||||||
$SCHEMA = LOGIN_DB_SCHEMA;
|
$SCHEMA = LOGIN_DB_SCHEMA;
|
||||||
} elseif (isset($db_config['db_schema']) && $db_config['db_schema']) {
|
} elseif (isset($db_config['db_schema']) && $db_config['db_schema']) {
|
||||||
@@ -175,7 +189,8 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
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);
|
||||||
}
|
}
|
||||||
$this->euid = array_key_exists('EUID', $_SESSION) ? $_SESSION['EUID'] : 0; // if there is none, there is none, saves me POST/GET check
|
// if there is none, there is none, saves me POST/GET check
|
||||||
|
$this->euid = array_key_exists('EUID', $_SESSION) ? $_SESSION['EUID'] : 0;
|
||||||
// get login vars, are so, can't be changed
|
// get login vars, are so, can't be changed
|
||||||
// prepare
|
// prepare
|
||||||
// pass on vars to Object vars
|
// pass on vars to Object vars
|
||||||
@@ -303,21 +318,24 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$password = $this->password;
|
$password = $this->password;
|
||||||
}
|
}
|
||||||
// first, errors on missing encryption
|
// first, errors on missing encryption
|
||||||
if ((preg_match("/^\\$2(a|y)\\$/", $hash) && CRYPT_BLOWFISH != 1) ||
|
if (
|
||||||
|
(preg_match("/^\\$2(a|y)\\$/", $hash) && CRYPT_BLOWFISH != 1) ||
|
||||||
(preg_match("/^\\$1\\$/", $hash) && CRYPT_MD5 != 1) ||
|
(preg_match("/^\\$1\\$/", $hash) && CRYPT_MD5 != 1) ||
|
||||||
(preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) && CRYPT_STD_DES != 1)
|
(preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) && CRYPT_STD_DES != 1)
|
||||||
) {
|
) {
|
||||||
// this means password cannot be decrypted because of missing crypt methods
|
// this means password cannot be decrypted because of missing crypt methods
|
||||||
$this->login_error = 9999;
|
$this->login_error = 9999;
|
||||||
$password_ok = false;
|
$password_ok = false;
|
||||||
} elseif (preg_match("/^\\$2y\\$/", $hash) &&
|
} elseif (
|
||||||
|
preg_match("/^\\$2y\\$/", $hash) &&
|
||||||
!Password::passwordVerify($password, $hash)
|
!Password::passwordVerify($password, $hash)
|
||||||
) {
|
) {
|
||||||
// this is the new password hash methid, is only $2y$
|
// this is the new password hash methid, is only $2y$
|
||||||
// all others are not valid anymore
|
// all others are not valid anymore
|
||||||
$this->login_error = 1013;
|
$this->login_error = 1013;
|
||||||
$password_ok = false;
|
$password_ok = false;
|
||||||
} elseif (!preg_match("/^\\$2(a|y)\\$/", $hash) &&
|
} elseif (
|
||||||
|
!preg_match("/^\\$2(a|y)\\$/", $hash) &&
|
||||||
!preg_match("/^\\$1\\$/", $hash) &&
|
!preg_match("/^\\$1\\$/", $hash) &&
|
||||||
!preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) &&
|
!preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) &&
|
||||||
$hash != $password
|
$hash != $password
|
||||||
@@ -344,30 +362,37 @@ 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, ";
|
$q = "SELECT eu.edit_user_id, username, password, eu.edit_group_id, "
|
||||||
$q .= "eu.login_error_count, eu.login_error_date_last, eu.login_error_date_first, eu.strict, eu.locked, ";
|
. "eg.name AS edit_group_name, admin, "
|
||||||
$q .= "debug, db_debug, ";
|
. "eu.login_error_count, eu.login_error_date_last, "
|
||||||
$q .= "eareu.level AS user_level, eareu.type AS user_type, ";
|
. "eu.login_error_date_first, eu.strict, eu.locked, "
|
||||||
$q .= "eareg.level AS group_level, eareg.type AS group_type, ";
|
. "debug, db_debug, "
|
||||||
$q .= "eu.enabled, el.short_name AS lang_short, el.iso_name AS lang_iso, first.header_color AS first_header_color, ";
|
. "eareu.level AS user_level, eareu.type AS user_type, "
|
||||||
$q .= "second.header_color AS second_header_color, second.template ";
|
. "eareg.level AS group_level, eareg.type AS group_type, "
|
||||||
$q .= "FROM edit_user eu ";
|
. "eu.enabled, el.short_name AS lang_short, el.iso_name AS lang_iso, "
|
||||||
$q .= "LEFT JOIN edit_scheme second ON (second.edit_scheme_id = eu.edit_scheme_id AND second.enabled = 1), ";
|
. "firstheader_color AS first_header_color, "
|
||||||
$q .= "edit_language el, edit_group eg, ";
|
. "second.header_color AS second_header_color, second.template "
|
||||||
$q .= "edit_access_right eareu, ";
|
. "FROM edit_user eu "
|
||||||
$q .= "edit_access_right eareg, ";
|
. "LEFT JOIN edit_scheme second ON "
|
||||||
$q .= "edit_scheme first ";
|
. "(second.edit_scheme_id = eu.edit_scheme_id AND second.enabled = 1), "
|
||||||
$q .= "WHERE first.edit_scheme_id = eg.edit_scheme_id AND eu.edit_group_id = eg.edit_group_id AND eu.edit_language_id = el.edit_language_id AND ";
|
. "edit_language el, edit_group eg, "
|
||||||
$q .= "eu.edit_access_right_id = eareu.edit_access_right_id AND ";
|
. "edit_access_right eareu, "
|
||||||
$q .= "eg.edit_access_right_id = eareg.edit_access_right_id AND ";
|
. "edit_access_right eareg, "
|
||||||
|
. "edit_scheme first "
|
||||||
|
. "WHERE first.edit_scheme_id = eg.edit_scheme_id "
|
||||||
|
. "AND eu.edit_group_id = egedit_group_id "
|
||||||
|
. "AND eu.edit_language_id = el.edit_language_id AND "
|
||||||
|
. "eu.edit_access_right_id = eareu.edit_access_right_id AND "
|
||||||
|
. "eg.edit_access_right_id = eareg.edit_access_right_id AND "
|
||||||
// password match is done in script, against old plain or new blowfish encypted
|
// password match is done in script, against old plain or new blowfish encypted
|
||||||
$q .= "(LOWER(username) = '".$this->dbEscapeString(strtolower($this->username))."') ";
|
. "(LOWER(username) = '" . $this->dbEscapeString(strtolower($this->username)) . "') ";
|
||||||
$res = $this->dbReturn($q);
|
$res = $this->dbReturn($q);
|
||||||
// username is wrong, but we throw for wrong username and wrong password the same error
|
// username is wrong, but we throw for wrong username and wrong password the same error
|
||||||
if (!$this->cursor_ext[md5($q)]['num_rows']) {
|
if (!$this->cursor_ext[md5($q)]['num_rows']) {
|
||||||
$this->login_error = 1010;
|
$this->login_error = 1010;
|
||||||
} 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 flow
|
// check flow
|
||||||
// - user is enabled
|
// - user is enabled
|
||||||
@@ -386,10 +411,14 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
// none to be set, set in login password check
|
// none to be set, set in login password check
|
||||||
} else {
|
} else {
|
||||||
// check if the current password is an invalid hash and do a rehash and set password
|
// check if the current password is an invalid hash and do a rehash and set password
|
||||||
// $this->debug('LOGIN', 'Hash: '.$res['password'].' -> VERIFY: '.($Password::passwordVerify($this->password, $res['password']) ? 'OK' : 'FAIL').' => HASH: '.(Password::passwordRehashCheck($res['password']) ? 'NEW NEEDED' : 'OK'));
|
// $this->debug('LOGIN', 'Hash: '.$res['password'].' -> VERIFY: '
|
||||||
|
// .($Password::passwordVerify($this->password, $res['password']) ? 'OK' : 'FAIL')
|
||||||
|
// .' => HASH: '.(Password::passwordRehashCheck($res['password']) ? 'NEW NEEDED' : 'OK'));
|
||||||
if (Password::passwordRehashCheck($res['password'])) {
|
if (Password::passwordRehashCheck($res['password'])) {
|
||||||
// update password hash to new one now
|
// update password hash to new one now
|
||||||
$q = "UPDATE edit_user SET password = '".$this->dbEscapeString(Password::passwordSet($this->password))."' WHERE edit_user_id = ".$res['edit_user_id'];
|
$q = "UPDATE edit_user "
|
||||||
|
. "SET password = '" . $this->dbEscapeString(Password::passwordSet($this->password))
|
||||||
|
. "' WHERE edit_user_id = " . $res['edit_user_id'];
|
||||||
$this->dbExec($q);
|
$this->dbExec($q);
|
||||||
}
|
}
|
||||||
// normal user processing
|
// normal user processing
|
||||||
@@ -410,31 +439,36 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$_SESSION['GROUP_ACL_TYPE'] = $res['group_type'];
|
$_SESSION['GROUP_ACL_TYPE'] = $res['group_type'];
|
||||||
// deprecated TEMPLATE setting
|
// deprecated TEMPLATE setting
|
||||||
$_SESSION['TEMPLATE'] = $res['template'] ? $res['template'] : '';
|
$_SESSION['TEMPLATE'] = $res['template'] ? $res['template'] : '';
|
||||||
$_SESSION['HEADER_COLOR'] = $res['second_header_color'] ? $res['second_header_color'] : $res['first_header_color'];
|
$_SESSION['HEADER_COLOR'] = $res['second_header_color'] ?
|
||||||
|
$res['second_header_color'] :
|
||||||
|
$res['first_header_color'];
|
||||||
$_SESSION['LANG'] = $res['lang_short'];
|
$_SESSION['LANG'] = $res['lang_short'];
|
||||||
$_SESSION['DEFAULT_CHARSET'] = $res['lang_iso'];
|
$_SESSION['DEFAULT_CHARSET'] = $res['lang_iso'];
|
||||||
$_SESSION['DEFAULT_LANG'] = $res['lang_short'].'_'.strtolower(str_replace('-', '', $res['lang_iso']));
|
$_SESSION['DEFAULT_LANG'] = $res['lang_short'] . '_'
|
||||||
|
. strtolower(str_replace('-', '', $res['lang_iso']));
|
||||||
// reset any login error count for this user
|
// reset any login error count for this user
|
||||||
if ($res['login_error_count'] > 0) {
|
if ($res['login_error_count'] > 0) {
|
||||||
$q = "UPDATE edit_user ";
|
$q = "UPDATE edit_user "
|
||||||
$q .= "SET login_error_count = 0, login_error_date_last = NULL, login_error_date_first = NULL ";
|
. "SET login_error_count = 0, login_error_date_last = NULL, "
|
||||||
$q .= "WHERE edit_user_id = ".$res['edit_user_id'];
|
. "login_error_date_first = NULL "
|
||||||
|
. "WHERE edit_user_id = " . $res['edit_user_id'];
|
||||||
$this->dbExec($q);
|
$this->dbExec($q);
|
||||||
}
|
}
|
||||||
$edit_page_ids = [];
|
$edit_page_ids = [];
|
||||||
$pages = [];
|
$pages = [];
|
||||||
$pages_acl = [];
|
$pages_acl = [];
|
||||||
// set pages access
|
// set pages access
|
||||||
$q = "SELECT ep.edit_page_id, ep.cuid, epca.cuid AS content_alias_uid, ";
|
$q = "SELECT ep.edit_page_id, ep.cuid, epca.cuid AS content_alias_uid, "
|
||||||
$q .= "ep.hostname, ep.filename, ep.name AS edit_page_name, ";
|
. "ep.hostname, ep.filename, ep.name AS edit_page_name, "
|
||||||
$q .= "ep.order_number AS edit_page_order, ep.menu, ";
|
. "ep.order_number AS edit_page_order, ep.menu, "
|
||||||
$q .= "ep.popup, ep.popup_x, ep.popup_y, ep.online, ear.level, ear.type ";
|
. "ep.popup, ep.popup_x, ep.popup_y, ep.online, ear.level, ear.type "
|
||||||
$q .= "FROM edit_page ep ";
|
. "FROM edit_page ep "
|
||||||
$q .= "LEFT JOIN edit_page epca ON (epca.edit_page_id = ep.content_alias_edit_page_id)";
|
. "LEFT JOIN edit_page epca ON (epca.edit_page_id = ep.content_alias_edit_page_id)"
|
||||||
$q .= ", edit_page_access epa, edit_access_right ear ";
|
. ", 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 ";
|
. "WHERE ep.edit_page_id = epa.edit_page_id "
|
||||||
$q .= "AND epa.enabled = 1 AND epa.edit_group_id = ".$res["edit_group_id"]." ";
|
. "AND ear.edit_access_right_id = epa.edit_access_right_id "
|
||||||
$q .= "ORDER BY ep.order_number";
|
. "AND epa.enabled = 1 AND epa.edit_group_id = " . $res["edit_group_id"] . " "
|
||||||
|
. "ORDER BY ep.order_number";
|
||||||
while ($res = $this->dbReturn($q)) {
|
while ($res = $this->dbReturn($q)) {
|
||||||
// page id array for sub data readout
|
// page id array for sub data readout
|
||||||
$edit_page_ids[$res['edit_page_id']] = $res['cuid'];
|
$edit_page_ids[$res['edit_page_id']] = $res['cuid'];
|
||||||
@@ -442,7 +476,8 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$pages[$res['cuid']] = [
|
$pages[$res['cuid']] = [
|
||||||
'edit_page_id' => $res['edit_page_id'],
|
'edit_page_id' => $res['edit_page_id'],
|
||||||
'cuid' => $res['cuid'],
|
'cuid' => $res['cuid'],
|
||||||
'content_alias_uid' => $res['content_alias_uid'], // for reference of content data on a differen page
|
// for reference of content data on a differen page
|
||||||
|
'content_alias_uid' => $res['content_alias_uid'],
|
||||||
'hostname' => $res['hostname'],
|
'hostname' => $res['hostname'],
|
||||||
'filename' => $res['filename'],
|
'filename' => $res['filename'],
|
||||||
'page_name' => $res['edit_page_name'],
|
'page_name' => $res['edit_page_name'],
|
||||||
@@ -462,18 +497,20 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
} // for each page
|
} // for each page
|
||||||
// get the visible groups for all pages and write them to the pages
|
// get the visible groups for all pages and write them to the pages
|
||||||
$_edit_page_id = 0;
|
$_edit_page_id = 0;
|
||||||
$q = "SELECT epvg.edit_page_id, name, flag ";
|
$q = "SELECT epvg.edit_page_id, name, flag "
|
||||||
$q .= "FROM edit_visible_group evp, edit_page_visible_group epvg ";
|
. "FROM edit_visible_group evp, edit_page_visible_group epvg "
|
||||||
$q .= "WHERE evp.edit_visible_group_id = epvg.edit_visible_group_id AND epvg.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
|
. "WHERE evp.edit_visible_group_id = epvg.edit_visible_group_id "
|
||||||
$q .= "ORDER BY epvg.edit_page_id";
|
. "AND epvg.edit_page_id IN (" . join(', ', array_keys($edit_page_ids)) . ") "
|
||||||
|
. "ORDER BY epvg.edit_page_id";
|
||||||
while ($res = $this->dbReturn($q)) {
|
while ($res = $this->dbReturn($q)) {
|
||||||
$pages[$edit_page_ids[$res['edit_page_id']]]['visible'][$res['name']] = $res['flag'];
|
$pages[$edit_page_ids[$res['edit_page_id']]]['visible'][$res['name']] = $res['flag'];
|
||||||
}
|
}
|
||||||
// get the same for the query strings
|
// get the same for the query strings
|
||||||
$_edit_page_id = 0;
|
$_edit_page_id = 0;
|
||||||
$q = "SELECT eqs.edit_page_id, name, value, dynamic FROM edit_query_string eqs ";
|
$q = "SELECT eqs.edit_page_id, name, value, dynamic FROM edit_query_string eqs "
|
||||||
$q .= "WHERE enabled = 1 AND edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
|
. "WHERE enabled = 1 AND edit_page_id "
|
||||||
$q .= "ORDER BY eqs.edit_page_id";
|
. "IN (" . join(', ', array_keys($edit_page_ids)) . ") "
|
||||||
|
. "ORDER BY eqs.edit_page_id";
|
||||||
while ($res = $this->dbReturn($q)) {
|
while ($res = $this->dbReturn($q)) {
|
||||||
$pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = [
|
$pages[$edit_page_ids[$res['edit_page_id']]]['query'][] = [
|
||||||
'name' => $res['name'],
|
'name' => $res['name'],
|
||||||
@@ -483,11 +520,12 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
// get the page content and add them to the page
|
// get the page content and add them to the page
|
||||||
$_edit_page_id = 0;
|
$_edit_page_id = 0;
|
||||||
$q = "SELECT epc.edit_page_id, epc.name, epc.uid, epc.order_number, epc.online, ear.level, ear.type ";
|
$q = "SELECT epc.edit_page_id, epc.name, epc.uid, epc.order_number, "
|
||||||
$q .= "FROM edit_page_content epc, edit_access_right ear ";
|
. "epc.online, ear.level, ear.type "
|
||||||
$q .= "WHERE epc.edit_access_right_id = ear.edit_access_right_id AND ";
|
. "FROM edit_page_content epc, edit_access_right ear "
|
||||||
$q .= "epc.edit_page_id IN (".join(', ', array_keys($edit_page_ids)).") ";
|
. "WHERE epc.edit_access_right_id = ear.edit_access_right_id AND "
|
||||||
$q .= "ORDER BY epc.order_number";
|
. "epc.edit_page_id IN (" . join(', ', array_keys($edit_page_ids)) . ") "
|
||||||
|
. "ORDER BY epc.order_number";
|
||||||
while ($res = $this->dbReturn($q)) {
|
while ($res = $this->dbReturn($q)) {
|
||||||
$pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = [
|
$pages[$edit_page_ids[$res['edit_page_id']]]['content'][$res['uid']] = [
|
||||||
'name' => $res['name'],
|
'name' => $res['name'],
|
||||||
@@ -503,17 +541,20 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$_SESSION['PAGES'] = $pages;
|
$_SESSION['PAGES'] = $pages;
|
||||||
$_SESSION['PAGES_ACL_LEVEL'] = $pages_acl;
|
$_SESSION['PAGES_ACL_LEVEL'] = $pages_acl;
|
||||||
// load the edit_access user rights
|
// load the edit_access user rights
|
||||||
$q = "SELECT ea.edit_access_id, level, type, ea.name, ea.color, ea.uid, edit_default ";
|
$q = "SELECT ea.edit_access_id, level, type, ea.name, ea.color, ea.uid, edit_default "
|
||||||
$q .= "FROM edit_access_user eau, edit_access_right ear, edit_access ea ";
|
. "FROM edit_access_user eau, edit_access_right ear, edit_access ea "
|
||||||
$q .= "WHERE eau.edit_access_id = ea.edit_access_id AND eau.edit_access_right_id = ear.edit_access_right_id ";
|
. "WHERE eau.edit_access_id = ea.edit_access_id "
|
||||||
$q .= "AND eau.enabled = 1 AND edit_user_id = ".$this->euid." ";
|
. "AND eau.edit_access_right_id = ear.edit_access_right_id "
|
||||||
$q .= "ORDER BY ea.name";
|
. "AND eau.enabled = 1 AND edit_user_id = " . $this->euid . " "
|
||||||
|
. "ORDER BY ea.name";
|
||||||
$unit_access = [];
|
$unit_access = [];
|
||||||
$eauid = [];
|
$eauid = [];
|
||||||
$unit_acl = [];
|
$unit_acl = [];
|
||||||
while ($res = $this->dbReturn($q)) {
|
while ($res = $this->dbReturn($q)) {
|
||||||
// read edit access data fields and drop them into the unit access array
|
// read edit access data fields and drop them into the unit access array
|
||||||
$q_sub ="SELECT name, value FROM edit_access_data WHERE enabled = 1 AND edit_access_id = ".$res['edit_access_id'];
|
$q_sub = "SELECT name, value "
|
||||||
|
. "FROM edit_access_data "
|
||||||
|
. "WHERE enabled = 1 AND edit_access_id = " . $res['edit_access_id'];
|
||||||
$ea_data = [];
|
$ea_data = [];
|
||||||
while ($res_sub = $this->dbReturn($q_sub)) {
|
while ($res_sub = $this->dbReturn($q_sub)) {
|
||||||
$ea_data[$res_sub['name']] = $res_sub['value'];
|
$ea_data[$res_sub['name']] = $res_sub['value'];
|
||||||
@@ -548,12 +589,14 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
$login_error_date_first = ", login_error_date_first = NOW()";
|
$login_error_date_first = ", login_error_date_first = NOW()";
|
||||||
}
|
}
|
||||||
// update login error count for this user
|
// update login error count for this user
|
||||||
$q = "UPDATE edit_user ";
|
$q = "UPDATE edit_user "
|
||||||
$q .= "SET login_error_count = login_error_count + 1, login_error_date_last = NOW() ".$login_error_date_first." ";
|
. "SET login_error_count = login_error_count + 1, "
|
||||||
$q .= "WHERE edit_user_id = ".$res['edit_user_id'];
|
. "login_error_date_last = NOW() " . $login_error_date_first . " "
|
||||||
|
. "WHERE edit_user_id = " . $res['edit_user_id'];
|
||||||
$this->dbExec($q);
|
$this->dbExec($q);
|
||||||
// totally lock the user if error max is reached
|
// totally lock the user if error max is reached
|
||||||
if ($this->max_login_error_count != -1 &&
|
if (
|
||||||
|
$this->max_login_error_count != -1 &&
|
||||||
$res['login_error_count'] + 1 > $this->max_login_error_count
|
$res['login_error_count'] + 1 > $this->max_login_error_count
|
||||||
) {
|
) {
|
||||||
// do some alert reporting in case this error is too big
|
// do some alert reporting in case this error is too big
|
||||||
@@ -581,14 +624,23 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
public function loginCheckPermissions(): bool
|
public function loginCheckPermissions(): bool
|
||||||
{
|
{
|
||||||
if ($this->euid && $this->login_error != 103) {
|
if ($this->euid && $this->login_error != 103) {
|
||||||
$q = "SELECT filename ";
|
$q = "SELECT filename "
|
||||||
$q .= "FROM edit_page ep, edit_page_access epa, edit_group eg, edit_user eu ";
|
. "FROM edit_page ep, edit_page_access epa, edit_group eg, edit_user eu "
|
||||||
$q .= "WHERE ep.edit_page_id = epa.edit_page_id AND eg.edit_group_id = epa.edit_group_id AND eg.edit_group_id = eu.edit_group_id ";
|
. "WHERE ep.edit_page_id = epa.edit_page_id "
|
||||||
$q .= "AND eu.edit_user_id = ".$this->euid." AND filename = '".$this->page_name."' AND eg.enabled = 1 AND epa.enabled = 1";
|
. "AND eg.edit_group_id = epa.edit_group_id "
|
||||||
|
. "AND eg.edit_group_id = eu.edit_group_id "
|
||||||
|
. "AND eu.edit_user_id = " . $this->euid . " "
|
||||||
|
. "AND filename = '" . $this->page_name . "' "
|
||||||
|
. "AND eg.enabled = 1 AND epa.enabled = 1";
|
||||||
$res = $this->dbReturnRow($q);
|
$res = $this->dbReturnRow($q);
|
||||||
// unset mem limit if debug is set to 1
|
// unset mem limit if debug is set to 1
|
||||||
// if (($GLOBALS["DEBUG_ALL"] || $GLOBALS["DB_DEBUG"] || $_SESSION["DEBUG_ALL"] || $_SESSION["DB_DEBUG"]) && ini_get('memory_limit') != -1)
|
// if (
|
||||||
// ini_set('memory_limit', -1);
|
// ($GLOBALS["DEBUG_ALL"] || $GLOBALS["DB_DEBUG"] ||
|
||||||
|
// $_SESSION["DEBUG_ALL"] || $_SESSION["DB_DEBUG"]) &&
|
||||||
|
// ini_get('memory_limit') != -1
|
||||||
|
// ) {
|
||||||
|
// ini_set('memory_limit', '-1');
|
||||||
|
// }
|
||||||
if (isset($res['filename']) && $res['filename'] == $this->page_name) {
|
if (isset($res['filename']) && $res['filename'] == $this->page_name) {
|
||||||
$this->permission_okay = true;
|
$this->permission_okay = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -687,7 +739,10 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
if ($_SESSION['GROUP_ACL_LEVEL'] != -1) {
|
if ($_SESSION['GROUP_ACL_LEVEL'] != -1) {
|
||||||
$this->acl['page'] = $_SESSION['GROUP_ACL_LEVEL'];
|
$this->acl['page'] = $_SESSION['GROUP_ACL_LEVEL'];
|
||||||
}
|
}
|
||||||
if (isset($_SESSION['PAGES_ACL_LEVEL'][$this->page_name]) && $_SESSION['PAGES_ACL_LEVEL'][$this->page_name] != -1) {
|
if (
|
||||||
|
isset($_SESSION['PAGES_ACL_LEVEL'][$this->page_name]) &&
|
||||||
|
$_SESSION['PAGES_ACL_LEVEL'][$this->page_name] != -1
|
||||||
|
) {
|
||||||
$this->acl['page'] = $_SESSION['PAGES_ACL_LEVEL'][$this->page_name];
|
$this->acl['page'] = $_SESSION['PAGES_ACL_LEVEL'][$this->page_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,7 +875,10 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
// check user exist, if not -> error
|
// check user exist, if not -> error
|
||||||
if (!$this->login_error) {
|
if (!$this->login_error) {
|
||||||
$q = "SELECT edit_user_id FROM edit_user WHERE enabled = 1 AND username = '".$this->dbEscapeString($this->pw_username)."'";
|
$q = "SELECT edit_user_id "
|
||||||
|
. "FROM edit_user "
|
||||||
|
. "WHERE enabled = 1 "
|
||||||
|
. "AND username = '" . $this->dbEscapeString($this->pw_username) . "'";
|
||||||
list ($edit_user_id) = $this->dbReturnRow($q);
|
list ($edit_user_id) = $this->dbReturnRow($q);
|
||||||
if (!$edit_user_id) {
|
if (!$edit_user_id) {
|
||||||
// username wrong
|
// username wrong
|
||||||
@@ -830,7 +888,10 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
// check old passwords match -> error
|
// check old passwords match -> error
|
||||||
if (!$this->login_error) {
|
if (!$this->login_error) {
|
||||||
$q = "SELECT edit_user_id, password FROM edit_user WHERE enabled = 1 AND username = '".$this->dbEscapeString($this->pw_username)."'";
|
$q = "SELECT edit_user_id, password "
|
||||||
|
. "FROM edit_user "
|
||||||
|
. "WHERE enabled = 1 "
|
||||||
|
. "AND username = '" . $this->dbEscapeString($this->pw_username) . "'";
|
||||||
list ($edit_user_id, $old_password_hash) = $this->dbReturnRow($q);
|
list ($edit_user_id, $old_password_hash) = $this->dbReturnRow($q);
|
||||||
if (!$edit_user_id || !$this->loginPasswordCheck($old_password_hash, $this->pw_old_password)) {
|
if (!$edit_user_id || !$this->loginPasswordCheck($old_password_hash, $this->pw_old_password)) {
|
||||||
// old password wrong
|
// old password wrong
|
||||||
@@ -862,7 +923,10 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
// no error change this users password
|
// no error change this users password
|
||||||
if (!$this->login_error && $edit_user_id) {
|
if (!$this->login_error && $edit_user_id) {
|
||||||
// update the user (edit_user_id) with the new password
|
// update the user (edit_user_id) with the new password
|
||||||
$q = "UPDATE edit_user SET password = '".$this->dbEscapeString(Password::passwordSet($this->pw_new_password))."' WHERE edit_user_id = ".$edit_user_id;
|
$q = "UPDATE edit_user "
|
||||||
|
. "SET password = "
|
||||||
|
. "'" . $this->dbEscapeString(Password::passwordSet($this->pw_new_password)) . "' "
|
||||||
|
. "WHERE edit_user_id = " . $edit_user_id;
|
||||||
$this->dbExec($q);
|
$this->dbExec($q);
|
||||||
$data = 'Password change for user "' . $this->pw_username . '"';
|
$data = 'Password change for user "' . $this->pw_username . '"';
|
||||||
$this->password_change_ok = true;
|
$this->password_change_ok = true;
|
||||||
@@ -903,36 +967,69 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
// pre change the data in the PASSWORD_CHANGE_DIV first
|
// pre change the data in the PASSWORD_CHANGE_DIV first
|
||||||
foreach ($this->login_template['strings'] as $string => $data) {
|
foreach ($this->login_template['strings'] as $string => $data) {
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$html_string_password_change = str_replace('{'.$string.'}', $data, $html_string_password_change);
|
$html_string_password_change = str_replace(
|
||||||
|
'{' . $string . '}',
|
||||||
|
$data,
|
||||||
|
$html_string_password_change
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// print error messagae
|
// print error messagae
|
||||||
if ($this->login_error) {
|
if ($this->login_error) {
|
||||||
$html_string_password_change = str_replace('{ERROR_MSG}', $this->login_error_msg[$this->login_error].'<br>', $html_string_password_change);
|
$html_string_password_change = str_replace(
|
||||||
|
'{ERROR_MSG}',
|
||||||
|
$this->login_error_msg[$this->login_error] . '<br>',
|
||||||
|
$html_string_password_change
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$html_string_password_change = str_replace('{ERROR_MSG}', '<br>', $html_string_password_change);
|
$html_string_password_change = str_replace(
|
||||||
|
'{ERROR_MSG}',
|
||||||
|
'<br>',
|
||||||
|
$html_string_password_change
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// if pw change action, show the float again
|
// if pw change action, show the float again
|
||||||
if ($this->change_password && !$this->password_change_ok) {
|
if ($this->change_password && !$this->password_change_ok) {
|
||||||
$html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '<script language="JavaScript">ShowHideDiv(\'pw_change_div\');</script>', $html_string_password_change);
|
$html_string_password_change = str_replace(
|
||||||
|
'{PASSWORD_CHANGE_SHOW}',
|
||||||
|
'<script language="JavaScript">'
|
||||||
|
. 'ShowHideDiv(\'pw_change_div\');</script>',
|
||||||
|
$html_string_password_change
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$html_string_password_change = str_replace('{PASSWORD_CHANGE_SHOW}', '', $html_string_password_change);
|
$html_string_password_change = str_replace(
|
||||||
|
'{PASSWORD_CHANGE_SHOW}',
|
||||||
|
'',
|
||||||
|
$html_string_password_change
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->login_template['strings']['PASSWORD_CHANGE_DIV'] = $html_string_password_change;
|
$this->login_template['strings']['PASSWORD_CHANGE_DIV'] = $html_string_password_change;
|
||||||
}
|
}
|
||||||
|
|
||||||
// put in the logout redirect string
|
// put in the logout redirect string
|
||||||
if ($this->logout && $LOGOUT_TARGET) {
|
if ($this->logout && $LOGOUT_TARGET) {
|
||||||
$html_string = str_replace('{LOGOUT_TARGET}', '<meta http-equiv="refresh" content="0; URL='.$LOGOUT_TARGET.'">', $html_string);
|
$html_string = str_replace(
|
||||||
|
'{LOGOUT_TARGET}',
|
||||||
|
'<meta http-equiv="refresh" content="0; URL=' . $LOGOUT_TARGET . '">',
|
||||||
|
$html_string
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$html_string = str_replace('{LOGOUT_TARGET}', '', $html_string);
|
$html_string = str_replace('{LOGOUT_TARGET}', '', $html_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print error messagae
|
// print error messagae
|
||||||
if ($this->login_error) {
|
if ($this->login_error) {
|
||||||
$html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[$this->login_error].'<br>', $html_string);
|
$html_string = str_replace(
|
||||||
|
'{ERROR_MSG}',
|
||||||
|
$this->login_error_msg[$this->login_error] . '<br>',
|
||||||
|
$html_string
|
||||||
|
);
|
||||||
} elseif ($this->password_change_ok && $this->password_change) {
|
} elseif ($this->password_change_ok && $this->password_change) {
|
||||||
$html_string = str_replace('{ERROR_MSG}', $this->login_error_msg[300].'<br>', $html_string);
|
$html_string = str_replace(
|
||||||
|
'{ERROR_MSG}',
|
||||||
|
$this->login_error_msg[300] . '<br>',
|
||||||
|
$html_string
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$html_string = str_replace('{ERROR_MSG}', '<br>', $html_string);
|
$html_string = str_replace('{ERROR_MSG}', '<br>', $html_string);
|
||||||
}
|
}
|
||||||
@@ -1000,24 +1097,33 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
];
|
];
|
||||||
|
|
||||||
$error_msgs = [
|
$error_msgs = [
|
||||||
'100' => $this->l->__('Fatal Error: <b>[EUID] came in as GET/POST!</b>'), // actually obsolete
|
// actually obsolete
|
||||||
'1010' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'), // user not found
|
'100' => $this->l->__('Fatal Error: <b>[EUID] came in as GET/POST!</b>'),
|
||||||
'1011' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'), // blowfish password wrong
|
// user not found
|
||||||
'1012' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'), // fallback md5 password wrong
|
'1010' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'),
|
||||||
'1013' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'), // new password_hash wrong
|
// blowfish password wrong
|
||||||
|
'1011' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'),
|
||||||
|
// fallback md5 password wrong
|
||||||
|
'1012' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'),
|
||||||
|
// new password_hash wrong
|
||||||
|
'1013' => $this->l->__('Fatal Error: <b>Login Failed - Wrong Username or Password</b>'),
|
||||||
'102' => $this->l->__('Fatal Error: <b>Login Failed - Please enter username and password</b>'),
|
'102' => $this->l->__('Fatal Error: <b>Login Failed - Please enter username and password</b>'),
|
||||||
'103' => $this->l->__('Fatal Error: <b>You do not have the rights to access this Page</b>'),
|
'103' => $this->l->__('Fatal Error: <b>You do not have the rights to access this Page</b>'),
|
||||||
'104' => $this->l->__('Fatal Error: <b>Login Failed - User not enabled</b>'),
|
'104' => $this->l->__('Fatal Error: <b>Login Failed - User not enabled</b>'),
|
||||||
'105' => $this->l->__('Fatal Error: <b>Login Failed - User is locked</b>'),
|
'105' => $this->l->__('Fatal Error: <b>Login Failed - User is locked</b>'),
|
||||||
'220' => $this->l->__('Fatal Error: <b>Password change - The user could not be found</b>'), // actually this is an illegal user, but I mask it
|
// actually this is an illegal user, but I mask it
|
||||||
|
'220' => $this->l->__('Fatal Error: <b>Password change - The user could not be found</b>'),
|
||||||
'200' => $this->l->__('Fatal Error: <b>Password change - Please enter username and old password</b>'),
|
'200' => $this->l->__('Fatal Error: <b>Password change - Please enter username and old password</b>'),
|
||||||
'201' => $this->l->__('Fatal Error: <b>Password change - The user could not be found</b>'),
|
'201' => $this->l->__('Fatal Error: <b>Password change - The user could not be found</b>'),
|
||||||
'202' => $this->l->__('Fatal Error: <b>Password change - The old password is not correct</b>'),
|
'202' => $this->l->__('Fatal Error: <b>Password change - The old password is not correct</b>'),
|
||||||
'203' => $this->l->__('Fatal Error: <b>Password change - Please fill out both new password fields</b>'),
|
'203' => $this->l->__('Fatal Error: <b>Password change - Please fill out both new password fields</b>'),
|
||||||
'204' => $this->l->__('Fatal Error: <b>Password change - The new passwords do not match</b>'),
|
'204' => $this->l->__('Fatal Error: <b>Password change - The new passwords do not match</b>'),
|
||||||
'205' => $this->l->__('Fatal Error: <b>Password change - The new password is not in a valid format</b>'), // we should also not here WHAT is valid
|
// we should also not here WHAT is valid
|
||||||
'300' => $this->l->__('Success: <b>Password change successful</b>'), // for OK password change
|
'205' => $this->l->__('Fatal Error: <b>Password change - The new password is not in a valid format</b>'),
|
||||||
'9999' => $this->l->__('Fatal Error: <b>necessary crypt engine could not be found</b>. Login is impossible') // this is bad bad error
|
// for OK password change
|
||||||
|
'300' => $this->l->__('Success: <b>Password change successful</b>'),
|
||||||
|
// this is bad bad error
|
||||||
|
'9999' => $this->l->__('Fatal Error: <b>necessary crypt engine could not be found</b>. Login is impossible')
|
||||||
];
|
];
|
||||||
|
|
||||||
// if password change is okay
|
// if password change is okay
|
||||||
@@ -1028,23 +1134,36 @@ class Login extends \CoreLibs\DB\IO
|
|||||||
'NEW_PASSWORD' => $this->l->__('New Password'),
|
'NEW_PASSWORD' => $this->l->__('New Password'),
|
||||||
'NEW_PASSWORD_CONFIRM' => $this->l->__('New Password confirm'),
|
'NEW_PASSWORD_CONFIRM' => $this->l->__('New Password confirm'),
|
||||||
'CLOSE' => $this->l->__('Close'),
|
'CLOSE' => $this->l->__('Close'),
|
||||||
'JS_SHOW_HIDE' => "function ShowHideDiv(id) { element = document.getElementById(id); if (element.className == 'visible' || !element.className) element.className = 'hidden'; else element.className = 'visible'; }",
|
'JS_SHOW_HIDE' => "function ShowHideDiv(id) { "
|
||||||
'PASSWORD_CHANGE_BUTTON' => '<input type="button" name="pw_change" value="'.$strings['PASSWORD_CHANGE_BUTTON_VALUE'].'" OnClick="ShowHideDiv(\'pw_change_div\');">'
|
. "element = document.getElementById(id); "
|
||||||
|
. "if (element.className == 'visible' || !element.className) element.className = 'hidden'; "
|
||||||
|
. "else element.className = 'visible'; }",
|
||||||
|
'PASSWORD_CHANGE_BUTTON' => '<input type="button" name="pw_change" value="'
|
||||||
|
. $strings['PASSWORD_CHANGE_BUTTON_VALUE']
|
||||||
|
. '" OnClick="ShowHideDiv(\'pw_change_div\');">'
|
||||||
]);
|
]);
|
||||||
|
// NOTE: for the HTML block I ignore line lengths
|
||||||
|
// phpcs:disable
|
||||||
$this->login_template['password_change'] = <<<EOM
|
$this->login_template['password_change'] = <<<EOM
|
||||||
<div id="pw_change_div" class="hidden" style="position: absolute; top: 30px; left: 50px; width: 400px; height: 220px; background-color: white; border: 1px solid black; padding: 25px;">
|
<div id="pw_change_div" class="hidden" style="position: absolute; top: 30px; left: 50px; width: 400px; height: 220px; background-color: white; border: 1px solid black; padding: 25px;">
|
||||||
<table>
|
<table>
|
||||||
<tr><td class="norm" align="center" colspan="2"><h3>{TITLE_PASSWORD_CHANGE}</h3></td></tr>
|
<tr><td class="norm" align="center" colspan="2"><h3>{TITLE_PASSWORD_CHANGE}</h3></td></tr>
|
||||||
<tr><td class="norm" colspan="2">{ERROR_MSG}</td></tr>
|
<tr><td class="norm" colspan="2">{ERROR_MSG}</td></tr>
|
||||||
<tr><td class="norm" align="right">{USERNAME}</td><td><input type="text" name="pw_username" value=""></td></tr>
|
<tr><td class="norm" align="right">{USERNAME}</td><td><input type="text" name="pw_username" value=""></td></tr>
|
||||||
<tr><td class="norm" align="right">{OLD_PASSWORD}</td><td><input type="password" name="pw_old_password" value=""></td></tr>
|
<tr><td class="norm" align="right">{OLD_PASSWORD}</td>
|
||||||
<tr><td class="norm" align="right">{NEW_PASSWORD}</td><td><input type="password" name="pw_new_password" value=""></td></tr>
|
<td><input type="password" name="pw_old_password" value=""></td></tr>
|
||||||
<tr><td class="norm" align="right">{NEW_PASSWORD_CONFIRM}</td><td><input type="password" name="pw_new_password_confirm" value=""></td></tr>
|
<tr><td class="norm" align="right">{NEW_PASSWORD}</td>
|
||||||
<tr><td></td><td><input type="submit" name="change_password" value="{PASSWORD_CHANGE_BUTTON_VALUE}"><input type="button" name="pw_change" value="{CLOSE}" OnClick="ShowHideDiv('pw_change_div');"></td></tr>
|
<td><input type="password" name="pw_new_password" value=""></td></tr>
|
||||||
|
<tr><td class="norm" align="right">{NEW_PASSWORD_CONFIRM}</td>
|
||||||
|
<td><input type="password" name="pw_new_password_confirm" value=""></td></tr>
|
||||||
|
<tr><td></td>
|
||||||
|
<td><input type="submit" name="change_password" value="{PASSWORD_CHANGE_BUTTON_VALUE}">
|
||||||
|
<input type="button" name="pw_change" value="{CLOSE}" OnClick="ShowHideDiv('pw_change_div');"></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{PASSWORD_CHANGE_SHOW}
|
{PASSWORD_CHANGE_SHOW}
|
||||||
EOM;
|
EOM;
|
||||||
|
// phpcs:enable
|
||||||
}
|
}
|
||||||
if ($this->password_forgot) {
|
if ($this->password_forgot) {
|
||||||
}
|
}
|
||||||
@@ -1163,15 +1282,25 @@ EOM;
|
|||||||
];
|
];
|
||||||
$data_binary = $this->dbEscapeBytea(bzcompress(serialize($_data_binary)));
|
$data_binary = $this->dbEscapeBytea(bzcompress(serialize($_data_binary)));
|
||||||
// SQL querie for log entry
|
// SQL querie for log entry
|
||||||
$q = "INSERT INTO edit_log ";
|
$q = "INSERT INTO edit_log "
|
||||||
$q .= "(username, password, euid, event_date, event, error, data, data_binary, page, ";
|
. "(username, password, euid, event_date, event, error, data, data_binary, page, "
|
||||||
$q .= "ip, user_agent, referer, script_name, query_string, server_name, http_host, http_accept, http_accept_charset, http_accept_encoding, session_id, ";
|
. "ip, user_agent, referer, script_name, query_string, server_name, http_host, "
|
||||||
$q .= "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) ";
|
. "http_accept, http_accept_charset, http_accept_encoding, session_id, "
|
||||||
$q .= "VALUES ('".$this->dbEscapeString($username)."', 'PASSWORD', ".($this->euid ? $this->euid : 'NULL').", ";
|
. "action, action_id, action_yes, action_flag, action_menu, action_loaded, "
|
||||||
$q .= "NOW(), '".$this->dbEscapeString($event)."', '".$this->dbEscapeString((string)$error)."', '".$this->dbEscapeString($data)."', '".$data_binary."', '".$this->page_name."', ";
|
. "action_value, action_error) "
|
||||||
foreach ([
|
. "VALUES ('" . $this->dbEscapeString($username) . "', 'PASSWORD', "
|
||||||
'REMOTE_ADDR', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'SCRIPT_FILENAME', 'QUERY_STRING', 'SERVER_NAME', 'HTTP_HOST', 'HTTP_ACCEPT', 'HTTP_ACCEPT_CHARSET', 'HTTP_ACCEPT_ENCODING'
|
. ($this->euid ? $this->euid : 'NULL') . ", "
|
||||||
] as $server_code) {
|
. "NOW(), '" . $this->dbEscapeString($event) . "', "
|
||||||
|
. "'" . $this->dbEscapeString((string)$error) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($data) . "', '" . $data_binary . "', "
|
||||||
|
. "'" . $this->page_name . "', ";
|
||||||
|
foreach (
|
||||||
|
[
|
||||||
|
'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 {
|
||||||
@@ -1197,7 +1326,8 @@ EOM;
|
|||||||
*/
|
*/
|
||||||
public function loginCheckEditAccessId(?int $edit_access_id): ?int
|
public function loginCheckEditAccessId(?int $edit_access_id): ?int
|
||||||
{
|
{
|
||||||
if (isset($_SESSION['UNIT']) &&
|
if (
|
||||||
|
isset($_SESSION['UNIT']) &&
|
||||||
is_array($_SESSION['UNIT']) &&
|
is_array($_SESSION['UNIT']) &&
|
||||||
!array_key_exists($edit_access_id, $_SESSION['UNIT'])
|
!array_key_exists($edit_access_id, $_SESSION['UNIT'])
|
||||||
) {
|
) {
|
||||||
@@ -1222,6 +1352,7 @@ EOM;
|
|||||||
return $_SESSION['UNIT'][$edit_access_id]['data'][$data_key];
|
return $_SESSION['UNIT'][$edit_access_id]['data'][$data_key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // close class
|
// close class
|
||||||
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2006/08/15
|
* CREATED: 2006/08/15
|
||||||
@@ -26,6 +27,8 @@
|
|||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Admin;
|
namespace CoreLibs\Admin;
|
||||||
|
|
||||||
class Backend extends \CoreLibs\DB\IO
|
class Backend extends \CoreLibs\DB\IO
|
||||||
@@ -34,7 +37,10 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
public $menu = [];
|
public $menu = [];
|
||||||
public $menu_show_flag = 0; // top menu flag (mostly string)
|
public $menu_show_flag = 0; // top menu flag (mostly string)
|
||||||
// action ids
|
// action ids
|
||||||
public $action_list = ['action', 'action_id', 'action_sub_id', 'action_yes', 'action_flag', 'action_menu', 'action_value', 'action_error', 'action_loaded'];
|
public $action_list = [
|
||||||
|
'action', 'action_id', 'action_sub_id', 'action_yes', 'action_flag',
|
||||||
|
'action_menu', 'action_value', 'action_error', 'action_loaded'
|
||||||
|
];
|
||||||
public $action;
|
public $action;
|
||||||
public $action_id;
|
public $action_id;
|
||||||
public $action_sub_id;
|
public $action_sub_id;
|
||||||
@@ -182,32 +188,38 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
$SCHEMA = 'public';
|
$SCHEMA = 'public';
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "INSERT INTO ".$SCHEMA.".edit_log ";
|
$q = "INSERT INTO " . $SCHEMA . ".edit_log "
|
||||||
$q .= "(euid, event_date, event, data, data_binary, page, ";
|
. "(euid, event_date, event, data, data_binary, page, "
|
||||||
$q .= "ip, user_agent, referer, script_name, query_string, server_name, http_host, http_accept, http_accept_charset, http_accept_encoding, session_id, ";
|
. "ip, user_agent, referer, script_name, query_string, server_name, http_host, "
|
||||||
$q .= "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) ";
|
. "http_accept, http_accept_charset, http_accept_encoding, session_id, "
|
||||||
$q .= "VALUES ";
|
. "action, action_id, action_yes, action_flag, action_menu, action_loaded, action_value, action_error) "
|
||||||
$q .= "(".$this->dbEscapeString(isset($_SESSION['EUID']) && is_numeric($_SESSION['EUID']) ? $_SESSION['EUID'] : 'NULL').", ";
|
. "VALUES "
|
||||||
$q .= "NOW(), ";
|
. "(" . $this->dbEscapeString(isset($_SESSION['EUID']) && is_numeric($_SESSION['EUID']) ?
|
||||||
$q .= "'".$this->dbEscapeString((string)$event)."', '".$data."', '".$data_binary."', '".$this->dbEscapeString((string)$this->page_name)."', ";
|
$_SESSION['EUID'] :
|
||||||
$q .= "'".@$_SERVER["REMOTE_ADDR"]."', '".$this->dbEscapeString(@$_SERVER['HTTP_USER_AGENT'])."', ";
|
'NULL')
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['HTTP_REFERER'] ?? '')."', ";
|
. ", "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['SCRIPT_FILENAME'] ?? '')."', ";
|
. "NOW(), "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['QUERY_STRING'] ?? '')."', ";
|
. "'" . $this->dbEscapeString((string)$event) . "', '" . $data . "', "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['SERVER_NAME'] ?? '')."', ";
|
. "'" . $data_binary . "', '" . $this->dbEscapeString((string)$this->page_name) . "', "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['HTTP_HOST'] ?? '')."', ";
|
. "'" . @$_SERVER["REMOTE_ADDR"] . "', "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['HTTP_ACCEPT'] ?? '')."', ";
|
. "'" . $this->dbEscapeString(@$_SERVER['HTTP_USER_AGENT']) . "', "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['HTTP_ACCEPT_CHARSET'] ?? '')."', ";
|
. "'" . $this->dbEscapeString($_SERVER['HTTP_REFERER'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($_SERVER['HTTP_ACCEPT_ENCODING'] ?? '')."', ";
|
. "'" . $this->dbEscapeString($_SERVER['SCRIPT_FILENAME'] ?? '') . "', "
|
||||||
$q .= "'".session_id()."', ";
|
. "'" . $this->dbEscapeString($_SERVER['QUERY_STRING'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action)."', ";
|
. "'" . $this->dbEscapeString($_SERVER['SERVER_NAME'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_id)."', ";
|
. "'" . $this->dbEscapeString($_SERVER['HTTP_HOST'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_yes)."', ";
|
. "'" . $this->dbEscapeString($_SERVER['HTTP_ACCEPT'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_flag)."', ";
|
. "'" . $this->dbEscapeString($_SERVER['HTTP_ACCEPT_CHARSET'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_menu)."', ";
|
. "'" . $this->dbEscapeString($_SERVER['HTTP_ACCEPT_ENCODING'] ?? '') . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_loaded)."', ";
|
. "'" . session_id() . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_value)."', ";
|
. "'" . $this->dbEscapeString($this->action) . "', "
|
||||||
$q .= "'".$this->dbEscapeString($this->action_error)."')";
|
. "'" . $this->dbEscapeString($this->action_id) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($this->action_yes) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($this->action_flag) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($this->action_menu) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($this->action_loaded) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($this->action_value) . "', "
|
||||||
|
. "'" . $this->dbEscapeString($this->action_error) . "')";
|
||||||
$this->dbExec($q, 'NULL');
|
$this->dbExec($q, 'NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,20 +274,23 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
$query_string = '';
|
$query_string = '';
|
||||||
|
|
||||||
if (isset($data['query']) &&
|
if (
|
||||||
|
isset($data['query']) &&
|
||||||
is_array($data['query']) &&
|
is_array($data['query']) &&
|
||||||
count($data['query'])
|
count($data['query'])
|
||||||
) {
|
) {
|
||||||
// for ($j = 0, $jMax = count($pages[$i]['query']); $j < $jMax; $j ++) {
|
// for ($j = 0, $jMax = count($pages[$i]['query']); $j < $jMax; $j ++) {
|
||||||
foreach ($data['query'] as $j => $query) {
|
foreach ($data['query'] as $j => $query) {
|
||||||
if (!empty($query['name']) &&
|
if (
|
||||||
|
!empty($query['name']) &&
|
||||||
!empty($query['value'])
|
!empty($query['value'])
|
||||||
) {
|
) {
|
||||||
if (strlen($query_string)) {
|
if (strlen($query_string)) {
|
||||||
$query_string .= '&';
|
$query_string .= '&';
|
||||||
}
|
}
|
||||||
$query_string .= $query['name'] . '=';
|
$query_string .= $query['name'] . '=';
|
||||||
if (isset($query['dynamic']) &&
|
if (
|
||||||
|
isset($query['dynamic']) &&
|
||||||
$query['dynamic']
|
$query['dynamic']
|
||||||
) {
|
) {
|
||||||
if (isset($_GET[$query['value']])) {
|
if (isset($_GET[$query['value']])) {
|
||||||
@@ -300,7 +315,8 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
$name = $data['page_name'] ?? '';
|
$name = $data['page_name'] ?? '';
|
||||||
// if page name matchs -> set selected flag
|
// if page name matchs -> set selected flag
|
||||||
$selected = 0;
|
$selected = 0;
|
||||||
if (isset($data['filename']) &&
|
if (
|
||||||
|
isset($data['filename']) &&
|
||||||
\CoreLibs\Get\System::getPageName() == $data['filename'] &&
|
\CoreLibs\Get\System::getPageName() == $data['filename'] &&
|
||||||
(!isset($data['hostname']) || (
|
(!isset($data['hostname']) || (
|
||||||
isset($data['hostname']) &&
|
isset($data['hostname']) &&
|
||||||
@@ -312,7 +328,8 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
// last check, is this menu point okay to show
|
// last check, is this menu point okay to show
|
||||||
$enabled = 0;
|
$enabled = 0;
|
||||||
if (isset($data['filename']) &&
|
if (
|
||||||
|
isset($data['filename']) &&
|
||||||
$this->adbShowMenuPoint($data['filename'])
|
$this->adbShowMenuPoint($data['filename'])
|
||||||
) {
|
) {
|
||||||
$enabled = 1;
|
$enabled = 1;
|
||||||
@@ -364,7 +381,10 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
*/
|
*/
|
||||||
public function adbAssocArray(array $db_array, $key, $value): array
|
public function adbAssocArray(array $db_array, $key, $value): array
|
||||||
{
|
{
|
||||||
trigger_error('Method '.__METHOD__.' is deprecated: \CoreLibs\Combined\ArrayHandler::genAssocArray', E_USER_DEPRECATED);
|
trigger_error(
|
||||||
|
'Method ' . __METHOD__ . ' is deprecated: \CoreLibs\Combined\ArrayHandler::genAssocArray',
|
||||||
|
E_USER_DEPRECATED
|
||||||
|
);
|
||||||
return \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value);
|
return \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +397,10 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
*/
|
*/
|
||||||
public function adbByteStringFormat($number): string
|
public function adbByteStringFormat($number): string
|
||||||
{
|
{
|
||||||
trigger_error('Method '.__METHOD__.' is deprecated: \CoreLibs\Convert\Byte::humanReadableByteFormat()', E_USER_DEPRECATED);
|
trigger_error(
|
||||||
|
'Method ' . __METHOD__ . ' is deprecated: \CoreLibs\Convert\Byte::humanReadableByteFormat()',
|
||||||
|
E_USER_DEPRECATED
|
||||||
|
);
|
||||||
return \CoreLibs\Convert\Byte::humanReadableByteFormat($number);
|
return \CoreLibs\Convert\Byte::humanReadableByteFormat($number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +417,10 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
*/
|
*/
|
||||||
public function adbCreateThumbnail($pic, $size_x, $size_y, $dummy = '', $path = "", $cache = "")
|
public function adbCreateThumbnail($pic, $size_x, $size_y, $dummy = '', $path = "", $cache = "")
|
||||||
{
|
{
|
||||||
trigger_error('Method '.__METHOD__.' is deprecated: \CoreLibs\Output\Image::createThumbnail()', E_USER_DEPRECATED);
|
trigger_error(
|
||||||
|
'Method ' . __METHOD__ . ' is deprecated: \CoreLibs\Output\Image::createThumbnail()',
|
||||||
|
E_USER_DEPRECATED
|
||||||
|
);
|
||||||
return \CoreLibs\Output\Image::createThumbnail($pic, $size_x, $size_y, $dummy, $path, $cache);
|
return \CoreLibs\Output\Image::createThumbnail($pic, $size_x, $size_y, $dummy, $path, $cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,14 +484,15 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
} else {
|
} else {
|
||||||
$SCHEMA = 'public';
|
$SCHEMA = 'public';
|
||||||
}
|
}
|
||||||
$q = "INSERT INTO ".$SCHEMA.".live_queue (";
|
$q = "INSERT INTO " . $SCHEMA . ".live_queue ("
|
||||||
$q .= "queue_key, key_value, key_name, type, target, data, group_key, action, associate, file";
|
. "queue_key, key_value, key_name, type, target, data, group_key, action, associate, file"
|
||||||
$q .= ") VALUES (";
|
. ") VALUES ("
|
||||||
$q .= "'".$this->dbEscapeString($queue_key)."', '".$this->dbEscapeString($key_value)."', ";
|
. "'" . $this->dbEscapeString($queue_key) . "', '" . $this->dbEscapeString($key_value) . "', "
|
||||||
$q .= "'".$this->dbEscapeString($key_name)."', '".$this->dbEscapeString($type)."', ";
|
. "'" . $this->dbEscapeString($key_name) . "', '" . $this->dbEscapeString($type) . "', "
|
||||||
$q .= "'".$this->dbEscapeString($target)."', '".$this->dbEscapeString($data)."', ";
|
. "'" . $this->dbEscapeString($target) . "', '" . $this->dbEscapeString($data) . "', "
|
||||||
$q .= "'".$this->queue_key."', '".$this->action."', '".$this->dbEscapeString((string)$associate)."', ";
|
. "'" . $this->queue_key . "', '" . $this->action . "', "
|
||||||
$q .= "'".$this->dbEscapeString((string)$file)."')";
|
. "'" . $this->dbEscapeString((string)$associate) . "', "
|
||||||
|
. "'" . $this->dbEscapeString((string)$file) . "')";
|
||||||
$this->dbExec($q);
|
$this->dbExec($q);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,7 +522,16 @@ class Backend extends \CoreLibs\DB\IO
|
|||||||
bool $name_pos_back = false
|
bool $name_pos_back = false
|
||||||
) {
|
) {
|
||||||
// get the build layout
|
// get the build layout
|
||||||
$html_time = \CoreLibs\Output\Form\Elements::printDateTime($year, $month, $day, $hour, $min, $suffix, $min_steps, $name_pos_back);
|
$html_time = \CoreLibs\Output\Form\Elements::printDateTime(
|
||||||
|
$year,
|
||||||
|
$month,
|
||||||
|
$day,
|
||||||
|
$hour,
|
||||||
|
$min,
|
||||||
|
$suffix,
|
||||||
|
$min_steps,
|
||||||
|
$name_pos_back
|
||||||
|
);
|
||||||
// translate the strings inside
|
// translate the strings inside
|
||||||
foreach (['Year ', 'Month ', 'Day ', 'Hour ', 'Minute '] as $_time) {
|
foreach (['Year ', 'Month ', 'Day ', 'Hour ', 'Minute '] as $_time) {
|
||||||
$html_time = str_replace($_time, $this->l->__(str_replace(' ', '', $_time)) . ' ', $html_time);
|
$html_time = str_replace($_time, $this->l->__(str_replace(' ', '', $_time)) . ' ', $html_time);
|
||||||
|
|||||||
+27
-79
@@ -1,4 +1,7 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
// phpcs:disable Generic.Files.LineLength
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2003/03/24
|
* CREATED: 2003/03/24
|
||||||
@@ -15,12 +18,15 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2021/06/16 (cs) CLASS MOSTLY DEPRECATED: moved all methids in their own classes
|
* 2021/06/16 (cs) CLASS MOSTLY DEPRECATED: moved all methids in their own classes
|
||||||
* 2010/12/24 (cs) add crypt classes with auto detect what crypt we can use, add php version check class
|
* 2010/12/24 (cs) add crypt classes with auto detect what crypt we can use, add php version check class
|
||||||
* 2008/08/07 (cs) fixed strange DEBUG_ALL on off behavour. data was written even thought DBEUG_ALL was off. now no debug logging is done at all if DEBUG_ALL is off
|
* 2008/08/07 (cs) fixed strange DEBUG_ALL on off behavour. data was written even thought
|
||||||
|
* DBEUG_ALL was off. now no debug logging is done at all if DEBUG_ALL is off
|
||||||
* 2007/11/13 (cs) add Comparedate function
|
* 2007/11/13 (cs) add Comparedate function
|
||||||
* 2007/11/05 (cs) added GenAssocArray and CheckDate functions
|
* 2007/11/05 (cs) added GenAssocArray and CheckDate functions
|
||||||
* 2007/10/10 (cs) magic links function can use http:///path as a local prefix. blank target is removed & http:// also
|
* 2007/10/10 (cs) magic links function can use http:///path as a local prefix.
|
||||||
|
* blank target is removed & http:// also
|
||||||
* 2006/03/09 (cs) added Byte/TimeStringFormat functions
|
* 2006/03/09 (cs) added Byte/TimeStringFormat functions
|
||||||
* 2006/02/21 (cs) fix various problems with the mime magic function: || not always working, fix prefix replacement, etc
|
* 2006/02/21 (cs) fix various problems with the mime magic function: || not always working,
|
||||||
|
* fix prefix replacement, etc
|
||||||
* 2006/02/09 (cs) added _mb_mime_encode function, replacement for php internal one
|
* 2006/02/09 (cs) added _mb_mime_encode function, replacement for php internal one
|
||||||
* 2005/07/12 (cs) added some small stylesheet defs to debug output
|
* 2005/07/12 (cs) added some small stylesheet defs to debug output
|
||||||
* 2005/06/24 (cs) made the check selected/checked function way easier
|
* 2005/06/24 (cs) made the check selected/checked function way easier
|
||||||
@@ -43,6 +49,8 @@
|
|||||||
* 2003-03-24: start of stub/basic class
|
* 2003-03-24: start of stub/basic class
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs;
|
namespace CoreLibs;
|
||||||
|
|
||||||
/** Basic core class declaration */
|
/** Basic core class declaration */
|
||||||
@@ -77,13 +85,19 @@ class Basic
|
|||||||
// TODO make check dynamic for entries we MUST have depending on load type
|
// TODO make check dynamic for entries we MUST have depending on load type
|
||||||
// before we start any work, we should check that all MUST constants are defined
|
// before we start any work, we should check that all MUST constants are defined
|
||||||
$abort = false;
|
$abort = false;
|
||||||
foreach ([
|
foreach (
|
||||||
'DS', 'DIR', 'BASE', 'ROOT', 'LIB', 'INCLUDES', 'LAYOUT', 'PICTURES', 'FLASH', 'VIDEOS', 'DOCUMENTS', 'PDFS', 'BINARIES', 'ICONS',
|
[
|
||||||
'UPLOADS', 'CSV', 'JS', 'CSS', 'TABLE_ARRAYS', 'SMARTY', 'LANG', 'CACHE', 'TMP', 'LOG', 'TEMPLATES', 'TEMPLATES_C',
|
'DS', 'DIR', 'BASE', 'ROOT', 'LIB', 'INCLUDES', 'LAYOUT', 'PICTURES', 'FLASH',
|
||||||
'DEFAULT_LANG', 'DEFAULT_ENCODING', 'DEFAULT_HASH',
|
'VIDEOS', 'DOCUMENTS', 'PDFS', 'BINARIES', 'ICONS', 'UPLOADS', 'CSV', 'JS',
|
||||||
'DEFAULT_ACL_LEVEL', 'LOGOUT_TARGET', 'PASSWORD_CHANGE', 'AJAX_REQUEST_TYPE', 'USE_PROTOTYPE', 'USE_SCRIPTACULOUS', 'USE_JQUERY',
|
'CSS', 'TABLE_ARRAYS', 'SMARTY', 'LANG', 'CACHE', 'TMP', 'LOG', 'TEMPLATES',
|
||||||
'PAGE_WIDTH', 'MASTER_TEMPLATE_NAME', 'PUBLIC_SCHEMA', 'TEST_SCHEMA', 'DEV_SCHEMA', 'LIVE_SCHEMA', 'DB_CONFIG_NAME', 'DB_CONFIG', 'TARGET', 'DEBUG', 'SHOW_ALL_ERRORS'
|
'TEMPLATES_C', 'DEFAULT_LANG', 'DEFAULT_ENCODING', 'DEFAULT_HASH',
|
||||||
] as $constant) {
|
'DEFAULT_ACL_LEVEL', 'LOGOUT_TARGET', 'PASSWORD_CHANGE', 'AJAX_REQUEST_TYPE',
|
||||||
|
'USE_PROTOTYPE', 'USE_SCRIPTACULOUS', 'USE_JQUERY', 'PAGE_WIDTH',
|
||||||
|
'MASTER_TEMPLATE_NAME', 'PUBLIC_SCHEMA', 'TEST_SCHEMA', 'DEV_SCHEMA',
|
||||||
|
'LIVE_SCHEMA', 'DB_CONFIG_NAME', 'DB_CONFIG', 'TARGET', 'DEBUG',
|
||||||
|
'SHOW_ALL_ERRORS'
|
||||||
|
] as $constant
|
||||||
|
) {
|
||||||
if (!defined($constant)) {
|
if (!defined($constant)) {
|
||||||
echo "Constant $constant misssing<br>";
|
echo "Constant $constant misssing<br>";
|
||||||
$abort = true;
|
$abort = true;
|
||||||
@@ -357,74 +371,6 @@ class Basic
|
|||||||
return $this->log->printErrorMsg($string);
|
return $this->log->printErrorMsg($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* writes error msg data to file for current level
|
|
||||||
* @param string $level the level to write
|
|
||||||
* @param string $error_string error string to write
|
|
||||||
* @return void has no return
|
|
||||||
*/
|
|
||||||
/* private function writeErrorMsg(string $level, string $error_string): void
|
|
||||||
{
|
|
||||||
// only write if write is requested
|
|
||||||
if ($this->doDebugTrigger('debug', $level) &&
|
|
||||||
$this->doDebugTrigger('print', $level)
|
|
||||||
) {
|
|
||||||
// replace all html tags
|
|
||||||
// $error_string = preg_replace("/(<\/?)(\w+)([^>]*>)/", "##\\2##", $error_string);
|
|
||||||
// $error_string = preg_replace("/(<\/?)(\w+)([^>]*>)/", "", $error_string);
|
|
||||||
// replace special line break tag
|
|
||||||
// $error_string = str_replace('<!--#BR#-->', "\n", $error_string);
|
|
||||||
|
|
||||||
// init output variable
|
|
||||||
$output = $error_string; // output formated error string to output file
|
|
||||||
// init base file path
|
|
||||||
$fn = BASE.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
|
|
||||||
// log ID prefix settings, if not valid, replace with empty
|
|
||||||
if (preg_match("/^[A-Za-z0-9]+$/", $this->log_file_id)) {
|
|
||||||
$rpl_string = '_'.$this->log_file_id;
|
|
||||||
} else {
|
|
||||||
$rpl_string = '';
|
|
||||||
}
|
|
||||||
$fn = str_replace('##LOGID##', $rpl_string, $fn); // log id (like a log file prefix)
|
|
||||||
|
|
||||||
if ($this->log_per_run) {
|
|
||||||
if (isset($GLOBALS['LOG_FILE_UNIQUE_ID'])) {
|
|
||||||
$this->log_file_unique_id = $GLOBALS['LOG_FILE_UNIQUE_ID'];
|
|
||||||
}
|
|
||||||
if (!$this->log_file_unique_id) {
|
|
||||||
$GLOBALS['LOG_FILE_UNIQUE_ID'] = $this->log_file_unique_id = date('Y-m-d_His').'_U_'.substr(hash('sha1', uniqid((string)mt_rand(), true)), 0, 8);
|
|
||||||
}
|
|
||||||
$rpl_string = '_'.$this->log_file_unique_id; // add 8 char unique string
|
|
||||||
} else {
|
|
||||||
$rpl_string = !$this->log_print_file_date ? '' : '_'.date('Y-m-d'); // add date to file
|
|
||||||
}
|
|
||||||
$fn = str_replace('##DATE##', $rpl_string, $fn); // create output filename
|
|
||||||
|
|
||||||
$rpl_string = !$this->log_per_level ? '' : '_'.$level; // if request to write to one file
|
|
||||||
$fn = str_replace('##LEVEL##', $rpl_string, $fn); // create output filename
|
|
||||||
|
|
||||||
$rpl_string = !$this->log_per_class ? '' : '_'.str_replace('\\', '-', get_class($this)); // set sub class settings
|
|
||||||
$fn = str_replace('##CLASS##', $rpl_string, $fn); // create output filename
|
|
||||||
|
|
||||||
$rpl_string = !$this->log_per_page ? '' : '_'.\CoreLibs\Get\System::getPageName(1); // if request to write to one file
|
|
||||||
$fn = str_replace('##PAGENAME##', $rpl_string, $fn); // create output filename
|
|
||||||
|
|
||||||
// write to file
|
|
||||||
// first check if max file size is is set and file is bigger
|
|
||||||
if ($this->log_max_filesize > 0 && ((filesize($fn) / 1024) > $this->log_max_filesize)) {
|
|
||||||
// for easy purpose, rename file only to attach timestamp, nur sequence numbering
|
|
||||||
rename($fn, $fn.'.'.date("YmdHis"));
|
|
||||||
}
|
|
||||||
$fp = fopen($fn, 'a');
|
|
||||||
if ($fp !== false) {
|
|
||||||
fwrite($fp, $output);
|
|
||||||
fclose($fp);
|
|
||||||
} else {
|
|
||||||
echo "<!-- could not open file: $fn //-->";
|
|
||||||
}
|
|
||||||
} // do write to file
|
|
||||||
} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unsests the error message array
|
* unsests the error message array
|
||||||
* can be used if writing is primary to file
|
* can be used if writing is primary to file
|
||||||
@@ -1619,4 +1565,6 @@ class Basic
|
|||||||
// *** JSON END ***
|
// *** JSON END ***
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// phpcs:enable
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Check;
|
namespace CoreLibs\Check;
|
||||||
|
|
||||||
@@ -6,7 +8,8 @@ class Email
|
|||||||
{
|
{
|
||||||
// this is for error check parts in where the email regex failed
|
// this is for error check parts in where the email regex failed
|
||||||
private static $email_regex_check = [
|
private static $email_regex_check = [
|
||||||
0 => "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$", // MASTER
|
0 => "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@"
|
||||||
|
. "[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$", // MASTER
|
||||||
1 => "@(.*)@(.*)", // double @
|
1 => "@(.*)@(.*)", // double @
|
||||||
2 => "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@", // wrong part before @
|
2 => "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@", // wrong part before @
|
||||||
3 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$", // wrong part after @
|
3 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$", // wrong part after @
|
||||||
@@ -18,27 +21,39 @@ class Email
|
|||||||
// the array with the mobile types that are valid
|
// the array with the mobile types that are valid
|
||||||
private static $mobile_email_type = [
|
private static $mobile_email_type = [
|
||||||
'.*@docomo\.ne\.jp$' => 'keitai_docomo',
|
'.*@docomo\.ne\.jp$' => 'keitai_docomo',
|
||||||
'.*@([a-z0-9]{2}\.)?ezweb\.ne\.jp$' => 'keitai_kddi_ezweb', # correct are a[2-4], b2, c[1-9], e[2-9], h[2-4], t[1-9]
|
// correct are a[2-4], b2, c[1-9], e[2-9], h[2-4], t[1-9]
|
||||||
'.*@(ez[a-j]{1}\.)?ido\.ne\.jp$' => 'keitai_kddi_ido', # ez[a-j] or nothing
|
'.*@([a-z0-9]{2}\.)?ezweb\.ne\.jp$' => 'keitai_kddi_ezweb',
|
||||||
'.*@([a-z]{2}\.)?sky\.tu-ka\.ne\.jp$' => 'keitai_kddi_tu-ka', # (sky group)
|
// ez[a-j] or nothing
|
||||||
'.*@([a-z]{2}\.)?sky\.tk[kc]{1}\.ne\.jp$' => 'keitai_kddi_sky', # (sky group) [tkk,tkc only]
|
'.*@(ez[a-j]{1}\.)?ido\.ne\.jp$' => 'keitai_kddi_ido',
|
||||||
'.*@([a-z]{2}\.)?sky\.dtg\.ne\.jp$' => 'keitai_kddi_dtg', # dtg (sky group)
|
// (sky group)
|
||||||
'.*@[tkdhcrnsq]{1}\.vodafone\.ne\.jp$' => 'keitai_softbank_vodafone', # old vodafone [t,k,d,h,c,r,n,s,q]
|
'.*@([a-z]{2}\.)?sky\.tu-ka\.ne\.jp$' => 'keitai_kddi_tu-ka',
|
||||||
'.*@jp-[dhtkrsnqc]{1}\.ne\.jp$' => 'keitai_softbank_j-phone', # very old j-phone (pre vodafone) [d,h,t,k,r,s,n,q,c]
|
// (sky group) [tkk,tkc only]
|
||||||
'.*@([dhtcrknsq]{1}\.)?softbank\.ne\.jp$' => 'keitai_softbank', # add i for iphone also as keitai, others similar to the vodafone group
|
'.*@([a-z]{2}\.)?sky\.tk[kc]{1}\.ne\.jp$' => 'keitai_kddi_sky',
|
||||||
'.*@i{1}\.softbank(\.ne)?\.jp$' => 'smartphone_softbank_iphone', # add iPhone also as keitai and not as pc
|
// dtg (sky group)
|
||||||
'.*@disney\.ne\.jp$' => 'keitai_softbank_disney', # (kids)
|
'.*@([a-z]{2}\.)?sky\.dtg\.ne\.jp$' => 'keitai_kddi_dtg',
|
||||||
|
// old vodafone [t,k,d,h,c,r,n,s,q]
|
||||||
|
'.*@[tkdhcrnsq]{1}\.vodafone\.ne\.jp$' => 'keitai_softbank_vodafone',
|
||||||
|
// very old j-phone (pre vodafone) [d,h,t,k,r,s,n,q,c]
|
||||||
|
'.*@jp-[dhtkrsnqc]{1}\.ne\.jp$' => 'keitai_softbank_j-phone',
|
||||||
|
// add i for iphone also as keitai, others similar to the vodafone group
|
||||||
|
'.*@([dhtcrknsq]{1}\.)?softbank\.ne\.jp$' => 'keitai_softbank',
|
||||||
|
// add iPhone also as keitai and not as pc
|
||||||
|
'.*@i{1}\.softbank(\.ne)?\.jp$' => 'smartphone_softbank_iphone',
|
||||||
|
'.*@disney\.ne\.jp$' => 'keitai_softbank_disney', // (kids)
|
||||||
'.*@willcom\.ne\.jp$' => 'keitai_willcom',
|
'.*@willcom\.ne\.jp$' => 'keitai_willcom',
|
||||||
'.*@willcom\.com$' => 'keitai_willcom', # new for pdx.ne.jp address
|
'.*@willcom\.com$' => 'keitai_willcom', // new for pdx.ne.jp address
|
||||||
'.*@wcm\.ne\.jp$' => 'keitai_willcom', # old willcom wcm.ne.jp
|
'.*@wcm\.ne\.jp$' => 'keitai_willcom', // old willcom wcm.ne.jp
|
||||||
'.*@pdx\.ne\.jp$' => 'keitai_willcom_pdx', # old pdx address for willcom
|
'.*@pdx\.ne\.jp$' => 'keitai_willcom_pdx', // old pdx address for willcom
|
||||||
'.*@bandai\.jp$' => 'keitai_willcom_bandai', # willcom paipo! (kids)
|
'.*@bandai\.jp$' => 'keitai_willcom_bandai', // willcom paipo! (kids)
|
||||||
'.*@pipopa\.ne\.jp$' => 'keitai_willcom_pipopa', # willcom paipo! (kids)
|
'.*@pipopa\.ne\.jp$' => 'keitai_willcom_pipopa', // willcom paipo! (kids)
|
||||||
'.*@([a-z0-9]{2,4}\.)?pdx\.ne\.jp$' => 'keitai_willcom_pdx', # actually only di,dj,dk,wm -> all others are "wrong", but none also allowed?
|
// actually only di,dj,dk,wm -> all others are "wrong", but none also allowed?
|
||||||
'.*@ymobile([1]{1})?\.ne\.jp$' => 'keitai_willcom_ymobile', # ymobile, ymobile1 techincally not willcom, but I group them there (softbank sub)
|
'.*@([a-z0-9]{2,4}\.)?pdx\.ne\.jp$' => 'keitai_willcom_pdx',
|
||||||
'.*@y-mobile\.ne\.jp$' => 'keitai_willcom_ymobile', # y-mobile techincally not willcom, but I group them there (softbank sub)
|
// ymobile, ymobile1 techincally not willcom, but I group them there (softbank sub)
|
||||||
'.*@emnet\.ne\.jp$' => 'keitai_willcom_emnet', # e-mobile, group will willcom
|
'.*@ymobile([1]{1})?\.ne\.jp$' => 'keitai_willcom_ymobile',
|
||||||
'.*@emobile\.ne\.jp$' => 'keitai_willcom_emnet', # e-mobile, group will willcom
|
// y-mobile techincally not willcom, but I group them there (softbank sub)
|
||||||
|
'.*@y-mobile\.ne\.jp$' => 'keitai_willcom_ymobile',
|
||||||
|
'.*@emnet\.ne\.jp$' => 'keitai_willcom_emnet', // e-mobile, group will willcom
|
||||||
|
'.*@emobile\.ne\.jp$' => 'keitai_willcom_emnet', // e-mobile, group will willcom
|
||||||
'.*@emobile-s\.ne\.jp$' => 'keitai_willcom_emnet' # e-mobile, group will willcom
|
'.*@emobile-s\.ne\.jp$' => 'keitai_willcom_emnet' # e-mobile, group will willcom
|
||||||
];
|
];
|
||||||
// short list for mobile email types
|
// short list for mobile email types
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* various file/file name functions
|
* various file/file name functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Check;
|
namespace CoreLibs\Check;
|
||||||
|
|
||||||
class File
|
class File
|
||||||
@@ -26,7 +28,8 @@ class File
|
|||||||
*/
|
*/
|
||||||
public static function getLinesFromFile(string $file): int
|
public static function getLinesFromFile(string $file): int
|
||||||
{
|
{
|
||||||
if (is_file($file) &&
|
if (
|
||||||
|
is_file($file) &&
|
||||||
file_exists($file) &&
|
file_exists($file) &&
|
||||||
is_readable($file)
|
is_readable($file)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Converts a json string to array and stores error for later checking
|
* Converts a json string to array and stores error for later checking
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
* and self set json as is on error as array
|
* and self set json as is on error as array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Check;
|
namespace CoreLibs\Check;
|
||||||
|
|
||||||
class Jason
|
class Jason
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* core password set, check and rehash check wrapper functions
|
* core password set, check and rehash check wrapper functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Check;
|
namespace CoreLibs\Check;
|
||||||
|
|
||||||
class Password
|
class Password
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Check;
|
namespace CoreLibs\Check;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* html convert functions
|
* html convert functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Combined;
|
namespace CoreLibs\Combined;
|
||||||
|
|
||||||
class ArrayHandler
|
class ArrayHandler
|
||||||
@@ -23,7 +25,8 @@ class ArrayHandler
|
|||||||
if (!is_array($haystack)) {
|
if (!is_array($haystack)) {
|
||||||
$haystack = [];
|
$haystack = [];
|
||||||
}
|
}
|
||||||
if ($key_lookin != null &&
|
if (
|
||||||
|
$key_lookin != null &&
|
||||||
!empty($key_lookin) &&
|
!empty($key_lookin) &&
|
||||||
array_key_exists($key_lookin, $haystack) &&
|
array_key_exists($key_lookin, $haystack) &&
|
||||||
$needle === $haystack[$key_lookin]
|
$needle === $haystack[$key_lookin]
|
||||||
@@ -31,20 +34,23 @@ class ArrayHandler
|
|||||||
$path[] = $key_lookin;
|
$path[] = $key_lookin;
|
||||||
} else {
|
} else {
|
||||||
foreach ($haystack as $key => $val) {
|
foreach ($haystack as $key => $val) {
|
||||||
if (is_scalar($val) &&
|
if (
|
||||||
|
is_scalar($val) &&
|
||||||
$val === $needle &&
|
$val === $needle &&
|
||||||
empty($key_lookin)
|
empty($key_lookin)
|
||||||
) {
|
) {
|
||||||
$path[] = $key;
|
$path[] = $key;
|
||||||
break;
|
break;
|
||||||
} elseif (is_scalar($val) &&
|
} elseif (
|
||||||
|
is_scalar($val) &&
|
||||||
!empty($key_lookin) &&
|
!empty($key_lookin) &&
|
||||||
$key === $key_lookin &&
|
$key === $key_lookin &&
|
||||||
$val == $needle
|
$val == $needle
|
||||||
) {
|
) {
|
||||||
$path[] = $key;
|
$path[] = $key;
|
||||||
break;
|
break;
|
||||||
} elseif (is_array($val) &&
|
} elseif (
|
||||||
|
is_array($val) &&
|
||||||
$path = self::arraySearchRecursive(
|
$path = self::arraySearchRecursive(
|
||||||
$needle,
|
$needle,
|
||||||
(array)$val,
|
(array)$val,
|
||||||
@@ -261,7 +267,8 @@ class ArrayHandler
|
|||||||
// do this to only run count once
|
// do this to only run count once
|
||||||
for ($i = 0, $iMax = count($db_array); $i < $iMax; $i++) {
|
for ($i = 0, $iMax = count($db_array); $i < $iMax; $i++) {
|
||||||
// if no key then we make an order reference
|
// if no key then we make an order reference
|
||||||
if ($key !== false &&
|
if (
|
||||||
|
$key !== false &&
|
||||||
$value !== false &&
|
$value !== false &&
|
||||||
(($set_only && $db_array[$i][$value]) || (!$set_only))
|
(($set_only && $db_array[$i][$value]) || (!$set_only))
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* image thumbnail, rotate, etc
|
* image thumbnail, rotate, etc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Combined;
|
namespace CoreLibs\Combined;
|
||||||
|
|
||||||
class DateTime
|
class DateTime
|
||||||
@@ -159,7 +161,8 @@ class DateTime
|
|||||||
if (!is_numeric($hour) || !is_numeric($min)) {
|
if (!is_numeric($hour) || !is_numeric($min)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (($hour < 0 || $hour > 24) ||
|
if (
|
||||||
|
($hour < 0 || $hour > 24) ||
|
||||||
($min < 0 || $min > 60) ||
|
($min < 0 || $min > 60) ||
|
||||||
(is_numeric($sec) && ($sec < 0 || $sec > 60))
|
(is_numeric($sec) && ($sec < 0 || $sec > 60))
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* image thumbnail, rotate, etc
|
* image thumbnail, rotate, etc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Convert;
|
namespace CoreLibs\Convert;
|
||||||
|
|
||||||
class Byte
|
class Byte
|
||||||
{
|
{
|
||||||
// define byteFormat
|
// define byteFormat
|
||||||
const BYTE_FORMAT_NOSPACE = 1;
|
public const BYTE_FORMAT_NOSPACE = 1;
|
||||||
const BYTE_FORMAT_ADJUST = 2;
|
public const BYTE_FORMAT_ADJUST = 2;
|
||||||
const BYTE_FORMAT_SI = 4;
|
public const BYTE_FORMAT_SI = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function replaces the old byteStringFormat
|
* This function replaces the old byteStringFormat
|
||||||
@@ -75,7 +77,8 @@ class Byte
|
|||||||
// deviation calculation
|
// deviation calculation
|
||||||
$dev = pow($unit, $exp) * ($unit - 0.05);
|
$dev = pow($unit, $exp) * ($unit - 0.05);
|
||||||
// shift the exp +1 for on the border units
|
// shift the exp +1 for on the border units
|
||||||
if ($exp < 6 &&
|
if (
|
||||||
|
$exp < 6 &&
|
||||||
$abs_bytes > ($dev - (((int)$dev & 0xfff) == 0xd00 ? 52 : 0))
|
$abs_bytes > ($dev - (((int)$dev & 0xfff) == 0xd00 ? 52 : 0))
|
||||||
) {
|
) {
|
||||||
$exp++;
|
$exp++;
|
||||||
@@ -120,7 +123,11 @@ class Byte
|
|||||||
// all valid units
|
// all valid units
|
||||||
$valid_units_ = 'bkmgtpezy';
|
$valid_units_ = 'bkmgtpezy';
|
||||||
// detects up to exo bytes
|
// detects up to exo bytes
|
||||||
preg_match("/([\d.,]*)\s?(eib|pib|tib|gib|mib|kib|eb|pb|tb|gb|mb|kb|e|p|t|g|m|k|b)$/i", strtolower($number), $matches);
|
preg_match(
|
||||||
|
"/([\d.,]*)\s?(eib|pib|tib|gib|mib|kib|eb|pb|tb|gb|mb|kb|e|p|t|g|m|k|b)$/i",
|
||||||
|
strtolower($number),
|
||||||
|
$matches
|
||||||
|
);
|
||||||
if (isset($matches[1]) && isset($matches[2])) {
|
if (isset($matches[1]) && isset($matches[2])) {
|
||||||
// remove all non valid characters from the number
|
// remove all non valid characters from the number
|
||||||
$number = preg_replace('/[^0-9\.]/', '', $matches[1]);
|
$number = preg_replace('/[^0-9\.]/', '', $matches[1]);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert color spaces
|
* Convert color spaces
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
* hsl to rgb
|
* hsl to rgb
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Convert;
|
namespace CoreLibs\Convert;
|
||||||
|
|
||||||
class Colors
|
class Colors
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* html convert functions
|
* html convert functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Convert;
|
namespace CoreLibs\Convert;
|
||||||
|
|
||||||
class Html
|
class Html
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* various math related function wrappers
|
* various math related function wrappers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Convert;
|
namespace CoreLibs\Convert;
|
||||||
|
|
||||||
class Math
|
class Math
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translates a mime id string into the actual application or file name
|
* Translates a mime id string into the actual application or file name
|
||||||
* for example 'text/plain' will output 'Text file'
|
* for example 'text/plain' will output 'Text file'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Convert;
|
namespace CoreLibs\Convert;
|
||||||
|
|
||||||
class MimeAppName
|
class MimeAppName
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hash wrapper functions for old problem fixes
|
* hash wrapper functions for old problem fixes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Create;
|
namespace CoreLibs\Create;
|
||||||
|
|
||||||
class Hash
|
class Hash
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* html convert functions
|
* html convert functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Create;
|
namespace CoreLibs\Create;
|
||||||
|
|
||||||
class RandomKey
|
class RandomKey
|
||||||
@@ -39,7 +41,8 @@ class RandomKey
|
|||||||
*/
|
*/
|
||||||
private static function validateRandomKeyLenght(int $key_length): bool
|
private static function validateRandomKeyLenght(int $key_length): bool
|
||||||
{
|
{
|
||||||
if (is_numeric($key_length) &&
|
if (
|
||||||
|
is_numeric($key_length) &&
|
||||||
$key_length > 0 &&
|
$key_length > 0 &&
|
||||||
$key_length <= self::$max_key_length
|
$key_length <= self::$max_key_length
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Create;
|
namespace CoreLibs\Create;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2002/12/17
|
* CREATED: 2002/12/17
|
||||||
@@ -29,6 +30,8 @@
|
|||||||
// as it actually has nothing to do with this one here ? (or at least
|
// as it actually has nothing to do with this one here ? (or at least
|
||||||
// put into separete function in this class)
|
// put into separete function in this class)
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\DB\Extended;
|
namespace CoreLibs\DB\Extended;
|
||||||
|
|
||||||
// subclass for one array handling
|
// subclass for one array handling
|
||||||
@@ -192,7 +195,8 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
$q_where = '';
|
$q_where = '';
|
||||||
foreach ($this->table_array as $column => $data_array) {
|
foreach ($this->table_array as $column => $data_array) {
|
||||||
// suchen nach bildern und lschen ...
|
// suchen nach bildern und lschen ...
|
||||||
if (!empty($this->table_array[$column]['file']) &&
|
if (
|
||||||
|
!empty($this->table_array[$column]['file']) &&
|
||||||
file_exists($this->table_array[$column]['url'] . $this->table_array[$column]['value'])
|
file_exists($this->table_array[$column]['url'] . $this->table_array[$column]['value'])
|
||||||
) {
|
) {
|
||||||
if (file_exists($this->table_array[$column]['path'] . $this->table_array[$column]['value'])) {
|
if (file_exists($this->table_array[$column]['path'] . $this->table_array[$column]['value'])) {
|
||||||
@@ -277,11 +281,13 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
foreach ($this->table_array as $column => $data_array) {
|
foreach ($this->table_array as $column => $data_array) {
|
||||||
// wenn "edit" dann gib daten wie in DB zurück, ansonten aufbereiten fr ausgabe
|
// wenn "edit" dann gib daten wie in DB zurück, ansonten aufbereiten fr ausgabe
|
||||||
// ?? sollte das nicht drauen ??? man weis ja net was da drin steht --> is noch zu berlegen
|
// ?? sollte das nicht drauen ??? man weis ja net was da drin steht --> is noch zu berlegen
|
||||||
// echo 'EDIT: $edit | Spalte: $column | type: '.$this->table_array[$column]['type'].' | Res: '.$res[$column].'<br>';
|
// $this->log->debug('DB READ', 'EDIT: $edit | Spalte: $column | type: '
|
||||||
|
// .$this->table_array[$column]['type'].' | Res: '.$res[$column]);
|
||||||
if ($edit) {
|
if ($edit) {
|
||||||
$this->table_array[$column]['value'] = $res[$column];
|
$this->table_array[$column]['value'] = $res[$column];
|
||||||
// if password, also write to hidden
|
// if password, also write to hidden
|
||||||
if (isset($this->table_array[$column]['type']) &&
|
if (
|
||||||
|
isset($this->table_array[$column]['type']) &&
|
||||||
$this->table_array[$column]['type'] == 'password'
|
$this->table_array[$column]['type'] == 'password'
|
||||||
) {
|
) {
|
||||||
$this->table_array[$column]['HIDDEN_value'] = $res[$column];
|
$this->table_array[$column]['HIDDEN_value'] = $res[$column];
|
||||||
@@ -360,7 +366,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
//echo 'Dn: $file_name';
|
//echo 'Dn: $file_name';
|
||||||
copy($this->table_array[$column]['tmp'], $this->table_array[$column]['path'] . $file_name);
|
copy($this->table_array[$column]['tmp'], $this->table_array[$column]['path'] . $file_name);
|
||||||
// automatisch thumbnail generieren, geht nur mit convert (ImageMagic!!!), aber nur bei bild ..
|
// automatisch thumbnail generieren, geht nur mit convert (ImageMagic!!!), aber nur bei bild ..
|
||||||
if (strtolower($ext) == 'jpeg' || strtolower($ext) == 'jpg' || strtolower($ext) == 'gif' || strtolower($ext) == 'png') {
|
if (in_array(strtolower($ext), ['jpeg', 'jpg', 'gif', 'png'])) {
|
||||||
$file_name_tn = $name . '_tn.' . $ext;
|
$file_name_tn = $name . '_tn.' . $ext;
|
||||||
$input = $this->table_array[$column]['path'] . $file_name;
|
$input = $this->table_array[$column]['path'] . $file_name;
|
||||||
$output = $this->table_array[$column]['path'] . $file_name_tn;
|
$output = $this->table_array[$column]['path'] . $file_name_tn;
|
||||||
@@ -378,13 +384,15 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
/********************************* END FILE **************************************/
|
/********************************* END FILE **************************************/
|
||||||
|
|
||||||
// do not write 'pk' (primary key) or 'view' values
|
// do not write 'pk' (primary key) or 'view' values
|
||||||
if (!isset($this->table_array[$column]['pk']) &&
|
if (
|
||||||
|
!isset($this->table_array[$column]['pk']) &&
|
||||||
isset($this->table_array[$column]['type']) &&
|
isset($this->table_array[$column]['type']) &&
|
||||||
$this->table_array[$column]['type'] != 'view' &&
|
$this->table_array[$column]['type'] != 'view' &&
|
||||||
strlen($column) > 0
|
strlen($column) > 0
|
||||||
) {
|
) {
|
||||||
// for password use hidden value if main is not set
|
// for password use hidden value if main is not set
|
||||||
if (isset($this->table_array[$column]['type']) &&
|
if (
|
||||||
|
isset($this->table_array[$column]['type']) &&
|
||||||
$this->table_array[$column]['type'] == 'password' &&
|
$this->table_array[$column]['type'] == 'password' &&
|
||||||
empty($this->table_array[$column]['value'])
|
empty($this->table_array[$column]['value'])
|
||||||
) {
|
) {
|
||||||
@@ -407,15 +415,18 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
}
|
}
|
||||||
// integer is different
|
// integer is different
|
||||||
if (isset($this->table_array[$column]['int']) || isset($this->table_array[$column]['int_null'])) {
|
if (isset($this->table_array[$column]['int']) || isset($this->table_array[$column]['int_null'])) {
|
||||||
$this->log->debug('write_check', '['.$column.']['.$this->table_array[$column]['value'].']['.$this->table_array[$column]['type'].'] '.
|
$this->log->debug('WRITE CHECK', '[' . $column . '][' . $this->table_array[$column]['value'] . ']'
|
||||||
'VALUE SET: '.(string)isset($this->table_array[$column]['value']).
|
. '[' . $this->table_array[$column]['type'] . '] '
|
||||||
' | INT NULL: '.(string)isset($this->table_array[$column]['int_null']));
|
. 'VALUE SET: ' . (string)isset($this->table_array[$column]['value'])
|
||||||
if (isset($this->table_array[$column]['value']) &&
|
. ' | INT NULL: ' . (string)isset($this->table_array[$column]['int_null']));
|
||||||
|
if (
|
||||||
|
isset($this->table_array[$column]['value']) &&
|
||||||
!$this->table_array[$column]['value'] &&
|
!$this->table_array[$column]['value'] &&
|
||||||
isset($this->table_array[$column]['int_null'])
|
isset($this->table_array[$column]['int_null'])
|
||||||
) {
|
) {
|
||||||
$_value = 'NULL';
|
$_value = 'NULL';
|
||||||
} elseif (!isset($this->table_array[$column]['value']) ||
|
} elseif (
|
||||||
|
!isset($this->table_array[$column]['value']) ||
|
||||||
(isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value'])
|
(isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value'])
|
||||||
) {
|
) {
|
||||||
$_value = 0;
|
$_value = 0;
|
||||||
@@ -428,7 +439,8 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
$q_data .= "'" . $this->dbBoolean($this->table_array[$column]['value'], true) . "'";
|
$q_data .= "'" . $this->dbBoolean($this->table_array[$column]['value'], true) . "'";
|
||||||
} elseif (isset($this->table_array[$column]['interval'])) {
|
} elseif (isset($this->table_array[$column]['interval'])) {
|
||||||
// for interval we check if no value, then we set null
|
// for interval we check if no value, then we set null
|
||||||
if (!isset($this->table_array[$column]['value']) ||
|
if (
|
||||||
|
!isset($this->table_array[$column]['value']) ||
|
||||||
(isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value'])
|
(isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value'])
|
||||||
) {
|
) {
|
||||||
$_value = 'NULL';
|
$_value = 'NULL';
|
||||||
@@ -442,9 +454,14 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
} else {
|
} else {
|
||||||
// if the error check is json, we set field to null if NOT set
|
// if the error check is json, we set field to null if NOT set
|
||||||
// else normal string write
|
// else normal string write
|
||||||
if (isset($this->table_array[$column]['error_check']) &&
|
if (
|
||||||
|
isset($this->table_array[$column]['error_check']) &&
|
||||||
$this->table_array[$column]['error_check'] == 'json' &&
|
$this->table_array[$column]['error_check'] == 'json' &&
|
||||||
(!isset($this->table_array[$column]['value']) || (isset($this->table_array[$column]['value']) && !$this->table_array[$column]['value']))
|
(
|
||||||
|
!isset($this->table_array[$column]['value']) ||
|
||||||
|
(isset($this->table_array[$column]['value']) &&
|
||||||
|
!$this->table_array[$column]['value'])
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
$q_data .= 'NULL';
|
$q_data .= 'NULL';
|
||||||
} else {
|
} else {
|
||||||
@@ -452,7 +469,9 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
$q_data .= "'";
|
$q_data .= "'";
|
||||||
// if add slashes do convert & add slashes else write AS is
|
// if add slashes do convert & add slashes else write AS is
|
||||||
if ($addslashes) {
|
if ($addslashes) {
|
||||||
$q_data .= $this->dbEscapeString($this->convertEntities($this->table_array[$column]['value']));
|
$q_data .= $this->dbEscapeString(
|
||||||
|
$this->convertEntities($this->table_array[$column]['value'])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$q_data .= $this->dbEscapeString($this->table_array[$column]['value']);
|
$q_data .= $this->dbEscapeString($this->table_array[$column]['value']);
|
||||||
}
|
}
|
||||||
@@ -520,6 +539,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
// return the table if needed
|
// return the table if needed
|
||||||
return $this->table_array;
|
return $this->table_array;
|
||||||
}
|
}
|
||||||
} // end of class
|
// end of class
|
||||||
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
+229
-68
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2000/11/23
|
* CREATED: 2000/11/23
|
||||||
@@ -107,9 +108,11 @@
|
|||||||
* _db_io()
|
* _db_io()
|
||||||
* - pseudo deconstructor - functionality moved to db_close
|
* - pseudo deconstructor - functionality moved to db_close
|
||||||
* $string info($show=1)
|
* $string info($show=1)
|
||||||
* - returns a string various info about class (version, authoer, etc), if $show set to 0, it will not be appended to the error_msgs string
|
* - returns a string various info about class (version, authoer, etc)
|
||||||
|
* - if $show set to 0, it will not be appended to the error_msgs string
|
||||||
* $string db_info($show=1)
|
* $string db_info($show=1)
|
||||||
* - returns a string with info about db connection, etc, if $show set to 0, it will not be appended to the error_msgs string
|
* - returns a string with info about db connection, etc, if $show set to 0,
|
||||||
|
* - it will not be appended to the error_msgs string
|
||||||
* $string db_dump_data($query=0)
|
* $string db_dump_data($query=0)
|
||||||
* - returns a string with all data of that query or if no query given with all data in the cursor_ext
|
* - returns a string with all data of that query or if no query given with all data in the cursor_ext
|
||||||
* 0/$cursor db_exec($query=0)
|
* 0/$cursor db_exec($query=0)
|
||||||
@@ -135,13 +138,15 @@
|
|||||||
* $string db_boolean(string)
|
* $string db_boolean(string)
|
||||||
* - if the string value is 't' or 'f' it returns correct TRUE/FALSE for php
|
* - if the string value is 't' or 'f' it returns correct TRUE/FALSE for php
|
||||||
* $primary_key db_write_data($write_array, $not_write_array, $primary_key, $table, $data = [])
|
* $primary_key db_write_data($write_array, $not_write_array, $primary_key, $table, $data = [])
|
||||||
* - writes into one table based on arrays of columns to write and not write, reads data from global vars or optional array
|
* - writes into one table based on arrays of columns to write and not write,
|
||||||
|
* - reads data from global vars or optional array
|
||||||
* $boolean db_set_schema(schema)
|
* $boolean db_set_schema(schema)
|
||||||
* - sets search path to a schema
|
* - sets search path to a schema
|
||||||
* $boolean db_set_encoding(encoding)
|
* $boolean db_set_encoding(encoding)
|
||||||
* - sets an encoding for this database output and input
|
* - sets an encoding for this database output and input
|
||||||
* $string db_time_format($age/datetime diff, $micro_time = false/true)
|
* $string db_time_format($age/datetime diff, $micro_time = false/true)
|
||||||
* - returns a nice formatted time string based on a age or datetime difference (postgres only), micro time is default false
|
* - returns a nice formatted time string based on a age or datetime difference
|
||||||
|
* - (postgres only), micro time is default false
|
||||||
*
|
*
|
||||||
* PRIVATE METHODS
|
* PRIVATE METHODS
|
||||||
* _db_error()
|
* _db_error()
|
||||||
@@ -159,10 +164,12 @@
|
|||||||
* string _db_debug_prepare($prepare_id, $data_array)
|
* string _db_debug_prepare($prepare_id, $data_array)
|
||||||
* - returns the prepared statement with the actual data. for debug purposes only
|
* - returns the prepared statement with the actual data. for debug purposes only
|
||||||
* none _db_debug($debug_id, $string, $id, $type)
|
* none _db_debug($debug_id, $string, $id, $type)
|
||||||
* - wrapper for normal debug, adds prefix data from id & type and strips all HTML from the query data (color codes, etc) via flag to debug call
|
* - wrapper for normal debug, adds prefix data from id & type and strips
|
||||||
|
* - all HTML from the query data (color codes, etc) via flag to debug call
|
||||||
*
|
*
|
||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2008/10/25 (cs) add db_boolean to fix the postgres to php boolean var problem (TODO: implement this in any select return)
|
* 2008/10/25 (cs) add db_boolean to fix the postgres to php boolean var problem
|
||||||
|
* (TODO: implement this in any select return)
|
||||||
* 2008/07/03 (cs) add db_write_data function, original written for inventory tool "invSQLWriteData"
|
* 2008/07/03 (cs) add db_write_data function, original written for inventory tool "invSQLWriteData"
|
||||||
* 2008/04/16 (cs) add db_escape_string function for correct string escape
|
* 2008/04/16 (cs) add db_escape_string function for correct string escape
|
||||||
* 2007/11/14 (cs) add a prepare debug statement to replace the placeholders with the actual data in a prepared statement
|
* 2007/11/14 (cs) add a prepare debug statement to replace the placeholders with the actual data in a prepared statement
|
||||||
@@ -241,6 +248,8 @@
|
|||||||
* 23.11.2000: erster Test
|
* 23.11.2000: erster Test
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\DB;
|
namespace CoreLibs\DB;
|
||||||
|
|
||||||
class IO extends \CoreLibs\Basic
|
class IO extends \CoreLibs\Basic
|
||||||
@@ -324,7 +333,8 @@ class IO extends \CoreLibs\Basic
|
|||||||
$this->db_pwd = $db_config['db_pass'] ?? '';
|
$this->db_pwd = $db_config['db_pass'] ?? '';
|
||||||
$this->db_host = $db_config['db_host'] ?? '';
|
$this->db_host = $db_config['db_host'] ?? '';
|
||||||
$this->db_port = !empty($db_config['db_port']) ? $db_config['db_port'] : 5432;
|
$this->db_port = !empty($db_config['db_port']) ? $db_config['db_port'] : 5432;
|
||||||
$this->db_schema = !empty($db_config['db_schema']) ? $db_config['db_schema'] : ''; // do not set to 'public' if not set, because the default is already public
|
// do not set to 'public' if not set, because the default is already public
|
||||||
|
$this->db_schema = !empty($db_config['db_schema']) ? $db_config['db_schema'] : '';
|
||||||
$this->db_encoding = !empty($db_config['db_encoding']) ? $db_config['db_encoding'] : '';
|
$this->db_encoding = !empty($db_config['db_encoding']) ? $db_config['db_encoding'] : '';
|
||||||
$this->db_type = $db_config['db_type'] ?? '';
|
$this->db_type = $db_config['db_type'] ?? '';
|
||||||
$this->db_ssl = !empty($db_config['db_ssl']) ? $db_config['db_ssl'] : 'allow';
|
$this->db_ssl = !empty($db_config['db_ssl']) ? $db_config['db_ssl'] : 'allow';
|
||||||
@@ -343,16 +353,19 @@ class IO extends \CoreLibs\Basic
|
|||||||
$this->error_string['14'] = 'Can\'t connect to DB server';
|
$this->error_string['14'] = 'Can\'t connect to DB server';
|
||||||
$this->error_string['15'] = 'Can\'t select DB';
|
$this->error_string['15'] = 'Can\'t select DB';
|
||||||
$this->error_string['16'] = 'No DB Handler found / connect or reconnect failed';
|
$this->error_string['16'] = 'No DB Handler found / connect or reconnect failed';
|
||||||
$this->error_string['17'] = 'All dbReturn* methods work only with SELECT statements, please use dbExec for everything else';
|
$this->error_string['17'] = 'All dbReturn* methods work only with SELECT statements, '
|
||||||
|
. 'please use dbExec for everything else';
|
||||||
$this->error_string['18'] = 'Query not found in cache. Nothing has been reset';
|
$this->error_string['18'] = 'Query not found in cache. Nothing has been reset';
|
||||||
$this->error_string['19'] = 'Wrong PK name given or no PK name given at all, can\'t get Insert ID';
|
$this->error_string['19'] = 'Wrong PK name given or no PK name given at all, can\'t get Insert ID';
|
||||||
$this->error_string['20'] = 'Found given Prepare Statement Name in array, Query not prepared, will use existing one';
|
$this->error_string['20'] = 'Found given Prepare Statement Name in array, '
|
||||||
|
. 'Query not prepared, will use existing one';
|
||||||
$this->error_string['21'] = 'Query Prepare failed';
|
$this->error_string['21'] = 'Query Prepare failed';
|
||||||
$this->error_string['22'] = 'Query Execute failed';
|
$this->error_string['22'] = 'Query Execute failed';
|
||||||
$this->error_string['23'] = 'Query Execute failed, data array does not match placeholders';
|
$this->error_string['23'] = 'Query Execute failed, data array does not match placeholders';
|
||||||
$this->error_string['24'] = 'Missing prepared query entry for execute.';
|
$this->error_string['24'] = 'Missing prepared query entry for execute.';
|
||||||
$this->error_string['25'] = 'Prepare query data is not in array format.';
|
$this->error_string['25'] = 'Prepare query data is not in array format.';
|
||||||
$this->error_string['30'] = 'Query call in a possible endless loop. Was called more than '.$this->MAX_QUERY_CALL.' times';
|
$this->error_string['30'] = 'Query call in a possible endless loop. '
|
||||||
|
. 'Was called more than ' . $this->MAX_QUERY_CALL . ' times';
|
||||||
$this->error_string['31'] = 'Could not fetch PK after query insert';
|
$this->error_string['31'] = 'Could not fetch PK after query insert';
|
||||||
$this->error_string['32'] = 'Multiple PK return as array';
|
$this->error_string['32'] = 'Multiple PK return as array';
|
||||||
$this->error_string['33'] = 'Returning PK was not found';
|
$this->error_string['33'] = 'Returning PK was not found';
|
||||||
@@ -412,7 +425,14 @@ class IO extends \CoreLibs\Basic
|
|||||||
private function __connectToDB(): bool
|
private function __connectToDB(): bool
|
||||||
{
|
{
|
||||||
// generate connect string
|
// generate connect string
|
||||||
$this->dbh = $this->db_functions->__dbConnect($this->db_host, $this->db_user, $this->db_pwd, $this->db_name, $this->db_port, $this->db_ssl);
|
$this->dbh = $this->db_functions->__dbConnect(
|
||||||
|
$this->db_host,
|
||||||
|
$this->db_user,
|
||||||
|
$this->db_pwd,
|
||||||
|
$this->db_name,
|
||||||
|
$this->db_port,
|
||||||
|
$this->db_ssl
|
||||||
|
);
|
||||||
// if no dbh here, we couldn't connect to the DB itself
|
// if no dbh here, we couldn't connect to the DB itself
|
||||||
if (!$this->dbh) {
|
if (!$this->dbh) {
|
||||||
$this->error_id = 14;
|
$this->error_id = 14;
|
||||||
@@ -576,12 +596,26 @@ class IO extends \CoreLibs\Basic
|
|||||||
// okay, an error occured
|
// okay, an error occured
|
||||||
if ($this->error_id) {
|
if ($this->error_id) {
|
||||||
// write error msg ...
|
// write error msg ...
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$this->error_id.': '.$this->error_string[$this->error_id].($msg ? ', '.$msg : '').'</span>', 'DB_ERROR', $where_called);
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> ' . $this->error_id . ': '
|
||||||
|
. $this->error_string[$this->error_id] . ($msg ? ', ' . $msg : '')
|
||||||
|
. '</span>',
|
||||||
|
'DB_ERROR',
|
||||||
|
$where_called
|
||||||
|
);
|
||||||
$this->had_error = $this->error_id;
|
$this->had_error = $this->error_id;
|
||||||
// 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_WARNING', $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
|
||||||
@@ -597,7 +631,8 @@ class IO extends \CoreLibs\Basic
|
|||||||
private function __dbConvertEncoding($row)
|
private function __dbConvertEncoding($row)
|
||||||
{
|
{
|
||||||
// only do if array, else pass through row (can be false)
|
// only do if array, else pass through row (can be false)
|
||||||
if (!is_array($row) || empty($this->to_encoding) || empty($this->db_encoding)
|
if (
|
||||||
|
!is_array($row) || empty($this->to_encoding) || empty($this->db_encoding)
|
||||||
) {
|
) {
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
@@ -736,7 +771,8 @@ class IO extends \CoreLibs\Basic
|
|||||||
}
|
}
|
||||||
// count up the run, if this is run more than the max_run then exit with error
|
// count up the run, if this is run more than the max_run then exit with error
|
||||||
// if set to -1, then ignore it
|
// if set to -1, then ignore it
|
||||||
if ($this->MAX_QUERY_CALL != -1 &&
|
if (
|
||||||
|
$this->MAX_QUERY_CALL != -1 &&
|
||||||
$this->query_called[$md5] > $this->MAX_QUERY_CALL
|
$this->query_called[$md5] > $this->MAX_QUERY_CALL
|
||||||
) {
|
) {
|
||||||
$this->error_id = 30;
|
$this->error_id = 30;
|
||||||
@@ -782,7 +818,8 @@ class IO extends \CoreLibs\Basic
|
|||||||
// if not select do here
|
// if not select do here
|
||||||
// count affected rows
|
// count affected rows
|
||||||
$this->num_rows = $this->db_functions->__dbAffectedRows($this->cursor);
|
$this->num_rows = $this->db_functions->__dbAffectedRows($this->cursor);
|
||||||
if (($this->__checkQueryForInsert($this->query, true) && $this->pk_name != 'NULL') ||
|
if (
|
||||||
|
($this->__checkQueryForInsert($this->query, true) && $this->pk_name != 'NULL') ||
|
||||||
($this->__checkQueryForUpdate($this->query) && $this->returning_id)
|
($this->__checkQueryForUpdate($this->query) && $this->returning_id)
|
||||||
) {
|
) {
|
||||||
// set insert_id
|
// set insert_id
|
||||||
@@ -798,22 +835,30 @@ class IO extends \CoreLibs\Basic
|
|||||||
// echo "** PREPARE RETURNING FOR CURSOR: ".$this->cursor."<br>";
|
// echo "** PREPARE RETURNING FOR CURSOR: ".$this->cursor."<br>";
|
||||||
// we have returning, now we need to check if we get one or many returned
|
// we have returning, now we need to check if we get one or many returned
|
||||||
// we'll need to loop this, if we have multiple insert_id returns
|
// we'll need to loop this, if we have multiple insert_id returns
|
||||||
while ($_insert_id = $this->db_functions->__dbFetchArray(
|
while (
|
||||||
|
$_insert_id = $this->db_functions->__dbFetchArray(
|
||||||
$this->cursor,
|
$this->cursor,
|
||||||
$this->db_functions->__dbResultType(true)
|
$this->db_functions->__dbResultType(true)
|
||||||
)) {
|
)
|
||||||
|
) {
|
||||||
// echo "*** RETURNING: ".print_r($_insert_id, true)."<br>";
|
// echo "*** RETURNING: ".print_r($_insert_id, true)."<br>";
|
||||||
$this->insert_id[] = $_insert_id;
|
$this->insert_id[] = $_insert_id;
|
||||||
$this->insert_id_arr[] = $_insert_id;
|
$this->insert_id_arr[] = $_insert_id;
|
||||||
}
|
}
|
||||||
// if we have only one, revert from array to single
|
// if we have only one, revert from array to single
|
||||||
if (count($this->insert_id) == 1) {
|
if (count($this->insert_id) == 1) {
|
||||||
// echo "* SINGLE DATA CONVERT: ".count($this->insert_id[0])." => ".array_key_exists($this->pk_name, $this->insert_id[0])."<br>";
|
// $this->log->debug('SINGLE DATA CONVERT', count($this->insert_id[0])." => "
|
||||||
// echo "* PK DIRECT: ".(isset($this->insert_id[0][$this->pk_name]) ? $this->insert_id[0][$this->pk_name] : '[NO PK NAME SET]' )."<Br>";
|
// .array_key_exists($this->pk_name, $this->insert_id[0]));
|
||||||
// if this has only the pk_name, then only return this, else array of all data (but without the position)
|
// $this->log->debug('PK DIRECT', (isset($this->insert_id[0][$this->pk_name]) ?
|
||||||
// example if insert_id[0]['foo'] && insert_id[0]['bar'] it will become insert_id['foo'] & insert_id['bar']
|
// $this->insert_id[0][$this->pk_name] : '[NO PK NAME SET]' ));
|
||||||
// if only ['foo_id'] and it is the PK then the PK is directly written to the insert_id
|
// if this has only the pk_name, then only return this,
|
||||||
if (count($this->insert_id[0]) > 1 ||
|
// else array of all data (but without the position)
|
||||||
|
// example if insert_id[0]['foo'] && insert_id[0]['bar']
|
||||||
|
// it will become insert_id['foo'] & insert_id['bar']
|
||||||
|
// if only ['foo_id'] and it is the PK then the
|
||||||
|
// PK is directly written to the insert_id
|
||||||
|
if (
|
||||||
|
count($this->insert_id[0]) > 1 ||
|
||||||
!array_key_exists($this->pk_name, $this->insert_id[0])
|
!array_key_exists($this->pk_name, $this->insert_id[0])
|
||||||
) {
|
) {
|
||||||
$this->insert_id_ext = $this->insert_id[0];
|
$this->insert_id_ext = $this->insert_id[0];
|
||||||
@@ -916,7 +961,8 @@ class IO extends \CoreLibs\Basic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// ok entry, set
|
// ok entry, set
|
||||||
if ($max_calls == -1 ||
|
if (
|
||||||
|
$max_calls == -1 ||
|
||||||
$max_calls > 0
|
$max_calls > 0
|
||||||
) {
|
) {
|
||||||
$this->MAX_QUERY_CALL = $max_calls;
|
$this->MAX_QUERY_CALL = $max_calls;
|
||||||
@@ -1120,8 +1166,12 @@ class IO extends \CoreLibs\Basic
|
|||||||
* - if set to 3, after EACH row, the data will be reset,
|
* - if set to 3, after EACH row, the data will be reset,
|
||||||
* no caching is done except for basic (count, etc)
|
* no caching is done except for basic (count, etc)
|
||||||
* @param string $query Query string
|
* @param string $query Query string
|
||||||
* @param int $reset reset status: 1: read cache, clean at the end, 2: read new, clean at end, 3: never cache
|
* @param int $reset reset status:
|
||||||
* @param bool $assoc_only true to only returned the named and not index position ones
|
* 1: read cache, clean at the end
|
||||||
|
* 2: read new, clean at end
|
||||||
|
* 3: never cache
|
||||||
|
* @param bool $assoc_only true to only returned the named and not
|
||||||
|
* index position ones
|
||||||
* @return array|bool return array data or false on error/end
|
* @return array|bool return array data or false on error/end
|
||||||
* @suppress PhanTypeMismatchDimFetch
|
* @suppress PhanTypeMismatchDimFetch
|
||||||
*/
|
*/
|
||||||
@@ -1161,7 +1211,9 @@ class IO extends \CoreLibs\Basic
|
|||||||
if ($reset && !$this->cursor_ext[$md5]['pos']) {
|
if ($reset && !$this->cursor_ext[$md5]['pos']) {
|
||||||
$this->cursor_ext[$md5]['cursor'] = null;
|
$this->cursor_ext[$md5]['cursor'] = null;
|
||||||
}
|
}
|
||||||
// $this->debug('MENU', 'Reset: '.$reset.', Cursor: '.$this->cursor_ext[$md5]['cursor'].', Pos: '.$this->cursor_ext[$md5]['pos'].', Query: '.$query);
|
// $this->debug('MENU', 'Reset: '.$reset.', Cursor: '
|
||||||
|
// .$this->cursor_ext[$md5]['cursor'].', Pos: '.$this->cursor_ext[$md5]['pos']
|
||||||
|
// .', Query: '.$query);
|
||||||
|
|
||||||
// if no cursor yet, execute
|
// if no cursor yet, execute
|
||||||
if (!$this->cursor_ext[$md5]['cursor']) {
|
if (!$this->cursor_ext[$md5]['cursor']) {
|
||||||
@@ -1203,12 +1255,18 @@ class IO extends \CoreLibs\Basic
|
|||||||
if ($this->cursor_ext[$md5]['cursor']) {
|
if ($this->cursor_ext[$md5]['cursor']) {
|
||||||
if ($this->cursor_ext[$md5]['firstcall'] == 1) {
|
if ($this->cursor_ext[$md5]['firstcall'] == 1) {
|
||||||
// count the rows returned (if select)
|
// count the rows returned (if select)
|
||||||
$this->cursor_ext[$md5]['num_rows'] = $this->db_functions->__dbNumRows($this->cursor_ext[$md5]['cursor']);
|
$this->cursor_ext[$md5]['num_rows'] =
|
||||||
|
$this->db_functions->__dbNumRows($this->cursor_ext[$md5]['cursor']);
|
||||||
// count the fields
|
// count the fields
|
||||||
$this->cursor_ext[$md5]['num_fields'] = $this->db_functions->__dbNumFields($this->cursor_ext[$md5]['cursor']);
|
$this->cursor_ext[$md5]['num_fields'] =
|
||||||
|
$this->db_functions->__dbNumFields($this->cursor_ext[$md5]['cursor']);
|
||||||
// set field names
|
// set field names
|
||||||
for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i++) {
|
for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i++) {
|
||||||
$this->cursor_ext[$md5]['field_names'][] = $this->db_functions->__dbFieldName($this->cursor_ext[$md5]['cursor'], $i);
|
$this->cursor_ext[$md5]['field_names'][] =
|
||||||
|
$this->db_functions->__dbFieldName(
|
||||||
|
$this->cursor_ext[$md5]['cursor'],
|
||||||
|
$i
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// reset first call vars
|
// reset first call vars
|
||||||
$this->cursor_ext[$md5]['firstcall'] = 0;
|
$this->cursor_ext[$md5]['firstcall'] = 0;
|
||||||
@@ -1237,7 +1295,9 @@ class IO extends \CoreLibs\Basic
|
|||||||
// check if end of output ...
|
// check if end of output ...
|
||||||
if ($this->cursor_ext[$md5]['pos'] >= $this->cursor_ext[$md5]['num_rows']) {
|
if ($this->cursor_ext[$md5]['pos'] >= $this->cursor_ext[$md5]['num_rows']) {
|
||||||
$this->cursor_ext[$md5]['pos'] = 0;
|
$this->cursor_ext[$md5]['pos'] = 0;
|
||||||
# if not reset given, set the cursor to true, so in a cached call on a different page we don't get problems from DB connection (as those will be LOST)
|
// if not reset given, set the cursor to true, so in a cached
|
||||||
|
// call on a different page we don't get problems from
|
||||||
|
// DB connection (as those will be LOST)
|
||||||
$this->cursor_ext[$md5]['cursor'] = 1;
|
$this->cursor_ext[$md5]['cursor'] = 1;
|
||||||
$return = false;
|
$return = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -1245,16 +1305,24 @@ class IO extends \CoreLibs\Basic
|
|||||||
$return = [];
|
$return = [];
|
||||||
for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i++) {
|
for ($i = 0; $i < $this->cursor_ext[$md5]['num_fields']; $i++) {
|
||||||
// create mixed return array
|
// create mixed return array
|
||||||
if ($assoc_only === false && isset($this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i])) {
|
if (
|
||||||
|
$assoc_only === false &&
|
||||||
|
isset($this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i])
|
||||||
|
) {
|
||||||
$return[$i] = $this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i];
|
$return[$i] = $this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i];
|
||||||
}
|
}
|
||||||
// named part
|
// named part
|
||||||
if (isset($this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i])) {
|
if (isset($this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i])) {
|
||||||
$return[$this->cursor_ext[$md5]['field_names'][$i]] = $this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$i];
|
$return[$this->cursor_ext[$md5]['field_names'][$i]] =
|
||||||
|
$this->cursor_ext[$md5]['data']
|
||||||
|
[$this->cursor_ext[$md5]['pos']][$i];
|
||||||
} else {
|
} else {
|
||||||
// throws PhanTypeMismatchDimFetch error, but in this case we know we will access only named array parts
|
// throws PhanTypeMismatchDimFetch error, but in this
|
||||||
|
// case we know we will access only named array parts
|
||||||
// @suppress PhanTypeMismatchDimFetch
|
// @suppress PhanTypeMismatchDimFetch
|
||||||
$return[$this->cursor_ext[$md5]['field_names'][$i]] = $this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]['pos']][$this->cursor_ext[$md5]['field_names'][$i]];
|
$return[$this->cursor_ext[$md5]['field_names'][$i]] =
|
||||||
|
$this->cursor_ext[$md5]['data'][$this->cursor_ext[$md5]
|
||||||
|
['pos']][$this->cursor_ext[$md5]['field_names'][$i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->cursor_ext[$md5]['pos'] ++;
|
$this->cursor_ext[$md5]['pos'] ++;
|
||||||
@@ -1393,7 +1461,12 @@ class IO extends \CoreLibs\Basic
|
|||||||
} else {
|
} else {
|
||||||
// if no async running print error
|
// if no async running print error
|
||||||
$this->error_id = 42;
|
$this->error_id = 42;
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> No async query has been started yet.</span>', 'DB_ERROR');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> No async query '
|
||||||
|
. 'has been started yet.</span>',
|
||||||
|
'DB_ERROR'
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1582,7 +1655,10 @@ class IO extends \CoreLibs\Basic
|
|||||||
if (!preg_match("/ returning /i", $query) && $this->prepare_cursor[$stm_name]['pk_name']) {
|
if (!preg_match("/ returning /i", $query) && $this->prepare_cursor[$stm_name]['pk_name']) {
|
||||||
$query .= " RETURNING " . $this->prepare_cursor[$stm_name]['pk_name'];
|
$query .= " RETURNING " . $this->prepare_cursor[$stm_name]['pk_name'];
|
||||||
$this->prepare_cursor[$stm_name]['returning_id'] = true;
|
$this->prepare_cursor[$stm_name]['returning_id'] = true;
|
||||||
} elseif (preg_match("/ returning (.*)/i", $query, $matches) && $this->prepare_cursor[$stm_name]['pk_name']) {
|
} elseif (
|
||||||
|
preg_match("/ returning (.*)/i", $query, $matches) &&
|
||||||
|
$this->prepare_cursor[$stm_name]['pk_name']
|
||||||
|
) {
|
||||||
// if returning exists but not pk_name, add it
|
// if returning exists but not pk_name, add it
|
||||||
if (!preg_match("/{$this->prepare_cursor[$stm_name]['pk_name']}/", $matches[1])) {
|
if (!preg_match("/{$this->prepare_cursor[$stm_name]['pk_name']}/", $matches[1])) {
|
||||||
$query .= " , " . $this->prepare_cursor[$stm_name]['pk_name'];
|
$query .= " , " . $this->prepare_cursor[$stm_name]['pk_name'];
|
||||||
@@ -1606,7 +1682,13 @@ class IO extends \CoreLibs\Basic
|
|||||||
} else {
|
} else {
|
||||||
$this->error_id = 21;
|
$this->error_id = 21;
|
||||||
$this->__dbError();
|
$this->__dbError();
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': Prepare field with: '.$stm_name.' | '.$query.'</span>', 'DB_ERROR');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> ' . $stm_name
|
||||||
|
. ': Prepare field with: ' . $stm_name . ' | '
|
||||||
|
. $query . '</span>',
|
||||||
|
'DB_ERROR'
|
||||||
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1627,17 +1709,34 @@ class IO extends \CoreLibs\Basic
|
|||||||
// if we do not have no prepare cursor array entry for this statement name, abort
|
// if we do not have no prepare cursor array entry for this statement name, abort
|
||||||
if (!is_array($this->prepare_cursor[$stm_name])) {
|
if (!is_array($this->prepare_cursor[$stm_name])) {
|
||||||
$this->error_id = 24;
|
$this->error_id = 24;
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': We do not have a prepared query entry for this statement name.</span>', 'DB_ERROR');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> ' . $stm_name
|
||||||
|
. ': We do not have a prepared query entry for this statement name.</span>',
|
||||||
|
'DB_ERROR'
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!is_array($data)) {
|
if (!is_array($data)) {
|
||||||
$this->error_id = 25;
|
$this->error_id = 25;
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': Prepared query Data has to be given in array form.</span>', 'DB_ERROR');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> ' . $stm_name
|
||||||
|
. ': Prepared query Data has to be given in array form.</span>',
|
||||||
|
'DB_ERROR'
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->prepare_cursor[$stm_name]['count'] != count($data)) {
|
if ($this->prepare_cursor[$stm_name]['count'] != count($data)) {
|
||||||
$this->error_id = 23;
|
$this->error_id = 23;
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': Array data count does not match prepared fields. Need: '.$this->prepare_cursor[$stm_name]['count'].', has: '.count($data).'</span>', 'DB_ERROR');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> ' . $stm_name
|
||||||
|
. ': Array data count does not match prepared fields. Need: '
|
||||||
|
. $this->prepare_cursor[$stm_name]['count'] . ', has: '
|
||||||
|
. count($data) . '</span>',
|
||||||
|
'DB_ERROR'
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->db_debug) {
|
if ($this->db_debug) {
|
||||||
@@ -1645,17 +1744,28 @@ class IO extends \CoreLibs\Basic
|
|||||||
}
|
}
|
||||||
$result = $this->db_functions->__dbExecute($stm_name, $data);
|
$result = $this->db_functions->__dbExecute($stm_name, $data);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->log->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[$stm_name]['result'].']: '.$this->log->prAr($data));
|
$this->log->debug('ExecuteData', 'ERROR in STM[' . $stm_name . '|'
|
||||||
|
. $this->prepare_cursor[$stm_name]['result'] . ']: '
|
||||||
|
. $this->log->prAr($data));
|
||||||
$this->error_id = 22;
|
$this->error_id = 22;
|
||||||
$this->__dbError($this->prepare_cursor[$stm_name]['result']);
|
$this->__dbError($this->prepare_cursor[$stm_name]['result']);
|
||||||
$this->__dbDebug('db', '<span style="color: red;"><b>DB-Error</b> '.$stm_name.': Execution failed</span>', 'DB_ERROR');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: red;"><b>DB-Error</b> ' . $stm_name
|
||||||
|
. ': Execution failed</span>',
|
||||||
|
'DB_ERROR'
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->__checkQueryForInsert($this->prepare_cursor[$stm_name]['query'], true) &&
|
if (
|
||||||
|
$this->__checkQueryForInsert($this->prepare_cursor[$stm_name]['query'], true) &&
|
||||||
$this->prepare_cursor[$stm_name]['pk_name'] != 'NULL'
|
$this->prepare_cursor[$stm_name]['pk_name'] != 'NULL'
|
||||||
) {
|
) {
|
||||||
if (!$this->prepare_cursor[$stm_name]['returning_id']) {
|
if (!$this->prepare_cursor[$stm_name]['returning_id']) {
|
||||||
$this->insert_id = $this->db_functions->__dbInsertId($this->prepare_cursor[$stm_name]['query'], $this->prepare_cursor[$stm_name]['pk_name']);
|
$this->insert_id = $this->db_functions->__dbInsertId(
|
||||||
|
$this->prepare_cursor[$stm_name]['query'],
|
||||||
|
$this->prepare_cursor[$stm_name]['pk_name']
|
||||||
|
);
|
||||||
$this->insert_id_ext = $this->insert_id;
|
$this->insert_id_ext = $this->insert_id;
|
||||||
$this->insert_id_arr[] = $this->insert_id;
|
$this->insert_id_arr[] = $this->insert_id;
|
||||||
} elseif ($result) {
|
} elseif ($result) {
|
||||||
@@ -1664,21 +1774,28 @@ class IO extends \CoreLibs\Basic
|
|||||||
$this->insert_id_arr = [];
|
$this->insert_id_arr = [];
|
||||||
// we have returning, now we need to check if we get one or many returned
|
// we have returning, now we need to check if we get one or many returned
|
||||||
// we'll need to loop this, if we have multiple insert_id returns
|
// we'll need to loop this, if we have multiple insert_id returns
|
||||||
while ($_insert_id = $this->db_functions->__dbFetchArray(
|
while (
|
||||||
|
$_insert_id = $this->db_functions->__dbFetchArray(
|
||||||
$result,
|
$result,
|
||||||
$this->db_functions->__dbResultType(true)
|
$this->db_functions->__dbResultType(true)
|
||||||
)) {
|
)
|
||||||
|
) {
|
||||||
$this->insert_id[] = $_insert_id;
|
$this->insert_id[] = $_insert_id;
|
||||||
$this->insert_id_arr[] = $_insert_id;
|
$this->insert_id_arr[] = $_insert_id;
|
||||||
}
|
}
|
||||||
// if we have only one, revert from arry to single
|
// if we have only one, revert from arry to single
|
||||||
if (count($this->insert_id) == 1) {
|
if (count($this->insert_id) == 1) {
|
||||||
// echo "+ SINGLE DATA CONVERT: ".count($this->insert_id[0])." => ".array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0])."<br>";
|
// $this->log->debug('SINGLE DATA CONVERT', count($this->insert_id[0])." => "
|
||||||
// echo "+ PK DIRECT: ".$this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']]."<Br>";
|
// .array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0]));
|
||||||
// if this has only the pk_name, then only return this, else array of all data (but without the position)
|
// $this->log->debug('PK DIRECT', $this->insert_id[0][$this->prepare_cursor[$stm_name]['pk_name']]);
|
||||||
// example if insert_id[0]['foo'] && insert_id[0]['bar'] it will become insert_id['foo'] & insert_id['bar']
|
// if this has only the pk_name, then only return this,
|
||||||
// if only ['foo_id'] and it is the PK then the PK is directly written to the insert_id
|
// else array of all data (but without the position)
|
||||||
if (count($this->insert_id[0]) > 1 ||
|
// example if insert_id[0]['foo'] && insert_id[0]['bar']
|
||||||
|
// it will become insert_id['foo'] & insert_id['bar']
|
||||||
|
// if only ['foo_id'] and it is the PK then the PK is directly
|
||||||
|
// written to the insert_id
|
||||||
|
if (
|
||||||
|
count($this->insert_id[0]) > 1 ||
|
||||||
!array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0])
|
!array_key_exists($this->prepare_cursor[$stm_name]['pk_name'], $this->insert_id[0])
|
||||||
) {
|
) {
|
||||||
$this->insert_id_ext = $this->insert_id[0];
|
$this->insert_id_ext = $this->insert_id[0];
|
||||||
@@ -1691,19 +1808,34 @@ class IO extends \CoreLibs\Basic
|
|||||||
$this->insert_id = '';
|
$this->insert_id = '';
|
||||||
$this->warning_id = 33;
|
$this->warning_id = 33;
|
||||||
$this->__dbError();
|
$this->__dbError();
|
||||||
$this->__dbDebug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': insert id returned no data</span>', 'DB_WARNING');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: orange;"><b>DB-Warning</b> ' . $stm_name
|
||||||
|
. ': insert id returned no data</span>',
|
||||||
|
'DB_WARNING'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this error handling is only for pgsql
|
// this error handling is only for pgsql
|
||||||
if (is_array($this->insert_id)) {
|
if (is_array($this->insert_id)) {
|
||||||
$this->warning_id = 32;
|
$this->warning_id = 32;
|
||||||
$this->__dbError();
|
$this->__dbError();
|
||||||
$this->__dbDebug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': insert id data returned as array</span>', 'DB_WARNING');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: orange;"><b>DB-Warning</b> ' . $stm_name
|
||||||
|
. ': insert id data returned as array</span>',
|
||||||
|
'DB_WARNING'
|
||||||
|
);
|
||||||
} elseif (!$this->insert_id) {
|
} elseif (!$this->insert_id) {
|
||||||
// NOTE should we keep this inside
|
// NOTE should we keep this inside
|
||||||
$this->warning_id = 31;
|
$this->warning_id = 31;
|
||||||
$this->__dbError();
|
$this->__dbError();
|
||||||
$this->__dbDebug('db', '<span style="color: orange;"><b>DB-Warning</b> '.$stm_name.': Could not get insert id</span>', 'DB_WARNING');
|
$this->__dbDebug(
|
||||||
|
'db',
|
||||||
|
'<span style="color: orange;"><b>DB-Warning</b> ' . $stm_name
|
||||||
|
. ': Could not get insert id</span>',
|
||||||
|
'DB_WARNING'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1852,8 +1984,13 @@ class IO extends \CoreLibs\Basic
|
|||||||
* @param array $data data array to override _POST data
|
* @param array $data data array to override _POST data
|
||||||
* @return int|bool primary key
|
* @return int|bool primary key
|
||||||
*/
|
*/
|
||||||
public function dbWriteData(array $write_array, array $not_write_array, $primary_key, string $table, $data = [])
|
public function dbWriteData(
|
||||||
{
|
array $write_array,
|
||||||
|
array $not_write_array,
|
||||||
|
int $primary_key,
|
||||||
|
string $table,
|
||||||
|
array $data = []
|
||||||
|
) {
|
||||||
if (!is_array($write_array)) {
|
if (!is_array($write_array)) {
|
||||||
$write_array = [];
|
$write_array = [];
|
||||||
}
|
}
|
||||||
@@ -1864,7 +2001,14 @@ class IO extends \CoreLibs\Basic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$not_write_update_array = [];
|
$not_write_update_array = [];
|
||||||
return $this->dbWriteDataExt($write_array, $primary_key, $table, $not_write_array, $not_write_update_array, $data);
|
return $this->dbWriteDataExt(
|
||||||
|
$write_array,
|
||||||
|
$primary_key,
|
||||||
|
$table,
|
||||||
|
$not_write_array,
|
||||||
|
$not_write_update_array,
|
||||||
|
$data
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1911,7 +2055,8 @@ class IO extends \CoreLibs\Basic
|
|||||||
$primary_key['row'] = $primary_key['row'] ?? '';
|
$primary_key['row'] = $primary_key['row'] ?? '';
|
||||||
// loop through the write array and each field to build the query
|
// loop through the write array and each field to build the query
|
||||||
foreach ($write_array as $field) {
|
foreach ($write_array as $field) {
|
||||||
if ((!$primary_key['value'] ||
|
if (
|
||||||
|
(!$primary_key['value'] ||
|
||||||
($primary_key['value'] &&
|
($primary_key['value'] &&
|
||||||
!in_array($field, $not_write_update_array))
|
!in_array($field, $not_write_update_array))
|
||||||
) &&
|
) &&
|
||||||
@@ -1936,8 +2081,11 @@ class IO extends \CoreLibs\Basic
|
|||||||
}
|
}
|
||||||
// we detect bool, so we can force a write on "false"
|
// we detect bool, so we can force a write on "false"
|
||||||
$is_bool = $table_data[$field]['type'] == 'bool' ? true : false;
|
$is_bool = $table_data[$field]['type'] == 'bool' ? true : false;
|
||||||
// write if the field has to be not null, or if there is no data and the field has no default values or if there is data or if this is an update and there is no data (set null)
|
// write if the field has to be not null, or if there is
|
||||||
if (($not_null && $_data) ||
|
// no data and the field has no default values or if there
|
||||||
|
// is data or if this is an update and there is no data (set null)
|
||||||
|
if (
|
||||||
|
($not_null && $_data) ||
|
||||||
(!$has_default && !$_data) ||
|
(!$has_default && !$_data) ||
|
||||||
(is_numeric($_data) && $_data) ||
|
(is_numeric($_data) && $_data) ||
|
||||||
($primary_key['value'] && !$_data) ||
|
($primary_key['value'] && !$_data) ||
|
||||||
@@ -1946,7 +2094,9 @@ class IO extends \CoreLibs\Basic
|
|||||||
if ($q_sub_value && !$primary_key['value']) {
|
if ($q_sub_value && !$primary_key['value']) {
|
||||||
$q_sub_value .= ', ';
|
$q_sub_value .= ', ';
|
||||||
}
|
}
|
||||||
if ($q_sub_data) { // && (!$primary_key || ($primary_key && !in_array($field, $not_write_array))))
|
if ($q_sub_data) {
|
||||||
|
// && (!$primary_key ||
|
||||||
|
// ($primary_key && !in_array($field, $not_write_array))))
|
||||||
$q_sub_data .= ', ';
|
$q_sub_data .= ', ';
|
||||||
}
|
}
|
||||||
if ($primary_key['value']) {
|
if ($primary_key['value']) {
|
||||||
@@ -1963,7 +2113,13 @@ class IO extends \CoreLibs\Basic
|
|||||||
$q_sub_data .= is_numeric($_data) ? $_data : 'NULL';
|
$q_sub_data .= is_numeric($_data) ? $_data : 'NULL';
|
||||||
} else {
|
} else {
|
||||||
// if bool -> set bool, else write data
|
// if bool -> set bool, else write data
|
||||||
$q_sub_data .= isset($_data) ? "'".($is_bool ? $this->dbBoolean($_data, true) : $this->dbEscapeString($_data))."'" : 'NULL';
|
$q_sub_data .= isset($_data) ?
|
||||||
|
"'" . (
|
||||||
|
$is_bool ?
|
||||||
|
$this->dbBoolean($_data, true) :
|
||||||
|
$this->dbEscapeString($_data)
|
||||||
|
) . "'" :
|
||||||
|
'NULL';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2013,7 +2169,11 @@ class IO extends \CoreLibs\Basic
|
|||||||
$seconds = $matches[4] != '00' ? preg_replace('/^0/', '', $matches[4]) : '';
|
$seconds = $matches[4] != '00' ? preg_replace('/^0/', '', $matches[4]) : '';
|
||||||
$milliseconds = $matches[6];
|
$milliseconds = $matches[6];
|
||||||
|
|
||||||
return $prefix.($hour ? $hour.'h ' : '').($minutes ? $minutes.'m ' : '').($seconds ? $seconds.'s' : '').($show_micro && $milliseconds? ' '.$milliseconds.'ms' : '');
|
return $prefix
|
||||||
|
. ($hour ? $hour . 'h ' : '')
|
||||||
|
. ($minutes ? $minutes . 'm ' : '')
|
||||||
|
. ($seconds ? $seconds . 's' : '')
|
||||||
|
. ($show_micro && $milliseconds ? ' ' . $milliseconds . 'ms' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2216,6 +2376,7 @@ class IO extends \CoreLibs\Basic
|
|||||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetNumRows()', E_USER_DEPRECATED);
|
trigger_error('Method ' . __METHOD__ . ' is deprecated, use dbGetNumRows()', E_USER_DEPRECATED);
|
||||||
return $this->dbGetNumRows();
|
return $this->dbGetNumRows();
|
||||||
}
|
}
|
||||||
} // end if db class
|
// end if db class
|
||||||
|
}
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2003/04/09
|
* CREATED: 2003/04/09
|
||||||
@@ -11,7 +12,9 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2008/04/16 (cs) wrapper for pg escape string
|
* 2008/04/16 (cs) wrapper for pg escape string
|
||||||
* 2007/01/11 (cs) add prepare/execute for postgres
|
* 2007/01/11 (cs) add prepare/execute for postgres
|
||||||
* 2006/09/12 (cs) in case db_query retuns false, save the query and run the query through the send/get procedure to get correct error data from the db
|
* 2006/09/12 (cs) in case db_query retuns false, save the query and
|
||||||
|
* run the query through the send/get procedure to get
|
||||||
|
* correct error data from the db
|
||||||
* 2006/06/26 (cs) added port for db connection
|
* 2006/06/26 (cs) added port for db connection
|
||||||
* 2006/04/03 (cs) added meta data for table
|
* 2006/04/03 (cs) added meta data for table
|
||||||
* 2005/07/25 (cs) removed the plural s remove, not needed and not 100% working
|
* 2005/07/25 (cs) removed the plural s remove, not needed and not 100% working
|
||||||
@@ -41,6 +44,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\DB\SQL;
|
namespace CoreLibs\DB\SQL;
|
||||||
|
|
||||||
class PgSQL
|
class PgSQL
|
||||||
@@ -293,22 +298,23 @@ class PgSQL
|
|||||||
}
|
}
|
||||||
// read from table the PK name
|
// read from table the PK name
|
||||||
// faster primary key get
|
// faster primary key get
|
||||||
$q = "SELECT pg_attribute.attname AS column_name, format_type(pg_attribute.atttypid, pg_attribute.atttypmod) AS type ";
|
$q = "SELECT pg_attribute.attname AS column_name, "
|
||||||
$q .= "FROM pg_index, pg_class, pg_attribute ";
|
. "format_type(pg_attribute.atttypid, pg_attribute.atttypmod) AS type "
|
||||||
|
. "FROM pg_index, pg_class, pg_attribute ";
|
||||||
if ($schema) {
|
if ($schema) {
|
||||||
$q .= ", pg_namespace ";
|
$q .= ", pg_namespace ";
|
||||||
}
|
}
|
||||||
$q .= "WHERE ";
|
$q .= "WHERE "
|
||||||
// regclass translates the OID to the name
|
// regclass translates the OID to the name
|
||||||
$q .= "pg_class.oid = '".$table_prefix.$table."'::regclass AND ";
|
. "pg_class.oid = '" . $table_prefix . $table . "'::regclass AND "
|
||||||
$q .= "indrelid = pg_class.oid AND ";
|
. "indrelid = pg_class.oid AND ";
|
||||||
if ($schema) {
|
if ($schema) {
|
||||||
$q .= "nspname = '".$schema."' AND ";
|
$q .= "nspname = '" . $schema . "' AND "
|
||||||
$q .= "pg_class.relnamespace = pg_namespace.oid AND ";
|
. "pg_class.relnamespace = pg_namespace.oid AND ";
|
||||||
}
|
}
|
||||||
$q .= "pg_attribute.attrelid = pg_class.oid AND ";
|
$q .= "pg_attribute.attrelid = pg_class.oid AND "
|
||||||
$q .= "pg_attribute.attnum = any(pg_index.indkey) ";
|
. "pg_attribute.attnum = any(pg_index.indkey) "
|
||||||
$q .= "AND indisprimary";
|
. "AND indisprimary";
|
||||||
$cursor = $this->__dbQuery($q);
|
$cursor = $this->__dbQuery($q);
|
||||||
if ($cursor) {
|
if ($cursor) {
|
||||||
return $this->__dbFetchArray($cursor)['column_name'] ?? false;
|
return $this->__dbFetchArray($cursor)['column_name'] ?? false;
|
||||||
@@ -330,15 +336,23 @@ class PgSQL
|
|||||||
* @param string $db_ssl SSL (allow is default)
|
* @param string $db_ssl SSL (allow is default)
|
||||||
* @return ?resource db handler resource or null on error
|
* @return ?resource db handler resource or null on error
|
||||||
*/
|
*/
|
||||||
public function __dbConnect(string $db_host, string $db_user, string $db_pass, string $db_name, int $db_port = 5432, string $db_ssl = 'allow')
|
public function __dbConnect(
|
||||||
{
|
string $db_host,
|
||||||
|
string $db_user,
|
||||||
|
string $db_pass,
|
||||||
|
string $db_name,
|
||||||
|
int $db_port = 5432,
|
||||||
|
string $db_ssl = 'allow'
|
||||||
|
) {
|
||||||
// to avoid empty db_port
|
// to avoid empty db_port
|
||||||
if (!$db_port) {
|
if (!$db_port) {
|
||||||
$db_port = 5432;
|
$db_port = 5432;
|
||||||
}
|
}
|
||||||
$this->dbh = pg_connect("host=".$db_host." port=".$db_port." user=".$db_user." password=".$db_pass." dbname=".$db_name." sslmode=".$db_ssl);
|
$this->dbh = pg_connect("host=" . $db_host . " port=" . $db_port . " user="
|
||||||
|
. $db_user . " password=" . $db_pass . " dbname=" . $db_name . " sslmode=" . $db_ssl);
|
||||||
if (!$this->dbh) {
|
if (!$this->dbh) {
|
||||||
die("<!-- Can't connect [host=".$db_host." port=".$db_port." user=".$db_user." password=XXXX dbname=".$db_name." sslmode=".$db_ssl."] //-->");
|
die("<!-- Can't connect [host=" . $db_host . " port=" . $db_port . " user="
|
||||||
|
. $db_user . " password=XXXX dbname=" . $db_name . " sslmode=" . $db_ssl . "] //-->");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $this->dbh;
|
return $this->dbh;
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* direct write to log file
|
* direct write to log file
|
||||||
* must have BASE folder and LOG foder defined
|
* must have BASE folder and LOG foder defined
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Debug;
|
namespace CoreLibs\Debug;
|
||||||
|
|
||||||
class FileWriter
|
class FileWriter
|
||||||
@@ -51,7 +53,8 @@ class FileWriter
|
|||||||
if ($enter === true) {
|
if ($enter === true) {
|
||||||
$string .= "\n";
|
$string .= "\n";
|
||||||
}
|
}
|
||||||
$string = "[".\CoreLibs\Debug\Support::printTime()."] [".\CoreLibs\Get\System::getPageName(2)."] - ".$string;
|
$string = "[" . \CoreLibs\Debug\Support::printTime() . "] "
|
||||||
|
. "[" . \CoreLibs\Get\System::getPageName(2) . "] - " . $string;
|
||||||
fwrite($fh, $string);
|
fwrite($fh, $string);
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Debug support functions
|
* Debug support functions
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
* print_output_not
|
* print_output_not
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Debug;
|
namespace CoreLibs\Debug;
|
||||||
|
|
||||||
class Logging
|
class Logging
|
||||||
@@ -152,7 +154,8 @@ class Logging
|
|||||||
// check if we do debug, echo or print
|
// check if we do debug, echo or print
|
||||||
switch ($target) {
|
switch ($target) {
|
||||||
case 'debug':
|
case 'debug':
|
||||||
if ((
|
if (
|
||||||
|
(
|
||||||
(isset($this->debug_output[$level]) && $this->debug_output[$level]) ||
|
(isset($this->debug_output[$level]) && $this->debug_output[$level]) ||
|
||||||
$this->debug_output_all
|
$this->debug_output_all
|
||||||
) &&
|
) &&
|
||||||
@@ -164,7 +167,8 @@ class Logging
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'echo':
|
case 'echo':
|
||||||
if ((
|
if (
|
||||||
|
(
|
||||||
(isset($this->echo_output[$level]) && $this->echo_output[$level]) ||
|
(isset($this->echo_output[$level]) && $this->echo_output[$level]) ||
|
||||||
$this->echo_output_all
|
$this->echo_output_all
|
||||||
) &&
|
) &&
|
||||||
@@ -176,7 +180,8 @@ class Logging
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'print':
|
case 'print':
|
||||||
if ((
|
if (
|
||||||
|
(
|
||||||
(isset($this->print_output[$level]) && $this->print_output[$level]) ||
|
(isset($this->print_output[$level]) && $this->print_output[$level]) ||
|
||||||
$this->print_output_all
|
$this->print_output_all
|
||||||
) &&
|
) &&
|
||||||
@@ -200,7 +205,8 @@ class Logging
|
|||||||
private function writeErrorMsg(string $level, string $error_string): bool
|
private function writeErrorMsg(string $level, string $error_string): bool
|
||||||
{
|
{
|
||||||
// only write if write is requested
|
// only write if write is requested
|
||||||
if (!($this->doDebugTrigger('debug', $level) &&
|
if (
|
||||||
|
!($this->doDebugTrigger('debug', $level) &&
|
||||||
$this->doDebugTrigger('print', $level))
|
$this->doDebugTrigger('print', $level))
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
@@ -228,7 +234,9 @@ class Logging
|
|||||||
$this->log_file_unique_id = $GLOBALS['LOG_FILE_UNIQUE_ID'];
|
$this->log_file_unique_id = $GLOBALS['LOG_FILE_UNIQUE_ID'];
|
||||||
}
|
}
|
||||||
if (!$this->log_file_unique_id) {
|
if (!$this->log_file_unique_id) {
|
||||||
$GLOBALS['LOG_FILE_UNIQUE_ID'] = $this->log_file_unique_id = date('Y-m-d_His').'_U_'.substr(hash('sha1', uniqid((string)mt_rand(), true)), 0, 8);
|
$GLOBALS['LOG_FILE_UNIQUE_ID'] = $this->log_file_unique_id =
|
||||||
|
date('Y-m-d_His') . '_U_'
|
||||||
|
. substr(hash('sha1', uniqid((string)mt_rand(), true)), 0, 8);
|
||||||
}
|
}
|
||||||
$rpl_string = '_' . $this->log_file_unique_id; // add 8 char unique string
|
$rpl_string = '_' . $this->log_file_unique_id; // add 8 char unique string
|
||||||
} else {
|
} else {
|
||||||
@@ -239,10 +247,13 @@ class Logging
|
|||||||
$rpl_string = !$this->log_per_level ? '' : '_' . $level; // if request to write to one file
|
$rpl_string = !$this->log_per_level ? '' : '_' . $level; // if request to write to one file
|
||||||
$fn = str_replace('##LEVEL##', $rpl_string, $fn); // create output filename
|
$fn = str_replace('##LEVEL##', $rpl_string, $fn); // create output filename
|
||||||
// set per class, but don't use get_class as we will only get self
|
// set per class, but don't use get_class as we will only get self
|
||||||
$rpl_string = !$this->log_per_class ? '' : '_'.str_replace('\\', '-', \CoreLibs\Debug\Support::getCallerClass()); // set sub class settings
|
$rpl_string = !$this->log_per_class ? '' : '_'
|
||||||
|
// set sub class settings
|
||||||
|
. str_replace('\\', '-', \CoreLibs\Debug\Support::getCallerClass());
|
||||||
$fn = str_replace('##CLASS##', $rpl_string, $fn); // create output filename
|
$fn = str_replace('##CLASS##', $rpl_string, $fn); // create output filename
|
||||||
|
|
||||||
$rpl_string = !$this->log_per_page ? '' : '_'.\CoreLibs\Get\System::getPageName(1); // if request to write to one file
|
// if request to write to one file
|
||||||
|
$rpl_string = !$this->log_per_page ? '' : '_' . \CoreLibs\Get\System::getPageName(1);
|
||||||
$fn = str_replace('##PAGENAME##', $rpl_string, $fn); // create output filename
|
$fn = str_replace('##PAGENAME##', $rpl_string, $fn); // create output filename
|
||||||
|
|
||||||
// write to file
|
// write to file
|
||||||
@@ -548,10 +559,15 @@ class Logging
|
|||||||
} // for each level
|
} // for each level
|
||||||
// create the output wrapper around, so we have a nice formated output per class
|
// create the output wrapper around, so we have a nice formated output per class
|
||||||
if ($string_output) {
|
if ($string_output) {
|
||||||
$string_prefix = '<div style="text-align: left; padding: 5px; font-size: 10px; font-family: sans-serif; border-top: 1px solid black; border-bottom: 1px solid black; margin: 10px 0 10px 0; background-color: white; color: black;">'
|
$string_prefix = '<div style="text-align: left; padding: 5px; font-size: 10px; '
|
||||||
.'<div style="font-size: 12px;">{<span style="font-style: italic; color: #928100;">'.\CoreLibs\Debug\Support::getCallerClass().'</span>}</div>';
|
. 'font-family: sans-serif; border-top: 1px solid black; '
|
||||||
|
. 'border-bottom: 1px solid black; margin: 10px 0 10px 0; '
|
||||||
|
. 'background-color: white; color: black;">'
|
||||||
|
. '<div style="font-size: 12px;">{<span style="font-style: italic; color: #928100;">'
|
||||||
|
. \CoreLibs\Debug\Support::getCallerClass() . '</span>}</div>';
|
||||||
$string_output = $string_prefix . $string_output
|
$string_output = $string_prefix . $string_output
|
||||||
.'<div><span style="font-style: italic; color: #108db3;">Script Run Time:</span> '.$script_end.'</div>'
|
. '<div><span style="font-style: italic; color: #108db3;">Script Run Time:</span> '
|
||||||
|
. $script_end . '</div>'
|
||||||
. '</div>';
|
. '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* various running time checkers
|
* various running time checkers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Debug;
|
namespace CoreLibs\Debug;
|
||||||
|
|
||||||
class RunningTime
|
class RunningTime
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Debug support functions
|
* Debug support functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Debug;
|
namespace CoreLibs\Debug;
|
||||||
|
|
||||||
class Support
|
class Support
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* system related functions to get self name, host name, error strings
|
* system related functions to get self name, host name, error strings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Get;
|
namespace CoreLibs\Get;
|
||||||
|
|
||||||
class System
|
class System
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language\Core;
|
namespace CoreLibs\Language\Core;
|
||||||
|
|
||||||
// Preloads entire file in memory first, then creates a StringReader
|
// Preloads entire file in memory first, then creates a StringReader
|
||||||
@@ -27,7 +29,7 @@ namespace CoreLibs\Language\Core;
|
|||||||
class CachedFileReader extends \CoreLibs\Language\Core\StringReader
|
class CachedFileReader extends \CoreLibs\Language\Core\StringReader
|
||||||
{
|
{
|
||||||
public $error = 0;
|
public $error = 0;
|
||||||
public $_str = '';
|
public $fd_str = '';
|
||||||
|
|
||||||
public function __construct($filename)
|
public function __construct($filename)
|
||||||
{
|
{
|
||||||
@@ -39,7 +41,7 @@ class CachedFileReader extends \CoreLibs\Language\Core\StringReader
|
|||||||
if (!$fd) {
|
if (!$fd) {
|
||||||
$this->error = 3; // Cannot read file, probably permissions
|
$this->error = 3; // Cannot read file, probably permissions
|
||||||
}
|
}
|
||||||
$this->_str = fread($fd, $length);
|
$this->fd_str = fread($fd, $length);
|
||||||
fclose($fd);
|
fclose($fd);
|
||||||
} else {
|
} else {
|
||||||
$this->error = 2; // File doesn't exist
|
$this->error = 2; // File doesn't exist
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language\Core;
|
namespace CoreLibs\Language\Core;
|
||||||
|
|
||||||
class FileReader
|
class FileReader
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003, 2009 Danilo Segan <danilo@kvota.net>.
|
Copyright (c) 2003, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
|
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
|
||||||
@@ -20,6 +21,8 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language\Core;
|
namespace CoreLibs\Language\Core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,9 +152,11 @@ class GetTextReader
|
|||||||
*/
|
*/
|
||||||
private function load_tables()
|
private function load_tables()
|
||||||
{
|
{
|
||||||
if (is_array($this->cache_translations) &&
|
if (
|
||||||
|
is_array($this->cache_translations) &&
|
||||||
is_array($this->table_originals) &&
|
is_array($this->table_originals) &&
|
||||||
is_array($this->table_translations)) {
|
is_array($this->table_translations)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language\Core;
|
namespace CoreLibs\Language\Core;
|
||||||
|
|
||||||
// Simple class to wrap file streams, string streams, etc.
|
// Simple class to wrap file streams, string streams, etc.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language\Core;
|
namespace CoreLibs\Language\Core;
|
||||||
|
|
||||||
class StringReader
|
class StringReader
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hash wrapper functions for old problem fixes
|
* hash wrapper functions for old problem fixes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language;
|
namespace CoreLibs\Language;
|
||||||
|
|
||||||
class Encoding
|
class Encoding
|
||||||
@@ -95,7 +97,11 @@ class Encoding
|
|||||||
$char = mb_substr($string, $i, 1, $from_encoding);
|
$char = mb_substr($string, $i, 1, $from_encoding);
|
||||||
$r_char = mb_substr($compare, $i, 1, $from_encoding);
|
$r_char = mb_substr($compare, $i, 1, $from_encoding);
|
||||||
// the ord 194 is a hack to fix the IE7/IE8 bug with line break and illegal character
|
// the ord 194 is a hack to fix the IE7/IE8 bug with line break and illegal character
|
||||||
if ((($char != $r_char && !self::$mb_error_char) || ($char != $r_char && $r_char == self::$mb_error_char && self::$mb_error_char)) && ord($char) != 194) {
|
if (
|
||||||
|
(($char != $r_char && !self::$mb_error_char) ||
|
||||||
|
($char != $r_char && $r_char == self::$mb_error_char && self::$mb_error_char)) &&
|
||||||
|
ord($char) != 194
|
||||||
|
) {
|
||||||
$failed[] = $char;
|
$failed[] = $char;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,15 +125,20 @@ class Encoding
|
|||||||
* to what we sav the source is
|
* to what we sav the source is
|
||||||
* @return string encoding converted string
|
* @return string encoding converted string
|
||||||
*/
|
*/
|
||||||
public static function convertEncoding(string $string, string $to_encoding, string $source_encoding = '', bool $auto_check = true): string
|
public static function convertEncoding(
|
||||||
{
|
string $string,
|
||||||
|
string $to_encoding,
|
||||||
|
string $source_encoding = '',
|
||||||
|
bool $auto_check = true
|
||||||
|
): string {
|
||||||
// set if not given
|
// set if not given
|
||||||
if (!$source_encoding) {
|
if (!$source_encoding) {
|
||||||
$source_encoding = mb_detect_encoding($string);
|
$source_encoding = mb_detect_encoding($string);
|
||||||
} else {
|
} else {
|
||||||
$_source_encoding = mb_detect_encoding($string);
|
$_source_encoding = mb_detect_encoding($string);
|
||||||
}
|
}
|
||||||
if ($auto_check === true &&
|
if (
|
||||||
|
$auto_check === true &&
|
||||||
isset($_source_encoding) &&
|
isset($_source_encoding) &&
|
||||||
$_source_encoding == $source_encoding
|
$_source_encoding == $source_encoding
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2004/11/18
|
* CREATED: 2004/11/18
|
||||||
@@ -23,10 +24,12 @@
|
|||||||
* 2005/10/17 (cs) made an on the fly switch method (reload of lang)
|
* 2005/10/17 (cs) made an on the fly switch method (reload of lang)
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Language;
|
namespace CoreLibs\Language;
|
||||||
|
|
||||||
use \CoreLibs\Language\Core\FileReader;
|
use CoreLibs\Language\Core\FileReader;
|
||||||
use \CoreLibs\Language\Core\GetTextReader;
|
use CoreLibs\Language\Core\GetTextReader;
|
||||||
|
|
||||||
class L10n extends \CoreLibs\Basic
|
class L10n extends \CoreLibs\Basic
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* elements for html output direct
|
* elements for html output direct
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Output\Form;
|
namespace CoreLibs\Output\Form;
|
||||||
|
|
||||||
class Elements
|
class Elements
|
||||||
@@ -15,15 +17,25 @@ class Elements
|
|||||||
* @param int $day day d
|
* @param int $day day d
|
||||||
* @param int $hour hour H
|
* @param int $hour hour H
|
||||||
* @param int $min min i
|
* @param int $min min i
|
||||||
* @param string $suffix additional info printed after the date time variable in the drop down
|
* @param string $suffix additional info printed after the date time
|
||||||
|
* variable in the drop down
|
||||||
* also used for ID in the on change JS call
|
* also used for ID in the on change JS call
|
||||||
* @param int $min_steps default is 1 (minute), can set to anything, is used as sum up from 0
|
* @param int $min_steps default is 1 (minute), can set to anything,
|
||||||
|
* is used as sum up from 0
|
||||||
* @param bool $name_pos_back default false, if set to true, the name will be printend
|
* @param bool $name_pos_back default false, if set to true, the name will be printend
|
||||||
* after the drop down and not before the drop down
|
* after the drop down and not before the drop down
|
||||||
* @return string HTML formated strings for drop down lists of date and time
|
* @return string HTML formated strings for drop down lists of date and time
|
||||||
*/
|
*/
|
||||||
public static function printDateTime($year, $month, $day, $hour, $min, string $suffix = '', int $min_steps = 1, bool $name_pos_back = false)
|
public static function printDateTime(
|
||||||
{
|
$year,
|
||||||
|
$month,
|
||||||
|
$day,
|
||||||
|
$hour,
|
||||||
|
$min,
|
||||||
|
string $suffix = '',
|
||||||
|
int $min_steps = 1,
|
||||||
|
bool $name_pos_back = false
|
||||||
|
) {
|
||||||
// if suffix given, add _ before
|
// if suffix given, add _ before
|
||||||
if ($suffix) {
|
if ($suffix) {
|
||||||
$suffix = '_' . $suffix;
|
$suffix = '_' . $suffix;
|
||||||
@@ -66,7 +78,8 @@ class Elements
|
|||||||
}
|
}
|
||||||
$string .= '<select id="month' . $suffix . '" name="month' . $suffix . '" onChange="' . $on_change_call . '">';
|
$string .= '<select id="month' . $suffix . '" name="month' . $suffix . '" onChange="' . $on_change_call . '">';
|
||||||
for ($i = 1; $i <= 12; $i++) {
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
$string .= '<option value="'.($i < 10 ? '0'.$i : $i).'" '.($month == $i ? 'selected' : '').'>'.$i.'</option>';
|
$string .= '<option value="' . ($i < 10 ? '0' . $i : $i) . '" '
|
||||||
|
. ($month == $i ? 'selected' : '') . '>' . $i . '</option>';
|
||||||
}
|
}
|
||||||
$string .= '</select> ';
|
$string .= '</select> ';
|
||||||
if ($name_pos_back === true) {
|
if ($name_pos_back === true) {
|
||||||
@@ -78,7 +91,9 @@ class Elements
|
|||||||
$string .= '<select id="day' . $suffix . '" name="day' . $suffix . '" onChange="' . $on_change_call . '">';
|
$string .= '<select id="day' . $suffix . '" name="day' . $suffix . '" onChange="' . $on_change_call . '">';
|
||||||
for ($i = 1; $i <= $days_in_month; $i++) {
|
for ($i = 1; $i <= $days_in_month; $i++) {
|
||||||
// set weekday text based on current month ($month) and year ($year)
|
// set weekday text based on current month ($month) and year ($year)
|
||||||
$string .= '<option value="'.($i < 10 ? '0'.$i : $i).'" '.($day == $i ? 'selected' : '').'>'.$i.' ('.date('D', mktime(0, 0, 0, $month, $i, $year)).')</option>';
|
$string .= '<option value="' . ($i < 10 ? '0' . $i : $i) . '" '
|
||||||
|
. ($day == $i ? 'selected' : '') . '>' . $i
|
||||||
|
. ' (' . date('D', mktime(0, 0, 0, $month, $i, $year)) . ')</option>';
|
||||||
}
|
}
|
||||||
$string .= '</select> ';
|
$string .= '</select> ';
|
||||||
if ($name_pos_back === true) {
|
if ($name_pos_back === true) {
|
||||||
@@ -89,7 +104,8 @@ class Elements
|
|||||||
}
|
}
|
||||||
$string .= '<select id="hour' . $suffix . '" name="hour' . $suffix . '" onChange="' . $on_change_call . '">';
|
$string .= '<select id="hour' . $suffix . '" name="hour' . $suffix . '" onChange="' . $on_change_call . '">';
|
||||||
for ($i = 0; $i <= 23; $i += $min_steps) {
|
for ($i = 0; $i <= 23; $i += $min_steps) {
|
||||||
$string .= '<option value="'.($i < 10 ? '0'.$i : $i).'" '.($hour == $i ? 'selected' : '').'>'.$i.'</option>';
|
$string .= '<option value="' . ($i < 10 ? '0' . $i : $i)
|
||||||
|
. '" ' . ($hour == $i ? 'selected' : '') . '>' . $i . '</option>';
|
||||||
}
|
}
|
||||||
$string .= '</select> ';
|
$string .= '</select> ';
|
||||||
if ($name_pos_back === true) {
|
if ($name_pos_back === true) {
|
||||||
@@ -98,9 +114,11 @@ class Elements
|
|||||||
if ($name_pos_back === false) {
|
if ($name_pos_back === false) {
|
||||||
$string .= 'Minute ';
|
$string .= 'Minute ';
|
||||||
}
|
}
|
||||||
$string .= '<select id="min'.$suffix.'" name="min'.$suffix.'" onChange="'.$on_change_call.'">';
|
$string .= '<select id="min' . $suffix . '" name="min'
|
||||||
|
. $suffix . '" onChange="' . $on_change_call . '">';
|
||||||
for ($i = 0; $i <= 59; $i++) {
|
for ($i = 0; $i <= 59; $i++) {
|
||||||
$string .= '<option value="'.($i < 10 ? '0'.$i : $i).'" '.($min == $i ? 'selected' : '').'>'.$i.'</option>';
|
$string .= '<option value="' . ($i < 10 ? '0' . $i : $i)
|
||||||
|
. '" ' . ($min == $i ? 'selected' : '') . '>' . $i . '</option>';
|
||||||
}
|
}
|
||||||
$string .= '</select>';
|
$string .= '</select>';
|
||||||
if ($name_pos_back === true) {
|
if ($name_pos_back === true) {
|
||||||
@@ -152,7 +170,15 @@ class Elements
|
|||||||
$output = preg_replace_callback(
|
$output = preg_replace_callback(
|
||||||
"/(href=\")?(\>)?\b($protRegex)([\w\.\-?&=+%#~,;\/]+)\b([\.\-?&=+%#~,;\/]*)(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
"/(href=\")?(\>)?\b($protRegex)([\w\.\-?&=+%#~,;\/]+)\b([\.\-?&=+%#~,;\/]*)(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
||||||
function ($matches) {
|
function ($matches) {
|
||||||
return self::createUrl($matches[1] ?? '', $matches[2] ?? '', $matches[3] ?? '', $matches[4] ?? '', $matches[5] ?? '', $matches[7] ?? '', $matches[9] ?? '');
|
return self::createUrl(
|
||||||
|
$matches[1] ?? '',
|
||||||
|
$matches[2] ?? '',
|
||||||
|
$matches[3] ?? '',
|
||||||
|
$matches[4] ?? '',
|
||||||
|
$matches[5] ?? '',
|
||||||
|
$matches[7] ?? '',
|
||||||
|
$matches[9] ?? ''
|
||||||
|
);
|
||||||
},
|
},
|
||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
@@ -160,7 +186,15 @@ class Elements
|
|||||||
$output = preg_replace_callback(
|
$output = preg_replace_callback(
|
||||||
"/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
"/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
||||||
function ($matches) {
|
function ($matches) {
|
||||||
return self::createEmail($matches[1] ?? '', $matches[2] ?? '', $matches[3] ?? '', $matches[4] ?? '', $matches[5] ?? '', $matches[7] ?? '', $matches[9] ?? '');
|
return self::createEmail(
|
||||||
|
$matches[1] ?? '',
|
||||||
|
$matches[2] ?? '',
|
||||||
|
$matches[3] ?? '',
|
||||||
|
$matches[4] ?? '',
|
||||||
|
$matches[5] ?? '',
|
||||||
|
$matches[7] ?? '',
|
||||||
|
$matches[9] ?? ''
|
||||||
|
);
|
||||||
},
|
},
|
||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
@@ -201,7 +235,10 @@ class Elements
|
|||||||
}
|
}
|
||||||
// if it is a link already just return the original link do not touch anything
|
// if it is a link already just return the original link do not touch anything
|
||||||
if (!$href && !$atag) {
|
if (!$href && !$atag) {
|
||||||
return "##LT##a href=##QUOT##".$_1.$_2.$_3."##QUOT##".($class ? ' class=##QUOT##'.$class.'##QUOT##' : '').($target ? " target=##QUOT##".$target."##QUOT##" : '')."##GT##".($name ? $name : $_2.$_3)."##LT##/a##GT##";
|
return "##LT##a href=##QUOT##" . $_1 . $_2 . $_3 . "##QUOT##"
|
||||||
|
. ($class ? ' class=##QUOT##' . $class . '##QUOT##' : '')
|
||||||
|
. ($target ? " target=##QUOT##" . $target . "##QUOT##" : '')
|
||||||
|
. "##GT##" . ($name ? $name : $_2 . $_3) . "##LT##/a##GT##";
|
||||||
} elseif ($href && !$atag) {
|
} elseif ($href && !$atag) {
|
||||||
return "href=##QUOT##$_1$_2$_3##QUOT##";
|
return "href=##QUOT##$_1$_2$_3##QUOT##";
|
||||||
} elseif ($atag) {
|
} elseif ($atag) {
|
||||||
@@ -226,7 +263,9 @@ class Elements
|
|||||||
{
|
{
|
||||||
$email = $_1 . "@" . $_2 . "." . $_3;
|
$email = $_1 . "@" . $_2 . "." . $_3;
|
||||||
if (!$mailto && !$atag) {
|
if (!$mailto && !$atag) {
|
||||||
return "##LT##a href=##QUOT##mailto:".$email."##QUOT##".($class ? ' class=##QUOT##'.$class.'##QUOT##' : '')."##GT##".($title ? $title : $email)."##LT##/a##GT##";
|
return "##LT##a href=##QUOT##mailto:" . $email . "##QUOT##"
|
||||||
|
. ($class ? ' class=##QUOT##' . $class . '##QUOT##' : '')
|
||||||
|
. "##GT##" . ($title ? $title : $email) . "##LT##/a##GT##";
|
||||||
} elseif ($mailto && !$atag) {
|
} elseif ($mailto && !$atag) {
|
||||||
return "mailto:" . $email;
|
return "mailto:" . $email;
|
||||||
} elseif ($atag) {
|
} elseif ($atag) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sets a form token in the _SESSION variable
|
* sets a form token in the _SESSION variable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Output\Form;
|
namespace CoreLibs\Output\Form;
|
||||||
|
|
||||||
class Token
|
class Token
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* image thumbnail, rotate, etc
|
* image thumbnail, rotate, etc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Output;
|
namespace CoreLibs\Output;
|
||||||
|
|
||||||
class Image
|
class Image
|
||||||
@@ -175,10 +177,12 @@ class Image
|
|||||||
int $jpeg_quality = 80
|
int $jpeg_quality = 80
|
||||||
) {
|
) {
|
||||||
$thumbnail = false;
|
$thumbnail = false;
|
||||||
// $this->debug('IMAGE PREPARE', "FILE: $filename (exists ".(string)file_exists($filename)."), WIDTH: $thumb_width, HEIGHT: $thumb_height");
|
// $this->debug('IMAGE PREPARE', "FILE: $filename (exists "
|
||||||
|
// .(string)file_exists($filename)."), WIDTH: $thumb_width, HEIGHT: $thumb_height");
|
||||||
// check that input image exists and is either jpeg or png
|
// check that input image exists and is either jpeg or png
|
||||||
// also fail if the basic CACHE folder does not exist at all
|
// also fail if the basic CACHE folder does not exist at all
|
||||||
if (file_exists($filename) &&
|
if (
|
||||||
|
file_exists($filename) &&
|
||||||
is_dir(BASE . LAYOUT . CONTENT_PATH . CACHE) &&
|
is_dir(BASE . LAYOUT . CONTENT_PATH . CACHE) &&
|
||||||
is_writable(BASE . LAYOUT . CONTENT_PATH . CACHE)
|
is_writable(BASE . LAYOUT . CONTENT_PATH . CACHE)
|
||||||
) {
|
) {
|
||||||
@@ -187,7 +191,8 @@ class Image
|
|||||||
$thumbnail_write_path = null;
|
$thumbnail_write_path = null;
|
||||||
$thumbnail_web_path = null;
|
$thumbnail_web_path = null;
|
||||||
// path set first
|
// path set first
|
||||||
if ($img_type == IMAGETYPE_JPEG ||
|
if (
|
||||||
|
$img_type == IMAGETYPE_JPEG ||
|
||||||
$img_type == IMAGETYPE_PNG ||
|
$img_type == IMAGETYPE_PNG ||
|
||||||
$create_dummy === true
|
$create_dummy === true
|
||||||
) {
|
) {
|
||||||
@@ -204,7 +209,8 @@ class Image
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// do resize or fall back on dummy run
|
// do resize or fall back on dummy run
|
||||||
if ($img_type == IMAGETYPE_JPEG ||
|
if (
|
||||||
|
$img_type == IMAGETYPE_JPEG ||
|
||||||
$img_type == IMAGETYPE_PNG
|
$img_type == IMAGETYPE_PNG
|
||||||
) {
|
) {
|
||||||
// if missing width or height in thumb, use the set one
|
// if missing width or height in thumb, use the set one
|
||||||
@@ -219,7 +225,8 @@ class Image
|
|||||||
$thumb_width_r = 0;
|
$thumb_width_r = 0;
|
||||||
$thumb_height_r = 0;
|
$thumb_height_r = 0;
|
||||||
// we need to keep the aspect ration on longest side
|
// we need to keep the aspect ration on longest side
|
||||||
if (($inc_height > $inc_width &&
|
if (
|
||||||
|
($inc_height > $inc_width &&
|
||||||
// and the height is bigger than thumb set
|
// and the height is bigger than thumb set
|
||||||
$inc_height > $thumb_height) ||
|
$inc_height > $thumb_height) ||
|
||||||
// or the height is smaller or equal width
|
// or the height is smaller or equal width
|
||||||
@@ -240,8 +247,10 @@ class Image
|
|||||||
}
|
}
|
||||||
// $this->debug('IMAGE PREPARE', "Ratio: $ratio, Target size $thumb_width_r x $thumb_height_r");
|
// $this->debug('IMAGE PREPARE', "Ratio: $ratio, Target size $thumb_width_r x $thumb_height_r");
|
||||||
// set output thumbnail name
|
// set output thumbnail name
|
||||||
$thumbnail = 'thumb-'.pathinfo($filename)['filename'].'-'.$thumb_width_r.'x'.$thumb_height_r;
|
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-'
|
||||||
if ($use_cache === false ||
|
. $thumb_width_r . 'x' . $thumb_height_r;
|
||||||
|
if (
|
||||||
|
$use_cache === false ||
|
||||||
!file_exists($thumbnail_write_path . $thumbnail)
|
!file_exists($thumbnail_write_path . $thumbnail)
|
||||||
) {
|
) {
|
||||||
// image, copy source image, offset in image, source x/y, new size, source image size
|
// image, copy source image, offset in image, source x/y, new size, source image size
|
||||||
@@ -268,9 +277,31 @@ class Image
|
|||||||
if ($source !== null) {
|
if ($source !== null) {
|
||||||
// resize no shift
|
// resize no shift
|
||||||
if ($high_quality === true) {
|
if ($high_quality === true) {
|
||||||
imagecopyresized($thumb, $source, 0, 0, 0, 0, $thumb_width_r, $thumb_height_r, $inc_width, $inc_height);
|
imagecopyresized(
|
||||||
|
$thumb,
|
||||||
|
$source,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
$thumb_width_r,
|
||||||
|
$thumb_height_r,
|
||||||
|
$inc_width,
|
||||||
|
$inc_height
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $thumb_width_r, $thumb_height_r, $inc_width, $inc_height);
|
imagecopyresampled(
|
||||||
|
$thumb,
|
||||||
|
$source,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
$thumb_width_r,
|
||||||
|
$thumb_height_r,
|
||||||
|
$inc_width,
|
||||||
|
$inc_height
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// write file
|
// write file
|
||||||
switch ($img_type) {
|
switch ($img_type) {
|
||||||
@@ -291,7 +322,8 @@ class Image
|
|||||||
} else {
|
} else {
|
||||||
// we just copy over the image as is, we never upscale
|
// we just copy over the image as is, we never upscale
|
||||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $inc_width . 'x' . $inc_height;
|
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $inc_width . 'x' . $inc_height;
|
||||||
if ($use_cache === false ||
|
if (
|
||||||
|
$use_cache === false ||
|
||||||
!file_exists($thumbnail_write_path . $thumbnail)
|
!file_exists($thumbnail_write_path . $thumbnail)
|
||||||
) {
|
) {
|
||||||
copy($filename, $thumbnail_write_path . $thumbnail);
|
copy($filename, $thumbnail_write_path . $thumbnail);
|
||||||
@@ -312,7 +344,8 @@ class Image
|
|||||||
}
|
}
|
||||||
// do we have an image already?
|
// do we have an image already?
|
||||||
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $thumb_width . 'x' . $thumb_height;
|
$thumbnail = 'thumb-' . pathinfo($filename)['filename'] . '-' . $thumb_width . 'x' . $thumb_height;
|
||||||
if ($use_cache === false ||
|
if (
|
||||||
|
$use_cache === false ||
|
||||||
!file_exists($thumbnail_write_path . $thumbnail)
|
!file_exists($thumbnail_write_path . $thumbnail)
|
||||||
) {
|
) {
|
||||||
// if both are unset, set to 250
|
// if both are unset, set to 250
|
||||||
@@ -335,7 +368,14 @@ class Image
|
|||||||
} else {
|
} else {
|
||||||
$width = (int)round(imagesy($thumb) / 100 * 5);
|
$width = (int)round(imagesy($thumb) / 100 * 5);
|
||||||
}
|
}
|
||||||
imagefilledrectangle($thumb, 0 + $width, 0 + $width, imagesx($thumb) - $width, imagesy($thumb) - $width, $white);
|
imagefilledrectangle(
|
||||||
|
$thumb,
|
||||||
|
0 + $width,
|
||||||
|
0 + $width,
|
||||||
|
imagesx($thumb) - $width,
|
||||||
|
imagesy($thumb) - $width,
|
||||||
|
$white
|
||||||
|
);
|
||||||
// add "No valid images source"
|
// add "No valid images source"
|
||||||
// OR add circle
|
// OR add circle
|
||||||
// * find center
|
// * find center
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class ProgressBar
|
* Class ProgressBar
|
||||||
*
|
*
|
||||||
@@ -13,6 +14,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace CoreLibs\Output;
|
namespace CoreLibs\Output;
|
||||||
|
|
||||||
class ProgressBar
|
class ProgressBar
|
||||||
@@ -313,7 +316,10 @@ class ProgressBar
|
|||||||
'type' => $type, // either percent or percentlbl
|
'type' => $type, // either percent or percentlbl
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'left' => false,
|
'left' => false,
|
||||||
'top' => round(($this->height - $font_size) / log($this->height - $font_size, 7), 0) - $this->pedding,
|
'top' => round(
|
||||||
|
($this->height - $font_size) / log($this->height - $font_size, 7),
|
||||||
|
0
|
||||||
|
) - $this->pedding,
|
||||||
'width' => $this->width,
|
'width' => $this->width,
|
||||||
'height' => 0,
|
'height' => 0,
|
||||||
'align' => 'center',
|
'align' => 'center',
|
||||||
@@ -368,8 +374,14 @@ class ProgressBar
|
|||||||
* @param string $align alignment (left/right/etc), default empty
|
* @param string $align alignment (left/right/etc), default empty
|
||||||
* @return void has no return
|
* @return void has no return
|
||||||
*/
|
*/
|
||||||
public function setLabelPosition(string $name, int $left, int $top, int $width, int $height, string $align = ''): void
|
public function setLabelPosition(
|
||||||
{
|
string $name,
|
||||||
|
int $left,
|
||||||
|
int $top,
|
||||||
|
int $width,
|
||||||
|
int $height,
|
||||||
|
string $align = ''
|
||||||
|
): void {
|
||||||
// print "SET POSITION[$name]: $left<br>";
|
// print "SET POSITION[$name]: $left<br>";
|
||||||
// if this is percent, we ignore anything, it is auto positioned
|
// if this is percent, we ignore anything, it is auto positioned
|
||||||
if ($this->label[$name]['type'] != 'percent') {
|
if ($this->label[$name]['type'] != 'percent') {
|
||||||
@@ -386,11 +398,16 @@ class ProgressBar
|
|||||||
// init
|
// init
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
$output = '<script type="text/JavaScript">';
|
$output = '<script type="text/JavaScript">';
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.top="'.$this->label[$name]['top'].'px";';
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.left="'.$this->label[$name]['left'].'px";';
|
. $this->code . '").style.top="' . $this->label[$name]['top'] . 'px";';
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.width="'.$this->label[$name]['width'].'px";';
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.height="'.$this->label[$name]['height'].'px";';
|
. $this->code . '").style.left="' . $this->label[$name]['left'] . 'px";';
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.align="'.$this->label[$name]['align'].'";';
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.width="' . $this->label[$name]['width'] . 'px";';
|
||||||
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.height="' . $this->label[$name]['height'] . 'px";';
|
||||||
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.align="' . $this->label[$name]['align'] . '";';
|
||||||
$output .= '</script>' . "\n";
|
$output .= '</script>' . "\n";
|
||||||
echo $output;
|
echo $output;
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
@@ -407,7 +424,8 @@ class ProgressBar
|
|||||||
{
|
{
|
||||||
$this->label[$name]['color'] = $color;
|
$this->label[$name]['color'] = $color;
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
echo '<script type="text/JavaScript">document.getElementById("plbl'.$name.$this->code.'").style.color="'.$color.'";</script>'."\n";
|
echo '<script type="text/JavaScript">document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.color="' . $color . '";</script>' . "\n";
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -422,7 +440,8 @@ class ProgressBar
|
|||||||
{
|
{
|
||||||
$this->label[$name]['bgr_color'] = $color;
|
$this->label[$name]['bgr_color'] = $color;
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
echo '<script type="text/JavaScript">document.getElementById("plbl'.$name.$this->code.'").style.background="'.$color.'";</script>'."\n";
|
echo '<script type="text/JavaScript">document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.background="' . $color . '";</script>' . "\n";
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,9 +466,14 @@ class ProgressBar
|
|||||||
}
|
}
|
||||||
// position the label new if this is percent
|
// position the label new if this is percent
|
||||||
if ($this->label[$name]['type'] == 'percent') {
|
if ($this->label[$name]['type'] == 'percent') {
|
||||||
$this->label[$name]['top'] = round(($this->height - intval($size)) / log($this->height - intval($size), 7), 0) - $this->pedding;
|
$this->label[$name]['top'] = round(
|
||||||
|
($this->height - intval($size)) / log($this->height - intval($size), 7),
|
||||||
|
0
|
||||||
|
) - $this->pedding;
|
||||||
}
|
}
|
||||||
// print "HEIGHT: ".$this->height.", Size: ".intval($size).", Pedding: ".$this->pedding.", Calc: ".round($this->height - intval($size)).", Log: ".log($this->height - intval($size), 7)."<br>";
|
// print "HEIGHT: ".$this->height.", Size: ".intval($size)
|
||||||
|
// .", Pedding: ".$this->pedding.", Calc: ".round($this->height - intval($size))
|
||||||
|
// .", Log: ".log($this->height - intval($size), 7)."<br>";
|
||||||
// then set like usual
|
// then set like usual
|
||||||
$this->label[$name]['font-size'] = intval($size);
|
$this->label[$name]['font-size'] = intval($size);
|
||||||
if ($family != '') {
|
if ($family != '') {
|
||||||
@@ -461,9 +485,12 @@ class ProgressBar
|
|||||||
|
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
$output = '<script type="text/JavaScript">';
|
$output = '<script type="text/JavaScript">';
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.font-size="'.$this->label[$name]['font-size'].'px";';
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.font-family="'.$this->label[$name]['font-family'].'";';
|
. $this->code . '").style.font-size="' . $this->label[$name]['font-size'] . 'px";';
|
||||||
$output .= 'document.getElementById("plbl'.$name.$this->code.'").style.font-weight="'.$this->label[$name]['font-weight'].'";';
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.font-family="' . $this->label[$name]['font-family'] . '";';
|
||||||
|
$output .= 'document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").style.font-weight="' . $this->label[$name]['font-weight'] . '";';
|
||||||
$output .= '</script>' . "\n";
|
$output .= '</script>' . "\n";
|
||||||
echo $output;
|
echo $output;
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
@@ -481,7 +508,8 @@ class ProgressBar
|
|||||||
$this->label[$name]['value'] = $value;
|
$this->label[$name]['value'] = $value;
|
||||||
// print "NAME[$name], Status: ".$this->status.": ".$value."<Br>";
|
// print "NAME[$name], Status: ".$this->status.": ".$value."<Br>";
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
echo '<script type="text/JavaScript">PBlabelText'.$this->code.'("'.$name.'","'.$this->label[$name]['value'].'");</script>'."\n";
|
echo '<script type="text/JavaScript">PBlabelText' . $this->code
|
||||||
|
. '("' . $name . '","' . $this->label[$name]['value'] . '");</script>' . "\n";
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,7 +523,8 @@ class ProgressBar
|
|||||||
{
|
{
|
||||||
$this->color = $color;
|
$this->color = $color;
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
echo '<script type="text/JavaScript">document.getElementById("pbar'.$this->code.'").style.background="'.$color.'";</script>'."\n";
|
echo '<script type="text/JavaScript">document.getElementById("pbar' . $this->code
|
||||||
|
. '").style.background="' . $color . '";</script>' . "\n";
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,7 +538,8 @@ class ProgressBar
|
|||||||
{
|
{
|
||||||
$this->bgr_color = $color;
|
$this->bgr_color = $color;
|
||||||
if ($this->status != 'new') {
|
if ($this->status != 'new') {
|
||||||
echo '<script type="text/JavaScript">document.getElementById("pbrd'.$this->code.'").style.background="'.$color.'";</script>'."\n";
|
echo '<script type="text/JavaScript">document.getElementById("pbrd' . $this->code
|
||||||
|
. '").style.background="' . $color . '";</script>' . "\n";
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -552,15 +582,23 @@ class ProgressBar
|
|||||||
|
|
||||||
$style_master = '';
|
$style_master = '';
|
||||||
if ($this->top || $this->left) {
|
if ($this->top || $this->left) {
|
||||||
$style_master = 'position:relative;top:'.$this->top.'px;left:'.$this->left.'px;width:'.($this->width + 10).'px;';
|
$style_master = 'position:relative;top:' . $this->top
|
||||||
|
. 'px;left:' . $this->left . 'px;width:' . ($this->width + 10) . 'px;';
|
||||||
}
|
}
|
||||||
$html = '<div id="pbm'.$this->code.'" style="'.$style_master.'background:'.$this->bgr_color_master.';">';
|
$html = '<div id="pbm' . $this->code . '" style="' . $style_master
|
||||||
$style_brd = 'width:'.$this->width.'px;height:'.$this->height.'px;background:'.$this->bgr_color.';';
|
. 'background:' . $this->bgr_color_master . ';">';
|
||||||
|
$style_brd = 'width:' . $this->width . 'px;height:' . $this->height
|
||||||
|
. 'px;background:' . $this->bgr_color . ';';
|
||||||
if ($this->border > 0) {
|
if ($this->border > 0) {
|
||||||
$style_brd .= 'border:'.$this->border.'px solid; border-color:'.$this->brd_color.'; -webkit-border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px; -webkit-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset;';
|
$style_brd .= 'border:'
|
||||||
|
. $this->border . 'px solid; border-color:'
|
||||||
|
. $this->brd_color . '; -webkit-border-radius: 5px 5px 5px 5px; '
|
||||||
|
. 'border-radius: 5px 5px 5px 5px; -webkit-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset; '
|
||||||
|
. 'box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset;';
|
||||||
}
|
}
|
||||||
|
|
||||||
$style_bar = 'position:relative;width:'.$this->position['width'].'px;height:'.$this->position['height'].'px;background:'.$this->color.';';
|
$style_bar = 'position:relative;width:' . $this->position['width']
|
||||||
|
. 'px;height:' . $this->position['height'] . 'px;background:' . $this->color . ';';
|
||||||
if ($this->position['top'] !== false) {
|
if ($this->position['top'] !== false) {
|
||||||
$style_bar .= 'top:' . $this->position['top'] . 'px;';
|
$style_bar .= 'top:' . $this->position['top'] . 'px;';
|
||||||
}
|
}
|
||||||
@@ -568,19 +606,26 @@ class ProgressBar
|
|||||||
$style_bar .= 'left:' . $this->position['left'] . 'px;';
|
$style_bar .= 'left:' . $this->position['left'] . 'px;';
|
||||||
}
|
}
|
||||||
if ($this->border > 0) {
|
if ($this->border > 0) {
|
||||||
$style_bar .= '-webkit-border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px; -webkit-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset;';
|
$style_bar .= '-webkit-border-radius: 5px 5px 5px 5px; '
|
||||||
|
. 'border-radius: 5px 5px 5px 5px; -webkit-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset; '
|
||||||
|
. 'box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25) inset;';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->frame['show'] == true) {
|
if ($this->frame['show'] == true) {
|
||||||
$border = '';
|
$border = '';
|
||||||
if ($this->frame['border'] > 0) {
|
if ($this->frame['border'] > 0) {
|
||||||
$border = 'border:'.$this->frame['border'].'px solid;border-color:'.$this->frame['brd_color'].';margin-top:2px;-webkit-border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;';
|
$border = 'border:' . $this->frame['border']
|
||||||
|
. 'px solid;border-color:' . $this->frame['brd_color'] . ';margin-top:2px; '
|
||||||
|
. '-webkit-border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;';
|
||||||
}
|
}
|
||||||
$html .= '<div id="pfrm'.$this->code.'" style="width:'.$this->frame['width'].'px;height:'.$this->frame['height'].'px;'.$border.'background:'.$this->frame['color'].';">'."\n";
|
$html .= '<div id="pfrm' . $this->code . '" style="width:'
|
||||||
|
. $this->frame['width'] . 'px;height:' . $this->frame['height'] . 'px;'
|
||||||
|
. $border . 'background:' . $this->frame['color'] . ';">' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// temp write the bar here, we add that later, below all the html + progress %
|
// temp write the bar here, we add that later, below all the html + progress %
|
||||||
$html_bar_top = '<div id="pbrd'.$this->code.'" style="'.$style_brd.($this->frame['show'] == true ? 'margin-left: 2px;margin-bottom:2px;' : '').'">'."\n";
|
$html_bar_top = '<div id="pbrd' . $this->code . '" style="' . $style_brd
|
||||||
|
. ($this->frame['show'] == true ? 'margin-left: 2px;margin-bottom:2px;' : '') . '">' . "\n";
|
||||||
$html_bar_top .= '<div id="pbar' . $this->code . '" style="' . $style_bar . '">';
|
$html_bar_top .= '<div id="pbar' . $this->code . '" style="' . $style_bar . '">';
|
||||||
// insert single percent there
|
// insert single percent there
|
||||||
$html_bar_bottom = '</div></div>' . "\n";
|
$html_bar_bottom = '</div></div>' . "\n";
|
||||||
@@ -588,10 +633,14 @@ class ProgressBar
|
|||||||
$js .= 'function PBposition' . $this->code . '(item,pixel) {' . "\n";
|
$js .= 'function PBposition' . $this->code . '(item,pixel) {' . "\n";
|
||||||
$js .= ' pixel = parseInt(pixel);' . "\n";
|
$js .= ' pixel = parseInt(pixel);' . "\n";
|
||||||
$js .= ' switch(item) {' . "\n";
|
$js .= ' switch(item) {' . "\n";
|
||||||
$js .= ' case "left": document.getElementById("pbar'.$this->code.'").style.left=(pixel) + \'px\'; break;'."\n";
|
$js .= ' case "left": document.getElementById("pbar' . $this->code
|
||||||
$js .= ' case "top": document.getElementById("pbar'.$this->code.'").style.top=(pixel) + \'px\'; break;'."\n";
|
. '").style.left=(pixel) + \'px\'; break;' . "\n";
|
||||||
$js .= ' case "width": document.getElementById("pbar'.$this->code.'").style.width=(pixel) + \'px\'; break;'."\n";
|
$js .= ' case "top": document.getElementById("pbar' . $this->code
|
||||||
$js .= ' case "height": document.getElementById("pbar'.$this->code.'").style.height=(pixel) + \'px\'; break;'."\n";
|
. '").style.top=(pixel) + \'px\'; break;' . "\n";
|
||||||
|
$js .= ' case "width": document.getElementById("pbar' . $this->code
|
||||||
|
. '").style.width=(pixel) + \'px\'; break;' . "\n";
|
||||||
|
$js .= ' case "height": document.getElementById("pbar' . $this->code
|
||||||
|
. '").style.height=(pixel) + \'px\'; break;' . "\n";
|
||||||
$js .= ' }' . "\n";
|
$js .= ' }' . "\n";
|
||||||
$js .= '}' . "\n";
|
$js .= '}' . "\n";
|
||||||
|
|
||||||
@@ -630,37 +679,51 @@ class ProgressBar
|
|||||||
if (array_key_exists('type', $data)) {
|
if (array_key_exists('type', $data)) {
|
||||||
switch ($data['type']) {
|
switch ($data['type']) {
|
||||||
case 'text':
|
case 'text':
|
||||||
$html .= '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'margin-bottom:2px;">'.$data['value'].'</div>'."\n";
|
$html .= '<div id="plbl' . $name . $this->code . '" style="'
|
||||||
|
. $style_lbl . 'margin-bottom:2px;">' . $data['value'] . '</div>' . "\n";
|
||||||
break;
|
break;
|
||||||
case 'button':
|
case 'button':
|
||||||
$html_button .= '<div><input id="plbl'.$name.$this->code.'" type="button" value="'.$data['value'].'" style="'.$style_lbl.'margin-bottom:5px;" onclick="'.$data['target'].'.location.href=\''.$data['action'].'\'" /></div>'."\n";
|
$html_button .= '<div><input id="plbl' . $name
|
||||||
|
. $this->code . '" type="button" value="' . $data['value'] . '" style="'
|
||||||
|
. $style_lbl . 'margin-bottom:5px;" onclick="' . $data['target'] . '.location.href=\''
|
||||||
|
. $data['action'] . '\'" /></div>' . "\n";
|
||||||
break;
|
break;
|
||||||
case 'step':
|
case 'step':
|
||||||
$html .= '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'">'.$this->step.'</div>'."\n";
|
$html .= '<div id="plbl' . $name . $this->code . '" style="'
|
||||||
|
. $style_lbl . '">' . $this->step . '</div>' . "\n";
|
||||||
break;
|
break;
|
||||||
case 'percent':
|
case 'percent':
|
||||||
// only one inner percent
|
// only one inner percent
|
||||||
// print "STYLE[$name]: ".$style_lbl."<br>";
|
// print "STYLE[$name]: ".$style_lbl."<br>";
|
||||||
if (empty($html_percent)) {
|
if (empty($html_percent)) {
|
||||||
$html_percent = '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'width:'.$data['width'].'px;line-height:1;text-shadow: 0 0 .2em white, 0 0 .5em white;">'.$this->__calculatePercent($this->step).'%</div>'."\n";
|
$html_percent = '<div id="plbl' . $name . $this->code
|
||||||
|
. '" style="' . $style_lbl . 'width:' . $data['width']
|
||||||
|
. 'px;line-height:1;text-shadow: 0 0 .2em white, 0 0 .5em white;">'
|
||||||
|
. $this->__calculatePercent($this->step) . '%</div>' . "\n";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'percentlbl':
|
case 'percentlbl':
|
||||||
$html .= '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'width:'.$data['width'].'px;">'.$this->__calculatePercent($this->step).'%</div>'."\n";
|
$html .= '<div id="plbl' . $name . $this->code . '" style="'
|
||||||
|
. $style_lbl . 'width:' . $data['width'] . 'px;">'
|
||||||
|
. $this->__calculatePercent($this->step) . '%</div>' . "\n";
|
||||||
break;
|
break;
|
||||||
case 'crossbar':
|
case 'crossbar':
|
||||||
$html .= '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'">'.$data['value'].'</div>'."\n";
|
$html .= '<div id="plbl' . $name . $this->code . '" style="'
|
||||||
|
. $style_lbl . '">' . $data['value'] . '</div>' . "\n";
|
||||||
|
|
||||||
$js .= 'function PBrotaryCross'.$name.$this->code.'() {'."\n";
|
$js .= 'function PBrotaryCross' . $name . $this->code . '() {'
|
||||||
$js .= ' cross = document.getElementById("plbl'.$name.$this->code.'").firstChild.nodeValue;'."\n";
|
. "\n"
|
||||||
$js .= ' switch(cross) {'."\n";
|
. ' cross = document.getElementById("plbl' . $name
|
||||||
$js .= ' case "--": cross = "\\\\"; break;'."\n";
|
. $this->code . '").firstChild.nodeValue;' . "\n"
|
||||||
$js .= ' case "\\\\": cross = "|"; break;'."\n";
|
. ' switch(cross) {' . "\n"
|
||||||
$js .= ' case "|": cross = "/"; break;'."\n";
|
. ' case "--": cross = "\\\\"; break;' . "\n"
|
||||||
$js .= ' default: cross = "--"; break;'."\n";
|
. ' case "\\\\": cross = "|"; break;' . "\n"
|
||||||
$js .= ' }'."\n";
|
. ' case "|": cross = "/"; break;' . "\n"
|
||||||
$js .= ' document.getElementById("plbl'.$name.$this->code.'").firstChild.nodeValue = cross;'."\n";
|
. ' default: cross = "--"; break;' . "\n"
|
||||||
$js .= '}'."\n";
|
. ' }' . "\n"
|
||||||
|
. ' document.getElementById("plbl' . $name
|
||||||
|
. $this->code . '").firstChild.nodeValue = cross;' . "\n"
|
||||||
|
. '}' . "\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -716,13 +779,19 @@ class ProgressBar
|
|||||||
|
|
||||||
$js = '';
|
$js = '';
|
||||||
$new_position = $this->__calculatePosition($this->step);
|
$new_position = $this->__calculatePosition($this->step);
|
||||||
if ($new_position['width'] != $this->position['width'] && ($this->direction == 'right' || $this->direction == 'left')) {
|
if (
|
||||||
|
$new_position['width'] != $this->position['width'] &&
|
||||||
|
($this->direction == 'right' || $this->direction == 'left')
|
||||||
|
) {
|
||||||
if ($this->direction == 'left') {
|
if ($this->direction == 'left') {
|
||||||
$js .= 'PBposition' . $this->code . '("left",' . $new_position['left'] . ');';
|
$js .= 'PBposition' . $this->code . '("left",' . $new_position['left'] . ');';
|
||||||
}
|
}
|
||||||
$js .= 'PBposition' . $this->code . '("width",' . $new_position['width'] . ');';
|
$js .= 'PBposition' . $this->code . '("width",' . $new_position['width'] . ');';
|
||||||
}
|
}
|
||||||
if ($new_position['height'] != $this->position['height'] && ($this->direction == 'up' || $this->direction == 'down')) {
|
if (
|
||||||
|
$new_position['height'] != $this->position['height'] &&
|
||||||
|
($this->direction == 'up' || $this->direction == 'down')
|
||||||
|
) {
|
||||||
if ($this->direction == 'up') {
|
if ($this->direction == 'up') {
|
||||||
$js .= 'PBposition' . $this->code . '("top",' . $new_position['top'] . ');';
|
$js .= 'PBposition' . $this->code . '("top",' . $new_position['top'] . ');';
|
||||||
}
|
}
|
||||||
@@ -734,7 +803,8 @@ class ProgressBar
|
|||||||
switch ($data['type']) {
|
switch ($data['type']) {
|
||||||
case 'step':
|
case 'step':
|
||||||
if ($this->step != $last_step) {
|
if ($this->step != $last_step) {
|
||||||
$js .= 'PBlabelText'.$this->code.'("'.$name.'","'.$this->step.'/'.$this->max.'");';
|
$js .= 'PBlabelText' . $this->code . '("'
|
||||||
|
. $name . '","' . $this->step . '/' . $this->max . '");';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'percentlbl':
|
case 'percentlbl':
|
||||||
@@ -783,9 +853,11 @@ class ProgressBar
|
|||||||
if ($this->status == 'show') {
|
if ($this->status == 'show') {
|
||||||
$this->status = 'hide';
|
$this->status = 'hide';
|
||||||
|
|
||||||
$output = '<script type="text/JavaScript">';
|
$output = '<script type="text/JavaScript">'
|
||||||
$output .= 'document.getElementById("pbm'.$this->code.'").style.visibility="hidden";document.getElementById("pbm'.$this->code.'").style.display="none";';
|
. 'document.getElementById("pbm' . $this->code
|
||||||
$output .= '</script>'."\n";
|
. '").style.visibility="hidden";document.getElementById("pbm'
|
||||||
|
. $this->code . '").style.display="none";'
|
||||||
|
. '</script>' . "\n";
|
||||||
echo $output;
|
echo $output;
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
@@ -800,9 +872,11 @@ class ProgressBar
|
|||||||
if ($this->status == 'hide') {
|
if ($this->status == 'hide') {
|
||||||
$this->status = 'show';
|
$this->status = 'show';
|
||||||
|
|
||||||
$output = '<script type="text/JavaScript">';
|
$output = '<script type="text/JavaScript">'
|
||||||
$output .= 'document.getElementById("pbm'.$this->code.'").style.visibility="visible";document.getElementById("pbm'.$this->code.'").style.visibility="block";';
|
. 'document.getElementById("pbm' . $this->code
|
||||||
$output .= '</script>'."\n";
|
. '").style.visibility="visible";document.getElementById("pbm'
|
||||||
|
. $this->code . '").style.visibility="block";'
|
||||||
|
. '</script>' . "\n";
|
||||||
echo $output;
|
echo $output;
|
||||||
$this->__flushCache();
|
$this->__flushCache();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php // phpcs:ignore PSR1.Files.SideEffects
|
||||||
// because smarty is symlinked folder
|
|
||||||
/**
|
/**
|
||||||
* @phan-file-suppress PhanRedefinedExtendedClass
|
* @phan-file-suppress PhanRedefinedExtendedClass
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// because smarty is symlinked folder
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2004/12/21
|
* CREATED: 2004/12/21
|
||||||
@@ -159,42 +163,48 @@ class SmartyExtend extends SmartyBC
|
|||||||
{
|
{
|
||||||
// core CS
|
// core CS
|
||||||
$this->CSS_CORE_INCLUDE = '';
|
$this->CSS_CORE_INCLUDE = '';
|
||||||
if (file_exists($this->CSS.$this->CSS_CORE_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->CSS . $this->CSS_CORE_TEMPLATE_NAME) &&
|
||||||
is_file($this->CSS . $this->CSS_CORE_TEMPLATE_NAME)
|
is_file($this->CSS . $this->CSS_CORE_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->CSS_CORE_INCLUDE = $this->CSS . $this->CSS_CORE_TEMPLATE_NAME;
|
$this->CSS_CORE_INCLUDE = $this->CSS . $this->CSS_CORE_TEMPLATE_NAME;
|
||||||
}
|
}
|
||||||
// core JS
|
// core JS
|
||||||
$this->JS_CORE_INCLUDE = '';
|
$this->JS_CORE_INCLUDE = '';
|
||||||
if (file_exists($this->JAVASCRIPT.$this->JS_CORE_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->JAVASCRIPT . $this->JS_CORE_TEMPLATE_NAME) &&
|
||||||
is_file($this->JAVASCRIPT . $this->JS_CORE_TEMPLATE_NAME)
|
is_file($this->JAVASCRIPT . $this->JS_CORE_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->JS_CORE_INCLUDE = $this->JAVASCRIPT . $this->JS_CORE_TEMPLATE_NAME;
|
$this->JS_CORE_INCLUDE = $this->JAVASCRIPT . $this->JS_CORE_TEMPLATE_NAME;
|
||||||
}
|
}
|
||||||
// additional per page Javascript include
|
// additional per page Javascript include
|
||||||
$this->JS_INCLUDE = '';
|
$this->JS_INCLUDE = '';
|
||||||
if (file_exists($this->JAVASCRIPT.$this->JS_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->JAVASCRIPT . $this->JS_TEMPLATE_NAME) &&
|
||||||
is_file($this->JAVASCRIPT . $this->JS_TEMPLATE_NAME)
|
is_file($this->JAVASCRIPT . $this->JS_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->JS_INCLUDE = $this->JAVASCRIPT . $this->JS_TEMPLATE_NAME;
|
$this->JS_INCLUDE = $this->JAVASCRIPT . $this->JS_TEMPLATE_NAME;
|
||||||
}
|
}
|
||||||
// per page css file
|
// per page css file
|
||||||
$this->CSS_INCLUDE = '';
|
$this->CSS_INCLUDE = '';
|
||||||
if (file_exists($this->CSS.$this->CSS_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->CSS . $this->CSS_TEMPLATE_NAME) &&
|
||||||
is_file($this->CSS . $this->CSS_TEMPLATE_NAME)
|
is_file($this->CSS . $this->CSS_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->CSS_INCLUDE = $this->CSS . $this->CSS_TEMPLATE_NAME;
|
$this->CSS_INCLUDE = $this->CSS . $this->CSS_TEMPLATE_NAME;
|
||||||
}
|
}
|
||||||
// optional CSS file
|
// optional CSS file
|
||||||
$this->CSS_SPECIAL_INCLUDE = '';
|
$this->CSS_SPECIAL_INCLUDE = '';
|
||||||
if (file_exists($this->CSS.$this->CSS_SPECIAL_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->CSS . $this->CSS_SPECIAL_TEMPLATE_NAME) &&
|
||||||
is_file($this->CSS . $this->CSS_SPECIAL_TEMPLATE_NAME)
|
is_file($this->CSS . $this->CSS_SPECIAL_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->CSS_SPECIAL_INCLUDE = $this->CSS . $this->CSS_SPECIAL_TEMPLATE_NAME;
|
$this->CSS_SPECIAL_INCLUDE = $this->CSS . $this->CSS_SPECIAL_TEMPLATE_NAME;
|
||||||
}
|
}
|
||||||
// optional JS file
|
// optional JS file
|
||||||
$this->JS_SPECIAL_INCLUDE = '';
|
$this->JS_SPECIAL_INCLUDE = '';
|
||||||
if (file_exists($this->JAVASCRIPT.$this->JS_SPECIAL_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->JAVASCRIPT . $this->JS_SPECIAL_TEMPLATE_NAME) &&
|
||||||
is_file($this->JAVASCRIPT . $this->JS_SPECIAL_TEMPLATE_NAME)
|
is_file($this->JAVASCRIPT . $this->JS_SPECIAL_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
$this->JS_SPECIAL_INCLUDE = $this->JAVASCRIPT . $this->JS_SPECIAL_TEMPLATE_NAME;
|
$this->JS_SPECIAL_INCLUDE = $this->JAVASCRIPT . $this->JS_SPECIAL_TEMPLATE_NAME;
|
||||||
@@ -236,13 +246,15 @@ class SmartyExtend extends SmartyBC
|
|||||||
$this->CACHE_PICTURES = LAYOUT . CACHE;
|
$this->CACHE_PICTURES = LAYOUT . CACHE;
|
||||||
$this->CACHE_PICTURES_ROOT = ROOT . $this->CACHE_PICTURES;
|
$this->CACHE_PICTURES_ROOT = ROOT . $this->CACHE_PICTURES;
|
||||||
// check if we have an external file with the template name
|
// check if we have an external file with the template name
|
||||||
if (file_exists($this->INCLUDES.$this->INC_TEMPLATE_NAME) &&
|
if (
|
||||||
|
file_exists($this->INCLUDES . $this->INC_TEMPLATE_NAME) &&
|
||||||
is_file($this->INCLUDES . $this->INC_TEMPLATE_NAME)
|
is_file($this->INCLUDES . $this->INC_TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
include($this->INCLUDES . $this->INC_TEMPLATE_NAME);
|
include($this->INCLUDES . $this->INC_TEMPLATE_NAME);
|
||||||
}
|
}
|
||||||
// check for template include
|
// check for template include
|
||||||
if ($this->USE_INCLUDE_TEMPLATE === true &&
|
if (
|
||||||
|
$this->USE_INCLUDE_TEMPLATE === true &&
|
||||||
!$this->TEMPLATE_NAME
|
!$this->TEMPLATE_NAME
|
||||||
) {
|
) {
|
||||||
$this->TEMPLATE_NAME = $this->CONTENT_INCLUDE;
|
$this->TEMPLATE_NAME = $this->CONTENT_INCLUDE;
|
||||||
@@ -259,7 +271,8 @@ class SmartyExtend extends SmartyBC
|
|||||||
// abort if master template could not be found
|
// abort if master template could not be found
|
||||||
exit('MASTER TEMPLATE: ' . $this->MASTER_TEMPLATE_NAME . ' could not be found');
|
exit('MASTER TEMPLATE: ' . $this->MASTER_TEMPLATE_NAME . ' could not be found');
|
||||||
}
|
}
|
||||||
if ($this->TEMPLATE_NAME &&
|
if (
|
||||||
|
$this->TEMPLATE_NAME &&
|
||||||
!file_exists($this->getTemplateDir()[0] . DS . $this->TEMPLATE_NAME)
|
!file_exists($this->getTemplateDir()[0] . DS . $this->TEMPLATE_NAME)
|
||||||
) {
|
) {
|
||||||
exit('INCLUDE TEMPLATE: ' . $this->TEMPLATE_NAME . ' could not be found');
|
exit('INCLUDE TEMPLATE: ' . $this->TEMPLATE_NAME . ' could not be found');
|
||||||
@@ -385,7 +398,8 @@ class SmartyExtend extends SmartyBC
|
|||||||
// html title
|
// html title
|
||||||
// set local page title
|
// set local page title
|
||||||
$this->HEADER['HTML_TITLE'] = !$this->L_TITLE ?
|
$this->HEADER['HTML_TITLE'] = !$this->L_TITLE ?
|
||||||
ucfirst(str_replace('_', ' ', \CoreLibs\Get\System::getPageName(1))).(defined(G_TITLE) ? ' - '.$this->l10n->__(G_TITLE) : '') :
|
ucfirst(str_replace('_', ' ', \CoreLibs\Get\System::getPageName(1)))
|
||||||
|
. (defined(G_TITLE) ? ' - ' . $this->l10n->__(G_TITLE) : '') :
|
||||||
$this->l10n->__($this->L_TITLE);
|
$this->l10n->__($this->L_TITLE);
|
||||||
|
|
||||||
// LANG
|
// LANG
|
||||||
@@ -419,7 +433,8 @@ class SmartyExtend extends SmartyBC
|
|||||||
{
|
{
|
||||||
// array merge HEADER, DATA, DEBUG DATA
|
// array merge HEADER, DATA, DEBUG DATA
|
||||||
foreach (['HEADER', 'DATA', 'DEBUG_DATA'] as $ext_smarty) {
|
foreach (['HEADER', 'DATA', 'DEBUG_DATA'] as $ext_smarty) {
|
||||||
if (isset($cms->{$ext_smarty}) &&
|
if (
|
||||||
|
isset($cms->{$ext_smarty}) &&
|
||||||
is_array($cms->{$ext_smarty})
|
is_array($cms->{$ext_smarty})
|
||||||
) {
|
) {
|
||||||
$this->{$ext_smarty} = array_merge($this->{$ext_smarty}, $cms->{$ext_smarty});
|
$this->{$ext_smarty} = array_merge($this->{$ext_smarty}, $cms->{$ext_smarty});
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2011/2/8
|
* CREATED: 2011/2/8
|
||||||
@@ -7,6 +8,8 @@
|
|||||||
* error etc will still be written to the log/display
|
* error etc will still be written to the log/display
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
// define the base working directory outside because in the function it might return undefined
|
// define the base working directory outside because in the function it might return undefined
|
||||||
// if we have config set BASE use this
|
// if we have config set BASE use this
|
||||||
if (defined('BASE')) {
|
if (defined('BASE')) {
|
||||||
@@ -62,7 +65,8 @@ function MyErrorHandler(int $type, string $message, string $file, int $line, arr
|
|||||||
// <> the line number in this file
|
// <> the line number in this file
|
||||||
// [|] error name and error number
|
// [|] error name and error number
|
||||||
// : the php error message
|
// : the php error message
|
||||||
$output = '{'.array_pop($page_temp).'} ['.$file.'] <'.$line.'> ['.$error_level[$type].'|'.$type.']: '.$message;
|
$output = '{' . array_pop($page_temp) . '} [' . $file . '] '
|
||||||
|
. '<' . $line . '> [' . $error_level[$type] . '|' . $type . ']: ' . $message;
|
||||||
# try to open file
|
# try to open file
|
||||||
$ROOT = CURRENT_WORKING_DIR;
|
$ROOT = CURRENT_WORKING_DIR;
|
||||||
$LOG = 'log' . DIRECTORY_SEPARATOR;
|
$LOG = 'log' . DIRECTORY_SEPARATOR;
|
||||||
@@ -74,7 +78,8 @@ function MyErrorHandler(int $type, string $message, string $file, int $line, arr
|
|||||||
// again, if the folder now exists, else set error flag
|
// again, if the folder now exists, else set error flag
|
||||||
if (is_dir($ROOT . $LOG)) {
|
if (is_dir($ROOT . $LOG)) {
|
||||||
$fn = $ROOT . $LOG . 'php_errors-' . date('Y-m-d') . '.log';
|
$fn = $ROOT . $LOG . 'php_errors-' . date('Y-m-d') . '.log';
|
||||||
// when opening, surpress the warning so we can catch the no file pointer below without throwing a warning for this
|
// when opening, surpress the warning so we can catch
|
||||||
|
// the no file pointer below without throwing a warning for this
|
||||||
$fp = @fopen($fn, 'a');
|
$fp = @fopen($fn, 'a');
|
||||||
// write if we have a file pointer, else set error flag
|
// write if we have a file pointer, else set error flag
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
@@ -92,7 +97,8 @@ function MyErrorHandler(int $type, string $message, string $file, int $line, arr
|
|||||||
// if the display errors is on
|
// if the display errors is on
|
||||||
// pretty print output for HTML
|
// pretty print output for HTML
|
||||||
if (ini_get("display_errors")) {
|
if (ini_get("display_errors")) {
|
||||||
echo "<div style='border: 1px dotted red; background-color: #ffffe5; color: #000000; padding: 5px; margin-bottom: 2px;'>";
|
echo "<div style='border: 1px dotted red; background-color: #ffffe5; "
|
||||||
|
. "color: #000000; padding: 5px; margin-bottom: 2px;'>";
|
||||||
echo "<div style='color: orange; font-weight: bold;'>" . $error_level[$type] . ":</div>";
|
echo "<div style='color: orange; font-weight: bold;'>" . $error_level[$type] . ":</div>";
|
||||||
echo "<b>" . $message . "</b> on line <b>" . $line . "</b> in <b>" . $file . "</b>";
|
echo "<b>" . $message . "</b> on line <b>" . $line . "</b> in <b>" . $file . "</b>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Autoloader;
|
namespace Autoloader;
|
||||||
|
|
||||||
@@ -52,7 +54,8 @@ if (class_exists('Autoload', false) === false) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // end class define
|
// end class define
|
||||||
|
}
|
||||||
|
|
||||||
spl_autoload_register('Autoloader\Autoload::load', true, true);
|
spl_autoload_register('Autoloader\Autoload::load', true, true);
|
||||||
} // end check for already defined
|
} // end check for already defined
|
||||||
|
|||||||
Reference in New Issue
Block a user