@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | |
35 | 35 | |
36 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
36 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
37 | 37 | /********************************************************************************* |
38 | 38 | * SugarCRM Community Edition is a customer relationship management program developed by |
39 | 39 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | |
77 | 77 | function smarty_function_sugar_link($params, &$smarty) |
78 | 78 | { |
79 | - if(empty($params['module'])){ |
|
79 | + if (empty($params['module'])) { |
|
80 | 80 | $smarty->trigger_error("sugar_link: missing 'module' parameter"); |
81 | 81 | return; |
82 | 82 | } |
83 | - if(!empty($params['data']) && is_array($params['data'])){ |
|
83 | + if (!empty($params['data']) && is_array($params['data'])) { |
|
84 | 84 | $link_url = 'index.php?'; |
85 | 85 | $link_url .= 'module=iFrames&action=index'; |
86 | 86 | $link_url .= '&record='.$params['data']['0']; |
87 | 87 | $link_url .= '&tab=true'; |
88 | - }else{ |
|
89 | - $action = (!empty($params['action']))?$params['action']:'index'; |
|
88 | + } else { |
|
89 | + $action = (!empty($params['action'])) ? $params['action'] : 'index'; |
|
90 | 90 | |
91 | 91 | $link_url = 'index.php?'; |
92 | 92 | $link_url .= 'module='.$params['module'].'&action='.$action; |
@@ -95,24 +95,24 @@ discard block |
||
95 | 95 | if (!empty($params['extraparams'])) { $link_url .= '&'.$params['extraparams']; } |
96 | 96 | } |
97 | 97 | |
98 | - if (isset($params['link_only']) && $params['link_only'] == 1 ) { |
|
98 | + if (isset($params['link_only']) && $params['link_only'] == 1) { |
|
99 | 99 | // Let them just get the url, they want to put it someplace |
100 | 100 | return ajaxLink($link_url); |
101 | 101 | } |
102 | 102 | |
103 | - $id = (!empty($params['id']))?' id="'.$params['id'].'"':''; |
|
104 | - $class = (!empty($params['class']))?' class="'.$params['class'].'"':''; |
|
105 | - $style = (!empty($params['style']))?' style="'.$params['style'].'"':''; |
|
106 | - $title = (!empty($params['title']))?' title="'.$params['title'].'"':''; |
|
103 | + $id = (!empty($params['id'])) ? ' id="'.$params['id'].'"' : ''; |
|
104 | + $class = (!empty($params['class'])) ? ' class="'.$params['class'].'"' : ''; |
|
105 | + $style = (!empty($params['style'])) ? ' style="'.$params['style'].'"' : ''; |
|
106 | + $title = (!empty($params['title'])) ? ' title="'.$params['title'].'"' : ''; |
|
107 | 107 | $module = ' module="'.$params['module'].'"'; |
108 | - $accesskey = (!empty($params['accesskey']))?' accesskey="'.$params['accesskey'].'" ':''; |
|
109 | - $options = (!empty($params['options']))?' '.$params['options'].'':''; |
|
110 | - if(!empty($params['data']) && is_array($params['data'])) |
|
111 | - $label =$params['data']['4']; |
|
112 | - elseif ( !empty($params['label']) ) |
|
108 | + $accesskey = (!empty($params['accesskey'])) ? ' accesskey="'.$params['accesskey'].'" ' : ''; |
|
109 | + $options = (!empty($params['options'])) ? ' '.$params['options'].'' : ''; |
|
110 | + if (!empty($params['data']) && is_array($params['data'])) |
|
111 | + $label = $params['data']['4']; |
|
112 | + elseif (!empty($params['label'])) |
|
113 | 113 | $label = $params['label']; |
114 | 114 | else |
115 | - $label = (!empty($GLOBALS['app_list_strings']['moduleList'][$params['module']]))?$GLOBALS['app_list_strings']['moduleList'][$params['module']]:$params['module']; |
|
115 | + $label = (!empty($GLOBALS['app_list_strings']['moduleList'][$params['module']])) ? $GLOBALS['app_list_strings']['moduleList'][$params['module']] : $params['module']; |
|
116 | 116 | |
117 | 117 | $link = '<a href="'.ajaxLink($link_url).'"'.$id.$class.$style.$options.$title.$module.'>'.$label.'</a>'; |
118 | 118 | return $link; |
@@ -30,27 +30,27 @@ discard block |
||
30 | 30 | $content = ''; |
31 | 31 | if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) { |
32 | 32 | $_params = array('resource_type' => 'file', 'resource_name' => $params['file']); |
33 | - require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); |
|
34 | - if(!smarty_core_is_secure($_params, $smarty)) { |
|
35 | - $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed'); |
|
33 | + require_once(SMARTY_CORE_DIR.'core.is_secure.php'); |
|
34 | + if (!smarty_core_is_secure($_params, $smarty)) { |
|
35 | + $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \''.$params['file'].'\' is not allowed'); |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | 39 | // fetch the file |
40 | - if($fp = @fopen($params['file'],'r')) { |
|
41 | - while(!feof($fp)) { |
|
42 | - $content .= fgets ($fp,4096); |
|
40 | + if ($fp = @fopen($params['file'], 'r')) { |
|
41 | + while (!feof($fp)) { |
|
42 | + $content .= fgets($fp, 4096); |
|
43 | 43 | } |
44 | 44 | fclose($fp); |
45 | 45 | } else { |
46 | - $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\''); |
|
46 | + $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \''.$params['file'].'\''); |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | } else { |
50 | 50 | // not a local file |
51 | - if(preg_match('!^http://!i',$params['file'])) { |
|
51 | + if (preg_match('!^http://!i', $params['file'])) { |
|
52 | 52 | // http fetch |
53 | - if($uri_parts = parse_url($params['file'])) { |
|
53 | + if ($uri_parts = parse_url($params['file'])) { |
|
54 | 54 | // set defaults |
55 | 55 | $host = $server_name = $uri_parts['host']; |
56 | 56 | $timeout = 30; |
@@ -58,44 +58,44 @@ discard block |
||
58 | 58 | $agent = "Smarty Template Engine ".$smarty->_version; |
59 | 59 | $referer = ""; |
60 | 60 | $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; |
61 | - $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; |
|
61 | + $uri .= !empty($uri_parts['query']) ? '?'.$uri_parts['query'] : ''; |
|
62 | 62 | $_is_proxy = false; |
63 | - if(empty($uri_parts['port'])) { |
|
63 | + if (empty($uri_parts['port'])) { |
|
64 | 64 | $port = 80; |
65 | 65 | } else { |
66 | 66 | $port = $uri_parts['port']; |
67 | 67 | } |
68 | - if(!empty($uri_parts['user'])) { |
|
68 | + if (!empty($uri_parts['user'])) { |
|
69 | 69 | $user = $uri_parts['user']; |
70 | 70 | } |
71 | - if(!empty($uri_parts['pass'])) { |
|
71 | + if (!empty($uri_parts['pass'])) { |
|
72 | 72 | $pass = $uri_parts['pass']; |
73 | 73 | } |
74 | 74 | // loop through parameters, setup headers |
75 | - foreach($params as $param_key => $param_value) { |
|
76 | - switch($param_key) { |
|
75 | + foreach ($params as $param_key => $param_value) { |
|
76 | + switch ($param_key) { |
|
77 | 77 | case "file": |
78 | 78 | case "assign": |
79 | 79 | case "assign_headers": |
80 | 80 | break; |
81 | 81 | case "user": |
82 | - if(!empty($param_value)) { |
|
82 | + if (!empty($param_value)) { |
|
83 | 83 | $user = $param_value; |
84 | 84 | } |
85 | 85 | break; |
86 | 86 | case "pass": |
87 | - if(!empty($param_value)) { |
|
87 | + if (!empty($param_value)) { |
|
88 | 88 | $pass = $param_value; |
89 | 89 | } |
90 | 90 | break; |
91 | 91 | case "accept": |
92 | - if(!empty($param_value)) { |
|
92 | + if (!empty($param_value)) { |
|
93 | 93 | $accept = $param_value; |
94 | 94 | } |
95 | 95 | break; |
96 | 96 | case "header": |
97 | - if(!empty($param_value)) { |
|
98 | - if(!preg_match('![\w\d-]+: .+!',$param_value)) { |
|
97 | + if (!empty($param_value)) { |
|
98 | + if (!preg_match('![\w\d-]+: .+!', $param_value)) { |
|
99 | 99 | $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'"); |
100 | 100 | return; |
101 | 101 | } else { |
@@ -104,31 +104,31 @@ discard block |
||
104 | 104 | } |
105 | 105 | break; |
106 | 106 | case "proxy_host": |
107 | - if(!empty($param_value)) { |
|
107 | + if (!empty($param_value)) { |
|
108 | 108 | $proxy_host = $param_value; |
109 | 109 | } |
110 | 110 | break; |
111 | 111 | case "proxy_port": |
112 | - if(!preg_match('!\D!', $param_value)) { |
|
113 | - $proxy_port = (int) $param_value; |
|
112 | + if (!preg_match('!\D!', $param_value)) { |
|
113 | + $proxy_port = (int)$param_value; |
|
114 | 114 | } else { |
115 | 115 | $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); |
116 | 116 | return; |
117 | 117 | } |
118 | 118 | break; |
119 | 119 | case "agent": |
120 | - if(!empty($param_value)) { |
|
120 | + if (!empty($param_value)) { |
|
121 | 121 | $agent = $param_value; |
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case "referer": |
125 | - if(!empty($param_value)) { |
|
125 | + if (!empty($param_value)) { |
|
126 | 126 | $referer = $param_value; |
127 | 127 | } |
128 | 128 | break; |
129 | 129 | case "timeout": |
130 | - if(!preg_match('!\D!', $param_value)) { |
|
131 | - $timeout = (int) $param_value; |
|
130 | + if (!preg_match('!\D!', $param_value)) { |
|
131 | + $timeout = (int)$param_value; |
|
132 | 132 | } else { |
133 | 133 | $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); |
134 | 134 | return; |
@@ -139,54 +139,54 @@ discard block |
||
139 | 139 | return; |
140 | 140 | } |
141 | 141 | } |
142 | - if(!empty($proxy_host) && !empty($proxy_port)) { |
|
142 | + if (!empty($proxy_host) && !empty($proxy_port)) { |
|
143 | 143 | $_is_proxy = true; |
144 | - $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); |
|
144 | + $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout); |
|
145 | 145 | } else { |
146 | - $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); |
|
146 | + $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout); |
|
147 | 147 | } |
148 | 148 | |
149 | - if(!$fp) { |
|
149 | + if (!$fp) { |
|
150 | 150 | $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)"); |
151 | 151 | return; |
152 | 152 | } else { |
153 | - if($_is_proxy) { |
|
154 | - fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); |
|
153 | + if ($_is_proxy) { |
|
154 | + fputs($fp, 'GET '.$params['file']." HTTP/1.0\r\n"); |
|
155 | 155 | } else { |
156 | 156 | fputs($fp, "GET $uri HTTP/1.0\r\n"); |
157 | 157 | } |
158 | - if(!empty($host)) { |
|
158 | + if (!empty($host)) { |
|
159 | 159 | fputs($fp, "Host: $host\r\n"); |
160 | 160 | } |
161 | - if(!empty($accept)) { |
|
161 | + if (!empty($accept)) { |
|
162 | 162 | fputs($fp, "Accept: $accept\r\n"); |
163 | 163 | } |
164 | - if(!empty($agent)) { |
|
164 | + if (!empty($agent)) { |
|
165 | 165 | fputs($fp, "User-Agent: $agent\r\n"); |
166 | 166 | } |
167 | - if(!empty($referer)) { |
|
167 | + if (!empty($referer)) { |
|
168 | 168 | fputs($fp, "Referer: $referer\r\n"); |
169 | 169 | } |
170 | - if(isset($extra_headers) && is_array($extra_headers)) { |
|
171 | - foreach($extra_headers as $curr_header) { |
|
170 | + if (isset($extra_headers) && is_array($extra_headers)) { |
|
171 | + foreach ($extra_headers as $curr_header) { |
|
172 | 172 | fputs($fp, $curr_header."\r\n"); |
173 | 173 | } |
174 | 174 | } |
175 | - if(!empty($user) && !empty($pass)) { |
|
175 | + if (!empty($user) && !empty($pass)) { |
|
176 | 176 | fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); |
177 | 177 | } |
178 | 178 | |
179 | 179 | fputs($fp, "\r\n"); |
180 | - while(!feof($fp)) { |
|
181 | - $content .= fgets($fp,4096); |
|
180 | + while (!feof($fp)) { |
|
181 | + $content .= fgets($fp, 4096); |
|
182 | 182 | } |
183 | 183 | fclose($fp); |
184 | - $csplit = preg_split("!\r\n\r\n!",$content,2); |
|
184 | + $csplit = preg_split("!\r\n\r\n!", $content, 2); |
|
185 | 185 | |
186 | 186 | $content = $csplit[1]; |
187 | 187 | |
188 | - if(!empty($params['assign_headers'])) { |
|
189 | - $smarty->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0])); |
|
188 | + if (!empty($params['assign_headers'])) { |
|
189 | + $smarty->assign($params['assign_headers'], preg_split("!\r\n!", $csplit[0])); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | } else { |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | } |
196 | 196 | } else { |
197 | 197 | // ftp fetch |
198 | - if($fp = @fopen($params['file'],'r')) { |
|
199 | - while(!feof($fp)) { |
|
200 | - $content .= fgets ($fp,4096); |
|
198 | + if ($fp = @fopen($params['file'], 'r')) { |
|
199 | + while (!feof($fp)) { |
|
200 | + $content .= fgets($fp, 4096); |
|
201 | 201 | } |
202 | 202 | fclose($fp); |
203 | 203 | } else { |
204 | - $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\''); |
|
204 | + $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \''.$params['file'].'\''); |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | |
212 | 212 | if (!empty($params['assign'])) { |
213 | - $smarty->assign($params['assign'],$content); |
|
213 | + $smarty->assign($params['assign'], $content); |
|
214 | 214 | } else { |
215 | 215 | return $content; |
216 | 216 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function smarty_modifier_regex_replace($string, $search, $replace) |
24 | 24 | { |
25 | - if(is_array($search)) { |
|
26 | - foreach($search as $idx => $s) |
|
25 | + if (is_array($search)) { |
|
26 | + foreach ($search as $idx => $s) |
|
27 | 27 | $search[$idx] = _smarty_regex_replace_check($s); |
28 | 28 | } else { |
29 | 29 | $search = _smarty_regex_replace_check($search); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | function _smarty_regex_replace_check($search) |
36 | 36 | { |
37 | - if (($pos = strpos($search,"\0")) !== false) |
|
38 | - $search = substr($search,0,$pos); |
|
37 | + if (($pos = strpos($search, "\0")) !== false) |
|
38 | + $search = substr($search, 0, $pos); |
|
39 | 39 | if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { |
40 | 40 | /* remove eval-modifier from $search */ |
41 | - $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); |
|
41 | + $search = substr($search, 0, -strlen($match[1])).preg_replace('![e\s]+!', '', $match[1]); |
|
42 | 42 | } |
43 | 43 | return $search; |
44 | 44 | } |
@@ -52,25 +52,25 @@ |
||
52 | 52 | function smarty_function_sugar_getlink($params, &$smarty) { |
53 | 53 | |
54 | 54 | // error checking for required parameters |
55 | - if(!isset($params['url'])) |
|
56 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'url'); |
|
57 | - if(!isset($params['title'])) |
|
58 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'title'); |
|
55 | + if (!isset($params['url'])) |
|
56 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'url'); |
|
57 | + if (!isset($params['title'])) |
|
58 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'title'); |
|
59 | 59 | |
60 | 60 | // set defaults |
61 | - if(!isset($params['attr'])) |
|
61 | + if (!isset($params['attr'])) |
|
62 | 62 | $params['attr'] = ''; |
63 | - if(!isset($params['img_name'])) |
|
63 | + if (!isset($params['img_name'])) |
|
64 | 64 | $params['img_name'] = ''; |
65 | - if(!isset($params['img_attr'])) |
|
65 | + if (!isset($params['img_attr'])) |
|
66 | 66 | $params['img_attr'] = ''; |
67 | - if(!isset($params['img_width'])) |
|
67 | + if (!isset($params['img_width'])) |
|
68 | 68 | $params['img_width'] = null; |
69 | - if(!isset($params['img_height'])) |
|
69 | + if (!isset($params['img_height'])) |
|
70 | 70 | $params['height'] = null; |
71 | - if(!isset($params['img_placement'])) |
|
71 | + if (!isset($params['img_placement'])) |
|
72 | 72 | $params['img_placement'] = 'imageonly'; |
73 | - if(!isset($params['img_alt'])) |
|
73 | + if (!isset($params['img_alt'])) |
|
74 | 74 | $params['img_alt'] = ''; |
75 | 75 | |
76 | 76 | return SugarThemeRegistry::current()->getLink($params['url'], $params['title'], $params['attr'], $params['img_name'], |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | |
58 | 58 | |
59 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
59 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
60 | 60 | /********************************************************************************* |
61 | 61 | * SugarCRM Community Edition is a customer relationship management program developed by |
62 | 62 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | $bean = $params['bean']; |
102 | 102 | $field = $params['field']; |
103 | 103 | $type = $bean->field_name_map[$field]['type']; |
104 | - if($type == 'text') { |
|
105 | - echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47) . '...' : $bean->field; |
|
106 | - } else if($type == 'link') { |
|
104 | + if ($type == 'text') { |
|
105 | + echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47).'...' : $bean->field; |
|
106 | + } else if ($type == 'link') { |
|
107 | 107 | echo "<a href='{$bean->$field}' target='_blank'>{$bean->$field}</a>"; |
108 | 108 | } else { |
109 | 109 | echo $bean->$field; |
@@ -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 | } |
@@ -64,17 +64,17 @@ |
||
64 | 64 | function smarty_function_sugar_currency_format($params, &$smarty) { |
65 | 65 | |
66 | 66 | // Bug #47406 : Currency field doesn't accept 0.00 as default value |
67 | - if(!isset($params['var']) || $params['var'] === '') { |
|
67 | + if (!isset($params['var']) || $params['var'] === '') { |
|
68 | 68 | return ''; |
69 | 69 | } |
70 | 70 | |
71 | 71 | global $locale; |
72 | - if(empty($params['currency_id'])){ |
|
72 | + if (empty($params['currency_id'])) { |
|
73 | 73 | $params['currency_id'] = $locale->getPrecedentPreference('currency'); |
74 | - if(!isset($params['convert'])) { |
|
74 | + if (!isset($params['convert'])) { |
|
75 | 75 | $params['convert'] = true; |
76 | 76 | } |
77 | - if(!isset($params['currency_symbol'])) { |
|
77 | + if (!isset($params['currency_symbol'])) { |
|
78 | 78 | $params['currency_symbol'] = $locale->getPrecedentPreference('default_currency_symbol'); |
79 | 79 | } |
80 | 80 | } |
@@ -66,10 +66,10 @@ |
||
66 | 66 | function smarty_function_multienum_to_array($params, &$smarty) |
67 | 67 | { |
68 | 68 | $ret = ""; |
69 | - if(empty($params['string'])) { |
|
69 | + if (empty($params['string'])) { |
|
70 | 70 | if (empty($params['default'])) |
71 | 71 | $ret = array(); |
72 | - else if(is_array($params['default'])) |
|
72 | + else if (is_array($params['default'])) |
|
73 | 73 | $ret = $params['default']; |
74 | 74 | else |
75 | 75 | $ret = unencodeMultienum($params['default']); |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | */ |
282 | 282 | function smarty_function_sugar_button($params, &$smarty) |
283 | 283 | { |
284 | - if(empty($params['module'])) { |
|
284 | + if (empty($params['module'])) { |
|
285 | 285 | $smarty->trigger_error("sugar_button: missing required param (module)"); |
286 | - } else if(empty($params['id'])) { |
|
286 | + } else if (empty($params['id'])) { |
|
287 | 287 | $smarty->trigger_error("sugar_button: missing required param (id)"); |
288 | - } else if(empty($params['view'])) { |
|
288 | + } else if (empty($params['view'])) { |
|
289 | 289 | $smarty->trigger_error("sugar_button: missing required param (view)"); |
290 | 290 | } |
291 | 291 | |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | $type = $params['id']; |
295 | 295 | $location = (empty($params['location'])) ? "" : "_".$params['location']; |
296 | 296 | |
297 | - if(!is_array($type)) { |
|
297 | + if (!is_array($type)) { |
|
298 | 298 | $module = $params['module']; |
299 | 299 | $view = $params['view']; |
300 | - switch(strtoupper($type)) { |
|
300 | + switch (strtoupper($type)) { |
|
301 | 301 | case "SEARCH": |
302 | 302 | $output = '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" onclick="SUGAR.savedViews.setChooser();" class="button" type="submit" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/> '; |
303 | 303 | break; |
@@ -317,28 +317,28 @@ discard block |
||
317 | 317 | break; |
318 | 318 | |
319 | 319 | case "DELETE": |
320 | - $output = '{if $bean->aclAccess("delete")}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'ListView\'; _form.action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button">{/if} '; |
|
320 | + $output = '{if $bean->aclAccess("delete")}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'ListView\'; _form.action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button">{/if} '; |
|
321 | 321 | break; |
322 | 322 | |
323 | 323 | case "DUPLICATE": |
324 | - $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''. $module . '\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\'' . $view . '\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} '; |
|
324 | + $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\''.$view.'\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} '; |
|
325 | 325 | break; |
326 | 326 | |
327 | 327 | case "EDIT"; |
328 | - $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} '; |
|
328 | + $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} '; |
|
329 | 329 | break; |
330 | 330 | |
331 | 331 | case "FIND_DUPLICATES": |
332 | - $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} '; |
|
332 | + $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} '; |
|
333 | 333 | break; |
334 | 334 | |
335 | 335 | case "SAVE": |
336 | 336 | $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
337 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
337 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\''.$view.'\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case "SUBPANELSAVE": |
341 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
341 | + if ($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
342 | 342 | |
343 | 343 | /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ |
344 | 344 | /** |
@@ -355,20 +355,20 @@ discard block |
||
355 | 355 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
356 | 356 | |
357 | 357 | */ |
358 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
358 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \''.$params['module'].'_subpanel_save_button\');return false;" type="submit" name="'.$params['module'].'_subpanel_save_button" id="'.$params['module'].'_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
359 | 359 | /* END - SECURITY GROUPS */ |
360 | 360 | |
361 | 361 | break; |
362 | 362 | case "SUBPANELCANCEL": |
363 | - $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
363 | + $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="'.$params['module'].'_subpanel_cancel_button" id="'.$params['module'].'_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
364 | 364 | |
365 | 365 | break; |
366 | 366 | case "SUBPANELFULLFORM": |
367 | - $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
367 | + $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';" type="submit" name="'.$params['module'].'_subpanel_full_form_button" id="'.$params['module'].'_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
368 | 368 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
369 | 369 | break; |
370 | 370 | case "DCMENUCANCEL": |
371 | - $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
371 | + $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="'.$params['module'].'_dcmenu_cancel_button" id="'.$params['module'].'_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
372 | 372 | break; |
373 | 373 | case "DCMENUSAVE": |
374 | 374 | if ($view == 'QuickCreate') { |
@@ -376,10 +376,10 @@ discard block |
||
376 | 376 | } else if ($view == 'EditView') { |
377 | 377 | $view = "form_DCEditView_{$module}"; |
378 | 378 | } |
379 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
379 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \''.$params['module'].'_subpanel_save_button\');return false;" type="submit" name="'.$params['module'].'_dcmenu_save_button" id="'.$params['module'].'_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
380 | 380 | break; |
381 | 381 | case "DCMENUFULLFORM": |
382 | - $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\'' . $params['module'] . '\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
382 | + $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\''.$params['module'].'\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="'.$params['module'].'_subpanel_full_form_button" id="'.$params['module'].'_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
383 | 383 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
384 | 384 | $output .= '<input type="hidden" name="is_admin" value="">'; |
385 | 385 | break; |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | $view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view; |
388 | 388 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
389 | 389 | . 'class="button primary" onclick="'.$js_form.' _form.action.value=\'Popup\';' |
390 | - . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
391 | - . '_popupcreate_save_button" id="' . $params['module'] |
|
390 | + . 'return check_form(\''.$view.'\')" type="submit" name="'.$params['module'] |
|
391 | + . '_popupcreate_save_button" id="'.$params['module'] |
|
392 | 392 | . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
393 | 393 | break; |
394 | 394 | case "POPUPCANCEL": |
395 | 395 | $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
396 | 396 | . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
397 | - . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
398 | - . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
397 | + . 'name="'.$params['module'].'_popup_cancel_button" type="submit"' |
|
398 | + . 'id="'.$params['module'].'_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
399 | 399 | break; |
400 | 400 | case "AUDIT": |
401 | 401 | $popup_request_data = array( |
@@ -407,45 +407,45 @@ discard block |
||
407 | 407 | |
408 | 408 | require_once('include/SugarFields/Parsers/MetaParser.php'); |
409 | 409 | $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
410 | - $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">'; |
|
410 | + $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name='.$params['module'].'", true, false, '.$encoded_popup_request_data.'); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">'; |
|
411 | 411 | $output = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
412 | 412 | break; |
413 | 413 | |
414 | 414 | |
415 | 415 | } //switch |
416 | - if(isset($params['appendTo'])) { |
|
416 | + if (isset($params['appendTo'])) { |
|
417 | 417 | $smarty->append($params['appendTo'], $output); |
418 | 418 | return; |
419 | 419 | } |
420 | 420 | return $output; |
421 | - } else if(is_array($type) && isset($type['sugar_html'])) { |
|
421 | + } else if (is_array($type) && isset($type['sugar_html'])) { |
|
422 | 422 | require_once('include/SugarHtml/SugarHtml.php'); |
423 | 423 | |
424 | 424 | $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']); |
425 | 425 | replaceFormClick($dom_tree, $js_form); |
426 | 426 | $output = SugarHtml::createHtml($dom_tree); |
427 | 427 | |
428 | - if(isset($params['appendTo'])) { |
|
428 | + if (isset($params['appendTo'])) { |
|
429 | 429 | $smarty->append($params['appendTo'], $output); |
430 | 430 | return; |
431 | 431 | } |
432 | 432 | return $output; |
433 | - } else if(is_array($type) && isset($type['customCode'])) { |
|
433 | + } else if (is_array($type) && isset($type['customCode'])) { |
|
434 | 434 | require_once('include/SugarHtml/SugarHtml.php'); |
435 | 435 | |
436 | 436 | $dom_tree = SugarHtml::parseHtmlTag($type['customCode']); |
437 | 437 | $hidden_exists = false; |
438 | 438 | |
439 | 439 | replaceFormClick($dom_tree, $js_form, $hidden_exists); |
440 | - if($hidden_exists) { |
|
440 | + if ($hidden_exists) { |
|
441 | 441 | //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form |
442 | 442 | $form = $smarty->get_template_vars('form'); |
443 | 443 | $hidden_fields = $dom_tree; |
444 | 444 | extractHiddenInputs($hidden_fields); |
445 | - if(!isset($form)) { |
|
445 | + if (!isset($form)) { |
|
446 | 446 | $form = array(); |
447 | 447 | } |
448 | - if(!isset($form['hidden'])) { |
|
448 | + if (!isset($form['hidden'])) { |
|
449 | 449 | $form['hidden'] = array(); |
450 | 450 | } |
451 | 451 | $form['hidden'][] = SugarHtml::createHtml($hidden_fields); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | } |
454 | 454 | $output = SugarHtml::createHtml($dom_tree); |
455 | 455 | |
456 | - if(isset($params['appendTo'])) { |
|
456 | + if (isset($params['appendTo'])) { |
|
457 | 457 | $smarty->append($params['appendTo'], $output); |
458 | 458 | return; |
459 | 459 | } |
@@ -475,21 +475,21 @@ discard block |
||
475 | 475 | $set_submit = false; |
476 | 476 | $is_hidden_field = false; |
477 | 477 | //if the code is wrapped with the form element, it will escape the operation for JS replacement |
478 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
478 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
479 | 479 | return false; |
480 | 480 | |
481 | - if(isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
|
481 | + if (isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
|
482 | 482 | $is_hidden_field = true; |
483 | 483 | } |
484 | 484 | |
485 | 485 | //Replace the JS syntax where the sugar_button contains the event handler for this.form |
486 | - if(isset($dom_tree['onclick'])) { |
|
487 | - if(strpos($dom_tree['onclick'], "this.form") !== false) { |
|
486 | + if (isset($dom_tree['onclick'])) { |
|
487 | + if (strpos($dom_tree['onclick'], "this.form") !== false) { |
|
488 | 488 | $dom_tree['onclick'] = str_replace("this.form", "_form", $dom_tree['onclick']); |
489 | - if(substr($dom_tree['onclick'], -1) != ';') |
|
489 | + if (substr($dom_tree['onclick'], -1) != ';') |
|
490 | 490 | $dom_tree['onclick'] .= ";"; |
491 | 491 | //Onclick handler contains returning a variable, for example it prompts a confirm message. |
492 | - if(strpos($dom_tree['onclick'], "return ") !== false ) { |
|
492 | + if (strpos($dom_tree['onclick'], "return ") !== false) { |
|
493 | 493 | $dom_tree['onclick'] = $js_form.' var _onclick=(function(){ldelim}'.$dom_tree['onclick']."{rdelim}()); if(_onclick!==false) _form.submit();"; |
494 | 494 | } else { |
495 | 495 | $dom_tree['onclick'] = $js_form.$dom_tree['onclick']."_form.submit();"; |
@@ -498,19 +498,19 @@ discard block |
||
498 | 498 | $set_submit = true; |
499 | 499 | } |
500 | 500 | } |
501 | - foreach($dom_tree as $key => $sub_tree) { |
|
502 | - if(is_array($sub_tree)) { |
|
501 | + foreach ($dom_tree as $key => $sub_tree) { |
|
502 | + if (is_array($sub_tree)) { |
|
503 | 503 | list($_submit, $_hidden) = replaceFormClick($dom_tree[$key], $js_form, $hidden_field_exists); |
504 | 504 | $set_submit = ($set_submit) ? $set_submit : $_submit; |
505 | 505 | $is_hidden_field = ($is_hidden_field) ? $is_hidden_field : $_hidden; |
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
509 | - if($set_submit && isset($dom_tree['type'])) { |
|
509 | + if ($set_submit && isset($dom_tree['type'])) { |
|
510 | 510 | $dom_tree['type'] = "button"; |
511 | 511 | $set_submit = false; |
512 | 512 | } |
513 | - if($is_hidden_field && isset($dom_tree['tag']) && $dom_tree['tag'] == 'input' ) { |
|
513 | + if ($is_hidden_field && isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
514 | 514 | $hidden_field_exists = true; |
515 | 515 | $is_hidden_field = false; |
516 | 516 | } |
@@ -527,20 +527,20 @@ discard block |
||
527 | 527 | 'hidden' |
528 | 528 | ); |
529 | 529 | //all hidden fields in the form elements must NOT attach in the original form |
530 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
530 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
531 | 531 | $dom_tree = array(); |
532 | 532 | } |
533 | - foreach($dom_tree as $key => $sub_tree) { |
|
534 | - if(is_numeric($key) && isset($sub_tree['tag']) && $sub_tree['tag'] == 'input') { |
|
535 | - if( !isset($sub_tree['type']) || in_array($sub_tree['type'], $allow_types) === false ) { |
|
533 | + foreach ($dom_tree as $key => $sub_tree) { |
|
534 | + if (is_numeric($key) && isset($sub_tree['tag']) && $sub_tree['tag'] == 'input') { |
|
535 | + if (!isset($sub_tree['type']) || in_array($sub_tree['type'], $allow_types) === false) { |
|
536 | 536 | unset($dom_tree[$key]); |
537 | 537 | } |
538 | - } else if(is_array($sub_tree)) { |
|
538 | + } else if (is_array($sub_tree)) { |
|
539 | 539 | extractHiddenInputs($dom_tree[$key]); |
540 | 540 | } |
541 | 541 | } |
542 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
543 | - if( !isset($dom_tree['type']) || in_array($dom_tree['type'], $allow_types) === false ) { |
|
542 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
543 | + if (!isset($dom_tree['type']) || in_array($dom_tree['type'], $allow_types) === false) { |
|
544 | 544 | $dom_tree = array(); |
545 | 545 | } |
546 | 546 | } |