Global Functions

booleanisCurrentRequestSSL()
Returns true if current request is through SSL, whether it is through a proxy load balancer or not
string___(string $s)
Returns a translated text in current language
string___S(string $s)
Returns a HTML-encoded string, translated in current language
intget_schlix_max_user_session_time()
Get maximum login time
intget_schlix_max_user_remember_cookie_time()
Get maximum remember me cookie time in seconds
stringget_random_token(int $length=16)
Generate random token
generate_salt($hash_type, $work_factor=9)
get_skin_module($skin_name)
get_current_skin_module()
Get current skin module
stringskin_html(string $html, array $vars, array $allowed_namespaces=['x-ui'])
Skin HTML
arrayget_all_skin_modules()
Returns a list of available skin
booleanis_value_true(string $string)
Returns true if a variable == true or > 0
typefix_xhtml(type $html)
Fix self closing XHTML tags
get_file_permissions(type $path)
Get readable file permissions
___u(string $path)
Return URL encode path
int___c(array $object)
Return the count of an array without emitting a PHP warning (PHP 7.2 compat)
stringencode_path(string $url)
Raw URL encode a path
stringdecode_path(string $url)
Raw URL decode a path
stringget_remote_file_content(string $url, bool $use_default_user_agent=true, bool $ignore_ssl_ca=false)
Get remote file content with CURL
start_output_buffer($clean_first=false)
Start output buffering
stringend_output_buffer()
End output buffering and return string
string___h(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
stringSAFE_HTML(string $s, int $maxlen)
Alias of ___h/ Deprecated for an easier to remember function name. Use ___h. String output sanitizing function to ensure there's no XSS in the text. If maxlen is specified then it will be limited to maxlen. To be removed in v2.3.x-x Deprecatedsince version 2.1.6-2 since version 2.1.6-2
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
stringtime_since(int $time_since)
http://stackoverflow.com/questions/18685/how-to-display-12-minutes-ago-etc-in-a-php-webpage
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
get_class_ancestors($class)
stringget_user_real_ip_address()
Returns a user's real IP address. Probes for proxy if the CMS is behind a load balancer.
stringget_user_browser_string()
Returns the user's browser string limited to 255 chars
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
stringforce_https_url()
Force URL to be HTTPS if the site's SSL variable is enabled and HTTPS URL is defined inthe subsite configuration
stringset_csrf_token()
Setthe CSRF token if none
stringget_csrf_token()
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
check_csrf_halt_on_error($is_ajax=false)
typeget_simplified_file_hash(type $filename)
Simple file hash
typeis_readable_file(type $filename)
Check if file is readable and is a file
booleanis_valid_image_file(string $filename, string $check_filename=true)
Returns true if image file is valid
booleanis_valid_uploaded_image_file(string $tmp_filename, string $uploaded_filename)
Returns true if image is valid (beta)
typerecord_404_error()
Record 404 error $SystemDB
display_http_error($error_number)
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'
display_schlix_alert($error)
Adds an error string that will be displayed when the page loads again next time
clear_schlix_alert()
Clear error string
boolis_serialized(string $string)
Returns true if the input string is serialized
stringnew_uuid_v4()
Generates a new UUIDv4 Source Credit: copied and pasted this from http://php.net/manual/en/function.uniqid.php
boolis_valid_guid(string $guid)
Returns true if format is valid GUID
get_application_alias($app, $subclass=NULL)
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
boolis_captcha_verification_valid()
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
quote_field_name_for_query($item_field)
quote_array_of_field_names_for_query($item_fields)
stringalpha_numeric_with_underscore(string $str, string $replacement='-')
Returns alphanumeric of string with _ (underscore) allowed
stringalpha_numeric_with_dash_underscore(string $str, string $replacement='-')
Returns alphanumeric of string with - (dash) and _ (underscore) allowed
stringsanitize_action_command(string $str)
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
convert_to_safe_basename($str, $max_len, $default_empty='untitled', $allow_utf8=true)
typemb_pathinfo(type $filepath)
Alternative pathinfo
stringconvert_to_safe_filename($str, $default_empty_ext='')
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
inttime_difference(string $start_date, string $end_date)
Returns the number of seconds between start_date and end_date
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
stringget_current_datetime()
Return string of current date in ISO-8601 format
typeis_valid_email_address(type $email)
Returns true if email address is valid
boolverify_email_dns(string $email)
Returns true if email address is DNS verified with the MX record
arrayselect_http_post_variables()
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
boolis_ajax_request()
Returns true if this request is AJAX
boolis_postback()
Returns true if it's a postback ... similar to ASP.NET's isPostBack()
stringreal_strip_tags(string $i_html, array $i_allowedtags=[], bool $i_trimtext=FALSE)
Perform a real strip tag. Function copied from php.net
boolcreate_generic_directory(string $dir, $permission=0755, $recursive=true)
Create directory with permission 0755 if not exist
stringunix_slash(string $f)
Replaces Windows \ with /
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
ajax_reply_invalid_method($method_name)
ajax_reply_ok_redirect($success_message=null, $url_redirect='')
ajax_reply_ok_message($success_message=null)
ajax_reply_ok($data=null)
ajax_reply_error($data=null)
string echo ajax reply and return false (RETURN AS AJAX)ajax_echo(string $s)
AJAX - reply with error string $s string string
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
__convert_unit_prefix_to_bytes($val)
Converts unit in Giga, mega, or kilo to bytes e.g. 1M, 2G, 30K etc
intget_real_max_upload_size()
Returns max upload size in bytes
stringget_calling_class_function()
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
intfget_uint(string $varname)
Returns $_GET variable as an unsigned integer
intfpost_int(string $varname)
Returns $_POST variable as an integer
intfpost_uint(string $varname)
Returns $_POST variable as an unsigned 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]
intfpost_date_combobox(string $varname)
Returns $_POST variable as an integer
rate_limit_record(string $action, string $detail_string, int $period=3600)
Record a rate limit action $SystemDB
boolrate_limit_count(string $action, int $period=3600)
Returns action count for a certain action $SystemDB
boolrate_limit_exceeded(string $action, int $max_retry, int $period=3600)
Returns true if rate limit for a certain action has been exceeded
boolrate_limit_and_halt(string $action, int $max_soft_retry, int $max_hard_retry=50, int $period=3600)
Check if rate limit for a certain action has been exceeded. Upon the first hit of soft retry number, captcha should be displayed. When hard retry count has been exceeded, the system will automatically halt it. Max retry is set at a very generous number = 50
arraystrip_array_column(array $data, array $fields_to_strip)
Strip array column
get_sorted_timezone_data()
force_download_file($filename, $override_filename='')