AppGini PHP functions reference

This document is still a draft and work-in-progress. If you stumbled upon it via search, please beware that information here is not so accurate. Use at your discretion!
_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

_toUTF8

Syntax

_toUTF8 ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

addFilter

Syntax

addFilter (index, filterAnd, filterField, filterOperator, filterValue)

Description

Applies a filter to the current table by adding it to 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

indexInteger, the index of the filter being configured. Valid values are integers between 1 and 80.
filterAndString, how to combine the filter with previous ones. Valid values are and and or.
filterFieldInteger, 1-based index of the field being filtered as determined by its order in the table inside the AppGini project.
filterOperatorString, 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.
filterValueString, 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()));
Back to top

addMailRecipients

Syntax

addMailRecipients ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

app_datetime

Syntax

app_datetime ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

app_datetime_format

Syntax

app_datetime_format ([destination], [datetime])

Description

Returns the configured date or date/time format for this application.

Parameters

destinationOptional. String, the format type. Valid values are mysql, moment, phps or php
datetimeOptional. 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);
Back to top

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

pageOptional. 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'
Back to top

application_url

Syntax

application_url ([page])

Description

Returns the absolute URL of the provided page, or the homepage URL if no page provided.

Parameters

pageOptional. 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'
Back to top

assocArrFilter

Syntax

assocArrFilter ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

backtick_keys_once

Syntax

backtick_keys_once ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

bgStyleToClass

Syntax

bgStyleToClass ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

bootstrapSQLSelect

Syntax

bootstrapSQLSelect ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

bootstrapSelect

Syntax

bootstrapSelect ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

br2nl

Syntax

br2nl (text)

Description

replaces all variations of HTML
tags with a new line character

Parameters

textis the text which has
tags

Return value

return text with new line instead of

Example(s)

echo br2nl("hello<br>all");
/* outputs:
hello
all
*/
Back to top

breakpoint

Syntax

breakpoint ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

calculated_fields

Syntax

calculated_fields ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

checkAppRequirements

Syntax

checkAppRequirements ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

checkPermissionVal

Syntax

checkPermissionVal ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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 otherwise

Parameters

tableis the table name
idgiven record id
permOptional. 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 otherwise

Example(s)

%EXAMPLE%
Back to top

clearFilters

Syntax

clearFilters ()

Description

clear all filters

Parameters

Return value

None

Example(s)

%EXAMPLE%
Back to top

config

Syntax

config (setting, [force_reload])

Description

Retrieves the configured value of the provided config setting.

Parameters

settingString, the name of the setting
force_reloadOptional. 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'];
Back to top

configure_admin_group

Syntax

configure_admin_group ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

configure_anonymous_group

Syntax

configure_anonymous_group ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

convertLegacyOptions

Syntax

convertLegacyOptions ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

createQueryLogTable

Syntax

createQueryLogTable ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

createThumbnail

Syntax

createThumbnail ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

validateOptional. 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_onlyOptional. 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);
Back to top

curl_batch

Syntax

curl_batch ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

curl_insert_handler

Syntax

curl_insert_handler ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

db_affected_rows

Syntax

db_affected_rows ([link])

Description

Get number of affected rows in previous database operation

Parameters

linkOptional. Is the link of the database connection

Return value

number of affected rows in previous database operation

Example(s)

%EXAMPLE%
Back to top

db_close

Syntax

db_close ([link])

Description

closes the connection to db link

Parameters

linkOptional. Is the link of the database connection

Return value

None

Example(s)

%EXAMPLE%
Back to top

db_connect

Syntax

db_connect ([host], [username], [passwd], [dbname], [port], [socket])

Description

Open a connection to a database Server

Parameters

hostOptional. Is The database server. It can also include a port number. e.g.
usernameOptional. Is the database username
passwdOptional. Is the database password
dbnameOptional. Is the database name
portOptional. Is the port number
socketOptional. Is the socket number

Return value

a database link identifier on success or FALSE on failure.

Example(s)

%EXAMPLE%
Back to top

db_errno

Syntax

db_errno ([link], [mysqli_connect])

Description

Returns the numerical value of the error message from previous database operation

Parameters

linkOptional. Is the link of the database connection
mysqli_connectOptional. 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%
Back to top

db_error

Syntax

db_error ([link], [mysqli_connect])

Description

Returns the text of the error message from previous database operation

Parameters

linkOptional. Is the link of the database connection
mysqli_connectOptional. 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%
Back to top

db_escape

Syntax

db_escape ([str], [link])

Description

Escapes a string for use in a database_query

Parameters

strOptional.
linkOptional. Is the link of the database connection

Return value

The escaped string.

Example(s)

%EXAMPLE%
Back to top

db_fetch_array

Syntax

db_fetch_array (res)

Description

Fetch a result row as an associative array, a numeric array, or both

Parameters

resthe resultset of query

Return value

array of query results

Example(s)

%EXAMPLE%
Back to top

db_fetch_assoc

Syntax

db_fetch_assoc (res)

Description

converts the result row of query to associative array

Parameters

resthe resultset of query

Return value

An array of query result row

Example(s)

%EXAMPLE%
Back to top

db_fetch_row

Syntax

db_fetch_row (res)

Description

Get a result row as an enumerated array

Parameters

resthe resultset of query

Return value

An enumerated array

Example(s)

%EXAMPLE%
Back to top

db_field_name

Syntax

db_field_name (res, field_offset)

Description

Get the name of the specified field in a result

Parameters

resthe resultset of query
field_offsetIs The numerical field offset. The field_offset starts at 0.

Return value

the name of the specified field in a result

Example(s)

%EXAMPLE%
Back to top

db_field_type

Syntax

db_field_type (res, field_offset)

Description

Get the type of the specified field in a result

Parameters

resthe resultset of query
field_offsetIs The numerical field offset. The field_offset starts at 0.

Return value

The type of the specified field in a result

Example(s)

%EXAMPLE%
Back to top

db_insert_id

Syntax

db_insert_id ([link])

Description

Get the ID generated in the last insert query

Parameters

linkOptional. Is the link of the database connection

Return value

The ID generated in the last query

Example(s)

%EXAMPLE%
Back to top

db_num_fields

Syntax

db_num_fields (res)

Description

Get number of fields in query result

Parameters

resthe resultset of query

Return value

number of fields in query result

Example(s)

%EXAMPLE%
Back to top

db_num_rows

Syntax

db_num_rows (res)

Description

Get number of rows in query result

Parameters

resthe resultset of query

Return value

number of rows in query result

Example(s)

%EXAMPLE%
Back to top

db_query

Syntax

db_query (query, [link])

Description

execute a database query

Parameters

queryIs the query which required to execute
linkOptional. Is the link of the database connection

Return value

result of execute database query

Example(s)

%EXAMPLE%
Back to top

db_select_db

Syntax

db_select_db (dbname, [link])

Description

selects specifying database

Parameters

dbnameIs the database name
linkOptional. Is the link of the database connection

Return value

None

Example(s)

%EXAMPLE%
Back to top

default_config

Syntax

default_config ()

Description

Returns the default app config template.

Parameters

Return value

Associative array, the default config template.

Example(s)

%EXAMPLE%
Back to top

denyAccess

Syntax

denyAccess ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

redirectToSetupOptional. 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%
Back to top

dieErrorPage

Syntax

dieErrorPage ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

entitiesToUTF8

Syntax

entitiesToUTF8 (input)

Description

converts unicode entities (e.g. Ӓ) to actual UTF8 characters, requires multibyte string PHP extension

Parameters

inputunicode entities

Return value

UTF8 characters

Example(s)

%EXAMPLE%
Back to top

errorMsg

Syntax

errorMsg ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

msgis the Error msg
back_urlOptional. is the url of back button

Return value

html code for a styled error message

Example(s)

%EXAMPLE%
Back to top

existing_value

Syntax

existing_value ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

from_utf8

Syntax

from_utf8 ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

func_get_args_byref

Syntax

func_get_args_byref ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getCSVData

Syntax

getCSVData ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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%
Back to top

getLoggedGroupID

Syntax

getLoggedGroupID ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getLoggedMemberID

Syntax

getLoggedMemberID ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getMemberInfo

Syntax

getMemberInfo ([memberID])

Description

Retrieves member information

Parameters

memberIDOptional. Username to retrieve.

Return value

An associative array of Member information as detailed here.

Example(s)

%EXAMPLE%
Back to top

getPKFieldName

Syntax

getPKFieldName (tn)

Description

gets primary key field name of given table

Parameters

tnIs table name which input by user

Return value

A primary key of given table

Example(s)

%EXAMPLE%
Back to top

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

tableThe table name from which to retrieve the record.
idThe 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%
Back to top

getTableList

Syntax

getTableList ([skip_authentication])

Description

Parameters

skip_authenticationOptional. 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%
Back to top

getTablePermissions

Syntax

getTablePermissions (tn)

Description

get table permissions

Parameters

tnIs 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%
Back to top

getThumbnailSpecs

Syntax

getThumbnailSpecs ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getUploadDir

Syntax

getUploadDir ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getUploadedFile

Syntax

getUploadedFile ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getUserData

Syntax

getUserData ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

getValueGivenCaption

Syntax

getValueGivenCaption (query, caption)

Description

get Value executes select query with given condition

Parameters

queryis the query
captionis the where condition

Return value

a result of executing select query with given condition

Example(s)

%EXAMPLE%
Back to top

get_defaults

Syntax

get_defaults ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

provideris one of supported providers: youtube, googlemap
urlis the embeded url
max_widthOptional. is the max width of provider area in page
max_heightOptional. is the max height of provider area in page
retrieveOptional. is the retrieve code is html code

Return value

embed code for a given url (supported providers: youtube, googlemap)

Example(s)

%EXAMPLE%
Back to top

get_embed_googlemap

Syntax

get_embed_googlemap (url, [max_width], [max_height], [retrieve])

Description

get embeded google map provider

Parameters

urlis the embeded url
max_widthOptional. is the max width of provider area in page
max_heightOptional. is the max height of provider area in page
retrieveOptional. is the retrieve code is html code

Return value

embed code for a given url supported provider:googlemap

Example(s)

%EXAMPLE%
Back to top

get_group_id

Syntax

get_group_id ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

get_joined_record

Syntax

get_joined_record ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

get_parent_tables

Syntax

get_parent_tables ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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%
Back to top

get_property

Syntax

get_property ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

get_sql_fields

Syntax

get_sql_fields (tn)

Description

returns the SELECT part of the table view query

Parameters

tnIs the table name

Return value

The SELECT part of the table view query

Example(s)

%EXAMPLE%
Back to top

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

tnIs the table name
skip_permissionOptional. 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%
Back to top

get_table_fields

Syntax

get_table_fields ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

get_table_groups

Syntax

get_table_groups ([skip_authentication])

Description

returns an associative array (table_group => tables_array)

Parameters

skip_authenticationOptional. Is a boolean value for skipping authentication or not

Return value

An associative array (table_group => tables_array)

Example(s)

%EXAMPLE%
Back to top

get_table_keys

Syntax

get_table_keys ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

get_tables_info

Syntax

get_tables_info ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

guessMySQLDateTime

Syntax

guessMySQLDateTime ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

handle_maintenance

Syntax

handle_maintenance ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

htmlRadioGroup

Syntax

htmlRadioGroup ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

htmlSQLSelect

Syntax

htmlSQLSelect ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

htmlSelect

Syntax

htmlSelect ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

htmlUserBar

Syntax

htmlUserBar ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

html_attr

Syntax

html_attr (str)

Description

prepare $str to be placed inside an HTML attribute by Converting special characters to HTML entities

Parameters

stris the input string

Return value

HTML entities

Example(s)

%EXAMPLE%
Back to top

html_attr_tags_ok

Syntax

html_attr_tags_ok (str)

Description

Added in AppGini 5.71. Same as html_attr, except that HTML tags are allowed

Parameters

stris the input string

Return value

HTML entities

Example(s)

%EXAMPLE%
Back to top

initSession

Syntax

initSession ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

insert

Syntax

insert ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

invoke_method

Syntax

invoke_method ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

invoke_static_method

Syntax

invoke_static_method ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

isEmail

Syntax

isEmail (email)

Description

checks if the input field is Email or not

Parameters

emailIs input String

Return value

returns $email if valid or false otherwise

Example(s)

%EXAMPLE%
Back to top

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%
Back to top

is_allowed_username

Syntax

is_allowed_username (username)

Description

checks if input username is allowed or not

Parameters

usernameIs input username

Return value

true if username allowed, false otherwise

Example(s)

%EXAMPLE%
Back to top

jwt_check_login

Syntax

jwt_check_login ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

jwt_header

Syntax

jwt_header ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

jwt_key

Syntax

jwt_key ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

jwt_token

Syntax

jwt_token ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

latest_jquery

Syntax

latest_jquery ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

loadTable

Syntax

loadTable ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

viewis the name of a php file (without extension) to be loaded from the templates folder
the_data_to_pass_to_the_viewOptional. 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%
Back to top

logErrorQuery

Syntax

logErrorQuery ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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%
Back to top

logSlowQuery

Syntax

logSlowQuery ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

lookupQuery

Syntax

lookupQuery ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

maintenance_mode

Syntax

maintenance_mode ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

stringThe string to escape
is_gpcOptional. 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\'
Back to top

membership_table_functions

Syntax

membership_table_functions ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

mysql_datetime

Syntax

mysql_datetime ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

normalize_path

Syntax

normalize_path ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

notifyMemberApproval

Syntax

notifyMemberApproval ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

openDBConnection

Syntax

openDBConnection ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

parseCode

Syntax

parseCode ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

parseMySQLDate

Syntax

parseMySQLDate ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

parseTemplate

Syntax

parseTemplate ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

password_harden

Syntax

password_harden ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

password_match

Syntax

password_match ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

tableis the table name
levelOptional. 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%
Back to top

pkGivenLookupText

Syntax

pkGivenLookupText ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

FieldNameString, the name of the form field containing the uploaded file (the value of the name attribute in a <input type="file"> element.)
MaxSizeInt, 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.
FileTypesOptional. String, allowed extensions for the uploaded file, separated by a pipe character |.
NoRenameOptional. 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.
dirOptional. 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 {
Back to top

prepare_sql_set

Syntax

prepare_sql_set ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

quick_search_html

Syntax

quick_search_html ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

arris 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%
Back to top

redirect

Syntax

redirect (URL, [absolute])

Description

uses to redirect to absolute url or relational url

Parameters

URLIs url which required to redirect to it
absoluteOptional. Is boolean value to choose if url is absolute or not

Return value

None

Example(s)

%EXAMPLE%
Back to top

request_cache

Syntax

request_cache ()

Description

Parameters

Return value

None

Example(s)

%EXAMPLE%
Back to top

request_outside_admin_folder

Syntax

request_outside_admin_folder ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

safe_html

Syntax

safe_html ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

save_config

Syntax

save_config ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

sendmail

Syntax

sendmail ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

setAnonymousAccess

Syntax

setAnonymousAccess ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

setUserData

Syntax

setUserData ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

set_headers

Syntax

set_headers ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

set_record_owner

Syntax

set_record_owner ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

setupMembership

Syntax

setupMembership ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

setupindexes

Syntax

setupindexes ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

setuptable

Syntax

setuptable ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

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

msgOptional. is the message to display in notification
classOptional. is the class of the message
fadeoutOptional. 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%
Back to top

sql

Syntax

sql (query, options)

Description

executes given $query and returns its result set. $o is an options array

Parameters

queryis the input query
optionsSupported 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>";
}
Back to top

sqlValue

Syntax

sqlValue (statment)

Description

Executes a database query that retreives a single data value and returns the value retrieved.

Parameters

statmentquery 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");
Back to top

styleSheet

Syntax

styleSheet ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

test

Syntax

test ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

thisOr

Syntax

thisOr ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

time12

Syntax

time12 ([t])

Description

gets time in 12-hour format

Parameters

tOptional. 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%
Back to top

time24

Syntax

time24 ([t])

Description

gets time in 24-hour format

Parameters

tOptional. 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%
Back to top

toBytes

Syntax

toBytes (val)

Description

gets the size of input string in bytes unit

Parameters

valIs the String which needs to get its size in bytes

Return value

The size of input string in bytes

Example(s)

%EXAMPLE%
Back to top

toMySQLDate

Syntax

toMySQLDate (formattedDate, [separator], [format])

Description

Converts a date from AppGini-configured date format to MySQL format of Y-m-d.

Parameters

formattedDateThe date in AppGini-configured date format.
separatorOptional. The date separator used in the provided date.
formatOptional. The format (without separator) of the provided date

Return value

The date in MySQL format.

Example(s)

%EXAMPLE%
Back to top

to_utf8

Syntax

to_utf8 ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

update

Syntax

update ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

update_calc_fields

Syntax

update_calc_fields ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

update_config_app_uri

Syntax

update_config_app_uri ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

userCanImport

Syntax

userCanImport ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top

validMySQLDate

Syntax

validMySQLDate ()

Description

Parameters

Return value

Example(s)

%EXAMPLE%
Back to top