Global Functions

Initializes SCHLIX runtime
Returns true if current request is through SSL, whether it is through a proxy load balancer or not
string___(string $str)
TODO: translation (v2.4.x) translation
upgrade_schlix(string $from_version, string $db_host, string $db_database, string $db_username, string $db_password)
Upgrade end v2.0.3
set_db_to_current_version(\SCHLIX\cmsDatabase $mydb)
Update version
stringget_remote_file_content(string $url, bool $use_default_user_agent=true)
Get remote file content with CURL
Start output buffering
End output buffering and return string
stringSAFE_HTML(string $s, int $maxlen)
String output sanitizing function to ensure there's no XSS in the text. If maxlen is specified then it will be limited to maxlen
stringformat_nice_date(string $the_date, bool $display_time=false)
Converts a datetime or a UNIX date and return it in the format of year-month-day time
booleanstr_starts_with(string $haystack, string $needle)
Returns true if haystack starts with needle
booleanstr_ends_with(string $haystack, string $needle)
Returns true if haystack ends with needle
booleanstr_contains(string $haystack, string $needle)
Returns true if haystack contains needle
stringstr_limit(string $str, int $maxlen)
Returns string value of $str and if the length is greater than maxlen then it will be trimmed
Returns a user's real IP address. Probes for proxy if the CMS is behind a load balancer.
get_system_or_user_file($filename, $die=true)
get_system_or_user_url_path($filename, $die=true)
stringget_application_real_name_by_alias(string $alias)
Returns the application real name, given the alias as defined in the application configuration page $SystemDB
stringprevent_duplicate_filename_in_folder(string $folder, string $original_filename)
Returns a new, non-duplicate filename
Force URL to be HTTPS if the site's SSL variable is enabled and HTTPS URL is defined inthe subsite configuration
Setthe CSRF token if none
Returns the CSRF token
boolis_valid_csrf(array $datavalues=NULL)
Check if the variable _csrftoken matches with the currently set token. If the array is not specified, then $_POST will be used
Record 404 error and redirect $SystemDB
Display HTTP Error (e.g. 404, 400, etc). Internal use only
stringget_js_csrf_var(string $varname='_csrftoken')
Returns a Javascript variable that contains csrftoken string e.g. var variable_name = '1231351232asdasd'
Adds an error string that will be displayed when the page loads again next time
Clear error string
boolis_serialized(string $string)
Returns true if the input string is serialized
Generates a new UUIDv4 Source Credit: copied and pasted this from
redirect_url(string $url)
Redirect URL
encode_url(string $path)
Return URL encode
arrayget_list_of_all_apps(bool $use_cache=false, int $cache_how_many_minutes=5)
Returns a list of all applications type $SystemConfig
Returns true if Captcha is valid
stringconvert_pasted_png_images_from_html_text(string $txt, string $upload_path, string $url_path, string $filename_prefix='img')
Converts data:image/png;base64 from text to image $SystemLog
stringmove_static_external_images_from_html_text(string $txt, string $upload_path, string $url_path)
Search for all external images hosted outside of this URL in this HTML text to a local one. If the file already exists with the same name then it will be ignored
stringalpha_numeric_with_dash_underscore(string $str, string $replacement='-')
Returns alphanumeric of string with - (dash) and _ (underscore) allowed
stringalpha_numeric_only(string $str, string $replacement='')
Like alpha_numeric_with_dash_underscore but without - (dash) and (underscore) allowed
stringconvert_to_safe_filename(string $s)
Converts a string to safe filename
stringconvert_into_sef_friendly_title(string $str, bool $allow_utf8=true)
Converts a string to an alphanumeric one (dash and underscores allowed). This is mainly used to convert a title page to virtual filename
intdays_difference(string $start_date, string $end_date)
Returns the day numbers between start_date and end_date
intdays_difference_from_today(string $the_date)
Returns the number of day difference from today
Return string of current date in ISO-8601 format
boolverify_email_dns(string $email)
Returns true if email address is DNS verified with the MX record
Select HTTP POST Variables. Useful to filter variables based on table names
arrayconvert_array_values_to_keys(array $array, mixed $fill=1)
Convert array values to keys and fill it with number
stringremove_multiple_slashes(string $str)
Remove multiple slashes from string.
stringsanitize_string(string $value, bool $dont_add_quotes=false)
Sanitize string - SQL $SystemDB
boolis_date(object $date, string $format='Y-m-d H:i:s')
Returns true if input is in date format
Returns true if this request is AJAX
Returns true if it's a postback ... similar to ASP.NET's isPostBack()
stringreal_strip_tags(string $i_html, array $i_allowedtags=array(), bool $i_trimtext=FALSE)
Perform a real strip tag. Function copied from
boolcopy_recursive(string $source, string $dest)
Copy recursive from source to destination
sort_associative_array_by_key(array $array, string $subkey, int $sortType=SORT_ASC)
Sort an associative array by key
stringajax_reply(int $status, array $data)
Returns a JSON-encoded string of reply. Set status to 200 for ok
stringajax_echo(string $s)
echo ajax reply and return false (RETURN AS AJAX)
stringajax_datasource_reply(int $status, int $allRecords, int $start, int $end, int $item_per_page, int $total_item_count, string $sort=null, string $dir='asc')
Returns a JSON-encoded array of message for datasource in SCHLIX.UI.DataTable
booleanis_animated_gif(string $filename)
Returns true if the file is an animated gif
booleancreate_image_thumbnail(string $src, string $dest, int $thumb_width=120, int $thumb_height=120, bool $dont_resize_if_smaller=false, int $quality=100)
Create an image thumbnail. If dont_resize_if_smaller flag is specified and the source image is smaller than the specified thumbnail width and height then it will just be copied. Quality is a number between 1 - 100
booleancreate_htaccess_restrict_view(string $folder)
Create .htaccess and web.config to restrict folder viewing
create_directory_if_not_exists($main_folder, $log_if_error=false)
booleancreate_site_skeleton(string $prefix, string $sitename)
Create sub-site folder skeleton. Prefix is usually SCHLIX_SITE_HTTPBASE
stringnormalize_file_path(string $path)
Returns a UNIX-style file path (with forward slash /) and remove multiple slashes.
stringremove_prefix_from_file_name(string $filename, string $prefix)
This function is an alias of remove_prefix_from_string. This function is used to determine the base path of a URL. e.g. $filename = /var/www/html, $prefix = /var then it would return /www/html
stringremove_prefix_from_string(string $str, string $prefix)
Remove leading prefix from a string.
__force_change_site_httpbase($str_old_httpbase, $str_new_httpbase)
This is a function designed to replace the base path. Not intended to be called during page exection. However $SystemDB must be initialized. Please call setupSchlixRuntime() before executing this function
booleancreate_image_thumbnail_with_watermark(string $fileSrc, string $thumbDest, string $watermarkSrc, int $thumb_width=120, int $thumb_height=120)
Create an image with watermark (usually PNG watermark)
Converts unit in Giga, mega, or kilo to bytes e.g. 1M, 2G, 30K etc
Returns max upload size in bytes
Get the class and function name that called the current method
boolfget_bool(string $varname)
Returns $_GET variable as a boolean
boolfpost_bool(string $varname)
Returns $_POST variable as a boolean
string|intfget_alphanumeric(string $varname, int $limit)
Returns $_GET variable as alphanumeric
intfpost_alphanumeric(string $varname, $limit)
Returns $_POST variable as alphanumeric
intfget_int(string $varname)
Returns $_GET variable as an integer
intfpost_int(string $varname)
Returns $_POST variable as an integer
intfget_float(string $varname)
Returns $_GET variable as a float number
intfpost_float(string $varname)
Returns $_POST variable as a float number
intfget_double(string $varname)
Returns $_GET variable as adouble
intfpost_double(string $varname)
Returns $_POST variable as double
stringfget_string(string $varname, int $limit)
Returns the value of $_GET[$varname], limited to $limit
stringfpost_string(string $varname, int $limit)
Returns the value of $_POST[$varname], limited to $limit
stringfget_string_notags(string $varname, int $limit)
Returns the value of $_GET[$varname], limited to $limit
stringfpost_string_notags(string $varname, int $limit)
Returns the value of $_POST[$varname], limited to $limit
stringfget_string_noquotes_notags(string $varname, int $limit)
Returns the value of $_GET[$varname], limited to $limit
stringfpost_string_noquotes_notags(string $varname, int $limit)
Returns the value of $_POST[$varname], limited to $limit
stringfget_filename_only(string $varname)
Returns a sanitized filename from $_GET[$varname]
stringfpost_filename_only(string $varname)
Returns a sanitized filename from $_POST[$varname]
stringfget_filename_fullpath(string $varname)
Returns a sanitized full path from $_GET[$varname]
stringfpost_filename_fullpath(string $varname)
Returns a sanitized full path from $_POST[$varname]
arrayfpost_array_any(string $varname)
Returns array from $_POST[$varname]
arrayfpost_array_int(string $varname)
Returns array of int from $_POST[$varname]