@@ -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. |
@@ -456,8 +458,9 @@ discard block |
||
456 | 458 | while ($file = readdir($handler)) { |
457 | 459 | // if $file isn't this directory or its parent, |
458 | 460 | // add it to the results array |
459 | - if ($file != '.' && $file != '..') |
|
460 | - $results[] = $file; |
|
461 | + if ($file != '.' && $file != '..') { |
|
462 | + $results[] = $file; |
|
463 | + } |
|
461 | 464 | } |
462 | 465 | |
463 | 466 | // tidy up: close the handler |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | $file = 'custom/include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
92 | 92 | $type = $field; |
93 | 93 | //else check the fields directory |
94 | - }else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
94 | + } else if(file_exists('include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php')){ |
|
95 | 95 | $file = 'include/SugarFields/Fields/' . $field . '/SugarField' . $field. '.php'; |
96 | 96 | $type = $field; |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | // No direct class, check the directories to see if they are defined |
99 | 99 | if( $returnNullIfBase && |
100 | 100 | !is_dir('custom/include/SugarFields/Fields/'.$field) && |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $customClass = 'Custom' . $class; |
112 | 112 | if(class_exists($customClass)){ |
113 | 113 | $sugarFieldObjects[$field] = new $customClass($field); |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | $sugarFieldObjects[$field] = new $class($field); |
116 | 116 | } |
117 | 117 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){ |
47 | 47 | $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); |
48 | 48 | return $this->fetch($this->findTemplate('EditViewFunction')); |
49 | - }else{ |
|
49 | + } else{ |
|
50 | 50 | $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); |
51 | 51 | return $this->fetch($this->findTemplate('SearchView')); |
52 | 52 | } |
@@ -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. |
@@ -132,8 +134,9 @@ discard block |
||
132 | 134 | $alternate_found = false; |
133 | 135 | $alternate2_found = false; |
134 | 136 | foreach($this->addresses as $k=>$address) { |
135 | - if ($primary_found && $alternate_found) |
|
136 | - break; |
|
137 | + if ($primary_found && $alternate_found) { |
|
138 | + break; |
|
139 | + } |
|
137 | 140 | if ($address['primary_address'] == 1 && !$primary_found) { |
138 | 141 | $primary_index = $k; |
139 | 142 | $primary_found = true; |
@@ -271,8 +274,9 @@ discard block |
||
271 | 274 | ) |
272 | 275 | { |
273 | 276 | $emailCaps = strtoupper(trim($email)); |
274 | - if(empty($emailCaps)) |
|
275 | - return 0; |
|
277 | + if(empty($emailCaps)) { |
|
278 | + return 0; |
|
279 | + } |
|
276 | 280 | |
277 | 281 | $q = "SELECT * |
278 | 282 | FROM email_addr_bean_rel eabl JOIN email_addresses ea |
@@ -288,7 +292,9 @@ discard block |
||
288 | 292 | |
289 | 293 | // do it this way to make the count accurate in oracle |
290 | 294 | $i = 0; |
291 | - while ($this->db->fetchByAssoc($r)) ++$i; |
|
295 | + while ($this->db->fetchByAssoc($r)) { |
|
296 | + ++$i; |
|
297 | + } |
|
292 | 298 | |
293 | 299 | return $i; |
294 | 300 | } |
@@ -471,8 +477,9 @@ discard block |
||
471 | 477 | foreach($_REQUEST as $k => $v) { |
472 | 478 | if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) { |
473 | 479 | $validateFlag = str_replace("Value", "Flag", $k); |
474 | - if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") |
|
475 | - $new_addrs[$k] = $v; |
|
480 | + if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") { |
|
481 | + $new_addrs[$k] = $v; |
|
482 | + } |
|
476 | 483 | } |
477 | 484 | } |
478 | 485 | } |
@@ -675,8 +682,7 @@ discard block |
||
675 | 682 | if ($id) { |
676 | 683 | $r = $this->db->query("SELECT * FROM email_addresses WHERE id='".$this->db->quote($id)."'"); |
677 | 684 | $current_email = $this->db->fetchByAssoc($r); |
678 | - } |
|
679 | - else { |
|
685 | + } else { |
|
680 | 686 | $current_email = null; |
681 | 687 | } |
682 | 688 | |
@@ -716,8 +722,7 @@ discard block |
||
716 | 722 | $upd_r = $this->db->query($upd_q); |
717 | 723 | } |
718 | 724 | return $duplicate_email['id']; |
719 | - } |
|
720 | - else { |
|
725 | + } else { |
|
721 | 726 | // no case-insensitive address match - it's new, or undeleted. |
722 | 727 | $guid = ''; |
723 | 728 | if(!empty($address)){ |
@@ -783,8 +788,7 @@ discard block |
||
783 | 788 | // otherwise |
784 | 789 | $q .= " |
785 | 790 | ORDER BY ear.reply_to_address DESC"; |
786 | - } |
|
787 | - else |
|
791 | + } else |
|
788 | 792 | { |
789 | 793 | // retrieve reply-to address only |
790 | 794 | $q .= " |
@@ -835,8 +839,9 @@ discard block |
||
835 | 839 | */ |
836 | 840 | function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0') |
837 | 841 | { |
838 | - if ( !($this->smarty instanceOf Sugar_Smarty ) ) |
|
839 | - $this->smarty = new Sugar_Smarty(); |
|
842 | + if ( !($this->smarty instanceOf Sugar_Smarty ) ) { |
|
843 | + $this->smarty = new Sugar_Smarty(); |
|
844 | + } |
|
840 | 845 | |
841 | 846 | global $app_strings, $dictionary, $beanList; |
842 | 847 | |
@@ -854,8 +859,9 @@ discard block |
||
854 | 859 | if(!empty($id)) { |
855 | 860 | $prefillDataArr = $this->getAddressesByGUID($id, $module); |
856 | 861 | //When coming from convert leads, sometimes module is Contacts while the id is for a lead. |
857 | - if (empty($prefillDataArr) && $module == "Contacts") |
|
858 | - $prefillDataArr = $this->getAddressesByGUID($id, "Leads"); |
|
862 | + if (empty($prefillDataArr) && $module == "Contacts") { |
|
863 | + $prefillDataArr = $this->getAddressesByGUID($id, "Leads"); |
|
864 | + } |
|
859 | 865 | } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){ |
860 | 866 | $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0'; |
861 | 867 | $count = 0; |
@@ -880,8 +886,9 @@ discard block |
||
880 | 886 | |
881 | 887 | $required = false; |
882 | 888 | $vardefs = $dictionary[$beanList[$passedModule]]['fields']; |
883 | - if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) |
|
884 | - $required = true; |
|
889 | + if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) { |
|
890 | + $required = true; |
|
891 | + } |
|
885 | 892 | $this->smarty->assign('required', $required); |
886 | 893 | |
887 | 894 | $this->smarty->assign('module', $saveModule); |
@@ -935,13 +942,16 @@ discard block |
||
935 | 942 | */ |
936 | 943 | function getEmailAddressWidgetDetailView($focus, $tpl='') |
937 | 944 | { |
938 | - if ( !($this->smarty instanceOf Sugar_Smarty ) ) |
|
939 | - $this->smarty = new Sugar_Smarty(); |
|
945 | + if ( !($this->smarty instanceOf Sugar_Smarty ) ) { |
|
946 | + $this->smarty = new Sugar_Smarty(); |
|
947 | + } |
|
940 | 948 | |
941 | 949 | global $app_strings; |
942 | 950 | global $current_user; |
943 | 951 | $assign = array(); |
944 | - if(empty($focus->id))return ''; |
|
952 | + if(empty($focus->id)) { |
|
953 | + return ''; |
|
954 | + } |
|
945 | 955 | $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir); |
946 | 956 | |
947 | 957 | foreach($prefillData as $addressItem) { |
@@ -970,8 +980,9 @@ discard block |
||
970 | 980 | */ |
971 | 981 | function getEmailAddressWidgetDuplicatesView($focus) |
972 | 982 | { |
973 | - if ( !($this->smarty instanceOf Sugar_Smarty ) ) |
|
974 | - $this->smarty = new Sugar_Smarty(); |
|
983 | + if ( !($this->smarty instanceOf Sugar_Smarty ) ) { |
|
984 | + $this->smarty = new Sugar_Smarty(); |
|
985 | + } |
|
975 | 986 | |
976 | 987 | $count = 0; |
977 | 988 | $emails = array(); |
@@ -1131,7 +1142,9 @@ discard block |
||
1131 | 1142 | |
1132 | 1143 | if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') { |
1133 | 1144 | $module = $focus->module_dir; |
1134 | - if ($view == 'ConvertLead' && $module == "Contacts") $module = "Leads"; |
|
1145 | + if ($view == 'ConvertLead' && $module == "Contacts") { |
|
1146 | + $module = "Leads"; |
|
1147 | + } |
|
1135 | 1148 | |
1136 | 1149 | return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex); |
1137 | 1150 | } |
@@ -133,7 +133,7 @@ |
||
133 | 133 | try{ |
134 | 134 | $this->_last = $token = parent::getRequestToken($params); |
135 | 135 | return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret()); |
136 | - }catch(Zend_Oauth_Exception $e){ |
|
136 | + } catch(Zend_Oauth_Exception $e){ |
|
137 | 137 | return array('oauth_token' => '', 'oauth_token_secret' => ''); |
138 | 138 | } |
139 | 139 | } |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | $vardef['type'] = 'varchar'; |
76 | 76 | } |
77 | 77 | |
78 | - if (isset($vardef['precision'])) unset($vardef['precision']); |
|
78 | + if (isset($vardef['precision'])) { |
|
79 | + unset($vardef['precision']); |
|
80 | + } |
|
79 | 81 | |
80 | 82 | //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user); |
81 | 83 | |
@@ -115,8 +117,9 @@ discard block |
||
115 | 117 | if (isset($vardef['function']) |
116 | 118 | && ($vardef['function'] == 'getEmailAddressWidget' |
117 | 119 | || $vardef['function']['name'] == 'getEmailAddressWidget') |
118 | - ) |
|
119 | - unset($vardef['function']); |
|
120 | + ) { |
|
121 | + unset($vardef['function']); |
|
122 | + } |
|
120 | 123 | |
121 | 124 | if (isset($vardef['name']) && ($vardef['name'] == 'date_modified')) { |
122 | 125 | $vardef['name'] = 'aow_temp_date'; |
@@ -149,8 +152,9 @@ discard block |
||
149 | 152 | } |
150 | 153 | |
151 | 154 | // hack to disable one of the js calls in this control |
152 | - if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) |
|
153 | - $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
155 | + if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) { |
|
156 | + $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}"; |
|
157 | + } |
|
154 | 158 | |
155 | 159 | |
156 | 160 | |
@@ -186,8 +190,9 @@ discard block |
||
186 | 190 | $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week()); |
187 | 191 | |
188 | 192 | $fieldlist = array(); |
189 | - if (!isset($focus) || !($focus instanceof SugarBean)) |
|
190 | - require_once($beanFiles[$beanList[$module]]); |
|
193 | + if (!isset($focus) || !($focus instanceof SugarBean)) { |
|
194 | + require_once($beanFiles[$beanList[$module]]); |
|
195 | + } |
|
191 | 196 | $focus = new $beanList[$module]; |
192 | 197 | // create the dropdowns for the parent type fields |
193 | 198 | $vardefFields[$fieldname] = $focus->field_defs[$fieldname]; |
@@ -197,14 +202,17 @@ discard block |
||
197 | 202 | foreach ($vardefFields as $name => $properties) { |
198 | 203 | $fieldlist[$name] = $properties; |
199 | 204 | // fill in enums |
200 | - if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) |
|
201 | - $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
205 | + if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) { |
|
206 | + $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']]; |
|
207 | + } |
|
202 | 208 | // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings |
203 | - elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) |
|
204 | - $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
209 | + elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) { |
|
210 | + $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']]; |
|
211 | + } |
|
205 | 212 | // Bug 22730: make sure all enums have the ability to select blank as the default value. |
206 | - if (!isset($fieldlist[$name]['options'][''])) |
|
207 | - $fieldlist[$name]['options'][''] = ''; |
|
213 | + if (!isset($fieldlist[$name]['options'][''])) { |
|
214 | + $fieldlist[$name]['options'][''] = ''; |
|
215 | + } |
|
208 | 216 | } |
209 | 217 | |
210 | 218 | // fill in function return values |
@@ -212,8 +220,9 @@ discard block |
||
212 | 220 | if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html') { |
213 | 221 | $function = $fieldlist[$fieldname]['function']['name']; |
214 | 222 | // include various functions required in the various vardefs |
215 | - if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) |
|
216 | - require_once($fieldlist[$fieldname]['function']['include']); |
|
223 | + if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) { |
|
224 | + require_once($fieldlist[$fieldname]['function']['include']); |
|
225 | + } |
|
217 | 226 | $_REQUEST[$fieldname] = $value; |
218 | 227 | $value = $function($focus, $fieldname, $value, $view); |
219 | 228 | |
@@ -311,14 +320,14 @@ discard block |
||
311 | 320 | |
312 | 321 | if ($bean->field_defs[$field]['type'] == "multienum") { |
313 | 322 | $bean->$field = encodeMultienumValue($value); |
314 | - }else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){ |
|
323 | + } else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){ |
|
315 | 324 | $save_field = $bean->field_defs[$field]['id_name']; |
316 | 325 | $bean->$save_field = $value; |
317 | 326 | if ($bean->field_defs[$field]['type'] == 'parent') { |
318 | 327 | $bean->parent_type = $_REQUEST['parent_type']; |
319 | 328 | $bean->fill_in_additional_parent_fields(); // get up to date parent info as need it to display name |
320 | 329 | } |
321 | - }else{ |
|
330 | + } else{ |
|
322 | 331 | $bean->$field = $value; |
323 | 332 | } |
324 | 333 | |
@@ -449,7 +458,7 @@ discard block |
||
449 | 458 | if($vardef['ext2']){ |
450 | 459 | $value .= getFieldValueFromModule($vardef['rname'],$vardef['ext2'],$record) . "</a>"; |
451 | 460 | |
452 | - }else if(!empty($vardef['rname'])){ |
|
461 | + } else if(!empty($vardef['rname'])){ |
|
453 | 462 | $value .= getFieldValueFromModule($vardef['rname'],$vardef['module'],$record) . "</a>"; |
454 | 463 | |
455 | 464 | } else { |
@@ -486,7 +495,7 @@ discard block |
||
486 | 495 | |
487 | 496 | if($bean->ACLAccess('EditView')) { |
488 | 497 | return true; |
489 | - }else { |
|
498 | + } else { |
|
490 | 499 | return false; |
491 | 500 | } |
492 | 501 | } |
@@ -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. |
@@ -77,8 +79,9 @@ discard block |
||
77 | 79 | { |
78 | 80 | global $current_user; |
79 | 81 | |
80 | - if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) |
|
81 | - $focus->retrieve($_REQUEST[$prefix.'record']); |
|
82 | + if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) { |
|
83 | + $focus->retrieve($_REQUEST[$prefix.'record']); |
|
84 | + } |
|
82 | 85 | |
83 | 86 | if(!empty($_POST['assigned_user_id']) && |
84 | 87 | ($focus->assigned_user_id != $_POST['assigned_user_id']) && |
@@ -240,8 +243,7 @@ discard block |
||
240 | 243 | if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") |
241 | 244 | { |
242 | 245 | $return_module = $_REQUEST['return_module']; |
243 | - } |
|
244 | - else |
|
246 | + } else |
|
245 | 247 | { |
246 | 248 | $return_module = $return_module; |
247 | 249 | } |
@@ -275,14 +277,12 @@ discard block |
||
275 | 277 | $return_module = $_REQUEST['module']; |
276 | 278 | $return_action = $_REQUEST['return_action']; |
277 | 279 | // wp: return action needs to be set for one-click close in task list |
278 | - } |
|
279 | - else |
|
280 | + } else |
|
280 | 281 | { |
281 | 282 | // if we "Cancel", we go back to the list view. |
282 | 283 | $return_action = $_REQUEST['return_action']; |
283 | 284 | } |
284 | - } |
|
285 | - else |
|
285 | + } else |
|
286 | 286 | { |
287 | 287 | $return_action = "DetailView"; |
288 | 288 | } |
@@ -378,8 +378,7 @@ discard block |
||
378 | 378 | $focus=BeanFactory::getBean('Prospects'); |
379 | 379 | if(is_array($child_id)){ |
380 | 380 | $uids = $child_id; |
381 | - } |
|
382 | - else{ |
|
381 | + } else{ |
|
383 | 382 | $uids = array($child_id); |
384 | 383 | } |
385 | 384 |
@@ -448,11 +448,9 @@ discard block |
||
448 | 448 | |
449 | 449 | if(file_exists("custom/include/language/{$language}.notify_template.html")){ |
450 | 450 | $file = "custom/include/language/{$language}.notify_template.html"; |
451 | - } |
|
452 | - else if(file_exists("include/language/{$language}.notify_template.html")){ |
|
451 | + } else if(file_exists("include/language/{$language}.notify_template.html")){ |
|
453 | 452 | $file = "include/language/{$language}.notify_template.html"; |
454 | - } |
|
455 | - else if(file_exists("custom/include/language/en_us.notify_template.html")){ |
|
453 | + } else if(file_exists("custom/include/language/en_us.notify_template.html")){ |
|
456 | 454 | $file = "custom/include/language/en_us.notify_template.html"; |
457 | 455 | } |
458 | 456 | |
@@ -470,8 +468,7 @@ discard block |
||
470 | 468 | foreach( $default as $key => $value ){ |
471 | 469 | if( !array_key_exists($key, $override) ){ |
472 | 470 | $override[$key] = $value; |
473 | - } |
|
474 | - else if( is_array( $key ) ){ |
|
471 | + } else if( is_array( $key ) ){ |
|
475 | 472 | $override[$key] = sugar_config_union( $value, $override[$key] ); |
476 | 473 | } |
477 | 474 | } |
@@ -484,8 +481,7 @@ discard block |
||
484 | 481 | if( is_file($file) || is_dir($file) ){ |
485 | 482 | if( !is_writable($file) ){ |
486 | 483 | $ret_val = true; |
487 | - } |
|
488 | - else { |
|
484 | + } else { |
|
489 | 485 | $original_fileperms = fileperms($file); |
490 | 486 | |
491 | 487 | // take away writable permissions |
@@ -591,8 +587,9 @@ discard block |
||
591 | 587 | function get_user_name($id) { |
592 | 588 | global $db; |
593 | 589 | |
594 | - if(empty($db)) |
|
595 | - $db = DBManagerFactory::getInstance(); |
|
590 | + if(empty($db)) { |
|
591 | + $db = DBManagerFactory::getInstance(); |
|
592 | + } |
|
596 | 593 | |
597 | 594 | $q = "SELECT user_name FROM users WHERE id='{$id}'"; |
598 | 595 | $r = $db->query($q); |
@@ -637,8 +634,7 @@ discard block |
||
637 | 634 | // Including deleted users for now. |
638 | 635 | if (empty($status)) { |
639 | 636 | $query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter; |
640 | - } |
|
641 | - else { |
|
637 | + } else { |
|
642 | 638 | $query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter; |
643 | 639 | } |
644 | 640 | /* BEGIN - SECURITY GROUPS */ |
@@ -677,7 +673,7 @@ discard block |
||
677 | 673 | //its possible for first name to be skipped, check for this |
678 | 674 | if($firstNamePos===false){ |
679 | 675 | $order_by_string = 'last_name ASC'; |
680 | - }else{ |
|
676 | + } else{ |
|
681 | 677 | $order_by_string = ($lastNamePos < $firstNamePos) ? "last_name, first_name ASC" : "first_name, last_name ASC"; |
682 | 678 | } |
683 | 679 | } |
@@ -1100,18 +1096,20 @@ discard block |
||
1100 | 1096 | $loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh); |
1101 | 1097 | |
1102 | 1098 | // cn: bug 6048 - merge en_us with requested language |
1103 | - if($language != $sugar_config['default_language']) |
|
1104 | - $loaded_mod_strings = sugarLangArrayMerge( |
|
1099 | + if($language != $sugar_config['default_language']) { |
|
1100 | + $loaded_mod_strings = sugarLangArrayMerge( |
|
1105 | 1101 | LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'],$refresh), |
1106 | 1102 | $loaded_mod_strings |
1107 | 1103 | ); |
1104 | + } |
|
1108 | 1105 | |
1109 | 1106 | // Load in en_us strings by default |
1110 | - if($language != 'en_us' && $sugar_config['default_language'] != 'en_us') |
|
1111 | - $loaded_mod_strings = sugarLangArrayMerge( |
|
1107 | + if($language != 'en_us' && $sugar_config['default_language'] != 'en_us') { |
|
1108 | + $loaded_mod_strings = sugarLangArrayMerge( |
|
1112 | 1109 | LanguageManager::loadModuleLanguage($module, 'en_us', $refresh), |
1113 | 1110 | $loaded_mod_strings |
1114 | 1111 | ); |
1112 | + } |
|
1115 | 1113 | |
1116 | 1114 | // If we are in debug mode for translating, turn on the prefix now! |
1117 | 1115 | if($sugar_config['translation_string_prefix']) { |
@@ -1123,9 +1121,9 @@ discard block |
||
1123 | 1121 | $return_value = $loaded_mod_strings; |
1124 | 1122 | if(!isset($mod_strings)){ |
1125 | 1123 | $mod_strings = $return_value; |
1124 | + } else { |
|
1125 | + $mod_strings = $temp_mod_strings; |
|
1126 | 1126 | } |
1127 | - else |
|
1128 | - $mod_strings = $temp_mod_strings; |
|
1129 | 1127 | |
1130 | 1128 | $cache_key = LanguageManager::getLanguageCacheKey($module, $language); |
1131 | 1129 | sugar_cache_put($cache_key, $return_value); |
@@ -1164,8 +1162,9 @@ discard block |
||
1164 | 1162 | // cn: bug 6048 - merge en_us with requested language |
1165 | 1163 | include("modules/$module/language/en_us.lang.php"); |
1166 | 1164 | $en_mod_list_strings = array(); |
1167 | - if($language_used != $default_language) |
|
1168 | - $en_mod_list_strings = $mod_list_strings; |
|
1165 | + if($language_used != $default_language) { |
|
1166 | + $en_mod_list_strings = $mod_list_strings; |
|
1167 | + } |
|
1169 | 1168 | |
1170 | 1169 | if(file_exists("modules/$module/language/$language.lang.php")) { |
1171 | 1170 | include("modules/$module/language/$language.lang.php"); |
@@ -1295,8 +1294,9 @@ discard block |
||
1295 | 1294 | $where = ""; |
1296 | 1295 | foreach($where_clauses as $clause) |
1297 | 1296 | { |
1298 | - if($where != "") |
|
1299 | - $where .= " and "; |
|
1297 | + if($where != "") { |
|
1298 | + $where .= " and "; |
|
1299 | + } |
|
1300 | 1300 | $where .= $clause; |
1301 | 1301 | } |
1302 | 1302 | |
@@ -1374,8 +1374,7 @@ discard block |
||
1374 | 1374 | if($strlen < $length) |
1375 | 1375 | { |
1376 | 1376 | $string = str_pad($string,$length,"0"); |
1377 | - } |
|
1378 | - else if($strlen > $length) |
|
1377 | + } else if($strlen > $length) |
|
1379 | 1378 | { |
1380 | 1379 | $string = substr($string, 0, $length); |
1381 | 1380 | } |
@@ -1575,7 +1574,9 @@ discard block |
||
1575 | 1574 | $replacement .= "/OPTION>\n<OPTION value='__SugarMassUpdateClearField__'><"; // Giving the user the option to unset a drop down list. I.e. none means that it won't get updated |
1576 | 1575 | } |
1577 | 1576 | |
1578 | - if (empty($key_list)) $key_list = array(); |
|
1577 | + if (empty($key_list)) { |
|
1578 | + $key_list = array(); |
|
1579 | + } |
|
1579 | 1580 | //create the type dropdown domain and set the selected value if $opp value already exists |
1580 | 1581 | foreach ($key_list as $option_key=>$option_value) { |
1581 | 1582 | |
@@ -1737,24 +1738,26 @@ discard block |
||
1737 | 1738 | $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language']; |
1738 | 1739 | } |
1739 | 1740 | $mod_strings = return_module_language($current_language, $mod); |
1740 | - if ($mod == "") |
|
1741 | - echo "Language is <pre>" . $mod_strings . "</pre>"; |
|
1741 | + if ($mod == "") { |
|
1742 | + echo "Language is <pre>" . $mod_strings . "</pre>"; |
|
1743 | + } |
|
1742 | 1744 | |
1743 | - }else{ |
|
1745 | + } else{ |
|
1744 | 1746 | global $mod_strings; |
1745 | 1747 | } |
1746 | 1748 | |
1747 | 1749 | $returnValue = ''; |
1748 | 1750 | global $app_strings, $app_list_strings; |
1749 | 1751 | |
1750 | - if (isset($mod_strings[$string])) |
|
1751 | - $returnValue = $mod_strings[$string]; |
|
1752 | - else if (isset($app_strings[$string])) |
|
1753 | - $returnValue = $app_strings[$string]; |
|
1754 | - else if (isset($app_list_strings[$string])) |
|
1755 | - $returnValue = $app_list_strings[$string]; |
|
1756 | - else if (isset($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$string])) |
|
1757 | - $returnValue = $app_list_strings['moduleList'][$string]; |
|
1752 | + if (isset($mod_strings[$string])) { |
|
1753 | + $returnValue = $mod_strings[$string]; |
|
1754 | + } else if (isset($app_strings[$string])) { |
|
1755 | + $returnValue = $app_strings[$string]; |
|
1756 | + } else if (isset($app_list_strings[$string])) { |
|
1757 | + $returnValue = $app_list_strings[$string]; |
|
1758 | + } else if (isset($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$string])) { |
|
1759 | + $returnValue = $app_list_strings['moduleList'][$string]; |
|
1760 | + } |
|
1758 | 1761 | |
1759 | 1762 | |
1760 | 1763 | //$test_end = microtime(); |
@@ -1867,8 +1870,9 @@ discard block |
||
1867 | 1870 | function clean_xss($str, $cleanImg=true) { |
1868 | 1871 | global $sugar_config; |
1869 | 1872 | |
1870 | - if(empty($sugar_config['email_xss'])) |
|
1871 | - $sugar_config['email_xss'] = getDefaultXssTags(); |
|
1873 | + if(empty($sugar_config['email_xss'])) { |
|
1874 | + $sugar_config['email_xss'] = getDefaultXssTags(); |
|
1875 | + } |
|
1872 | 1876 | |
1873 | 1877 | $xsstags = unserialize(base64_decode($sugar_config['email_xss'])); |
1874 | 1878 | |
@@ -1987,32 +1991,65 @@ discard block |
||
1987 | 1991 | die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
1988 | 1992 | } |
1989 | 1993 | return false; |
1990 | - } |
|
1991 | - else { |
|
1994 | + } else { |
|
1992 | 1995 | return $str; |
1993 | 1996 | } |
1994 | 1997 | } |
1995 | 1998 | |
1996 | 1999 | function clean_special_arguments() { |
1997 | 2000 | if(isset($_SERVER['PHP_SELF'])) { |
1998 | - if (!empty($_SERVER['PHP_SELF'])) clean_string($_SERVER['PHP_SELF'], 'SAFED_GET'); |
|
1999 | - } |
|
2000 | - if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme'], "STANDARD"); |
|
2001 | - if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) clean_string($_REQUEST['login_module'], "STANDARD"); |
|
2002 | - if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) clean_string($_REQUEST['login_action'], "STANDARD"); |
|
2003 | - if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) clean_string($_REQUEST['ck_login_theme_20'], "STANDARD"); |
|
2004 | - if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme'], "STANDARD"); |
|
2005 | - if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) clean_string($_REQUEST['module_name'], "STANDARD"); |
|
2006 | - if (!empty($_REQUEST) && !empty($_REQUEST['module'])) clean_string($_REQUEST['module'], "STANDARD"); |
|
2007 | - if (!empty($_POST) && !empty($_POST['parent_type'])) clean_string($_POST['parent_type'], "STANDARD"); |
|
2008 | - if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) clean_string($_REQUEST['mod_lang'], "STANDARD"); |
|
2009 | - if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language'], "STANDARD"); |
|
2010 | - if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL"); |
|
2011 | - if (!empty($_GET) && !empty($_GET['from'])) clean_string($_GET['from']); |
|
2012 | - if (!empty($_GET) && !empty($_GET['gmto'])) clean_string($_GET['gmto'], "NUMBER"); |
|
2013 | - if (!empty($_GET) && !empty($_GET['case_number'])) clean_string($_GET['case_number'], "AUTO_INCREMENT"); |
|
2014 | - if (!empty($_GET) && !empty($_GET['bug_number'])) clean_string($_GET['bug_number'], "AUTO_INCREMENT"); |
|
2015 | - if (!empty($_GET) && !empty($_GET['quote_num'])) clean_string($_GET['quote_num'], "AUTO_INCREMENT"); |
|
2001 | + if (!empty($_SERVER['PHP_SELF'])) { |
|
2002 | + clean_string($_SERVER['PHP_SELF'], 'SAFED_GET'); |
|
2003 | + } |
|
2004 | + } |
|
2005 | + if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) { |
|
2006 | + clean_string($_REQUEST['login_theme'], "STANDARD"); |
|
2007 | + } |
|
2008 | + if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) { |
|
2009 | + clean_string($_REQUEST['login_module'], "STANDARD"); |
|
2010 | + } |
|
2011 | + if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) { |
|
2012 | + clean_string($_REQUEST['login_action'], "STANDARD"); |
|
2013 | + } |
|
2014 | + if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) { |
|
2015 | + clean_string($_REQUEST['ck_login_theme_20'], "STANDARD"); |
|
2016 | + } |
|
2017 | + if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) { |
|
2018 | + clean_string($_SESSION['authenticated_user_theme'], "STANDARD"); |
|
2019 | + } |
|
2020 | + if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) { |
|
2021 | + clean_string($_REQUEST['module_name'], "STANDARD"); |
|
2022 | + } |
|
2023 | + if (!empty($_REQUEST) && !empty($_REQUEST['module'])) { |
|
2024 | + clean_string($_REQUEST['module'], "STANDARD"); |
|
2025 | + } |
|
2026 | + if (!empty($_POST) && !empty($_POST['parent_type'])) { |
|
2027 | + clean_string($_POST['parent_type'], "STANDARD"); |
|
2028 | + } |
|
2029 | + if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) { |
|
2030 | + clean_string($_REQUEST['mod_lang'], "STANDARD"); |
|
2031 | + } |
|
2032 | + if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) { |
|
2033 | + clean_string($_SESSION['authenticated_user_language'], "STANDARD"); |
|
2034 | + } |
|
2035 | + if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) { |
|
2036 | + clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL"); |
|
2037 | + } |
|
2038 | + if (!empty($_GET) && !empty($_GET['from'])) { |
|
2039 | + clean_string($_GET['from']); |
|
2040 | + } |
|
2041 | + if (!empty($_GET) && !empty($_GET['gmto'])) { |
|
2042 | + clean_string($_GET['gmto'], "NUMBER"); |
|
2043 | + } |
|
2044 | + if (!empty($_GET) && !empty($_GET['case_number'])) { |
|
2045 | + clean_string($_GET['case_number'], "AUTO_INCREMENT"); |
|
2046 | + } |
|
2047 | + if (!empty($_GET) && !empty($_GET['bug_number'])) { |
|
2048 | + clean_string($_GET['bug_number'], "AUTO_INCREMENT"); |
|
2049 | + } |
|
2050 | + if (!empty($_GET) && !empty($_GET['quote_num'])) { |
|
2051 | + clean_string($_GET['quote_num'], "AUTO_INCREMENT"); |
|
2052 | + } |
|
2016 | 2053 | clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls |
2017 | 2054 | clean_superglobals('offset', 'ALPHANUM'); |
2018 | 2055 | clean_superglobals('return_action'); |
@@ -2024,10 +2061,16 @@ discard block |
||
2024 | 2061 | * cleans the given key in superglobals $_GET, $_POST, $_REQUEST |
2025 | 2062 | */ |
2026 | 2063 | function clean_superglobals($key, $filter = 'STANDARD') { |
2027 | - if(isset($_GET[$key])) clean_string($_GET[$key], $filter); |
|
2028 | - if(isset($_POST[$key])) clean_string($_POST[$key], $filter); |
|
2029 | - if(isset($_REQUEST[$key])) clean_string($_REQUEST[$key], $filter); |
|
2030 | -} |
|
2064 | + if(isset($_GET[$key])) { |
|
2065 | + clean_string($_GET[$key], $filter); |
|
2066 | + } |
|
2067 | + if(isset($_POST[$key])) { |
|
2068 | + clean_string($_POST[$key], $filter); |
|
2069 | + } |
|
2070 | + if(isset($_REQUEST[$key])) { |
|
2071 | + clean_string($_REQUEST[$key], $filter); |
|
2072 | + } |
|
2073 | + } |
|
2031 | 2074 | |
2032 | 2075 | function set_superglobals($key, $val){ |
2033 | 2076 | $_GET[$key] = $val; |
@@ -2068,25 +2111,51 @@ discard block |
||
2068 | 2111 | //get translated, so scrub the data but don't die |
2069 | 2112 | if(ini_get('mbstring.encoding_translation')==='1'){ |
2070 | 2113 | securexsskey($k,false); |
2071 | - }else{ |
|
2114 | + } else{ |
|
2072 | 2115 | securexsskey($k,true); |
2073 | 2116 | } |
2074 | 2117 | |
2075 | 2118 | } |
2076 | 2119 | // Any additional variables that need to be cleaned should be added here |
2077 | - if (isset($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme']); |
|
2078 | - if (isset($_REQUEST['login_module'])) clean_string($_REQUEST['login_module']); |
|
2079 | - if (isset($_REQUEST['login_action'])) clean_string($_REQUEST['login_action']); |
|
2080 | - if (isset($_REQUEST['login_language'])) clean_string($_REQUEST['login_language']); |
|
2081 | - if (isset($_REQUEST['action'])) clean_string($_REQUEST['action']); |
|
2082 | - if (isset($_REQUEST['module'])) clean_string($_REQUEST['module']); |
|
2083 | - if (isset($_REQUEST['record'])) clean_string($_REQUEST['record'], 'STANDARDSPACE'); |
|
2084 | - if (isset($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme']); |
|
2085 | - if (isset($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language']); |
|
2086 | - if (isset($_REQUEST['language'])) clean_string($_REQUEST['language']); |
|
2087 | - if (isset($sugar_config['default_theme'])) clean_string($sugar_config['default_theme']); |
|
2088 | - if (isset($_REQUEST['offset'])) clean_string($_REQUEST['offset']); |
|
2089 | - if (isset($_REQUEST['stamp'])) clean_string($_REQUEST['stamp']); |
|
2120 | + if (isset($_REQUEST['login_theme'])) { |
|
2121 | + clean_string($_REQUEST['login_theme']); |
|
2122 | + } |
|
2123 | + if (isset($_REQUEST['login_module'])) { |
|
2124 | + clean_string($_REQUEST['login_module']); |
|
2125 | + } |
|
2126 | + if (isset($_REQUEST['login_action'])) { |
|
2127 | + clean_string($_REQUEST['login_action']); |
|
2128 | + } |
|
2129 | + if (isset($_REQUEST['login_language'])) { |
|
2130 | + clean_string($_REQUEST['login_language']); |
|
2131 | + } |
|
2132 | + if (isset($_REQUEST['action'])) { |
|
2133 | + clean_string($_REQUEST['action']); |
|
2134 | + } |
|
2135 | + if (isset($_REQUEST['module'])) { |
|
2136 | + clean_string($_REQUEST['module']); |
|
2137 | + } |
|
2138 | + if (isset($_REQUEST['record'])) { |
|
2139 | + clean_string($_REQUEST['record'], 'STANDARDSPACE'); |
|
2140 | + } |
|
2141 | + if (isset($_SESSION['authenticated_user_theme'])) { |
|
2142 | + clean_string($_SESSION['authenticated_user_theme']); |
|
2143 | + } |
|
2144 | + if (isset($_SESSION['authenticated_user_language'])) { |
|
2145 | + clean_string($_SESSION['authenticated_user_language']); |
|
2146 | + } |
|
2147 | + if (isset($_REQUEST['language'])) { |
|
2148 | + clean_string($_REQUEST['language']); |
|
2149 | + } |
|
2150 | + if (isset($sugar_config['default_theme'])) { |
|
2151 | + clean_string($sugar_config['default_theme']); |
|
2152 | + } |
|
2153 | + if (isset($_REQUEST['offset'])) { |
|
2154 | + clean_string($_REQUEST['offset']); |
|
2155 | + } |
|
2156 | + if (isset($_REQUEST['stamp'])) { |
|
2157 | + clean_string($_REQUEST['stamp']); |
|
2158 | + } |
|
2090 | 2159 | |
2091 | 2160 | if(isset($_REQUEST['lvso'])){ |
2092 | 2161 | set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc'); |
@@ -2096,8 +2165,7 @@ discard block |
||
2096 | 2165 | if (str_end($key, "_offset")) { |
2097 | 2166 | clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query |
2098 | 2167 | set_superglobals($key, $_REQUEST[$key]); |
2099 | - } |
|
2100 | - elseif (str_end($key, "_ORDER_BY")) { |
|
2168 | + } elseif (str_end($key, "_ORDER_BY")) { |
|
2101 | 2169 | clean_string($_REQUEST[$key], "SQL_COLUMN_LIST"); |
2102 | 2170 | set_superglobals($key, $_REQUEST[$key]); |
2103 | 2171 | } |
@@ -2138,7 +2206,7 @@ discard block |
||
2138 | 2206 | if(!empty($matches)){ |
2139 | 2207 | if($die){ |
2140 | 2208 | die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>"); |
2141 | - }else{ |
|
2209 | + } else{ |
|
2142 | 2210 | unset($_REQUEST[$value]); |
2143 | 2211 | unset($_POST[$value]); |
2144 | 2212 | unset($_GET[$value]); |
@@ -2153,8 +2221,7 @@ discard block |
||
2153 | 2221 | } |
2154 | 2222 | |
2155 | 2223 | $value = securexss($value); |
2156 | - } |
|
2157 | - else if (is_array($value)){ |
|
2224 | + } else if (is_array($value)){ |
|
2158 | 2225 | foreach ($value as $key => $element) { |
2159 | 2226 | $value[$key] = preprocess_param($element); |
2160 | 2227 | } |
@@ -2165,7 +2232,9 @@ discard block |
||
2165 | 2232 | |
2166 | 2233 | function cleanup_slashes($value) |
2167 | 2234 | { |
2168 | - if(is_string($value)) return stripslashes($value); |
|
2235 | + if(is_string($value)) { |
|
2236 | + return stripslashes($value); |
|
2237 | + } |
|
2169 | 2238 | return $value; |
2170 | 2239 | } |
2171 | 2240 | |
@@ -2210,18 +2279,26 @@ discard block |
||
2210 | 2279 | |
2211 | 2280 | function getWebPath($relative_path){ |
2212 | 2281 | //if it has a :// then it isn't a relative path |
2213 | - if(substr_count($relative_path, '://') > 0) return $relative_path; |
|
2214 | - if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2282 | + if(substr_count($relative_path, '://') > 0) { |
|
2283 | + return $relative_path; |
|
2284 | + } |
|
2285 | + if(defined('TEMPLATE_URL')) { |
|
2286 | + $relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2287 | + } |
|
2215 | 2288 | return $relative_path; |
2216 | 2289 | } |
2217 | 2290 | |
2218 | 2291 | function getVersionedPath($path, $additional_attrs='') |
2219 | 2292 | { |
2220 | - if(empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1; |
|
2293 | + if(empty($GLOBALS['sugar_config']['js_custom_version'])) { |
|
2294 | + $GLOBALS['sugar_config']['js_custom_version'] = 1; |
|
2295 | + } |
|
2221 | 2296 | $js_version_key = isset($GLOBALS['js_version_key'])?$GLOBALS['js_version_key']:''; |
2222 | 2297 | if(inDeveloperMode()) { |
2223 | 2298 | static $rand; |
2224 | - if(empty($rand)) $rand = mt_rand(); |
|
2299 | + if(empty($rand)) { |
|
2300 | + $rand = mt_rand(); |
|
2301 | + } |
|
2225 | 2302 | $dev = $rand; |
2226 | 2303 | } else { |
2227 | 2304 | $dev = ''; |
@@ -2233,7 +2310,9 @@ discard block |
||
2233 | 2310 | $str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2); |
2234 | 2311 | // remove / - it confuses some parsers |
2235 | 2312 | $str = strtr($str, '/+', '-_'); |
2236 | - if(empty($path)) return $str; |
|
2313 | + if(empty($path)) { |
|
2314 | + return $str; |
|
2315 | + } |
|
2237 | 2316 | |
2238 | 2317 | return $path . "?v=$str"; |
2239 | 2318 | } |
@@ -2245,7 +2324,9 @@ discard block |
||
2245 | 2324 | |
2246 | 2325 | function getJSPath($relative_path, $additional_attrs='') |
2247 | 2326 | { |
2248 | - if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2327 | + if(defined('TEMPLATE_URL')) { |
|
2328 | + $relative_path = SugarTemplateUtilities::getWebPath($relative_path); |
|
2329 | + } |
|
2249 | 2330 | return getVersionedPath($relative_path).(!empty($additional_attrs)?"&$additional_attrs":""); |
2250 | 2331 | } |
2251 | 2332 | |
@@ -2277,8 +2358,7 @@ discard block |
||
2277 | 2358 | $match[1] = "0".$match[1]; |
2278 | 2359 | } |
2279 | 2360 | return "{$match[3]}-{$match[1]}-{$match[2]}"; |
2280 | - } |
|
2281 | - else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match)) |
|
2361 | + } else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match)) |
|
2282 | 2362 | { |
2283 | 2363 | if ( strlen($match[2]) == 1) |
2284 | 2364 | { |
@@ -2289,8 +2369,7 @@ discard block |
||
2289 | 2369 | $match[1] = "0".$match[1]; |
2290 | 2370 | } |
2291 | 2371 | return "{$match[3]}-{$match[1]}-{$match[2]}"; |
2292 | - } |
|
2293 | - else |
|
2372 | + } else |
|
2294 | 2373 | { |
2295 | 2374 | return ""; |
2296 | 2375 | } |
@@ -2347,10 +2426,12 @@ discard block |
||
2347 | 2426 | } |
2348 | 2427 | $bean->update_date_modified = false; |
2349 | 2428 | $bean->update_modified_by = false; |
2350 | - if(isset($bean->date_modified)) |
|
2351 | - $bean->date_modified = $timedate->to_db($bean->date_modified); |
|
2352 | - if(isset($bean->date_entered)) |
|
2353 | - $bean->date_entered = $timedate->to_db($bean->date_entered); |
|
2429 | + if(isset($bean->date_modified)) { |
|
2430 | + $bean->date_modified = $timedate->to_db($bean->date_modified); |
|
2431 | + } |
|
2432 | + if(isset($bean->date_entered)) { |
|
2433 | + $bean->date_entered = $timedate->to_db($bean->date_entered); |
|
2434 | + } |
|
2354 | 2435 | //save |
2355 | 2436 | $new_id=$bean->save(); |
2356 | 2437 | |
@@ -2673,7 +2754,7 @@ discard block |
||
2673 | 2754 | //no error notice - lets just display the error to the user |
2674 | 2755 | if(!isset($error_notice)){ |
2675 | 2756 | echo '<br>'.$msg . '<br>'; |
2676 | - }else{ |
|
2757 | + } else{ |
|
2677 | 2758 | $error_notice .= $msg . '<br>'; |
2678 | 2759 | } |
2679 | 2760 | } |
@@ -2717,10 +2798,9 @@ discard block |
||
2717 | 2798 | |
2718 | 2799 | if(ord(substr($str, $i, 1))==10){ |
2719 | 2800 | $new_str .= '\n'; |
2720 | - }elseif(ord(substr($str, $i, 1))==13){ |
|
2801 | + } elseif(ord(substr($str, $i, 1))==13){ |
|
2721 | 2802 | $new_str .= '\r'; |
2722 | - } |
|
2723 | - else { |
|
2803 | + } else { |
|
2724 | 2804 | $new_str .= $str{$i}; |
2725 | 2805 | } |
2726 | 2806 | } |
@@ -2735,8 +2815,7 @@ discard block |
||
2735 | 2815 | |
2736 | 2816 | if($keep){ |
2737 | 2817 | $str = javascript_escape($str); |
2738 | - } |
|
2739 | - else { |
|
2818 | + } else { |
|
2740 | 2819 | $str = str_replace("'", " ", $str); |
2741 | 2820 | $str = str_replace('"', " ", $str); |
2742 | 2821 | } |
@@ -2931,8 +3010,9 @@ discard block |
||
2931 | 3010 | |
2932 | 3011 | $server_software = $_SERVER["SERVER_SOFTWARE"]; |
2933 | 3012 | $iis_version = ''; |
2934 | - if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) |
|
2935 | - $iis_version = $out[1][0]; |
|
3013 | + if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out)) { |
|
3014 | + $iis_version = $out[1][0]; |
|
3015 | + } |
|
2936 | 3016 | |
2937 | 3017 | $sys_iis_version = empty($sys_iis_version) ? $iis_version : $sys_iis_version; |
2938 | 3018 | |
@@ -3008,7 +3088,9 @@ discard block |
||
3008 | 3088 | |
3009 | 3089 | function sugar_cleanup($exit = false) { |
3010 | 3090 | static $called = false; |
3011 | - if($called)return; |
|
3091 | + if($called) { |
|
3092 | + return; |
|
3093 | + } |
|
3012 | 3094 | $called = true; |
3013 | 3095 | set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path()); |
3014 | 3096 | chdir(realpath(dirname(__FILE__) . '/..')); |
@@ -3019,7 +3101,11 @@ discard block |
||
3019 | 3101 | |
3020 | 3102 | //added this check to avoid errors during install. |
3021 | 3103 | if (empty($sugar_config['dbconfig'])) { |
3022 | - if ($exit) exit; else return; |
|
3104 | + if ($exit) { |
|
3105 | + exit; |
|
3106 | + } else { |
|
3107 | + return; |
|
3108 | + } |
|
3023 | 3109 | } |
3024 | 3110 | |
3025 | 3111 | if (!class_exists('Tracker', true)) { |
@@ -3028,8 +3114,9 @@ discard block |
||
3028 | 3114 | Tracker::logPage(); |
3029 | 3115 | // Now write the cached tracker_queries |
3030 | 3116 | if(!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) { |
3031 | - if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) |
|
3032 | - $GLOBALS['current_user']->savePreferencesToDB(); |
|
3117 | + if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) { |
|
3118 | + $GLOBALS['current_user']->savePreferencesToDB(); |
|
3119 | + } |
|
3033 | 3120 | } |
3034 | 3121 | |
3035 | 3122 | //check to see if this is not an `ajax call AND the user preference error flag is set |
@@ -3154,8 +3241,9 @@ discard block |
||
3154 | 3241 | |
3155 | 3242 | echo "\n\n display_stack_trace caller, file: " . $stack[0]['file']. ' line#: ' .$stack[0]['line']; |
3156 | 3243 | |
3157 | - if(!$textOnly) |
|
3158 | - echo '<br>'; |
|
3244 | + if(!$textOnly) { |
|
3245 | + echo '<br>'; |
|
3246 | + } |
|
3159 | 3247 | |
3160 | 3248 | $first = true; |
3161 | 3249 | $out = ''; |
@@ -3166,14 +3254,18 @@ discard block |
||
3166 | 3254 | $line = ''; |
3167 | 3255 | $function = ''; |
3168 | 3256 | |
3169 | - if(isset($item['file'])) |
|
3170 | - $file = $item['file']; |
|
3171 | - if(isset($item['class'])) |
|
3172 | - $class = $item['class']; |
|
3173 | - if(isset($item['line'])) |
|
3174 | - $line = $item['line']; |
|
3175 | - if(isset($item['function'])) |
|
3176 | - $function = $item['function']; |
|
3257 | + if(isset($item['file'])) { |
|
3258 | + $file = $item['file']; |
|
3259 | + } |
|
3260 | + if(isset($item['class'])) { |
|
3261 | + $class = $item['class']; |
|
3262 | + } |
|
3263 | + if(isset($item['line'])) { |
|
3264 | + $line = $item['line']; |
|
3265 | + } |
|
3266 | + if(isset($item['function'])) { |
|
3267 | + $function = $item['function']; |
|
3268 | + } |
|
3177 | 3269 | |
3178 | 3270 | if(!$first) { |
3179 | 3271 | if(!$textOnly) { |
@@ -3217,9 +3309,9 @@ discard block |
||
3217 | 3309 | if ( error_reporting() & E_NOTICE ) { |
3218 | 3310 | $halt_script = false; |
3219 | 3311 | $type = 'Notice'; |
3312 | + } else { |
|
3313 | + return; |
|
3220 | 3314 | } |
3221 | - else |
|
3222 | - return; |
|
3223 | 3315 | break; |
3224 | 3316 | case E_USER_WARNING: |
3225 | 3317 | case E_COMPILE_WARNING: |
@@ -3367,14 +3459,16 @@ discard block |
||
3367 | 3459 | $file = str_replace("/", '\\', $file); |
3368 | 3460 | |
3369 | 3461 | if(file_exists($file)) { |
3370 | - if (!($f = @sugar_fopen($file, 'r+'))) |
|
3371 | - return false; |
|
3462 | + if (!($f = @sugar_fopen($file, 'r+'))) { |
|
3463 | + return false; |
|
3464 | + } |
|
3372 | 3465 | fclose($f); |
3373 | 3466 | return true; |
3374 | 3467 | } |
3375 | 3468 | |
3376 | - if(!($f = @sugar_fopen($file, 'w'))) |
|
3377 | - return false; |
|
3469 | + if(!($f = @sugar_fopen($file, 'w'))) { |
|
3470 | + return false; |
|
3471 | + } |
|
3378 | 3472 | fclose($f); |
3379 | 3473 | unlink($file); |
3380 | 3474 | return true; |
@@ -3393,7 +3487,9 @@ discard block |
||
3393 | 3487 | global $beanList; |
3394 | 3488 | |
3395 | 3489 | foreach($module_array as $key => $value){ |
3396 | - if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value]; |
|
3490 | + if(!empty($beanList[$value])) { |
|
3491 | + $module_array[$key] = $beanList[$value]; |
|
3492 | + } |
|
3397 | 3493 | |
3398 | 3494 | if($value=="Cases") { |
3399 | 3495 | $module_array[$key] = "Case"; |
@@ -3417,8 +3513,7 @@ discard block |
||
3417 | 3513 | global $beanFiles, $beanList; |
3418 | 3514 | if(array_key_exists($bean_name, $beanList)){ |
3419 | 3515 | return $beanList[$bean_name]; |
3420 | - } |
|
3421 | - else{ |
|
3516 | + } else{ |
|
3422 | 3517 | return $bean_name; |
3423 | 3518 | } |
3424 | 3519 | } |
@@ -3692,8 +3787,7 @@ discard block |
||
3692 | 3787 | $num=unformat_number($num); |
3693 | 3788 | if(isset($system_id) && $system_id == 1){ |
3694 | 3789 | return sprintf("%d", $num); |
3695 | - } |
|
3696 | - else{ |
|
3790 | + } else{ |
|
3697 | 3791 | return sprintf("%d-%d", $num, $system_id); |
3698 | 3792 | } |
3699 | 3793 | } |
@@ -3720,8 +3814,7 @@ discard block |
||
3720 | 3814 | { |
3721 | 3815 | //third index ($split[2]) will be the host |
3722 | 3816 | $split[2] .= ":".$port; |
3723 | - } |
|
3724 | - else // otherwise assumed to start with host name |
|
3817 | + } else // otherwise assumed to start with host name |
|
3725 | 3818 | { |
3726 | 3819 | //first index ($split[0]) will be the host |
3727 | 3820 | $split[0] .= ":".$port; |
@@ -3797,19 +3890,19 @@ discard block |
||
3797 | 3890 | if(is_array($domVal)) |
3798 | 3891 | { |
3799 | 3892 | $tempArr = array(); |
3800 | - foreach ( $domVal as $domArrKey => $domArrVal ) |
|
3801 | - $tempArr[$domArrKey] = $domArrVal; |
|
3802 | - foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) |
|
3803 | - if ( !isset($tempArr[$gimpArrKey]) ) |
|
3893 | + foreach ( $domVal as $domArrKey => $domArrVal ) { |
|
3894 | + $tempArr[$domArrKey] = $domArrVal; |
|
3895 | + } |
|
3896 | + foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) { |
|
3897 | + if ( !isset($tempArr[$gimpArrKey]) ) |
|
3804 | 3898 | $tempArr[$gimpArrKey] = $gimpArrVal; |
3899 | + } |
|
3805 | 3900 | $gimp[$domKey] = $tempArr; |
3806 | - } |
|
3807 | - else |
|
3901 | + } else |
|
3808 | 3902 | { |
3809 | 3903 | $gimp[$domKey] = $domVal; |
3810 | 3904 | } |
3811 | - } |
|
3812 | - else |
|
3905 | + } else |
|
3813 | 3906 | { |
3814 | 3907 | $gimp[$domKey] = $domVal; |
3815 | 3908 | } |
@@ -3843,11 +3936,13 @@ discard block |
||
3843 | 3936 | if(array_key_exists($domKey, $gimp)) { |
3844 | 3937 | if(is_array($domVal)) { |
3845 | 3938 | $tempArr = array(); |
3846 | - foreach ( $domVal as $domArrKey => $domArrVal ) |
|
3847 | - $tempArr[$domArrKey] = $domArrVal; |
|
3848 | - foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) |
|
3849 | - if ( !array_key_exists($gimpArrKey, $tempArr) ) |
|
3939 | + foreach ( $domVal as $domArrKey => $domArrVal ) { |
|
3940 | + $tempArr[$domArrKey] = $domArrVal; |
|
3941 | + } |
|
3942 | + foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) { |
|
3943 | + if ( !array_key_exists($gimpArrKey, $tempArr) ) |
|
3850 | 3944 | $tempArr[$gimpArrKey] = $gimpArrVal; |
3945 | + } |
|
3851 | 3946 | $gimp[$domKey] = $tempArr; |
3852 | 3947 | } else { |
3853 | 3948 | $gimp[$domKey] = $domVal; |
@@ -3858,8 +3953,9 @@ discard block |
||
3858 | 3953 | } |
3859 | 3954 | } |
3860 | 3955 | // if the passed value for gimp isn't an array, then return the $dom |
3861 | - elseif(is_array($dom)) |
|
3862 | - return $dom; |
|
3956 | + elseif(is_array($dom)) { |
|
3957 | + return $dom; |
|
3958 | + } |
|
3863 | 3959 | |
3864 | 3960 | return $gimp; |
3865 | 3961 | } |
@@ -3886,8 +3982,9 @@ discard block |
||
3886 | 3982 | } |
3887 | 3983 | } |
3888 | 3984 | // if the passed value for gimp isn't an array, then return the $dom |
3889 | - elseif(is_array($dom)) |
|
3890 | - return $dom; |
|
3985 | + elseif(is_array($dom)) { |
|
3986 | + return $dom; |
|
3987 | + } |
|
3891 | 3988 | |
3892 | 3989 | return $gimp; |
3893 | 3990 | } |
@@ -4042,8 +4139,7 @@ discard block |
||
4042 | 4139 | |
4043 | 4140 | if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ |
4044 | 4141 | return true; |
4045 | - } |
|
4046 | - else { |
|
4142 | + } else { |
|
4047 | 4143 | return false; |
4048 | 4144 | } |
4049 | 4145 | } |
@@ -4076,8 +4172,9 @@ discard block |
||
4076 | 4172 | if(!empty($_SERVER['HTTP_REFERER'])) { |
4077 | 4173 | $url = parse_url($_SERVER['HTTP_REFERER']); |
4078 | 4174 | $replacement_url = $url['scheme']."://".$url['host']; |
4079 | - if(!empty($url['port'])) |
|
4080 | - $replacement_url .= ':'.$url['port']; |
|
4175 | + if(!empty($url['port'])) { |
|
4176 | + $replacement_url .= ':'.$url['port']; |
|
4177 | + } |
|
4081 | 4178 | $site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']); |
4082 | 4179 | } else { |
4083 | 4180 | $site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/',"http$1://".$_SERVER['HTTP_HOST'],$sugar_config['site_url']); |
@@ -4102,8 +4199,7 @@ discard block |
||
4102 | 4199 | foreach ($array as $key => $value){ |
4103 | 4200 | $depth_array[] = array_depth($value, $depth_count); |
4104 | 4201 | } |
4105 | - } |
|
4106 | - else{ |
|
4202 | + } else{ |
|
4107 | 4203 | return $depth_count; |
4108 | 4204 | } |
4109 | 4205 | foreach ($depth_array as $value){ |
@@ -4146,17 +4242,20 @@ discard block |
||
4146 | 4242 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4147 | 4243 | |
4148 | 4244 | //First try un-ucfirst-ing the icon name |
4149 | - if ( empty($iconFound) ) |
|
4150 | - $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif"; |
|
4245 | + if ( empty($iconFound) ) { |
|
4246 | + $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif"; |
|
4247 | + } |
|
4151 | 4248 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4152 | 4249 | |
4153 | 4250 | //Next try removing the icon prefix |
4154 | - if ( empty($iconFound) ) |
|
4155 | - $iconName = "{$iconFileName}.gif"; |
|
4251 | + if ( empty($iconFound) ) { |
|
4252 | + $iconName = "{$iconFileName}.gif"; |
|
4253 | + } |
|
4156 | 4254 | $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false); |
4157 | 4255 | |
4158 | - if ( empty($iconFound) ) |
|
4159 | - $iconName = ''; |
|
4256 | + if ( empty($iconFound) ) { |
|
4257 | + $iconName = ''; |
|
4258 | + } |
|
4160 | 4259 | |
4161 | 4260 | return $iconName; |
4162 | 4261 | } |
@@ -4222,8 +4321,9 @@ discard block |
||
4222 | 4321 | if (!isset($trans_tbl)) |
4223 | 4322 | { |
4224 | 4323 | $trans_tbl = array(); |
4225 | - foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) |
|
4226 | - $trans_tbl[$key] = utf8_encode($val); |
|
4324 | + foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) { |
|
4325 | + $trans_tbl[$key] = utf8_encode($val); |
|
4326 | + } |
|
4227 | 4327 | } |
4228 | 4328 | return strtr($string, $trans_tbl); |
4229 | 4329 | } |
@@ -4231,10 +4331,18 @@ discard block |
||
4231 | 4331 | // Returns the utf string corresponding to the unicode value |
4232 | 4332 | function code2utf($num) |
4233 | 4333 | { |
4234 | - if ($num < 128) return chr($num); |
|
4235 | - if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
4236 | - if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4237 | - if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4334 | + if ($num < 128) { |
|
4335 | + return chr($num); |
|
4336 | + } |
|
4337 | + if ($num < 2048) { |
|
4338 | + return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
4339 | + } |
|
4340 | + if ($num < 65536) { |
|
4341 | + return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4342 | + } |
|
4343 | + if ($num < 2097152) { |
|
4344 | + return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
4345 | + } |
|
4238 | 4346 | return ''; |
4239 | 4347 | } |
4240 | 4348 | |
@@ -4287,8 +4395,9 @@ discard block |
||
4287 | 4395 | */ |
4288 | 4396 | function chartColors() |
4289 | 4397 | { |
4290 | - if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') |
|
4291 | - return SugarThemeRegistry::current()->getImageURL('sugarColors.xml'); |
|
4398 | + if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') { |
|
4399 | + return SugarThemeRegistry::current()->getImageURL('sugarColors.xml'); |
|
4400 | + } |
|
4292 | 4401 | return SugarThemeRegistry::current()->getCSSURL('sugarColors.xml'); |
4293 | 4402 | } |
4294 | 4403 | /* End Chart Dashlet helper functions */ |
@@ -4319,8 +4428,9 @@ discard block |
||
4319 | 4428 | if ( ( substr($path,0,2) == '\\\\' ) |
4320 | 4429 | || ( $path[0] == '/' ) |
4321 | 4430 | || preg_match('/^[A-z]:/i',$path) |
4322 | - || $currentServer ) |
|
4323 | - return $path; |
|
4431 | + || $currentServer ) { |
|
4432 | + return $path; |
|
4433 | + } |
|
4324 | 4434 | |
4325 | 4435 | return getcwd().'/'.$path; |
4326 | 4436 | } |
@@ -4367,8 +4477,9 @@ discard block |
||
4367 | 4477 | */ |
4368 | 4478 | function get_alt_hot_key() { |
4369 | 4479 | $ua = ''; |
4370 | - if ( isset($_SERVER['HTTP_USER_AGENT']) ) |
|
4371 | - $ua = strtolower($_SERVER['HTTP_USER_AGENT']); |
|
4480 | + if ( isset($_SERVER['HTTP_USER_AGENT']) ) { |
|
4481 | + $ua = strtolower($_SERVER['HTTP_USER_AGENT']); |
|
4482 | + } |
|
4372 | 4483 | $isMac = strpos($ua, 'mac') !== false; |
4373 | 4484 | $isLinux = strpos($ua, 'linux') !== false; |
4374 | 4485 | |
@@ -4412,11 +4523,12 @@ discard block |
||
4412 | 4523 | { |
4413 | 4524 | if ( !isset($GLOBALS['sugar_config']['allow_pop_inbound']) || ! $GLOBALS['sugar_config']['allow_pop_inbound'] ) |
4414 | 4525 | { |
4415 | - if( isset($protocol['pop3']) ) |
|
4416 | - unset($protocol['pop3']); |
|
4526 | + if( isset($protocol['pop3']) ) { |
|
4527 | + unset($protocol['pop3']); |
|
4528 | + } |
|
4529 | + } else { |
|
4530 | + $protocol['pop3'] = 'POP3'; |
|
4417 | 4531 | } |
4418 | - else |
|
4419 | - $protocol['pop3'] = 'POP3'; |
|
4420 | 4532 | |
4421 | 4533 | return $protocol; |
4422 | 4534 | } |
@@ -4460,11 +4572,13 @@ discard block |
||
4460 | 4572 | } |
4461 | 4573 | |
4462 | 4574 | function encodeMultienumValue($arr) { |
4463 | - if (!is_array($arr)) |
|
4464 | - return $arr; |
|
4575 | + if (!is_array($arr)) { |
|
4576 | + return $arr; |
|
4577 | + } |
|
4465 | 4578 | |
4466 | - if (empty($arr)) |
|
4467 | - return ""; |
|
4579 | + if (empty($arr)) { |
|
4580 | + return ""; |
|
4581 | + } |
|
4468 | 4582 | |
4469 | 4583 | $string = "^" . implode('^,^', $arr) . "^"; |
4470 | 4584 | |
@@ -4496,16 +4610,14 @@ discard block |
||
4496 | 4610 | if(empty($join_type)) |
4497 | 4611 | { |
4498 | 4612 | $params['join_type'] = ' LEFT JOIN '; |
4499 | - } |
|
4500 | - else |
|
4613 | + } else |
|
4501 | 4614 | { |
4502 | 4615 | $params['join_type'] = $join_type; |
4503 | 4616 | } |
4504 | 4617 | if(isset($data['join_name'])) |
4505 | 4618 | { |
4506 | 4619 | $params['join_table_alias'] = $field['join_name']; |
4507 | - } |
|
4508 | - else |
|
4620 | + } else |
|
4509 | 4621 | { |
4510 | 4622 | $params['join_table_alias'] = 'join_'.$field['name']; |
4511 | 4623 | |
@@ -4513,8 +4625,7 @@ discard block |
||
4513 | 4625 | if(isset($data['join_link_name'])) |
4514 | 4626 | { |
4515 | 4627 | $params['join_table_link_alias'] = $field['join_link_name']; |
4516 | - } |
|
4517 | - else |
|
4628 | + } else |
|
4518 | 4629 | { |
4519 | 4630 | $params['join_table_link_alias'] = 'join_link_'.$field['name']; |
4520 | 4631 | } |
@@ -4523,7 +4634,7 @@ discard block |
||
4523 | 4634 | if(isset($field['db_concat_fields'])){ |
4524 | 4635 | $db_field = db_concat($join_table_alias, $field['db_concat_fields']); |
4525 | 4636 | $where = preg_replace('/'.$field['name'].'/', $db_field, $where); |
4526 | - }else{ |
|
4637 | + } else{ |
|
4527 | 4638 | $where = preg_replace('/(^|[\s(])' . $field['name'] . '/', '${1}' . $join_table_alias . '.'.$field['rname'], $where); |
4528 | 4639 | } |
4529 | 4640 | } |
@@ -4558,8 +4669,7 @@ discard block |
||
4558 | 4669 | $number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches); |
4559 | 4670 | if($number){ |
4560 | 4671 | return $matches[1]; |
4561 | - } |
|
4562 | - else{ |
|
4672 | + } else{ |
|
4563 | 4673 | return false; |
4564 | 4674 | } |
4565 | 4675 | } |
@@ -4591,7 +4701,7 @@ discard block |
||
4591 | 4701 | function getVersionStatus($version){ |
4592 | 4702 | if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) { |
4593 | 4703 | return strtoupper($matches[1]); |
4594 | - }else{ |
|
4704 | + } else{ |
|
4595 | 4705 | return 'GA'; |
4596 | 4706 | } |
4597 | 4707 | } |
@@ -4686,7 +4796,9 @@ discard block |
||
4686 | 4796 | } else { |
4687 | 4797 | // check image manually |
4688 | 4798 | $fp = fopen($path, "rb"); |
4689 | - if(!$fp) return false; |
|
4799 | + if(!$fp) { |
|
4800 | + return false; |
|
4801 | + } |
|
4690 | 4802 | $data = ''; |
4691 | 4803 | // read the whole file in chunks |
4692 | 4804 | while(!feof($fp)) { |
@@ -4778,8 +4890,9 @@ discard block |
||
4778 | 4890 | // add wildcard at the beginning of the search string |
4779 | 4891 | if (isset($GLOBALS['sugar_config']['search_wildcard_infront']) && |
4780 | 4892 | $GLOBALS['sugar_config']['search_wildcard_infront'] == true) { |
4781 | - if (substr($str,0,1) <> $wildcard) |
|
4782 | - $str = $wildcard.$str; |
|
4893 | + if (substr($str,0,1) <> $wildcard) { |
|
4894 | + $str = $wildcard.$str; |
|
4895 | + } |
|
4783 | 4896 | } |
4784 | 4897 | |
4785 | 4898 | // add wildcard at the end of search string (default) |
@@ -4834,8 +4947,7 @@ discard block |
||
4834 | 4947 | { |
4835 | 4948 | if (isset($GLOBALS['app_list_strings'][$optionName])) { |
4836 | 4949 | return $GLOBALS['app_list_strings'][$optionName]; |
4837 | - } |
|
4838 | - else { |
|
4950 | + } else { |
|
4839 | 4951 | return array(); |
4840 | 4952 | } |
4841 | 4953 | } |
@@ -5085,47 +5197,53 @@ discard block |
||
5085 | 5197 | |
5086 | 5198 | function suite_strlen($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5087 | 5199 | { |
5088 | - if(function_exists('mb_strlen')) |
|
5089 | - return mb_strlen($input,$encoding); |
|
5090 | - else |
|
5091 | - return strlen($input); |
|
5092 | -} |
|
5200 | + if(function_exists('mb_strlen')) { |
|
5201 | + return mb_strlen($input,$encoding); |
|
5202 | + } else { |
|
5203 | + return strlen($input); |
|
5204 | + } |
|
5205 | + } |
|
5093 | 5206 | |
5094 | 5207 | function suite_substr($input, $start, $length = null,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5095 | 5208 | { |
5096 | - if(function_exists('mb_substr')) |
|
5097 | - return mb_substr($input,$start,$length,$encoding); |
|
5098 | - else |
|
5099 | - return substr($input,$start,$length); |
|
5100 | -} |
|
5209 | + if(function_exists('mb_substr')) { |
|
5210 | + return mb_substr($input,$start,$length,$encoding); |
|
5211 | + } else { |
|
5212 | + return substr($input,$start,$length); |
|
5213 | + } |
|
5214 | + } |
|
5101 | 5215 | |
5102 | 5216 | function suite_strtoupper($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5103 | 5217 | { |
5104 | - if(function_exists('mb_strtoupper')) |
|
5105 | - return mb_strtoupper($input,$encoding); |
|
5106 | - else |
|
5107 | - return strtoupper($input); |
|
5108 | -} |
|
5218 | + if(function_exists('mb_strtoupper')) { |
|
5219 | + return mb_strtoupper($input,$encoding); |
|
5220 | + } else { |
|
5221 | + return strtoupper($input); |
|
5222 | + } |
|
5223 | + } |
|
5109 | 5224 | function suite_strtolower($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5110 | 5225 | { |
5111 | - if(function_exists('mb_strtolower')) |
|
5112 | - return mb_strtolower($input,$encoding); |
|
5113 | - else |
|
5114 | - return strtolower($input); |
|
5115 | -} |
|
5226 | + if(function_exists('mb_strtolower')) { |
|
5227 | + return mb_strtolower($input,$encoding); |
|
5228 | + } else { |
|
5229 | + return strtolower($input); |
|
5230 | + } |
|
5231 | + } |
|
5116 | 5232 | |
5117 | 5233 | function suite_strpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5118 | 5234 | { |
5119 | - if(function_exists('mb_strpos')) |
|
5120 | - return mb_strpos($haystack,$needle,$offset,$encoding); |
|
5121 | - else |
|
5122 | - return strpos($haystack,$needle,$offset); |
|
5123 | -} |
|
5235 | + if(function_exists('mb_strpos')) { |
|
5236 | + return mb_strpos($haystack,$needle,$offset,$encoding); |
|
5237 | + } else { |
|
5238 | + return strpos($haystack,$needle,$offset); |
|
5239 | + } |
|
5240 | + } |
|
5124 | 5241 | |
5125 | 5242 | function suite_strrpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING) |
5126 | 5243 | { |
5127 | - if(function_exists('mb_strrpos')) |
|
5128 | - return mb_strrpos($haystack,$needle,$offset,$encoding); |
|
5129 | - else |
|
5130 | - return strrpos($haystack,$needle,$offset); |
|
5131 | -} |
|
5132 | 5244 | \ No newline at end of file |
5245 | + if(function_exists('mb_strrpos')) { |
|
5246 | + return mb_strrpos($haystack,$needle,$offset,$encoding); |
|
5247 | + } else { |
|
5248 | + return strrpos($haystack,$needle,$offset); |
|
5249 | + } |
|
5250 | + } |
|
5133 | 5251 | \ No newline at end of file |
@@ -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. |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | foreach($this->displayColumns as $name => $params) { |
129 | 131 | $this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2); |
130 | 132 | // figure out which contextMenu objectsTypes are required |
131 | - if(!empty($params['contextMenu']['objectType'])) |
|
132 | - $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true; |
|
133 | + if(!empty($params['contextMenu']['objectType'])) { |
|
134 | + $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true; |
|
135 | + } |
|
133 | 136 | } |
134 | 137 | $this->th->ss->assign('displayColumns', $this->displayColumns); |
135 | 138 | |
@@ -147,10 +150,17 @@ discard block |
||
147 | 150 | $this->th->ss->assign('searchForm', $this->searchForm->display(false)); |
148 | 151 | //rrs |
149 | 152 | |
150 | - if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink()); |
|
153 | + if($this->export) { |
|
154 | + $this->th->ss->assign('exportLink', $this->buildExportLink()); |
|
155 | + } |
|
151 | 156 | $this->th->ss->assign('quickViewLinks', $this->quickViewLinks); |
152 | - if($this->mailMerge) $this->th->ss->assign('mergeLink', $this->buildMergeLink()); // still check for mailmerge access |
|
153 | - if($this->mergeduplicates) $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink()); |
|
157 | + if($this->mailMerge) { |
|
158 | + $this->th->ss->assign('mergeLink', $this->buildMergeLink()); |
|
159 | + } |
|
160 | + // still check for mailmerge access |
|
161 | + if($this->mergeduplicates) { |
|
162 | + $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink()); |
|
163 | + } |
|
154 | 164 | |
155 | 165 | |
156 | 166 | if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { |
@@ -301,7 +311,7 @@ discard block |
||
301 | 311 | |
302 | 312 | if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){ |
303 | 313 | require('custom/modules/'.$this->module.'/metadata/metafiles.php'); |
304 | - }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
314 | + } elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){ |
|
305 | 315 | require('modules/'.$this->module.'/metadata/metafiles.php'); |
306 | 316 | } |
307 | 317 | |
@@ -321,21 +331,24 @@ discard block |
||
321 | 331 | $displayColumns = array(); |
322 | 332 | if(!empty($_REQUEST['displayColumns'])) { |
323 | 333 | foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) { |
324 | - if(!empty($listViewDefs[$this->module][$col])) |
|
325 | - $displayColumns[$col] = $this->listviewdefs[$this->module][$col]; |
|
334 | + if(!empty($listViewDefs[$this->module][$col])) { |
|
335 | + $displayColumns[$col] = $this->listviewdefs[$this->module][$col]; |
|
336 | + } |
|
326 | 337 | } |
327 | - } |
|
328 | - else { |
|
338 | + } else { |
|
329 | 339 | foreach($this->listviewdefs[$this->module] as $col => $para) { |
330 | - if(!empty($para['default']) && $para['default']) |
|
331 | - $displayColumns[$col] = $para; |
|
340 | + if(!empty($para['default']) && $para['default']) { |
|
341 | + $displayColumns[$col] = $para; |
|
342 | + } |
|
332 | 343 | } |
333 | 344 | } |
334 | 345 | $params['massupdate'] = true; |
335 | 346 | if(!empty($_REQUEST['orderBy'])) { |
336 | 347 | $params['orderBy'] = $_REQUEST['orderBy']; |
337 | 348 | $params['overrideOrder'] = true; |
338 | - if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder']; |
|
349 | + if(!empty($_REQUEST['sortOrder'])) { |
|
350 | + $params['sortOrder'] = $_REQUEST['sortOrder']; |
|
351 | + } |
|
339 | 352 | } |
340 | 353 | |
341 | 354 | $lv->displayColumns = $displayColumns; |
@@ -453,7 +466,9 @@ discard block |
||
453 | 466 | |
454 | 467 | // Need to include the default whereStatement |
455 | 468 | if(!empty($this->_popupMeta['whereStatement'])){ |
456 | - if(!empty($where))$where .= ' AND '; |
|
469 | + if(!empty($where)) { |
|
470 | + $where .= ' AND '; |
|
471 | + } |
|
457 | 472 | $where .= $this->_popupMeta['whereStatement']; |
458 | 473 | } |
459 | 474 | |
@@ -472,11 +487,13 @@ discard block |
||
472 | 487 | $this->formData[] = array('field' => $data); |
473 | 488 | $value = ''; |
474 | 489 | $this->customFieldDefs[$data['name']]= $data; |
475 | - if(!empty($_REQUEST[$data['name']])) |
|
476 | - $value = $_REQUEST[$data['name']]; |
|
490 | + if(!empty($_REQUEST[$data['name']])) { |
|
491 | + $value = $_REQUEST[$data['name']]; |
|
492 | + } |
|
477 | 493 | $this->customFieldDefs[$data['name']]['value'] = $value; |
478 | - }else |
|
479 | - $this->formData[] = array('field' => array('name'=>$data)); |
|
494 | + } else { |
|
495 | + $this->formData[] = array('field' => array('name'=>$data)); |
|
496 | + } |
|
480 | 497 | } |
481 | 498 | $this->fieldDefs = array(); |
482 | 499 | if($this->seed){ |
@@ -487,13 +504,15 @@ discard block |
||
487 | 504 | //if we have a relate type then reset to name so that we end up with a textbox |
488 | 505 | //rather than a select button |
489 | 506 | $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name']; |
490 | - if($this->fieldDefs[$name]['type'] == 'relate') |
|
491 | - $this->fieldDefs[$name]['type'] = 'name'; |
|
507 | + if($this->fieldDefs[$name]['type'] == 'relate') { |
|
508 | + $this->fieldDefs[$name]['type'] = 'name'; |
|
509 | + } |
|
492 | 510 | if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) { |
493 | 511 | $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums |
494 | 512 | } |
495 | - if(!empty($_REQUEST[$name])) |
|
496 | - $value = $_REQUEST[$name]; |
|
513 | + if(!empty($_REQUEST[$name])) { |
|
514 | + $value = $_REQUEST[$name]; |
|
515 | + } |
|
497 | 516 | $this->fieldDefs[$name]['value'] = $value; |
498 | 517 | } |
499 | 518 | } |
@@ -540,8 +559,9 @@ discard block |
||
540 | 559 | EOQ; |
541 | 560 | // if metadata contains custom inputs for the quickcreate |
542 | 561 | if(!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) { |
543 | - foreach($this->_popupMeta['customInput'] as $key => $value) |
|
544 | - $formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n'; |
|
562 | + foreach($this->_popupMeta['customInput'] as $key => $value) { |
|
563 | + $formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n'; |
|
564 | + } |
|
545 | 565 | } |
546 | 566 | |
547 | 567 |