Commit Graph
100 Commits
Author SHA1 Message Date
Clemens Schwaighofer 118aacee28 Bug in RamdomKey::validateRandomKeyData when passing large character sets
The check for stringlength was done on the set key range in the class var and not the variable passed on in the method.
So if we cold call randomKey with a key character list and not the default list it failed with invalid max length
2026-01-14 15:07:38 +09:00
Clemens Schwaighofer 564e23ecd7 Update and fix Strings stringToTime()
Allow parsing of more flexible interval strings including
long names (day, hour, minute, second, millisecond),
negative values, no spaces between components, and
throwing exceptions on invalid input if requested.

The following types are now allowed
- d|day|days
- h|hour|hours
- m|min|mins|minute|minutes
- s|sec|secs|second|seconds
- ms|msec|msecs|msecond|mseconds|millis|millisec|millisecs|millisecond|milliseconds

Also fix the milisecond parsing that was done completly wrong
the milliseoncds where just added after a "." as decimals without converting them at all.
Now the value is divided by 1000 and added to the existing number, and as before only if ms exist

The negative check is now included in the main parse regex, so a second regex check is no longer necessary

Spaces between values, before or anywhere are now more flexible.

Exceptions are thrown if the regex cannot parse anything, or it returns only one master entry and no matches
2026-01-14 13:16:53 +09:00
Clemens Schwaighofer 2889012592 Add no dash character list allowed in Strings parseCharacterRanges function
Same rules with returning unique elements array
2026-01-14 10:49:14 +09:00
Clemens Schwaighofer cd65604073 Add parseCharacterRanges function to Strings.php and tests
Parses character ranges like A-Z into individual characters and returns as an array
2026-01-14 10:36:09 +09:00
Clemens Schwaighofer a3cf5f45f9 Fix function name in Create/RandomKey 2026-01-07 17:21:26 +09:00
Clemens Schwaighofer 6f3dacdec0 Remove double color settings entry in Phan config 2026-01-07 13:32:31 +09:00
Clemens Schwaighofer 2ab1ee90ef Add color output in phan 2026-01-07 13:17:54 +09:00
Clemens Schwaighofer b8c0aff975 Update phive phars with correct version and update scripts to use both
new "-c" switch for all checking scripts to swtich to the composer version from the phive installed version

NOTE: phpstan plugins only work in the composer version.

Default is the phive version
2026-01-06 18:15:50 +09:00
Clemens Schwaighofer c5fed66237 PHP 8.5 fixes and updates
All tested with PHP 8.4 and PHP 8.3 too

Major changes:
- cube root Math (cbrt) now throws InvalidArgumentException if NAN is returned instead of returning NAN
- Byte convert from string to int will throw errors if value is too large (\LengthException)
- new flag for returning string type but for this bcmath must be installed (\RuntimeException if no bcmath)
- Updated curl class and remove close handler as not needed and deprecated as of PHP 8.5
- Curl phpunit tests: convert string to JSON convert flow for return content check (to avoid per PHP version check)
- image close handler for ImageMagick removed as not needed and deprecated as of PHP 8.5
- updated all check calls too use phive tools if possible (except phpunit) and all scripts can have dynamic php version set
2026-01-06 15:55:47 +09:00
Clemens Schwaighofer 157169d3ba Fix gittignore for package lock json 2025-11-27 17:59:53 +09:00
Clemens Schwaighofer 60fe0e0def Remove package lock for npm, add it to gitignore 2025-11-27 17:58:55 +09:00
Clemens Schwaighofer e473e7899d Fix logging line and call method information
The logging line number and file was for the previous call position, not for
where the actual log entry was called

Also fix for ErrorMessage class calls with shifting the start position up depending on which method is called.

Output shows file and line where the message/log call was done and the function/class method where the log call was done
2025-11-27 17:54:28 +09:00
Clemens Schwaighofer 8af71b70a3 general SQL update to use uuid for uid, update edit.jq.js for some testing 2025-11-06 11:51:29 +09:00
Clemens Schwaighofer 7d10b4c5af Change UUIdv4 validation to properly check for version 4 UUIDs 2025-11-04 11:51:08 +09:00
Clemens Schwaighofer c81b602657 phpunit: redirect error_log message to temp file so they are not printed to console
This is for any logging part that logs to emergency where emergency logging is
set to log to the error_log too
2025-10-09 15:05:00 +09:00
Clemens Schwaighofer 59cc5f2060 phpstan checks and fixes 2025-10-09 11:58:47 +09:00
Clemens Schwaighofer e072aaf4d6 Add ISO Type datetime format to support, and make this default loggint time format 2025-10-09 11:14:06 +09:00
Clemens Schwaighofer 259f9cebf3 Had to roll back previous MessageLevel changes
Keep everything lower case as is
any upper case check have to go through fromName, this will convert to lowercase anyway
2025-09-10 13:41:42 +09:00
Clemens Schwaighofer bd4f674f0f Add a noset level and add uppercase support to fromName()
Noset is for unset status, which is different from unknown.
Also allow upper case so we can use "OK" and "ERROR" in addition to "ok" and "error".
2025-09-10 13:28:39 +09:00
Clemens Schwaighofer 87293bf633 Add a security info md file 2025-08-26 14:14:36 +09:00
Clemens Schwaighofer be46d6e101 Readme update for url fix for the JS utils files 2025-08-18 09:36:10 +09:00
Clemens Schwaighofer 433bc3d539 All array variable names are no longer $array to not confuse 2025-07-23 15:22:25 +09:00
Clemens Schwaighofer 4ed645bac3 Update email check with better domain name check (ASCII), logging class debug output update 2025-07-15 13:13:11 +09:00
Clemens Schwaighofer 908376c1a5 Array sort method doc update 2025-06-26 11:43:28 +09:00
Clemens Schwaighofer c329e7a2da Add JSON_UNESCAPED_UNICODE as default flag for json convert to array calls 2025-06-26 11:39:38 +09:00
Clemens Schwaighofer ad7b59e26a phan check swich from phive to composer package 2025-06-05 18:02:03 +09:00
Clemens Schwaighofer c43bb0662d check scripts update: phan from phive is too old 2025-06-05 18:01:12 +09:00
Clemens Schwaighofer c4e83f94e9 Check scripts update 2025-06-05 17:56:29 +09:00
Clemens Schwaighofer a292abc2c5 phpstan updates 2025-06-05 15:52:43 +09:00
Clemens Schwaighofer 6c5af91386 Add new Logging option to turn on error_log write
On default the level for error_log write is Emergency.
This can be changed either on class creation or via set/get methods.

If logging is skipped because the logging level does not match the main logging level the error_log write is also skipped.

Added MARK fields in the Logging class
2025-06-05 15:32:39 +09:00
Clemens Schwaighofer 73fc74a43a Fix old basic class call for random key length init 2025-06-05 14:47:02 +09:00
Clemens Schwaighofer b89238b922 Merge branch 'release/v9.34.0' into feature/TTD-2650/string-class-update-with-string-check-helpers 2025-06-05 14:44:26 +09:00
Clemens Schwaighofer 9115fc9557 phan and phpstan fixes 2025-06-05 14:43:18 +09:00
Clemens Schwaighofer 62d9cda3d0 Add fix for splitFormatString with format parameter without any split characters
Other phpstan fixes
2025-06-05 14:37:42 +09:00
Clemens Schwaighofer dbc72472f9 Strings regex validation
Update regex validation and add validation class to return full information. Add helper to return last error message from defined constant
2025-06-05 14:29:04 +09:00
Clemens Schwaighofer 3be3519e45 Add new funtions and update
- ksortArray and sortArray
Sort array and return sorted output in one flow. Allows for case insensitve sort, reverse sort

- selectArrayFromOption
select array blocks based on a "key": "value" match.
Can do recusrive with flat or not flat output, strict matching, case insenstivie
The flat combined character can be changed

- findArraysMissingKey
Search an array for a matching value with optional key match and return array block if in this block a key (or keys) are missing
The matching for key and value is always strict, eg 2 and '2' are different,
Found path is added with ":" separators, can be overridden by parameter

- arraySearchSimple
Allow search values to be array for multiple matching (any match)
2025-06-05 13:47:32 +09:00
Clemens Schwaighofer 4707427ff4 Add phpunit tests for checking valid regex 2025-06-04 15:48:32 +09:00
Clemens Schwaighofer 73ac0b68b6 Add valid regex string check 2025-06-04 15:48:08 +09:00
Clemens Schwaighofer a501fa25de Add jsonPrettyPrint for formatted JSON output
Can be used for any debug output when needed
2025-06-04 15:09:20 +09:00
Clemens Schwaighofer d4db235e5b Add new split string, update split string format, add create string from array list, char in char list, remove duplicates
NEW:
- remove duplicates in string
- check character string list in other character string list
- build character string from array (or nested array) values
- split string with fixed split length

UPDATE:
- split string with format
* throw exceptions for wrong paramters
* remove the "split chracters", as they get extracted from the format string
2025-06-04 14:15:45 +09:00
Clemens Schwaighofer c70cdf457f Merge branch 'release/v9.34.0' into feature/TTD-2650/string-class-update-with-string-check-helpers 2025-06-04 14:12:01 +09:00
Clemens Schwaighofer 57aae073d7 Use string buildCharStringsFromList function 2025-06-04 14:11:57 +09:00
Clemens Schwaighofer 4bebec2b47 random key fixes for phpstan checks 2025-06-04 11:58:20 +09:00
Clemens Schwaighofer 991750aa5f Update create random key class with custom character string
- remove set random key length methods, this is now set only during call
- add random key character list update, either via method set or during call
2025-06-04 11:39:58 +09:00
Clemens Schwaighofer c22e68f19a Phive update 2025-05-20 12:13:04 +09:00
Clemens Schwaighofer 074d5bed4c class test login logging update 2025-05-15 15:37:06 +09:00
Clemens Schwaighofer 93cb7e0cab DB IO Adjustments for cursor set check and table exists check 2025-04-22 11:04:22 +09:00
Clemens Schwaighofer 7fbce6529b Merge branch 'development' of github-omc:TBWA-EGPlus-Japan/Client-Projects.php-core-libraries into development 2025-04-22 10:53:19 +09:00
Clemens Schwaighofer 6e086fe7b3 Add array helper for modifying key of a key value array 2025-04-22 10:52:13 +09:00
Clemens Schwaighofer 0ec19d5b75 Add array helper for modifying key of a key value array 2025-04-22 10:36:54 +09:00
Clemens Schwaighofer 8134da349f DB IO add flag to ignore not existing on cache reset, and ignore in ACL Login
in the ACL login cache reset, set flag to ignore unset query data
2025-04-16 17:42:09 +09:00
Clemens Schwaighofer 8396f7856b ACL Login add page information and lookup
Add the full page information and a new file name to cuid lookup to the acl array.
Add a new method to check if a page name is in the list of pages that can be accessed by the user.
2025-04-15 18:38:14 +09:00
Clemens Schwaighofer b18866077e Edit user settings class remove password as mandatory 2025-04-15 17:51:32 +09:00
Clemens Schwaighofer a66cc09095 Fix phpstan problems in test db encryption file 2025-04-15 17:46:41 +09:00
Clemens Schwaighofer 1cfdc45107 Fix edit user missing error example for login user id field 2025-04-15 17:40:54 +09:00
Clemens Schwaighofer 07e46c91ab Add test decryption for pg crypto columns 2025-04-14 09:19:58 +09:00
Clemens Schwaighofer 8aee448c59 Update DB IO for query hash storage and parameter count
The parameter count methods in the PgSQL class have changed
- the function returns a unique list of $ parameters

The count is now done in the DB IO part where it counts over the unique array

Query hash is stored like the query for the current run one (reset on dbExec call).
The method to create the hash is renamed to dbBuildQueryHash instead of "Get".
The dbGetQueryHash function now just returns the last set query hash. There is a matching dbResetQueryHash for unsetting the query hash.
2025-04-09 11:35:02 +09:00
Clemens Schwaighofer 37367db878 Fix regex for $$ PostgresSQL string in convert placeholder 2025-04-07 19:44:18 +09:00
Clemens Schwaighofer 2d30d1d160 Rewrite DB param lookup
* Correct wrong comment lookup
* simplify regex by excluding comment and string blocks before
* simpler lookup for each type
* update checks for more tests for various special cases

In DB IO
* add a function to return all placeholders found in a query
* only numbered parameters are looked up
2025-04-07 17:30:30 +09:00
Clemens Schwaighofer 531229e8b7 Add DB Encryption tests 2025-04-07 12:05:06 +09:00
Clemens Schwaighofer d09c20ff9d hash test page update 2025-04-07 09:09:45 +09:00
Clemens Schwaighofer f4ddc5a5fc Add hash hmac to the Create Hash class 2025-04-07 09:05:37 +09:00
Clemens Schwaighofer 1791ec3908 phan and phpstan fixes for hash uses in CoreLibs 2025-04-04 15:17:42 +09:00
Clemens Schwaighofer 3d13f55c35 Update Hash Class
Add new constant: STANDARD_HASH for sha256
Deprecate DEFAULT_HASH is now STANDARD_HASH_SHORT

Deprecated
__sha1Short:
replace with __crc32b with the default parameter use_sha false
replace with sha1Short if use_sha is true

__hash:
replace with hashShort if default hash type
replace with hash for all others with new default STANDARD_HASH

__hashLong:
replace with hashLong

New:
hashShort: returns STANDARD_HASH_SHORT which is __hash default type
hashStd: returns STANDARD_HASH sha256
hash: switches to STANDARD_HASH as default type
2025-04-04 15:08:58 +09:00
Clemens Schwaighofer cf1989819a phpstan fixes 2025-04-01 11:22:59 +09:00
Clemens Schwaighofer b302fb4053 Add CombinedDateTime class calcDaysInteral wrapper functions
calcDaysIntervalNamedIndex for force using named index and returning only named index
calcDaysIntervalNumIndex for force using numeric index and returning only numeric index
2025-04-01 11:15:00 +09:00
Clemens Schwaighofer 32decdd037 Readme update 2025-03-28 10:58:07 +09:00
Clemens Schwaighofer 46cda40d37 JavaScript general utils file updates 2025-03-28 10:53:42 +09:00
Clemens Schwaighofer e71df90144 Fully deprecate prototype edit.js, add deprecation warnings to edit.jq.js and add new utils
Note that all the utils.js are build in an external repository and just copied here
2025-03-10 11:00:02 +09:00
Clemens Schwaighofer bbcc642fde All "edit.js" development has moved to a new repository
"Code-Blocks.javascript-utils"
2025-03-07 15:09:47 +09:00
Clemens Schwaighofer 558694aa6c Fix DEFAULT_ENCODING that it is string 2025-02-28 10:32:43 +09:00
Clemens Schwaighofer f3bd09529a phpstan fixes 2025-02-28 10:29:04 +09:00
Clemens Schwaighofer 816bb7c9ee Allow encoding ovrride for htmlentities 2025-02-28 10:19:36 +09:00
Clemens Schwaighofer fc7b705355 config.master.php file update
- remove not used code
- reorder defines for possible clean up targets
- TARGET and HOST_NAME are set early
HOST NAME is set right at the top
TARGET is set after site configs is read
- add more $_ENV reads
DEFAULT_ACL_LEVEL
LOCALE (encoding is read from locale which should be in the format of nn_CT.ENCODING, eg en_US.UTF-8), falls back to UTF-8
ADMIN.STYLESHEET
ADMIN.JAVASCRIPT
2025-02-28 10:17:10 +09:00
Clemens Schwaighofer 7b96c1f9ca Remove old eslint config, replaced with mjs one 2025-02-17 12:55:20 +09:00
Clemens Schwaighofer 26c6ebcea7 Merge branch 'NewFeatures' into Update-eslintrcToFlatLayout 2025-02-17 12:54:23 +09:00
Clemens Schwaighofer 32dee1692e Fix DateTime days internal counter
Fixed the bad coded include end date with using flags instead
Allow exclude of start date
Reverse counter fixed, and also includes weekend days

Add reverse for weekend in date interval

Login class: add numeric for ACL level

DB IO: some minor code clean up for not needed var set check

Some edit.jq.js clean ups and added
- loadEl: load element by id and return element value or throw error if not found
- goTo: scroll to an element with scroll into view call
2025-02-17 11:16:51 +09:00
Clemens Schwaighofer 6291ed88c0 eslint config update 2025-02-13 19:01:44 +09:00
Clemens Schwaighofer 5e21ead6fa change error catcher for javasript from log to error as output 2025-02-13 18:24:50 +09:00
Clemens Schwaighofer 07fbd13213 Setup npm with eslint 2025-02-13 18:24:30 +09:00
Clemens Schwaighofer 44b825310a Add ACL level number to unit detail 2025-02-07 19:06:35 +09:00
Clemens Schwaighofer 2c234ccef6 On config errors do not exit but throw exception 2025-01-29 09:57:58 +09:00
Clemens Schwaighofer b493b3c4fd Remove debug message 2025-01-20 20:27:34 +09:00
Clemens Schwaighofer e7dd96b5d9 Further fixes for PHP 8.4 2025-01-20 20:27:03 +09:00
Clemens Schwaighofer bcde36ac17 DB IO Cache reset should not be an error
If the query is not found, do not throw an error, just show a warning
2025-01-20 10:45:31 +09:00
Clemens Schwaighofer 8bde34ec7d Fix bug in DB IO prepared statement with INSERT and auto RETURNING add
INSERT will get a RETURNING added automatically if it has a primary key
This was not checked when query was compared for prepared statements.

Also added a prepared statement status checker
2025-01-17 17:52:41 +09:00
Clemens Schwaighofer a345d71306 De-depricate the ACL Login loginCheckEditAccessId method
This is still used a lot, and there is no reason to deprecate it so early.

First all the other logic should be brought in to make this an easy
conversion.
2025-01-17 14:43:13 +09:00
Clemens Schwaighofer 0ff6294faa Fix ACL Login cuid <-> id pk lookups
Used the wrong SESSION var for lookup
2025-01-17 14:34:41 +09:00
Clemens Schwaighofer 757d7ae01d ACL Login fixes for legacy id lookups
add an edit access id lookup to cuid

Fix unit_cuid not initialized, only old unit_id
2025-01-17 12:48:46 +09:00
Clemens Schwaighofer 4e78b21c67 phpstan fix for fegetcsv param $length 2025-01-17 09:59:39 +09:00
Clemens Schwaighofer d7e6434808 New DeprecatedHelper namespace
For temporary wrapper functions for deprecated calls that need this

PHP 8.4 fputcsv/fgetcsv/str_getcsv encoding default change deprecated warning

Note this does not cover the SqlFileInfo class as this is not used in our code
2025-01-17 09:58:02 +09:00
Clemens Schwaighofer 443cc2751d Update Logging file name change unit tests 2025-01-17 09:33:05 +09:00
Clemens Schwaighofer cf6500b55a Logging class change to "." for block separator
Blocks for info are now separated with "." and not "_" to make it visual more easy to see
2025-01-17 09:08:13 +09:00
Clemens Schwaighofer 09c2ec653f ACL Login set deprecated edit user id too
We need that for some old calls in old projects
2025-01-16 14:49:15 +09:00
Clemens Schwaighofer fc105f9295 Add ACL Login lookup edit access id to edit access cuid 2025-01-16 14:36:11 +09:00
Clemens Schwaighofer 053ab69330 Add edit access cuuid to the unit detail list 2025-01-16 14:04:30 +09:00
Clemens Schwaighofer fd079316f5 ACL Login: Add edit_access_id to unit detail block
This is needed for a lot of legacy data lookup
2025-01-16 13:55:17 +09:00
Clemens Schwaighofer 08664e9834 Update log writing for login info
Fix the deprecated message in the Admin/Backend one with a full sample
Update the admin_header include sample page with the corret writeLog call
2025-01-16 10:40:41 +09:00
Clemens Schwaighofer e063162161 Remove not needed use parts and ignore noop new for phan check 2025-01-15 12:53:02 +09:00
Clemens Schwaighofer 7fbc449a5c PHPunit test call script update
Fix for default PHP set via getting version from default PHP.
Add a verbose option and remove the fixed verbose setting from the phpunit config
Update the options call to add a usage info block
2025-01-15 11:57:25 +09:00