Page tree
Skip to end of metadata
Go to start of metadata

Under /var/www/html/admin/libraries/utility.functions.php , we've got some methods useful they can be used any times.


functionDescription
freepbx_log_security($txt)Log a message to the freepbx security file
freepbx_log($level, $message)FreePBX Logging facility to FILE or syslog
version_compare_freepbx($version1, $version2, $op = null)version_compare that works with FreePBX version numbers
compress_framework_css()None
die_freepbx($text, $extended_text="", $type="FATAL")Throw FreePBX DIE Message
getversion($cached=true)Get the FreePBX/Framework Version
get_framework_version($cached=true)Get the FreePBX/Framework Version (Depreciated in favor of getversion)
needreload()Tell the user we need to apply changes and reload Asterisk
check_reload_needed($implicit_grant=false)Check to see if Apply Changes/Need Reload flag has been set
freepbx_debug($string, $option='', $filename='')Log a debug message to a debug file (Depreciated)
dbugcalltrace()None
d($var, $tags = null)None
dbug()FreePBX Debugging function
freepbx_error_handler($errno, $errstr, $errfile, $errline,  $errcontext)http://php.net/manual/en/function.set-error-handler.php
out($text,$log=true)None
outn($text,$log=true)None
error($text,$log=true)None
fatal($text,$log=true)None
file_get_contents_url($file_url)

like file_get_contents designed to work with url only, will try
wget if fails or if MODULEADMINWGET set to true. If it detects
failure, will set MODULEADMINWGET to true for future improvements.

edit_crontab($remove = '', $add = '')

function edit crontab
short Add/removes stuff rom conrtab
long Use this function to programmatically add/remove data from the crontab
will always run as the asterisk user

dbug_write($txt, $check = false)None
json_print_pretty($json, $indent = "\t")

this function can print a json object in a "pretty"

astdb_get($exclude = array())None
astdb_put($astdb, $exclude = array())None
scandirr($dir, $absolute = false)

Function scandirr scans a directory just like scandir(), only recursively
returns a hierarchical array representing the directory structure

dbug_printtree($dir, $indent = "\t")Prints an array as a "tree" of data
fpbx_which($app)Returns the absolute path to a system application
bytes2string($size)Returns a rounded string representation of a byte size
string2bytes($str, $type = '')Returns a rounded byte size representation of a string
download_file($file, $name = '', $type = '', $force_download = false)Downloads a file to the browser (i.e. sends the file to the browser)
fpbx_pdfinfo($pdf)Get data from a pdf file. Requires pdfinfo
generate_message_banner($message,$type='info',$details=array(),$link='',$closeable = false)Generate Message Banner(s)
fpbx_ami_update($user=false, $pass=false, $writetimeout = false)Update AMI credentials in manager.conf
sanitize_outbound_callerid($cid)None
rrmdir($dir)Recursively remove a directory
bootstrap_include_hooks($hook_type, $module)

Run bootstrap hooks as provided by module.xml
We currently support hooking at two points: before modules are loaded and after modules are loaded
Before we load ANY modules, we will include all "all_mods" hooks
Before we load an indevidual module, we will load there specifc hook

_bootstrap_parse_hooks()Helper function to laod hooks for bootstrap_include_hooks()
varsub($string, $del = '$')do variable substitution
getSystemMemInfo()None
getCpuCount()None
freepbx_filetype($file)Check filetype of files
freepbx_filesize($file)Return semi-accurate filesize for files
freepbxGetSanitizedRequest($definition = FILTER_SANITIZE_STRING, $add_empty = true)

Use filter_input_array
The filter extension is enabled by default as of PHP 5.2.0. To disable the filter extension, use --disable-filter .
Before PHP 5.2 an experimental PECL extension was used, however, the PECL version is no longer recommended or updated.

IsAsteriskSupported($version)None
version_min($origin, $list)None
checkFreeSpace($allowedSpace)None
  • No labels