portal/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_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_ppl( \$mixed $mixed, \$die $die = false, \$displayStackTrace $displayStackTrace = false,  $loglevel = "debug" ) : 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 ) : 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
    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
    functionadd_http(  $url ) : void

    Parameters
    Name Type Description
    $url
    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): ______________________________________..

    functionbr2nl(  $str ) : void

    Parameters
    Name Type Description
    $str
    functioncheckAuthUserStatus( ) : void

    functioncheckLoginUserStatus( ) : void

    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_special_arguments( ) : void

    functionclean_string(  $str,  $filter = "STANDARD" ) : void

    Parameters
    Name Type Description
    $str
    $filter
    functionclean_superglobals(  $key,  $filter = 'STANDARD' ) : void

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

    Parameters
    Name Type Description
    $key
    $filter
    functionclear_register(  $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
    functionconvert_id(  $string ) : void

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

    Parameters
    Name Type Description
    $module_array
    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
    functiondisplay_notice(  $msg = false ) : void

    Parameters
    Name Type Description
    $msg
    functiondisplay_stack_trace( ) : void

    functionensure_length(  $string,  $length ) : void

    Parameters
    Name Type Description
    $string
    $length
    functionformat_number_display( \$num $num, \$system_id $system_id ) : \$result

    This function will take a number and system_id and format

    Parameters
    Name Type Description
    $num \$num

    of bean

    $system_id \$system_id

    from system

    Returns
    Type Description
    \$result a formatted string
    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): ______________________________________..  
    functiongetCurrentURL( ) : void

    functiongetJSONobj( ) : \JSON

    Singleton to return JSON object

    Returns
    Type Description
    \JSON object
    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.  
    functiongetSQLDate(  $date_str ) : void

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

    returns a 20-char or less string for the Tracker to display in the header

    Parameters
    Name Type Description
    $name string

    name field for a given Object

    Returns
    Type Description
    string 20-char or less name
    functionget_assigned_team_name(  $assigned_team_id ) : void

    Parameters
    Name Type Description
    $assigned_team_id
    functionget_assigned_user_name(  $assigned_user_id,  $is_group = ' AND is_group=0 ' ) : 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_image(  $image,  $other_attributes,  $width = "",  $height = "",  $alt ) : void

    Parameters
    Name Type Description
    $image
    $other_attributes
    $width
    $height
    $alt
    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_languages( ) : void

    functionget_module_info(  $module_name ) : void

    Parameters
    Name Type Description
    $module_name
    functionget_register_value(  $category,  $name ) : void

    Parameters
    Name Type Description
    $category
    $name
    functionget_register_values(  $category ) : void

    Parameters
    Name Type Description
    $category
    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 ) : 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
    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_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
    functionget_themes( ) : void

    Return an array of directory names.

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

    functionget_user_array(  $add_blank = true,  $status = "Active",  $assigned_user = "",  $use_real_name = false,  $user_name_begins = null,  $is_group = ' AND is_group=0 ' ) : void

    Parameters
    Name Type Description
    $add_blank
    $status
    $assigned_user
    $use_real_name
    $user_name_begins
    $is_group
    functioninsert_charset_header( ) : void

    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_windows( ) : void

    tries to determine whether the Host machine is a Windows machine

    functionjavascript_escape(  $str ) : void

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

    Parameters
    Name Type Description
    $str
    $keep
    functionload_menu(  $path ) : void

    Parameters
    Name Type Description
    $path
    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 ) : void

    Parameters
    Name Type Description
    $value
    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
    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(  $language ) : void

    This function retrieves an application language file and returns the array of strings included in the $app_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
    functionreturn_application_language(  $language ) : void

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

    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
    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(  $language,  $module ) : void

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

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

    Parameters
    Name Type Description
    $language
    $module
    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
    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
    functionsetPhpIniSettings( ) : void

    Set default php.ini settings for entry points

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

    Parameters
    Name Type Description
    $category
    $name
    $value
    functionskype_formatted(  $number ) : void

    Parameters
    Name Type Description
    $number
    functionstr_begin(  $str,  $begin ) : void

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

    Parameters
    Name Type Description
    $str
    $end
    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
    functionsugarArrayMerge( array $gimp, array $dom ) : array

    like array_merge() but will handle array elements that are themselves arrays; PHP's version just overwrites the element with the new one.

    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
    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
    functiontranslate(  $string,  $mod = '',  $selectedValue = '' ) : void

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

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

    Parameters
    Name Type Description
    $string
    functionvalues_to_keys(  $array ) : void

    Parameters
    Name Type Description
    $array
    Documentation was generated by DocBlox 0.18.1.