@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | // strip out backticks, not necessary for math |
31 | - $equation = str_replace('`','',$params['equation']); |
|
31 | + $equation = str_replace('`', '', $params['equation']); |
|
32 | 32 | |
33 | 33 | // make sure parenthesis are balanced |
34 | - if (substr_count($equation,"(") != substr_count($equation,")")) { |
|
34 | + if (substr_count($equation, "(") != substr_count($equation, ")")) { |
|
35 | 35 | $smarty->trigger_error("math: unbalanced parenthesis"); |
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | 39 | // match all vars in equation, make sure all are passed |
40 | - preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match); |
|
41 | - $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10', |
|
42 | - 'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'); |
|
40 | + preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!", $equation, $match); |
|
41 | + $allowed_funcs = array('int', 'abs', 'ceil', 'cos', 'exp', 'floor', 'log', 'log10', |
|
42 | + 'max', 'min', 'pi', 'pow', 'rand', 'round', 'sin', 'sqrt', 'srand', 'tan'); |
|
43 | 43 | |
44 | - foreach($match[1] as $curr_var) { |
|
44 | + foreach ($match[1] as $curr_var) { |
|
45 | 45 | if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { |
46 | 46 | $smarty->trigger_error("math: function call $curr_var not allowed"); |
47 | 47 | return; |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - foreach($params as $key => $val) { |
|
51 | + foreach ($params as $key => $val) { |
|
52 | 52 | if ($key != "equation" && $key != "format" && $key != "assign") { |
53 | 53 | // make sure value is not empty |
54 | - if (strlen($val)==0) { |
|
54 | + if (strlen($val) == 0) { |
|
55 | 55 | $smarty->trigger_error("math: parameter $key is empty"); |
56 | 56 | return; |
57 | 57 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | if (empty($params['assign'])) { |
70 | 70 | return $smarty_math_result; |
71 | 71 | } else { |
72 | - $smarty->assign($params['assign'],$smarty_math_result); |
|
72 | + $smarty->assign($params['assign'], $smarty_math_result); |
|
73 | 73 | } |
74 | 74 | } else { |
75 | - if (empty($params['assign'])){ |
|
76 | - printf($params['format'],$smarty_math_result); |
|
75 | + if (empty($params['assign'])) { |
|
76 | + printf($params['format'], $smarty_math_result); |
|
77 | 77 | } else { |
78 | - $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result)); |
|
78 | + $smarty->assign($params['assign'], sprintf($params['format'], $smarty_math_result)); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | // match all vars in equation, make sure all are passed |
40 | 40 | preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match); |
41 | 41 | $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10', |
42 | - 'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'); |
|
42 | + 'max','min','pi','pow','rand','round','sin','sqrt','srand','tan'); |
|
43 | 43 | |
44 | 44 | foreach($match[1] as $curr_var) { |
45 | 45 | if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) { |
@@ -43,19 +43,19 @@ |
||
43 | 43 | |
44 | 44 | function smarty_function_ext_includes($params, &$smarty) |
45 | 45 | { |
46 | - $ret = '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/ext-all.css") . '" />' |
|
47 | - . '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/xtheme-gray.css") . '" />'; |
|
46 | + $ret = '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/ext-all.css") . '" />' |
|
47 | + . '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/xtheme-gray.css") . '" />'; |
|
48 | 48 | |
49 | - global $theme; |
|
50 | - if (is_dir("themes/$theme/ext/resources/css")) { |
|
51 | - $cssDir = opendir("themes/$theme/ext/resources/css"); |
|
52 | - while (($file = readdir($cssDir)) !== false) { |
|
53 | - if (strcasecmp(substr($file, -4), '.css' == 0)) { |
|
54 | - $ret .= "<link rel='stylesheet' type='text/css' href='" . getJSPath("themes/$theme/ext/resources/css/$file") . "' />"; |
|
55 | - } |
|
56 | - } |
|
57 | - } |
|
49 | + global $theme; |
|
50 | + if (is_dir("themes/$theme/ext/resources/css")) { |
|
51 | + $cssDir = opendir("themes/$theme/ext/resources/css"); |
|
52 | + while (($file = readdir($cssDir)) !== false) { |
|
53 | + if (strcasecmp(substr($file, -4), '.css' == 0)) { |
|
54 | + $ret .= "<link rel='stylesheet' type='text/css' href='" . getJSPath("themes/$theme/ext/resources/css/$file") . "' />"; |
|
55 | + } |
|
56 | + } |
|
57 | + } |
|
58 | 58 | |
59 | - return $ret; |
|
59 | + return $ret; |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -43,15 +43,15 @@ |
||
43 | 43 | |
44 | 44 | function smarty_function_ext_includes($params, &$smarty) |
45 | 45 | { |
46 | - $ret = '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/ext-all.css") . '" />' |
|
47 | - . '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/xtheme-gray.css") . '" />'; |
|
46 | + $ret = '<link rel="stylesheet" type="text/css" href="'.getJSPath("themes/default/ext/resources/css/ext-all.css").'" />' |
|
47 | + . '<link rel="stylesheet" type="text/css" href="'.getJSPath("themes/default/ext/resources/css/xtheme-gray.css").'" />'; |
|
48 | 48 | |
49 | 49 | global $theme; |
50 | 50 | if (is_dir("themes/$theme/ext/resources/css")) { |
51 | 51 | $cssDir = opendir("themes/$theme/ext/resources/css"); |
52 | 52 | while (($file = readdir($cssDir)) !== false) { |
53 | 53 | if (strcasecmp(substr($file, -4), '.css' == 0)) { |
54 | - $ret .= "<link rel='stylesheet' type='text/css' href='" . getJSPath("themes/$theme/ext/resources/css/$file") . "' />"; |
|
54 | + $ret .= "<link rel='stylesheet' type='text/css' href='".getJSPath("themes/$theme/ext/resources/css/$file")."' />"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | function smarty_function_sugar_field($params, &$smarty) |
56 | 56 | { |
57 | 57 | if (!isset($params['vardef']) || !isset($params['displayType']) || !isset($params['parentFieldArray'])) { |
58 | - if(!isset($params['vardef'])) |
|
58 | + if (!isset($params['vardef'])) |
|
59 | 59 | $smarty->trigger_error("sugar_field: missing 'vardef' parameter"); |
60 | - if(!isset($params['displayType'])) |
|
60 | + if (!isset($params['displayType'])) |
|
61 | 61 | $smarty->trigger_error("sugar_field: missing 'displayType' parameter"); |
62 | - if(!isset($params['parentFieldArray'])) |
|
62 | + if (!isset($params['parentFieldArray'])) |
|
63 | 63 | $smarty->trigger_error("sugar_field: missing 'parentFieldArray' parameter"); |
64 | 64 | |
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | static $sfh; |
69 | - if(!isset($sfh)) $sfh = new SugarFieldHandler(); |
|
69 | + if (!isset($sfh)) $sfh = new SugarFieldHandler(); |
|
70 | 70 | |
71 | - if(!isset($params['displayParams'])) $displayParams = array(); |
|
71 | + if (!isset($params['displayParams'])) $displayParams = array(); |
|
72 | 72 | else $displayParams = $params['displayParams']; |
73 | 73 | |
74 | - if(isset($params['labelSpan'])) $displayParams['labelSpan'] = $params['labelSpan']; |
|
74 | + if (isset($params['labelSpan'])) $displayParams['labelSpan'] = $params['labelSpan']; |
|
75 | 75 | else $displayParams['labelSpan'] = null; |
76 | - if(isset($params['fieldSpan'])) $displayParams['fieldSpan'] = $params['fieldSpan']; |
|
76 | + if (isset($params['fieldSpan'])) $displayParams['fieldSpan'] = $params['fieldSpan']; |
|
77 | 77 | else $displayParams['fieldSpan'] = null; |
78 | 78 | |
79 | - if(isset($params['typeOverride'])) { // override the type in the vardef? |
|
79 | + if (isset($params['typeOverride'])) { // override the type in the vardef? |
|
80 | 80 | $params['vardef']['type'] = $params['typeOverride']; |
81 | 81 | } |
82 | - if(isset($params['formName'])) $displayParams['formName'] = $params['formName']; |
|
82 | + if (isset($params['formName'])) $displayParams['formName'] = $params['formName']; |
|
83 | 83 | |
84 | - if(isset($params['field'])) { |
|
84 | + if (isset($params['field'])) { |
|
85 | 85 | $params['vardef']['name'] = $params['field']; |
86 | 86 | } |
87 | 87 | |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | $displayParams['call_back_function'] = $params['call_back_function']; |
90 | 90 | } |
91 | 91 | |
92 | - if(isset($params['skipClearButton'])) { |
|
92 | + if (isset($params['skipClearButton'])) { |
|
93 | 93 | $displayParams['skipClearButton'] = $params['skipClearButton']; |
94 | 94 | } |
95 | 95 | |
96 | - if(isset($params['idName'])) { |
|
96 | + if (isset($params['idName'])) { |
|
97 | 97 | $displayParams['idName'] = $params['idName']; |
98 | 98 | } |
99 | 99 | |
100 | - if(isset($params['accesskey'])) { |
|
100 | + if (isset($params['accesskey'])) { |
|
101 | 101 | $displayParams['accesskey'] = $params['accesskey']; |
102 | 102 | } |
103 | 103 |
@@ -55,31 +55,47 @@ |
||
55 | 55 | function smarty_function_sugar_field($params, &$smarty) |
56 | 56 | { |
57 | 57 | if (!isset($params['vardef']) || !isset($params['displayType']) || !isset($params['parentFieldArray'])) { |
58 | - if(!isset($params['vardef'])) |
|
59 | - $smarty->trigger_error("sugar_field: missing 'vardef' parameter"); |
|
60 | - if(!isset($params['displayType'])) |
|
61 | - $smarty->trigger_error("sugar_field: missing 'displayType' parameter"); |
|
62 | - if(!isset($params['parentFieldArray'])) |
|
63 | - $smarty->trigger_error("sugar_field: missing 'parentFieldArray' parameter"); |
|
58 | + if(!isset($params['vardef'])) { |
|
59 | + $smarty->trigger_error("sugar_field: missing 'vardef' parameter"); |
|
60 | + } |
|
61 | + if(!isset($params['displayType'])) { |
|
62 | + $smarty->trigger_error("sugar_field: missing 'displayType' parameter"); |
|
63 | + } |
|
64 | + if(!isset($params['parentFieldArray'])) { |
|
65 | + $smarty->trigger_error("sugar_field: missing 'parentFieldArray' parameter"); |
|
66 | + } |
|
64 | 67 | |
65 | 68 | return; |
66 | 69 | } |
67 | 70 | |
68 | 71 | static $sfh; |
69 | - if(!isset($sfh)) $sfh = new SugarFieldHandler(); |
|
72 | + if(!isset($sfh)) { |
|
73 | + $sfh = new SugarFieldHandler(); |
|
74 | + } |
|
70 | 75 | |
71 | - if(!isset($params['displayParams'])) $displayParams = array(); |
|
72 | - else $displayParams = $params['displayParams']; |
|
76 | + if(!isset($params['displayParams'])) { |
|
77 | + $displayParams = array(); |
|
78 | + } else { |
|
79 | + $displayParams = $params['displayParams']; |
|
80 | + } |
|
73 | 81 | |
74 | - if(isset($params['labelSpan'])) $displayParams['labelSpan'] = $params['labelSpan']; |
|
75 | - else $displayParams['labelSpan'] = null; |
|
76 | - if(isset($params['fieldSpan'])) $displayParams['fieldSpan'] = $params['fieldSpan']; |
|
77 | - else $displayParams['fieldSpan'] = null; |
|
82 | + if(isset($params['labelSpan'])) { |
|
83 | + $displayParams['labelSpan'] = $params['labelSpan']; |
|
84 | + } else { |
|
85 | + $displayParams['labelSpan'] = null; |
|
86 | + } |
|
87 | + if(isset($params['fieldSpan'])) { |
|
88 | + $displayParams['fieldSpan'] = $params['fieldSpan']; |
|
89 | + } else { |
|
90 | + $displayParams['fieldSpan'] = null; |
|
91 | + } |
|
78 | 92 | |
79 | 93 | if(isset($params['typeOverride'])) { // override the type in the vardef? |
80 | 94 | $params['vardef']['type'] = $params['typeOverride']; |
81 | 95 | } |
82 | - if(isset($params['formName'])) $displayParams['formName'] = $params['formName']; |
|
96 | + if(isset($params['formName'])) { |
|
97 | + $displayParams['formName'] = $params['formName']; |
|
98 | + } |
|
83 | 99 | |
84 | 100 | if(isset($params['field'])) { |
85 | 101 | $params['vardef']['name'] = $params['field']; |
@@ -18,10 +18,10 @@ |
||
18 | 18 | */ |
19 | 19 | function smarty_function_escape_special_chars($string) |
20 | 20 | { |
21 | - if(!is_array($string)) { |
|
21 | + if (!is_array($string)) { |
|
22 | 22 | $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); |
23 | 23 | $string = htmlspecialchars($string); |
24 | - $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string); |
|
24 | + $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); |
|
25 | 25 | } |
26 | 26 | return $string; |
27 | 27 | } |
@@ -54,6 +54,6 @@ |
||
54 | 54 | */ |
55 | 55 | function smarty_modifier_strip_semicolon($text) |
56 | 56 | { |
57 | - return preg_replace("/([:]|\xEF\xBC\x9A)[\\s]*$/", '', trim($text)); |
|
57 | + return preg_replace("/([:]|\xEF\xBC\x9A)[\\s]*$/", '', trim($text)); |
|
58 | 58 | } |
59 | 59 | ?> |
60 | 60 | \ No newline at end of file |
@@ -38,7 +38,7 @@ |
||
38 | 38 | return; |
39 | 39 | } |
40 | 40 | if (DIRECTORY_SEPARATOR == '\\') { |
41 | - $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
41 | + $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
42 | 42 | $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); |
43 | 43 | if (strpos($format, '%e') !== false) { |
44 | 44 | $_win_from[] = '%e'; |
@@ -72,15 +72,15 @@ |
||
72 | 72 | function smarty_function_sugar_help($params, &$smarty) |
73 | 73 | { |
74 | 74 | $text = str_replace("'","\'",htmlspecialchars($params['text'])); |
75 | - //append any additional parameters. |
|
76 | - $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
75 | + //append any additional parameters. |
|
76 | + $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
77 | 77 | |
78 | - if (count( $params) > 1){ |
|
78 | + if (count( $params) > 1){ |
|
79 | 79 | |
80 | - $click .=",'".$params['myPos']."','".$params['atPos']."'"; |
|
81 | - } |
|
80 | + $click .=",'".$params['myPos']."','".$params['atPos']."'"; |
|
81 | + } |
|
82 | 82 | $helpImage = SugarThemeRegistry::current()->getImageURL('helpInline.png'); |
83 | - $click .= " );" ; |
|
83 | + $click .= " );" ; |
|
84 | 84 | $alt_tag = $GLOBALS['app_strings']['LBL_ALT_INFO']; |
85 | 85 | return <<<EOHTML |
86 | 86 | <img border="0" |
@@ -71,16 +71,16 @@ |
||
71 | 71 | */ |
72 | 72 | function smarty_function_sugar_help($params, &$smarty) |
73 | 73 | { |
74 | - $text = str_replace("'","\'",htmlspecialchars($params['text'])); |
|
74 | + $text = str_replace("'", "\'", htmlspecialchars($params['text'])); |
|
75 | 75 | //append any additional parameters. |
76 | - $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
76 | + $click = "return SUGAR.util.showHelpTips(this,'$text'"; |
|
77 | 77 | |
78 | - if (count( $params) > 1){ |
|
78 | + if (count($params) > 1) { |
|
79 | 79 | |
80 | - $click .=",'".$params['myPos']."','".$params['atPos']."'"; |
|
80 | + $click .= ",'".$params['myPos']."','".$params['atPos']."'"; |
|
81 | 81 | } |
82 | 82 | $helpImage = SugarThemeRegistry::current()->getImageURL('helpInline.png'); |
83 | - $click .= " );" ; |
|
83 | + $click .= " );"; |
|
84 | 84 | $alt_tag = $GLOBALS['app_strings']['LBL_ALT_INFO']; |
85 | 85 | return <<<EOHTML |
86 | 86 | <img border="0" |
@@ -207,8 +207,8 @@ |
||
207 | 207 | * @return String representing date value |
208 | 208 | */ |
209 | 209 | function smarty_modifier_default_date_value($defaultValue) { |
210 | - global $timedate; |
|
211 | - require_once('modules/DynamicFields/templates/Fields/TemplateDate.php'); |
|
212 | - $td = new TemplateDate(); |
|
213 | - return $timedate->asUser(new SugarDateTime($td->dateStrings[$defaultValue])); |
|
210 | + global $timedate; |
|
211 | + require_once('modules/DynamicFields/templates/Fields/TemplateDate.php'); |
|
212 | + $td = new TemplateDate(); |
|
213 | + return $timedate->asUser(new SugarDateTime($td->dateStrings[$defaultValue])); |
|
214 | 214 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -45,9 +45,9 @@ |
||
45 | 45 | */ |
46 | 46 | function smarty_function_sugar_getwebpath($params, &$smarty) |
47 | 47 | { |
48 | - if(!isset($params['file'])) { |
|
49 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
50 | - } |
|
51 | - return getWebPath($params['file']); |
|
48 | + if(!isset($params['file'])) { |
|
49 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
50 | + } |
|
51 | + return getWebPath($params['file']); |
|
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | \ No newline at end of file |
@@ -43,8 +43,8 @@ |
||
43 | 43 | */ |
44 | 44 | function smarty_function_sugar_getjspath($params, &$smarty) |
45 | 45 | { |
46 | - if(!isset($params['file'])) { |
|
47 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
46 | + if (!isset($params['file'])) { |
|
47 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'file'); |
|
48 | 48 | } |
49 | 49 | return getJSPath($params['file']); |
50 | 50 | } |