Compare commits

...

44 Commits

Author SHA1 Message Date
Clemens Schwaighofer
06c2ea5e0d Admin\Backend: make sure we do not access unset ->action vars 2024-10-16 12:34:48 +09:00
Clemens Schwaighofer
2e9239ec23 Ingore node_modules/ folder 2024-10-16 12:18:51 +09:00
Clemens Schwaighofer
0c89840dba Admin\Backend move _POST action read to sub function and trigger not auto loading it
On default it still auto loads the _POST vars for backwards compatible, but add a load class
flag to ignore it "init_action_vars"

also add a get vor tha "acl" array adbGetAcl()
2024-10-16 12:15:19 +09:00
Clemens Schwaighofer
db144493f3 Message system: allow warning level to be logged
Like error messages, they are written to the log if debug is on or the
flag is explicit set
2024-09-24 15:10:53 +09:00
Clemens Schwaighofer
5cec54d508 Add "Success" to message logging levels, fixes for PHP 8.4, other preg_match fixes
The Logger/MessageLevel gets "success" as level 110 to something a bit
heigher than "ok" which is the general "OK" for anything ending without
an error. The "success" is currently only used in file uploads with the
java script ajax file uploader

Fix any "type $var = null" with correctly "?type $var = null" for PHP 8.4 (phphan)

Fix preg match no return catches for DB IO compare version and for language
look up.
2024-09-20 13:33:19 +09:00
Clemens Schwaighofer
8e60c992f1 Fixes phan/phpstan 2024-09-03 12:06:01 +09:00
Clemens Schwaighofer
1b5437b675 Add testing for new added bom utf8 replace 2024-09-03 11:58:36 +09:00
Clemens Schwaighofer
ef80cba561 Add new functions: get IPs, strip UTF8 BOM from text, text updates
Add the following new static methods

Convert\Strings::stripUTF8BomBytes: removes the UTF8 BOM bytes from the beginning of a line
Used for CSV files created in Excel for the first header entry (line 0/row 0)

Get\Systen::getIpAddresses: gets all IP addresses for the the current access user
and returns an array

Moved the frontend folder detection from the first load config to the config.path.php

Cleaned up the translations JS scripts
2024-09-03 09:49:01 +09:00
Clemens Schwaighofer
2d71e760e8 Composer update 2024-08-21 11:45:17 +09:00
Clemens Schwaighofer
a8d07634ff Add soba.egplusww.jp as local development host, jshint esversion update to 11 2024-08-07 13:41:09 +09:00
Clemens Schwaighofer
aa2b60973e HTML::htmlent and HTML::checked updates
Changed Params form ENT_COMPAT | ENT_HTML401 to ENT_QUOTES | ENT_HTML5
Flags can be overwritten on call

Logic clean up for return flow

HTML::checked gets logic updated with less nested ifs
2024-08-05 13:24:37 +09:00
Clemens Schwaighofer
554dd5f73c Fix not closed <head> block in all admin test files 2024-08-05 12:53:48 +09:00
Clemens Schwaighofer
e6f9559fbb DB IO: placeholder fix for JSON/JSONB lists 2024-07-29 16:30:48 +09:00
Clemens Schwaighofer
770d6f30a4 DB\IO Placeholder regex fix for json queries, test data updates
Some doc typo fixes
test updates with remove of not used sub calls

DB IO Placeholder regex now checks for any JSON/JSONB operators
2024-07-29 15:55:38 +09:00
Clemens Schwaighofer
f94f6cbe87 Add .shellcheckrc, move phpstan tmp folder to repository temp folder 2024-07-19 18:40:24 +09:00
Clemens Schwaighofer
9b69390fa2 Merge branch 'development' into NewFeatures 2024-05-22 10:47:12 +09:00
Clemens Schwaighofer
0524d8ac1b Update Symmetric Encryption
Can be used as a class with central key set.

for old static calls:
encrypt -> encryptKey
decrypt -> decryptKey
2024-05-22 10:43:54 +09:00
Clemens Schwaighofer
e933022671 Phive update 2024-05-22 10:27:20 +09:00
Clemens Schwaighofer
c549d34e65 phive tools update 2024-05-15 17:06:09 +09:00
Clemens Schwaighofer
f4ff31721b phpunit test add php 8.3, remove special code for mb_encode_mimeheader
In the past we had a special function to do mb_encode_mimeheader correctly.

Since PHP 8.2 this works perfectly fine, so all the code was removed and
replaced with just the normal "mb_encode_mimeheader" call with the same
settings as before:
- set global encoding to parameter
- run encoding with charset, 'B' for transfer and use the line break given in parameter
- reset the global encoding to previous set
2024-04-17 10:08:12 +09:00
Clemens Schwaighofer
21ac91d2e6 Composer update for Smarty v4.5.2 2024-04-16 18:27:55 +09:00
Clemens Schwaighofer
2d98d26d0b phive update 2024-04-16 16:32:48 +09:00
Clemens Schwaighofer
3fda1bef60 Move Symmetric Encryption Key generation into its own method
Test update for future class based encryption system without static
methods
2024-03-27 11:58:53 +09:00
Clemens Schwaighofer
4f1104c36e phive tools update 2024-03-21 12:38:43 +09:00
Clemens Schwaighofer
db1007ef12 Smarty Update v4.6.1, Bug fixes in DB\Extended\ArrayIO and Form\Generate 2024-03-19 10:43:12 +09:00
Clemens Schwaighofer
13c76efcef Fix new layout path location
Was "www/layout/admin|frontend/..." now is
www/frontend/layout and www/admin/layout
2024-03-07 14:53:00 +09:00
Clemens Schwaighofer
f59c325b05 Bug fix in string path slash fix
if null error return original path
2024-03-07 14:37:05 +09:00
Clemens Schwaighofer
aac5157173 phive update 2024-03-07 14:33:30 +09:00
Clemens Schwaighofer
abc2705c64 Bug fix in Form Generate load list generation
For binary 1/0 blocks make sure we use the actual data and not just the
wrong binary 0/1 source
Also add auto translations for all strings in there
2024-03-07 14:31:30 +09:00
Clemens Schwaighofer
e2fff45b16 Composer update Smarty v4.4.1 2024-03-06 18:44:41 +09:00
Clemens Schwaighofer
b6ae3f99d9 Layout folder move to admin and frontend 2024-02-27 12:02:03 +09:00
Clemens Schwaighofer
a377ab4b61 Strip multiple slashes in CoreLibs Convert Strings 2024-02-14 12:26:17 +09:00
Clemens Schwaighofer
ec9275d8d3 Add mime type get to the Check\File class 2024-01-11 16:15:08 +09:00
Clemens Schwaighofer
10ed5b3ea0 phive packages updates 2024-01-10 17:04:20 +09:00
Clemens Schwaighofer
5f290419c6 Minor php cs fixes 2024-01-10 17:03:18 +09:00
Clemens Schwaighofer
0152af6e65 add php code sniffer xml 2023-12-05 17:37:55 +09:00
Clemens Schwaighofer
4adb9fba30 DB IO Bug Fix for parameter detect after <>, DateTime code fix
Query Parameters where not detected after a <> unequal check

DateTime fix for last element, use array_pop instead of $array[count - 1]
2023-11-29 10:44:21 +09:00
Clemens Schwaighofer
672931ee67 phive packages update 2023-11-29 10:36:49 +09:00
Clemens Schwaighofer
373a9aff2f Add local eslintrc and jsconfig 2023-11-28 11:34:29 +09:00
Clemens Schwaighofer
4e3ceecac8 Phive update 2023-11-02 14:05:49 +09:00
Clemens Schwaighofer
8bf694b2b2 ArrayHandler: find next or previous key in array and return it
get next or previous key in array
2023-11-02 14:01:47 +09:00
Clemens Schwaighofer
caf03421a7 Bug fix for DB\IO param prepare call with wrong param array check
The global param array in the class instead of the param array passed
to the method was checked
2023-10-31 10:18:44 +09:00
Clemens Schwaighofer
facf8adaf7 DB\IO move dbReturn params set before first abort 2023-10-31 10:05:43 +09:00
Clemens Schwaighofer
c8158c8224 Remove echo from phpunit test file 2023-10-23 17:11:06 +09:00
980 changed files with 1646 additions and 548 deletions

43
.eslintrc.js Normal file
View File

@@ -0,0 +1,43 @@
module.exports = {
'env': {
'browser': true,
'es6': true,
'commonjs': true,
'jquery': true
},
'extends': 'eslint:recommended',
'parserOptions': {
'ecmaVersion': 6
},
'rules': {
'indent': [
'error',
'tab',
{
'SwitchCase': 1
}
],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
],
'no-console': 'off',
'no-unused-vars': [
'error', {
'vars': 'all',
'args': 'after-used',
'ignoreRestSiblings': false
}
],
// Requires eslint >= v8.14.0
'no-constant-binary-expression': 'error'
}
};

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.libs .libs
node_modules/

View File

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive"> <phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^9.6" installed="9.6.13" location="./tools/phpunit" copy="false"/> <phar name="phpunit" version="^9.6" installed="9.6.21" location="./tools/phpunit" copy="false"/>
<phar name="phpcbf" version="^3.7.2" installed="3.7.2" location="./tools/phpcbf" copy="false"/> <phar name="phpcbf" version="^3.7.2" installed="3.10.3" location="./tools/phpcbf" copy="false"/>
<phar name="phpcs" version="^3.7.2" installed="3.7.2" location="./tools/phpcs" copy="false"/> <phar name="phpcs" version="^3.7.2" installed="3.10.3" location="./tools/phpcs" copy="false"/>
<phar name="phpstan" version="^1.10.37" installed="1.10.37" location="./tools/phpstan" copy="false"/> <phar name="phpstan" version="^1.10.37" installed="1.12.4" location="./tools/phpstan" copy="false"/>
<phar name="phan" version="^5.4.2" installed="5.4.2" location="./tools/phan" copy="false"/> <phar name="phan" version="^5.4.2" installed="5.4.3" location="./tools/phan" copy="false"/>
<phar name="psalm" version="^5.15.0" installed="5.15.0" location="./tools/psalm" copy="false"/> <phar name="psalm" version="^5.15.0" installed="5.24.0" location="./tools/psalm" copy="false"/>
<phar name="phpdox" version="^0.12.0" installed="0.12.0" location="./tools/phpdox" copy="false"/> <phar name="phpdox" version="^0.12.0" installed="0.12.0" location="./tools/phpdox" copy="false"/>
<phar name="phpdocumentor" version="^3.4.2" installed="3.4.2" location="./tools/phpDocumentor" copy="false"/> <phar name="phpdocumentor" version="^3.4.2" installed="3.4.3" location="./tools/phpDocumentor" copy="false"/>
<phar name="php-cs-fixer" version="^3.34.1" installed="3.34.1" location="./tools/php-cs-fixer" copy="false"/> <phar name="php-cs-fixer" version="^3.34.1" installed="3.57.2" location="./tools/php-cs-fixer" copy="false"/>
</phive> </phive>

2
.shellcheckrc Normal file
View File

@@ -0,0 +1,2 @@
shell=bash
external-sources=true

View File

@@ -1,19 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
BASE_FOLDER=$(dirname $(readlink -f $0))"/"; BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
# Assume script is in 4dev/bin # Assume script is in 4dev/bin
base_folder="${BASE_FOLDER}../../www/"; base_folder="${BASE_FOLDER}../../www/";
# locale gettext po to mo translator master # locale gettext po to mo translator master
for file in $(ls -1 ${base_folder}../4dev/locale/*.po); do for file in "${base_folder}"../4dev/locale/*.po; do
file=$(basename $file .po); [[ -e "$file" ]] || break
file=$(basename "$file" .po);
locale=$(echo "${file}" | cut -d "-" -f 1); locale=$(echo "${file}" | cut -d "-" -f 1);
domain=$(echo "${file}" | cut -d "-" -f 2); domain=$(echo "${file}" | cut -d "-" -f 2);
echo "- Translate language file '${file}' for locale '${locale}' and domain '${domain}':"; echo "- Translate language file '${file}' for locale '${locale}' and domain '${domain}':";
if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then
mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/"; mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/";
fi; fi;
msgfmt -o ${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo ${base_folder}../4dev/locale/${locale}-${domain}.po; msgfmt -o "${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo" "${base_folder}../4dev/locale/${locale}-${domain}.po";
done; done;
# __END__ # __END__

View File

@@ -2,16 +2,18 @@
# read source mo files and writes target js files in object form # read source mo files and writes target js files in object form
# check for ARG 1 is "mv" # check for ARG 1 is "no-move"
# then move the files directly and don't do manual check (don't create temp files) # then do not move the files directly for manual check
FILE_MOVE=0; FILE_MOVE=1;
if [ "${1}" = "mv" ]; then if [ "${1}" = "no-move" ]; then
echo "+++ CREATE TEMPORARY FILES +++";
FILE_MOVE=0;
else
echo "*** Direct write ***"; echo "*** Direct write ***";
FILE_MOVE=1;
fi; fi;
target=''; target='';
BASE_FOLDER=$(dirname $(readlink -f $0))"/"; BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
# Assume script is in 4dev/bin # Assume script is in 4dev/bin
base_folder="${BASE_FOLDER}../../www/"; base_folder="${BASE_FOLDER}../../www/";
po_folder='../4dev/locale/' po_folder='../4dev/locale/'
@@ -26,9 +28,9 @@ if [ "${target}" == '' ]; then
echo "*** Non smarty ***"; echo "*** Non smarty ***";
TEXTDOMAINDIR=${base_folder}${mo_folder}. TEXTDOMAINDIR=${base_folder}${mo_folder}.
# default is admin # default is admin
TEXTDOMAIN=admin; TEXTDOMAIN="admin";
fi; fi;
js_folder="layout/${TEXTDOMAIN}/javascript/"; js_folder="${TEXTDOMAIN}/layout/javascript/";
error=0; error=0;
# this checks if the TEXTDOMAIN target actually exists # this checks if the TEXTDOMAIN target actually exists
@@ -44,15 +46,16 @@ if [ ${error} -eq 1 ]; then
fi; fi;
# locale gettext po to mo translator master # locale gettext po to mo translator master
for file in $(ls -1 ${base_folder}../4dev/locale/*.po); do for file in "${base_folder}"../4dev/locale/*.po; do
file=$(basename $file .po); [[ -e "$file" ]] || break
echo "Translate language ${file}"; file=$(basename "$file" .po);
locale=$(echo "${file}" | cut -d "-" -f 1); locale=$(echo "${file}" | cut -d "-" -f 1);
domain=$(echo "${file}" | cut -d "-" -f 2); domain=$(echo "${file}" | cut -d "-" -f 2);
echo "- Translate language file '${file}' for locale '${locale}' and domain '${domain}':";
if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then if [ ! -d "${base_folder}/includes/locale/${locale}/LC_MESSAGES/" ]; then
mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/"; mkdir -p "${base_folder}/includes/locale/${locale}/LC_MESSAGES/";
fi; fi;
msgfmt -o ${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo ${base_folder}${po_folder}${locale}-${domain}.po; msgfmt -o "${base_folder}/includes/locale/${locale}/LC_MESSAGES/${domain}.mo" "${base_folder}${po_folder}${locale}-${domain}.po";
done; done;
rx_msgid_empty="^msgid \"\""; rx_msgid_empty="^msgid \"\"";
@@ -62,7 +65,7 @@ rx_msgstr="^msgstr \""
# quick copy string at the end # quick copy string at the end
quick_copy=''; quick_copy='';
for language in ${language_list[*]}; do for language in "${language_list[@]}"; do
# I don't know which one must be set, but I think at least LANGUAGE # I don't know which one must be set, but I think at least LANGUAGE
case ${language} in case ${language} in
ja) ja)
@@ -79,7 +82,8 @@ for language in ${language_list[*]}; do
esac; esac;
# write only one for language and then symlink files # write only one for language and then symlink files
template_file=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##//" | sed -e "s/##LANGUAGE##/${LANG}/"); template_file=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##//" | sed -e "s/##LANGUAGE##/${LANG}/");
original_file=$(echo ${template_file} | sed -e 's/\.TMP//g'); # original_file=$(echo ${template_file} | sed -e 's/\.TMP//g');
original_file=${template_file//.TMP/};
if [ "${FILE_MOVE}" -eq 0 ]; then if [ "${FILE_MOVE}" -eq 0 ]; then
file=${target_folder}${template_file}; file=${target_folder}${template_file};
else else
@@ -88,16 +92,18 @@ for language in ${language_list[*]}; do
echo "===> Write translation file ${file}"; echo "===> Write translation file ${file}";
echo ". = normal, : = escape, x = skip"; echo ". = normal, : = escape, x = skip";
# init line [aka don't touch this file] # init line [aka don't touch this file]
echo "// AUTO FILL, changes will be overwritten" > $file; echo "// AUTO FILL, changes will be overwritten" > "$file";
echo "// source: ${suffix}, language: ${language}" >> $file; {
echo "// Translation strings in the format" >> $file; echo "// source: ${suffix}, language: ${language}";
echo "// \"Original\":\"Translated\""$'\n' >> $file; echo "// Translation strings in the format";
echo "var i18n = {" >> $file; echo "// \"Original\":\"Translated\""$'\n'
echo "var i18n = {"
} >> "$file"
# translations stuff # translations stuff
# read the po file # read the po file
pos=0; # do we add a , for the next line pos=0; # do we add a , for the next line
cat "${base_folder}${po_folder}${language}-${TEXTDOMAIN}.po" | cat "${base_folder}${po_folder}${language}-${TEXTDOMAIN}.po" |
while read str; do while read -r str; do
# echo "S: ${str}"; # echo "S: ${str}";
# skip empty # skip empty
if [[ "${str}" =~ ${rx_msgid_empty} ]]; then if [[ "${str}" =~ ${rx_msgid_empty} ]]; then
@@ -112,12 +118,13 @@ for language in ${language_list[*]}; do
str_source=$(echo "${str}" | sed -e "s/^msgid \"//" | sed -e "s/\"$//"); str_source=$(echo "${str}" | sed -e "s/^msgid \"//" | sed -e "s/\"$//");
# close right side, if not last add , # close right side, if not last add ,
if [ "${pos}" -eq 1 ]; then if [ "${pos}" -eq 1 ]; then
echo -n "," >> $file; echo -n "," >> "$file";
fi; fi;
# all " inside string need to be escaped # all " inside string need to be escaped
str_source=$(echo "${str_source}" | sed -e 's/"/\\"/g'); # str_source=$(echo "${str_source}" | sed -e 's/"/\\"/g');
str_source=${str_source//\"/\\\"}
# fix with proper layout # fix with proper layout
echo -n "\"$str_source\":\"$(TEXTDOMAINDIR=${TEXTDOMAINDIR} LANGUAGE=${language} LANG=${LANG} gettext ${TEXTDOMAIN} "${str_source}")\"" >> $file; echo -n "\"$str_source\":\"$(TEXTDOMAINDIR=${TEXTDOMAINDIR} LANGUAGE=${language} LANG=${LANG} gettext "${TEXTDOMAIN}" "${str_source}")\"" >> "$file";
pos=1; pos=1;
elif [[ "${str}" =~ ${rx_msgstr} ]]; then elif [[ "${str}" =~ ${rx_msgstr} ]]; then
# open right side (ignore) # open right side (ignore)
@@ -128,8 +135,8 @@ for language in ${language_list[*]}; do
fi; fi;
done; done;
echo "" >> $file; echo "" >> "$file";
echo "};" >> $file; echo "};" >> "$file";
echo " [DONE]"; echo " [DONE]";
# on no move # on no move
@@ -140,19 +147,19 @@ for language in ${language_list[*]}; do
fi; fi;
# symlink to master file # symlink to master file
for suffix in ${source_list[*]}; do for suffix in "${source_list[@]}"; do
# symlink with full lang name # symlink with full lang name
symlink_file[0]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANG}/" | sed -e 's/\.TMP//g'); symlink_file[0]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANG}/" | sed -e 's/\.TMP//g');
# create second one with lang (no country) + encoding # create second one with lang (no country) + encoding
symlink_file[1]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANGUAGE}\.${ENCODING}/" | sed -e 's/\.TMP//g'); symlink_file[1]=$(echo ${template_file_stump} | sed -e "s/##SUFFIX##/${suffix}_/" | sed -e "s/##LANGUAGE##/${LANGUAGE}\.${ENCODING}/" | sed -e 's/\.TMP//g');
for template_file in ${symlink_file[@]}; do for template_file in "${symlink_file[@]}"; do
# if this is not symlink, create them # if this is not symlink, create them
if [ ! -h "${template_file}" ]; then if [ ! -h "${template_file}" ]; then
echo "Create symlink: ${template_file}"; echo "Create symlink: ${template_file}";
# symlik to original # symlik to original
cd "${target_folder}"; cd "${target_folder}" || exit;
ln -sf "${original_file}" "${template_file}"; ln -sf "${original_file}" "${template_file}";
cd - >/dev/null; cd - >/dev/null || exit;
fi; fi;
done; done;
done; done;

View File

@@ -12,23 +12,25 @@ if [ "${1}" = "t" ] || [ "${2}" = "t" ]; then
opt_testdox="--testdox"; opt_testdox="--testdox";
fi; fi;
php_bin=""; php_bin="";
if [ ! -z "${1}" ]; then if [ -n "${1}" ]; then
case "${1}" in case "${1}" in
# "7.3") php_bin="/usr/bin/php7.3 "; ;; # "7.3") php_bin="/usr/bin/php7.3 "; ;;
# "7.4") php_bin="/usr/bin/php7.4 "; ;; # "7.4") php_bin="/usr/bin/php7.4 "; ;;
# "8.0") php_bin="/usr/bin/php8.0 "; ;; # "8.0") php_bin="/usr/bin/php8.0 "; ;;
# "8.1") php_bin="/usr/bin/php8.1 "; ;; # "8.1") php_bin="/usr/bin/php8.1 "; ;;
"8.2") php_bin="/usr/bin/php8.2 "; ;; "8.2") php_bin="/usr/bin/php8.2 "; ;;
"8.3") php_bin="/usr/bin/php8.4 "; ;;
*) echo "Not support PHP: ${1}"; exit; ;; *) echo "Not support PHP: ${1}"; exit; ;;
esac; esac;
fi; fi;
if [ ! -z "${2}" ] && [ -z "${php_bin}" ]; then if [ -n "${2}" ] && [ -z "${php_bin}" ]; then
case "${2}" in case "${2}" in
# "7.3") php_bin="/usr/bin/php7.3 "; ;; # "7.3") php_bin="/usr/bin/php7.3 "; ;;
# "7.4") php_bin="/usr/bin/php7.4 "; ;; # "7.4") php_bin="/usr/bin/php7.4 "; ;;
# "8.0") php_bin="/usr/bin/php8.0 "; ;; # "8.0") php_bin="/usr/bin/php8.0 "; ;;
# "8.1") php_bin="/usr/bin/php8.1 "; ;; # "8.1") php_bin="/usr/bin/php8.1 "; ;;
"8.2") php_bin="/usr/bin/php8.2 "; ;; "8.2") php_bin="/usr/bin/php8.2 "; ;;
"8.3") php_bin="/usr/bin/php8.3 "; ;;
*) echo "Not support PHP: ${1}"; exit; ;; *) echo "Not support PHP: ${1}"; exit; ;;
esac; esac;
fi; fi;

View File

@@ -28,10 +28,10 @@ final class CoreLibsCheckFileTest extends TestCase
public function filesList(): array public function filesList(): array
{ {
return [ return [
['filename.txt', 'txt', 5], ['filename.txt', 'txt', 5, 'text/plain'],
['filename.csv', 'csv', 15], ['filename.csv', 'csv', 15, 'text/csv'],
['filename.tsv', 'tsv', 0], ['filename.tsv', 'tsv', 0, 'text/plain'],
['file_does_not_exits', '', -1], ['file_does_not_exits', '', -1, ''],
]; ];
} }
@@ -63,6 +63,15 @@ final class CoreLibsCheckFileTest extends TestCase
return $list; return $list;
} }
public function mimeTypeProvider(): array
{
$list = [];
foreach ($this->filesList() as $row) {
$list[$row[0] . ' must be mime type ' . $row[3]] = [$row[0], $row[3]];
}
return $list;
}
/** /**
* Tests if file extension matches * Tests if file extension matches
* *
@@ -115,6 +124,51 @@ final class CoreLibsCheckFileTest extends TestCase
unlink($this->base_folder . $input); unlink($this->base_folder . $input);
} }
} }
/**
* Undocumented function
*
* @covers ::getMimeType
* @dataProvider mimeTypeProvider
* @testdox getMimeType $input must be mime type $expected [$_dataName]
*
* @param string $input
* @param string $expected
* @return void
*/
public function testGetMimeType(string $input, string $expected): void
{
if (!empty($expected)) {
$file = $this->base_folder . $input;
$fp = fopen($file, 'w');
switch ($expected) {
case 'text/csv':
for ($i = 1; $i <= 10; $i++) {
fwrite($fp, '"This is row","' . $expected . '",' . $i . PHP_EOL);
}
break;
case 'text/tsv':
for ($i = 1; $i <= 10; $i++) {
fwrite($fp, "\"This is row\"\t\"" . $expected . "\"\t\"" . $i . PHP_EOL);
}
break;
case 'text/plain':
fwrite($fp, 'This is mime type: ' . $expected . PHP_EOL);
break;
}
fclose($fp);
} else {
$this->expectException(\UnexpectedValueException::class);
}
$this->assertEquals(
$expected,
\CoreLibs\Check\File::getMimeType($this->base_folder . $input)
);
// unlink file
if (is_file($this->base_folder . $input)) {
unlink($this->base_folder . $input);
}
}
} }
// __END__ // __END__

View File

@@ -1098,16 +1098,109 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
* @testdox arrayFlatForKey array $input will be $expected [$_dataName] * @testdox arrayFlatForKey array $input will be $expected [$_dataName]
* *
* @param array $input * @param array $input
* @param string $search
* @param array $expected * @param array $expected
* @return void * @return void
*/ */
public function testArrayFlatForKey(array $input, $search, array $expected): void public function testArrayFlatForKey(array $input, string $search, array $expected): void
{ {
$this->assertEquals( $this->assertEquals(
$expected, $expected,
\CoreLibs\Combined\ArrayHandler::arrayFlatForKey($input, $search) \CoreLibs\Combined\ArrayHandler::arrayFlatForKey($input, $search)
); );
} }
/**
* Undocumented function
*
* @return array
*/
public function providerArrayGetNextPrevKey(): array
{
return [
'find, ok' => [
'input' => [
'a' => 'First',
'b' => 'Second',
'c' => 'Third',
],
'b',
'a',
'c'
],
'find, first' => [
'input' => [
'a' => 'First',
'b' => 'Second',
'c' => 'Third',
],
'a',
null,
'b'
],
'find, last' => [
'input' => [
'a' => 'First',
'b' => 'Second',
'c' => 'Third',
],
'c',
'b',
null
],
'find, not found' => [
'input' => [
'a' => 'First',
'b' => 'Second',
'c' => 'Third',
],
'z',
null,
null
],
'int, index' => [
'input' => [
'a',
'b',
'c'
],
1,
0,
2
]
];
}
/**
* Undocumented function
*
* @covers ::arrayGetPrevKey, ::arrayGetNextKey
* @dataProvider providerArrayGetNextPrevKey
* @testdox arrayGetNextPrevKey get next/prev key for $search wtih $expected_prev/$expected_next [$_dataName]
*
* @param array $input
* @param int|string $search
* @param int|string|null $expected_prev
* @param int|string|null $expected_next
* @return void
*/
public function testArrayGetNextPrevKey(
array $input,
int|string $search,
int|string|null $expected_prev,
int|string|null $expected_next
): void {
$this->assertEquals(
$expected_prev,
\CoreLibs\Combined\ArrayHandler::arrayGetPrevKey($input, $search),
'Find prev key in array'
);
$this->assertEquals(
$expected_next,
\CoreLibs\Combined\ArrayHandler::arrayGetNextKey($input, $search),
'Find next key in array'
);
}
} }
// __END__ // __END__

View File

@@ -467,7 +467,6 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds); \CoreLibs\Combined\DateTime::intervalStringFormat($seconds);
} else { } else {
if (in_array('show_only_days', $params)) { if (in_array('show_only_days', $params)) {
echo "FOO\n";
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, show_only_days:true); \CoreLibs\Combined\DateTime::intervalStringFormat($seconds, show_only_days:true);
} elseif (in_array('truncate_after', $params)) { } elseif (in_array('truncate_after', $params)) {
\CoreLibs\Combined\DateTime::intervalStringFormat($seconds, truncate_after: 'v'); \CoreLibs\Combined\DateTime::intervalStringFormat($seconds, truncate_after: 'v');

View File

@@ -33,15 +33,14 @@ final class CoreLibsConvertMimeEncodeTest extends TestCase
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine ' 'The quick brown fox jumps over the lazy sheep that sleeps in the ravine '
. 'and has no idea what is going on here', . 'and has no idea what is going on here',
'UTF-8', 'UTF-8',
'The quick brown fox jumps over the lazy sheep that sleeps in the ravine ' "The quick brown fox jumps over the lazy sheep that sleeps in the ravine and\r\n"
. 'and has no idea what is going on here' . ' has no idea what is going on here'
], ],
'standard with special chars UTF-8' => [ 'standard with special chars UTF-8' => [
'This is ümläßtと漢字もカタカナ!^$%&', 'This is ümläßtと漢字もカタカナ!^$%&',
'UTF-8', 'UTF-8',
'This is =?UTF-8?B?w7xtbMOkw59044Go5ryi5a2X44KC44Kr44K/44Kr44OK77yBIV4k?=' "This is =?UTF-8?B?w7xtbMOkw59044Go5ryi5a2X44KC44Kr44K/44Kr44OK77yBIV4k?=\r\n"
. "\r\n" . ' =?UTF-8?B?JSY=?='
. ' =?UTF-8?B?JQ==?=&'
], ],
'35 chars and space at the end UTF-8' => [ '35 chars and space at the end UTF-8' => [
'12345678901234567890123456789012345 ' '12345678901234567890123456789012345 '
@@ -62,9 +61,8 @@ final class CoreLibsConvertMimeEncodeTest extends TestCase
. 'is there a space?', . 'is there a space?',
'UTF-8', 'UTF-8',
"=?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr?=\r\n" "=?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr?=\r\n"
. " =?UTF-8?B?44K/44Kr44OK?=\r\n" . " =?UTF-8?B?44K/44Kr44OK44GL44Gq44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq?=\r\n"
. " =?UTF-8?B?44GL44Gq44Kr44K/44Kr44OK44Kr44K/44Kr44OK44GL44Gq44Kr44K/44Kr?=\r\n" . " =?UTF-8?B?44Kr44K/44Kr44OK44Kr44K/IGlzIHRoZXJlIGEgc3BhY2U/?="
. " =?UTF-8?B?44OK44Kr44K/?= is there a =?UTF-8?B?c3BhY2U/?="
] ]
]; ];
} }
@@ -85,16 +83,28 @@ final class CoreLibsConvertMimeEncodeTest extends TestCase
// print "MIME: -" . $encoded . "-\n"; // print "MIME: -" . $encoded . "-\n";
$this->assertEquals( $this->assertEquals(
$expected, $expected,
$encoded $encoded,
"__mbMimeEncode"
); );
$decoded = mb_decode_mimeheader($encoded); $decoded = mb_decode_mimeheader($encoded);
// print "INPUT : " . $input . "\n"; // print "ENCODED: " . $encoded . "\n";
// print "DECODED: " . $decoded . "\n"; // print "INPUT : " . $input . " | " . mb_strlen($input) . "\n";
// print "DECODED: " . $decoded . " | " . mb_strlen($decoded) . "\n";
// $test_enc = mb_encode_mimeheader($input, $encoding);
// $test_dec = mb_decode_mimeheader($test_enc);
// print "TEST ENC: " . $test_enc . "\n";
// back compare decoded // back compare decoded
$this->assertEquals( $this->assertEquals(
$input, $input,
$decoded $decoded,
"mb_decode_mimeheader"
); );
// $this->assertEquals(
// $input,
// $test_dec,
// 'mb_encode_to_decode'
// );
} }
} }

View File

@@ -13,6 +13,8 @@ use PHPUnit\Framework\TestCase;
*/ */
final class CoreLibsConvertStringsTest extends TestCase final class CoreLibsConvertStringsTest extends TestCase
{ {
private const DATA_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR;
/** /**
* Undocumented function * Undocumented function
* *
@@ -256,6 +258,126 @@ final class CoreLibsConvertStringsTest extends TestCase
$output $output
); );
} }
/**
* provider for testStripMultiplePathSlashes
*
* @return array<mixed>
*/
public function stripMultiplePathSlashesProvider(): array
{
return [
'no slahses' => [
'input' => 'string_abc',
'expected' => 'string_abc',
],
'one slash' => [
'input' => 'some/foo',
'expected' => 'some/foo',
],
'two slashes' => [
'input' => 'some//foo',
'expected' => 'some/foo',
],
'three slashes' => [
'input' => 'some///foo',
'expected' => 'some/foo',
],
'slashes in front' => [
'input' => '/foo',
'expected' => '/foo',
],
'two slashes in front' => [
'input' => '//foo',
'expected' => '/foo',
],
'thee slashes in front' => [
'input' => '///foo',
'expected' => '/foo',
],
'slashes in back' => [
'input' => 'foo/',
'expected' => 'foo/',
],
'two slashes in back' => [
'input' => 'foo//',
'expected' => 'foo/',
],
'thee slashes in back' => [
'input' => 'foo///',
'expected' => 'foo/',
],
'multiple slashes' => [
'input' => '/foo//bar///string/end_times',
'expected' => '/foo/bar/string/end_times',
]
];
}
/**
* test multiple slashes clean up
*
* @covers ::stripMultiplePathSlashes
* @dataProvider stripMultiplePathSlashesProvider
* @testdox stripMultiplePathSlashes $input will be $expected [$_dataName]
*
* @param string $input
* @param string $expected
* @return void
*/
public function testStripMultiplePathSlashes(string $input, string $expected): void
{
$this->assertEquals(
$expected,
\CoreLibs\Convert\Strings::stripMultiplePathSlashes($input)
);
}
/**
* Undocumented function
*
* @return array
*/
public function providerStripUTF8BomBytes(): array
{
return [
"utf8-bom" => [
"file" => "UTF8BOM.csv",
"expect" => "Asset Type,Epic,File Name\n",
],
"utf8" => [
"file" => "UTF8.csv",
"expect" => "Asset Type,Epic,File Name\n",
],
];
}
/**
* test utf8 bom remove
*
* @covers ::stripUTF8BomBytes
* @dataProvider providerStripUTF8BomBytes
* @testdox stripUTF8BomBytes $file will be $expected [$_dataName]
*
* @param string $file
* @param string $expected
* @return void
*/
public function testStripUTF8BomBytes(string $file, string $expected): void
{
// load sample file
if (!is_file(self::DATA_FOLDER . $file)) {
$this->markTestSkipped('File: ' . $file . ' could not be opened');
}
$file = file_get_contents(self::DATA_FOLDER . $file);
if ($file === false) {
$this->markTestSkipped('File: ' . $file . ' could not be read');
}
$this->assertEquals(
$expected,
\CoreLibs\Convert\Strings::stripUTF8BomBytes($file)
);
}
} }
// __END__ // __END__

View File

@@ -0,0 +1 @@
Asset Type,Epic,File Name
1 Asset Type Epic File Name

View File

@@ -0,0 +1 @@
Asset Type,Epic,File Name
1 Asset Type Epic File Name

View File

@@ -216,6 +216,29 @@ final class CoreLibsGetSystemTest extends TestCase
); );
} }
} }
/**
* Undocumented function
*
* @covers ::getIpAddresses
* @testdox getIpAddresses check
*
* @return void
*/
public function testGetIpAddresses()
{
// response must have "REMOTE_ADDR" entry, others are optional
// NOTE: we have no IP addresses on command line
$this->assertTrue(
true,
"We do not have REMOTE_ADDR on command line"
);
// $this->assertContains(
// 'REMOTE_ADDR',
// array_keys(\CoreLibs\Get\System::getIpAddresses()),
// 'failed REMOTE_ADDR assert'
// );
}
} }
// __END__ // __END__

View File

@@ -39,6 +39,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'OK', 'str' => 'OK',
'expected' => 'ok', 'expected' => 'ok',
], ],
'success' => [
'level' => 'success',
'str' => 'SUCCESS',
'expected' => 'success',
],
'info' => [ 'info' => [
'level' => 'info', 'level' => 'info',
'str' => 'INFO', 'str' => 'INFO',
@@ -225,6 +230,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ERROR MESSAGE', 'str' => 'ERROR MESSAGE',
'message' => null, 'message' => null,
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<ERROR> ERROR MESSAGE', 'expected' => '<ERROR> ERROR MESSAGE',
], ],
'error, logged' => [ 'error, logged' => [
@@ -233,6 +239,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ERROR MESSAGE', 'str' => 'ERROR MESSAGE',
'message' => null, 'message' => null,
'log_error' => true, 'log_error' => true,
'log_warning' => null,
'expected' => '<ERROR> ERROR MESSAGE', 'expected' => '<ERROR> ERROR MESSAGE',
], ],
'error, logged, message' => [ 'error, logged, message' => [
@@ -241,14 +248,43 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ERROR MESSAGE', 'str' => 'ERROR MESSAGE',
'message' => 'OTHER ERROR MESSAGE', 'message' => 'OTHER ERROR MESSAGE',
'log_error' => true, 'log_error' => true,
'log_warning' => null,
'expected' => '<ERROR> OTHER ERROR MESSAGE', 'expected' => '<ERROR> OTHER ERROR MESSAGE',
], ],
'warn, not logged' => [
'id' => '300',
'level' => 'warn',
'str' => 'WARNING MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => null,
'expected' => '<WARNING> WARNING MESSAGE',
],
'warn, logged' => [
'id' => '300',
'level' => 'warn',
'str' => 'WARNING MESSAGE',
'message' => null,
'log_error' => null,
'log_warning' => true,
'expected' => '<WARNING> WARNING MESSAGE',
],
'warn, logged, message' => [
'id' => '300',
'level' => 'warn',
'str' => 'WARNING MESSAGE',
'message' => 'OTHER WARNING MESSAGE',
'log_error' => null,
'log_warning' => true,
'expected' => '<WARNING> OTHER WARNING MESSAGE',
],
'notice' => [ 'notice' => [
'id' => '100', 'id' => '100',
'level' => 'notice', 'level' => 'notice',
'str' => 'NOTICE MESSAGE', 'str' => 'NOTICE MESSAGE',
'message' => null, 'message' => null,
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<NOTICE> NOTICE MESSAGE', 'expected' => '<NOTICE> NOTICE MESSAGE',
], ],
'notice, message' => [ 'notice, message' => [
@@ -257,6 +293,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'NOTICE MESSAGE', 'str' => 'NOTICE MESSAGE',
'message' => 'OTHER NOTICE MESSAGE', 'message' => 'OTHER NOTICE MESSAGE',
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<NOTICE> OTHER NOTICE MESSAGE', 'expected' => '<NOTICE> OTHER NOTICE MESSAGE',
], ],
'crash' => [ 'crash' => [
@@ -265,6 +302,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'CRASH MESSAGE', 'str' => 'CRASH MESSAGE',
'message' => null, 'message' => null,
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<ALERT> CRASH MESSAGE', 'expected' => '<ALERT> CRASH MESSAGE',
], ],
'crash, message' => [ 'crash, message' => [
@@ -273,6 +311,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'CRASH MESSAGE', 'str' => 'CRASH MESSAGE',
'message' => 'OTHER CRASH MESSAGE', 'message' => 'OTHER CRASH MESSAGE',
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<ALERT> OTHER CRASH MESSAGE', 'expected' => '<ALERT> OTHER CRASH MESSAGE',
], ],
'abort' => [ 'abort' => [
@@ -281,6 +320,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ABORT MESSAGE', 'str' => 'ABORT MESSAGE',
'message' => null, 'message' => null,
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<CRITICAL> ABORT MESSAGE', 'expected' => '<CRITICAL> ABORT MESSAGE',
], ],
'abort, message' => [ 'abort, message' => [
@@ -289,6 +329,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'ABORT MESSAGE', 'str' => 'ABORT MESSAGE',
'message' => 'OTHER ABORT MESSAGE', 'message' => 'OTHER ABORT MESSAGE',
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<CRITICAL> OTHER ABORT MESSAGE', 'expected' => '<CRITICAL> OTHER ABORT MESSAGE',
], ],
'unknown' => [ 'unknown' => [
@@ -297,6 +338,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'WRONG LEVEL MESSAGE', 'str' => 'WRONG LEVEL MESSAGE',
'message' => null, 'message' => null,
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<EMERGENCY> WRONG LEVEL MESSAGE', 'expected' => '<EMERGENCY> WRONG LEVEL MESSAGE',
], ],
'unknown, message' => [ 'unknown, message' => [
@@ -305,6 +347,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'WRONG LEVEL MESSAGE', 'str' => 'WRONG LEVEL MESSAGE',
'message' => 'OTHER WRONG LEVEL MESSAGE', 'message' => 'OTHER WRONG LEVEL MESSAGE',
'log_error' => null, 'log_error' => null,
'log_warning' => null,
'expected' => '<EMERGENCY> OTHER WRONG LEVEL MESSAGE', 'expected' => '<EMERGENCY> OTHER WRONG LEVEL MESSAGE',
], ],
]; ];
@@ -321,6 +364,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
* @param string $str * @param string $str
* @param string|null $message * @param string|null $message
* @param bool|null $log_error * @param bool|null $log_error
* @param bool|null $log_warning
* @param string $expected * @param string $expected
* @return void * @return void
*/ */
@@ -330,6 +374,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
string $str, string $str,
?string $message, ?string $message,
?bool $log_error, ?bool $log_error,
?bool $log_warning,
string $expected string $expected
): void { ): void {
$log = new \CoreLibs\Logging\Logging([ $log = new \CoreLibs\Logging\Logging([
@@ -344,7 +389,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$level, $level,
$str, $str,
message: $message, message: $message,
log_error: $log_error log_error: $log_error,
log_warning: $log_warning
); );
$file_content = ''; $file_content = '';
if (is_file($log->getLogFolder() . $log->getLogFile())) { if (is_file($log->getLogFolder() . $log->getLogFile())) {
@@ -358,6 +404,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$expected, $expected,
$file_content $file_content
); );
} elseif ($level == 'warn' && ($log_warning === null || $log_warning === false)) {
$this->assertStringNotContainsString(
$expected,
$file_content
);
} else { } else {
$this->assertStringContainsString( $this->assertStringContainsString(
$expected, $expected,
@@ -377,6 +428,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
* @param string $str * @param string $str
* @param string|null $message * @param string|null $message
* @param bool|null $log_error * @param bool|null $log_error
* @param bool|null $log_warning
* @param string $expected * @param string $expected
* @return void * @return void
*/ */
@@ -386,6 +438,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
string $str, string $str,
?string $message, ?string $message,
?bool $log_error, ?bool $log_error,
?bool $log_warning,
string $expected string $expected
): void { ): void {
$log = new \CoreLibs\Logging\Logging([ $log = new \CoreLibs\Logging\Logging([
@@ -400,7 +453,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$level, $level,
$str, $str,
message: $message, message: $message,
log_error: $log_error log_error: $log_error,
log_warning: $log_warning
); );
$file_content = ''; $file_content = '';
if (is_file($log->getLogFolder() . $log->getLogFile())) { if (is_file($log->getLogFolder() . $log->getLogFile())) {
@@ -414,6 +468,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$expected, $expected,
$file_content $file_content
); );
} elseif ($level == 'warn' && $log_warning === false) {
$this->assertStringNotContainsString(
$expected,
$file_content
);
} else { } else {
$this->assertStringContainsString( $this->assertStringContainsString(
$expected, $expected,

View File

@@ -46,12 +46,34 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
public function testEncryptDecryptSuccess(string $input, string $expected): void public function testEncryptDecryptSuccess(string $input, string $expected): void
{ {
$key = CreateKey::generateRandomKey(); $key = CreateKey::generateRandomKey();
$encrypted = SymmetricEncryption::encrypt($input, $key);
$decrypted = SymmetricEncryption::decrypt($encrypted, $key); // test class
$crypt = new SymmetricEncryption($key);
$encrypted = $crypt->encrypt($input);
$decrypted = $crypt->decrypt($encrypted);
$this->assertEquals(
$expected,
$decrypted,
'Class call',
);
// test indirect
$encrypted = SymmetricEncryption::getInstance($key)->encrypt($input);
$decrypted = SymmetricEncryption::getInstance($key)->decrypt($encrypted);
$this->assertEquals(
$expected,
$decrypted,
'Class Instance call',
);
// test static
$encrypted = SymmetricEncryption::encryptKey($input, $key);
$decrypted = SymmetricEncryption::decryptKey($encrypted, $key);
$this->assertEquals( $this->assertEquals(
$expected, $expected,
$decrypted $decrypted,
'Static call',
); );
} }
@@ -86,10 +108,24 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
public function testEncryptFailed(string $input, string $exception_message): void public function testEncryptFailed(string $input, string $exception_message): void
{ {
$key = CreateKey::generateRandomKey(); $key = CreateKey::generateRandomKey();
$encrypted = SymmetricEncryption::encrypt($input, $key);
$wrong_key = CreateKey::generateRandomKey(); $wrong_key = CreateKey::generateRandomKey();
// wrong key in class call
$crypt = new SymmetricEncryption($key);
$encrypted = $crypt->encrypt($input);
$this->expectExceptionMessage($exception_message); $this->expectExceptionMessage($exception_message);
SymmetricEncryption::decrypt($encrypted, $wrong_key); $crypt->setKey($key);
$crypt->decrypt($encrypted);
// class instance
$encrypted = SymmetricEncryption::getInstance($key)->encrypt($input);
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::getInstance($wrong_key)->decrypt($encrypted);
// class static
$encrypted = SymmetricEncryption::encryptKey($input, $key);
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::decryptKey($encrypted, $wrong_key);
} }
/** /**
@@ -107,7 +143,6 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
'too short hex key' => [ 'too short hex key' => [
'key' => '1cabd5cba9e042f12522f4ff2de5c31d233b', 'key' => '1cabd5cba9e042f12522f4ff2de5c31d233b',
'excpetion_message' => 'Key is not the correct size (must be ' 'excpetion_message' => 'Key is not the correct size (must be '
. 'SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes long).'
], ],
]; ];
} }
@@ -126,13 +161,33 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
*/ */
public function testWrongKey(string $key, string $exception_message): void public function testWrongKey(string $key, string $exception_message): void
{ {
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::encrypt('test', $key);
// we must encrypt valid thing first so we can fail with the wrong kjey
$enc_key = CreateKey::generateRandomKey(); $enc_key = CreateKey::generateRandomKey();
$encrypted = SymmetricEncryption::encrypt('test', $enc_key);
// class
$crypt = new SymmetricEncryption($key);
$this->expectExceptionMessage($exception_message); $this->expectExceptionMessage($exception_message);
SymmetricEncryption::decrypt($encrypted, $key); $crypt->encrypt('test');
$crypt->setKey($enc_key);
$encrypted = $crypt->encrypt('test');
$this->expectExceptionMessage($exception_message);
$crypt->setKey($key);
$crypt->decrypt($encrypted);
// class instance
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::getInstance($key)->encrypt('test');
// we must encrypt valid thing first so we can fail with the wrong key
$encrypted = SymmetricEncryption::getInstance($enc_key)->encrypt('test');
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::getInstance($key)->decrypt($encrypted);
// class static
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::encryptKey('test', $key);
// we must encrypt valid thing first so we can fail with the wrong key
$encrypted = SymmetricEncryption::encryptKey('test', $enc_key);
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::decryptKey($encrypted, $key);
} }
/** /**
@@ -145,7 +200,7 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
return [ return [
'too short ciphertext' => [ 'too short ciphertext' => [
'input' => 'short', 'input' => 'short',
'exception_message' => 'Invalid ciphertext (too short)' 'exception_message' => 'Decipher message failed: '
], ],
]; ];
} }
@@ -164,8 +219,18 @@ final class CoreLibsSecuritySymmetricEncryptionTest extends TestCase
public function testWrongCiphertext(string $input, string $exception_message): void public function testWrongCiphertext(string $input, string $exception_message): void
{ {
$key = CreateKey::generateRandomKey(); $key = CreateKey::generateRandomKey();
// class
$crypt = new SymmetricEncryption($key);
$this->expectExceptionMessage($exception_message); $this->expectExceptionMessage($exception_message);
SymmetricEncryption::decrypt($input, $key); $crypt->decrypt($input);
// class instance
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::getInstance($key)->decrypt($input);
// class static
$this->expectExceptionMessage($exception_message);
SymmetricEncryption::decryptKey($input, $key);
} }
} }

15
jsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"target": "ES2020",
"jsx": "react",
"allowImportingTsExtensions": true,
"strictNullChecks": true,
"strictFunctionTypes": true
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}

18
phpcs.xml Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>PSR12 override rules (strict, standard). Switch spaces indent to tab.</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR1"/>
<rule ref="PSR12">
<!-- turn off white space check for tab -->
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
</rule>
<!-- no space indent, must be tab, 4 is tab iwdth -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
</properties>
</rule>
</ruleset>

View File

@@ -2,7 +2,7 @@
includes: includes:
- phpstan-conditional.php - phpstan-conditional.php
parameters: parameters:
tmpDir: /tmp/phpstan-corelibs tmpDir: %currentWorkingDirectory%/tmp/phpstan-corelibs
level: 8 # max is now 9 level: 8 # max is now 9
checkMissingCallableSignature: true checkMissingCallableSignature: true
treatPhpDocTypesAsCertain: false treatPhpDocTypesAsCertain: false

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/phan-5.4.2.phar /home/clemens/.phive/phars/phan-5.4.3.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/php-cs-fixer-3.34.1.phar /home/clemens/.phive/phars/php-cs-fixer-3.57.2.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/phpdocumentor-3.4.2.phar /home/clemens/.phive/phars/phpdocumentor-3.4.3.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/phpcbf-3.7.2.phar /home/clemens/.phive/phars/phpcbf-3.10.3.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/phpcs-3.7.2.phar /home/clemens/.phive/phars/phpcs-3.10.3.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/phpstan-1.10.37.phar /home/clemens/.phive/phars/phpstan-1.12.4.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/phpunit-9.6.13.phar /home/clemens/.phive/phars/phpunit-9.6.21.phar

View File

@@ -1 +1 @@
/home/clemens/.phive/phars/psalm-5.15.0.phar /home/clemens/.phive/phars/psalm-5.24.0.phar

View File

@@ -46,7 +46,7 @@ use CoreLibs\Debug\Support;
$PAGE_NAME = 'TEST CLASS: ADMIN BACKEND'; $PAGE_NAME = 'TEST CLASS: ADMIN BACKEND';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -21,6 +21,7 @@ ob_end_flush();
use CoreLibs\Combined\ArrayHandler; use CoreLibs\Combined\ArrayHandler;
use CoreLibs\Debug\Support as DgS; use CoreLibs\Debug\Support as DgS;
use CoreLibs\Convert\SetVarType; use CoreLibs\Convert\SetVarType;
// use PHPUnit\Framework\Constraint\ArrayHasKey;
$log = new CoreLibs\Logging\Logging([ $log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG, 'log_folder' => BASE . LOG,
@@ -32,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: ARRAY HANDLER'; $PAGE_NAME = 'TEST CLASS: ARRAY HANDLER';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -236,6 +237,22 @@ $flag = false;
$output = \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value, $flag); $output = \CoreLibs\Combined\ArrayHandler::genAssocArray($db_array, $key, $value, $flag);
print "OUTPUT: " . \CoreLibs\Debug\Support::printAr($output) . "<br>"; print "OUTPUT: " . \CoreLibs\Debug\Support::printAr($output) . "<br>";
print "<hr>";
$array = [
'a' => 'First',
'b' => 'Second',
'c' => 'Third',
];
foreach (array_keys($array) as $search) {
print "Result[" . $search . "]: "
. "next: " . DgS::printAr(ArrayHandler::arrayGetNextKey($array, $search)) . ", "
. "prev: " . DgS::printAr(ArrayHandler::arrayGetPrevKey($array, $search))
. "<br>";
}
print "Key not exists: " . DgS::printAr(ArrayHandler::arrayGetNextKey($array, 'z')) . "<br>";
print "</body></html>"; print "</body></html>";
// __END__ // __END__

View File

@@ -23,7 +23,7 @@ use CoreLibs\Convert\Byte;
$PAGE_NAME = 'TEST CLASS: AUTOLOADER'; $PAGE_NAME = 'TEST CLASS: AUTOLOADER';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $byte_class = 'CoreLibs\Convert\Byte';
$PAGE_NAME = 'TEST CLASS: BYTE CONVERT'; $PAGE_NAME = 'TEST CLASS: BYTE CONVERT';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CHECK COLORS'; $PAGE_NAME = 'TEST CLASS: CHECK COLORS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $db = new CoreLibs\DB\IO(DB_CONFIG, $log);
$PAGE_NAME = 'TEST CLASS: CLASS CALLS'; $PAGE_NAME = 'TEST CLASS: CLASS CALLS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONFIG DIRECT'; $PAGE_NAME = 'TEST CLASS: CONFIG DIRECT';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -26,7 +26,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONFIG LINK'; $PAGE_NAME = 'TEST CLASS: CONFIG LINK';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -31,7 +31,7 @@ $color_class = 'CoreLibs\Convert\Colors';
$PAGE_NAME = 'TEST CLASS: CONVERT COLORS'; $PAGE_NAME = 'TEST CLASS: CONVERT COLORS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CREATE EMAIL'; $PAGE_NAME = 'TEST CLASS: CREATE EMAIL';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $datetime_class = 'CoreLibs\Combined\DateTime';
$PAGE_NAME = 'TEST CLASS: DATE/TIME'; $PAGE_NAME = 'TEST CLASS: DATE/TIME';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -451,6 +451,7 @@ function intervalStringFormatDeprecated(
$value = $interval->days; $value = $interval->days;
$skip = true; $skip = true;
} else { } else {
/** @phan-suppress-next-line PhanUndeclaredProperty */
$value = $interval->$part; $value = $interval->$part;
} }
if ($value == 0 && $skip_last_zero === true) { if ($value == 0 && $skip_last_zero === true) {

View File

@@ -34,7 +34,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB dbReturn'; $PAGE_NAME = 'TEST CLASS: DB dbReturn';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><a href="class_test.db.php">Class Test DB</a></div>'; print '<div><a href="class_test.db.php">Class Test DB</a></div>';
@@ -56,7 +56,9 @@ print "<b>dbReturn CACHE tests</b><br>";
$db->dbExec("DELETE FROM test_db_return"); $db->dbExec("DELETE FROM test_db_return");
$db->dbExec("INSERT INTO test_db_return (uid, data) VALUES ('A1', 'Test A'), ('B1', 'Test B')"); $db->dbExec("INSERT INTO test_db_return (uid, data) VALUES ('A1', 'Test A'), ('B1', 'Test B')");
// read query to use // read query to use
$q_db_ret = "SELECT * FROM test_db_return ORDER BY uid"; $q_db_ret = <<<SQL
SELECT * FROM test_db_return ORDER BY uid
SQL;
RunningTime::hrRunningTime(); RunningTime::hrRunningTime();
@@ -157,4 +159,15 @@ $db->dbCacheReset($q_db_ret);
print "<br>"; print "<br>";
print "Overall Run time: " . RunningTime::hrRunningTimeFromStart() . "<br>"; print "Overall Run time: " . RunningTime::hrRunningTimeFromStart() . "<br>";
print "<br>";
print "PARAM TEST RUN<br>";
// PARAM
$q_db_ret = <<<SQL
SELECT * FROM test_db_return WHERE uid = $1
SQL;
while (is_array($res = $db->dbReturnParams($q_db_ret, ['A1'], $db::NO_CACHE, true))) {
print "ROW: " . Support::printAr($res) . "<br>";
}
// __END__ // __END__

View File

@@ -35,7 +35,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB'; $PAGE_NAME = 'TEST CLASS: DB';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><a href="class_test.db.type.php">Class Test DB row type convert to PHP type</a></div>'; print '<div><a href="class_test.db.type.php">Class Test DB row type convert to PHP type</a></div>';

View File

@@ -20,7 +20,7 @@ $LOG_FILE_ID = 'classTest-db-query-placeholder';
ob_end_flush(); ob_end_flush();
use CoreLibs\Debug\Support; use CoreLibs\Debug\Support;
use CoreLibs\DB\Support\ConvertPlaceholder; // use CoreLibs\DB\Support\ConvertPlaceholder;
$log = new CoreLibs\Logging\Logging([ $log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG, 'log_folder' => BASE . LOG,
@@ -33,7 +33,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDER'; $PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDER';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -115,6 +115,8 @@ echo "INSERT ALL COLUMN TYPES: "
. "ERROR: " . $db->dbGetLastError(true) . "<br>"; . "ERROR: " . $db->dbGetLastError(true) . "<br>";
echo "<hr>"; echo "<hr>";
// test connectors: = , <> () for query detection
// convert placeholder tests // convert placeholder tests
// ? -> $n // ? -> $n
// :name -> $n // :name -> $n

View File

@@ -19,7 +19,7 @@ require 'config.php';
$LOG_FILE_ID = 'classTest-db-query-placeholders'; $LOG_FILE_ID = 'classTest-db-query-placeholders';
ob_end_flush(); ob_end_flush();
use CoreLibs\Debug\Support; // use CoreLibs\Debug\Support;
$log = new CoreLibs\Logging\Logging([ $log = new CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG, 'log_folder' => BASE . LOG,
@@ -32,7 +32,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDERS'; $PAGE_NAME = 'TEST CLASS: DB QUERY PLACEHOLDERS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -33,7 +33,7 @@ $db->log->debug('START', '=============================>');
$PAGE_NAME = 'TEST CLASS: DB COLUMN TYPES'; $PAGE_NAME = 'TEST CLASS: DB COLUMN TYPES';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -43,7 +43,7 @@ $debug_logging_class = 'CoreLibs\Debug\LoggingLegacy';
$PAGE_NAME = 'TEST CLASS: DEBUG'; $PAGE_NAME = 'TEST CLASS: DEBUG';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS'; $PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -35,7 +35,7 @@ $chk_enc = 'CoreLibs\Check\Encoding';
$PAGE_NAME = 'TEST CLASS: ENCODING (CHECK/CONVERT/MIME)'; $PAGE_NAME = 'TEST CLASS: ENCODING (CHECK/CONVERT/MIME)';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -31,7 +31,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: ENCRYPTION'; $PAGE_NAME = 'TEST CLASS: ENCRYPTION';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -40,16 +40,33 @@ $key = CreateKey::generateRandomKey();
print "Secret Key: " . $key . "<br>"; print "Secret Key: " . $key . "<br>";
$string = "I a some deep secret"; $string = "I a some deep secret";
$encrypted = SymmetricEncryption::encrypt($string, $key); //
$decrypted = SymmetricEncryption::decrypt($encrypted, $key); $crypt = new SymmetricEncryption($key);
$encrypted = $crypt->encrypt($string);
$decrypted = $crypt->decrypt($encrypted);
print "[C] Encrypted: " . $encrypted . "<br>";
print "[C] Decrytped: " . $decrypted . "<br>";
$encrypted = SymmetricEncryption::getInstance($key)->encrypt($string);
$decrypted = SymmetricEncryption::getInstance($key)->decrypt($encrypted);
print "[S] Original: " . $string . "<br>";
print "[S] Encrypted: " . $encrypted . "<br>";
print "[S] Decrytped: " . $decrypted . "<br>";
$encrypted = SymmetricEncryption::encryptKey($string, $key);
$decrypted = SymmetricEncryption::decryptKey($encrypted, $key);
print "[SS] Encrypted: " . $encrypted . "<br>";
print "[SS] Decrytped: " . $decrypted . "<br>";
print "Original: " . $string . "<br>"; print "<br>INIT KEY MISSING<br>";
print "Encrypted: " . $encrypted . "<br>"; try {
print "Decrytped: " . $decrypted . "<br>"; $crypt = new SymmetricEncryption();
$encrypted = $crypt->decrypt($string);
} catch (Exception $e) {
print("Error: " . $e->getMessage() . "<br>");
}
print "<br>WRONG CIPHERTEXT<br>"; print "<br>WRONG CIPHERTEXT<br>";
try { try {
$decrypted = SymmetricEncryption::decrypt('flupper', $key); $decrypted = SymmetricEncryption::decryptKey('flupper', $key);
} catch (Exception $e) { } catch (Exception $e) {
print "Error: " . $e->getMessage() . "<br>"; print "Error: " . $e->getMessage() . "<br>";
} }
@@ -57,7 +74,7 @@ try {
print "<br>SHORT and WRONG KEY<br>"; print "<br>SHORT and WRONG KEY<br>";
$key = 'wrong_key'; $key = 'wrong_key';
try { try {
$encrypted = SymmetricEncryption::encrypt($string, $key); $encrypted = SymmetricEncryption::encryptKey($string, $key);
} catch (Exception $e) { } catch (Exception $e) {
print "Error: " . $e->getMessage() . "<br>"; print "Error: " . $e->getMessage() . "<br>";
} }
@@ -65,7 +82,7 @@ try {
print "<br>INVALID HEX KEY<br>"; print "<br>INVALID HEX KEY<br>";
$key = '1cabd5cba9e042f12522f4ff2de5c31d233b'; $key = '1cabd5cba9e042f12522f4ff2de5c31d233b';
try { try {
$encrypted = SymmetricEncryption::encrypt($string, $key); $encrypted = SymmetricEncryption::encryptKey($string, $key);
} catch (Exception $e) { } catch (Exception $e) {
print "Error: " . $e->getMessage() . "<br>"; print "Error: " . $e->getMessage() . "<br>";
} }
@@ -73,25 +90,21 @@ try {
print "<br>WRONG KEY TO DECRYPT<br>"; print "<br>WRONG KEY TO DECRYPT<br>";
$key = CreateKey::generateRandomKey(); $key = CreateKey::generateRandomKey();
$string = "I a some deep secret"; $string = "I a some deep secret";
$encrypted = SymmetricEncryption::encrypt($string, $key); $encrypted = SymmetricEncryption::encryptKey($string, $key);
$key = CreateKey::generateRandomKey();
try {
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);
} catch (Exception $e) {
print "Error: " . $e->getMessage() . "<br>";
}
print "<br>WRONG KEY TO DECRYPT<br>";
$key = CreateKey::generateRandomKey();
$string = "I a some deep secret";
$encrypted = SymmetricEncryption::encrypt($string, $key);
$key = 'wrong_key'; $key = 'wrong_key';
try { try {
$decrypted = SymmetricEncryption::decrypt($encrypted, $key); $decrypted = SymmetricEncryption::decryptKey($encrypted, $key);
} catch (Exception $e) { } catch (Exception $e) {
print "Error: " . $e->getMessage() . "<br>"; print "Error: " . $e->getMessage() . "<br>";
} }
// echo "<hr>";
// $key = CreateKey::generateRandomKey();
// $se = new SymmetricEncryption($key);
// $string = "I a some deep secret";
// $encrypted = $se->encrypt($string);
// $decrypted = $se->decrypt($encrypted);
print "</body></html>"; print "</body></html>";
// __END__ // __END__

View File

@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: ERROR MSG'; $PAGE_NAME = 'TEST CLASS: ERROR MSG';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -45,6 +45,8 @@ $em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug');
$em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug', 'target-id', 'other-style'); $em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug', 'target-id', 'other-style');
$em->setErrorMsg('123', 'error', 'msg this is bad, logged always', log_error:true); $em->setErrorMsg('123', 'error', 'msg this is bad, logged always', log_error:true);
$em->setErrorMsg('123', 'error', 'msg this is bad, never logged', log_error:false); $em->setErrorMsg('123', 'error', 'msg this is bad, never logged', log_error:false);
$em->setErrorMsg('500', 'warning', 'This is perhaps not super good, logged_always', log_warning:true);
$em->setErrorMsg('500', 'warning', 'This is perhaps not super good, logged_never', log_warning:false);
$em->setErrorMsg('1000', 'info', 'This is good'); $em->setErrorMsg('1000', 'info', 'This is good');
$em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)'); $em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)');
$em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency'); $em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency');
@@ -59,6 +61,8 @@ print "ErrorsIds: <pre>" . $log->prAr($em->getErrorIds()) . "</pre>";
print "Errors: <pre>" . $log->prAr($em->getErrorMsg()) . "</pre>"; print "Errors: <pre>" . $log->prAr($em->getErrorMsg()) . "</pre>";
print "JumpTargets: <pre>" . $log->prAr($em->getJumpTarget()) . "</pre>"; print "JumpTargets: <pre>" . $log->prAr($em->getJumpTarget()) . "</pre>";
print "IS info > ok: " . ml::fromName('info')->isHigherThan(ml::ok) . "<br>";
print "</body></html>"; print "</body></html>";
$log->debug('[END]', '==========================================>'); $log->debug('[END]', '==========================================>');

View File

@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: FILE'; $PAGE_NAME = 'TEST CLASS: FILE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -37,6 +37,7 @@ $file = '/some/path/to/some/file.txt';
print "GETFILENAMEENDING: $file: " . File::getFilenameEnding($file) . "<br>"; print "GETFILENAMEENDING: $file: " . File::getFilenameEnding($file) . "<br>";
$file = getcwd() . DIRECTORY_SEPARATOR . 'class_test.file.php'; $file = getcwd() . DIRECTORY_SEPARATOR . 'class_test.file.php';
print "GETLINESFROMFILE: $file: " . File::getLinesFromFile($file) . "<br>"; print "GETLINESFROMFILE: $file: " . File::getLinesFromFile($file) . "<br>";
print "MIMEINFO: $file: " . File::getMimeType($file) . "<br>";
print "</body></html>"; print "</body></html>";

View File

@@ -31,7 +31,7 @@ $hash_class = 'CoreLibs\Create\Hash';
$PAGE_NAME = 'TEST CLASS: HASH'; $PAGE_NAME = 'TEST CLASS: HASH';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -35,19 +35,21 @@ $elements_class = 'CoreLibs\Output\Form\Elements';
$PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS'; $PAGE_NAME = 'TEST CLASS: HTML/ELEMENTS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
$string = "Something < = > Other <br> Next line"; $string = "Something < = > Other <br> Next line and Quotes '\"";
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . "<br>"; echo "String: <pre>$string</pre><br>";
$log->debug('HTMLENT', Html::htmlent($string));
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . " (" . htmlentities($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: " print "PRINTDATETIME: "
. $_elements->printDateTime($date_str[0], $date_str[1], $date_str[2], $date_str[3], $date_str[4]) . "<br>"; . $_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 and Quotes '\"";
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];
@@ -67,8 +69,10 @@ $checked_list = [
['foo', ['bar']], ['foo', ['bar']],
]; ];
foreach ($checked_list as $check) { foreach ($checked_list as $check) {
print "CHECKED(0): $check[0]: " . Html::checked($check[1], $check[0]) . "<br>"; print "CHECKED(0): " . $check[0] . " -> " . print_r($check[1], true) . ": "
print "CHECKED(1): $check[0]: " . Html::checked($check[1], $check[0], Html::CHECKED) . "<br>"; . Html::checked($check[1], $check[0]) . "<br>";
print "CHECKED(1): " . $check[0] . " -> " . print_r($check[1], true) . ": "
. Html::checked($check[1], $check[0], Html::CHECKED) . "<br>";
} }
// magic link creation test // magic link creation test

View File

@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML BUILD: BLOCK'; $PAGE_NAME = 'TEST CLASS: HTML BUILD: BLOCK';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -33,7 +33,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML BUILD'; $PAGE_NAME = 'TEST CLASS: HTML BUILD';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: HTML BUILD: STRING REPLACE'; $PAGE_NAME = 'TEST CLASS: HTML BUILD: STRING REPLACE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -32,7 +32,7 @@ $image_class = 'CoreLibs\Output\Image';
$PAGE_NAME = 'TEST CLASS: IMAGE'; $PAGE_NAME = 'TEST CLASS: IMAGE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -41,9 +41,9 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
$thumb_width = 250; $thumb_width = 250;
$thumb_height = 300; $thumb_height = 300;
// class // class
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture_square.jpg'; $image = BASE . CONTENT_PATH . LAYOUT . IMAGES . 'no_picture_square.jpg';
// folders // folders
$cache_folder = BASE . LAYOUT . CONTENT_PATH . CACHE . IMAGES; $cache_folder = BASE . CONTENT_PATH . LAYOUT . CACHE . IMAGES;
$web_folder = LAYOUT . CACHE . IMAGES; $web_folder = LAYOUT . CACHE . IMAGES;
// rotate image first // rotate image first
try { try {
@@ -58,7 +58,7 @@ echo "<div>CLASS->CREATETHUMBNAILSIMPLE: "
. basename($image) . ": WIDTH: $thumb_width<br><img src=" . basename($image) . ": WIDTH: $thumb_width<br><img src="
. $_image->createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>"; . $_image->createThumbnailSimple($image, $thumb_width, 0, $cache_folder, $web_folder) . "></div>";
// static // static
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . 'no_picture.jpg'; $image = BASE . CONTENT_PATH . LAYOUT . IMAGES . 'no_picture.jpg';
// rotate image first // rotate image first
try { try {
$image_class::correctImageOrientation($image); $image_class::correctImageOrientation($image);
@@ -94,7 +94,7 @@ $images = array(
// return mime type ala mimetype // return mime type ala mimetype
$finfo = new finfo(FILEINFO_MIME_TYPE); $finfo = new finfo(FILEINFO_MIME_TYPE);
foreach ($images as $image) { foreach ($images as $image) {
$image = BASE . LAYOUT . CONTENT_PATH . IMAGES . $image; $image = BASE . CONTENT_PATH . LAYOUT . IMAGES . $image;
list ($height, $width, $img_type) = \CoreLibs\Convert\SetVarType::setArray(getimagesize($image)); list ($height, $width, $img_type) = \CoreLibs\Convert\SetVarType::setArray(getimagesize($image));
echo "<div><b>IMAGE INFO</b>: " . $height . "x" . $width . ", TYPE: " echo "<div><b>IMAGE INFO</b>: " . $height . "x" . $width . ", TYPE: "
. \CoreLibs\Debug\Support::dumpVar($img_type) . " [" . $finfo->file($image) . "]</div>"; . \CoreLibs\Debug\Support::dumpVar($img_type) . " [" . $finfo->file($image) . "]</div>";

View File

@@ -32,7 +32,7 @@ $json_class = 'CoreLibs\Convert\Json';
$PAGE_NAME = 'TEST CLASS: JSON'; $PAGE_NAME = 'TEST CLASS: JSON';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -20,7 +20,7 @@ ob_end_flush();
$PAGE_NAME = 'TEST CLASS: LANG'; $PAGE_NAME = 'TEST CLASS: LANG';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -38,7 +38,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: LOGGING'; $PAGE_NAME = 'TEST CLASS: LOGGING';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -44,7 +44,7 @@ $login->loginMainCall();
$PAGE_NAME = 'TEST CLASS: LOGIN'; $PAGE_NAME = 'TEST CLASS: LOGIN';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $math_class = 'CoreLibs\Convert\Math';
$PAGE_NAME = 'TEST CLASS: MATH'; $PAGE_NAME = 'TEST CLASS: MATH';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: MEMORY USAGE'; $PAGE_NAME = 'TEST CLASS: MEMORY USAGE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -27,7 +27,7 @@ $_mime = new CoreLibs\Convert\MimeAppName();
$PAGE_NAME = 'TEST CLASS: MIME'; $PAGE_NAME = 'TEST CLASS: MIME';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -74,7 +74,7 @@ $form = new CoreLibs\Output\Form\Generate(
$PAGE_NAME = 'TEST CLASS: FORM GENERATE'; $PAGE_NAME = 'TEST CLASS: FORM GENERATE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -32,7 +32,7 @@ $password_class = 'CoreLibs\Security\Password';
$PAGE_NAME = 'TEST CLASS: PASSWORD'; $PAGE_NAME = 'TEST CLASS: PASSWORD';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -63,7 +63,7 @@ $backend->db->dbInfo(true);
ob_end_flush(); ob_end_flush();
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>TEST CLASS</title><head>"; print "<html><head><title>TEST CLASS</title></head>";
print "<body>"; print "<body>";
// key: file name, value; name // key: file name, value; name
@@ -178,7 +178,7 @@ $log->debug('SOME MARK', 'Some error output');
print "EDIT ACCESS ID: " . $backend->edit_access_id . "<br>"; print "EDIT ACCESS ID: " . $backend->edit_access_id . "<br>";
if (is_object($login)) { if (is_object($login)) {
// print "ACL: <br>".$backend->print_ar($login->loginGetAcl())."<br>"; // print "ACL: <br>".$backend->print_ar($login->loginGetAcl())."<br>";
$log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl())); // $log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>"; // print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
// print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>"; // print "DEFAULT ACL: <br>".$backend->print_ar($login->default_acl_list)."<br>";
// $result = array_flip( // $result = array_flip(

View File

@@ -32,7 +32,7 @@ $phpv_class = 'CoreLibs\Check\PhpVersion';
$PAGE_NAME = 'TEST CLASS: PHP VERSION'; $PAGE_NAME = 'TEST CLASS: PHP VERSION';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $array_class = 'CoreLibs\Create\RandomKey';
$PAGE_NAME = 'TEST CLASS: RANDOM KEY'; $PAGE_NAME = 'TEST CLASS: RANDOM KEY';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -27,7 +27,7 @@ $ref_class = 'CoreLibs\Get\ReadEnvFile';
$PAGE_NAME = 'TEST CLASS: READ ENV FILE'; $PAGE_NAME = 'TEST CLASS: READ ENV FILE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -28,7 +28,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: RUNNING TIME'; $PAGE_NAME = 'TEST CLASS: RUNNING TIME';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -50,7 +50,7 @@ $session = new Session();
$PAGE_NAME = 'TEST CLASS: SESSION'; $PAGE_NAME = 'TEST CLASS: SESSION';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -50,7 +50,7 @@ $session = new Session();
$PAGE_NAME = 'TEST CLASS: SESSION (READ)'; $PAGE_NAME = 'TEST CLASS: SESSION (READ)';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -47,7 +47,7 @@ $adm->DATA['adm_set'] = 'SET from admin class';
$PAGE_NAME = 'TEST CLASS: SMARTY'; $PAGE_NAME = 'TEST CLASS: SMARTY';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -97,7 +97,7 @@ $smarty->DATA['drop_down_test'] = [
'foobar' => 'Foo Bar', 'foobar' => 'Foo Bar',
]; ];
$smarty->DATA['drop_down_test_selected'] = 'bar'; $smarty->DATA['drop_down_test_selected'] = 'bar';
$smarty->DATA['drop_down_test_nested'] = [ $smarty->DATA['drop_down_test_nested'] = [
'' => '選択してください', '' => '選択してください',
'4/25(木)' => [ '4/25(木)' => [
'4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50', '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50',

View File

@@ -23,7 +23,7 @@ $byte_class = 'CoreLibs\Convert\Strings';
$PAGE_NAME = 'TEST CLASS: STRINGS CONVERT'; $PAGE_NAME = 'TEST CLASS: STRINGS CONVERT';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: SYSTEM'; $PAGE_NAME = 'TEST CLASS: SYSTEM';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';
@@ -41,7 +41,7 @@ print "GETPAGENAME(0): " . System::getPageName() . "<br>";
print "GETPAGENAME(1): " . System::getPageName(System::NO_EXTENSION) . "<br>"; print "GETPAGENAME(1): " . System::getPageName(System::NO_EXTENSION) . "<br>";
print "GETPAGENAME(2): " . System::getPageName(System::FULL_PATH) . "<br>"; print "GETPAGENAME(2): " . System::getPageName(System::FULL_PATH) . "<br>";
print "System::getPageNameArray():<br>"; print "System::getPageNameArray():<br>";
print "GETPAGENAMEARRAY: " . \CoreLibs\Debug\Support::printAr(System::getPageNameArray()) . "<br>"; print "GETPAGENAMEARRAY: " . DgS::printAr(System::getPageNameArray()) . "<br>";
// seting errro codes file upload // seting errro codes file upload
print "System::fileUploadErrorMessage():<br>"; print "System::fileUploadErrorMessage():<br>";
print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "<br>"; print "FILEUPLOADERRORMESSAGE(): " . System::fileUploadErrorMessage(-1) . "<br>";
@@ -51,4 +51,6 @@ print "FILEUPLOADERRORMESSAGE(UPLOAD_ERR_CANT_WRITE): "
print "System::checkCLI():<br>"; print "System::checkCLI():<br>";
print "Are we in an CLI: " . (System::checkCLI() ? 'Yes' : 'No') . "<br>"; print "Are we in an CLI: " . (System::checkCLI() ? 'Yes' : 'No') . "<br>";
print "Get Addresses: " . DgS::printAr(System::getIpAddresses()) . "<br>";
print "</body></html>"; print "</body></html>";

View File

@@ -28,7 +28,7 @@ $token_class = 'CoreLibs\Output\Form\Token';
$PAGE_NAME = 'TEST CLASS: FORM TOKEN'; $PAGE_NAME = 'TEST CLASS: FORM TOKEN';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -29,7 +29,7 @@ $uids_class = 'CoreLibs\Create\Uids';
$PAGE_NAME = 'TEST CLASS: UIDS'; $PAGE_NAME = 'TEST CLASS: UIDS';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -30,7 +30,7 @@ $log = new CoreLibs\Logging\Logging([
$PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE'; $PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE';
print "<!DOCTYPE html>"; print "<!DOCTYPE html>";
print "<html><head><title>" . $PAGE_NAME . "</title><head>"; print "<html><head><title>" . $PAGE_NAME . "</title></head>";
print "<body>"; 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 '<div><h1>' . $PAGE_NAME . '</h1></div>'; print '<div><h1>' . $PAGE_NAME . '</h1></div>';

View File

@@ -3,4 +3,3 @@
// empty file for add and remove test // empty file for add and remove test
// __END__ // __END__

View File

@@ -1 +0,0 @@
../layout/admin/

View File

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

Before

Width:  |  Height:  |  Size: 489 KiB

After

Width:  |  Height:  |  Size: 489 KiB

View File

Before

Width:  |  Height:  |  Size: 807 KiB

After

Width:  |  Height:  |  Size: 807 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Some files were not shown because too many files have changed in this diff Show More