Remove unused code and classes.
Clean up code to remove all named constant from them and throw
deprecation alerts if used.
Add basic psalm setup in root folder and remove from www folder
update debug support to add html escape for html strings on request.
Default is keep as is. debugString gets new third parameter for this as
bool flag.
Add Create\Email to send basic text emails to several too addresses.
Content replace in subject and body is possible with {} entries.
Default encoding is UTF-8 but others can be set and content will be
converted to this.
The dynamic replace works on all data or can be set per receiver.
All static Session:: calls (except for checking valid session name) are
converted to object type. This Object is passed on to Login, Admin
Backend and any other class that needs basic session checking
- edit base used useless regex for getting filename and dir from folder
list. Changed to pathinfo() call to fix this
- edit_base.php and DB\Extended\ArrayIO fixes
On page order in edit we got errors because pk_name in ArrayIO class was
not init as empty string as it should be (is defined as string only)
- ACL\Login updates
Move all public functions to the public block.
Add public functions for base check Page/Base level to min level name
get acl array as is for now (will be extended with other calls for more
detail query)
Also clean ups in PHPdoc layout, long lines, etc
new Langauge\GetLocale::setLocale() for getting new type lang info from
session, etc
L10n class call chnage of parameters:
NEW: locale, domain, path
OLD: locale, path, domain, legacy(bool)
Temporary auto detect for possible path/domain switch if domain value
has slash inside
Rename all local files to names matching locale folder
en_US -> en
Delete lang folders with symlinks as they are no longer used
Update all header files and class Backend\Admin, ACL\Login,
Output\Form\Generate, Template\SmartyExtend with new language order:
call ::setLocale() afer login class
Update missing test translation strings in all po files
Update phpUnit tests to match all new changes
Language\Encoding::__mbMimeEncode -> Convert\MimeEncode::__mbMimeEncode
Langauge\Encoding::checkConvertEncoding -> Check\Encoding::checkConvertEncoding
Langauge\Encoding::setErrorChar -> Check\Encoding::setErrorChar
Langauge\Encoding::getErrorChar -> Encoding::getErrorChar
Langauge\Encoding::convertEncoding -> Convert\Encoding::convertEncoding
Also fixed encoding check that not only a code point but a string can
also be used as a parameter.
Update phpunit tests and split them out for each class
Normal test page is still combined for all classes but updated to
correctly use each class
There was a bug in ther SQL interface class where the folder was just
called "Interface" which is not an allowed Namespace name. Renamed to
SqlInterface
Moved the detect lang/etc function used in Form/Generate,
Template/SmartyExtend and Admin/Backend to Language/GetSettings.
Fixed some test class calls
Move autolaoder loading from config.master.php to config.php and before
we read config.master.php
The read env function has moved into a class and is launched after the
auto loader has been loaded
DB IO class update with better error reporting with last error set and
error history of all errors in order.
TODO: per query or per action error grouping
PHP version check now works with only max too, if called with (null,
'1.2.3') then php version will be checked <= 1.2.3
Debug Support has a to string print method printToString which tries to
print all types of var content as string (bool, int, float, resource,
object, etc)
Debug Support printAr supports ##HTMLPRE## style too (flag true)
DB/IO + PgSQL is changed from is_resource check to "false" check to be
compatible with new PHP 8.1 pgsql connect interface where all resources
are changed to objects PgSql\Connect|Resource|...
If not created Logger class will be auto created in \DB\IO
Recommended to run a CoreLibs\Debug\Logging([...]); and use this class
for all ACL\Login, Admin\Backend, DB\IO, Output\Form\Generate calls.
Last parameter after DB CONFIG is the log parameter
Session create has been moved to a new Create\Session class from the
\Basic class and MUST be started before using ACL\Login. Currently
ACL\Login will fallback and start it if no session is yet started.
See the Readme.md file for which classes use _SESSION data
In future the _SESSION settings should be moved to some wrapper class
for this so we can unit test sessions
Only Output\Form\Generate class call has the new changed with the second
parameter no longer beeing the table width setting but the class
setting.
But as this is a semi retired class and only used for edit_base this is
not 100% breaking.
All other classes can be used as is and have internal fallback to run as
before.
Deprecation messages will be added later.
Smarty extended class is now included in checks and is fixed.
Add the lib/ folder to the composer.json autoloader block so we can use
the composer autoloader and not the one from CoreLibs
Added an autoloader load test backend file
Will check if there is a read_env_file.php and then run it to load .env
file in /configs folder
This file can hold secrets that are not to be checked into git
Updated edit.js file to be eslint compatible
Some code clean up in smarty class (check if $cms object is actually
set)
Logger/Support Debug clean up for some minor logic with debug prefixes
DB IO update debug prefix for log line so we can have a HTML formatted
prefix for echo output
add a prAr that is a new wrapper around print_r, but it does not use
<pre> for layout formatting but {##HTMLPRE##} which will be removed for log
file write or replace with <pre> if printed to the web page
Start moving all basic class methods into dedicated classes.
Most of them are static and can be direct called.
No need to group them into one big class that is hard to maintain and
check.
Work is ongoing
Big fix with IMG_PNG constant use. Switched to IMAGETYPE_*
Some code cleanup in config files (array, DEFINE->define, etc)
Code cleanup in DB:IO class, especially for consistent returning
array/single data blocks
Some javascript core lib update
Some basic json string to array with second function to check last
cought error.
Updated string to bytes convert to make it shorter and more compact
Some minor fixes in DB::IO helper methods
Basic: remove all error handling override for any class vars to avoid
exploiting private/public/protected settings
Basic: Add MIME lookup table with array. So you can return a File name
description (human understandable) to a mime handler.
See mimeInitApps for basic list
IO: Bug fix for counting prepared statment place holders. If there are
$1, $1, $2 then those are TWO and not THREE
IO: various wrappers for returning PK, Extended return set, Number for
rows
Those will be extended to all variables
- fixed all DEFINE to define in config* files
- Updates Login class with missing strict declarations
- some fixes in Login class for possible errors
- Basic class return array layout updates for all rgb sets plus correct
static update
- Basic class timestamp method fix for not full set (eg missing seconds)
- Basic class add method for getting linecount from a file
- DB IO class gets a get settings return value method
The old method name byteStringFormat is currently deprecated and it is
recommended to move to the new humanReadableByteFormat method.
Difference is that the new version uses a bitfield settings mask
BYTE_FORMAT_NOSPACE, BYTE_FORMAT_ADJUST, BYTE_FORMAT_SI
There are no more lang vars passed on to any class calls
The new order is the following
$OVERRIDE_LANG > _SESSION > SITE_LANG > DEFAULT_LANG
Todo: make the setLang better so we do not have the same method in
Backend/Generic/SmartyExtended
Move all smarty and path settings into the Smarty Extended class
the include files <admin|frontend>_set_paths.php and <admin|frontend>_smarty.php
are deprecated.
For special frontend smarty (which will be not used in future anyway) a
dedicated sub class to Smarty Extended with its own methods should be
created
DB\IO dbReturn method has a third parameter to set read only assoc and
not number data from the query
Install basic composer for trying out psalm
setting phpan/phpstan for basic static checking and do basic clean up on
all of the files
Because .inc style is deprecated and also dangerious as often not setup
correctly on the server all .inc files have been renamed to .php files.
All internall calls have been udpated.
The base class has now set/get class variable check handlers.
Default they are off and setting undefined variables in a class works as
before.
The flag can be set to throw an error on an unset var but let var still
be set or also surpress setting and unset var.
This can be controlled via setting for the last parameter in class init
or the global var $CLASS_VARIABLE_ERROR_MODE or in the config file the
constant CLASS_VARIABLE_ERROR_MODE (constant > global). Note that if a
global or constant is set the class constructor setting will be
overridden.
Backend/IO/Basic/Login classes are set to be type safe as much as possible if
called from a strict defined php script.
Added random key generator function to the basic class and removed the
random key definitons from the Backend class.
- randomKeyGen
- initRandomKeyLength
Updated the basic bytes to string and string to bytes functions.
Added hrRunningTime method to use the hrtime for precise running time
calculations. Default returns running time in ms. Can be set via
parameter to ns (lowest), ys, ms, s.
The old runningTime method is still there, but it is recommended to use the
hrRunningTime method instead
Removed Error Handling method in Basic, as there is no need for it
there. The is a master one in lib Folder Error.Handling.inc if needed.
Currently Generate/ArrayIO are not 100% type safe [because they are only
used in the edit_base anyway]
- ALL classes are E_NOTICE safe as far as possible.
There might be some minor things left over which will be cleaned up in
further testing
- Added declare(strict_types=1); on all pages for trying to make all
calls strict
- Added page_content sub content to edit_page, with this some inner page
content with ACL can be set, eg for use with Ajax/JS calls with backend.
Also alias can be set so the control ajax pages can back reference to
the master page content setting. Currently only one back reference is
allowed
- Note that the PAGES array has no numeric indexes, but uses the cuid as
index
First step to clean up all files that are not mandatory for outside
access
* move all header/footer/smarty/set_paths/config files (inc) into
includes/ folder
* generate basic config.php that JUST loads the config.inc file (search)
* config.inc file has sub sections for db access arrays and host
configs, so config.inc is more static
* Also move edit base and template arrays to the include folder
* move the language po files to the 4dev folder as they do not need to
sit outside
* remove not maintained "files.php"
TODO:
split out templates and language files into external layout group
perhaps drop the whole sub template include path thing as this is
actually never really used and more annoying to maintain
eg: layout/frontend/default/ -> layout/frontend
eg: layout/fronend/default/template -> includes/frontend/template
Also check splitting out the NOT define parts of the config.inc file
G_TITLE, EDIT_STYLESHEET, EDIT_JAVASCRIPT, STYLESHEET, JAVASCRIPT
to default define?
DB IO
- Update/Select/Insert checks are sane now and not reverse
- UPDATE can now use RETURNING
- meta table check in postgresql is supressing warning for not existing
table and just returns false
JS (edit)
- update for the html element creation functions
Basic:
- SITE LANG settings added to change default lang based on vhost
- log file id is now set more lienient via globals and not with a global
constant
DB Tables/Functions:
- fix wrong general function and set uid function was missing