AppGini PHP functions reference
_toUTF8addFilteraddMailRecipientsapp_datetimeapp_datetime_formatapplication_uriapplication_urlassocArrFilterbacktick_keys_oncebgStyleToClassbootstrapSQLSelectbootstrapSelectbr2nlbreakpointcalculated_fieldscheckAppRequirementscheckPermissionValcheck_record_permissionclearFiltersconfigconfigure_admin_groupconfigure_anonymous_groupconvertLegacyOptionscreateQueryLogTablecreateThumbnailcsrf_tokencurl_batchcurl_insert_handlerdb_affected_rowsdb_closedb_connectdb_errnodb_errordb_escapedb_fetch_arraydb_fetch_assocdb_fetch_rowdb_field_namedb_field_typedb_insert_iddb_linkdb_num_fieldsdb_num_rowsdb_querydb_select_dbdefault_configdenyAccessdetect_configdieErrorPageentitiesToUTF8errorMsgerror_messageexisting_valuefrom_utf8func_get_args_byrefgetCSVDatagetLoggedAdmingetLoggedGroupIDgetLoggedMemberIDgetMemberInfogetPKFieldNamegetRecordgetTableListgetTablePermissionsgetThumbnailSpecsgetUploadDirgetUploadedFilegetUserDatagetValueGivenCaptionget_defaultsget_embedget_embed_googlemapget_group_idget_home_linksget_joined_recordget_parent_tablesget_pluginsget_propertyget_sql_fieldsget_sql_fromget_table_fieldsget_table_groupsget_table_keysget_tables_infoguessMySQLDateTimehandle_maintenancehtmlRadioGrouphtmlSQLSelecthtmlSelecthtmlUserBarhtml_attrhtml_attr_tags_okinitSessioninsertinvoke_methodinvoke_static_methodisEmailis_ajaxis_allowed_usernamejwt_check_loginjwt_headerjwt_keyjwt_tokenlatest_jqueryloadTableloadViewlogErrorQuerylogOutUserlogSlowQuerylookupQuerymaintenance_modemakeSafemembership_table_functionsmysql_datetimenavMenusnormalize_pathnotifyMemberApprovalopenDBConnectionparseCodeparseMySQLDateparseTemplatepassword_hardenpassword_matchpermissions_sqlpkGivenLookupTextprepareUploadedFileprepare_sql_setquick_search_htmlreIndexredirectrequest_cacherequest_outside_admin_foldersafe_htmlsave_configsendmailsetAnonymousAccesssetUserDataset_headersset_record_ownersetupMembershipsetupindexessetuptableshowNotificationssqlsqlValuestyleSheettestthisOrtime12time24toBytestoMySQLDateto_utf8updateupdate_calc_fieldsupdate_config_app_uriuserCanImportvalidMySQLDate
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
Back to top
addFilter
Syntax
addFilter (index, filterAnd, filterField, filterOperator, filterValue)
Description
Applies a filter to the current table by adding it to the
AppGini supports up to 80 filters grouped into 20 groups. When building the
$_REQUEST
global variable.AppGini supports up to 80 filters grouped into 20 groups. When building the
WHERE
clause of the table view, each filter group is wrapped in parentheses when combined with the next filter group.Parameters
index | Integer, the index of the filter being configured. Valid values are integers between 1 and 80. |
---|---|
filterAnd | String, how to combine the filter with previous ones. Valid values are and and or |
filterField | Integer, 1-based index of the field being filtered as determined by its order in the table inside the AppGini project. |
filterOperator | String, the comparison operator. Valid values: equal-to , not-equal-to , greater-than , greater-than-or-equal-to , less-than , less-than-or-equal-to , like , not-like , is-empty , is-not-empty . |
filterValue | String, the value to filter for. When using is-empty or is-not-empty operators, this value is ignored (you can just pass an empty string '' in that case. |
Return value
True on success or false on error.
Example(s)
// add this code to the tablename_init hook function // to apply a default filter displaying today's orders // assuming the index of the 'order_date' field is 5 addFilter(1, 'and', 5, 'equal-to', date(app_datetime_format()));
addMailRecipients
Syntax
addMailRecipients ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
app_datetime
Syntax
app_datetime ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
app_datetime_format
Syntax
app_datetime_format ([destination], [datetime])
Description
Returns the configured date or date/time format for this application.
Parameters
destination | Optional. String, the format type. Valid values are mysql , moment , phps or php |
---|---|
datetime | Optional. String, d to return date format, or dt to return datetime format. |
Return value
String, the date or date/time format string.
Example(s)
$phpDateFormat = app_datetime_format(); echo 'Today is ' . date($phpDateFormat); $phpDTFormat = app_datetime_format('php', 'dt'); echo 'Current date and time: ' . date($phpDTFormat);
application_uri
Syntax
application_uri ([page])
Description
Use this function to retrieve the URI (Uniform Resource Identifier) of a page inside the current AppGini app. See also application_url().
Parameters
page | Optional. String. Relative path of a page inside the AppGini app. |
---|---|
Return value
String. URI of the provided page, or app homepage if no page provided.
Example(s)
// Let's assume the URL of our AppGini app is // https://www.goodcompany.com/hr-app/ application_uri(); // => 'hr-app' application_uri('hooks/payroll-report.php'); // => 'hr-app/hooks/payroll-report.php'
application_url
Syntax
application_url ([page])
Description
Returns the absolute URL of the provided page, or the homepage URL if no page provided.
Parameters
page | Optional. String. A page relative to the current AppGini app path. |
---|---|
Return value
String. The absolute URL of the provided page.
Example(s)
// Let's assume the URL of our AppGini app is // https://www.goodcompany.com/hr-app/ application_url(); // => 'https://www.goodcompany.com/hr-app' application_url('hooks/payroll-report.php'); // => 'https://www.goodcompany.com/hr-app/hooks/payroll-report.php'
assocArrFilter
Syntax
assocArrFilter ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
backtick_keys_once
Syntax
backtick_keys_once ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
bgStyleToClass
Syntax
bgStyleToClass ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
bootstrapSQLSelect
Syntax
bootstrapSQLSelect ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
bootstrapSelect
Syntax
bootstrapSelect ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
br2nl
Syntax
br2nl (text)
Description
replaces all variations of HTML
tags with a new line character
tags with a new line character
Parameters
text | is the text which has tags |
---|---|
Return value
return text with new line instead of
Example(s)
echo br2nl("hello<br>all"); /* outputs: hello all */
breakpoint
Syntax
breakpoint ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
calculated_fields
Syntax
calculated_fields ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
checkAppRequirements
Syntax
checkAppRequirements ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
checkPermissionVal
Syntax
checkPermissionVal ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
check_record_permission
Syntax
check_record_permission (table, id, [perm])
Description
returns true if current user has the specified permission $perm (
view
, edit
or delete
) for the given record, false otherwiseParameters
table | is the table name |
---|---|
id | given record id |
perm | Optional. is one of the specified permission(view , edit or delete ) |
Return value
True if current user has the specified permission $perm (
view
, edit
or delete
) for the given recors, false otherwiseExample(s)
%EXAMPLE%
clearFilters
Syntax
clearFilters ()
Description
clear all filters
Parameters
Return value
None
Example(s)
%EXAMPLE%
config
Syntax
config (setting, [force_reload])
Description
Retrieves the configured value of the provided config setting.
Parameters
setting | String, the name of the setting |
---|---|
force_reload | Optional. Boolean, indicating whether to use cached config (if false ) or to force reloading the config file (if true ). |
Return value
Mixed, the value of the config setting.
Example(s)
echo config('host'); // the name of the server // retrieve the records per page in listings displayed in the admin area echo config('adminConfig')['recordsPerPage'];
configure_admin_group
Syntax
configure_admin_group ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
configure_anonymous_group
Syntax
configure_anonymous_group ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
convertLegacyOptions
Syntax
convertLegacyOptions ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
createQueryLogTable
Syntax
createQueryLogTable ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
createThumbnail
Syntax
createThumbnail ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
csrf_token
Syntax
csrf_token ([validate], [token_only])
Description
Adds a CSRF token to a form, or validates a submitted CSRF token. CSRF tokens protect pages from malicious submissions that pretend to come from a valid user.
Parameters
validate | Optional. If set to true, validates token sent in $_REQUEST against that stored in the session and returns true if valid or false if invalid, absent or expired. |
---|---|
token_only | Optional. if set to true , and validate is false , returns the value of the CSRF token without wrapping in an HTML hidden input. |
Return value
Based on input parameters, returns either a CSRF token value, optionally wrapped in an html hidden input code to insert into the form to be protected, or a boolean indicating if provided CSRF token is valid or not.
Example(s)
// to insert CSRF token into a form, call without parameters inside the form HTML echo csrf_token(); // to validate submitted requests: if(!csrf_token(true)) die('Invalid CSRF token'); // to obtain token value without wrapping in an HTML hidden input, // for example to use in an ajax request: echo csrf_token(false, true);
curl_batch
Syntax
curl_batch ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
curl_insert_handler
Syntax
curl_insert_handler ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
db_affected_rows
Syntax
db_affected_rows ([link])
Description
Get number of affected rows in previous database operation
Parameters
link | Optional. Is the link of the database connection |
---|---|
Return value
number of affected rows in previous database operation
Example(s)
%EXAMPLE%
db_close
Syntax
db_close ([link])
Description
closes the connection to db link
Parameters
link | Optional. Is the link of the database connection |
---|---|
Return value
None
Example(s)
%EXAMPLE%
db_connect
Syntax
db_connect ([host], [username], [passwd], [dbname], [port], [socket])
Description
Open a connection to a database Server
Parameters
host | Optional. Is The database server. It can also include a port number. e.g. |
---|---|
username | Optional. Is the database username |
passwd | Optional. Is the database password |
dbname | Optional. Is the database name |
port | Optional. Is the port number |
socket | Optional. Is the socket number |
Return value
a database link identifier on success or FALSE on failure.
Example(s)
%EXAMPLE%
db_errno
Syntax
db_errno ([link], [mysqli_connect])
Description
Returns the numerical value of the error message from previous database operation
Parameters
link | Optional. Is the link of the database connection |
---|---|
mysqli_connect | Optional. In case of using sqlite database set it to true else set to false |
Return value
The numerical value of the error message from previous database operation
Example(s)
%EXAMPLE%
db_error
Syntax
db_error ([link], [mysqli_connect])
Description
Returns the text of the error message from previous database operation
Parameters
link | Optional. Is the link of the database connection |
---|---|
mysqli_connect | Optional. In case of using sqlite database set it to true else set to false |
Return value
The text of the error message from previous database operation
Example(s)
%EXAMPLE%
db_escape
Syntax
db_escape ([str], [link])
Description
Escapes a string for use in a database_query
Parameters
str | Optional. |
---|---|
link | Optional. Is the link of the database connection |
Return value
The escaped string.
Example(s)
%EXAMPLE%
db_fetch_array
Syntax
db_fetch_array (res)
Description
Fetch a result row as an associative array, a numeric array, or both
Parameters
res | the resultset of query |
---|---|
Return value
array of query results
Example(s)
%EXAMPLE%
db_fetch_assoc
Syntax
db_fetch_assoc (res)
Description
converts the result row of query to associative array
Parameters
res | the resultset of query |
---|---|
Return value
An array of query result row
Example(s)
%EXAMPLE%
db_fetch_row
Syntax
db_fetch_row (res)
Description
Get a result row as an enumerated array
Parameters
res | the resultset of query |
---|---|
Return value
An enumerated array
Example(s)
%EXAMPLE%
db_field_name
Syntax
db_field_name (res, field_offset)
Description
Get the name of the specified field in a result
Parameters
res | the resultset of query |
---|---|
field_offset | Is The numerical field offset. The field_offset starts at 0. |
Return value
the name of the specified field in a result
Example(s)
%EXAMPLE%
db_field_type
Syntax
db_field_type (res, field_offset)
Description
Get the type of the specified field in a result
Parameters
res | the resultset of query |
---|---|
field_offset | Is The numerical field offset. The field_offset starts at 0. |
Return value
The type of the specified field in a result
Example(s)
%EXAMPLE%
db_insert_id
Syntax
db_insert_id ([link])
Description
Get the ID generated in the last insert query
Parameters
link | Optional. Is the link of the database connection |
---|---|
Return value
The ID generated in the last query
Example(s)
%EXAMPLE%
db_link
Syntax
db_link ([link ])
Description
defines satic var of database connection link and sets it by input link if found
Parameters
link | Optional. Is the link of the database connection |
---|---|
Return value
A database link
Example(s)
%EXAMPLE%
db_num_fields
Syntax
db_num_fields (res)
Description
Get number of fields in query result
Parameters
res | the resultset of query |
---|---|
Return value
number of fields in query result
Example(s)
%EXAMPLE%
db_num_rows
Syntax
db_num_rows (res)
Description
Get number of rows in query result
Parameters
res | the resultset of query |
---|---|
Return value
number of rows in query result
Example(s)
%EXAMPLE%
db_query
Syntax
db_query (query, [link])
Description
execute a database query
Parameters
query | Is the query which required to execute |
---|---|
link | Optional. Is the link of the database connection |
Return value
result of execute database query
Example(s)
%EXAMPLE%
db_select_db
Syntax
db_select_db (dbname, [link])
Description
selects specifying database
Parameters
dbname | Is the database name |
---|---|
link | Optional. Is the link of the database connection |
Return value
None
Example(s)
%EXAMPLE%
default_config
Syntax
default_config ()
Description
Returns the default app config template.
Parameters
Return value
Associative array, the default config template.
Example(s)
%EXAMPLE%
denyAccess
Syntax
denyAccess ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
detect_config
Syntax
detect_config ([redirectToSetup])
Description
Checks if the app has a config file, and optionally redirects to app setup page if no config found.
Parameters
redirectToSetup | Optional. Boolean, specifying whether to redirect to app setup page if no config file found. |
---|---|
Return value
Boolean,
true
if config file found, false
otherwise.Example(s)
%EXAMPLE%
dieErrorPage
Syntax
dieErrorPage ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
entitiesToUTF8
Syntax
entitiesToUTF8 (input)
Description
converts unicode entities (e.g. Ӓ) to actual UTF8 characters, requires multibyte string PHP extension
Parameters
input | unicode entities |
---|---|
Return value
UTF8 characters
Example(s)
%EXAMPLE%
error_message
Syntax
error_message (msg, [back_url])
Description
returns html code for a styled error message .. pass explicit false in second param to suppress back button
Parameters
msg | is the Error msg |
---|---|
back_url | Optional. is the url of back button |
Return value
html code for a styled error message
Example(s)
%EXAMPLE%
existing_value
Syntax
existing_value ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
func_get_args_byref
Syntax
func_get_args_byref ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getCSVData
Syntax
getCSVData ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getLoggedAdmin
Syntax
getLoggedAdmin ()
Description
Retrieves the username of the current user if she's the admin.
Parameters
Return value
the username of the current user if she's the admin, or false otherwise.
Example(s)
%EXAMPLE%
getLoggedGroupID
Syntax
getLoggedGroupID ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getLoggedMemberID
Syntax
getLoggedMemberID ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getMemberInfo
Syntax
getMemberInfo ([memberID])
Description
Retrieves member information
Parameters
memberID | Optional. Username to retrieve. |
---|---|
Return value
An associative array of Member information as detailed here.
Example(s)
%EXAMPLE%
getPKFieldName
Syntax
getPKFieldName (tn)
Description
gets primary key field name of given table
Parameters
tn | Is table name which input by user |
---|---|
Return value
A primary key of given table
Example(s)
%EXAMPLE%
getRecord
Syntax
getRecord (table, id)
Description
Retrieves a record from the specified table, given its primary key value. Warning: No ownership checks are made when executing this function.
Parameters
table | The table name from which to retrieve the record. |
---|---|
id | The primary key value for the requested record |
Return value
The requested record as an associative array (field names as keys, stored data as values), or false on error.
Example(s)
%EXAMPLE%
getTableList
Syntax
getTableList ([skip_authentication])
Description
Parameters
skip_authentication | Optional. Is a boolean value for skipping authentication or not |
---|---|
Return value
An associative array (tableName => tableData, tableData is array(tableCaption, tableDescription, tableIcon)) of tables accessible by current user
Example(s)
%EXAMPLE%
getTablePermissions
Syntax
getTablePermissions (tn)
Description
get table permissions
Parameters
tn | Is the table name |
---|---|
Return value
An array of permissions allowed for logged member to given table (allowAccess, allowInsert, allowView, allowEdit, allowDelete) -- allowAccess is set to true if any access level is allowed
Example(s)
%EXAMPLE%
getThumbnailSpecs
Syntax
getThumbnailSpecs ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getUploadDir
Syntax
getUploadDir ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getUploadedFile
Syntax
getUploadedFile ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getUserData
Syntax
getUserData ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
getValueGivenCaption
Syntax
getValueGivenCaption (query, caption)
Description
get Value executes select query with given condition
Parameters
query | is the query |
---|---|
caption | is the where condition |
Return value
a result of executing select query with given condition
Example(s)
%EXAMPLE%
get_defaults
Syntax
get_defaults ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_embed
Syntax
get_embed (provider, url, [max_width], [max_height], [retrieve])
Description
returns embed code for a given url (supported providers: youtube, googlemap)
Parameters
provider | is one of supported providers: youtube, googlemap |
---|---|
url | is the embeded url |
max_width | Optional. is the max width of provider area in page |
max_height | Optional. is the max height of provider area in page |
retrieve | Optional. is the retrieve code is html code |
Return value
embed code for a given url (supported providers: youtube, googlemap)
Example(s)
%EXAMPLE%
get_embed_googlemap
Syntax
get_embed_googlemap (url, [max_width], [max_height], [retrieve])
Description
get embeded google map provider
Parameters
url | is the embeded url |
---|---|
max_width | Optional. is the max width of provider area in page |
max_height | Optional. is the max height of provider area in page |
retrieve | Optional. is the retrieve code is html code |
Return value
embed code for a given url supported provider:googlemap
Example(s)
%EXAMPLE%
get_group_id
Syntax
get_group_id ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_home_links
Syntax
get_home_links ()
Description
Parameters
Return value
None
Example(s)
%EXAMPLE%
get_joined_record
Syntax
get_joined_record ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_parent_tables
Syntax
get_parent_tables ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_plugins
Syntax
get_plugins ()
Description
scans for installed plugins
Parameters
Return value
installed plugins in an array ('name', 'title', 'icon' or 'glyphicon', 'admin_path')
Example(s)
%EXAMPLE%
get_property
Syntax
get_property ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_sql_fields
Syntax
get_sql_fields (tn)
Description
returns the SELECT part of the table view query
Parameters
tn | Is the table name |
---|---|
Return value
The SELECT part of the table view query
Example(s)
%EXAMPLE%
get_sql_from
Syntax
get_sql_from (tn, [skip_permission])
Description
returns the FROM part of the table view query, with full joins, optionally skipping permissions if true passed as 2nd param.
Parameters
tn | Is the table name |
---|---|
skip_permission | Optional. Is a boolean value for skipping permissions or not |
Return value
the FROM part of the table view query, with full joins, optionally skipping permissions if true passed as 2nd param.
Example(s)
%EXAMPLE%
get_table_fields
Syntax
get_table_fields ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_table_groups
Syntax
get_table_groups ([skip_authentication])
Description
returns an associative array (table_group => tables_array)
Parameters
skip_authentication | Optional. Is a boolean value for skipping authentication or not |
---|---|
Return value
An associative array (table_group => tables_array)
Example(s)
%EXAMPLE%
get_table_keys
Syntax
get_table_keys ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
get_tables_info
Syntax
get_tables_info ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
guessMySQLDateTime
Syntax
guessMySQLDateTime ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
handle_maintenance
Syntax
handle_maintenance ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
htmlRadioGroup
Syntax
htmlRadioGroup ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
htmlSQLSelect
Syntax
htmlSQLSelect ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
htmlSelect
Syntax
htmlSelect ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
htmlUserBar
Syntax
htmlUserBar ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
html_attr
Syntax
html_attr (str)
Description
prepare $str to be placed inside an HTML attribute by Converting special characters to HTML entities
Parameters
str | is the input string |
---|---|
Return value
HTML entities
Example(s)
%EXAMPLE%
initSession
Syntax
initSession ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
invoke_method
Syntax
invoke_method ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
invoke_static_method
Syntax
invoke_static_method ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
isEmail
Syntax
isEmail (email)
Description
checks if the input field is Email or not
Parameters
Is input String | |
Return value
returns $email if valid or false otherwise
Example(s)
%EXAMPLE%
is_ajax
Syntax
is_ajax ()
Description
returns true if this is an ajax request, false otherwise
Parameters
Return value
true if this is an ajax request, false otherwise
Example(s)
%EXAMPLE%
is_allowed_username
Syntax
is_allowed_username (username)
Description
checks if input username is allowed or not
Parameters
username | Is input username |
---|---|
Return value
true if username allowed, false otherwise
Example(s)
%EXAMPLE%
jwt_check_login
Syntax
jwt_check_login ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
jwt_header
Syntax
jwt_header ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
latest_jquery
Syntax
latest_jquery ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
loadView
Syntax
loadView (view, [the_data_to_pass_to_the_view])
Description
Loads a given view from the templates folder, passing the given data to it
Parameters
view | is the name of a php file (without extension) to be loaded from the templates folder |
---|---|
the_data_to_pass_to_the_view | Optional. is an associative array containing the data to pass to the view |
Return value
the output of the parsed view as a string
Example(s)
%EXAMPLE%
logErrorQuery
Syntax
logErrorQuery ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
logOutUser
Syntax
logOutUser ()
Description
Destroys current session, thus logging out current user. You might need to redirect users to the login page or some custom goodbye page after calling this function.
Parameters
Return value
None
Example(s)
%EXAMPLE%
logSlowQuery
Syntax
logSlowQuery ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
lookupQuery
Syntax
lookupQuery ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
maintenance_mode
Syntax
maintenance_mode ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
makeSafe
Syntax
makeSafe (string, [is_gpc])
Description
Escapes a string to be placed safely in an SQL query. If the 2nd parameter is not provided (or is set to true) the string is escaped only if magic quotes are turned on. So, this is useful if the string is coming from the request parameters or cookies. To always escape the string, set the 2nd parameter to false.
Parameters
string | The string to escape |
---|---|
is_gpc | Optional. Boolean. Set to true if the string coming from user input (GET, POST, COOKIES), false otherwise. |
Return value
A string ready to be placed safely in an SQL query
Example(s)
$unsafe = "unsafe 'string'"; $safe = makeSafe($unsafe, false); echo $safe; // unsafe \'string\'
membership_table_functions
Syntax
membership_table_functions ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
mysql_datetime
Syntax
mysql_datetime ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
normalize_path
Syntax
normalize_path ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
notifyMemberApproval
Syntax
notifyMemberApproval ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
openDBConnection
Syntax
openDBConnection ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
parseMySQLDate
Syntax
parseMySQLDate ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
parseTemplate
Syntax
parseTemplate ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
password_harden
Syntax
password_harden ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
password_match
Syntax
password_match ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
permissions_sql
Syntax
permissions_sql (table, [level])
Description
returns an array containing the FROM and WHERE additions for applying permissions to an SQL query
Parameters
table | is the table name |
---|---|
level | Optional. is the level of permission (user or group) |
Return value
An array containing the FROM and WHERE additions for applying permissions to an SQL query
Example(s)
%EXAMPLE%
pkGivenLookupText
Syntax
pkGivenLookupText ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
prepareUploadedFile
Syntax
prepareUploadedFile (FieldName, MaxSize, [FileTypes], [NoRename], [dir])
Description
Handles file uploading made via a form submission, storing the uploaded file, if valid, in the specified folder. Warning: If handling fails, the function would abort execution with an error message, but this behavior might change in future releases.
Parameters
FieldName | String, the name of the form field containing the uploaded file (the value of the name attribute in a <input type="file"> element.) |
---|---|
MaxSize | Int, the max allowed size of the uploaded file in bytes. If larger than the php.ini value of upload_max_filesize , the latter will be used instead. |
FileTypes | Optional. String, allowed extensions for the uploaded file, separated by a pipe character | . |
NoRename | Optional. Boolean. If set to true , preserves the uploaded file name when stored in the destination folder, possibly overriding any existing file with the same name. The default is to rename the uploaded file to a unique name. |
dir | Optional. String, the destination folder to store the uploaded file, relative to the application folder. Defaults to the folder specified in the admin settings page as 'Base upload path'. If the specified folder doesn't exist inside the application folder, an attempt to create it will be made. |
Return value
String, the (renamed) file name on success, or an empty string on failure.
Example(s)
if($newFilename = PrepareUploadedFile('profile_photo', 1024 * 1024)) { echo '<img src="images/' . $newFilename . '">'; echo '<br>Profile photo updated successfully!'; } else { echo 'Error updating your profile photo!'; } else {
prepare_sql_set
Syntax
prepare_sql_set ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
quick_search_html
Syntax
quick_search_html ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
reIndex
Syntax
reIndex (arr)
Description
returns a copy of the given array, with keys replaced by 1-based numeric indices, and values replaced by original keys
Parameters
arr | is an associative array to index |
---|---|
Return value
a copy of the given array, with keys replaced by 1-based numeric indices, and values replaced by original keys
Example(s)
%EXAMPLE%
redirect
Syntax
redirect (URL, [absolute])
Description
uses to redirect to absolute url or relational url
Parameters
URL | Is url which required to redirect to it |
---|---|
absolute | Optional. Is boolean value to choose if url is absolute or not |
Return value
None
Example(s)
%EXAMPLE%
request_cache
Syntax
request_cache ()
Description
Parameters
Return value
None
Example(s)
%EXAMPLE%
request_outside_admin_folder
Syntax
request_outside_admin_folder ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
save_config
Syntax
save_config ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
setAnonymousAccess
Syntax
setAnonymousAccess ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
setUserData
Syntax
setUserData ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
set_headers
Syntax
set_headers ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
set_record_owner
Syntax
set_record_owner ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
setupMembership
Syntax
setupMembership ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
setupindexes
Syntax
setupindexes ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
setuptable
Syntax
setuptable ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
showNotifications
Syntax
showNotifications ([msg], [class], [fadeout])
Description
returns html code for displaying a notification. If no parameters provided, processes the GET request for possible notifications.
Parameters
msg | Optional. is the message to display in notification |
---|---|
class | Optional. is the class of the message |
fadeout | Optional. the boolean value if notification will display as fadeout or not |
Return value
html code for displaying a notification. If no parameters provided, processes the GET request for possible notifications.
Example(s)
%EXAMPLE%
sql
Syntax
sql (query, options)
Description
executes given $query and returns its result set. $o is an options array
Parameters
query | is the input query |
---|---|
options | Supported options that can be passed in options array (as array keys): 'silentErrors': If true, errors will be returned in $options['error'] rather than displaying them on screen and exiting. |
Return value
The result set returned from the query
Example(s)
$res = sql("select name, email from customers", $o); while($cust = db_fetch_assoc($res)){ echo "Name: {$cust['name']}<br>"; echo "Email: {$cust['email']}<br>"; echo "<hr>"; }
sqlValue
Syntax
sqlValue (statment)
Description
Executes a database query that retreives a single data value and returns the value retrieved.
Parameters
statment | query which retreives a single data value. |
---|---|
Return value
The single value retrieved from the provided query.
Example(s)
$sales = sqlValue("select sum(total) from orders");
styleSheet
Syntax
styleSheet ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
time12
Syntax
time12 ([t])
Description
gets time in 12-hour format
Parameters
t | Optional. is The time input by user |
---|---|
Return value
if there is input time convert it to 12-hour format. else, gets the current time in 12-hour format
Example(s)
%EXAMPLE%
time24
Syntax
time24 ([t])
Description
gets time in 24-hour format
Parameters
t | Optional. is The time input by user |
---|---|
Return value
if there is input time convert it to 24-hour format. else, gets the current time in 24-hour format
Example(s)
%EXAMPLE%
toBytes
Syntax
toBytes (val)
Description
gets the size of input string in bytes unit
Parameters
val | Is the String which needs to get its size in bytes |
---|---|
Return value
The size of input string in bytes
Example(s)
%EXAMPLE%
toMySQLDate
Syntax
toMySQLDate (formattedDate, [separator], [format])
Description
Converts a date from AppGini-configured date format to MySQL format of Y-m-d.
Parameters
formattedDate | The date in AppGini-configured date format. |
---|---|
separator | Optional. The date separator used in the provided date. |
format | Optional. The format (without separator) of the provided date |
Return value
The date in MySQL format.
Example(s)
%EXAMPLE%
update_calc_fields
Syntax
update_calc_fields ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
update_config_app_uri
Syntax
update_config_app_uri ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
userCanImport
Syntax
userCanImport ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%
validMySQLDate
Syntax
validMySQLDate ()
Description
Parameters
Return value
Example(s)
%EXAMPLE%