Update PHPdoc parts
Add empty line between description and first @param entry. Some other minor comment layout and text fixes
This commit is contained in:
@@ -116,6 +116,7 @@ class Backend
|
||||
// CONSTRUCTOR / DECONSTRUCTOR |====================================>
|
||||
/**
|
||||
* main class constructor
|
||||
*
|
||||
* @param \CoreLibs\DB\IO $db Database connection class
|
||||
* @param \CoreLibs\Debug\Logging $log Logging class
|
||||
* @param \CoreLibs\Create\Session $session Session interface class
|
||||
@@ -175,6 +176,7 @@ class Backend
|
||||
|
||||
/**
|
||||
* set internal ACL from login ACL
|
||||
*
|
||||
* @param array<mixed> $acl login acl array
|
||||
*/
|
||||
public function setACL(array $acl): void
|
||||
@@ -183,7 +185,8 @@ class Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* writes all action vars plus other info into edit_log tabl
|
||||
* writes all action vars plus other info into edit_log table
|
||||
*
|
||||
* @param string $event any kind of event description,
|
||||
* @param string|array<mixed> $data any kind of data related to that event
|
||||
* @param string $write_type write type can bei STRING or BINARY
|
||||
@@ -255,6 +258,7 @@ class Backend
|
||||
|
||||
/**
|
||||
* Set the menu show flag
|
||||
*
|
||||
* @param string|int $menu_show_flag
|
||||
* @return string|int
|
||||
*/
|
||||
@@ -267,6 +271,7 @@ class Backend
|
||||
|
||||
/**
|
||||
* Return the menu show flag
|
||||
*
|
||||
* @return string|int
|
||||
*/
|
||||
public function adbGetMenuShowFlag()
|
||||
@@ -276,6 +281,7 @@ class Backend
|
||||
|
||||
/**
|
||||
* menu creater (from login menu session pages)
|
||||
*
|
||||
* @param int $flag visible flag trigger
|
||||
* @return array<mixed> menu array for output on page (smarty)
|
||||
*/
|
||||
@@ -403,6 +409,7 @@ class Backend
|
||||
/**
|
||||
* ONLY USED IN adbTopMenu
|
||||
* checks if this filename is in the current situation (user id, etc) available
|
||||
*
|
||||
* @param string|null $filename filename
|
||||
* @return bool true for visible/accessable menu point, false for not
|
||||
*/
|
||||
@@ -422,8 +429,8 @@ class Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* creates out of a normal db_return array an assoc array
|
||||
*
|
||||
* @param array<mixed> $db_array input array
|
||||
* @param string|int|bool $key key
|
||||
* @param string|int|bool $value value
|
||||
@@ -440,8 +447,8 @@ class Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* converts bytes into formated string with KB, MB, etc
|
||||
*
|
||||
* @param string|int|float $number string or int or number
|
||||
* @return string formatted string
|
||||
* @deprecated \CoreLibs\Convert\Byte::humanReadableByteFormat()
|
||||
@@ -456,8 +463,8 @@ class Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* converts picture to a thumbnail with max x and max y size
|
||||
*
|
||||
* @param string $pic source image file with or without path
|
||||
* @param int $size_x maximum size width
|
||||
* @param int $size_y maximum size height
|
||||
@@ -485,6 +492,7 @@ class Backend
|
||||
|
||||
/**
|
||||
* wrapper function to fill up the mssages array
|
||||
*
|
||||
* @param string $level info/warning/error
|
||||
* @param string $msg string, can be printf formated
|
||||
* @param array<mixed> $vars optional data for a possible printf formated msg
|
||||
@@ -514,6 +522,7 @@ class Backend
|
||||
|
||||
/**
|
||||
* writes live queue
|
||||
*
|
||||
* @param string $queue_key string to identfy the queue
|
||||
* @param string $type [description]
|
||||
* @param string $target [description]
|
||||
@@ -559,17 +568,22 @@ class Backend
|
||||
/**
|
||||
* Basic class holds exact the same, except the Year/Month/Day/etc strings
|
||||
* are translated in this call
|
||||
*
|
||||
* @param int $year year YYYY
|
||||
* @param int $month month m
|
||||
* @param int $day day d
|
||||
* @param int $hour hour H
|
||||
* @param int $min min i
|
||||
* @param string $suffix additional info printed after the date time variable in the drop down
|
||||
* @param string $suffix additional info printed after the date time
|
||||
* variable in the drop down
|
||||
* also used for ID in the on change JS call
|
||||
* @param int $min_steps default is 1 (minute), can set to anything, is used as sum up from 0
|
||||
* @param bool $name_pos_back default false, if set to true, the name will be printend
|
||||
* @param int $min_steps default is 1 (minute), can set to anything,
|
||||
* is used as sum up from 0
|
||||
* @param bool $name_pos_back default false, if set to true,
|
||||
* the name will be printend
|
||||
* after the drop down and not before the drop down
|
||||
* @return string HTML formated strings for drop down lists of date and time
|
||||
* @return string HTML formated strings for drop down lists
|
||||
* of date and time
|
||||
*/
|
||||
public function adbPrintDateTime(
|
||||
$year,
|
||||
|
||||
@@ -165,6 +165,7 @@ class Email
|
||||
/**
|
||||
* guesses the email type (mostly for mobile) from the domain
|
||||
* if second is set to true, it will return short naming scheme (only provider)
|
||||
*
|
||||
* @param string $email email string
|
||||
* @param bool $short default false, if true,
|
||||
* returns only short type (pc instead of pc_html)
|
||||
@@ -197,6 +198,7 @@ class Email
|
||||
|
||||
/**
|
||||
* gets the short email type from a long email type
|
||||
*
|
||||
* @param string $email_type email string
|
||||
* @return string|bool short string or false for invalid
|
||||
*/
|
||||
@@ -227,7 +229,7 @@ class Email
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
* check email with all regex checks possible and return errors as array
|
||||
*
|
||||
* @param string $email Email address, will be checkd as lower
|
||||
* @param bool $error_code_only If this is set to true it will only return
|
||||
|
||||
@@ -12,6 +12,7 @@ class File
|
||||
{
|
||||
/**
|
||||
* quick return the extension of the given file name
|
||||
*
|
||||
* @param string $filename file name
|
||||
* @return string extension of the file name
|
||||
*/
|
||||
@@ -23,6 +24,7 @@ class File
|
||||
|
||||
/**
|
||||
* get lines in a file
|
||||
*
|
||||
* @param string $file file for line count read
|
||||
* @return int number of lines or -1 for non readable file
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,6 @@ use CoreLibs\Convert\Json;
|
||||
|
||||
class Jason
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string|null $json a json string, or null data
|
||||
* @param bool $override if set to true, then on json error
|
||||
|
||||
@@ -12,6 +12,7 @@ class Password
|
||||
{
|
||||
/**
|
||||
* creates the password hash
|
||||
*
|
||||
* @param string $password password
|
||||
* @return string hashed password
|
||||
*/
|
||||
@@ -25,6 +26,7 @@ class Password
|
||||
|
||||
/**
|
||||
* checks if the entered password matches the hash
|
||||
*
|
||||
* @param string $password password
|
||||
* @param string $hash password hash
|
||||
* @return bool true or false
|
||||
@@ -40,6 +42,7 @@ class Password
|
||||
|
||||
/**
|
||||
* checks if the password needs to be rehashed
|
||||
*
|
||||
* @param string $hash password hash
|
||||
* @return bool true or false
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ class PhpVersion
|
||||
* checks if running PHP version matches given PHP version (min or max)
|
||||
* if either is empty or null it will be ignored
|
||||
* if no min version (null or empty)
|
||||
*
|
||||
* @param string|null $min_version minimum version as string (x, x.y, x.y.x)
|
||||
* @param string|null $max_version optional maximum version as string (x, x.y, x.y.x)
|
||||
* @return bool true if ok, false if not matching version
|
||||
|
||||
@@ -13,6 +13,7 @@ class ArrayHandler
|
||||
/**
|
||||
* searches key = value in an array / array
|
||||
* only returns the first one found
|
||||
*
|
||||
* @param string|int $needle needle (search for)
|
||||
* @param array<mixed> $haystack haystack (search in)
|
||||
* @param string|null $key_search_for the key to look out for, default empty
|
||||
@@ -68,10 +69,12 @@ class ArrayHandler
|
||||
|
||||
/**
|
||||
* recursive array search function, which returns all found not only the first one
|
||||
*
|
||||
* @param string|int $needle needle (search for)
|
||||
* @param array<mixed> $haystack haystack (search in)
|
||||
* @param string|int $key_search_for the key to look for in
|
||||
* @param bool $old [true], if set to false will return new flat layout
|
||||
* @param bool $old [true], if set to false will
|
||||
* return new flat layout
|
||||
* @param array<mixed>|null $path recursive call for previous path
|
||||
* @return array<mixed>|null all array elements paths where
|
||||
* the element was found
|
||||
@@ -148,6 +151,7 @@ class ArrayHandler
|
||||
/**
|
||||
* array search simple. looks for key, value combination, if found, returns true
|
||||
* on default does not strict check, so string '4' will match int 4 and vica versa
|
||||
*
|
||||
* @param array<mixed> $array search in as array
|
||||
* @param string|int $key key (key to search in)
|
||||
* @param string|int $value value (what to find)
|
||||
@@ -184,6 +188,7 @@ class ArrayHandler
|
||||
* ... etc
|
||||
* bool key flag: true: handle keys as string or int
|
||||
* default false: all keys are string
|
||||
*
|
||||
* @return array<mixed>|bool merged array
|
||||
*/
|
||||
public static function arrayMergeRecursive()
|
||||
@@ -240,6 +245,7 @@ class ArrayHandler
|
||||
* array_diff only checks elements from A that are not in B, but not the
|
||||
* other way around.
|
||||
* Note that like array_diff this only checks first level values not keys
|
||||
*
|
||||
* @param array<mixed> $a array to compare a
|
||||
* @param array<mixed> $b array to compare b
|
||||
* @return array<mixed> array with missing elements from a & b
|
||||
@@ -254,9 +260,12 @@ class ArrayHandler
|
||||
* search for the needle array elements in haystack and
|
||||
* return the ones found as an array,
|
||||
* is there nothing found, it returns FALSE (boolean)
|
||||
*
|
||||
* @param array<mixed> $needle elements to search for
|
||||
* @param array<mixed> $haystack array where the $needle elements should be searched int
|
||||
* @return array<mixed>|bool either the found elements or false for nothing found or error
|
||||
* @param array<mixed> $haystack array where the $needle elements should
|
||||
* be searched int
|
||||
* @return array<mixed>|bool either the found elements or
|
||||
* false for nothing found or error
|
||||
*/
|
||||
public static function inArrayAny(array $needle, array $haystack)
|
||||
{
|
||||
@@ -275,6 +284,7 @@ class ArrayHandler
|
||||
|
||||
/**
|
||||
* creates out of a normal db_return array an assoc array
|
||||
*
|
||||
* @param array<mixed> $db_array return array from the database
|
||||
* @param string|int|bool $key key set, false for not set
|
||||
* @param string|int|bool $value value set, false for not set
|
||||
@@ -313,6 +323,7 @@ class ArrayHandler
|
||||
/**
|
||||
* converts multi dimensional array to a flat array
|
||||
* does NOT preserve keys
|
||||
*
|
||||
* @param array<mixed> $array multi dimensionial array
|
||||
* @return array<mixed> flattened array
|
||||
*/
|
||||
@@ -330,6 +341,7 @@ class ArrayHandler
|
||||
|
||||
/**
|
||||
* will loop through an array recursivly and write the array keys back
|
||||
*
|
||||
* @param array<mixed> $array multidemnsional array to flatten
|
||||
* @param array<mixed> $return recoursive pass on array of keys
|
||||
* @return array<mixed> flattened keys array
|
||||
@@ -348,6 +360,7 @@ class ArrayHandler
|
||||
/**
|
||||
* as above will flatten an array, but in this case only the outmost
|
||||
* leave nodes, all other keyswill be skipped
|
||||
*
|
||||
* @param array<mixed> $array multidemnsional array to flatten
|
||||
* @return array<mixed> flattened keys array
|
||||
*/
|
||||
@@ -366,6 +379,7 @@ class ArrayHandler
|
||||
/**
|
||||
* searches for key -> value in an array tree and writes the value one level up
|
||||
* this will remove this leaf will all other values
|
||||
*
|
||||
* @param array<mixed> $array nested array
|
||||
* @param string|int $search key to find that has no sub leaf
|
||||
* and will be pushed up
|
||||
|
||||
@@ -66,9 +66,11 @@ class DateTime
|
||||
/**
|
||||
* a simple wrapper for the date format
|
||||
* if an invalid timestamp is give zero timestamp unix time is used
|
||||
*
|
||||
* @param int|float $timestamp unix timestamp
|
||||
* @param bool $show_micro show the micro time (default false)
|
||||
* @param bool $micro_as_float Add the micro time with . instead of ms (default false)
|
||||
* @param bool $micro_as_float Add the micro time with . instead
|
||||
* of ms (default false)
|
||||
* @return string formated date+time in Y-M-D h:m:s ms
|
||||
*/
|
||||
public static function dateStringFormat(
|
||||
@@ -92,7 +94,9 @@ class DateTime
|
||||
|
||||
/**
|
||||
* formats a timestamp into interval, not into a date
|
||||
* @param string|int|float $timestamp interval in seconds and optional float micro seconds
|
||||
*
|
||||
* @param string|int|float $timestamp interval in seconds and optional
|
||||
* float micro seconds
|
||||
* @param bool $show_micro show micro seconds, default true
|
||||
* @return string interval formatted string or string as is
|
||||
*/
|
||||
@@ -149,6 +153,7 @@ class DateTime
|
||||
/**
|
||||
* does a reverse of the timeStringFormat and converts the string from
|
||||
* xd xh xm xs xms to a timestamp.microtime format
|
||||
*
|
||||
* @param string|int|float $timestring formatted interval
|
||||
* @return string|int|float converted float interval, or string as is
|
||||
*/
|
||||
@@ -190,6 +195,7 @@ class DateTime
|
||||
|
||||
/**
|
||||
* splits & checks date, wrap around for check_date function
|
||||
*
|
||||
* @param string $date a date string in the format YYYY-MM-DD
|
||||
* @return bool true if valid date, false if date not valid
|
||||
*/
|
||||
@@ -214,6 +220,7 @@ class DateTime
|
||||
|
||||
/**
|
||||
* splits & checks date, wrap around for check_date function
|
||||
*
|
||||
* @param string $datetime date (YYYY-MM-DD) + time (HH:MM:SS), SS can be dropped
|
||||
* @return bool true if valid date, false if date not valid
|
||||
*/
|
||||
@@ -263,6 +270,7 @@ class DateTime
|
||||
* 0 if both are equal
|
||||
* 1 if the first date is bigger than the last
|
||||
* false (bool): error
|
||||
*
|
||||
* @param string $start_date start date string in YYYY-MM-DD
|
||||
* @param string $end_date end date string in YYYY-MM-DD
|
||||
* @return int|bool false on error, or int -1/0/1 as difference
|
||||
@@ -297,12 +305,14 @@ class DateTime
|
||||
}
|
||||
|
||||
/**
|
||||
* compares the two dates + times. if seconds missing in one set, add :00, converts / to -
|
||||
* compares the two dates + times. if seconds missing in one set,
|
||||
* add :00, converts / to -
|
||||
* returns int/bool in:
|
||||
* -1 if the first date is smaller the last
|
||||
* 0 if both are equal
|
||||
* 1 if the first date is bigger than the last
|
||||
* false if no valid date/times chould be found
|
||||
*
|
||||
* @param string $start_datetime start date/time in YYYY-MM-DD HH:mm:ss
|
||||
* @param string $end_datetime end date/time in YYYY-MM-DD HH:mm:ss
|
||||
* @return int|bool false for error or -1/0/1 as difference
|
||||
@@ -336,6 +346,7 @@ class DateTime
|
||||
* calculates the days between two dates
|
||||
* return: overall days, week days, weekend days as array 0...2 or named
|
||||
* as overall, weekday and weekend
|
||||
*
|
||||
* @param string $start_date valid start date (y/m/d)
|
||||
* @param string $end_date valid end date (y/m/d)
|
||||
* @param bool $return_named return array type, false (default), true for named
|
||||
|
||||
@@ -30,6 +30,7 @@ class Byte
|
||||
* BYTE_FORMAT_ADJUST [2] use sprintf to always print two decimals
|
||||
* BYTE_FORMAT_SI [3] use si standard 1000 instead of bytes 1024
|
||||
* To use the constant from outside use class::CONSTANT
|
||||
*
|
||||
* @param string|int|float $bytes bytes as string int or pure int
|
||||
* @param int $flags bitwise flag with use space turned on
|
||||
* @return string converted byte number (float) with suffix
|
||||
@@ -106,6 +107,7 @@ class Byte
|
||||
* NOTE: large exabyte numbers will overflow
|
||||
* flag allowed:
|
||||
* BYTE_FORMAT_SI [3] use si standard 1000 instead of bytes 1024
|
||||
*
|
||||
* @param string|int|float $number any string or number to convert
|
||||
* @param int $flags bitwise flag with use space turned on
|
||||
* @return string|int|float converted value or original value
|
||||
|
||||
@@ -23,6 +23,7 @@ class Colors
|
||||
* converts the rgb values from int data to the valid rgb html hex string
|
||||
* optional can turn of leading #
|
||||
* if one value is invalid, will return false
|
||||
*
|
||||
* @param int $red red 0-255
|
||||
* @param int $green green 0-255
|
||||
* @param int $blue blue 0-255
|
||||
@@ -49,6 +50,7 @@ class Colors
|
||||
|
||||
/**
|
||||
* converts a hex RGB color to the int numbers
|
||||
*
|
||||
* @param string $hexStr RGB hexstring
|
||||
* @param bool $return_as_string flag to return as string
|
||||
* @param string $seperator string seperator: default: ","
|
||||
@@ -90,6 +92,7 @@ class Colors
|
||||
* converts RGB to HSB/V values
|
||||
* returns:
|
||||
* array with hue (0-360), sat (0-100%), brightness/value (0-100%)
|
||||
*
|
||||
* @param int $red red 0-255
|
||||
* @param int $green green 0-255
|
||||
* @param int $blue blue 0-255
|
||||
@@ -136,6 +139,7 @@ class Colors
|
||||
* hsb2rgb does not clean convert back to hsb in a round trip
|
||||
* converts HSB/V to RGB values RGB is full INT
|
||||
* if HSB/V value is invalid, sets this value to 0
|
||||
*
|
||||
* @param float $H hue 0-360 (int)
|
||||
* @param float $S saturation 0-100 (int)
|
||||
* @param float $V brightness/value 0-100 (int)
|
||||
@@ -218,6 +222,7 @@ class Colors
|
||||
* converts a RGB (0-255) to HSL
|
||||
* return:
|
||||
* array with hue (0-360), saturation (0-100%) and luminance (0-100%)
|
||||
*
|
||||
* @param int $red red 0-255
|
||||
* @param int $green green 0-255
|
||||
* @param int $blue blue 0-255
|
||||
@@ -271,6 +276,7 @@ class Colors
|
||||
/**
|
||||
* converts an HSL to RGB
|
||||
* if HSL value is invalid, set this value to 0
|
||||
*
|
||||
* @param float $hue hue: 0-360 (degrees)
|
||||
* @param float $sat saturation: 0-100
|
||||
* @param float $lum luminance: 0-100
|
||||
|
||||
@@ -15,6 +15,7 @@ class Html
|
||||
|
||||
/**
|
||||
* full wrapper for html entities
|
||||
*
|
||||
* @param mixed $string string to html encode
|
||||
* @return mixed if string, encoded, else as is (eg null)
|
||||
*/
|
||||
@@ -42,10 +43,14 @@ class Html
|
||||
* returns 'checked' or 'selected' if okay
|
||||
* $needle is a var, $haystack an array or a string
|
||||
* **** THE RETURN: VALUE WILL CHANGE TO A DEFAULT NULL IF NOT FOUND ****
|
||||
* @param array<mixed>|string $haystack (search in) haystack can be an array or a string
|
||||
*
|
||||
* @param array<mixed>|string $haystack (search in) haystack can be
|
||||
* an array or a string
|
||||
* @param string $needle needle (search for)
|
||||
* @param int $type type: 0: returns selected, 1, returns checked
|
||||
* @return ?string returns checked or selected, else returns null
|
||||
* @param int $type type: 0: returns selected, 1,
|
||||
* returns checked
|
||||
* @return ?string returns checked or selected,
|
||||
* else returns null
|
||||
*/
|
||||
public static function checked($haystack, string $needle, int $type = 0): ?string
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ class Json
|
||||
* or failed convert to array
|
||||
* In ANY case it will ALWAYS return array.
|
||||
* Does not throw errors
|
||||
*
|
||||
* @param string|null $json a json string, or null data
|
||||
* @param bool $override if set to true, then on json error
|
||||
* set original value as array
|
||||
@@ -49,6 +50,7 @@ class Json
|
||||
|
||||
/**
|
||||
* returns human readable string for json errors thrown in jsonConvertToArray
|
||||
*
|
||||
* @param bool|boolean $return_string [default=false] if set to true
|
||||
* it will return the message string and not
|
||||
* the error number
|
||||
|
||||
@@ -13,6 +13,7 @@ class Math
|
||||
/**
|
||||
* some float numbers will be rounded up even if they have no decimal entries
|
||||
* this function fixes this by pre-rounding before calling ceil
|
||||
*
|
||||
* @param float $number number to round
|
||||
* @param int|integer $precision intermediat round up decimals (default 10)
|
||||
* @return float correct ceil number
|
||||
@@ -25,6 +26,7 @@ class Math
|
||||
/**
|
||||
* round inside an a number, not the decimal part only
|
||||
* eg 48767 with -2 -> 48700
|
||||
*
|
||||
* @param float $number number to round
|
||||
* @param int $precision negative number for position in number (default -2)
|
||||
* @return float rounded number
|
||||
@@ -42,6 +44,7 @@ class Math
|
||||
|
||||
/**
|
||||
* inits input to 0, if value is not numeric
|
||||
*
|
||||
* @param string|int|float $number string or number to check
|
||||
* @return float if not number, then returns 0, else original input
|
||||
*/
|
||||
|
||||
@@ -55,6 +55,7 @@ class MimeAppName
|
||||
|
||||
/**
|
||||
* Sets or updates a mime type
|
||||
*
|
||||
* @param string $mime MIME Name, no validiation
|
||||
* @param string $app Applicaiton name
|
||||
* @return void
|
||||
@@ -71,6 +72,7 @@ class MimeAppName
|
||||
/**
|
||||
* get the application name from mime type
|
||||
* if not set returns "Other file"
|
||||
*
|
||||
* @param string $mime MIME Name
|
||||
* @return string Application name matching
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ class Hash
|
||||
* hash returns false
|
||||
* preg_replace fails for older php version
|
||||
* Use __hash with crc32b or hash('crc32b', ...) for correct output
|
||||
*
|
||||
* @param string $string string to crc
|
||||
* @return string crc32b hash (old type)
|
||||
*/
|
||||
@@ -39,6 +40,7 @@ class Hash
|
||||
|
||||
/**
|
||||
* replacement for __crc32b call
|
||||
*
|
||||
* @param string $string string to hash
|
||||
* @param bool $use_sha use sha instead of crc32b (default false)
|
||||
* @return string hash of the string
|
||||
@@ -58,6 +60,7 @@ class Hash
|
||||
* defaults to adler 32
|
||||
* allowed crc32b, adler32, fnv132, fnv1a32, joaat
|
||||
* all that create 8 char long hashes
|
||||
*
|
||||
* @param string $string string to hash
|
||||
* @param string $hash_type hash type (default adler32)
|
||||
* @return string hash of the string
|
||||
@@ -79,6 +82,7 @@ class Hash
|
||||
|
||||
/**
|
||||
* Wrapper function for standard long hashd
|
||||
*
|
||||
* @param string $string String to be hashed
|
||||
* @return string Hashed string
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ class RandomKey
|
||||
}
|
||||
/**
|
||||
* sets the random key range with the default values
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
private static function initRandomKeyData()
|
||||
@@ -44,6 +45,7 @@ class RandomKey
|
||||
|
||||
/**
|
||||
* validates they key length for random string generation
|
||||
*
|
||||
* @param int $key_length key length
|
||||
* @return bool true for valid, false for invalid length
|
||||
*/
|
||||
@@ -63,6 +65,7 @@ class RandomKey
|
||||
/**
|
||||
* sets the key length and checks that they key given is valid
|
||||
* if failed it will not change the default key length and return false
|
||||
*
|
||||
* @param int $key_length key length
|
||||
* @return bool true/false for set status
|
||||
*/
|
||||
@@ -91,6 +94,7 @@ class RandomKey
|
||||
* creates a random key based on the key_range with key_length
|
||||
* if override key length is set, it will check on valid key and use this
|
||||
* this will not set the class key length variable
|
||||
*
|
||||
* @param int $key_length key length override, -1 for use default
|
||||
* @return string random key
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ class Uids
|
||||
* creates psuedo random uuid v4
|
||||
* Code take from class here:
|
||||
* https://www.php.net/manual/en/function.uniqid.php#94959
|
||||
*
|
||||
* @return string pseudo random uuid v4
|
||||
*/
|
||||
public static function uuidv4(): string
|
||||
@@ -44,6 +45,7 @@ class Uids
|
||||
* TODO: make this a proper uniq ID creation
|
||||
* add uuidv4 subcall to the uuid function too
|
||||
* creates a uniq id
|
||||
*
|
||||
* @param string $type uniq id type, currently md5 or sha256 allowed
|
||||
* if not set will use DEFAULT_HASH if set
|
||||
* @return string uniq id
|
||||
@@ -81,7 +83,7 @@ class Uids
|
||||
return $uniq_id;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* create a unique id with the standard hash type defined in __hash
|
||||
*
|
||||
* @return string Unique ID with fixed length of 8 characters
|
||||
|
||||
@@ -50,6 +50,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
/**
|
||||
* constructor for the array io class, set the
|
||||
* primary key name automatically (from array)
|
||||
*
|
||||
* @param array<mixed> $db_config db connection config
|
||||
* @param array<mixed> $table_array table array config
|
||||
* @param string $table_name table name string
|
||||
@@ -93,6 +94,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
* works for <b>,<i>, and <a> (thought <a> can be / or should
|
||||
* be handled with the magic links functions
|
||||
* used with the read function
|
||||
*
|
||||
* @param string $text any html encoded string
|
||||
* @return string decoded html string
|
||||
*/
|
||||
@@ -111,6 +113,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
|
||||
/**
|
||||
* changeds all HTML entities into non HTML ones
|
||||
*
|
||||
* @param string $text encoded html string
|
||||
* @return string decoded html string
|
||||
*/
|
||||
@@ -126,6 +129,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
|
||||
/**
|
||||
* dumps the current data
|
||||
*
|
||||
* @param bool $write write to error message, default false
|
||||
* @return string the array data as html string entry
|
||||
*/
|
||||
@@ -144,7 +148,9 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if pk is set and if not, set from pk_id and if this also not set return 0
|
||||
* checks if pk is set and if not, set from pk_id and
|
||||
* if this also not set return 0
|
||||
*
|
||||
* @return bool true if pk value is set, else false
|
||||
*/
|
||||
public function dbCheckPkSet()
|
||||
@@ -182,6 +188,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
|
||||
/**
|
||||
* deletes one dataset
|
||||
*
|
||||
* @param array<mixed> $table_array optional override for table array set
|
||||
* set this as new table array too
|
||||
* @return array<mixed> returns the table array that was deleted
|
||||
@@ -241,8 +248,10 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
|
||||
/**
|
||||
* reads one row into the array
|
||||
*
|
||||
* @param boolean $edit on true convert data, else as is
|
||||
* @param array<mixed> $table_array optional table array, overwrites internal set array
|
||||
* @param array<mixed> $table_array optional table array, overwrites
|
||||
* internal set array
|
||||
* @return array<mixed> set table array with values
|
||||
*/
|
||||
public function dbRead($edit = false, $table_array = [])
|
||||
@@ -315,6 +324,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
|
||||
/**
|
||||
* writes one set into DB or updates one set (if PK exists)
|
||||
*
|
||||
* @param boolean $addslashes old convert entities and set set escape
|
||||
* @param array<mixed> $table_array optional table array, overwrites internal one
|
||||
* @return array<mixed> table array or null
|
||||
|
||||
@@ -59,15 +59,9 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/** @var object|resource|bool */ // replace object with PgSql\Connection
|
||||
private $dbh;
|
||||
|
||||
/**
|
||||
* class constructor, empty does nothing
|
||||
*/
|
||||
// public function __construct()
|
||||
// {
|
||||
// }
|
||||
|
||||
/**
|
||||
* queries last error query and returns true or false if error was set
|
||||
*
|
||||
* @return bool true/false if last error is set
|
||||
*/
|
||||
public function __dbLastErrorQuery(): bool
|
||||
@@ -81,6 +75,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_query, catches error and stores it in class var
|
||||
*
|
||||
* @param string $query Query string
|
||||
* @return object|resource|bool query result (PgSql\Result)
|
||||
*/
|
||||
@@ -102,6 +97,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* Proposed
|
||||
* wrapperf or pg_query_params for queries in the style of
|
||||
* SELECT foo FROM bar WHERE foobar = $1
|
||||
*
|
||||
* @param string $query Query string with placeholders $1, ..
|
||||
* @param array<mixed> $params Matching parameters for each placerhold
|
||||
* @return object|resource|bool Query result (PgSql\Result)
|
||||
@@ -124,6 +120,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* sends an async query to the server
|
||||
*
|
||||
* @param string $query query string
|
||||
* @return bool true/false if query was sent successful
|
||||
*/
|
||||
@@ -138,6 +135,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_get_result
|
||||
*
|
||||
* @return object|resource|bool resource handler or false for error (PgSql\Result)
|
||||
*/
|
||||
public function __dbGetResult()
|
||||
@@ -158,6 +156,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_close
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function __dbClose(): void
|
||||
@@ -173,9 +172,11 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_prepare
|
||||
*
|
||||
* @param string $name statement name
|
||||
* @param string $query query string
|
||||
* @return object|resource|bool prepare statement handler or false for error (PgSql\Result)
|
||||
* @return object|resource|bool prepare statement handler or
|
||||
* false for error (PgSql\Result)
|
||||
*/
|
||||
public function __dbPrepare(string $name, string $query)
|
||||
{
|
||||
@@ -191,6 +192,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_execute for running a prepared statement
|
||||
*
|
||||
* @param string $name statement name
|
||||
* @param array<mixed> $data data array
|
||||
* @return object|resource|bool returns status or false for error (PgSql\Result)
|
||||
@@ -209,6 +211,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_num_rows
|
||||
*
|
||||
* @param object|resource|bool $cursor cursor PgSql\Result (former resource)
|
||||
* @return int number of rows, -1 on error
|
||||
*/
|
||||
@@ -222,6 +225,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_num_fields
|
||||
*
|
||||
* @param object|resource|bool $cursor cursor PgSql\Result (former resource)
|
||||
* @return int number for fields in result, -1 on error
|
||||
*/
|
||||
@@ -235,6 +239,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_field_name
|
||||
*
|
||||
* @param object|resource|bool $cursor cursor PgSql\Result (former resource)
|
||||
* @param int $i field position
|
||||
* @return string|bool name or false on error
|
||||
@@ -250,6 +255,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* wrapper for pg_fetch_array
|
||||
* if through/true false, use __dbResultType(true)
|
||||
*
|
||||
* @param object|resource|bool $cursor cursor PgSql\Result (former resource)
|
||||
* @param int $result_type result type as int number
|
||||
* @return array<mixed>|bool array result data or false on end/error
|
||||
@@ -265,6 +271,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* simple match up between assoc true/false
|
||||
*
|
||||
* @param bool $assoc_type true (default) for PGSQL_ASSOC, false for PGSQL_BOTH
|
||||
* @return int valid result type for fetch array
|
||||
*/
|
||||
@@ -279,6 +286,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_fetch_all
|
||||
*
|
||||
* @param object|resource|bool $cursor cursor PgSql\Result (former resource)
|
||||
* @return array<mixed>|bool data array or false for end/error
|
||||
*/
|
||||
@@ -292,6 +300,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_affected_rows
|
||||
*
|
||||
* @param object|resource|bool $cursor cursor PgSql\Result (former resource)
|
||||
* @return int affected rows, 0 for none, -1 for error
|
||||
*/
|
||||
@@ -306,7 +315,9 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* reads the last inserted primary key for the query
|
||||
* if there is no pk_name tries to auto built it from the table name
|
||||
* this only works if db schema is after "no plural names. and pk name is table name + _id
|
||||
* this only works if db schema is after no plural names
|
||||
* and pk name is table name + _id
|
||||
*
|
||||
* detects schema prefix in table name
|
||||
* @param string $query query string
|
||||
* @param string|null $pk_name primary key name, if '' then auto detect
|
||||
@@ -355,6 +366,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* queries database for the primary key name to this table in the selected schema
|
||||
*
|
||||
* @param string $table table name
|
||||
* @param string $schema optional schema name, '' for default
|
||||
* @return string|bool primary key name or false if not found
|
||||
@@ -407,6 +419,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_connect, writes out failure to screen if error occurs (hidden var)
|
||||
*
|
||||
* @param string $db_host host name
|
||||
* @param string $db_user user name
|
||||
* @param string $db_pass password
|
||||
@@ -456,6 +469,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* reads the last error for this cursor and returns
|
||||
* html formatted string with error name
|
||||
*
|
||||
* @param bool|object|resource $cursor cursor PgSql\Result (former resource)
|
||||
* or null
|
||||
* @return string error string
|
||||
@@ -481,6 +495,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_meta_data
|
||||
*
|
||||
* @param string $table table name
|
||||
* @param bool $extended show extended info (default true)
|
||||
* @return array<mixed>|bool array data for the table info or false on error
|
||||
@@ -496,6 +511,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_escape_string
|
||||
*
|
||||
* @param string|int|float|bool $string any string/int/float/bool
|
||||
* @return string excaped string
|
||||
*/
|
||||
@@ -511,6 +527,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* wrapper for pg_escape_literal
|
||||
* difference to escape string is that this one adds quotes ('') around
|
||||
* the string too
|
||||
*
|
||||
* @param string|int|float|bool $string any string/int/float/bool
|
||||
* @return string excaped string including quites
|
||||
*/
|
||||
@@ -526,6 +543,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* wrapper for pg_escape_identifier
|
||||
* Only used for table names, column names
|
||||
*
|
||||
* @param string $string any string
|
||||
* @return string escaped string
|
||||
*/
|
||||
@@ -540,6 +558,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_escape_byte
|
||||
*
|
||||
* @param string $bytea bytea data stream
|
||||
* @return string escaped bytea string
|
||||
*/
|
||||
@@ -553,6 +572,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* wrapper for pg_connection_busy
|
||||
*
|
||||
* @return bool True if connection is busy, False if not or no db connection at all
|
||||
*/
|
||||
public function __dbConnectionBusy(): bool
|
||||
@@ -565,6 +585,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* Experimental wrapper with scoket timetout
|
||||
*
|
||||
* @param integer $timeout_seconds Wait how many seconds on timeout
|
||||
* @return boolean True if connection is busy, or false on
|
||||
* not busy or no db connection at all
|
||||
@@ -593,6 +614,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* if not in array return empty string
|
||||
* On default 'version' will be stripped of any space attached info
|
||||
* eg 13.5 (other info) will return only 13.5
|
||||
*
|
||||
* @param string $parameter Parameter string to extract from array
|
||||
* @param boolean $strip If parameter is server strip out on default
|
||||
* Set to false to get original string AS is
|
||||
@@ -617,6 +639,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* Returns all parameters that are possible from the db_version
|
||||
*
|
||||
* @return array<mixed> Parameter key names from pg_version
|
||||
*/
|
||||
public function __dbVersionInfoParameterList(): array
|
||||
@@ -631,6 +654,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* wrapper for pg_version
|
||||
* Note: this only returns server version
|
||||
* not connection version OR client version
|
||||
*
|
||||
* @return string version string
|
||||
*/
|
||||
public function __dbVersion(): string
|
||||
@@ -649,6 +673,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* Old version is 9.5.6 where 9.5 is the major version
|
||||
* Newer Postgresql (10 on) have only one major version so eg 13.5
|
||||
* is returned as 130005
|
||||
*
|
||||
* @return integer Server version
|
||||
*/
|
||||
public function __dbVersionNumeric(): int
|
||||
@@ -662,6 +687,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* This is a fallback for old PostgreSQL versions
|
||||
* postgresql array to php array
|
||||
* https://stackoverflow.com/a/27964420
|
||||
*
|
||||
* @param string $array_text Array text from PostgreSQL
|
||||
* @param int $start Start string position
|
||||
* @param int|null $end End string position from recursive call
|
||||
@@ -721,6 +747,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
* Returns any server setting
|
||||
* if no connection or empty parameter or other error returns false
|
||||
* else returns a string
|
||||
*
|
||||
* @param string $parameter Parameter to query
|
||||
* @return string|bool Settings value as string
|
||||
*/
|
||||
@@ -738,6 +765,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* wrapper for any SHOW data blocks
|
||||
* eg search_path or client_encoding
|
||||
*
|
||||
* @param string $show_string Part to show, if invalid will return empty string
|
||||
* @return string Found part as is
|
||||
*/
|
||||
@@ -758,6 +786,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* Sets a new database schema/search_path
|
||||
* Checks if schema exits and if not aborts with error code 2
|
||||
*
|
||||
* @param string $db_schema Schema to set
|
||||
* @return int Returns 0 if no error
|
||||
* 1 for check query failed
|
||||
@@ -788,6 +817,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
|
||||
/**
|
||||
* Returns current set schema/search_path
|
||||
*
|
||||
* @return string Search Path as currently set in DB
|
||||
*/
|
||||
public function __dbGetSchema(): string
|
||||
@@ -798,6 +828,7 @@ class PgSQL implements \CoreLibs\DB\SQL\SqlInterface\SqlFunctions
|
||||
/**
|
||||
* set the client encoding
|
||||
* Returns 0 on set ok, or 3 if the client encoding could not be set
|
||||
*
|
||||
* @param string $db_encoding
|
||||
* @return int Returns 0 for no error
|
||||
* [not used] 1 for check query failed
|
||||
|
||||
@@ -16,7 +16,7 @@ class FileWriter
|
||||
/** @var string */
|
||||
private static $debug_folder;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set a debug log folder, if not set BASE+LOG folders are set
|
||||
* if they are defined
|
||||
* This folder name must exist and must be writeable
|
||||
@@ -60,6 +60,7 @@ class FileWriter
|
||||
|
||||
/**
|
||||
* writes a string to a file immediatly, for fast debug output
|
||||
*
|
||||
* @param string $string string to write to the file
|
||||
* @param boolean $enter default true, if set adds a linebreak \n at the end
|
||||
* @return bool True for log written, false for not wirrten
|
||||
|
||||
@@ -17,6 +17,7 @@ class System
|
||||
|
||||
/**
|
||||
* helper function for PHP file upload error messgaes to messge string
|
||||
*
|
||||
* @param int $error_code integer _FILE upload error code
|
||||
* @return string message string, translated
|
||||
*/
|
||||
@@ -53,6 +54,7 @@ class System
|
||||
|
||||
/**
|
||||
* get the host name without the port as given by the SELF var
|
||||
*
|
||||
* @return array<mixed> host name/port name
|
||||
*/
|
||||
public static function getHostName(): array
|
||||
@@ -64,6 +66,7 @@ class System
|
||||
|
||||
/**
|
||||
* get the page name of the curronte page
|
||||
*
|
||||
* @param int $strip_ext WITH_EXTENSION: keep filename as is (default)
|
||||
* NO_EXTENSION: strip page file name extension
|
||||
* FULL_PATH: keep filename as is, but add dirname too
|
||||
|
||||
@@ -37,6 +37,7 @@ class FileReader
|
||||
|
||||
/**
|
||||
* file read constructor
|
||||
*
|
||||
* @param string $filename file name to load
|
||||
*/
|
||||
public function __construct(string $filename)
|
||||
@@ -55,6 +56,7 @@ class FileReader
|
||||
|
||||
/**
|
||||
* read byte data length
|
||||
*
|
||||
* @param int $bytes how many bytes to read
|
||||
* @return string read data as string
|
||||
*/
|
||||
@@ -83,6 +85,7 @@ class FileReader
|
||||
|
||||
/**
|
||||
* seek to a position in the file
|
||||
*
|
||||
* @param int $pos position where to go to
|
||||
* @return int file position after seek done
|
||||
*/
|
||||
@@ -98,6 +101,7 @@ class FileReader
|
||||
|
||||
/**
|
||||
* get current position in file
|
||||
*
|
||||
* @return int current position in bytes
|
||||
*/
|
||||
public function currentpos(): int
|
||||
@@ -107,6 +111,7 @@ class FileReader
|
||||
|
||||
/**
|
||||
* file length/size
|
||||
*
|
||||
* @return int file size in bytes
|
||||
*/
|
||||
public function length(): int
|
||||
@@ -116,6 +121,7 @@ class FileReader
|
||||
|
||||
/**
|
||||
* close open file handler
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function close(): void
|
||||
|
||||
@@ -38,6 +38,7 @@ class StreamReader
|
||||
|
||||
/**
|
||||
* should return a string [FIXME: perhaps return array of bytes?]
|
||||
*
|
||||
* @param int $bytes bytes to read
|
||||
* @return bool dummy false
|
||||
*/
|
||||
@@ -48,6 +49,7 @@ class StreamReader
|
||||
|
||||
/**
|
||||
* should return new position
|
||||
*
|
||||
* @param int $position seek to position
|
||||
* @return bool dummy false
|
||||
*/
|
||||
@@ -58,6 +60,7 @@ class StreamReader
|
||||
|
||||
/**
|
||||
* returns current position
|
||||
*
|
||||
* @return bool dummy false
|
||||
*/
|
||||
public function currentpos(): bool
|
||||
@@ -67,6 +70,7 @@ class StreamReader
|
||||
|
||||
/**
|
||||
* returns length of entire stream (limit for seekto()s)
|
||||
*
|
||||
* @return bool dummy false
|
||||
*/
|
||||
public function length(): bool
|
||||
|
||||
@@ -33,6 +33,7 @@ class StringReader
|
||||
|
||||
/**
|
||||
* constructor for string reader
|
||||
*
|
||||
* @param string $str basic string
|
||||
*/
|
||||
public function __construct(string $str = '')
|
||||
@@ -43,6 +44,7 @@ class StringReader
|
||||
|
||||
/**
|
||||
* read bytes in string
|
||||
*
|
||||
* @param int $bytes bytes to read in string
|
||||
* @return string data read in length of bytes as string
|
||||
*/
|
||||
@@ -59,6 +61,7 @@ class StringReader
|
||||
|
||||
/**
|
||||
* go to position in string
|
||||
*
|
||||
* @param int $pos position in string
|
||||
* @return int new position in string after seek
|
||||
*/
|
||||
@@ -73,6 +76,7 @@ class StringReader
|
||||
|
||||
/**
|
||||
* get current position in string
|
||||
*
|
||||
* @return int position in string
|
||||
*/
|
||||
public function currentpos(): int
|
||||
@@ -82,6 +86,7 @@ class StringReader
|
||||
|
||||
/**
|
||||
* get length of string
|
||||
*
|
||||
* @return int return length of assigned string
|
||||
*/
|
||||
public function length(): int
|
||||
|
||||
@@ -12,6 +12,7 @@ class Elements
|
||||
{
|
||||
/**
|
||||
* print the date/time drop downs, used in any queue/send/insert at date/time place
|
||||
*
|
||||
* @param int $year year YYYY
|
||||
* @param int $month month m
|
||||
* @param int $day day d
|
||||
@@ -22,8 +23,9 @@ class Elements
|
||||
* also used for ID in the on change JS call
|
||||
* @param int $min_steps default is 1 (minute), can set to anything,
|
||||
* is used as sum up from 0
|
||||
* @param bool $name_pos_back default false, if set to true, the name will be printend
|
||||
* after the drop down and not before the drop down
|
||||
* @param bool $name_pos_back default false, if set to true,
|
||||
* the name will be printend after the drop down
|
||||
* and not before the drop down
|
||||
* @return string HTML formated strings for drop down lists of date and time
|
||||
*/
|
||||
public static function printDateTime(
|
||||
@@ -132,9 +134,11 @@ class Elements
|
||||
}
|
||||
|
||||
/**
|
||||
* tries to find mailto:user@bubu.at and changes it into -> <a href="mailto:user@bubu.at">E-Mail senden</a>
|
||||
* tries to find mailto:user@bubu.at and changes it into ->
|
||||
* <a href="mailto:user@bubu.at">E-Mail senden</a>
|
||||
* or tries to take any url (http, ftp, etc) and transform it into a valid URL
|
||||
* the string is in the format: some url|name#css|, same for email
|
||||
*
|
||||
* @param string $string data to transform to a valid HTML url
|
||||
* @param string $target target string, default _blank
|
||||
* @return string correctly formed html url link
|
||||
@@ -202,7 +206,8 @@ class Elements
|
||||
$output
|
||||
) ?: '';
|
||||
|
||||
// we have one slashes after the Protocol -> internal link no domain, strip out the proto
|
||||
// we have one slashes after the Protocol ->
|
||||
// internal link no domain, strip out the proto
|
||||
// $output = preg_replace("/($protRegex)\/(.*)/e", "\\2", $ouput);
|
||||
|
||||
// post processing
|
||||
@@ -217,6 +222,7 @@ class Elements
|
||||
/**
|
||||
* internal function, called by the magic url create functions.
|
||||
* checks if title $_4 exists, if not, set url as title
|
||||
*
|
||||
* @param string $href url link
|
||||
* @param string $atag anchor tag (define both type or url)
|
||||
* @param string $_1 part of the URL, if atag is set, _1 is not used
|
||||
@@ -253,6 +259,7 @@ class Elements
|
||||
|
||||
/**
|
||||
* internal function for createing email, returns data to magic_url method
|
||||
*
|
||||
* @param string $mailto email address
|
||||
* @param string $atag atag (define type of url)
|
||||
* @param string $_1 parts of the email _1 before @, 3_ tld
|
||||
|
||||
@@ -299,6 +299,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* construct form generator
|
||||
*
|
||||
* @param array<mixed> $db_config db config array, mandatory
|
||||
* @param \CoreLibs\Debug\Logging|null $log Logging class, null auto set
|
||||
* @param \CoreLibs\Language\L10n|null $l10n l10n language class, null auto set
|
||||
@@ -463,6 +464,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* dumps all values into output (for error msg)
|
||||
*
|
||||
* @return string full table array data output as string html formatted
|
||||
*/
|
||||
public function formDumpTableArray()
|
||||
@@ -482,6 +484,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
* the value of the $want_key array field
|
||||
* works only with fields that appear only ONCE
|
||||
* if multiple gets only FIRST
|
||||
*
|
||||
* @param string $want_key key to search for
|
||||
* @param string|null $key_value value to match to (optional)
|
||||
* @return string|null returns key found or empty string
|
||||
@@ -505,6 +508,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* array of fields
|
||||
*
|
||||
* @param string $want_key the key where you want the data from
|
||||
* @param string|null $key_value if set searches for special right value
|
||||
* @return array<mixed> found key fields
|
||||
@@ -529,6 +533,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* formated output for the error && warning msg
|
||||
*
|
||||
* @return array<string,string|int> error message with msg, width, clas
|
||||
*/
|
||||
public function formPrintMsg(): array
|
||||
@@ -550,6 +555,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// next for functions are pre_test fkts for easier default new,load, etc handling
|
||||
/**
|
||||
* default load procedure
|
||||
*
|
||||
* @param string $archive_id archive id to load
|
||||
* @return void has no return
|
||||
*/
|
||||
@@ -568,6 +574,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* default new procedure
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formProcedureNew(): void
|
||||
@@ -589,6 +596,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* default save procedure
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formProcedureSave(): void
|
||||
@@ -608,6 +616,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* default delete procedure
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formProcedureDelete(): void
|
||||
@@ -634,6 +643,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* default delete procedure
|
||||
*
|
||||
* @param array<mixed> $element_list element array that should be removed
|
||||
* @param array<mixed> $remove_name key names that should be removed
|
||||
* @return void has no return
|
||||
@@ -732,6 +742,8 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* create the load list and return it as an array
|
||||
*
|
||||
*
|
||||
* @return array<string,mixed> load list array with primary key, name and selected entry
|
||||
*/
|
||||
public function formCreateLoad(): array
|
||||
@@ -794,6 +806,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* Create new entry element for HTML output
|
||||
*
|
||||
* @param bool $hide_new_checkbox show or hide the new checkbox, default is false
|
||||
* @return array<string,string|int> return the new create array with name & checkbox show flag
|
||||
*/
|
||||
@@ -879,6 +892,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* create a form element based on the settings in the element array entry
|
||||
*
|
||||
* @param string $element_name the name from the array, you want to have build
|
||||
* @param string|null $query can overrule internal query data,
|
||||
* for drop down, as data comes from a reference table
|
||||
@@ -1120,6 +1134,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
* should be cought like this ...
|
||||
* if ($msg = $form->form_error_check())
|
||||
* $error=1;
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formErrorCheck(): void
|
||||
@@ -1530,6 +1545,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* sets the order to the maximum, if order flag is set in array
|
||||
*
|
||||
* @return array<mixed> table array with set order number
|
||||
*/
|
||||
public function formSetOrder(): array
|
||||
@@ -1569,6 +1585,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* resets all values in table_array and in the reference tables
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function formUnsetTableArray(): void
|
||||
@@ -1601,6 +1618,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* load a table & reference
|
||||
*
|
||||
* @param string|null $pk_id overrule pk_id
|
||||
* @return void has no return
|
||||
*/
|
||||
@@ -1644,6 +1662,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
* save a table, reference and all input fields
|
||||
* note that the addslashes flag here is passed on to the dbWrite method
|
||||
* it only does html conversion, add slashes for DB is done automatically
|
||||
*
|
||||
* @param bool $addslashes override internal addslasahes flag (default false)
|
||||
* @return void has no return
|
||||
*/
|
||||
@@ -2036,6 +2055,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* delete a table and reference fields
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function formDeleteTableArray()
|
||||
@@ -2081,6 +2101,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* creates HTML hidden input fields out of an hash array
|
||||
*
|
||||
* @param array<mixed> $hidden_array The list of fields to be added as hidden
|
||||
* @return array<mixed> key -> value list of hidden fileds data
|
||||
*/
|
||||
@@ -2114,6 +2135,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
|
||||
/**
|
||||
* creates the multiple select part for a reference_table
|
||||
*
|
||||
* @param string $table_name Table name for reference array lookup
|
||||
* @return array<string,mixed> Reference table output array
|
||||
*/
|
||||
@@ -2151,6 +2173,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
* this currently only works for a list that is filled from a sub table and creates
|
||||
* only a connection to this one new version will allow a sub list with free input
|
||||
* fields to directly fill a sub table to a master table
|
||||
*
|
||||
* @param string $table_name Which element entry to create
|
||||
* @return array<string,mixed> Element for html creation
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ class Token
|
||||
{
|
||||
/**
|
||||
* sets a form token in a session and returns form token
|
||||
*
|
||||
* @param string $name optional form name, default form_token
|
||||
* @return string token name for given form id string
|
||||
*/
|
||||
@@ -26,6 +27,7 @@ class Token
|
||||
|
||||
/**
|
||||
* checks if the form token matches the session set form token
|
||||
*
|
||||
* @param string $token token string to check
|
||||
* @param string $name optional form name to check to, default form_token
|
||||
* @return bool false if not set, or true/false if matching or not mtaching
|
||||
|
||||
@@ -12,11 +12,14 @@ class Image
|
||||
{
|
||||
/**
|
||||
* converts picture to a thumbnail with max x and max y size
|
||||
*
|
||||
* @param string $pic source image file with or without path
|
||||
* @param int $size_x maximum size width
|
||||
* @param int $size_y maximum size height
|
||||
* @param string $dummy empty, or file_type to show an icon instead of nothing if file is not found
|
||||
* @param string $path if source start is not ROOT path, if empty ROOT is choosen
|
||||
* @param string $dummy empty, or file_type to show an icon
|
||||
* instead of nothing if file is not found
|
||||
* @param string $path if source start is not ROOT path,
|
||||
* if empty ROOT is choosen
|
||||
* @param string $cache_source cache path, if not given TMP is used
|
||||
* @param bool $clear_cache if set to true, will create thumb all the tame
|
||||
* @return string|bool thumbnail name, or false for error
|
||||
@@ -154,6 +157,7 @@ class Image
|
||||
* the resize is to max of one size
|
||||
* if both are set, those are the max sizes (aspect ration is always ekpt)
|
||||
* - if path is not given will cache folder for current path set
|
||||
*
|
||||
* @param string $filename source file name with full path
|
||||
* @param int $thumb_width thumbnail width
|
||||
* @param int $thumb_height thumbnail height
|
||||
@@ -162,7 +166,8 @@ class Image
|
||||
* create a dummy image file and return it
|
||||
* @param bool $use_cache default to true, set to false to skip
|
||||
* creating new image if exists
|
||||
* @param bool $high_quality default to true, uses sample version, set to false
|
||||
* @param bool $high_quality default to true, uses sample version,
|
||||
* set to false to not use (default true)
|
||||
* to use quick but less nice version
|
||||
* @param int $jpeg_quality default 80, set image quality for jpeg only
|
||||
* @return string|bool thumbnail with path
|
||||
@@ -416,6 +421,7 @@ class Image
|
||||
* reads the rotation info of an file and rotates it to be correctly upright
|
||||
* this is done because not all software honers the exit Orientation flag
|
||||
* only works with jpg or png
|
||||
*
|
||||
* @param string $filename path + filename to rotate. This file must be writeable
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -109,6 +109,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* progress bar constructor
|
||||
*
|
||||
* @param integer $width progress bar width, default 0
|
||||
* @param integer $height progress bar height, default 0
|
||||
*/
|
||||
@@ -130,6 +131,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* flush cache hack for IE and others
|
||||
*
|
||||
* @param integer $clear_buffer_size buffer size override
|
||||
* @return void has not return
|
||||
*/
|
||||
@@ -146,6 +148,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* [__calculatePercent description]
|
||||
*
|
||||
* @param float $step percent step to do
|
||||
* @return float percent step done
|
||||
*/
|
||||
@@ -164,6 +167,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* calculate position in bar step
|
||||
*
|
||||
* @param float $step percent step to do
|
||||
* @return array<string,int|float> bar position as array
|
||||
*/
|
||||
@@ -224,6 +228,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* set the step
|
||||
*
|
||||
* @param float $step percent step to do
|
||||
* @return void
|
||||
*/
|
||||
@@ -241,6 +246,7 @@ class ProgressBar
|
||||
// public functions
|
||||
/**
|
||||
* set frame layout
|
||||
*
|
||||
* @param integer $width bar width
|
||||
* @param integer $height bar height
|
||||
* @return void
|
||||
@@ -269,6 +275,7 @@ class ProgressBar
|
||||
/**
|
||||
* set bar label text
|
||||
* allowed types are: text, button, step, percent, percentlbl, crossbar
|
||||
*
|
||||
* @param string $type label type
|
||||
* @param string $name label name (internal)
|
||||
* @param string $value label output name (optional)
|
||||
@@ -374,6 +381,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* add a button to the progress bar
|
||||
*
|
||||
* @param string $name button name (internal)
|
||||
* @param string $value button text (output)
|
||||
* @param string $action button action (link)
|
||||
@@ -389,6 +397,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* set the label position
|
||||
*
|
||||
* @param string $name label name to set
|
||||
* @param int $left left px
|
||||
* @param int $top top px
|
||||
@@ -439,6 +448,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* set label color
|
||||
*
|
||||
* @param string $name label name to set
|
||||
* @param string $color color value in rgb html hex
|
||||
* @return void
|
||||
@@ -455,6 +465,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* set the label background color
|
||||
*
|
||||
* @param string $name label name to set
|
||||
* @param string $color background color to set in rgb html hex
|
||||
* @return void
|
||||
@@ -471,6 +482,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* [setLabelFont description]
|
||||
*
|
||||
* @param string $name label name to set
|
||||
* @param int $size font size in px
|
||||
* @param string $family font family (default empty)
|
||||
@@ -521,7 +533,8 @@ class ProgressBar
|
||||
}
|
||||
|
||||
/**
|
||||
* set the label valeu
|
||||
* set the label value
|
||||
*
|
||||
* @param string $name label name to set
|
||||
* @param string $value label value (output)
|
||||
* @return void
|
||||
@@ -539,6 +552,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* set the bar color
|
||||
*
|
||||
* @param string $color color for the progress bar in rgb html hex
|
||||
* @return void
|
||||
*/
|
||||
@@ -554,6 +568,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* set the progress bar background color
|
||||
*
|
||||
* @param string $color background color in rgb html hex
|
||||
* @return void
|
||||
*/
|
||||
@@ -569,6 +584,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* progress bar direct (left/right)
|
||||
*
|
||||
* @param string $direction set direction as left/right
|
||||
* @return void
|
||||
*/
|
||||
@@ -591,6 +607,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* get the progress bar base HTML
|
||||
*
|
||||
* @return string progress bar HTML code
|
||||
*/
|
||||
public function getHtml(): string
|
||||
@@ -780,6 +797,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* show the progress bar after initialize
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function show(): void
|
||||
@@ -792,6 +810,7 @@ class ProgressBar
|
||||
/**
|
||||
* move the progress bar by one step
|
||||
* prints out javascript to move progress bar
|
||||
*
|
||||
* @param float $step percent step
|
||||
* @return void has no return
|
||||
*/
|
||||
@@ -851,6 +870,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* moves progress bar by one step (1)
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function moveNext(): void
|
||||
@@ -860,6 +880,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* moves the progress bar back to the beginning
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function moveMin(): void
|
||||
@@ -869,6 +890,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* hide the progress bar if it is visible
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function hide(): void
|
||||
@@ -888,6 +910,7 @@ class ProgressBar
|
||||
|
||||
/**
|
||||
* show progress bar again after it was hidden with hide()
|
||||
*
|
||||
* @return void has no return
|
||||
*/
|
||||
public function unhide(): void
|
||||
|
||||
@@ -156,6 +156,7 @@ class SmartyExtend extends \Smarty
|
||||
* constructor class, just sets the language stuff
|
||||
* calls L10 for pass on internaly in smarty
|
||||
* also registers the getvar caller plugin
|
||||
*
|
||||
* @param \CoreLibs\Language\L10n $l10n l10n language class
|
||||
* @param array<string,string> $locale locale data read from setLocale
|
||||
*/
|
||||
@@ -250,6 +251,7 @@ class SmartyExtend extends \Smarty
|
||||
|
||||
/**
|
||||
* sets all internal paths and names that need to be passed on to the smarty template
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSmartyPaths(): void
|
||||
@@ -344,6 +346,7 @@ class SmartyExtend extends \Smarty
|
||||
/**
|
||||
* wrapper call for setSmartyVars
|
||||
* this is for frontend type and will not set any only admin needed variables
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSmartyVarsFrontend(): void
|
||||
@@ -362,6 +365,7 @@ class SmartyExtend extends \Smarty
|
||||
|
||||
/**
|
||||
* set smarty pass on variables, sub template names and finally calls the smarty parser
|
||||
*
|
||||
* @param boolean $admin_call default false, will set admin only variables
|
||||
* @return void
|
||||
*/
|
||||
@@ -472,6 +476,7 @@ class SmartyExtend extends \Smarty
|
||||
|
||||
/**
|
||||
* merge outside object HEADER/DATA/DEBUG_DATA vars into the smarty class
|
||||
*
|
||||
* @param object $cms object that has header/data/debug_data
|
||||
* @return void
|
||||
*/
|
||||
@@ -490,6 +495,7 @@ class SmartyExtend extends \Smarty
|
||||
|
||||
/**
|
||||
* render smarty data (can be called sepparate)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function renderSmarty(): void
|
||||
|
||||
Reference in New Issue
Block a user