include/utils.php

Show: inherited
    Table of Contents

    Functions

    functionStackTraceErrorHandler(  $errno,  $errstr,  $errfile,  $errline,  $errcontext ) : void

    Parameters
    Name Type Description
    $errno
    $errstr
    $errfile
    $errline
    $errcontext
    function_getIcon(  $iconFileName ) : void

    Parameters
    Name Type Description
    $iconFileName
    function_mergeCustomAppListStrings( \file $file, \app_list_strings $app_list_strings ) : array

    The dropdown items in custom language files is $app_list_strings['$key']['$second_key'] = $value not $GLOBALS['app_list_strings']['$key'] = $value, so we have to delete the original ones in app_list_strings and relace it with the custom ones.

    Parameters
    Name Type Description
    $file \file

    string the language that you want include,

    $app_list_strings \app_list_strings

    array the golbal strings

    Returns
    Type Description
    array
    function_pp(  $mixed ) : void

    Private helper function for displaying the contents of a given variable.

    This function is only intended to be used for SugarCRM internal development. The pp stands for Pre Print.

    Parameters
    Name Type Description
    $mixed
    function_ppd(  $mixed ) : void

    Private helper function for displaying the contents of a given variable.

    This function is only intended to be used for SugarCRM internal development. The ppd stands for Pre Print Die.

    Parameters
    Name Type Description
    $mixed
    function_ppf( object $bean,  $die = false ) : void

    private helper function to quickly show the major, direct, field attributes of a given bean.

    The ppf stands for Pre[formatted] Print Focus [object]

    Parameters
    Name Type Description
    $bean object

    bean The focus bean

    $die
    function_ppl( \$mixed $mixed, \$die $die = false, \$displayStackTrace $displayStackTrace = false,  $loglevel = "fatal" ) : void

    Private helper function for displaying the contents of a given variable in the Logger. This function is only intended to be used for SugarCRM internal development. The pp stands for Pre Print.

    Parameters
    Name Type Description
    $mixed \$mixed

    var to print_r()

    $die \$die

    boolean end script flow

    $displayStackTrace \$displayStackTrace

    also show stack trace

    $loglevel
    function_ppt(  $mixed,  $textOnly = false ) : void

    Private helper function for displaying the contents of a given variable.

    This function is only intended to be used for SugarCRM internal development. The pp stands for Pre Print Trace.

    Parameters
    Name Type Description
    $mixed
    $textOnly
    function_pptd(  $mixed ) : void

    Private helper function for displaying the contents of a given variable.

    This function is only intended to be used for SugarCRM internal development. The pp stands for Pre Print Trace Die.

    Parameters
    Name Type Description
    $mixed
    function_pstack_trace(  $mixed = NULL ) : void

    Private helper function for displaying the contents of a given variable.

    This function is only intended to be used for SugarCRM internal development. The pp stands for Pre Print.

    Parameters
    Name Type Description
    $mixed
    functionadd_http(  $url ) : void

    Parameters
    Name Type Description
    $url
    functionadd_quotes(  $str ) : void

    Parameters
    Name Type Description
    $str
    functionadd_squotes(  $str ) : void

    Parameters
    Name Type Description
    $str
    functionajaxInit( ) : void

    This function is designed to set up the php enviroment for AJAX requests.

    functionappendPortToHost( \$url $url, \$port $port ) : \$resulturl

    This function will take a number and system_id and format

    Parameters
    Name Type Description
    $url \$url

    URL containing host to append port

    $port \$port

    the port number - if '' is passed, no change to url

    Returns
    Type Description
    \$resulturl the new URL with the port appended to the host
    functionappend_where_clause( \$where_clauses $where_clauses, \$variable_name $variable_name, \$SQL_name $SQL_name = null ) : void

    Creates an array of where restrictions. These are used to construct a where SQL statement on the query It looks for the variable in the $_REQUEST array. If it is set and is not "" it will create a where clause out of it.

    Parameters
    Name Type Description
    $where_clauses \$where_clauses
    • The array to append the clause to
    $variable_name \$variable_name
    • The name of the variable to look for an add to the where clause if found
    $SQL_name \$SQL_name
    • [Optional] If specified, this is the SQL column name that is used. If not specified, the $variable_name is used as the SQL_name. Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..
    functionarray_csort( ) : void

    Very cool algorithm for sorting multi-dimensional arrays. Found at http://us2.php.net/manual/en/function.array-multisort.php Syntax: $new_array = array_csort($array [, 'col1' [, SORT_FLAG [, SORT_FLAG]]]...); Explanation: $array is the array you want to sort, 'col1' is the name of the column you want to sort, SORT_FLAGS are : SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING you can repeat the 'col',FLAG,FLAG, as often you want, the highest prioritiy is given to the first - so the array is sorted by the last given column first, then the one before ...

    Example: $array = array_csort($array,'town','age',SORT_DESC,'name'); Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    functionarray_depth(  $array,  $depth_count = -1,  $depth_array = array() ) : void

    Parameters
    Name Type Description
    $array
    $depth_count
    $depth_array
    functionbr2nl(  $str ) : void

    Parameters
    Name Type Description
    $str
    functioncan_start_session( ) : void

    functionchartColors( ) : \sugarColors.xml

    Chart dashlet helper functions that returns the correct XML color file for charts, dependent on the current theme.

    Returns
    Type Description
    \sugarColors.xml to use
    functionchartStyle( ) : \chart.css

    Chart dashlet helper function that returns the correct CSS file, dependent on the current theme.

    Returns
    Type Description
    \chart.css file to use
    Details
    Todo
    this won't work completely right until we impliment css compression and combination for now, we'll just include the last css file found.  
    functioncheckAuthUserStatus( ) : void

    functioncheckForMobile( ) : bool

    Checks for hit from a mobile browser

    Returns
    Type Description
    bool
    functioncheckLoginUserStatus( ) : void

    functioncheck_iis_version(  $sys_iis_version = '' ) : \1

    Will check if a given IIS version string is supported (tested on this ver), unsupported (results unknown), or invalid (something will break on this ver).

    Parameters
    Name Type Description
    $sys_iis_version
    Returns
    Type Description
    \1 implies supported, 0 implies unsupported, -1 implies invalid
    functioncheck_logic_hook_file(  $module_name,  $event,  $action_array ) : void

    Parameters
    Name Type Description
    $module_name
    $event
    $action_array
    functioncheck_php_version(  $sys_php_version = '' ) : \1

    Will check if a given PHP version string is supported (tested on this ver), unsupported (results unknown), or invalid (something will break on this ver). Do not pass in any pararameter to default to a check against the current environment's PHP version.

    Parameters
    Name Type Description
    $sys_php_version
    Returns
    Type Description
    \1 implies supported, 0 implies unsupported, -1 implies invalid
    functionclean(  $string,  $maxLength ) : void

    Parameters
    Name Type Description
    $string
    $maxLength
    functionclean_incoming_data( ) : void

    functionclean_sensitive_data( array $defs, \SugarBean | array $data ) : mixed

    Remove vars marked senstitive from array

    Parameters
    Name Type Description
    $defs array
    $data \SugarBean | array
    Returns
    Type Description
    mixed $data without sensitive fields
    functionclean_special_arguments( ) : void

    functionclean_string( string $str, string $filter = "STANDARD", boolean $dieOnBadData = true ) : void

    Designed to take a string passed in the URL as a parameter and clean all "bad" data from it

    Parameters
    Name Type Description
    $str string
    $filter string

    which corresponds to a regular expression to use; choices are: "STANDARD" ( default ) "STANDARDSPACE" "FILE" "NUMBER" "SQL_COLUMN_LIST" "PATH_NO_URL" "SAFED_GET" "UNIFIED_SEARCH" "AUTO_INCREMENT" "ALPHANUM"

    $dieOnBadData boolean

    true (default) if you want to die if bad data if found, false if not

    functionclean_superglobals(  $key,  $filter = 'STANDARD' ) : void

    cleans the given key in superglobals $_GET, $_POST, $_REQUEST

    Parameters
    Name Type Description
    $key
    $filter
    functionclean_xss( string $str, bool $cleanImg = true ) : array

    Detects typical XSS attack patterns

    Parameters
    Name Type Description
    $str string

    str String to search for XSS attack vectors

    $cleanImg bool

    cleanImg Flag to allow tags to survive - only used by InboundEmail for inline images.

    Returns
    Type Description
    array Array of matches, empty on clean string
    Details
    Deprecated
     
    functioncleanup_slashes(  $value ) : void

    Parameters
    Name Type Description
    $value
    functionclearAllJsAndJsLangFilesWithoutOutput( ) : void

    We need to clear all the js cache files, including the js language files in serval places in MB. So I extract them into a util function here.

    Details
    Depends
    on QuickRepairAndRebuild.php  
    Relate
    bug 30642 ,23177  
    functionclear_register_value(  $category,  $name ) : void

    Parameters
    Name Type Description
    $category
    $name
    functionclone_history(  $db,  $from_id,  $to_id,  $to_type ) : void

    Parameters
    Name Type Description
    $db
    $from_id
    $to_id
    $to_type
    functionclone_relationship(  $db,  $tables = array(),  $from_column,  $from_id,  $to_id ) : void

    Parameters
    Name Type Description
    $db
    $tables
    $from_column
    $from_id
    $to_id
    functioncmp_beans(  $a,  $b ) : void

    Parameters
    Name Type Description
    $a
    $b
    functioncode2utf(  $num ) : void

    Parameters
    Name Type Description
    $num
    functionconvert_id(  $string ) : void

    Parameters
    Name Type Description
    $string
    functionconvert_module_to_singular(  $module_array ) : void

    Parameters
    Name Type Description
    $module_array
    functioncreateGroupUser( string $name ) : string

    Creates a new Group User

    Parameters
    Name Type Description
    $name string

    Name of Group User

    Returns
    Type Description
    string GUID of new Group User
    functioncreate_export_query_relate_link_patch( \$module: $module, \$searchFields: $searchFields, \$where: $where ) : \$ret_array['where']:\$ret_array['join']:

    create_export_query is used for export and massupdate We haven't handle the these fields: $field['type'] == 'relate' && isset($field['link'] This function will correct the where clause and output necessary join condition for them

    Parameters
    Name Type Description
    $module \$module:

    the module name

    $searchFields \$searchFields:

    searchFields which is got after $searchForm->populateFromArray()

    $where \$where:

    where clauses

    Returns
    Type Description
    \$ret_array['where']:\$ret_array['join']: corrected where clauseextra join condition
    functioncreate_guid( ) : String

    A temporary method of generating GUIDs of the correct format for our DB.

    Returns
    Type Description
    String contianing a GUID in the format: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..
    functioncreate_guid_section(  $characters ) : void

    Parameters
    Name Type Description
    $characters
    functiondecodeJavascriptUTF8(  $str ) : void

    Private helper function for decoding javascript UTF8 This function is only intended to be used for SugarCRM internal development.

    Parameters
    Name Type Description
    $str
    functiondisplayStudioForCurrentUser( ) : void

    functiondisplayWorkflowForCurrentUser( ) : void

    functiondisplay_notice(  $msg = false ) : void

    Parameters
    Name Type Description
    $msg
    functiondisplay_stack_trace(  $textOnly = false ) : void

    Parameters
    Name Type Description
    $textOnly
    functionencodeMultienumValue(  $arr ) : void

    Parameters
    Name Type Description
    $arr
    functionensure_length(  $string,  $length ) : void

    Parameters
    Name Type Description
    $string
    $length
    functionfilterInboundEmailPopSelection( array $protocol ) : void

    Filter the protocol list for inbound email accounts.

    Parameters
    Name Type Description
    $protocol array
    functionformat_number_display( \$num $num, \$system_id $system_id ) : \$result

    Generate a string for displaying a unique identifier that is composed of a system_id and number. This is use to allow us to generate quote numbers using a DB auto-increment key from offline clients and still have the number be unique (since it is modified by the system_id.

    Parameters
    Name Type Description
    $num \$num

    of bean

    $system_id \$system_id

    from system

    Returns
    Type Description
    \$result a formatted string
    functionformat_skype(  $number ) : void

    Parameters
    Name Type Description
    $number
    functiongenerateETagHeader( string $etag ) : void

    generateETagHeader

    This function generates the necessary cache headers for using ETags with dynamic content. You simply have to generate the ETag, pass it in, and the function handles the rest.

    Parameters
    Name Type Description
    $etag string

    ETag to use for this content.

    functiongenerate_search_where(  $field_list = array(),  $values = array(),  $bean,  $add_custom_fields = false,  $module = '' ) : void

    Parameters
    Name Type Description
    $field_list
    $values
    $bean
    $add_custom_fields
    $module
    functiongenerate_where_statement( \$where_clauses $where_clauses ) : void

    Generate the appropriate SQL based on the where clauses.

    Parameters
    Name Type Description
    $where_clauses \$where_clauses
    • An Array of individual where clauses stored as strings
    Details
    Returns
    string where_clause - The final SQL where clause to be executed. Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..  
    functiongetAbsolutePath( string $path,  $currentServer = false ) : string

    Returns an absolute path from the given path, determining if it is relative or absolute

    Parameters
    Name Type Description
    $path string
    $currentServer
    Returns
    Type Description
    string
    functiongetCurrentURL( ) : void

    functiongetDefaultXssTags( ) : array

    returns a default array of XSS tags to clean

    Returns
    Type Description
    array
    functiongetFTSBoostOptions( string $optionName ) : array

    Parameters
    Name Type Description
    $optionName string
    • name of the option to be retrieved from app_list_strings
    Returns
    Type Description
    array - the array to be used in option element
    functiongetFTSEngineType( ) : string

    Returns
    Type Description
    string - the full text search engine name
    functiongetImagePath(  $image_name ) : void

    Parameters
    Name Type Description
    $image_name
    Details
    Deprecated
    use SugarTheme::getImageURL()  
    functiongetJSONobj( ) : \JSON

    Singleton to return JSON object

    Returns
    Type Description
    \JSON object
    functiongetJSPath(  $relative_path,  $additional_attrs = '' ) : void

    Parameters
    Name Type Description
    $relative_path
    $additional_attrs
    functiongetJavascriptSiteURL( ) : \$site_url

    getJavascriptSiteURL This function returns a URL for the client javascript calls to access the site. It uses $_SERVER['HTTP_REFERER'] in the event that Proxy servers are used to access the site. Thus, the hostname in the URL returned may not always match that of $sugar_config['site_url']. Basically, the assumption is that however the user accessed the website is how they will continue to with subsequent javascript requests. If the variable $_SERVER['HTTP_REFERER'] is not found then we default to old algorithm.

    Returns
    Type Description
    \$site_url The url used to refer to the website
    functiongetMajorMinorVersion( string $version ) : \version

    Return the numeric portion of a version. For example if passed 5.5.0RC1 then return 5.5. If given 5.5.1RC1 then return 5.5.1

    Parameters
    Name Type Description
    $version string
    Returns
    Type Description
    \version
    functiongetPhpInfo( \$level $level = -1 ) : \$returnInfo

    This function returns an array of phpinfo() results that can be parsed and used to figure out what version we run, what modules are compiled in, etc.

    Parameters
    Name Type Description
    $level \$level

    int info level constant (1,2,4,8...64);

    Returns
    Type Description
    \$returnInfo array array of info about the PHP environment
    Details
    Author
    original by "code at adspeed dot com" Fron php.net  
    Author
    customized for Sugar by Chris N.  
    functiongetReportNameTranslation( string $reportName ) : string

    getReportNameTranslation

    Translates the report name if a translation exists, otherwise just returns the name

    Parameters
    Name Type Description
    $reportName string
    Returns
    Type Description
    string translated report name
    functiongetSQLDate(  $date_str ) : void

    Parameters
    Name Type Description
    $date_str
    functiongetSWFPath(  $relative_path,  $additional_params = '' ) : void

    Parameters
    Name Type Description
    $relative_path
    $additional_params
    functiongetStudioIcon( string $iconFileName = '',  $altFileName = '', string $width = '48', string $height = '48', string $align = 'baseline', string $alt = '' ) : string

    Function to grab the correct icon image for Studio

    Parameters
    Name Type Description
    $iconFileName string

    Name of the icon file

    $altFileName
    $width string

    Width of image

    $height string

    Height of image

    $align string

    Alignment of image

    $alt string

    Alt tag of image

    Returns
    Type Description
    string $string <img> tag with corresponding image
    functiongetTeamSetNameJoin(  $table_name ) : void

    Parameters
    Name Type Description
    $table_name
    functiongetTrackerSubstring( string $name ) : string

    getTrackerSubstring

    Returns a [number]-char or less string for the Tracker to display in the header based on the tracker_max_display_length setting in config.php. If not set, or invalid length, then defaults to 15 for COM editions, 30 for others.

    Parameters
    Name Type Description
    $name string

    name field for a given Object

    Returns
    Type Description
    string [number]-char formatted string if length of string exceeds the max allowed
    functiongetUrls(  $string ) : array

    Extract urls from a piece of text

    Parameters
    Name Type Description
    $string
    Returns
    Type Description
    array of urls found in $string
    functiongetUserArrayFromFullName( \args $args,  $hide_portal_users = false ) : array

    uses a different query to return a list of users than get_user_array() Used from QuickSearch.php

    Parameters
    Name Type Description
    $args \args

    string where clause entry

    $hide_portal_users
    Returns
    Type Description
    array Array of Users' details that match passed criteria
    functiongetVariableFromQueryString(  $variable,  $string ) : void

    This function will allow you to get a variable value from query string

    Parameters
    Name Type Description
    $variable
    $string
    functiongetVersionStatus( string $version ) : string

    Given a version such as 5.5.0RC1 return RC. If we have a version such as: 5.5 then return GA

    Parameters
    Name Type Description
    $version string
    Returns
    Type Description
    string RC, BETA, GA
    functiongetVersionedPath(  $path,  $additional_attrs = '' ) : void

    Parameters
    Name Type Description
    $path
    $additional_attrs
    functiongetVersionedScript(  $path,  $additional_attrs = '' ) : void

    Parameters
    Name Type Description
    $path
    $additional_attrs
    functiongetWebPath(  $relative_path ) : void

    Parameters
    Name Type Description
    $relative_path
    functionget_admin_modules_for_user(  $user ) : void

    Parameters
    Name Type Description
    $user
    functionget_all_languages( ) : void

    functionget_alt_hot_key( ) : String

    Returns the shortcut keys to access the shortcut links. Shortcut keys vary depending on browser versions and operating systems.

    Returns
    Type Description
    String value of the shortcut keys
    functionget_assigned_team_name(  $assigned_team_id ) : void

    Parameters
    Name Type Description
    $assigned_team_id
    functionget_assigned_user_name(  $assigned_user_id,  $is_group = '' ) : void

    Parameters
    Name Type Description
    $assigned_user_id
    $is_group
    functionget_bean_select_array(  $add_blank = true,  $bean_name,  $display_columns,  $where = '',  $order_by = '',  $blank_is_none = false ) : void

    Parameters
    Name Type Description
    $add_blank
    $bean_name
    $display_columns
    $where
    $order_by
    $blank_is_none
    functionget_clear_form_js( ) : void

    Create javascript to clear values of all elements in a form.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    functionget_custom_file_if_exists( \$file $file ) : \$file

    get_custom_file_if_exists

    This function handles the repetitive code we have where we first check if a file exists in the custom directory to determine whether we should load it, require it, include it, etc. This function returns the path of the custom file if it exists. It basically checks if custom/{$file} exists and returns this path if so; otherwise it return $file

    Parameters
    Name Type Description
    $file \$file

    String of filename to check

    Returns
    Type Description
    \$file String of filename including custom directory if found
    functionget_dashlets_dialog_icon( string $module = '', string $width = '32', string $height = '32', string $align = 'absmiddle', string $alt = '' ) : string

    Function to grab the correct icon image for Dashlets Dialog

    Parameters
    Name Type Description
    $module string

    Name of the module to fall back onto if file does not exist

    $width string

    Width of image

    $height string

    Height of image

    $align string

    Alignment of image

    $alt string

    Alt tag of image

    Returns
    Type Description
    string $string <img> tag with corresponding image
    functionget_emails_by_assign_or_link(  $params ) : void

    Parameters
    Name Type Description
    $params
    functionget_help_url( string $send_edition = '', string $send_version = '', string $send_lang = '', string $send_module = '', string $send_action = '', string $dev_status = '', string $send_key = '', string $send_anchor = '' ) : string

    get_help_url

    This will return the URL used to redirect the user to the help documentation. It can be overriden completely by setting the custom_help_url or partially by setting the custom_help_base_url in config.php or config_override.php.

    Parameters
    Name Type Description
    $send_edition string
    $send_version string
    $send_lang string
    $send_module string
    $send_action string
    $dev_status string
    $send_key string
    $send_anchor string
    Returns
    Type Description
    string the completed help URL
    functionget_image(  $image,  $other_attributes,  $width = "",  $height = "",  $ext = '.gif',  $alt = "" ) : void

    Parameters
    Name Type Description
    $image
    $other_attributes
    $width
    $height
    $ext
    $alt
    Details
    Deprecated
    use SugarTheme::getImage()  
    functionget_label(  $label_tag,  $temp_module_strings ) : void

    Parameters
    Name Type Description
    $label_tag
    $temp_module_strings
    functionget_language_display(  $key ) : void

    Parameters
    Name Type Description
    $key
    functionget_language_header( ) : String

    get_language_header

    This is a utility function for 508 Compliance. It returns the lang=[Current Language] text string used inside the tag. If no current language is specified, it defaults to lang='en'.

    Returns
    Type Description
    String The lang=[Current Language] markup to insert into the <html> tag
    functionget_languages( ) : void

    functionget_module_from_singular(  $singular ) : void

    Parameters
    Name Type Description
    $singular
    functionget_module_info(  $module_name ) : void

    Parameters
    Name Type Description
    $module_name
    functionget_notify_template_file(  $language ) : string

    get_notify_template_file This function will return the location of the email notifications template to use

    Parameters
    Name Type Description
    $language
    Returns
    Type Description
    string relative file path to email notifications template file
    functionget_register_value(  $category,  $name ) : void

    Parameters
    Name Type Description
    $category
    $name
    functionget_select_options(  $option_list,  $selected ) : void

    THIS FUNCTION IS DEPRECATED AND SHOULD NOT BE USED; USE get_select_options_with_id() Create HTML to display select options in a dropdown list. To be used inside of a select statement in a form.

    param $option_list - the array of strings to that contains the option list param $selected - the string which contains the default value Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $option_list
    $selected
    functionget_select_options_with_id(  $option_list,  $selected_key ) : void

    Create HTML to display select options in a dropdown list. To be used inside of a select statement in a form. This method expects the option list to have keys and values. The keys are the ids. The values are the display strings.

    param $option_list - the array of strings to that contains the option list param $selected - the string which contains the default value Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $option_list
    $selected_key
    functionget_select_options_with_id_separate_key(  $label_list,  $key_list,  $selected_key,  $massupdate = false ) : void

    Create HTML to display select options in a dropdown list. To be used inside of a select statement in a form. This method expects the option list to have keys and values. The keys are the ids. The values are the display strings.

    param $label_list - the array of strings to that contains the option list param $key_list - the array of strings to that contains the values list param $selected - the string which contains the default value Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $label_list
    $key_list
    $selected_key
    $massupdate
    functionget_set_focus_js( ) : void

    Create javascript to set the cursor focus to specific field in a form when the screen is rendered. The field name is currently hardcoded into the the function.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    functionget_singular_bean_name(  $bean_name ) : void

    Parameters
    Name Type Description
    $bean_name
    functionget_sub_cookies(  $name ) : void

    Parameters
    Name Type Description
    $name
    functionget_sugar_config_defaults( ) : void

    functionget_team_array(  $add_blank = FALSE ) : void

    retrieve the list of teams that this user has access to.

    add_blank -- If you would like to have a blank entry in the list (to allow no selection) pass true.

    Parameters
    Name Type Description
    $add_blank
    functionget_team_name( \unknown_type $team_id ) : void

    Bug 13271 - Sometimes we just want to know the name of a team for display purposes when the team_id may not be one of the users assigned teams.

    For example when they have an admin Role for a module we may need to display the teams for other users Unfortunately this means we can't just use the team_array value that may be stored in the register as unless we pass is_admin(), it won't contain all the necessary team names

    Parameters
    Name Type Description
    $team_id \unknown_type
    functionget_theme_display(  $theme ) : void

    Return the display name for a theme if it exists.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $theme
    Details
    Deprecated
    use SugarThemeRegistry::get($theme)->name instead  
    functionget_themes( ) : void

    Return an array of directory names.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Details
    Deprecated
    use SugarThemeRegistry::availableThemes() instead.  
    functionget_unlinked_email_query(  $type,  $bean ) : void

    Parameters
    Name Type Description
    $type
    $bean
    functionget_user_array( bool $add_blank = true, string $status = "Active", string $user_id = '', bool $use_real_name = false, String $user_name_filter = '', string $portal_filter = ' AND portal_only=0 ', bool $from_cache = true ) : array

    get_user_array

    This is a helper function to return an Array of users depending on the parameters passed into the function. This function uses the get_register_value function by default to use a caching layer where supported.

    Parameters
    Name Type Description
    $add_blank bool

    Boolean value to add a blank entry to the array results, true by default

    $status string

    String value indicating the status to filter users by, "Active" by default

    $user_id string

    String value to specify a particular user id value (searches the id column of users table), blank by default

    $use_real_name bool

    Boolean value indicating whether or not results should include the full name or just user_name, false by default

    $user_name_filter String

    String value indicating the user_name filter (searches the user_name column of users table) to optionally search with, blank by default

    $portal_filter string

    String query filter for portal users (defaults to searching non-portal users), change to blank if you wish to search for all users including portal users

    $from_cache bool

    Boolean value indicating whether or not to use the get_register_value function for caching, true by default

    Returns
    Type Description
    array Array of users matching the filter criteria that may be from cache (if similar search was previously run)
    functionget_user_name( string $id ) : string

    retrieves the user_name column value (login)

    Parameters
    Name Type Description
    $id string

    id GUID of user

    Returns
    Type Description
    string
    functionget_valid_bean_name(  $module_name ) : void

    In order to have one place to obtain the proper object name. aCase for example causes issues throughout the application.

    Parameters
    Name Type Description
    $module_name
    functionget_workflow_admin_modules_for_user(  $user ) : void

    Parameters
    Name Type Description
    $user
    functionhtml_entity_decode_utf8(  $string ) : void

    Parameters
    Name Type Description
    $string
    functioninDeveloperMode( ) : void

    functioninsert_charset_header( ) : void

    functionisTouchScreen( ) : void

    Returns true if the application is being accessed on a touch screen interface ( like an iPad )

    functionis_admin(  $user ) : void

    Check if user id belongs to a system admin.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $user
    functionis_admin_for_any_module(  $user ) : void

    Parameters
    Name Type Description
    $user
    functionis_admin_for_module(  $user,  $module ) : void

    Parameters
    Name Type Description
    $user
    $module
    functionis_freetds( ) : void

    functionis_guid( string $guid ) : bool

    determines if a passed string matches the criteria for a Sugar GUID

    Parameters
    Name Type Description
    $guid string
    Returns
    Type Description
    bool False on failure
    functionis_windows( ) : void

    tries to determine whether the Host machine is a Windows machine

    functionis_writable_windows( string $file ) : bool

    equivalent for windows filesystem for PHP's is_writable()

    Parameters
    Name Type Description
    $file string

    file Full path to the file/dir

    Returns
    Type Description
    bool true if writable
    functionjavascript_escape(  $str ) : void

    Parameters
    Name Type Description
    $str
    functionjs_escape(  $str,  $keep = true ) : void

    Parameters
    Name Type Description
    $str
    $keep
    functionloadBean( string $module ) : object

    Returns the bean object of the given module

    Parameters
    Name Type Description
    $module string
    Returns
    Type Description
    object
    Details
    Deprecated
    use SugarModule::loadBean() instead  
    functionload_link_class(  $properties ) : void

    Parameters
    Name Type Description
    $properties
    functionload_menu(  $path ) : void

    Parameters
    Name Type Description
    $path
    Details
    Deprecated
    use SugarView::getMenu() instead  
    functionlookupTimezone(  $userOffset = 0 ) : void

    best guesses Timezone based on webserver's TZ settings

    Parameters
    Name Type Description
    $userOffset
    functionmake_not_writable(  $file ) : void

    Parameters
    Name Type Description
    $file
    functionmake_sugar_config(  $sugar_config ) : void

    Parameters
    Name Type Description
    $sugar_config
    functionmark_delete_components(  $sub_object_array,  $run_second_level = false,  $sub_sub_array = "" ) : void

    Parameters
    Name Type Description
    $sub_object_array
    $run_second_level
    $sub_sub_array
    functionmicrotime_diff(  $a,  $b ) : void

    Parameters
    Name Type Description
    $a
    $b
    functionnumber_empty(  $value ) : boolean

    Check to see if the number is empty or non-zero

    Parameters
    Name Type Description
    $value
    Returns
    Type Description
    boolean
    functionorder_beans(  $beans,  $field_name ) : void

    Parameters
    Name Type Description
    $beans
    $field_name
    functionparse_calendardate(  $local_format ) : void

    Converts localized date format string to jscalendar format Example: $array = array_csort($array,'town','age',SORT_DESC,'name'); Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.

    All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $local_format
    functionparse_list_modules( \unknown_type $listArray ) : void

    Parameters
    Name Type Description
    $listArray \unknown_type
    functionpre_login_check( ) : void

    functionpreprocess_param(  $value ) : void

    Parameters
    Name Type Description
    $value
    functionrebuildConfigFile(  $sugar_config,  $sugar_version ) : bool

    This function will rebuild the config file

    Parameters
    Name Type Description
    $sugar_config
    $sugar_version
    Returns
    Type Description
    bool true if successful
    functionremove_logic_hook(  $module_name,  $event,  $action_array ) : void

    Parameters
    Name Type Description
    $module_name
    $event
    $action_array
    functionremove_xss( string $str ) : string

    Remove potential xss vectors from strings

    Parameters
    Name Type Description
    $str string

    str String to search for XSS attack vectors

    Returns
    Type Description
    string
    Details
    Deprecated
     
    functionreturnPhpJsonStatus( ) : bool

    finds the correctly working versions of PHP-JSON

    Returns
    Type Description
    bool True if NOT found or WRONG version
    functionreturn_app_list_strings_language( string $language ) : array

    This function retrieves an application language file and returns the array of strings included in the $app_list_strings var.

    Parameters
    Name Type Description
    $language string

    specific language to load

    Returns
    Type Description
    array lang strings
    functionreturn_application_language( string $language ) : array

    This function retrieves an application language file and returns the array of strings included.

    Parameters
    Name Type Description
    $language string

    specific language to load

    Returns
    Type Description
    array lang strings
    functionreturn_bytes(  $val ) : void

    For translating the php.ini memory values into bytes. e.g. input value of '8M' will return 8388608.

    Parameters
    Name Type Description
    $val
    functionreturn_mod_list_strings_language(  $language,  $module ) : void

    This function retrieves an application language file and returns the array of strings included in the $mod_list_strings var.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________.. If you are using the current language, do not call this function unless you are loading it for the first time

    Parameters
    Name Type Description
    $language
    $module
    functionreturn_module_language( string $language, string $module, bool $refresh = false ) : array

    This function retrieves a module's language file and returns the array of strings included.

    Parameters
    Name Type Description
    $language string

    specific language to load

    $module string

    module name to load strings for

    $refresh bool

    optional, true if you want to rebuild the language strings

    Returns
    Type Description
    array lang strings
    functionreturn_name(  $row,  $first_column,  $last_column ) : void

    This function returns the name of the person.

    It currently returns "first last". It should not put the space if either name is not available. It should not return errors if either name is not available. If no names are present, it will return "" Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $row
    $first_column
    $last_column
    functionreturn_session_value_or_default(  $varname,  $default ) : void

    If the session variable is defined and is not equal to "" then return it. Otherwise, return the default value.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $varname
    $default
    functionreturn_theme_language(  $language,  $theme ) : void

    This function retrieves a theme's language file and returns the array of strings included.

    Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $language
    $theme
    functionsafe_map(  $request_var,  $focus,  $always_copy = false ) : void

    Copy the specified request variable to the member variable of the specified object.

    Do no copy if the member variable is already set. Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $request_var
    $focus
    $always_copy
    functionsafe_map_named(  $request_var,  $focus,  $member_var,  $always_copy ) : void

    Copy the specified request variable to the member variable of the specified object.

    Do no copy if the member variable is already set. Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights Reserved. Contributor(s): ______________________________________..

    Parameters
    Name Type Description
    $request_var
    $focus
    $member_var
    $always_copy
    functionsanitize( \$input $input, int $quotes = ENT_QUOTES, string $charset = 'UTF-8', bool $remove = false ) : string

    Parameters
    Name Type Description
    $input \$input
    • the input string to sanitize
    $quotes int
    • use quotes
    $charset string
    • the default charset
    $remove bool
    • strip tags or not
    Returns
    Type Description
    string - the sanitized string
    functionsearch_filter_rel_info(  $focus,  $tar_rel_module,  $relationship_name ) : void

    Parameters
    Name Type Description
    $focus
    $tar_rel_module
    $relationship_name
    functionsecurexss(  $value ) : void

    Parameters
    Name Type Description
    $value
    functionsecurexsskey(  $value,  $die = true ) : void

    Parameters
    Name Type Description
    $value
    $die
    functionsetPhpIniSettings( ) : void

    Set default php.ini settings for entry points

    functionset_register_value(  $category,  $name,  $value ) : void

    Parameters
    Name Type Description
    $category
    $name
    $value
    functionset_superglobals(  $key,  $val ) : void

    Parameters
    Name Type Description
    $key
    $val
    functionshould_hide_iframes( ) : boolean

    should_hide_iframes This is a helper method to determine whether or not to show iframes (My Sites) related information in the application.

    Returns
    Type Description
    boolean flag indicating whether or not iframes module should be hidden
    functionshowFullName( ) : void

    based on user pref then system pref

    functionskype_formatted(  $number ) : void

    Parameters
    Name Type Description
    $number
    functionsql_like_string( string $str, string $like_char,  $wildcard = '%',  $appendWildcard = true ) : string

    Return search like string This function takes a user input string and returns a string that contains wild card(s) that can be used in db query.

    Parameters
    Name Type Description
    $str string

    string to be searched

    $like_char string

    Database like character, usually '%'

    $wildcard
    $appendWildcard
    Returns
    Type Description
    string Returns a string to be searched in db query
    functionstr_begin(  $str,  $begin ) : void

    Parameters
    Name Type Description
    $str
    $begin
    functionstr_end(  $str,  $end ) : void

    Parameters
    Name Type Description
    $str
    $end
    functionstr_split(  $string,  $length = 1 ) : void

    Parameters
    Name Type Description
    $string
    $length
    functionstr_split_php4(  $string,  $length = 1 ) : void

    Parameters
    Name Type Description
    $string
    $length
    functionstring_format( \$format $format, \$args $args ) : \$result

    This function will take a string that has tokens like {0}, {1} and will replace those tokens with the args provided

    Parameters
    Name Type Description
    $format \$format

    string to format

    $args \$args

    args to replace

    Returns
    Type Description
    \$result a formatted string
    functionsugarArrayMergeRecursive( array $gimp, array $dom ) : array

    Similiar to sugarArrayMerge except arrays of N depth are merged.

    Parameters
    Name Type Description
    $gimp array

    gimp the array whose values will be overloaded

    $dom array

    dom the array whose values will pwn the gimp's

    Returns
    Type Description
    array beaten gimp
    functionsugarLangArrayMerge(  $gimp,  $dom ) : array

    Identical to sugarArrayMerge but with some speed improvements and used specifically to merge language files. Language file merges do not need to account for null values so we can get some performance increases by using this specialized function. Note this merge function does not properly handle null values.

    Parameters
    Name Type Description
    $gimp
    $dom
    Returns
    Type Description
    array
    functionsugar_cleanup(  $exit = false ) : void

    Parameters
    Name Type Description
    $exit
    functionsugar_config_union(  $default,  $override ) : void

    Parameters
    Name Type Description
    $default
    $override
    functionsugar_die(  $error_message ) : void

    Call this method instead of die().

    Then we call the die method with the error message that is passed in.

    Parameters
    Name Type Description
    $error_message
    functionsugar_microtime( ) : string

    Return string composed of seconds & microseconds of current time, without dots

    Returns
    Type Description
    string
    functionsugar_substr(  $string,  $length,  $charset = 'UTF-8' ) : void

    The function is used because currently we are not supporting mbstring.func_overload For some user using mssql without FreeTDS, they may store multibyte charaters in varchar using latin_general collation. It cannot store so many mutilbyte characters, so we need to use strlen.

    The varchar in MySQL, Orcale, and nvarchar in FreeTDS, we can store $length mutilbyte charaters in it. we need mb_substr to keep more info.

    Parameters
    Name Type Description
    $string
    $length
    $charset
    Details
    Returns
    the substred strings.  
    functionsugar_ucfirst(  $string,  $charset = 'UTF-8' ) : void

    The function is used because on FastCGI enviroment, the ucfirst(Chinese Characters) will produce bad charcters.

    This will work even without setting the mbstring.*encoding

    Parameters
    Name Type Description
    $string
    $charset
    functiontranslate(  $string,  $mod = '',  $selectedValue = '' ) : void

    Parameters
    Name Type Description
    $string
    $mod
    $selectedValue
    functionunTranslateNum(  $num ) : void

    Parameters
    Name Type Description
    $num
    functionunencodeMultienum(  $string ) : void

    Parameters
    Name Type Description
    $string
    functionurl2html(  $string ) : void

    Adds the href HTML tags around any URL in the $string

    Parameters
    Name Type Description
    $string
    functionutf8_recursive_encode( \$data $data ) : \utf8

    utf8_recursive_encode

    This function walks through an Array and recursively calls utf8_encode on the values of each of the elements.

    Parameters
    Name Type Description
    $data \$data

    Array of data to encode

    Returns
    Type Description
    \utf8 encoded Array data
    functionvalues_to_keys(  $array ) : void

    Parameters
    Name Type Description
    $array
    functionverify_image_file( string $path, bool $jpeg = false ) : void

    Sanitize image file from hostile content

    Parameters
    Name Type Description
    $path string

    Image file

    $jpeg bool

    Accept only JPEGs?

    functionverify_uploaded_image( string $path, bool $jpeg_only = false ) : void

    Verify uploaded image Verifies that image has proper extension, MIME type and doesn't contain hostile content

    Parameters
    Name Type Description
    $path string

    Image path

    $jpeg_only bool

    Accept only JPEGs?

    functionxss_check_pattern( string $pattern, string $str ) : array

    Helper function used by clean_xss() to parse for known-bad vectors

    Parameters
    Name Type Description
    $pattern string

    pattern Regex pattern to use

    $str string

    str String to parse for badness

    Returns
    Type Description
    array
    Documentation was generated by DocBlox 0.18.1.