UNA
Loading...
Searching...
No Matches
UNA Core Functions

Functions

 DesignBoxContent ($sTitle, $sContent, $iTemplateNum=BX_DB_DEF, $mixedMenu=false)
 
 send_headers_page_changed ()
 
 MsgBox ($sText, $iTimer=0)
 
 PopupBox ($sName, $sTitle, $sContent, $isHiddenByDefault=false)
 
 getVersionComment ()
 
 getSiteStatUser ()
 
 bx_time_js ($iUnixTimestamp, $sFormatIdentifier=BX_FORMAT_DATE, $bForceFormat=false)
 
 bx_time_utc ($iUnixTimestamp)
 
 bx_get_logged_profile_id ()
 
 isLogged ()
 
 getLoggedId ()
 
 getLoggedPassword ()
 
 isMember ($iId=0)
 
if(!function_exists("isAdmin")) isRole ($iRole, $iId=0)
 
 bx_login ($iId, $bRememberMe=false)
 
 bx_logout ($bNotify=true)
 
 check_logged ()
 
 bx_check_password ($sLogin, $sPassword, $iRole=BX_DOL_ROLE_MEMBER)
 
 bx_check_login ($iID, $sPassword, $iRole=BX_DOL_ROLE_MEMBER)
 
 bx_require_authentication ($bStudio=false, $bAjaxMode=false, $sForceRelocate='')
 
 bx_login_form ($bStudio=false, $bAjaxMode=false, $sForceRelocate='')
 
 title2uri ($sValue)
 
 uri2title ($sValue)
 
 strmaxtextlen ($sInput, $iMaxLen=60, $sEllipsisSign='…')
 
 html2txt ($content, $tags="")
 
 bx_process_input ($mixedData, $iDataType=BX_DATA_TEXT, $mixedParams=false, $isCheckMagicQuotes=true)
 
 bx_process_output ($mixedData, $iDataType=BX_DATA_TEXT, $mixedParams=false)
 
 bx_is_macros_in_content (&$s)
 
 bx_process_macros ($s)
 
 bx_process_pass ($mixedData, $iDataType=BX_DATA_TEXT, $mixedParams=false, $isCheckMagicQuotes=true)
 
 htmlspecialchars_adv ( $string)
 
 sendMailTemplate ($sTemplateName, $iAccountId=0, $iProfileId=0, $aReplaceVars=array(), $iEmailType=BX_EMAIL_NOTIFY, $bAddToQueue=false)
 
 sendMailTemplateSystem ($sTemplateName, $aReplaceVars=array(), $iEmailType=BX_EMAIL_SYSTEM, $bAddToQueue=false)
 
 sendMail ($mRecipientEmails, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $iEmailType=BX_EMAIL_NOTIFY, $sEmailFlag='html', $isDisableAlert=false, $aCustomHeaders=array(), $bAddToQueue=false)
 
 _sendMail ($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $iEmailType=BX_EMAIL_NOTIFY, $sEmailFlag='html', $isDisableAlert=false, $aCustomHeaders=array(), $bAddToQueue=false)
 
 get_templates_array ($bEnabledOnly=true, $bShortInfo=true)
 
 bx_get_image_exif_and_size ($oStorage, $oTranscoder, $iContentId)
 
 bx_get_svg_image_size ($sUrl)
 
 extFileExists ( $sFileSrc)
 
 getVisitorIP ()
 
 genFlag ($sLang='', $oTemplate=null)
 
 echoDbg ( $what, $desc='')
 
 echoDbgLog ($mWhat, $sDesc='unused', $sFileName='unused')
 
 bx_is_dbg ()
 
 dbgTiming ($sStartMicrotime)
 
 echoJson ($a)
 
 clear_xss ($val)
 
 uriGenerate ($sValue, $sTable, $sField, $aParams=[])
 
 uriFilter ($s, $aParams=[])
 
 uriCheckUniq ($sValue, $sTable, $sField, $aCond=[])
 
 get_mb_replace ($sPattern, $sReplace, $s)
 
 get_mb_len ($s)
 
 get_mb_substr ($s, $iStart, $iLen)
 
 bx_mb_substr_replace ($s, $sReplace, $iPosStart, $iLength)
 
 bx_mb_strpos ($s, $sReplacement, $iStart=0)
 
 bx_import ($sClassName, $mixedModule=array())
 
 bx_autoload ($sClassName)
 
 bx_instance ($sClassName, $aParams=array(), $mixedModule=array())
 
 bx_js_string ($mixedInput, $iQuoteType=BX_ESCAPE_STR_AUTO)
 
 bx_html_attribute ($mixedInput, $iQuoteType=BX_ESCAPE_STR_AUTO)
 
 bx_php_string_apos ($mixedInput)
 
 bx_php_string_quot ($mixedInput)
 
 bx_file_get_contents ($sFileUrl, $aParams=array(), $sMethod='get', $aHeaders=array(), &$sHttpCode=null, $aBasicAuth=array(), $iTimeout=0, $aCustomCurlParams=array())
 
 bx_make_utf8 ($s)
 
 bx_get_site_info ($sSourceUrl, $aProcessAdditionalTags=array())
 
 bx_get_site_info_fix_relative_url ($sSourceUrl, $s)
 
 bx_parse_html_tag ($sContent, $sTag, $sAttrNameName, $sAttrNameValue, $sAttrContentName, $sCharset=false, $bSpecialCharsDecode=true)
 
 return_bytes ($val)
 
 genRndPwd ($iLength=8, $bSpecialCharacters=true)
 
 genRndSalt ()
 
 encryptUserPwd ($sPwd, $sSalt)
 
 encryptUserId ($sId)
 
 bx_get_reset_password_key ($sValue, $sField='email', $iLifetime=0)
 
 bx_get_reset_password_link ($sValue, $sField='email', $iLifetime=0)
 
 bx_get_reset_password_link_by_key ($sKey)
 
 bx_get_reset_password_redirect ($iAccountId)
 
 bx_get ($sName, $sMethod=false)
 
 bx_set ($sName, $sValue, $sMethod=false)
 
 bx_get_with_prefix ($sPrefix, $sMethod=false)
 
 bx_get_base_url_inline ($aParams=array())
 
 bx_get_base_url_popup ($aParams=array())
 
 bx_get_base_url ($sPageLink)
 
 bx_get_page_info ()
 
 bx_get_location_bounds_latlng ($fLatitude, $fLongitude, $iRadiusInKm)
 
 bx_encode_url_params ($a, $aExcludeKeys=array(), $aOnlyKeys=false)
 
 bx_parse_str ($s)
 
 bx_append_url_params ($sUrl, $mixedParams, $bEncodeParams=true, $aIgnoreParams=[])
 
 bx_process_url_param ($sValue, $sPattern="/^[\d\w_-]+$/")
 
 bx_rrmdir ($directory)
 
 bx_clear_folder ($sPath, $aExts=array())
 
 bx_ltrim_str ($sString, $sPrefix, $sReplace='')
 
 bx_rtrim_str ($sString, $sPrefix, $sReplace='')
 
 bx_trim_nl_duplicates ($s)
 
 bx_convert_array2attrs ($a, $sClasses=false, $sStyles=false)
 
 bx_unicode_urldecode ($s)
 
 bx_audit ($iContentId, $sContentModule, $sAction, $aParams, $iProfileId=0)
 
 bx_alert ($sUnit, $sAction, $iObjectId, $iSender=false, $aExtras=array())
 
 bx_is_srv ($mixedModule, $sMethod, $sClass="Module", $bIgnoreInactive=false)
 
 bx_is_srv_ii ($mixedModule, $sMethod, $sClass="Module")
 
 bx_srv ($mixed, $sMethod, $aParams=array(), $sClass='Module', $bIgnoreCache=false, $bIgnoreInactive=false)
 
 bx_srv_ii ($mixed, $sMethod, $aParams=array(), $sClass='Module', $bIgnoreCache=false)
 
 bx_srv_ic ($mixed, $sMethod, $aParams=array(), $sClass='Module', $bIgnoreInactive=false)
 
 bx_replace_markers ($mixed, $aMarkers)
 
 bx_site_hash ($sSalt='', $isSkipVersion=false)
 
 bx_gen_method_name ($s, $aWordsDelimiter=array('_'))
 
 bx_trigger_error ($sMsg, $iNumLevelsBack=0)
 
 bx_get_ver ($bInvalidateCache=false)
 
 bx_check_debug_mode ()
 
 bx_check_maintenance_mode ($bShowHttpError=false)
 
 bx_check_minimal_requirements ($bShowHttpError=false)
 
 bx_check_redirect_to_correct_hostname ($bProcessRedirect=false)
 
 bx_get_self_url ()
 
 bx_check_redirect_to_remove_install_folder ($bProcessRedirect=false)
 
 bx_show_service_unavailable_error_and_exit ($sMsg=false, $iRetryAfter=86400)
 
 bx_smart_readfile ($sPath, $sFilename='', $sMimeType='application/octet-stream', $iCacheAge=0, $sCachePrivacy='public', $sContentDisposition='inline')
 
 bx_linkify ($text, $sAttrs='', $bHtmlSpecialChars=false)
 
 bx_linkify_embeded ($sText)
 
 bx_linkify_html ($sHtmlOrig, $sAttrs='')
 
 bx_proto ()
 
 bx_has_proto ($sLink)
 
 bx_is_empty_array ($a)
 
 bx_is_full_array ($a)
 
 bx_is_url_in_content ($sContent, $bSkipLocalUrls=false)
 
 bx_is_dynamic_request ()
 
 bx_is_htmx_request ()
 
 bx_get_htmx_target ()
 
 bx_get_htmx_attrs ($aAttrs, $mPreload=false)
 
 bx_idn_to_utf8 ($sUrl, $bReturnDomain=false)
 
 bx_idn_to_ascii ($sUrl, $bReturnDomain=false)
 
 bx_idn_to ($sMethod, $sUrl, $bReturnDomain=false)
 
 bx_is_mobile ()
 
 bx_get_device_pixel_ratio ()
 
 bx_log ($sObject, $mixed)
 
 bx_birthday2age ($sBirthday)
 
 bx_setcookie ($sName, $sValue="", $oExpiresOrOptions=0, $sPath='auto', $sDomain='', $bSecure='auto', $bHttpOnly=false)
 
 bx_get_ip_hash ($sIp)
 
 is_private_ip ($sIp)
 
 bx_absolute_url ($sUrl, $sPrefix=BX_DOL_URL_ROOT)
 
 bx_is_api ()
 
 bx_api_get_sql ($q)
 
 bx_api_check_access ()
 
 bx_api_get_base_url ()
 
 bx_api_get_relative_url ($sUrl, $sPrefix=BX_DOL_URL_ROOT)
 
 bx_api_get_block ($sType, $sData, $aParams=[])
 
 bx_api_get_msg ($sMessage, $aParams=[])
 
 bx_api_get_image ($sStorage, $iId)
 
 bx_api_get_browse_params ($sParams, $bParamsOnly=false)
 

Variables

const BX_DB_CONTENT_ONLY 0
 
const BX_DB_DEF 1
 
const BX_DB_EMPTY 2
 
const BX_DB_NO_CAPTION 3
 
const BX_DB_PADDING_CONTENT_ONLY 10
 
const BX_DB_PADDING_DEF 11
 
const BX_DB_PADDING_NO_CAPTION 13
 
const BX_DB_MENU_TEMPLATE_TABS 25
 
const BX_DB_MENU_TEMPLATE_POPUP 26
 
const BX_DB_HIDDEN_PHONE 1
 
const BX_DB_HIDDEN_TABLET 2
 
const BX_DB_HIDDEN_DESKTOP 3
 
const BX_DB_HIDDEN_MOBILE 4
 
const BX_FORMAT_DATE 'sys_format_date'
 
const BX_FORMAT_TIME 'sys_format_time'
 
const BX_FORMAT_DATE_TIME 'sys_format_datetime'
 
const BX_MENU_TEMPLATE_SUBMENU 8
 
const BX_MENU_TEMPLATE_SUBMENU_MORE_AUTO 18
 
const BX_MENU_TEMPLATE_CUSTOM_HOR 15
 
const BX_MENU_TEMPLATE_CUSTOM_VER 20
 
 $oZ = new BxDolAlerts('system', 'design_included', 0)
 
const BX_DOL_START microtime ()
 
const BX_DOL_URL_PLUGINS BX_DOL_URL_ROOT . 'plugins/'
 
const BX_DOL_URL_PLUGINS_PUBLIC BX_DOL_URL_ROOT . 'plugins_public/'
 
const BX_DOL_URL_MODULES BX_DOL_URL_ROOT . 'modules/'
 
const BX_DOL_URL_CACHE_PUBLIC BX_DOL_URL_ROOT . 'cache_public/'
 
const BX_DOL_URL_BASE BX_DOL_URL_ROOT . 'template/'
 
const BX_DIRECTORY_PATH_INC BX_DIRECTORY_PATH_ROOT . 'inc/'
 
const BX_DIRECTORY_PATH_BASE BX_DIRECTORY_PATH_ROOT . 'template/'
 
const BX_DIRECTORY_PATH_CACHE BX_DIRECTORY_PATH_ROOT . 'cache/'
 
const BX_DIRECTORY_PATH_CACHE_PUBLIC BX_DIRECTORY_PATH_ROOT . 'cache_public/'
 
const BX_DIRECTORY_PATH_CLASSES BX_DIRECTORY_PATH_ROOT . 'inc/classes/'
 
const BX_DIRECTORY_PATH_PLUGINS BX_DIRECTORY_PATH_ROOT . 'plugins/'
 
const BX_DIRECTORY_PATH_PLUGINS_PUBLIC BX_DIRECTORY_PATH_ROOT . 'plugins_public/'
 
const BX_DIRECTORY_PATH_MODULES BX_DIRECTORY_PATH_ROOT . 'modules/'
 
const BX_DIRECTORY_PATH_TMP BX_DIRECTORY_PATH_ROOT . 'tmp/'
 
const BX_DIRECTORY_PATH_LOGS BX_DIRECTORY_PATH_ROOT . 'logs/'
 
const BX_DIRECTORY_STORAGE BX_DIRECTORY_PATH_ROOT . 'storage/'
 
const BX_DOL_DIR_RIGHTS 0777
 
const BX_DOL_FILE_RIGHTS 0666
 
const BX_DOL_STORAGE_OBJ_FILES 'sys_files'
 
const BX_DOL_STORAGE_OBJ_IMAGES 'sys_images'
 
 if (!defined( 'BX_DOL_INT_MAX')) define( 'BX_DOL_INT_MAX'
 
const BX_DOL_TRANSCODER_OBJ_ICON_APPLE 'sys_icon_apple'
 
const BX_DOL_TRANSCODER_OBJ_ICON_ANDROID 'sys_icon_android'
 
const BX_DOL_TRANSCODER_OBJ_ICON_ANDROID_SPLASH 'sys_icon_android_splash'
 
const BX_DOL_TRANSCODER_OBJ_ICON_FACEBOOK 'sys_icon_facebook'
 
const BX_DOL_TRANSCODER_OBJ_ICON_FAVICON 'sys_icon_favicon'
 
const BX_DOL_TRANSCODER_OBJ_COVER 'sys_cover'
 
const BX_DOL_TRANSCODER_OBJ_COVER_UNIT_PROFILE 'sys_cover_unit_profile'
 
const BX_DOL_MODULE_SUBTYPE_PROFILE (!defined('BX_DOL_MODULE_TYPE_MODULE')) 1
 
const BX_DOL_MODULE_SUBTYPE_CONTEXT 2
 
const BX_DOL_MODULE_SUBTYPE_TEXT 3
 
const BX_DOL_MODULE_SUBTYPE_FILE 4
 
const BX_DOL_MODULE_SUBTYPE_PAYMENT 5
 
const BX_DOL_MODULE_SUBTYPE_NOTIFICATION 6
 
const BX_DOL_MODULE_SUBTYPE_CONNECT 7
 
const BX_PAYMENT_TYPE_SINGLE 'single'
 
const BX_PAYMENT_TYPE_RECURRING 'recurring'
 
const BX_PAYMENT_EMPTY_ID 0
 
const BX_DOL_STUDIO_FOLDER 'studio'
 
const BX_DOL_URL_STUDIO BX_DOL_URL_ROOT . BX_DOL_STUDIO_FOLDER . '/'
 
const BX_DOL_URL_STUDIO_BASE BX_DOL_URL_STUDIO . 'template/'
 
const BX_DOL_DIR_STUDIO BX_DIRECTORY_PATH_ROOT . BX_DOL_STUDIO_FOLDER . '/'
 
const BX_DOL_DIR_STUDIO_INC BX_DOL_DIR_STUDIO . 'inc/'
 
const BX_DOL_DIR_STUDIO_CLASSES BX_DOL_DIR_STUDIO . 'classes/'
 
const BX_DOL_DIR_STUDIO_BASE BX_DOL_DIR_STUDIO . 'template/'
 
const BX_DOL_ROLE_GUEST 0
 
const BX_DOL_ROLE_MEMBER 1
 
const BX_DOL_ROLE_ADMIN 2
 
const BX_DOL_STUDIO_ROLE_MASTER 1
 
const BX_DOL_STUDIO_ROLE_OPERATOR 2
 
const BX_PROFILE_STATUS_SUSPENDED 'suspended'
 
const BX_PROFILE_STATUS_ACTIVE 'active'
 
const BX_PROFILE_STATUS_PENDING 'pending'
 
const BX_ACCOUNT_SESSION_KEY_FOR_2FA_LOGIN_ACCOUNT_ID '2FA_LOGIN_ACCOUNT_ID'
 
const BX_ACCOUNT_SESSION_KEY_FOR_2FA_LOGIN_IS_REMEMBER '2FA_LOGIN_IS_REMEMBER'
 
const BX_ACCOUNT_SESSION_KEY_FOR_PHONE_ACTIVATEION_CODE 'PHONE_ACTIVATEION_CODE'
 
const BX_ACCOUNT_CONFIRMATION_NONE 'none'
 
const BX_ACCOUNT_CONFIRMATION_EMAIL 'email'
 
const BX_ACCOUNT_CONFIRMATION_PHONE 'phone'
 
const BX_ACCOUNT_CONFIRMATION_EMAIL_PHONE 'email_and_phone'
 
const BX_ACCOUNT_CONFIRMATION_EMAIL_OR_PHONE 'email_or_phone'
 
const BX_DOL_TEMPLATE_CODE_KEY 'skin'
 
const BX_DOL_TEMPLATE_MIX_KEY 'mix'
 
const BX_DOL_TEMPLATE_DEFAULT_CODE 'protean'
 
const BX_DOL_TEMPLATE_FOLDER_ROOT 'template'
 
const BX_DOL_STUDIO_TEMPLATE_CODE_KEY 'sskin'
 
const BX_DOL_STUDIO_TEMPLATE_DEFAULT_CODE 'protean'
 
 $o = new BxDolAlerts('system', 'begin', 0)
 
const BX_DOL_LINK_CLASS 'bx-link'
 
const BX_DATA_TEXT 1
 
const BX_DATA_TEXT_MULTILINE 2
 
const BX_DATA_INT 3
 
const BX_DATA_FLOAT 4
 
const BX_DATA_CHECKBOX 5
 
const BX_DATA_HTML 6
 
const BX_DATA_DATE 7
 
const BX_DATA_DATETIME 12
 
const BX_DATA_DATE_TS 8
 
const BX_DATA_DATETIME_TS 9
 
const BX_DATA_DATE_TS_UTC 10
 
const BX_DATA_DATETIME_TS_UTC 11
 
const BX_DATA_DATE_UTC 13
 
const BX_DATA_DATETIME_UTC 14
 
const BX_SLASHES_AUTO 0
 
const BX_SLASHES_ADD 1
 
const BX_SLASHES_STRIP 2
 
const BX_SLASHES_NO_ACTION 3
 
const BX_ESCAPE_STR_AUTO 0
 
const BX_ESCAPE_STR_APOS 1
 
const BX_ESCAPE_STR_QUOTE 2
 
const BX_EMAIL_SYSTEM 0
 
const BX_EMAIL_NOTIFY 1
 
const BX_EMAIL_MASS 2
 
const BX_MAINTENANCE_FILE '.bx_maintenance'
 

Detailed Description

Copyright (c) UNA, Inc - https://una.io MIT License - https://opensource.org/licenses/MIT

Copyright (c) UNA, Inc - https://una.io MIT License - https://opensource.org/licenses/MIT

Copyright (c) UNA, Inc - https://una.io MIT License - https://opensource.org/licenses/MIT

Copyright (c) UNA, Inc - https://una.io MIT License - https://opensource.org/licenses/MIT

Function Documentation

◆ _sendMail()

_sendMail ( $sRecipientEmail,
$sMailSubject,
$sMailBody,
$iRecipientID = 0,
$aPlus = array(),
$iEmailType = BX_EMAIL_NOTIFY,
$sEmailFlag = 'html',
$isDisableAlert = false,
$aCustomHeaders = array(),
$bAddToQueue = false )

Hooks:

'system', 'check_send_mail' - hook for disabling mail sending

  • $unit_name - equals system
  • $action - equals check_send_mail
  • $object_id - recipient profile id
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:
    • email - [string] recipient email
    • subject - [string] email subject
    • body - [string] email body
    • header - [string] email headers, headers are separated with double new line character
    • params - [string] parameters for php mail function
    • recipient - [array] recipient info array
    • email_type - [int] email type, one of the following BX_EMAIL_SYSTEM, BX_EMAIL_NOTIFY, BX_EMAIL_MASS
    • html - [boolean] true if email content is HTML, if false then email content is text
    • custom_headers - [array] custom email headers array as key&value pairs
    • override_result - [boolean] override result of sendMail function, if true then mail sending should continue as usual, if false then mail sending should stop
      HOOKS
      'system', 'check_send_mail' - hook for disabling mail sending

Hooks:

'system', 'before_send_mail' - hook before mail sending

It's equivalent to 'system', 'check_send_mail' - hook for disabling mail sending

HOOKS
'system', 'before_send_mail' - hook before mail sending

Hooks:

'system', 'send_mail' - hook when mail was sent

It's equivalent to 'system', 'check_send_mail' - hook for disabling mail sending except override_result parameter in $extra_params is missing

HOOKS
'system', 'send_mail' - hook when mail was sent

◆ bx_alert()

bx_alert ( $sUnit,
$sAction,
$iObjectId,
$iSender = false,
$aExtras = array() )

Raise an alert

Parameters
string$sUnit- system type
string$sAction- system action
int$iObjectId- object id
int$iSender- sender (action's author) profile id, if it is false - then currectly logged in profile id is used
array$aExtras- extra parameters

◆ bx_audit()

bx_audit ( $iContentId,
$sContentModule,
$sAction,
$aParams,
$iProfileId = 0 )

Raise an audit event

Parameters
int$iContentId- content id
string$sContentModule- module name
string$sAction- system action key
array$aParams- array of parameters

◆ bx_autoload()

bx_autoload ( $sClassName)

used in spl_autoload_register() function, so no need to call bx_import for system classes

◆ bx_check_login()

bx_check_login ( $iID,
$sPassword,
$iRole = BX_DOL_ROLE_MEMBER )

Check encrypted password (ex., from Cookie)

Returns
empty string on success or error string on error

◆ bx_check_maintenance_mode()

bx_check_maintenance_mode ( $bShowHttpError = false)

Check if site maintetance mode is enabled. Maintetance mode is enabled when '.bx_maintenance' file exists in the script root folder, please note that this is hidden file and some file managers don't show it.

Parameters
$bShowHttpErrorshow 503 HTTP error if site is in mainenance mode
Returns
true if site is in maintenance mode, or false otherwise

◆ bx_check_minimal_requirements()

bx_check_minimal_requirements ( $bShowHttpError = false)

Check for minimal requirements. if BX_DISABLE_REQUIREMENTS_CHECK is defined then this requirements checking is skipped.

Parameters
$bShowHttpErrorshow 503 HTTP error if site doesn't meet minimal requirements
Returns
false if requirements are met, or array of errors of requirements aren't met

◆ bx_check_password()

bx_check_password ( $sLogin,
$sPassword,
$iRole = BX_DOL_ROLE_MEMBER )

Check unencrypted password

Returns
empty string on success or error string on error

Hooks:

'account', 'encrypt_password_after' - hook after user performed login

  • $unit_name - equals system
  • $action - equals encrypt_password_after
  • $object_id - not used
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:

Hooks:

'account', 'check_login' - hook after user's login/password check

  • $unit_name - equals account
  • $action - equals check_login
  • $object_id - account id
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:

◆ bx_check_redirect_to_correct_hostname()

bx_check_redirect_to_correct_hostname ( $bProcessRedirect = false)

Check if redirect to the correct hostname is required, for example redirect from site.com to www.site.com

Parameters
$bProcessRedirectprocess redirect and exit if needed

◆ bx_check_redirect_to_remove_install_folder()

bx_check_redirect_to_remove_install_folder ( $bProcessRedirect = false)

Check if redirect to remove install folder. If BX_SKIP_INSTALL_CHECK is defined then this redirect checking is skipped.

Parameters
$bProcessRedirectprocess redirect and exit if needed

◆ bx_convert_array2attrs()

bx_convert_array2attrs ( $a,
$sClasses = false,
$sStyles = false )

Convert array to attributes string

Example:

$a = array('name' => 'test', 'value' => 5);
echo $s; // outputs: name="test" value="5"
bx_convert_array2attrs($a, $sClasses=false, $sStyles=false)
Definition utils.inc.php:1758
Parameters
$a- array of attributes
$sClasses- classes to merge with 'class' attribute
$sStyles- styles to merge with 'style' attribute
Returns
string

◆ bx_file_get_contents()

bx_file_get_contents ( $sFileUrl,
$aParams = array(),
$sMethod = 'get',
$aHeaders = array(),
& $sHttpCode = null,
$aBasicAuth = array(),
$iTimeout = 0,
$aCustomCurlParams = array() )

Gets file contents by URL.

Parameters
string$sFileUrl- file URL to be read.
array$aParams- an array of parameters to be pathed with URL.
string$sMethod- post or get.
array$aHeaders- custom headers.
string$sHttpCode- HTTP code to return
array$aBasicAuth- array with 'user' and 'password' for Basic HTTP Auth
Returns
string the file's contents.

◆ bx_gen_method_name()

bx_gen_method_name ( $s,
$aWordsDelimiter = array('_') )

Transform string to method name string, for example it changes 'some_method' string to 'SomeMethod' string

Parameters
$sstring where words are separated with underscore
$aWordsDelimiterword delimeters
Returns
string where every word begins with capital letter

◆ bx_get_logged_profile_id()

bx_get_logged_profile_id ( )
Returns
corrently logged in profile id

◆ bx_get_self_url()

bx_get_self_url ( )

Get URL of current page

◆ bx_get_site_info_fix_relative_url()

bx_get_site_info_fix_relative_url ( $sSourceUrl,
$s )

Fix relative URL to make it absolute

Parameters
$sSourceUrlmain URL
$sURL to fix
Returns
absolute URL or URL wothout changes

◆ bx_get_ver()

bx_get_ver ( $bInvalidateCache = false)

Get system DB version, for files version

See also
BX_DOL_VERSION, these versions must match

◆ bx_has_proto()

bx_has_proto ( $sLink)

Checks protocol in the link

◆ bx_html_attribute()

bx_html_attribute ( $mixedInput,
$iQuoteType = BX_ESCAPE_STR_AUTO )

Return input string/array ready to pass to html attribute with filtered symbols like ', " etc

Parameters
$mixedInput- string/array which should be filtered
$iQuoteType- string escaping BX_ESCAPE_STR_AUTO, BX_ESCAPE_STR_APOS or BX_ESCAPE_STR_QUOTE
Returns
converted string / array

◆ bx_import()

bx_import ( $sClassName,
$mixedModule = array() )

Import class file, it automatically detects class path by its prefix or module array/name

Parameters
$sClassName- full class name or class postfix(withoit prefix) in the case of module class
$mixedModule- module array or module name in the case of module class

◆ bx_instance()

bx_instance ( $sClassName,
$aParams = array(),
$mixedModule = array() )

Gets an instance of class pathing necessary parameters if it's necessary.

Parameters
string$sClassNameclass name.
array$aParamsan array of parameters to be pathed to the constructor of the class.
array$mixedModulean array with module description. Is used when the requested class is located in some module.
Returns
unknown

◆ bx_is_srv()

bx_is_srv ( $mixedModule,
$sMethod,
$sClass = "Module",
$bIgnoreInactive = false )

Check whether serice method exists or not

Parameters
$mixedmodule name or module id
$sMethodservice method name in format 'method_name', corresponding class metod is serviceMethodName
$sClassclass to search for service method, by default it is main module class
Returns
boolean check result

◆ bx_is_srv_ii()

bx_is_srv_ii ( $mixedModule,
$sMethod,
$sClass = "Module" )

Check whether serice method exists or not in 'Ignore Inactive' mode.

◆ bx_js_string()

bx_js_string ( $mixedInput,
$iQuoteType = BX_ESCAPE_STR_AUTO )

Escapes string/array ready to pass to js script with filtered symbols like ', " etc

Parameters
$mixedInput- string/array which should be filtered
$iQuoteType- string escaping method: BX_ESCAPE_STR_AUTO(default), BX_ESCAPE_STR_APOS or BX_ESCAPE_STR_QUOTE
Returns
converted string / array

◆ bx_linkify()

bx_linkify ( $text,
$sAttrs = '',
$bHtmlSpecialChars = false )

Wrap in A tag links in TEXT string

Parameters
$text- text string without tags
$sAttrs- attributes string to add to the added A tag
$bHtmlSpecialChars- apply htmlspecialchars before processing
Returns
string where all links are wrapped in A tag

◆ bx_linkify_html()

bx_linkify_html ( $sHtmlOrig,
$sAttrs = '' )

Wrap in A tag links in HTML string, which aren't wrapped in A tag yet

Parameters
$sHtmlOrig- HTML string
$sAttrs- attributes string to add to the added A tag
Returns
modified HTML string, in case of errror original string is returned

◆ bx_log()

bx_log ( $sObject,
$mixed )

Log to logs object

Parameters
$sObject- logs object
$mixed- string or array to log

◆ bx_login()

bx_login ( $iId,
$bRememberMe = false )

Login user by setting necessary cookies

Parameters
$iIdaccount id
$bRememberMeremember session
Returns
false if id isn't correct or array of user info if user was logged in

Hooks:

'account', 'login' - hook after user performed login

◆ bx_login_form()

bx_login_form ( $bStudio = false,
$bAjaxMode = false,
$sForceRelocate = '' )

Display login form and exit

Parameters
$bStudiodisplay login form for studio
$bAjaxModelogin form displayed via AJAX
sForceRelocateforece relocate

◆ bx_logout()

bx_logout ( $bNotify = true)

Logout user by removing cookies

Hooks:

'account', 'logout' - hook after user performed logout

◆ bx_parse_str()

bx_parse_str ( $s)

It works similar to parse_str php function, but it doesn't decode URL params

◆ bx_php_string_apos()

bx_php_string_apos ( $mixedInput)

Escapes string/array ready to pass to php script with filtered symbols like ', " etc

Parameters
mixed$mixedInput- string/array which should be filtered
Returns
converted string / array

◆ bx_process_input()

bx_process_input ( $mixedData,
$iDataType = BX_DATA_TEXT,
$mixedParams = false,
$isCheckMagicQuotes = true )

Functions to process user input. DON'T use to process data before passing to SQL query - use db prepare instead

See also
BxDolDb\prepare. It is ok to use bx_process_input and then db prepare.
Parameters
$mixedDatadata to process
$iDataTypehow to handle data, possible valies:
BX_DATA_INT - integer value
BX_DATA_FLOAT - float values
BX_DATA_CHECKBOX - 'on' or empty string
BX_DATA_TEXT - text data, single line (default)
BX_DATA_TEXT_MULTILINE - text data, multiple lines
BX_DATA_HTML - HTML data
BX_DATA_DATE - date data type stored as yyyy-mm-dd
BX_DATA_DATETIME - date/time data type stored as yyyy-mm-dd hh:mm:ss
BX_DATA_DATE_TS' - date data type stored as unixtimestamp
BX_DATA_DATETIME_TS - date/time data type stored as unixtimestamp
BX_DATA_DATE_TS_UTC - date data type stored as unixtimestamp from UTC time
BX_DATA_DATETIME_TS_UTC - date/time data type stored as unixtimestamp from UTC time
const BX_DATA_DATE_TS
date data type stored as unixtimestamp
Definition utils.inc.php:20
const BX_DATA_INT
integer data type
Definition utils.inc.php:14
const BX_DATA_CHECKBOX
checkbox data type, 'on' or empty value
Definition utils.inc.php:16
const BX_DATA_DATETIME
date/time data type stored as yyyy-mm-dd hh:mm:ss
Definition utils.inc.php:19
const BX_DATA_TEXT
regular text data type
Definition utils.inc.php:12
const BX_DATA_DATE
date data type stored as yyyy-mm-dd
Definition utils.inc.php:18
const BX_DATA_HTML
HTML data type.
Definition utils.inc.php:17
const BX_DATA_TEXT_MULTILINE
regular multiline text data type
Definition utils.inc.php:13
const BX_DATA_FLOAT
float data type
Definition utils.inc.php:15
$mixedParamsoptional parameters to pass for validation
$isCheckMagicQuotesdeprecated
Returns
the filtered data, or FALSE if the filter fails.

◆ bx_process_macros()

bx_process_macros ( $s)

This function converts macros upon text output. Macros represents constructions like this:

{{!module_name:function[param1, "param2"]}}

For example, to display some content from module Posts:

{{!bx_posts:get_search_result_unit[3]}}

Only users which have "use macros" ACL action enabled can use this functionlity.

Parameters
$stext to process
Returns
modified or not modified text

◆ bx_proto()

bx_proto ( )

Returns current site protocol http:// or https://

◆ bx_require_authentication()

bx_require_authentication ( $bStudio = false,
$bAjaxMode = false,
$sForceRelocate = '' )

Declare that content is require user authoriztion and display login form if user isn't logged in

Parameters
$bStudiorequire webmaster authorization

◆ bx_show_service_unavailable_error_and_exit()

bx_show_service_unavailable_error_and_exit ( $sMsg = false,
$iRetryAfter = 86400 )

Show HTTP 503 service unavailable error and exit

◆ bx_smart_readfile()

bx_smart_readfile ( $sPath,
$sFilename = '',
$sMimeType = 'application/octet-stream',
$iCacheAge = 0,
$sCachePrivacy = 'public',
$sContentDisposition = 'inline' )

The function is sumilar to php readfile, but it send all required headers and can send file by chunks and suports file seek

Parameters
$sPathpath to file to output to the browser
$sFilenamefilename without path, ig file is saved from browser, then this name is used, not used(empty) by default
$sMimeTypefile mime type, by default 'application/octet-stream'
$iCacheAgefile cache age, by default 0
$sCachePrivacycache privacy 'public' (default value) or 'private'
$sContentDispositioncontent disposition header ('inline' or 'attachment' usually
Returns
true on success or false on error

◆ bx_srv()

bx_srv ( $mixed,
$sMethod,
$aParams = array(),
$sClass = 'Module',
$bIgnoreCache = false,
$bIgnoreInactive = false )

Perform serice call

Parameters
$mixedmodule name or module id
$sMethodservice method name in format 'method_name', corresponding class metod is serviceMethodName
$aParamsparams to pass to service method
$sClassclass to search for service method, by default it is main module class
Returns
service call result

◆ bx_srv_ic()

bx_srv_ic ( $mixed,
$sMethod,
$aParams = array(),
$sClass = 'Module',
$bIgnoreInactive = false )

Perform serice call in 'Ignore Cache' mode.

◆ bx_srv_ii()

bx_srv_ii ( $mixed,
$sMethod,
$aParams = array(),
$sClass = 'Module',
$bIgnoreCache = false )

Perform serice call in 'Ignore Inactive' mode.

◆ bx_time_js()

bx_time_js ( $iUnixTimestamp,
$sFormatIdentifier = BX_FORMAT_DATE,
$bForceFormat = false )

Output time wrapped in <time> tag in HTML. Then time is autoformatted using JS upon page load, this is aumatically converted to user's timezone and updated in realtime in case of short periods of 'from now' time format.

This is just short version for:

See also
BxTemplFunctions\timeForJs
Parameters
$iUnixTimestamptime as unixtimestamp
$sFormatIdentifieroutput format identifier
See also
BX_FORMAT_DATE
BX_FORMAT_TIME
BX_FORMAT_DATE_TIME
Parameters
$bForceFormatforce provided format and don't use "from now" time autoformat.

◆ bx_time_utc()

bx_time_utc ( $iUnixTimestamp)

Get UTC/GMT time string in ISO8601 date format from provided unix timestamp

Parameters
$iUnixTimestamp- unix timestamp
Returns
ISO8601 formatted date/time string

◆ bx_trigger_error()

bx_trigger_error ( $sMsg,
$iNumLevelsBack = 0 )

Trigger user error

Parameters
$sMsgmessage to display
$iNumLevelsBackadd additional debug backtracing N levels back

◆ bx_trim_nl_duplicates()

bx_trim_nl_duplicates ( $s)

Strip all lines with no information for example:

,

◆ check_logged()

check_logged ( )

Check if user is logged in (necessary cookies are present) and set some global variables

Hooks:

'account', 'logged' - hook after user performed logged

◆ clear_xss()

clear_xss ( $val)

Hooks:

'account', 'clear_xss' - hook after string is checked for xss

  • $unit_name - equals system
  • $action - equals clear_xss
  • $object_id - not used
  • $sender_id - not used
  • $extra_params - array of additional params with the following array keys:
    • oHtmlPurifier - [object] HtmlPurifier object
    • input_data - [string] string before check xss
    • return_data - [string] by ref, string before check xss, can be overridden in hook processing
      HOOKS
      hook-system-clear_xss

◆ DesignBoxContent()

DesignBoxContent ( $sTitle,
$sContent,
$iTemplateNum = BX_DB_DEF,
$mixedMenu = false )

◆ encryptUserId()

encryptUserId ( $sId)

Hash profile ID

◆ encryptUserPwd()

encryptUserPwd ( $sPwd,
$sSalt )

Encrypt user password. When BX_PWD_ALGO is 'custom', then bx_custom_pwd_encrypt function with custom algorythm must be defined in inc/header.inc.php file.

Parameters
$sPwdclear password
$sSaltsalt
Returns
password hash

◆ getLoggedId()

getLoggedId ( )
Returns
logged in account id

◆ getLoggedPassword()

getLoggedPassword ( )
Returns
logged in account password

◆ htmlspecialchars_adv()

htmlspecialchars_adv ( $string)

DEPRECATED

use bx_process_input + bx_process_output instead

function for processing pass data

This function cleans the GET/POST/COOKIE data if magic_quotes_gpc() is on for data which should be outputed immediately after submit

◆ isLogged()

isLogged ( )
Returns
true if user is logged in

◆ isMember()

isMember ( $iId = 0)

It checks if account role is member.

Returns
true if account is admin

◆ isRole()

if(!function_exists("isAdmin")) isRole ( $iRole,
$iId = 0 )

Check user role

Parameters
$iRolerole to check user for
$iIdoptional account id, if it isn't specified then curently logged in account is used
Returns
true if user is in the provided role

◆ send_headers_page_changed()

send_headers_page_changed ( )

Use this function in pages if you want to not cache it.

◆ sendMail()

sendMail ( $mRecipientEmails,
$sMailSubject,
$sMailBody,
$iRecipientID = 0,
$aPlus = array(),
$iEmailType = BX_EMAIL_NOTIFY,
$sEmailFlag = 'html',
$isDisableAlert = false,
$aCustomHeaders = array(),
$bAddToQueue = false )

Send email function

Parameters
$mRecipientEmails- Email where email should be send, can be array, string with one email or comma separated
$sMailSubject- subject of the message
$sMailBody- Body of the message
$iRecipientID- ID of recipient profile
$aPlus- Array of additional information
$iEmailType- email message type: BX_EMAIL_SYSTEM, BX_EMAIL_NOTIFY or BX_EMAIL_MASS
$sEmailFlag- use 'html' for HTML email message
$isDisableAlert- disable alert
$aCustomHeaders- custom email headers
$bAddToQueue- add message to email queue
Returns
true if message was send or false otherwise

◆ sendMailTemplate()

sendMailTemplate ( $sTemplateName,
$iAccountId = 0,
$iProfileId = 0,
$aReplaceVars = array(),
$iEmailType = BX_EMAIL_NOTIFY,
$bAddToQueue = false )

Send mail to user by parsing email template

◆ sendMailTemplateSystem()

sendMailTemplateSystem ( $sTemplateName,
$aReplaceVars = array(),
$iEmailType = BX_EMAIL_SYSTEM,
$bAddToQueue = false )

Send system email

◆ title2uri()

title2uri ( $sValue)

The following two functions are needed to convert title to uri and back. It usefull when titles are used in URLs, like in Categories and Tags.

Variable Documentation

◆ BX_DB_CONTENT_ONLY

const BX_DB_CONTENT_ONLY 0

design box with content only - no borders, no background, no caption

See also
DesignBoxContent

◆ BX_DB_DEF

const BX_DB_DEF 1

default design box with content, borders and caption

See also
DesignBoxContent

◆ BX_DB_EMPTY

const BX_DB_EMPTY 2

just empty design box, without anything

See also
DesignBoxContent

◆ BX_DB_NO_CAPTION

const BX_DB_NO_CAPTION 3

design box with content, like BX_DB_DEF but without caption

See also
DesignBoxContent

◆ BX_DB_PADDING_CONTENT_ONLY

const BX_DB_PADDING_CONTENT_ONLY 10

design box with content only wrapped with default padding - no borders, no background, no caption it can be used to just wrap content with default padding

See also
DesignBoxContent

◆ BX_DB_PADDING_DEF

const BX_DB_PADDING_DEF 11

default design box with content wrapped with default padding, borders and caption

See also
DesignBoxContent

◆ BX_DB_PADDING_NO_CAPTION

const BX_DB_PADDING_NO_CAPTION 13

design box with content wrapped with default padding, like BX_DB_DEF but without caption

See also
DesignBoxContent

◆ BX_ESCAPE_STR_APOS

const BX_ESCAPE_STR_APOS 1

escape apostrophes only, for js strings enclosed in apostrophes, for use in

See also
bx_js_string and
bx_html_attribute

◆ BX_ESCAPE_STR_AUTO

const BX_ESCAPE_STR_AUTO 0

turn apostropes and quote signs into html special chars, for use in

See also
bx_js_string and
bx_html_attribute

◆ BX_ESCAPE_STR_QUOTE

const BX_ESCAPE_STR_QUOTE 2

escape quotes only, for js strings enclosed in quotes, for use in

See also
bx_js_string and
bx_html_attribute

◆ BX_FORMAT_DATE

const BX_FORMAT_DATE 'sys_format_date'

date format identifier for use in

See also
bx_time_js function

◆ BX_FORMAT_DATE_TIME

const BX_FORMAT_DATE_TIME 'sys_format_datetime'

datetime format identifier for use in

See also
bx_time_js function

◆ BX_FORMAT_TIME

const BX_FORMAT_TIME 'sys_format_time'

time format identifier for use in

See also
bx_time_js function