@@ -26,7 +26,7 @@ |
||
26 | 26 | if (isset($params['output'])) { |
27 | 27 | $smarty->assign('_smarty_debug_output', $params['output']); |
28 | 28 | } |
29 | - require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); |
|
29 | + require_once(SMARTY_CORE_DIR.'core.display_debug_console.php'); |
|
30 | 30 | return smarty_core_display_debug_console(null, $smarty); |
31 | 31 | } |
32 | 32 |
@@ -26,14 +26,14 @@ |
||
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
29 | - if($params['var'] == '') { |
|
29 | + if ($params['var'] == '') { |
|
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled); |
34 | 34 | |
35 | 35 | ob_start(); |
36 | - $smarty->_eval('?>' . $_var_compiled); |
|
36 | + $smarty->_eval('?>'.$_var_compiled); |
|
37 | 37 | $_contents = ob_get_contents(); |
38 | 38 | ob_end_clean(); |
39 | 39 |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | |
31 | 31 | switch (gettype($var)) { |
32 | 32 | case 'array' : |
33 | - $results = '<b>Array (' . count($var) . ')</b>'; |
|
33 | + $results = '<b>Array ('.count($var).')</b>'; |
|
34 | 34 | foreach ($var as $curr_key => $curr_val) { |
35 | - $results .= '<br>' . str_repeat(' ', $depth * 2) |
|
36 | - . '<b>' . strtr($curr_key, $_replace) . '</b> => ' |
|
35 | + $results .= '<br>'.str_repeat(' ', $depth * 2) |
|
36 | + . '<b>'.strtr($curr_key, $_replace).'</b> => ' |
|
37 | 37 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); |
38 | 38 | $depth--; |
39 | 39 | } |
40 | 40 | break; |
41 | 41 | case 'object' : |
42 | 42 | $object_vars = get_object_vars($var); |
43 | - $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; |
|
43 | + $results = '<b>'.get_class($var).' Object ('.count($object_vars).')</b>'; |
|
44 | 44 | foreach ($object_vars as $curr_key => $curr_val) { |
45 | - $results .= '<br>' . str_repeat(' ', $depth * 2) |
|
46 | - . '<b> ->' . strtr($curr_key, $_replace) . '</b> = ' |
|
45 | + $results .= '<br>'.str_repeat(' ', $depth * 2) |
|
46 | + . '<b> ->'.strtr($curr_key, $_replace).'</b> = ' |
|
47 | 47 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); |
48 | 48 | $depth--; |
49 | 49 | } |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | } elseif (null === $var) { |
59 | 59 | $results = 'null'; |
60 | 60 | } else { |
61 | - $results = htmlspecialchars((string) $var); |
|
61 | + $results = htmlspecialchars((string)$var); |
|
62 | 62 | } |
63 | - $results = '<i>' . $results . '</i>'; |
|
63 | + $results = '<i>'.$results.'</i>'; |
|
64 | 64 | break; |
65 | 65 | case 'integer' : |
66 | 66 | case 'float' : |
67 | - $results = htmlspecialchars((string) $var); |
|
67 | + $results = htmlspecialchars((string)$var); |
|
68 | 68 | break; |
69 | 69 | case 'string' : |
70 | 70 | $results = strtr($var, $_replace); |
71 | - if (strlen($var) > $length ) { |
|
72 | - $results = substr($var, 0, $length - 3) . '...'; |
|
71 | + if (strlen($var) > $length) { |
|
72 | + $results = substr($var, 0, $length - 3).'...'; |
|
73 | 73 | } |
74 | - $results = htmlspecialchars('"' . $results . '"'); |
|
74 | + $results = htmlspecialchars('"'.$results.'"'); |
|
75 | 75 | break; |
76 | 76 | case 'unknown type' : |
77 | 77 | default : |
78 | - $results = strtr((string) $var, $_replace); |
|
79 | - if (strlen($results) > $length ) { |
|
80 | - $results = substr($results, 0, $length - 3) . '...'; |
|
78 | + $results = strtr((string)$var, $_replace); |
|
79 | + if (strlen($results) > $length) { |
|
80 | + $results = substr($results, 0, $length - 3).'...'; |
|
81 | 81 | } |
82 | 82 | $results = htmlspecialchars($results); |
83 | 83 | } |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | if (!empty($params['var']['assign'])) { |
89 | 89 | return '{$' . $params['colData']['field']['name'] . '}'; |
90 | 90 | } else { |
91 | - $code = $params['var']['customCode']; |
|
92 | - if(isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
93 | - $str_replace = array(); |
|
94 | - $tabindex = ' tabindex="' . $params['tabindex'] . '" '; |
|
95 | - foreach($matches[3] as $match) { |
|
96 | - $str_replace[$match] = $tabindex . $match; |
|
97 | - } |
|
98 | - $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
99 | - } |
|
91 | + $code = $params['var']['customCode']; |
|
92 | + if(isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
93 | + $str_replace = array(); |
|
94 | + $tabindex = ' tabindex="' . $params['tabindex'] . '" '; |
|
95 | + foreach($matches[3] as $match) { |
|
96 | + $str_replace[$match] = $tabindex . $match; |
|
97 | + } |
|
98 | + $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | if(isset($params['accesskey']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
102 | - $str_replace = array(); |
|
103 | - $accesskey = ' accesskey="' . $params['accesskey'] . '" '; |
|
104 | - foreach($matches[3] as $match) { |
|
105 | - $str_replace[$match] = $accesskey . $match; |
|
106 | - } |
|
107 | - $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
108 | - } |
|
102 | + $str_replace = array(); |
|
103 | + $accesskey = ' accesskey="' . $params['accesskey'] . '" '; |
|
104 | + foreach($matches[3] as $match) { |
|
105 | + $str_replace[$match] = $accesskey . $match; |
|
106 | + } |
|
107 | + $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | // Add a string replace to swap out @@FIELD@@ for the actual field, |
111 | 111 | // we can't do this through customCode directly because the sugar_field smarty function returns smarty code to run on the second pass |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | $code = str_replace('@@FIELD@@',$fieldText,$code); |
127 | 127 | } |
128 | 128 | |
129 | - //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering |
|
130 | - if(!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
131 | - require_once('include/connectors/utils/ConnectorUtils.php'); |
|
132 | - $code .= ' ' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
133 | - } |
|
134 | - return $code; |
|
129 | + //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering |
|
130 | + if(!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
131 | + require_once('include/connectors/utils/ConnectorUtils.php'); |
|
132 | + $code .= ' ' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
133 | + } |
|
134 | + return $code; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 |
@@ -68,48 +68,48 @@ discard block |
||
68 | 68 | */ |
69 | 69 | function smarty_function_sugar_evalcolumn($params, &$smarty) |
70 | 70 | { |
71 | - if (!isset($params['colData']['field']) ) { |
|
72 | - if(empty($params['colData'])) |
|
71 | + if (!isset($params['colData']['field'])) { |
|
72 | + if (empty($params['colData'])) |
|
73 | 73 | $smarty->trigger_error("evalcolumn: missing 'colData' parameter"); |
74 | - if(!isset($params['colData']['field'])) |
|
74 | + if (!isset($params['colData']['field'])) |
|
75 | 75 | $smarty->trigger_error("evalcolumn: missing 'colData.field' parameter"); |
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | - if(empty($params['colData']['field'])) { |
|
79 | + if (empty($params['colData']['field'])) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | $params['var'] = $params['colData']['field']; |
83 | - if(isset($params['toJSON'])) { |
|
83 | + if (isset($params['toJSON'])) { |
|
84 | 84 | $json = getJSONobj(); |
85 | 85 | $params['var'] = $json->encode($params['var']); |
86 | 86 | } |
87 | 87 | |
88 | 88 | if (!empty($params['var']['assign'])) { |
89 | - return '{$' . $params['colData']['field']['name'] . '}'; |
|
89 | + return '{$'.$params['colData']['field']['name'].'}'; |
|
90 | 90 | } else { |
91 | 91 | $code = $params['var']['customCode']; |
92 | - if(isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
92 | + if (isset($params['tabindex']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
93 | 93 | $str_replace = array(); |
94 | - $tabindex = ' tabindex="' . $params['tabindex'] . '" '; |
|
95 | - foreach($matches[3] as $match) { |
|
96 | - $str_replace[$match] = $tabindex . $match; |
|
94 | + $tabindex = ' tabindex="'.$params['tabindex'].'" '; |
|
95 | + foreach ($matches[3] as $match) { |
|
96 | + $str_replace[$match] = $tabindex.$match; |
|
97 | 97 | } |
98 | 98 | $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
99 | 99 | } |
100 | 100 | |
101 | - if(isset($params['accesskey']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
101 | + if (isset($params['accesskey']) && preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $code, $matches, PREG_PATTERN_ORDER)) { |
|
102 | 102 | $str_replace = array(); |
103 | - $accesskey = ' accesskey="' . $params['accesskey'] . '" '; |
|
104 | - foreach($matches[3] as $match) { |
|
105 | - $str_replace[$match] = $accesskey . $match; |
|
103 | + $accesskey = ' accesskey="'.$params['accesskey'].'" '; |
|
104 | + foreach ($matches[3] as $match) { |
|
105 | + $str_replace[$match] = $accesskey.$match; |
|
106 | 106 | } |
107 | 107 | $code = str_replace(array_keys($str_replace), array_values($str_replace), $code); |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Add a string replace to swap out @@FIELD@@ for the actual field, |
111 | 111 | // we can't do this through customCode directly because the sugar_field smarty function returns smarty code to run on the second pass |
112 | - if (!empty($code) && strpos($code,'@@FIELD@@') !== FALSE ) { |
|
112 | + if (!empty($code) && strpos($code, '@@FIELD@@') !== FALSE) { |
|
113 | 113 | // First we need to fetch extra data about the field |
114 | 114 | // sfp == SugarFieldParams |
115 | 115 | $sfp = $params; |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | |
124 | 124 | $fieldText = smarty_function_sugar_field($sfp, $smarty); |
125 | 125 | |
126 | - $code = str_replace('@@FIELD@@',$fieldText,$code); |
|
126 | + $code = str_replace('@@FIELD@@', $fieldText, $code); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | //eggsurplus bug 28321: add support for rendering customCode AND normal field rendering |
130 | - if(!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
130 | + if (!empty($params['var']['displayParams']['enableConnectors']) && empty($params['var']['customCodeRenderField'])) { |
|
131 | 131 | require_once('include/connectors/utils/ConnectorUtils.php'); |
132 | - $code .= ' ' . ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
132 | + $code .= ' '.ConnectorUtils::getConnectorButtonScript($params['var']['displayParams'], $smarty); |
|
133 | 133 | } |
134 | 134 | return $code; |
135 | 135 | } |
@@ -69,10 +69,12 @@ |
||
69 | 69 | function smarty_function_sugar_evalcolumn($params, &$smarty) |
70 | 70 | { |
71 | 71 | if (!isset($params['colData']['field']) ) { |
72 | - if(empty($params['colData'])) |
|
73 | - $smarty->trigger_error("evalcolumn: missing 'colData' parameter"); |
|
74 | - if(!isset($params['colData']['field'])) |
|
75 | - $smarty->trigger_error("evalcolumn: missing 'colData.field' parameter"); |
|
72 | + if(empty($params['colData'])) { |
|
73 | + $smarty->trigger_error("evalcolumn: missing 'colData' parameter"); |
|
74 | + } |
|
75 | + if(!isset($params['colData']['field'])) { |
|
76 | + $smarty->trigger_error("evalcolumn: missing 'colData.field' parameter"); |
|
77 | + } |
|
76 | 78 | return; |
77 | 79 | } |
78 | 80 |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -129,8 +131,9 @@ discard block |
||
129 | 131 | } |
130 | 132 | $flat = isset($params['flat']) ? $params['flat'] : (isset($sugar_config['enable_action_menu']) ? !$sugar_config['enable_action_menu'] : false); |
131 | 133 | //if buttons have not implemented, it returns empty string; |
132 | - if(empty($params['buttons'])) |
|
133 | - return ''; |
|
134 | + if(empty($params['buttons'])) { |
|
135 | + return ''; |
|
136 | + } |
|
134 | 137 | |
135 | 138 | if(is_array($params['buttons']) && !$flat) { |
136 | 139 |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | { |
123 | 123 | global $sugar_config; |
124 | 124 | |
125 | - if( !empty($params['params']) ) { |
|
125 | + if (!empty($params['params'])) { |
|
126 | 126 | $addition_params = $params['params']; |
127 | 127 | unset($params['params']); |
128 | 128 | $params = array_merge_recursive($params, $addition_params); |
129 | 129 | } |
130 | 130 | $flat = isset($params['flat']) ? $params['flat'] : (isset($sugar_config['enable_action_menu']) ? !$sugar_config['enable_action_menu'] : false); |
131 | 131 | //if buttons have not implemented, it returns empty string; |
132 | - if(empty($params['buttons'])) |
|
132 | + if (empty($params['buttons'])) |
|
133 | 133 | return ''; |
134 | 134 | |
135 | - if(is_array($params['buttons']) && !$flat) { |
|
135 | + if (is_array($params['buttons']) && !$flat) { |
|
136 | 136 | |
137 | 137 | $menus = array( |
138 | 138 | 'html' => array_shift($params['buttons']), |
139 | 139 | 'items' => array() |
140 | 140 | ); |
141 | 141 | |
142 | - foreach($params['buttons'] as $item) { |
|
143 | - if(is_array($item)) { |
|
142 | + foreach ($params['buttons'] as $item) { |
|
143 | + if (is_array($item)) { |
|
144 | 144 | $sub = array(); |
145 | 145 | $sub_first = array_shift($item); |
146 | - foreach($item as $subitem) { |
|
146 | + foreach ($item as $subitem) { |
|
147 | 147 | $sub[] = array( |
148 | 148 | 'html' => $subitem |
149 | 149 | ); |
150 | 150 | } |
151 | - array_push($menus['items'],array( |
|
151 | + array_push($menus['items'], array( |
|
152 | 152 | 'html' => $sub_first, |
153 | 153 | 'items' => $sub, |
154 | 154 | 'submenuHtmlOptions' => array( |
155 | 155 | 'class' => 'subnav-sub' |
156 | 156 | ) |
157 | 157 | )); |
158 | - } else if(strlen($item)) { |
|
159 | - array_push($menus['items'],array( |
|
158 | + } else if (strlen($item)) { |
|
159 | + array_push($menus['items'], array( |
|
160 | 160 | 'html' => $item |
161 | 161 | )); |
162 | 162 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $action_menu = array( |
165 | 165 | 'id' => !empty($params['id']) ? (is_array($params['id']) ? $params['id'][0] : $params['id']) : '', |
166 | 166 | 'htmlOptions' => array( |
167 | - 'class' => !empty($params['class']) && strpos($params['class'], 'clickMenu') !== false ? $params['class'] : 'clickMenu '. (!empty($params['class']) ? $params['class'] : ''), |
|
167 | + 'class' => !empty($params['class']) && strpos($params['class'], 'clickMenu') !== false ? $params['class'] : 'clickMenu '.(!empty($params['class']) ? $params['class'] : ''), |
|
168 | 168 | ), |
169 | 169 | 'itemOptions' => array( |
170 | 170 | 'class' => (count($menus['items']) == 0) ? 'single' : 'sugar_action_button' |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | if (is_array($params['buttons'])) { |
190 | - return '<div class="action_buttons">' . implode_r(' ', $params['buttons'], true).'<div class="clear"></div></div>'; |
|
191 | - } else if(is_array($params)) { |
|
192 | - return '<div class="action_buttons">' . implode_r(' ', $params, true).'<div class="clear"></div></div>'; |
|
190 | + return '<div class="action_buttons">'.implode_r(' ', $params['buttons'], true).'<div class="clear"></div></div>'; |
|
191 | + } else if (is_array($params)) { |
|
192 | + return '<div class="action_buttons">'.implode_r(' ', $params, true).'<div class="clear"></div></div>'; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $params['buttons']; |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | |
198 | 198 | function implode_r($glue, $pieces, $extract_first_item = false) { |
199 | 199 | $result = array_shift($pieces); |
200 | - if(is_array($result)) { |
|
200 | + if (is_array($result)) { |
|
201 | 201 | $result = implode_r($glue, $result); |
202 | 202 | } |
203 | - foreach($pieces as $item) { |
|
204 | - if(is_array($item)) { |
|
203 | + foreach ($pieces as $item) { |
|
204 | + if (is_array($item)) { |
|
205 | 205 | $result .= empty($extract_first_item) ? implode_r($glue, $item) : $glue.$item[0]; |
206 | 206 | } else { |
207 | 207 | $result .= $glue.$item; |
@@ -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 | } |