Test Failed
Push — CI ( 02428e...3e0292 )
by Adam
55:43
created
include/InlineEditing/InlineEditing.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
     global $current_language, $app_strings, $app_list_strings, $current_user, $beanFiles, $beanList;
44 44
 
45
-    $bean = BeanFactory::getBean($module,$id);
45
+    $bean = BeanFactory::getBean($module, $id);
46 46
 
47
-    if(!checkAccess($bean)){
47
+    if (!checkAccess($bean)) {
48 48
         return false;
49 49
     }
50 50
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     $mod_strings = return_module_language($current_language, $module);
55 55
 
56 56
     // set the filename for this control
57
-    $file = create_cache_directory('include/InlineEditing/') . $module . $view . $alt_type . $fieldname . '.tpl';
57
+    $file = create_cache_directory('include/InlineEditing/').$module.$view.$alt_type.$fieldname.'.tpl';
58 58
 
59 59
     if (!is_file($file)
60 60
         || inDeveloperMode()
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         if ($vardef['type'] == 'link') {
100 100
             $vardef['type'] = 'relate';
101 101
             $vardef['rname'] = 'name';
102
-            $vardef['id_name'] = $vardef['name'] . '_id';
102
+            $vardef['id_name'] = $vardef['name'].'_id';
103 103
             if ((!isset($vardef['module']) || $vardef['module'] == '') && $focus->load_relationship($vardef['name'])) {
104 104
                 $vardef['module'] = $focus->$vardef['name']->getRelatedModuleName();
105 105
             }
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
135 135
         // Remove all the copyright comments
136 136
         $contents = preg_replace('/\{\*[^\}]*?\*\}/', '', $contents);
137 137
         // remove extra wrong javascript which breaks auto complete on flexi relationship parent fields
138
-        $contents = preg_replace("/<script language=\"javascript\">if\(typeof sqs_objects == \'undefined\'\){var sqs_objects = new Array;}sqs_objects\[\'EditView_parent_name\'\].*?<\/script>/","",$contents);
138
+        $contents = preg_replace("/<script language=\"javascript\">if\(typeof sqs_objects == \'undefined\'\){var sqs_objects = new Array;}sqs_objects\[\'EditView_parent_name\'\].*?<\/script>/", "", $contents);
139 139
 
140 140
 
141 141
         if ($view == 'EditView' && ($vardef['type'] == 'relate' || $vardef['type'] == 'parent')) {
142 142
 
143
-            $contents = str_replace('"' . $vardef['id_name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.id_name}"{literal}', $contents);
144
-            $contents = str_replace('"' . $vardef['name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.name}"{literal}', $contents);
143
+            $contents = str_replace('"'.$vardef['id_name'].'"', '{/literal}"{$fields.'.$vardef['name'].'.id_name}"{literal}', $contents);
144
+            $contents = str_replace('"'.$vardef['name'].'"', '{/literal}"{$fields.'.$vardef['name'].'.name}"{literal}', $contents);
145 145
             // regex below fixes button javascript for flexi relationship
146
-            if($vardef['type'] == 'parent') {
146
+            if ($vardef['type'] == 'parent') {
147 147
                $contents = str_replace("onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"{\$fields.parent_name.id_name}", "onclick='open_popup(document.{\$form_name}.parent_type.value, 600, 400, \"\", true, false, {literal}{\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":{/literal}\"parent_id", $contents);
148 148
             }
149 149
         }
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
     }
178 178
     $t23 = strpos($time_format, '23') !== false ? '%H' : '%I';
179 179
     if (!isset($match[2]) || $match[2] == '') {
180
-        $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M");
180
+        $ss->assign('CALENDAR_FORMAT', $date_format.' '.$t23.$time_separator."%M");
181 181
     } else {
182 182
         $pm = $match[2] == "pm" ? "%P" : "%p";
183
-        $ss->assign('CALENDAR_FORMAT', $date_format . ' ' . $t23 . $time_separator . "%M" . $pm);
183
+        $ss->assign('CALENDAR_FORMAT', $date_format.' '.$t23.$time_separator."%M".$pm);
184 184
     }
185 185
 
186 186
     $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
     }
223 223
 
224 224
     if ($fieldlist[$fieldname]['type'] == 'link') {
225
-        $fieldlist[$fieldname]['id_name'] = $fieldlist[$fieldname]['name'] . '_id';
225
+        $fieldlist[$fieldname]['id_name'] = $fieldlist[$fieldname]['name'].'_id';
226 226
 
227 227
         if ((!isset($fieldlist[$fieldname]['module']) || $fieldlist[$fieldname]['module'] == '') && $focus->load_relationship($fieldlist[$fieldname]['name'])) {
228 228
             $fieldlist[$fieldname]['module'] = $focus->$fieldlist[$fieldname]['name']->getRelatedModuleName();
229 229
         }
230 230
     }
231 231
 
232
-    if($fieldlist[$fieldname]['type'] == 'parent'){
232
+    if ($fieldlist[$fieldname]['type'] == 'parent') {
233 233
         $fieldlist['parent_id']['name'] = 'parent_id';
234 234
     }
235 235
 
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
     }
241 241
 
242 242
     if (isset($fieldlist[$fieldname]['id_name']) && $fieldlist[$fieldname]['id_name'] != '' && $fieldlist[$fieldname]['id_name'] != $fieldlist[$fieldname]['name']) {
243
-        if($value){
244
-            $rel_value =  $bean->$fieldlist[$fieldname]['id_name'];
243
+        if ($value) {
244
+            $rel_value = $bean->$fieldlist[$fieldname]['id_name'];
245 245
 
246 246
         }
247 247
         $fieldlist[$fieldlist[$fieldname]['id_name']]['value'] = $rel_value;
248 248
         $fieldlist[$fieldname]['value'] = $value;
249 249
         $fieldlist[$fieldname]['id_name'] = $aow_field;
250
-        $fieldlist[$fieldname]['name'] = $aow_field . '_display';
250
+        $fieldlist[$fieldname]['name'] = $aow_field.'_display';
251 251
     } else if (isset($fieldlist[$fieldname]['type']) && ($fieldlist[$fieldname]['type'] == 'datetimecombo' || $fieldlist[$fieldname]['type'] == 'datetime')) {
252 252
         $value = $focus->convertField($value, $fieldlist[$fieldname]);
253 253
         if (!$value) {
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 
312 312
         if ($bean->field_defs[$field]['type'] == "multienum") {
313 313
             $bean->$field = encodeMultienumValue($value);
314
-        }else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){
314
+        } else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent') {
315 315
             $save_field = $bean->field_defs[$field]['id_name'];
316 316
             $bean->$save_field = $value;
317 317
             if ($bean->field_defs[$field]['type'] == 'parent') {
318 318
                 $bean->parent_type = $_REQUEST['parent_type'];
319 319
                 $bean->fill_in_additional_parent_fields(); // get up to date parent info as need it to display name
320 320
             }
321
-        }else{
321
+        } else {
322 322
             $bean->$field = $value;
323 323
         }
324 324
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
     $fieldlist[$field] = $bean->getFieldDefinition($field);
345 345
 
346
-    if(is_array($listViewDefs)){
346
+    if (is_array($listViewDefs)) {
347 347
         $fieldlist[$field] = array_merge($fieldlist[$field], $listViewDefs);
348 348
     }
349 349
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $vardef['module'] = $bean->module_dir;
382 382
 
383 383
         $SugarWidgetSubPanelDetailViewLink = new SugarWidgetSubPanelDetailViewLink($vardef);
384
-        $value = "<b>" . $SugarWidgetSubPanelDetailViewLink->displayList($vardef) . "</b>";
384
+        $value = "<b>".$SugarWidgetSubPanelDetailViewLink->displayList($vardef)."</b>";
385 385
 
386 386
     }
387 387
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         }
395 395
         $datetime_format = $timedate->get_date_time_format();
396 396
         // create utc date (as it's utc in db)
397
-        $datetime = DateTime::createFromFormat("Y-m-d H:i:s", $value,new DateTimeZone('UTC'));
397
+        $datetime = DateTime::createFromFormat("Y-m-d H:i:s", $value, new DateTimeZone('UTC'));
398 398
         // convert it to timezone the user uses
399 399
         $datetime = $timedate->tzUser($datetime);
400 400
 
@@ -428,17 +428,17 @@  discard block
 block discarded – undo
428 428
     }
429 429
 
430 430
     //if field is of type relate.
431
-    if ($vardef['type'] == "relate" || $vardef['type'] == "parent")  {
431
+    if ($vardef['type'] == "relate" || $vardef['type'] == "parent") {
432 432
 
433
-        if($vardef['source'] == "non-db"){
433
+        if ($vardef['source'] == "non-db") {
434 434
 
435
-            if($vardef['module'] == "Employees"){
435
+            if ($vardef['module'] == "Employees") {
436 436
                 $vardef['ext2'] = "Users";
437 437
                 $vardef['rname'] = "full_name";
438 438
             }
439 439
 
440 440
         }
441
-        if($vardef['type'] == "parent") {
441
+        if ($vardef['type'] == "parent") {
442 442
             $vardef['module'] = $bean->parent_type;
443 443
             $name = $bean->parent_name;
444 444
         }
@@ -446,14 +446,14 @@  discard block
 block discarded – undo
446 446
 
447 447
         $value = "<a class=\"listViewTdLinkS1\" href=\"index.php?action=DetailView&module=".$vardef['module']."&record=$record\">";
448 448
 
449
-        if($vardef['ext2']){
450
-            $value .= getFieldValueFromModule($vardef['rname'],$vardef['ext2'],$record) . "</a>";
449
+        if ($vardef['ext2']) {
450
+            $value .= getFieldValueFromModule($vardef['rname'], $vardef['ext2'], $record)."</a>";
451 451
 
452
-        }else if(!empty($vardef['rname'])){
453
-            $value .= getFieldValueFromModule($vardef['rname'],$vardef['module'],$record) . "</a>";
452
+        } else if (!empty($vardef['rname'])) {
453
+            $value .= getFieldValueFromModule($vardef['rname'], $vardef['module'], $record)."</a>";
454 454
 
455 455
         } else {
456
-            $value .= $name . "</a>";
456
+            $value .= $name."</a>";
457 457
         }
458 458
     }
459 459
 
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
     return $value;
483 483
 }
484 484
 
485
-function checkAccess($bean){
485
+function checkAccess($bean) {
486 486
 
487
-    if($bean->ACLAccess('EditView')) {
487
+    if ($bean->ACLAccess('EditView')) {
488 488
         return true;
489
-    }else {
489
+    } else {
490 490
         return false;
491 491
     }
492 492
 }
Please login to merge, or discard this patch.
include/phpmailer/language/phpmailer.lang-ar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 $PHPMAILER_LANG['invalid_address']      = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح.';
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.';
20 20
 $PHPMAILER_LANG['provide_address']      = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.';
21
-$PHPMAILER_LANG['recipients_failed']    = 'خطأ SMTP: الأخطاء التالية ' .
21
+$PHPMAILER_LANG['recipients_failed']    = 'خطأ SMTP: الأخطاء التالية '.
22 22
                                           'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 $PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() غير ممكن.';
Please login to merge, or discard this patch.
include/formbase.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
  */
55 55
 function checkRequired($prefix, $required)
56 56
 {
57
-	foreach($required as $key)
57
+	foreach ($required as $key)
58 58
 	{
59
-		if(!isset($_POST[$prefix.$key]) || number_empty($_POST[$prefix.$key]))
59
+		if (!isset($_POST[$prefix.$key]) || number_empty($_POST[$prefix.$key]))
60 60
 		{
61 61
 			return false;
62 62
 		}
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 {
78 78
 	global $current_user;
79 79
 
80
-	if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve)
80
+	if (!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve)
81 81
 		$focus->retrieve($_REQUEST[$prefix.'record']);
82 82
 
83
-	if(!empty($_POST['assigned_user_id']) && 
83
+	if (!empty($_POST['assigned_user_id']) && 
84 84
 	    ($focus->assigned_user_id != $_POST['assigned_user_id']) && 
85 85
 	    ($_POST['assigned_user_id'] != $current_user->id)) {
86 86
 		$GLOBALS['check_notify'] = true;
87 87
 	}
88
-    if(isset($_POST['dup_checked']) && $_POST['dup_checked'] && isset($_POST['id']) && $_POST['id'] != '' ){
88
+    if (isset($_POST['dup_checked']) && $_POST['dup_checked'] && isset($_POST['id']) && $_POST['id'] != '') {
89 89
         $focus->new_with_id = true;
90 90
     }
91 91
     require_once('include/SugarFields/SugarFieldHandler.php');
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
         $relatedFields[$def['id_name']] = $field;
107 107
     }
108 108
 
109
-	foreach($focus->field_defs as $field=>$def) {
110
-        if ( $field == 'id' && !empty($focus->id) ) {
109
+	foreach ($focus->field_defs as $field=>$def) {
110
+        if ($field == 'id' && !empty($focus->id)) {
111 111
             // Don't try and overwrite the ID
112 112
             continue;
113 113
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 	    $type = !empty($def['custom_type']) ? $def['custom_type'] : $def['type'];
117 117
 		$sf = $sfh->getSugarField($type);
118
-        if($sf != null){
118
+        if ($sf != null) {
119 119
             $sf->save($focus, $_POST, $field, $def, $prefix);
120 120
         } else {
121 121
             $GLOBALS['log']->fatal("Field '$field' does not have a SugarField handler");
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 */
155 155
 	}
156 156
 
157
-	foreach($focus->additional_column_fields as $field) {
158
-		if(isset($_POST[$prefix.$field])) {
157
+	foreach ($focus->additional_column_fields as $field) {
158
+		if (isset($_POST[$prefix.$field])) {
159 159
 			$value = $_POST[$prefix.$field];
160 160
 			$focus->$field = $value;
161 161
 		}
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 }
181 181
 
182 182
 
183
-function getPostToForm($ignore='', $isRegularExpression=false)
183
+function getPostToForm($ignore = '', $isRegularExpression = false)
184 184
 {
185 185
 	$fields = '';
186
-	if(!empty($ignore) && $isRegularExpression) {
187
-		foreach ($_POST as $key=>$value){
188
-			if(!preg_match($ignore, $key)) {
186
+	if (!empty($ignore) && $isRegularExpression) {
187
+		foreach ($_POST as $key=>$value) {
188
+			if (!preg_match($ignore, $key)) {
189 189
                                 $fields .= add_hidden_elements($key, $value);
190 190
 			}
191 191
 		}	
192 192
 	} else {
193
-		foreach ($_POST as $key=>$value){
194
-			if($key != $ignore) {
193
+		foreach ($_POST as $key=>$value) {
194
+			if ($key != $ignore) {
195 195
                                 $fields .= add_hidden_elements($key, $value);
196 196
 			}
197 197
 		}
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 	return $fields;
200 200
 }
201 201
 
202
-function getGetToForm($ignore='', $usePostAsAuthority = false)
202
+function getGetToForm($ignore = '', $usePostAsAuthority = false)
203 203
 {
204 204
 	$fields = '';
205 205
 	foreach ($_GET as $key=>$value)
206 206
 	{
207
-		if($key != $ignore){
208
-			if(!$usePostAsAuthority || !isset($_POST[$key])){
209
-				$fields.= "<input type='hidden' name='$key' value='$value'>";
207
+		if ($key != $ignore) {
208
+			if (!$usePostAsAuthority || !isset($_POST[$key])) {
209
+				$fields .= "<input type='hidden' name='$key' value='$value'>";
210 210
 			}
211 211
 		}
212 212
 	}
213 213
 	return $fields;
214 214
 
215 215
 }
216
-function getAnyToForm($ignore='', $usePostAsAuthority = false)
216
+function getAnyToForm($ignore = '', $usePostAsAuthority = false)
217 217
 {
218 218
 	$fields = getPostToForm($ignore);
219 219
 	$fields .= getGetToForm($ignore, $usePostAsAuthority);
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 
222 222
 }
223 223
 
224
-function handleRedirect($return_id='', $return_module='', $additionalFlags = false)
224
+function handleRedirect($return_id = '', $return_module = '', $additionalFlags = false)
225 225
 {
226
-	if(isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "")
226
+	if (isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "")
227 227
 	{
228
-		header("Location: ". $_REQUEST['return_url']);
228
+		header("Location: ".$_REQUEST['return_url']);
229 229
 		exit;
230 230
 	}
231 231
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 }
236 236
 
237 237
 //eggsurplus: abstract to simplify unit testing
238
-function buildRedirectURL($return_id='', $return_module='') 
238
+function buildRedirectURL($return_id = '', $return_module = '') 
239 239
 {
240
-    if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
240
+    if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
241 241
 	{
242 242
 		$return_module = $_REQUEST['return_module'];
243 243
 	}
@@ -245,24 +245,24 @@  discard block
 block discarded – undo
245 245
 	{
246 246
 		$return_module = $return_module;
247 247
 	}
248
-	if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "")
248
+	if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "")
249 249
 	{
250 250
 	    
251 251
 	   //if we are doing a "Close and Create New"
252
-        if(isCloseAndCreateNewPressed())
252
+        if (isCloseAndCreateNewPressed())
253 253
         {
254 254
             $return_action = "EditView";    
255 255
             $isDuplicate = "true";        
256 256
             $status = "";
257 257
             
258 258
             // Meeting Integration
259
-            if(isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) {
259
+            if (isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) {
260 260
             	$additionalFlags = array('meetingIntegrationShowForm' => '1');
261 261
             }
262 262
             // END Meeting Integration
263 263
         } 
264 264
 		// if we create a new record "Save", we want to redirect to the DetailView
265
-		else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" 
265
+		else if (isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" 
266 266
 			&& $_REQUEST['return_module'] != 'Activities'
267 267
 			&& $_REQUEST['return_module'] != 'Home' 
268 268
 			&& $_REQUEST['return_module'] != 'Forecasts' 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 			) 
272 272
 			{
273 273
 			    $return_action = 'DetailView';
274
-			} elseif($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') {
274
+			} elseif ($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') {
275 275
 			$return_module = $_REQUEST['module'];
276 276
 			$return_action = $_REQUEST['return_action']; 
277 277
 			// wp: return action needs to be set for one-click close in task list
@@ -287,25 +287,25 @@  discard block
 block discarded – undo
287 287
 		$return_action = "DetailView";
288 288
 	}
289 289
 	
290
-	if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "")
290
+	if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "")
291 291
 	{
292 292
 		$return_id = $_REQUEST['return_id'];
293 293
 	}
294 294
 
295 295
     $add = "";
296
-    if(isset($additionalFlags) && !empty($additionalFlags)) {
297
-        foreach($additionalFlags as $k => $v) {
296
+    if (isset($additionalFlags) && !empty($additionalFlags)) {
297
+        foreach ($additionalFlags as $k => $v) {
298 298
             $add .= "&{$k}={$v}";
299 299
         }
300 300
     }
301 301
     
302 302
     if (!isset($isDuplicate) || !$isDuplicate)
303 303
     {
304
-        $url="index.php?action=$return_action&module=$return_module&record=$return_id&return_module=$return_module&return_action=$return_action{$add}";
305
-        if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) {
304
+        $url = "index.php?action=$return_action&module=$return_module&record=$return_id&return_module=$return_module&return_action=$return_action{$add}";
305
+        if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) {
306 306
             $url .= "&offset=".$_REQUEST['offset'];
307 307
         }
308
-        if(!empty($_REQUEST['ajax_load']))
308
+        if (!empty($_REQUEST['ajax_load']))
309 309
         {
310 310
             $ajax_ret = array(
311 311
                 'content' => "<script>SUGAR.ajaxUI.loadContent('$url');</script>\n",
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
         }
322 322
     } else {
323 323
     	$standard = "action=$return_action&module=$return_module&record=$return_id&isDuplicate=true&return_module=$return_module&return_action=$return_action&status=$status";
324
-        $url="index.php?{$standard}{$add}";
325
-        if(!empty($_REQUEST['ajax_load']))
324
+        $url = "index.php?{$standard}{$add}";
325
+        if (!empty($_REQUEST['ajax_load']))
326 326
         {
327 327
             $ajax_ret = array(
328 328
                  'content' => "<script>SUGAR.ajaxUI.loadContent('$url');</script>\n",
@@ -339,20 +339,20 @@  discard block
 block discarded – undo
339 339
     }
340 340
 }
341 341
 
342
-function getLikeForEachWord($fieldname, $value, $minsize=4)
342
+function getLikeForEachWord($fieldname, $value, $minsize = 4)
343 343
 {
344 344
 	$value = trim($value);
345
-	$values = explode(' ',$value);
345
+	$values = explode(' ', $value);
346 346
 	$ret = '';
347
-	foreach($values as $val)
347
+	foreach ($values as $val)
348 348
 	{
349
-		if(strlen($val) >= $minsize)
349
+		if (strlen($val) >= $minsize)
350 350
 		{
351
-			if(!empty($ret))
351
+			if (!empty($ret))
352 352
 			{
353 353
 				$ret .= ' or';
354 354
 			}
355
-			$ret .= ' '. $fieldname . ' LIKE %'.$val.'%';
355
+			$ret .= ' '.$fieldname.' LIKE %'.$val.'%';
356 356
 		}
357 357
 
358 358
 	}
@@ -373,36 +373,36 @@  discard block
 block discarded – undo
373 373
  * @see include/generic/Save2.php
374 374
  */
375 375
 
376
-function add_prospects_to_prospect_list($parent_id,$child_id)
376
+function add_prospects_to_prospect_list($parent_id, $child_id)
377 377
 {
378
-    $focus=BeanFactory::getBean('Prospects');
379
-    if(is_array($child_id)){
378
+    $focus = BeanFactory::getBean('Prospects');
379
+    if (is_array($child_id)) {
380 380
         $uids = $child_id;
381 381
     }
382
-    else{
382
+    else {
383 383
         $uids = array($child_id);
384 384
     }
385 385
 
386 386
     $relationship = '';
387
-    foreach($focus->get_linked_fields() as $field => $def) {
387
+    foreach ($focus->get_linked_fields() as $field => $def) {
388 388
         if ($focus->load_relationship($field)) {
389
-            if ( $focus->$field->getRelatedModuleName() == 'ProspectLists' ) {
389
+            if ($focus->$field->getRelatedModuleName() == 'ProspectLists') {
390 390
                 $relationship = $field;
391 391
                 break;
392 392
             }
393 393
         }
394 394
     }
395 395
 
396
-    if ( $relationship != '' ) {
397
-        foreach ( $uids as $id) {
396
+    if ($relationship != '') {
397
+        foreach ($uids as $id) {
398 398
             $focus->retrieve($id);
399 399
             $focus->load_relationship($relationship);
400
-            $focus->prospect_lists->add( $parent_id );
400
+            $focus->prospect_lists->add($parent_id);
401 401
         }
402 402
     }
403 403
 }
404 404
 
405
-function add_to_prospect_list($query_panel,$parent_module,$parent_type,$parent_id,$child_id,$link_attribute,$link_type,$parent)
405
+function add_to_prospect_list($query_panel, $parent_module, $parent_type, $parent_id, $child_id, $link_attribute, $link_type, $parent)
406 406
 {
407 407
     $GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$query_panel);
408 408
     $GLOBALS['log']->debug('add_prospects_to_prospect_list:parameters:'.$parent_module);
@@ -419,21 +419,21 @@  discard block
 block discarded – undo
419 419
     }
420 420
     $focus = new $parent_type();
421 421
     $focus->retrieve($parent_id);
422
-    if(empty($focus->id)) {
422
+    if (empty($focus->id)) {
423 423
         return false;
424 424
     }
425
-    if(empty($parent)) {
425
+    if (empty($parent)) {
426 426
         return false;
427 427
     }
428 428
 
429 429
     //if link_type is default then load relationship once and add all the child ids.
430
-    $relationship_attribute=$link_attribute;
430
+    $relationship_attribute = $link_attribute;
431 431
 
432 432
     //find all prospects based on the query
433 433
 
434 434
     $subpanel = new SubPanelTiles($parent, $parent->module_dir);
435
-    $thisPanel=$subpanel->subpanel_definitions->load_subpanel($query_panel);
436
-    if(empty($thisPanel)) {
435
+    $thisPanel = $subpanel->subpanel_definitions->load_subpanel($query_panel);
436
+    if (empty($thisPanel)) {
437 437
         return false;
438 438
     }
439 439
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
         $thisPanel->_instance_properties['function_parameters']['EMAIL_MARKETING_ID_VALUE'] = $_REQUEST['marketing_id'];
444 444
     }
445 445
 
446
-    $result = SugarBean::get_union_related_list($parent, '', '', '', 0, -99,-99,'', $thisPanel);
446
+    $result = SugarBean::get_union_related_list($parent, '', '', '', 0, -99, -99, '', $thisPanel);
447 447
 
448
-    if(!empty($result['list'])) {
449
-        foreach($result['list'] as $object) {
448
+    if (!empty($result['list'])) {
449
+        foreach ($result['list'] as $object) {
450 450
             if ($link_type != 'default') {
451
-                $relationship_attribute=strtolower($object->$link_attribute);
451
+                $relationship_attribute = strtolower($object->$link_attribute);
452 452
             }
453 453
             $GLOBALS['log']->debug('add_prospects_to_prospect_list:relationship_attribute:'.$relationship_attribute);
454 454
             // load relationship for the first time or on change of relationship atribute.
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 }
463 463
 
464 464
 //Link rows returned by a report to parent record.
465
-function save_from_report($report_id,$parent_id, $module_name, $relationship_attr_name) {
465
+function save_from_report($report_id, $parent_id, $module_name, $relationship_attr_name) {
466 466
     global $beanFiles;
467 467
     global $beanList;
468 468
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     $GLOBALS['log']->debug("Save2:Module Name=".$module_name);
473 473
     $GLOBALS['log']->debug("Save2:Relationship Attribute Name=".$relationship_attr_name);
474 474
 
475
-    $GLOBALS['log']->debug("Save2:Bean Name=" . $module_name);
475
+    $GLOBALS['log']->debug("Save2:Bean Name=".$module_name);
476 476
     $focus = BeanFactory::newBean($module_name);
477 477
 
478 478
     $focus->retrieve($parent_id);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     //fetch report definition.
482 482
     global $current_language, $report_modules, $modules_report;
483 483
 
484
-    $mod_strings = return_module_language($current_language,"Reports");
484
+    $mod_strings = return_module_language($current_language, "Reports");
485 485
 
486 486
 
487 487
     $saved = new SavedReport();
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     $result = $report->db->query($sql);
499 499
 
500 500
     $reportBean = BeanFactory::newBean($saved->module);
501
-    while($row = $report->db->fetchByAssoc($result))
501
+    while ($row = $report->db->fetchByAssoc($result))
502 502
     {
503 503
         $reportBean->id = $row['primaryid'];
504 504
         $focus->$relationship_attr_name->add($reportBean);
Please login to merge, or discard this patch.
include/utils.php 1 patch
Spacing   +688 added lines, -688 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	// assumes the following variables must be set:
106 106
 	// $dbconfig, $dbconfigoption, $cache_dir,  $session_dir, $site_URL, $upload_dir
107 107
 
108
-	$sugar_config = array (
108
+	$sugar_config = array(
109 109
 	'admin_export_only' => empty($admin_export_only) ? false : $admin_export_only,
110 110
 	'export_delimiter' => empty($export_delimiter) ? ',' : $export_delimiter,
111 111
 	'cache_dir' => empty($cache_dir) ? 'cache/' : $cache_dir,
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	'd.m.Y' => '23.12.2010',
124 124
 	'm.d.Y' => '12.23.2010'
125 125
 		) : $dateFormats,
126
-	'dbconfig' => $dbconfig,  // this must be set!!
127
-	'dbconfigoption' => $dbconfigoption,  // this must be set!!
126
+	'dbconfig' => $dbconfig, // this must be set!!
127
+	'dbconfigoption' => $dbconfigoption, // this must be set!!
128 128
 	'default_action' => empty($default_action) ? 'index' : $default_action,
129 129
 	'default_charset' => empty($default_charset) ? 'UTF-8' : $default_charset,
130 130
 	'default_currency_name' => empty($default_currency_name) ? 'US Dollar' : $default_currency_name,
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	'default_language' => empty($default_language) ? 'en_us' : $default_language,
137 137
 	'default_module' => empty($default_module) ? 'Home' : $default_module,
138 138
 	'default_password' => empty($default_password) ? '' : $default_password,
139
-	'default_permissions' => array (
139
+	'default_permissions' => array(
140 140
 		'dir_mode' => 02770,
141 141
 		'file_mode' => 0755,
142 142
 		'chown' => '',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	'display_inbound_email_buttons' => empty($display_inbound_email_buttons) ? false : $display_inbound_email_buttons,
153 153
 	'history_max_viewed' => empty($history_max_viewed) ? 50 : $history_max_viewed,
154 154
 	'host_name' => empty($host_name) ? 'localhost' : $host_name,
155
-	'import_dir' => $import_dir,  // this must be set!!
155
+	'import_dir' => $import_dir, // this must be set!!
156 156
 	'import_max_records_per_file' => 100,
157 157
     'import_max_records_total_limit' => '',
158 158
 	'languages' => empty($languages) ? array('en_us' => 'English (US)') : $languages,
@@ -165,34 +165,34 @@  discard block
 block discarded – undo
165 165
         'l, f' => 'l, f', 's l, f' => 's l, f', 'l s f' => 'l s f', 'l f s' => 'l f s'
166 166
     ) : $nameFormats,
167 167
     'portal_view' => 'single_user',
168
-	'resource_management' => array (
168
+	'resource_management' => array(
169 169
 	    'special_query_limit' => 50000,
170 170
 	    'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'),
171 171
 	    'default_limit' => 1000,
172 172
     ),
173 173
 	'require_accounts' => empty($requireAccounts) ? true : $requireAccounts,
174 174
 	'rss_cache_time' => empty($RSS_CACHE_TIME) ? '10800' : $RSS_CACHE_TIME,
175
-	'session_dir' => $session_dir,  // this must be set!!
176
-	'site_url' => empty($site_URL) ? $site_url : $site_URL,  // this must be set!!
175
+	'session_dir' => $session_dir, // this must be set!!
176
+	'site_url' => empty($site_URL) ? $site_url : $site_URL, // this must be set!!
177 177
 	'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable
178 178
 	'showThemePicker' => true,
179 179
 	'sugar_version' => empty($sugar_version) ? 'unknown' : $sugar_version,
180
-	'time_formats' => empty($timeFormats) ? array (
180
+	'time_formats' => empty($timeFormats) ? array(
181 181
 	'H:i'=>'23:00', 'h:ia'=>'11:00 pm', 'h:iA'=>'11:00PM',
182 182
 	'H.i'=>'23.00', 'h.ia'=>'11.00 pm', 'h.iA'=>'11.00PM' ) : $timeFormats,
183
-	'tmp_dir' => $tmp_dir,  // this must be set!!
183
+	'tmp_dir' => $tmp_dir, // this must be set!!
184 184
 	'translation_string_prefix' => empty($translation_string_prefix) ? false : $translation_string_prefix,
185 185
 	'unique_key' => empty($unique_key) ? md5(create_guid()) : $unique_key,
186
-	'upload_badext' => empty($upload_badext) ? array (
186
+	'upload_badext' => empty($upload_badext) ? array(
187 187
 	'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py',
188 188
 	'asp', 'cfm', 'js', 'vbs', 'html', 'htm' ) : $upload_badext,
189
-	'upload_dir' => $upload_dir,  // this must be set!!
189
+	'upload_dir' => $upload_dir, // this must be set!!
190 190
 	'upload_maxsize' => empty($upload_maxsize) ? 30000000 : $upload_maxsize,
191 191
 	'import_max_execution_time' => empty($import_max_execution_time) ? 3600 : $import_max_execution_time,
192 192
 	'lock_homepage' => false,
193 193
 	'lock_subpanels' => false,
194 194
 	'max_dashlets_homepage' => 15,
195
-	'dashlet_display_row_options' => array('1','3','5','10'),
195
+	'dashlet_display_row_options' => array('1', '3', '5', '10'),
196 196
 	'default_max_tabs' => empty($max_tabs) ? '7' : $max_tabs,
197 197
 	'default_subpanel_tabs' =>  empty($subpanel_tabs) ? true : $subpanel_tabs,
198 198
 	'default_subpanel_links' => empty($subpanel_links) ? false : $subpanel_links,
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm,
202 202
     'default_call_status' => 'Planned',
203 203
 	'js_lang_version' => 1,
204
-	'passwordsetting' => empty($passwordsetting) ? array (
204
+	'passwordsetting' => empty($passwordsetting) ? array(
205 205
 	    'SystemGeneratedPasswordON' => '',
206 206
 	    'generatepasswordtmpl' => '',
207 207
 	    'lostpasswordtmpl' => '',
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * sugar_config_union
241 241
 	 */
242 242
 
243
-	$sugar_config_defaults = array (
243
+	$sugar_config_defaults = array(
244 244
 	'admin_export_only' => false,
245 245
 	'export_delimiter' => ',',
246 246
 	'export_excel_compatible' => false,
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
 	'calculate_response_time' => true,
249 249
 	'create_default_user' => false,
250 250
  	'chartEngine' => 'Jit',
251
-	'date_formats' => array (
251
+	'date_formats' => array(
252 252
 	'Y-m-d' => '2010-12-23', 'm-d-Y' => '12-23-2010', 'd-m-Y' => '23-12-2010',
253 253
 	'Y/m/d' => '2010/12/23', 'm/d/Y' => '12/23/2010', 'd/m/Y' => '23/12/2010',
254 254
 	'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010',),
255
-    'name_formats' => array (
255
+    'name_formats' => array(
256 256
         's f l' => 's f l', 'f l' => 'f l', 's l' => 's l', 'l, s f' => 'l, s f',
257 257
         'l, f' => 'l, f', 's l, f' => 's l, f', 'l s f' => 'l s f', 'l f s' => 'l f s'
258 258
     ),
259
-	'dbconfigoption' => array (
259
+	'dbconfigoption' => array(
260 260
 	'persistent' => true,
261 261
 	'autofree' => false,
262 262
 	'debug' => 0,
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	'en_us'),
278 278
 	'default_module' => 'Home',
279 279
 	'default_password' => '',
280
-	'default_permissions' => array (
280
+	'default_permissions' => array(
281 281
 		'dir_mode' => 02770,
282 282
 		'file_mode' => 0755,
283 283
 		'user' => '',
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	'lock_default_user_name' => false,
310 310
 	'log_memory_usage' => false,
311 311
 	'portal_view' => 'single_user',
312
-    'resource_management' => array (
312
+    'resource_management' => array(
313 313
 	    'special_query_limit' => 50000,
314 314
 	    'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'),
315 315
 	    'default_limit' => 1000,
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 	'showThemePicker' => true,
323 323
 	'slow_query_time_msec' => '100',
324 324
     'sugarbeet' => true,
325
-    'time_formats' => array (
325
+    'time_formats' => array(
326 326
         'H:i'=>'23:00', 'h:ia'=>'11:00pm', 'h:iA'=>'11:00PM', 'h:i a'=>'11:00 pm', 'h:i A'=>'11:00 PM',
327 327
         'H.i'=>'23.00', 'h.ia'=>'11.00pm', 'h.iA'=>'11.00PM', 'h.i a'=>'11.00 pm', 'h.i A'=>'11.00 PM' ),
328 328
     'tracker_max_display_length' => 15,
329 329
 	'translation_string_prefix' =>
330 330
 	return_session_value_or_default('translation_string_prefix', false),
331
-	'upload_badext' => array (
331
+	'upload_badext' => array(
332 332
 	'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py',
333 333
 	'asp', 'cfm', 'js', 'vbs', 'html', 'htm', 'phtml' ),
334 334
 	'upload_maxsize' => 30000000,
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	'lock_subpanels' => false,
345 345
 	'max_dashlets_homepage' => '15',
346 346
 	'default_max_tabs' => '7',
347
-	'dashlet_display_row_options' => array('1','3','5','10'),
347
+	'dashlet_display_row_options' => array('1', '3', '5', '10'),
348 348
 	'default_subpanel_tabs' =>  true,
349 349
 	'default_subpanel_links' => false,
350 350
 	'default_swap_last_viewed' => false,
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	  'enable_repeat' => true,
369 369
 	  'max_repeat_count' => 1000,
370 370
 	),
371
-	'passwordsetting' => empty($passwordsetting) ? array (
371
+	'passwordsetting' => empty($passwordsetting) ? array(
372 372
 	    'SystemGeneratedPasswordON' => '',
373 373
 	    'generatepasswordtmpl' => '',
374 374
 	    'lostpasswordtmpl' => '',
@@ -397,31 +397,31 @@  discard block
 block discarded – undo
397 397
 		),
398 398
     );
399 399
 
400
-	if(!is_object($locale)) {
400
+	if (!is_object($locale)) {
401 401
 		$locale = new Localization();
402 402
 	}
403 403
 
404 404
 	$sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies();
405 405
 
406 406
 	$sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults);
407
-	return( $sugar_config_defaults );
407
+	return($sugar_config_defaults);
408 408
 }
409 409
 
410 410
 /**
411 411
  * @deprecated use SugarView::getMenu() instead
412 412
  */
413
-function load_menu($path){
413
+function load_menu($path) {
414 414
 	global $module_menu;
415 415
 
416
-	if(file_exists($path . 'Menu.php'))
416
+	if (file_exists($path.'Menu.php'))
417 417
 	{
418
-		require($path . 'Menu.php');
418
+		require($path.'Menu.php');
419 419
 	}
420
-	if(file_exists('custom/' . $path . 'Ext/Menus/menu.ext.php'))
420
+	if (file_exists('custom/'.$path.'Ext/Menus/menu.ext.php'))
421 421
 	{
422
-		require('custom/' . $path . 'Ext/Menus/menu.ext.php');
422
+		require('custom/'.$path.'Ext/Menus/menu.ext.php');
423 423
 	}
424
-	if(file_exists('custom/application/Ext/Menus/menu.ext.php'))
424
+	if (file_exists('custom/application/Ext/Menus/menu.ext.php'))
425 425
 	{
426 426
 		require('custom/application/Ext/Menus/menu.ext.php');
427 427
 	}
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
  *
435 435
  * @return string relative file path to email notifications template file
436 436
  */
437
-function get_notify_template_file($language){
437
+function get_notify_template_file($language) {
438 438
 	/*
439 439
 	 * Order of operation:
440 440
 	 * 1) custom version of specified language
@@ -446,43 +446,43 @@  discard block
 block discarded – undo
446 446
 	// set $file to the base code template so it's set if none of the conditions pass
447 447
 	$file = "include/language/en_us.notify_template.html";
448 448
 
449
-	if(file_exists("custom/include/language/{$language}.notify_template.html")){
449
+	if (file_exists("custom/include/language/{$language}.notify_template.html")) {
450 450
 		$file = "custom/include/language/{$language}.notify_template.html";
451 451
 	}
452
-	else if(file_exists("include/language/{$language}.notify_template.html")){
452
+	else if (file_exists("include/language/{$language}.notify_template.html")) {
453 453
 		$file = "include/language/{$language}.notify_template.html";
454 454
 	}
455
-	else if(file_exists("custom/include/language/en_us.notify_template.html")){
455
+	else if (file_exists("custom/include/language/en_us.notify_template.html")) {
456 456
 		$file = "custom/include/language/en_us.notify_template.html";
457 457
 	}
458 458
 
459 459
 	return $file;
460 460
 }
461 461
 
462
-function sugar_config_union( $default, $override ){
462
+function sugar_config_union($default, $override) {
463 463
 	// a little different then array_merge and array_merge_recursive.  we want
464 464
 	// the second array to override the first array if the same value exists,
465 465
 	// otherwise merge the unique keys.  it handles arrays of arrays recursively
466 466
 	// might be suitable for a generic array_union
467
-	if( !is_array( $override ) ){
467
+	if (!is_array($override)) {
468 468
 		$override = array();
469 469
 	}
470
-	foreach( $default as $key => $value ){
471
-		if( !array_key_exists($key, $override) ){
470
+	foreach ($default as $key => $value) {
471
+		if (!array_key_exists($key, $override)) {
472 472
 			$override[$key] = $value;
473 473
 		}
474
-		else if( is_array( $key ) ){
475
-			$override[$key] = sugar_config_union( $value, $override[$key] );
474
+		else if (is_array($key)) {
475
+			$override[$key] = sugar_config_union($value, $override[$key]);
476 476
 		}
477 477
 	}
478
-	return( $override );
478
+	return($override);
479 479
 }
480 480
 
481
-function make_not_writable( $file ){
481
+function make_not_writable($file) {
482 482
 	// Returns true if the given file/dir has been made not writable
483 483
 	$ret_val = false;
484
-	if( is_file($file) || is_dir($file) ){
485
-		if( !is_writable($file) ){
484
+	if (is_file($file) || is_dir($file)) {
485
+		if (!is_writable($file)) {
486 486
 			$ret_val = true;
487 487
 		}
488 488
 		else {
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 			$new_fileperms = $original_fileperms & ~0x0092;
493 493
 			@sugar_chmod($file, $new_fileperms);
494 494
 
495
-			if( !is_writable($file) ){
495
+			if (!is_writable($file)) {
496 496
 				$ret_val = true;
497 497
 			}
498 498
 		}
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 	$last_name = "";
516 516
 	$full_name = "";
517 517
 
518
-	if(isset($row[$first_column]))
518
+	if (isset($row[$first_column]))
519 519
 	{
520 520
 		$first_name = stripslashes($row[$first_column]);
521 521
 	}
522 522
 
523
-	if(isset($row[$last_column]))
523
+	if (isset($row[$last_column]))
524 524
 	{
525 525
 		$last_name = stripslashes($row[$last_column]);
526 526
 	}
@@ -528,13 +528,13 @@  discard block
 block discarded – undo
528 528
 	$full_name = $first_name;
529 529
 
530 530
 	// If we have a first name and we have a last name
531
-	if($full_name != "" && $last_name != "")
531
+	if ($full_name != "" && $last_name != "")
532 532
 	{
533 533
 		// append a space, then the last name
534 534
 		$full_name .= " ".$last_name;
535 535
 	}
536 536
 	// If we have no first name, but we have a last name
537
-	else if($last_name != "")
537
+	else if ($last_name != "")
538 538
 	{
539 539
 		// append the last name without the space.
540 540
 		$full_name .= $last_name;
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 {
549 549
 	global $sugar_config;
550 550
 	$lang = $sugar_config['languages'];
551
-    if(!empty($sugar_config['disabled_languages'])){
552
-        foreach(explode(',', $sugar_config['disabled_languages']) as $disable) {
551
+    if (!empty($sugar_config['disabled_languages'])) {
552
+        foreach (explode(',', $sugar_config['disabled_languages']) as $disable) {
553 553
             unset($lang[$disable]);
554 554
         }
555 555
     }
@@ -572,11 +572,11 @@  discard block
 block discarded – undo
572 572
 function get_assigned_user_name($assigned_user_id, $is_group = '') {
573 573
 	static $saved_user_list = null;
574 574
 
575
-	if(empty($saved_user_list)) {
575
+	if (empty($saved_user_list)) {
576 576
 		$saved_user_list = get_user_array(false, '', '', false, null, $is_group);
577 577
 	}
578 578
 
579
-	if(isset($saved_user_list[$assigned_user_id])) {
579
+	if (isset($saved_user_list[$assigned_user_id])) {
580 580
 		return $saved_user_list[$assigned_user_id];
581 581
 	}
582 582
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 function get_user_name($id) {
592 592
 	global $db;
593 593
 
594
-	if(empty($db))
594
+	if (empty($db))
595 595
 	$db = DBManagerFactory::getInstance();
596 596
 
597 597
 	$q = "SELECT user_name FROM users WHERE id='{$id}'";
@@ -619,19 +619,19 @@  discard block
 block discarded – undo
619 619
  * @param bool $from_cache Boolean value indicating whether or not to use the get_register_value function for caching, true by default
620 620
  * @return array Array of users matching the filter criteria that may be from cache (if similar search was previously run)
621 621
  */
622
-function get_user_array($add_blank=true, $status="Active", $user_id='', $use_real_name=false, $user_name_filter='', $portal_filter=' AND portal_only=0 ', $from_cache = true) {
622
+function get_user_array($add_blank = true, $status = "Active", $user_id = '', $use_real_name = false, $user_name_filter = '', $portal_filter = ' AND portal_only=0 ', $from_cache = true) {
623 623
 	global $locale, $sugar_config, $current_user;
624 624
 
625
-	if(empty($locale)) {
625
+	if (empty($locale)) {
626 626
 		$locale = new Localization();
627 627
 	}
628 628
 
629
-	if($from_cache) {
630
-        $key_name = $add_blank. $status . $user_id . $use_real_name . $user_name_filter . $portal_filter;
629
+	if ($from_cache) {
630
+        $key_name = $add_blank.$status.$user_id.$use_real_name.$user_name_filter.$portal_filter;
631 631
 		$user_array = get_register_value('user_array', $key_name);
632 632
     }
633 633
 
634
-	if(empty($user_array)) {
634
+	if (empty($user_array)) {
635 635
 		$db = DBManagerFactory::getInstance();
636 636
 		$temp_result = Array();
637 637
 		// Including deleted users for now.
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 		}
644 644
         /* BEGIN - SECURITY GROUPS */
645 645
         global $current_user, $sugar_config;
646
-        if(!is_admin($current_user)
646
+        if (!is_admin($current_user)
647 647
             && isset($sugar_config['securitysuite_filter_user_list'])
648 648
             && $sugar_config['securitysuite_filter_user_list'] == true
649 649
             && (empty($_REQUEST['module']) || $_REQUEST['module'] != 'Home')
@@ -664,21 +664,21 @@  discard block
 block discarded – undo
664 664
 		}
665 665
 
666 666
         //get the user preference for name formatting, to be used in order by
667
-        $order_by_string =' user_name ASC ';
668
-        if(!empty($current_user) && !empty($current_user->id))
667
+        $order_by_string = ' user_name ASC ';
668
+        if (!empty($current_user) && !empty($current_user->id))
669 669
         {
670 670
             $formatString = $current_user->getPreference('default_locale_name_format');
671 671
 
672 672
             //create the order by string based on position of first and last name in format string
673
-            $order_by_string =' user_name ASC ';
674
-            $firstNamePos = strpos( $formatString, 'f');
675
-            $lastNamePos = strpos( $formatString, 'l');
676
-            if($firstNamePos !== false || $lastNamePos !== false){
673
+            $order_by_string = ' user_name ASC ';
674
+            $firstNamePos = strpos($formatString, 'f');
675
+            $lastNamePos = strpos($formatString, 'l');
676
+            if ($firstNamePos !== false || $lastNamePos !== false) {
677 677
                 //its possible for first name to be skipped, check for this
678
-                if($firstNamePos===false){
679
-                    $order_by_string =  'last_name ASC';
680
-                }else{
681
-                    $order_by_string =  ($lastNamePos < $firstNamePos) ? "last_name, first_name ASC" : "first_name, last_name ASC";
678
+                if ($firstNamePos === false) {
679
+                    $order_by_string = 'last_name ASC';
680
+                } else {
681
+                    $order_by_string = ($lastNamePos < $firstNamePos) ? "last_name, first_name ASC" : "first_name, last_name ASC";
682 682
                 }
683 683
             }
684 684
         }
@@ -687,16 +687,16 @@  discard block
 block discarded – undo
687 687
 		$GLOBALS['log']->debug("get_user_array query: $query");
688 688
 		$result = $db->query($query, true, "Error filling in user array: ");
689 689
 
690
-		if ($add_blank==true) {
690
+		if ($add_blank == true) {
691 691
 			// Add in a blank row
692 692
 			$temp_result[''] = '';
693 693
 		}
694 694
 
695 695
 		// Get the id and the name.
696
-		while($row = $db->fetchByAssoc($result)) {
697
-			if($use_real_name == true || showFullName()) {
698
-				if(isset($row['last_name'])) { // cn: we will ALWAYS have both first_name and last_name (empty value if blank in db)
699
-					$temp_result[$row['id']] = $locale->getLocaleFormattedName($row['first_name'],$row['last_name']);
696
+		while ($row = $db->fetchByAssoc($result)) {
697
+			if ($use_real_name == true || showFullName()) {
698
+				if (isset($row['last_name'])) { // cn: we will ALWAYS have both first_name and last_name (empty value if blank in db)
699
+					$temp_result[$row['id']] = $locale->getLocaleFormattedName($row['first_name'], $row['last_name']);
700 700
 				} else {
701 701
 					$temp_result[$row['id']] = $row['user_name'];
702 702
 				}
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 
708 708
 		$user_array = $temp_result;
709
-		if($from_cache)
709
+		if ($from_cache)
710 710
         {
711 711
 			set_register_value('user_array', $key_name, $temp_result);
712 712
         }
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
             $inClauses[] = "(first_name LIKE '{$arg}%' OR last_name LIKE '{$arg}%')";
747 747
         }
748 748
 
749
-        $inClause = '(' . implode('OR ', $inClauses) . ')';
749
+        $inClause = '('.implode('OR ', $inClauses).')';
750 750
 
751 751
     } else {
752 752
         $args = $db->quote($args);
@@ -754,14 +754,14 @@  discard block
 block discarded – undo
754 754
     }
755 755
     // ~jmorais@dri
756 756
 
757
-	$query  = "SELECT id, first_name, last_name, user_name FROM users WHERE status='Active' AND deleted=0 AND ";
758
-	if ( $hide_portal_users ) {
757
+	$query = "SELECT id, first_name, last_name, user_name FROM users WHERE status='Active' AND deleted=0 AND ";
758
+	if ($hide_portal_users) {
759 759
 	    $query .= " portal_only=0 AND ";
760 760
 	}
761 761
 	$query .= $inClause;
762 762
     /* BEGIN - SECURITY GROUPS */
763 763
     global $current_user, $sugar_config;
764
-    if(!is_admin($current_user)
764
+    if (!is_admin($current_user)
765 765
         && isset($sugar_config['securitysuite_filter_user_list'])
766 766
         && $sugar_config['securitysuite_filter_user_list'] == true
767 767
     ) {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
 	$r = $db->query($query);
777 777
 	$ret = array();
778
-	while($a = $db->fetchByAssoc($r)) {
778
+	while ($a = $db->fetchByAssoc($r)) {
779 779
 		$ret[$a['id']] = $locale->getLocaleFormattedName($a['first_name'], $a['last_name']);
780 780
 	}
781 781
 
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		$sysPref = !empty($sugar_config['use_real_names']);
796 796
 		$userPref = (is_object($current_user)) ? $current_user->getPreference('use_real_names') : null;
797 797
 
798
-		if($userPref != null) {
798
+		if ($userPref != null) {
799 799
 			$showFullName = ($userPref == 'on');
800 800
 		} else {
801 801
 			$showFullName = $sysPref;
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 
854 854
 	// Check for cached value
855 855
 	$cache_entry = sugar_cache_retrieve($cache_key);
856
-	if(!empty($cache_entry))
856
+	if (!empty($cache_entry))
857 857
 	{
858 858
 		return $cache_entry;
859 859
 	}
@@ -872,17 +872,17 @@  discard block
 block discarded – undo
872 872
 
873 873
 	$app_list_strings_array = array();
874 874
 
875
-	foreach ( $langs as $lang ) {
875
+	foreach ($langs as $lang) {
876 876
 	    $app_list_strings = array();
877
-	    if(file_exists("include/language/$lang.lang.php")) {
877
+	    if (file_exists("include/language/$lang.lang.php")) {
878 878
             include("include/language/$lang.lang.php");
879 879
             $GLOBALS['log']->info("Found language file: $lang.lang.php");
880 880
         }
881
-        if(file_exists("include/language/$lang.lang.override.php")) {
881
+        if (file_exists("include/language/$lang.lang.override.php")) {
882 882
             include("include/language/$lang.lang.override.php");
883 883
             $GLOBALS['log']->info("Found override language file: $lang.lang.override.php");
884 884
         }
885
-        if(file_exists("include/language/$lang.lang.php.override")) {
885
+        if (file_exists("include/language/$lang.lang.php.override")) {
886 886
             include("include/language/$lang.lang.php.override");
887 887
             $GLOBALS['log']->info("Found override language file: $lang.lang.php.override");
888 888
         }
@@ -891,22 +891,22 @@  discard block
 block discarded – undo
891 891
     }
892 892
 
893 893
     $app_list_strings = array();
894
-    foreach ( $app_list_strings_array as $app_list_strings_item ) {
894
+    foreach ($app_list_strings_array as $app_list_strings_item) {
895 895
         $app_list_strings = sugarLangArrayMerge($app_list_strings, $app_list_strings_item);
896 896
     }
897 897
 
898
-    foreach ( $langs as $lang ) {
899
-        if(file_exists("custom/application/Ext/Language/$lang.lang.ext.php")) {
900
-            $app_list_strings = _mergeCustomAppListStrings("custom/application/Ext/Language/$lang.lang.ext.php" , $app_list_strings);
898
+    foreach ($langs as $lang) {
899
+        if (file_exists("custom/application/Ext/Language/$lang.lang.ext.php")) {
900
+            $app_list_strings = _mergeCustomAppListStrings("custom/application/Ext/Language/$lang.lang.ext.php", $app_list_strings);
901 901
             $GLOBALS['log']->info("Found extended language file: $lang.lang.ext.php");
902 902
         }
903
-        if(file_exists("custom/include/language/$lang.lang.php")) {
903
+        if (file_exists("custom/include/language/$lang.lang.php")) {
904 904
             include("custom/include/language/$lang.lang.php");
905 905
             $GLOBALS['log']->info("Found custom language file: $lang.lang.php");
906 906
         }
907 907
     }
908 908
 
909
-	if(!isset($app_list_strings)) {
909
+	if (!isset($app_list_strings)) {
910 910
 		$GLOBALS['log']->fatal("Unable to load the application language file for the selected language ($language) or the default language ($default_language) or the en_us language");
911 911
 		return null;
912 912
 	}
@@ -927,14 +927,14 @@  discard block
 block discarded – undo
927 927
  * @return array
928 928
  */
929 929
  //jchi 25347
930
-function _mergeCustomAppListStrings($file , $app_list_strings){
930
+function _mergeCustomAppListStrings($file, $app_list_strings) {
931 931
 	$app_list_strings_original = $app_list_strings;
932 932
 	unset($app_list_strings);
933 933
         // FG - bug 45525 - $exemptDropdown array is defined (once) here, not inside the foreach
934 934
         //                  This way, language file can add items to save specific standard codelist from being overwritten
935 935
         $exemptDropdowns = array();
936 936
 	include($file);
937
-	if(!isset($app_list_strings) || !is_array($app_list_strings)){
937
+	if (!isset($app_list_strings) || !is_array($app_list_strings)) {
938 938
 		return $app_list_strings_original;
939 939
 	}
940 940
 	//Bug 25347: We should not merge custom dropdown fields unless they relate to parent fields or the module list.
@@ -944,14 +944,14 @@  discard block
 block discarded – undo
944 944
 	$exemptDropdowns[] = "moduleListSingular";
945 945
         $exemptDropdowns = array_merge($exemptDropdowns, getTypeDisplayList());
946 946
 
947
-	foreach($app_list_strings as $key=>$value)
947
+	foreach ($app_list_strings as $key=>$value)
948 948
 	{
949 949
 		if (!in_array($key, $exemptDropdowns) && array_key_exists($key, $app_list_strings_original))
950 950
 		{
951 951
 	   		unset($app_list_strings_original["$key"]);
952 952
 		}
953 953
    }
954
-   $app_list_strings = sugarArrayMergeRecursive($app_list_strings_original , $app_list_strings);
954
+   $app_list_strings = sugarArrayMergeRecursive($app_list_strings_original, $app_list_strings);
955 955
    return $app_list_strings;
956 956
 }
957 957
 
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 
970 970
 	// Check for cached value
971 971
 	$cache_entry = sugar_cache_retrieve($cache_key);
972
-	if(!empty($cache_entry))
972
+	if (!empty($cache_entry))
973 973
 	{
974 974
 		return $cache_entry;
975 975
 	}
@@ -989,25 +989,25 @@  discard block
 block discarded – undo
989 989
 
990 990
 	$app_strings_array = array();
991 991
 
992
-	foreach ( $langs as $lang ) {
992
+	foreach ($langs as $lang) {
993 993
 	    $app_strings = array();
994
-	    if(file_exists("include/language/$lang.lang.php")) {
994
+	    if (file_exists("include/language/$lang.lang.php")) {
995 995
             include("include/language/$lang.lang.php");
996 996
             $GLOBALS['log']->info("Found language file: $lang.lang.php");
997 997
         }
998
-        if(file_exists("include/language/$lang.lang.override.php")) {
998
+        if (file_exists("include/language/$lang.lang.override.php")) {
999 999
             include("include/language/$lang.lang.override.php");
1000 1000
             $GLOBALS['log']->info("Found override language file: $lang.lang.override.php");
1001 1001
         }
1002
-        if(file_exists("include/language/$lang.lang.php.override")) {
1002
+        if (file_exists("include/language/$lang.lang.php.override")) {
1003 1003
             include("include/language/$lang.lang.php.override");
1004 1004
             $GLOBALS['log']->info("Found override language file: $lang.lang.php.override");
1005 1005
         }
1006
-        if(file_exists("custom/application/Ext/Language/$lang.lang.ext.php")) {
1006
+        if (file_exists("custom/application/Ext/Language/$lang.lang.ext.php")) {
1007 1007
             include("custom/application/Ext/Language/$lang.lang.ext.php");
1008 1008
             $GLOBALS['log']->info("Found extended language file: $lang.lang.ext.php");
1009 1009
         }
1010
-        if(file_exists("custom/include/language/$lang.lang.php")) {
1010
+        if (file_exists("custom/include/language/$lang.lang.php")) {
1011 1011
             include("custom/include/language/$lang.lang.php");
1012 1012
             $GLOBALS['log']->info("Found custom language file: $lang.lang.php");
1013 1013
         }
@@ -1015,23 +1015,23 @@  discard block
 block discarded – undo
1015 1015
 	}
1016 1016
 
1017 1017
 	$app_strings = array();
1018
-    foreach ( $app_strings_array as $app_strings_item ) {
1018
+    foreach ($app_strings_array as $app_strings_item) {
1019 1019
         $app_strings = sugarLangArrayMerge($app_strings, $app_strings_item);
1020 1020
     }
1021 1021
 
1022
-	if(!isset($app_strings)) {
1022
+	if (!isset($app_strings)) {
1023 1023
 		$GLOBALS['log']->fatal("Unable to load the application language strings");
1024 1024
 		return null;
1025 1025
 	}
1026 1026
 
1027 1027
 	// If we are in debug mode for translating, turn on the prefix now!
1028
-    if(!empty($sugar_config['translation_string_prefix']))
1028
+    if (!empty($sugar_config['translation_string_prefix']))
1029 1029
     {
1030
-		foreach($app_strings as $entry_key=>$entry_value) {
1030
+		foreach ($app_strings as $entry_key=>$entry_value) {
1031 1031
 			$app_strings[$entry_key] = $language.' '.$entry_value;
1032 1032
 		}
1033 1033
 	}
1034
-	if(isset($_SESSION['show_deleted'])) {
1034
+	if (isset($_SESSION['show_deleted'])) {
1035 1035
 		$app_strings['LBL_DELETE_BUTTON'] = $app_strings['LBL_UNDELETE_BUTTON'];
1036 1036
 		$app_strings['LBL_DELETE_BUTTON_LABEL'] = $app_strings['LBL_UNDELETE_BUTTON_LABEL'];
1037 1037
 		$app_strings['LBL_DELETE_BUTTON_TITLE'] = $app_strings['LBL_UNDELETE_BUTTON_TITLE'];
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
  * @param bool $refresh optional, true if you want to rebuild the language strings
1057 1057
  * @return array lang strings
1058 1058
  */
1059
-function return_module_language($language, $module, $refresh=false)
1059
+function return_module_language($language, $module, $refresh = false)
1060 1060
 {
1061 1061
 	global $mod_strings;
1062 1062
 	global $sugar_config;
@@ -1064,17 +1064,17 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
 	// Jenny - Bug 8119: Need to check if $module is not empty
1066 1066
 	if (empty($module)) {
1067
-		$stack  = debug_backtrace();
1068
-		$GLOBALS['log']->warn("Variable module is not in return_module_language ". var_export($stack, true));
1067
+		$stack = debug_backtrace();
1068
+		$GLOBALS['log']->warn("Variable module is not in return_module_language ".var_export($stack, true));
1069 1069
 		return array();
1070 1070
 	}
1071 1071
 
1072
-    if( !$refresh )
1072
+    if (!$refresh)
1073 1073
     {
1074 1074
         $cache_key = LanguageManager::getLanguageCacheKey($module, $language);
1075 1075
         // Check for cached value
1076 1076
         $cache_entry = sugar_cache_retrieve($cache_key);
1077
-        if(!empty($cache_entry) && is_array($cache_entry))
1077
+        if (!empty($cache_entry) && is_array($cache_entry))
1078 1078
         {
1079 1079
             return $cache_entry;
1080 1080
         }
@@ -1085,43 +1085,43 @@  discard block
 block discarded – undo
1085 1085
 	$language_used = $language;
1086 1086
 	$default_language = $sugar_config['default_language'];
1087 1087
 
1088
-	if(empty($language)) {
1088
+	if (empty($language)) {
1089 1089
 		$language = $default_language;
1090 1090
 	}
1091 1091
 
1092 1092
 	// Bug 21559 - So we can get all the strings defined in the template, refresh
1093 1093
 	// the vardefs file if the cached language file doesn't exist.
1094
-    if(!file_exists(sugar_cached('modules/'). $module . '/language/'.$language.'.lang.php')
1095
-			&& !empty($GLOBALS['beanList'][$module])){
1094
+    if (!file_exists(sugar_cached('modules/').$module.'/language/'.$language.'.lang.php')
1095
+			&& !empty($GLOBALS['beanList'][$module])) {
1096 1096
 		$object = BeanFactory::getObjectName($module);
1097
-		VardefManager::refreshVardefs($module,$object);
1097
+		VardefManager::refreshVardefs($module, $object);
1098 1098
 	}
1099 1099
 
1100
-	$loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh);
1100
+	$loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language, $refresh);
1101 1101
 
1102 1102
 	// cn: bug 6048 - merge en_us with requested language
1103
-	if($language != $sugar_config['default_language'])
1103
+	if ($language != $sugar_config['default_language'])
1104 1104
         $loaded_mod_strings = sugarLangArrayMerge(
1105
-            LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'],$refresh),
1105
+            LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'], $refresh),
1106 1106
                 $loaded_mod_strings
1107 1107
             );
1108 1108
 
1109 1109
     // Load in en_us strings by default
1110
-    if($language != 'en_us' && $sugar_config['default_language'] != 'en_us')
1110
+    if ($language != 'en_us' && $sugar_config['default_language'] != 'en_us')
1111 1111
         $loaded_mod_strings = sugarLangArrayMerge(
1112 1112
             LanguageManager::loadModuleLanguage($module, 'en_us', $refresh),
1113 1113
                 $loaded_mod_strings
1114 1114
             );
1115 1115
 
1116 1116
 	// If we are in debug mode for translating, turn on the prefix now!
1117
-	if($sugar_config['translation_string_prefix']) {
1118
-		foreach($loaded_mod_strings as $entry_key=>$entry_value) {
1117
+	if ($sugar_config['translation_string_prefix']) {
1118
+		foreach ($loaded_mod_strings as $entry_key=>$entry_value) {
1119 1119
 			$loaded_mod_strings[$entry_key] = $language_used.' '.$entry_value;
1120 1120
 		}
1121 1121
 	}
1122 1122
 
1123 1123
 	$return_value = $loaded_mod_strings;
1124
-	if(!isset($mod_strings)){
1124
+	if (!isset($mod_strings)) {
1125 1125
 		$mod_strings = $return_value;
1126 1126
 	}
1127 1127
 	else
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
  * All Rights Reserved.
1139 1139
  * Contributor(s): ______________________________________..
1140 1140
  * If you are using the current language, do not call this function unless you are loading it for the first time */
1141
-function return_mod_list_strings_language($language,$module) {
1141
+function return_mod_list_strings_language($language, $module) {
1142 1142
 	global $mod_list_strings;
1143 1143
 	global $sugar_config;
1144 1144
 	global $currentModule;
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 
1148 1148
 	// Check for cached value
1149 1149
 	$cache_entry = sugar_cache_retrieve($cache_key);
1150
-	if(!empty($cache_entry))
1150
+	if (!empty($cache_entry))
1151 1151
 	{
1152 1152
 		return $cache_entry;
1153 1153
 	}
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 	$temp_mod_list_strings = $mod_list_strings;
1157 1157
 	$default_language = $sugar_config['default_language'];
1158 1158
 
1159
-	if($currentModule == $module && isset($mod_list_strings) && $mod_list_strings != null) {
1159
+	if ($currentModule == $module && isset($mod_list_strings) && $mod_list_strings != null) {
1160 1160
 		return $mod_list_strings;
1161 1161
 	}
1162 1162
 
@@ -1164,19 +1164,19 @@  discard block
 block discarded – undo
1164 1164
 	// cn: bug 6048 - merge en_us with requested language
1165 1165
 	include("modules/$module/language/en_us.lang.php");
1166 1166
 	$en_mod_list_strings = array();
1167
-	if($language_used != $default_language)
1167
+	if ($language_used != $default_language)
1168 1168
 	$en_mod_list_strings = $mod_list_strings;
1169 1169
 
1170
-	if(file_exists("modules/$module/language/$language.lang.php")) {
1170
+	if (file_exists("modules/$module/language/$language.lang.php")) {
1171 1171
 		include("modules/$module/language/$language.lang.php");
1172 1172
 	}
1173 1173
 
1174
-	if(file_exists("modules/$module/language/$language.lang.override.php")){
1174
+	if (file_exists("modules/$module/language/$language.lang.override.php")) {
1175 1175
 		include("modules/$module/language/$language.lang.override.php");
1176 1176
 	}
1177 1177
 
1178
-	if(file_exists("modules/$module/language/$language.lang.php.override")){
1179
-		echo 'Please Change:<br>' . "modules/$module/language/$language.lang.php.override" . '<br>to<br>' . 'Please Change:<br>' . "modules/$module/language/$language.lang.override.php";
1178
+	if (file_exists("modules/$module/language/$language.lang.php.override")) {
1179
+		echo 'Please Change:<br>'."modules/$module/language/$language.lang.php.override".'<br>to<br>'.'Please Change:<br>'."modules/$module/language/$language.lang.override.php";
1180 1180
 		include("modules/$module/language/$language.lang.php.override");
1181 1181
 	}
1182 1182
 
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 	$mod_list_strings = sugarLangArrayMerge($en_mod_list_strings, $mod_list_strings);
1185 1185
 
1186 1186
 	// if we still don't have a language pack, then log an error
1187
-	if(!isset($mod_list_strings)) {
1187
+	if (!isset($mod_list_strings)) {
1188 1188
 		$GLOBALS['log']->fatal("Unable to load the application list language file for the selected language($language) or the default language($default_language) for module({$module})");
1189 1189
 		return null;
1190 1190
 	}
@@ -1210,30 +1210,30 @@  discard block
 block discarded – undo
1210 1210
 	$default_language = $sugar_config['default_language'];
1211 1211
 
1212 1212
 	include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php");
1213
-	if(file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php")){
1213
+	if (file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php")) {
1214 1214
 		include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php");
1215 1215
 	}
1216
-	if(file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override")){
1217
-		echo 'Please Change:<br>' . SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override" . '<br>to<br>' . 'Please Change:<br>' . SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php";
1216
+	if (file_exists(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override")) {
1217
+		echo 'Please Change:<br>'.SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override".'<br>to<br>'.'Please Change:<br>'.SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php";
1218 1218
 		include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override");
1219 1219
 	}
1220
-	if(!isset($theme_strings))
1220
+	if (!isset($theme_strings))
1221 1221
 	{
1222 1222
 		$GLOBALS['log']->warn("Unable to find the theme file for language: ".$language." and theme: ".$theme);
1223 1223
 		require(SugarThemeRegistry::get($theme)->getFilePath()."/language/$default_language.lang.php");
1224 1224
 		$language_used = $default_language;
1225 1225
 	}
1226 1226
 
1227
-	if(!isset($theme_strings))
1227
+	if (!isset($theme_strings))
1228 1228
 	{
1229 1229
 		$GLOBALS['log']->fatal("Unable to load the theme($theme) language file for the selected language($language) or the default language($default_language)");
1230 1230
 		return null;
1231 1231
 	}
1232 1232
 
1233 1233
 	// If we are in debug mode for translating, turn on the prefix now!
1234
-	if($sugar_config['translation_string_prefix'])
1234
+	if ($sugar_config['translation_string_prefix'])
1235 1235
 	{
1236
-		foreach($theme_strings as $entry_key=>$entry_value)
1236
+		foreach ($theme_strings as $entry_key=>$entry_value)
1237 1237
 		{
1238 1238
 			$theme_strings[$entry_key] = $language_used.' '.$entry_value;
1239 1239
 		}
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
  */
1252 1252
 function return_session_value_or_default($varname, $default)
1253 1253
 {
1254
-	if(isset($_SESSION[$varname]) && $_SESSION[$varname] != "")
1254
+	if (isset($_SESSION[$varname]) && $_SESSION[$varname] != "")
1255 1255
 	{
1256 1256
 		return $_SESSION[$varname];
1257 1257
 	}
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
  */
1272 1272
 function append_where_clause(&$where_clauses, $variable_name, $SQL_name = null)
1273 1273
 {
1274
-	if($SQL_name == null)
1274
+	if ($SQL_name == null)
1275 1275
 	{
1276 1276
 		$SQL_name = $variable_name;
1277 1277
 	}
1278 1278
 
1279
-	if(isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "")
1279
+	if (isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "")
1280 1280
 	{
1281 1281
 		array_push($where_clauses, "$SQL_name like '".$GLOBALS['db']->quote($_REQUEST[$variable_name])."%'");
1282 1282
 	}
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
 function generate_where_statement($where_clauses)
1294 1294
 {
1295 1295
 	$where = "";
1296
-	foreach($where_clauses as $clause)
1296
+	foreach ($where_clauses as $clause)
1297 1297
 	{
1298
-		if($where != "")
1298
+		if ($where != "")
1299 1299
 		$where .= " and ";
1300 1300
 		$where .= $clause;
1301 1301
 	}
@@ -1310,15 +1310,15 @@  discard block
 block discarded – undo
1310 1310
  * @return bool False on failure
1311 1311
  */
1312 1312
 function is_guid($guid) {
1313
-	if(strlen($guid) != 36) {
1313
+	if (strlen($guid) != 36) {
1314 1314
 		return false;
1315 1315
 	}
1316 1316
 
1317
-	if(preg_match("/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i", $guid)) {
1317
+	if (preg_match("/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i", $guid)) {
1318 1318
 		return true;
1319 1319
 	}
1320 1320
 
1321
-	return true;;
1321
+	return true; ;
1322 1322
 }
1323 1323
 
1324 1324
 
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 	$microTime = microtime();
1336 1336
 	list($a_dec, $a_sec) = explode(" ", $microTime);
1337 1337
 
1338
-	$dec_hex = dechex($a_dec* 1000000);
1338
+	$dec_hex = dechex($a_dec * 1000000);
1339 1339
 	$sec_hex = dechex($a_sec);
1340 1340
 
1341 1341
 	ensure_length($dec_hex, 5);
@@ -1361,9 +1361,9 @@  discard block
 block discarded – undo
1361 1361
 function create_guid_section($characters)
1362 1362
 {
1363 1363
 	$return = "";
1364
-	for($i=0; $i<$characters; $i++)
1364
+	for ($i = 0; $i < $characters; $i++)
1365 1365
 	{
1366
-		$return .= dechex(mt_rand(0,15));
1366
+		$return .= dechex(mt_rand(0, 15));
1367 1367
 	}
1368 1368
 	return $return;
1369 1369
 }
@@ -1371,11 +1371,11 @@  discard block
 block discarded – undo
1371 1371
 function ensure_length(&$string, $length)
1372 1372
 {
1373 1373
 	$strlen = strlen($string);
1374
-	if($strlen < $length)
1374
+	if ($strlen < $length)
1375 1375
 	{
1376
-		$string = str_pad($string,$length,"0");
1376
+		$string = str_pad($string, $length, "0");
1377 1377
 	}
1378
-	else if($strlen > $length)
1378
+	else if ($strlen > $length)
1379 1379
 	{
1380 1380
 		$string = substr($string, 0, $length);
1381 1381
 	}
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 function displayStudioForCurrentUser()
1392 1392
 {
1393 1393
     global $current_user;
1394
-    if ( $current_user->isAdmin() ) {
1394
+    if ($current_user->isAdmin()) {
1395 1395
         return true;
1396 1396
     }
1397 1397
 
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
 function get_admin_modules_for_user($user) {
1412 1412
     $GLOBALS['log']->deprecated("get_admin_modules_for_user() is deprecated as of 6.2.2 and may disappear in the future, use Users->getDeveloperModules() instead");
1413 1413
 
1414
-    if(!isset($user)){
1414
+    if (!isset($user)) {
1415 1415
         $modules = array();
1416 1416
         return $modules;
1417 1417
     }
@@ -1420,14 +1420,14 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
 }
1422 1422
 
1423
- function get_workflow_admin_modules_for_user($user){
1423
+ function get_workflow_admin_modules_for_user($user) {
1424 1424
     if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
1425 1425
         return $_SESSION['get_workflow_admin_modules_for_user'];
1426 1426
     }
1427 1427
 
1428 1428
     global $moduleList;
1429 1429
     $workflow_mod_list = array();
1430
-    foreach($moduleList as $module){
1430
+    foreach ($moduleList as $module) {
1431 1431
 		$workflow_mod_list[$module] = $module;
1432 1432
 	}
1433 1433
 
@@ -1442,18 +1442,18 @@  discard block
 block discarded – undo
1442 1442
 	// End of list
1443 1443
 
1444 1444
     $workflow_admin_modules = array();
1445
-    if(empty($user)) {
1445
+    if (empty($user)) {
1446 1446
     	return $workflow_admin_modules;
1447 1447
     }
1448 1448
     $actions = ACLAction::getUserActions($user->id);
1449 1449
     //check for ForecastSchedule because it doesn't exist in $workflow_mod_list
1450
-    if (isset($actions['ForecastSchedule']['module']['admin']['aclaccess']) && ($actions['ForecastSchedule']['module']['admin']['aclaccess']==ACL_ALLOW_DEV ||
1451
-        $actions['ForecastSchedule']['module']['admin']['aclaccess']==ACL_ALLOW_ADMIN_DEV)) {
1450
+    if (isset($actions['ForecastSchedule']['module']['admin']['aclaccess']) && ($actions['ForecastSchedule']['module']['admin']['aclaccess'] == ACL_ALLOW_DEV ||
1451
+        $actions['ForecastSchedule']['module']['admin']['aclaccess'] == ACL_ALLOW_ADMIN_DEV)) {
1452 1452
         $workflow_admin_modules['Forecasts'] = 'Forecasts';
1453 1453
     }
1454 1454
     foreach ($workflow_mod_list as $key=>$val) {
1455
-        if(!in_array($val, $workflow_admin_modules) && ($val!='iFrames' && $val!='Feeds' && $val!='Home' && $val!='Dashboard'
1456
-            && $val!='Calendar' && $val!='Activities' && $val!='Reports') &&
1455
+        if (!in_array($val, $workflow_admin_modules) && ($val != 'iFrames' && $val != 'Feeds' && $val != 'Home' && $val != 'Dashboard'
1456
+            && $val != 'Calendar' && $val != 'Activities' && $val != 'Reports') &&
1457 1457
            ($user->isDeveloperForModule($key))) {
1458 1458
                 $workflow_admin_modules[$key] = $val;
1459 1459
         }
@@ -1464,10 +1464,10 @@  discard block
 block discarded – undo
1464 1464
 
1465 1465
 // Check if user is admin for at least one module.
1466 1466
 function is_admin_for_any_module($user) {
1467
-    if (!isset($user)){
1467
+    if (!isset($user)) {
1468 1468
         return false;
1469 1469
     }
1470
-    if($user->isAdmin()) {
1470
+    if ($user->isAdmin()) {
1471 1471
         return true;
1472 1472
     }
1473 1473
     return false;
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
 
1477 1477
 // Check if user is admin for a specific module.
1478
-function is_admin_for_module($user,$module) {
1478
+function is_admin_for_module($user, $module) {
1479 1479
     if (!isset($user)) {
1480 1480
         return false;
1481 1481
     }
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
  * Contributor(s): ______________________________________..
1494 1494
  */
1495 1495
 function is_admin($user) {
1496
-    if(empty($user)) {
1496
+    if (empty($user)) {
1497 1497
         return false;
1498 1498
     }
1499 1499
 
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
  * All Rights Reserved.
1537 1537
  * Contributor(s): ______________________________________..
1538 1538
  */
1539
-function get_select_options ($option_list, $selected) {
1539
+function get_select_options($option_list, $selected) {
1540 1540
 	return get_select_options_with_id($option_list, $selected);
1541 1541
 }
1542 1542
 
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
  * All Rights Reserved.
1550 1550
  * Contributor(s): ______________________________________..
1551 1551
  */
1552
-function get_select_options_with_id ($option_list, $selected_key) {
1552
+function get_select_options_with_id($option_list, $selected_key) {
1553 1553
 	return get_select_options_with_id_separate_key($option_list, $option_list, $selected_key);
1554 1554
 }
1555 1555
 
@@ -1564,14 +1564,14 @@  discard block
 block discarded – undo
1564 1564
  * All Rights Reserved.
1565 1565
  * Contributor(s): ______________________________________..
1566 1566
  */
1567
-function get_select_options_with_id_separate_key ($label_list, $key_list, $selected_key, $massupdate=false) {
1567
+function get_select_options_with_id_separate_key($label_list, $key_list, $selected_key, $massupdate = false) {
1568 1568
 	global $app_strings;
1569 1569
 	$select_options = "";
1570 1570
 
1571 1571
 	//for setting null selection values to human readable --None--
1572 1572
 	$pattern = "/'0?'></";
1573 1573
 	$replacement = "''>".$app_strings['LBL_NONE']."<";
1574
-    if($massupdate){
1574
+    if ($massupdate) {
1575 1575
         $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 1576
     }
1577 1577
 
@@ -1588,7 +1588,7 @@  discard block
 block discarded – undo
1588 1588
                 $option_key == ''
1589 1589
                 && (($selected_key == '' && !$massupdate) || $selected_key == '__SugarMassUpdateClearField__')
1590 1590
             )
1591
-            || (is_array($selected_key) &&  in_array($option_key, $selected_key))
1591
+            || (is_array($selected_key) && in_array($option_key, $selected_key))
1592 1592
         ) {
1593 1593
 			$selected_string = 'selected ';
1594 1594
 		}
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
  * All Rights Reserved.
1623 1623
  * Contributor(s): ______________________________________..
1624 1624
  */
1625
-function get_clear_form_js () {
1625
+function get_clear_form_js() {
1626 1626
 	$the_script = <<<EOQ
1627 1627
 <script type="text/javascript" language="JavaScript">
1628 1628
 function clear_form(form) {
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
  * All Rights Reserved.
1647 1647
  * Contributor(s): ______________________________________..
1648 1648
  */
1649
-function get_set_focus_js () {
1649
+function get_set_focus_js() {
1650 1650
 	//TODO Clint 5/20 - Make this function more generic so that it can take in the target form and field names as variables
1651 1651
 	$the_script = <<<EOQ
1652 1652
 <script type="text/javascript" language="JavaScript">
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
  */
1720 1720
 function parse_calendardate($local_format) {
1721 1721
 	preg_match('/\(?([^-]{1})[^-]*-([^-]{1})[^-]*-([^-]{1})[^-]*\)/', $local_format, $matches);
1722
-	$calendar_format = "%" . $matches[1] . "-%" . $matches[2] . "-%" . $matches[3];
1722
+	$calendar_format = "%".$matches[1]."-%".$matches[2]."-%".$matches[3];
1723 1723
 	return str_replace(array("y", "ᅣ1�7", "a", "j"), array("Y", "Y", "Y", "d"), $calendar_format);
1724 1724
 }
1725 1725
 
@@ -1727,20 +1727,20 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
 
1729 1729
 
1730
-function translate($string, $mod='', $selectedValue=''){
1730
+function translate($string, $mod = '', $selectedValue = '') {
1731 1731
 	//$test_start = microtime();
1732 1732
 	//static $mod_strings_results = array();
1733
-	if(!empty($mod)){
1733
+	if (!empty($mod)) {
1734 1734
 		global $current_language;
1735 1735
 		//Bug 31275
1736
-		if(isset($_REQUEST['login_language'])){
1737
-		    $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language'];
1736
+		if (isset($_REQUEST['login_language'])) {
1737
+		    $current_language = ($_REQUEST['login_language'] == $current_language) ? $current_language : $_REQUEST['login_language'];
1738 1738
 		}
1739 1739
 		$mod_strings = return_module_language($current_language, $mod);
1740 1740
         if ($mod == "")
1741
-        echo "Language is <pre>" . $mod_strings . "</pre>";
1741
+        echo "Language is <pre>".$mod_strings."</pre>";
1742 1742
 
1743
-	}else{
1743
+	} else {
1744 1744
 		global $mod_strings;
1745 1745
 	}
1746 1746
 
@@ -1774,13 +1774,13 @@  discard block
 block discarded – undo
1774 1774
 
1775 1775
 
1776 1776
 
1777
-	if(empty($returnValue)){
1777
+	if (empty($returnValue)) {
1778 1778
 		return $string;
1779 1779
 	}
1780 1780
 
1781 1781
     // Bug 48996 - Custom enums with '0' value were not returning because of empty check
1782 1782
     // Added a numeric 0 checker to the conditional to allow 0 value indexed to pass
1783
-	if(is_array($returnValue) && (!empty($selectedValue) || (is_numeric($selectedValue) && $selectedValue == 0))  && isset($returnValue[$selectedValue]) ){
1783
+	if (is_array($returnValue) && (!empty($selectedValue) || (is_numeric($selectedValue) && $selectedValue == 0)) && isset($returnValue[$selectedValue])) {
1784 1784
 		return $returnValue[$selectedValue];
1785 1785
 	}
1786 1786
 
@@ -1792,25 +1792,25 @@  discard block
 block discarded – undo
1792 1792
         static $num_grp_sep;
1793 1793
         global $current_user, $sugar_config;
1794 1794
 
1795
-        if($dec_sep == null) {
1795
+        if ($dec_sep == null) {
1796 1796
             $user_dec_sep = $current_user->getPreference('dec_sep');
1797 1797
             $dec_sep = (empty($user_dec_sep) ? $sugar_config['default_decimal_seperator'] : $user_dec_sep);
1798 1798
         }
1799
-        if($num_grp_sep == null) {
1799
+        if ($num_grp_sep == null) {
1800 1800
             $user_num_grp_sep = $current_user->getPreference('num_grp_sep');
1801 1801
             $num_grp_sep = (empty($user_num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $user_num_grp_sep);
1802 1802
         }
1803 1803
 
1804
-        $num = preg_replace("'" . preg_quote($num_grp_sep) . "'", '', $num);
1805
-        $num = preg_replace("'" . preg_quote($dec_sep) . "'", '.', $num);
1804
+        $num = preg_replace("'".preg_quote($num_grp_sep)."'", '', $num);
1805
+        $num = preg_replace("'".preg_quote($dec_sep)."'", '.', $num);
1806 1806
         return $num;
1807 1807
 
1808 1808
 }
1809 1809
 
1810 1810
 function add_http($url) {
1811
-	if(!preg_match("@://@i", $url)) {
1811
+	if (!preg_match("@://@i", $url)) {
1812 1812
 		$scheme = "http";
1813
-		if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
1813
+		if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
1814 1814
 			$scheme = 'https';
1815 1815
 		}
1816 1816
 
@@ -1864,10 +1864,10 @@  discard block
 block discarded – undo
1864 1864
  * @param bool cleanImg Flag to allow <img> tags to survive - only used by InboundEmail for inline images.
1865 1865
  * @return array Array of matches, empty on clean string
1866 1866
  */
1867
-function clean_xss($str, $cleanImg=true) {
1867
+function clean_xss($str, $cleanImg = true) {
1868 1868
 	global $sugar_config;
1869 1869
 
1870
-	if(empty($sugar_config['email_xss']))
1870
+	if (empty($sugar_config['email_xss']))
1871 1871
 	$sugar_config['email_xss'] = getDefaultXssTags();
1872 1872
 
1873 1873
 	$xsstags = unserialize(base64_decode($sugar_config['email_xss']));
@@ -1877,32 +1877,32 @@  discard block
 block discarded – undo
1877 1877
 	$jsEvents .= "onmouseup|onmouseover|onmousedown|onmouseenter|onmouseleave|onmousemove|onload|onchange|";
1878 1878
 	$jsEvents .= "onreset|onselect|onsubmit|onkeydown|onkeypress|onkeyup|onabort|onerror|ondragdrop";
1879 1879
 
1880
-	$attribute_regex	= "#\b({$jsEvents})\s*=\s*(?|(?!['\"])\S+|['\"].+?['\"])#sim";
1881
-	$javascript_regex	= '@<[^/>][^>]+(expression\(|j\W*a\W*v\W*a|v\W*b\W*s\W*c\W*r|&#|/\*|\*/)[^>]*>@sim';
1882
-	$imgsrc_regex		= '#<[^>]+src[^=]*=([^>]*?http(s)?://[^>]*)>#sim';
1883
-	$css_url			= '#url\(.*\.\w+\)#';
1880
+	$attribute_regex = "#\b({$jsEvents})\s*=\s*(?|(?!['\"])\S+|['\"].+?['\"])#sim";
1881
+	$javascript_regex = '@<[^/>][^>]+(expression\(|j\W*a\W*v\W*a|v\W*b\W*s\W*c\W*r|&#|/\*|\*/)[^>]*>@sim';
1882
+	$imgsrc_regex = '#<[^>]+src[^=]*=([^>]*?http(s)?://[^>]*)>#sim';
1883
+	$css_url = '#url\(.*\.\w+\)#';
1884 1884
 
1885 1885
 	$tagsrex = '#<\/?(\w+)((?:\s+(?:\w|\w[\w-]*\w)(?:\s*=\s*(?:\".*?\"|\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?>#im';
1886 1886
 
1887 1887
 	$tagmatches = array();
1888 1888
 	$matches = array();
1889 1889
 	preg_match_all($tagsrex, $str, $tagmatches, PREG_PATTERN_ORDER);
1890
-    foreach($tagmatches[1] as $no => $tag) {
1891
-        if(in_array($tag, $xsstags)) {
1890
+    foreach ($tagmatches[1] as $no => $tag) {
1891
+        if (in_array($tag, $xsstags)) {
1892 1892
             // dangerous tag - take out whole
1893 1893
             $matches[] = $tagmatches[0][$no];
1894 1894
             continue;
1895 1895
         }
1896 1896
         $attrmatch = array();
1897 1897
         preg_match_all($attribute_regex, $tagmatches[2][$no], $attrmatch, PREG_PATTERN_ORDER);
1898
-        if(!empty($attrmatch[0])) {
1898
+        if (!empty($attrmatch[0])) {
1899 1899
             $matches = array_merge($matches, $attrmatch[0]);
1900 1900
         }
1901 1901
     }
1902 1902
 
1903 1903
 	$matches = array_merge($matches, xss_check_pattern($javascript_regex, $str));
1904 1904
 
1905
-	if($cleanImg) {
1905
+	if ($cleanImg) {
1906 1906
 		$matches = array_merge($matches,
1907 1907
 		xss_check_pattern($imgsrc_regex, $str)
1908 1908
 		);
@@ -1911,18 +1911,18 @@  discard block
 block discarded – undo
1911 1911
 	// cn: bug 13498 - custom white-list of allowed domains that vet remote images
1912 1912
 	preg_match_all($css_url, $str, $cssUrlMatches, PREG_PATTERN_ORDER);
1913 1913
 
1914
-	if(isset($sugar_config['security_trusted_domains']) && !empty($sugar_config['security_trusted_domains']) && is_array($sugar_config['security_trusted_domains'])) {
1915
-		if(is_array($cssUrlMatches) && count($cssUrlMatches) > 0) {
1914
+	if (isset($sugar_config['security_trusted_domains']) && !empty($sugar_config['security_trusted_domains']) && is_array($sugar_config['security_trusted_domains'])) {
1915
+		if (is_array($cssUrlMatches) && count($cssUrlMatches) > 0) {
1916 1916
 			// normalize whitelist
1917
-			foreach($sugar_config['security_trusted_domains'] as $k => $v) {
1917
+			foreach ($sugar_config['security_trusted_domains'] as $k => $v) {
1918 1918
 				$sugar_config['security_trusted_domains'][$k] = strtolower($v);
1919 1919
 			}
1920 1920
 
1921
-			foreach($cssUrlMatches[0] as $match) {
1921
+			foreach ($cssUrlMatches[0] as $match) {
1922 1922
 				$domain = strtolower(substr(strstr($match, "://"), 3));
1923 1923
 				$baseUrl = substr($domain, 0, strpos($domain, "/"));
1924 1924
 
1925
-				if(!in_array($baseUrl, $sugar_config['security_trusted_domains'])) {
1925
+				if (!in_array($baseUrl, $sugar_config['security_trusted_domains'])) {
1926 1926
 					$matches[] = $match;
1927 1927
 				}
1928 1928
 			}
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 		if (isset($GLOBALS['log']) && is_object($GLOBALS['log'])) {
1984 1984
 			$GLOBALS['log']->fatal("SECURITY[$filter]: bad data passed in; string: {$str}");
1985 1985
 		}
1986
-		if ( $dieOnBadData ) {
1986
+		if ($dieOnBadData) {
1987 1987
 			die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
1988 1988
 		}
1989 1989
 		return false;
@@ -1994,7 +1994,7 @@  discard block
 block discarded – undo
1994 1994
 }
1995 1995
 
1996 1996
 function clean_special_arguments() {
1997
-	if(isset($_SERVER['PHP_SELF'])) {
1997
+	if (isset($_SERVER['PHP_SELF'])) {
1998 1998
 		if (!empty($_SERVER['PHP_SELF'])) clean_string($_SERVER['PHP_SELF'], 'SAFED_GET');
1999 1999
 	}
2000 2000
 	if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme'], "STANDARD");
@@ -2024,12 +2024,12 @@  discard block
 block discarded – undo
2024 2024
  * cleans the given key in superglobals $_GET, $_POST, $_REQUEST
2025 2025
  */
2026 2026
 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);
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 2030
 }
2031 2031
 
2032
-function set_superglobals($key, $val){
2032
+function set_superglobals($key, $val) {
2033 2033
 	$_GET[$key] = $val;
2034 2034
 	$_POST[$key] = $val;
2035 2035
 	$_REQUEST[$key] = $val;
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 	global $sugar_config;
2041 2041
     global $RAW_REQUEST;
2042 2042
 
2043
-    if(get_magic_quotes_gpc()) {
2043
+    if (get_magic_quotes_gpc()) {
2044 2044
         // magic quotes screw up data, we'd have to clean up
2045 2045
         $RAW_REQUEST = array_map("cleanup_slashes", $_REQUEST);
2046 2046
     } else {
@@ -2059,17 +2059,17 @@  discard block
 block discarded – undo
2059 2059
 	}
2060 2060
 
2061 2061
 	// PHP cannot stomp out superglobals reliably
2062
-	foreach($post as $k => $v) { $_POST[$k] = $v; }
2063
-	foreach($get  as $k => $v) { $_GET[$k] = $v; }
2064
-	foreach($req  as $k => $v) {
2062
+	foreach ($post as $k => $v) { $_POST[$k] = $v; }
2063
+	foreach ($get  as $k => $v) { $_GET[$k] = $v; }
2064
+	foreach ($req  as $k => $v) {
2065 2065
 		 $_REQUEST[$k] = $v;
2066 2066
 
2067 2067
 	    //ensure the keys are safe as well.  If mbstring encoding translation is on, the post keys don't
2068 2068
         //get translated, so scrub the data but don't die
2069
-	    if(ini_get('mbstring.encoding_translation')==='1'){
2070
-            securexsskey($k,false);
2071
-        }else{
2072
-		    securexsskey($k,true);
2069
+	    if (ini_get('mbstring.encoding_translation') === '1') {
2070
+            securexsskey($k, false);
2071
+        } else {
2072
+		    securexsskey($k, true);
2073 2073
         }
2074 2074
 
2075 2075
 	}
@@ -2088,8 +2088,8 @@  discard block
 block discarded – undo
2088 2088
 	if (isset($_REQUEST['offset'])) clean_string($_REQUEST['offset']);
2089 2089
 	if (isset($_REQUEST['stamp'])) clean_string($_REQUEST['stamp']);
2090 2090
 
2091
-	if(isset($_REQUEST['lvso'])){
2092
-			set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc');
2091
+	if (isset($_REQUEST['lvso'])) {
2092
+			set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc') ? 'desc' : 'asc');
2093 2093
 	}
2094 2094
 	// Clean "offset" and "order_by" parameters in URL
2095 2095
 	foreach ($_REQUEST as $key => $val) {
@@ -2118,27 +2118,27 @@  discard block
 block discarded – undo
2118 2118
 }
2119 2119
 
2120 2120
 function securexss($value) {
2121
-	if(is_array($value)){
2121
+	if (is_array($value)) {
2122 2122
     	$new = array();
2123
-        foreach($value as $key=>$val){
2123
+        foreach ($value as $key=>$val) {
2124 2124
        		$new[$key] = securexss($val);
2125 2125
         }
2126 2126
         return $new;
2127 2127
     }
2128
-	static $xss_cleanup=  array("&quot;" => "&#38;", '"' =>'&quot;', "'" =>  '&#039;' , '<' =>'&lt;' , '>'=>'&gt;');
2128
+	static $xss_cleanup = array("&quot;" => "&#38;", '"' =>'&quot;', "'" =>  '&#039;', '<' =>'&lt;', '>'=>'&gt;');
2129 2129
 	$value = preg_replace(array('/javascript:/i', '/\0/'), array('java script:', ''), $value);
2130 2130
 	$value = preg_replace('/javascript:/i', 'java script:', $value);
2131 2131
 	return str_replace(array_keys($xss_cleanup), array_values($xss_cleanup), $value);
2132 2132
 }
2133 2133
 
2134
-function securexsskey($value, $die=true){
2134
+function securexsskey($value, $die = true) {
2135 2135
 	global $sugar_config;
2136 2136
 	$matches = array();
2137 2137
 	preg_match('/[\'"<>]/', $value, $matches);
2138
-	if(!empty($matches)){
2139
-		if($die){
2138
+	if (!empty($matches)) {
2139
+		if ($die) {
2140 2140
 			die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
2141
-		}else{
2141
+		} else {
2142 2142
 			unset($_REQUEST[$value]);
2143 2143
 			unset($_POST[$value]);
2144 2144
 			unset($_GET[$value]);
@@ -2146,15 +2146,15 @@  discard block
 block discarded – undo
2146 2146
 	}
2147 2147
 }
2148 2148
 
2149
-function preprocess_param($value){
2150
-	if(is_string($value)){
2151
-		if(get_magic_quotes_gpc() == 1){
2149
+function preprocess_param($value) {
2150
+	if (is_string($value)) {
2151
+		if (get_magic_quotes_gpc() == 1) {
2152 2152
 			$value = stripslashes($value);
2153 2153
 		}
2154 2154
 
2155 2155
 		$value = securexss($value);
2156 2156
 	}
2157
-	else if (is_array($value)){
2157
+	else if (is_array($value)) {
2158 2158
 	    foreach ($value as $key => $element) {
2159 2159
 	        $value[$key] = preprocess_param($element);
2160 2160
 	    }
@@ -2165,40 +2165,40 @@  discard block
 block discarded – undo
2165 2165
 
2166 2166
 function cleanup_slashes($value)
2167 2167
 {
2168
-    if(is_string($value)) return stripslashes($value);
2168
+    if (is_string($value)) return stripslashes($value);
2169 2169
     return $value;
2170 2170
 }
2171 2171
 
2172 2172
 
2173
-function set_register_value($category, $name, $value){
2173
+function set_register_value($category, $name, $value) {
2174 2174
     return sugar_cache_put("{$category}:{$name}", $value);
2175 2175
 }
2176 2176
 
2177
-function get_register_value($category,$name){
2177
+function get_register_value($category, $name) {
2178 2178
     return sugar_cache_retrieve("{$category}:{$name}");
2179 2179
 }
2180 2180
 
2181
-function clear_register_value($category,$name){
2181
+function clear_register_value($category, $name) {
2182 2182
     return sugar_cache_clear("{$category}:{$name}");
2183 2183
 }
2184 2184
 // this function cleans id's when being imported
2185 2185
 function convert_id($string)
2186 2186
 {
2187
-	return preg_replace_callback( '|[^A-Za-z0-9\-]|',
2187
+	return preg_replace_callback('|[^A-Za-z0-9\-]|',
2188 2188
 	create_function(
2189 2189
 	// single quotes are essential here,
2190 2190
 	// or alternative escape all $ as \$
2191 2191
 	'$matches',
2192 2192
 	'return ord($matches[0]);'
2193
-         ) ,$string);
2193
+         ), $string);
2194 2194
 }
2195 2195
 
2196 2196
 /**
2197 2197
  * @deprecated use SugarTheme::getImage()
2198 2198
  */
2199
-function get_image($image,$other_attributes,$width="",$height="",$ext='.gif',$alt="")
2199
+function get_image($image, $other_attributes, $width = "", $height = "", $ext = '.gif', $alt = "")
2200 2200
 {
2201
-    return SugarThemeRegistry::current()->getImage(basename($image), $other_attributes, empty($width) ? null : $width, empty($height) ? null : $height, $ext, $alt );
2201
+    return SugarThemeRegistry::current()->getImage(basename($image), $other_attributes, empty($width) ? null : $width, empty($height) ? null : $height, $ext, $alt);
2202 2202
 }
2203 2203
 /**
2204 2204
  * @deprecated use SugarTheme::getImageURL()
@@ -2208,54 +2208,54 @@  discard block
 block discarded – undo
2208 2208
     return SugarThemeRegistry::current()->getImageURL($image_name);
2209 2209
 }
2210 2210
 
2211
-function getWebPath($relative_path){
2211
+function getWebPath($relative_path) {
2212 2212
 	//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);
2213
+	if (substr_count($relative_path, '://') > 0) return $relative_path;
2214
+	if (defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2215 2215
 	return $relative_path;
2216 2216
 }
2217 2217
 
2218
-function getVersionedPath($path, $additional_attrs='')
2218
+function getVersionedPath($path, $additional_attrs = '')
2219 2219
 {
2220
-	if(empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1;
2221
-	$js_version_key = isset($GLOBALS['js_version_key'])?$GLOBALS['js_version_key']:'';
2222
-	if(inDeveloperMode()) {
2220
+	if (empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1;
2221
+	$js_version_key = isset($GLOBALS['js_version_key']) ? $GLOBALS['js_version_key'] : '';
2222
+	if (inDeveloperMode()) {
2223 2223
 	    static $rand;
2224
-	    if(empty($rand)) $rand = mt_rand();
2224
+	    if (empty($rand)) $rand = mt_rand();
2225 2225
 	    $dev = $rand;
2226 2226
 	} else {
2227 2227
 	    $dev = '';
2228 2228
 	}
2229
-	if(is_array($additional_attrs)) {
2230
-	    $additional_attrs = join("|",$additional_attrs);
2229
+	if (is_array($additional_attrs)) {
2230
+	    $additional_attrs = join("|", $additional_attrs);
2231 2231
 	}
2232 2232
 	// cutting 2 last chars here because since md5 is 32 chars, it's always ==
2233 2233
 	$str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2);
2234 2234
 	// remove / - it confuses some parsers
2235 2235
 	$str = strtr($str, '/+', '-_');
2236
-	if(empty($path)) return $str;
2236
+	if (empty($path)) return $str;
2237 2237
 
2238
-	return $path . "?v=$str";
2238
+	return $path."?v=$str";
2239 2239
 }
2240 2240
 
2241
-function getVersionedScript($path, $additional_attrs='')
2241
+function getVersionedScript($path, $additional_attrs = '')
2242 2242
 {
2243 2243
     return '<script type="text/javascript" src="'.getVersionedPath($path, $additional_attrs).'"></script>';
2244 2244
 }
2245 2245
 
2246
-function getJSPath($relative_path, $additional_attrs='')
2246
+function getJSPath($relative_path, $additional_attrs = '')
2247 2247
 {
2248
-	if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2249
-	return getVersionedPath($relative_path).(!empty($additional_attrs)?"&$additional_attrs":"");
2248
+	if (defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2249
+	return getVersionedPath($relative_path).(!empty($additional_attrs) ? "&$additional_attrs" : "");
2250 2250
 }
2251 2251
 
2252
-function getSWFPath($relative_path, $additional_params=''){
2252
+function getSWFPath($relative_path, $additional_params = '') {
2253 2253
 	$path = $relative_path;
2254
-	if (!empty($additional_params)){
2255
-		$path .= '?' . $additional_params;
2254
+	if (!empty($additional_params)) {
2255
+		$path .= '?'.$additional_params;
2256 2256
 	}
2257
-	if (defined('TEMPLATE_URL')){
2258
-		$path = TEMPLATE_URL . '/' . $path;
2257
+	if (defined('TEMPLATE_URL')) {
2258
+		$path = TEMPLATE_URL.'/'.$path;
2259 2259
 	}
2260 2260
 	return $path;
2261 2261
 }
@@ -2266,25 +2266,25 @@  discard block
 block discarded – undo
2266 2266
 
2267 2267
 function getSQLDate($date_str)
2268 2268
 {
2269
-	if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/',$date_str,$match))
2269
+	if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/', $date_str, $match))
2270 2270
 	{
2271
-		if ( strlen($match[2]) == 1)
2271
+		if (strlen($match[2]) == 1)
2272 2272
 		{
2273 2273
 			$match[2] = "0".$match[2];
2274 2274
 		}
2275
-		if ( strlen($match[1]) == 1)
2275
+		if (strlen($match[1]) == 1)
2276 2276
 		{
2277 2277
 			$match[1] = "0".$match[1];
2278 2278
 		}
2279 2279
 		return "{$match[3]}-{$match[1]}-{$match[2]}";
2280 2280
 	}
2281
-	else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match))
2281
+	else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/', $date_str, $match))
2282 2282
 	{
2283
-		if ( strlen($match[2]) == 1)
2283
+		if (strlen($match[2]) == 1)
2284 2284
 		{
2285 2285
 			$match[2] = "0".$match[2];
2286 2286
 		}
2287
-		if ( strlen($match[1]) == 1)
2287
+		if (strlen($match[1]) == 1)
2288 2288
 		{
2289 2289
 			$match[1] = "0".$match[1];
2290 2290
 		}
@@ -2296,15 +2296,15 @@  discard block
 block discarded – undo
2296 2296
 	}
2297 2297
 }
2298 2298
 
2299
-function clone_history(&$db, $from_id,$to_id, $to_type)
2299
+function clone_history(&$db, $from_id, $to_id, $to_type)
2300 2300
 {
2301 2301
 	global $timedate;
2302
-	$old_note_id=null;
2303
-	$old_filename=null;
2302
+	$old_note_id = null;
2303
+	$old_filename = null;
2304 2304
 	require_once('include/upload_file.php');
2305 2305
 	$tables = array('calls'=>'Call', 'meetings'=>'Meeting', 'notes'=>'Note', 'tasks'=>'Task');
2306 2306
 
2307
-	$location=array('Email'=>"modules/Emails/Email.php",
2307
+	$location = array('Email'=>"modules/Emails/Email.php",
2308 2308
 	'Call'=>"modules/Calls/Call.php",
2309 2309
 	'Meeting'=>"modules/Meetings/Meeting.php",
2310 2310
 	'Note'=>"modules/Notes/Note.php",
@@ -2312,7 +2312,7 @@  discard block
 block discarded – undo
2312 2312
 	);
2313 2313
 
2314 2314
 
2315
-	foreach($tables as $table=>$bean_class)
2315
+	foreach ($tables as $table=>$bean_class)
2316 2316
 	{
2317 2317
 
2318 2318
 		if (!class_exists($bean_class))
@@ -2320,48 +2320,48 @@  discard block
 block discarded – undo
2320 2320
 			require_once($location[$bean_class]);
2321 2321
 		}
2322 2322
 
2323
-		$bProcessingNotes=false;
2324
-		if ($table=='notes')
2323
+		$bProcessingNotes = false;
2324
+		if ($table == 'notes')
2325 2325
 		{
2326
-			$bProcessingNotes=true;
2326
+			$bProcessingNotes = true;
2327 2327
 		}
2328 2328
 		$query = "SELECT id FROM $table WHERE parent_id='$from_id'";
2329 2329
 		$results = $db->query($query);
2330
-		while($row = $db->fetchByAssoc($results))
2330
+		while ($row = $db->fetchByAssoc($results))
2331 2331
 		{
2332 2332
 			//retrieve existing record.
2333
-			$bean= new $bean_class();
2333
+			$bean = new $bean_class();
2334 2334
 			$bean->retrieve($row['id']);
2335 2335
 			//process for new instance.
2336 2336
 			if ($bProcessingNotes)
2337 2337
 			{
2338
-				$old_note_id=$row['id'];
2339
-				$old_filename=$bean->filename;
2338
+				$old_note_id = $row['id'];
2339
+				$old_filename = $bean->filename;
2340 2340
 			}
2341
-			$bean->id=null;
2342
-			$bean->parent_id=$to_id;
2343
-			$bean->parent_type=$to_type;
2344
-			if ($to_type=='Contacts' and in_array('contact_id',$bean->column_fields))
2341
+			$bean->id = null;
2342
+			$bean->parent_id = $to_id;
2343
+			$bean->parent_type = $to_type;
2344
+			if ($to_type == 'Contacts' and in_array('contact_id', $bean->column_fields))
2345 2345
 			{
2346
-				$bean->contact_id=$to_id;
2346
+				$bean->contact_id = $to_id;
2347 2347
 			}
2348 2348
 			$bean->update_date_modified = false;
2349 2349
             $bean->update_modified_by = false;
2350
-            if(isset($bean->date_modified))
2350
+            if (isset($bean->date_modified))
2351 2351
                 $bean->date_modified = $timedate->to_db($bean->date_modified);
2352
-            if(isset($bean->date_entered))
2352
+            if (isset($bean->date_entered))
2353 2353
                 $bean->date_entered = $timedate->to_db($bean->date_entered);
2354 2354
 			//save
2355
-			$new_id=$bean->save();
2355
+			$new_id = $bean->save();
2356 2356
 
2357 2357
 			//duplicate the file now. for notes.
2358 2358
 			if ($bProcessingNotes && !empty($old_filename))
2359 2359
 			{
2360
-				UploadFile::duplicate_file($old_note_id,$new_id,$old_filename);
2360
+				UploadFile::duplicate_file($old_note_id, $new_id, $old_filename);
2361 2361
 			}
2362 2362
 			//reset the values needed for attachment duplication.
2363
-			$old_note_id=null;
2364
-			$old_filename=null;
2363
+			$old_note_id = null;
2364
+			$old_filename = null;
2365 2365
 		}
2366 2366
 	}
2367 2367
 }
@@ -2369,11 +2369,11 @@  discard block
 block discarded – undo
2369 2369
 function values_to_keys($array)
2370 2370
 {
2371 2371
 	$new_array = array();
2372
-	if(!is_array($array))
2372
+	if (!is_array($array))
2373 2373
 	{
2374 2374
 		return $new_array;
2375 2375
 	}
2376
-	foreach($array as $arr){
2376
+	foreach ($array as $arr) {
2377 2377
 		$new_array[$arr] = $arr;
2378 2378
 	}
2379 2379
 	return $new_array;
@@ -2381,7 +2381,7 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
 function clone_relationship(&$db, $tables = array(), $from_column, $from_id, $to_id)
2383 2383
 {
2384
-	foreach($tables as $table)
2384
+	foreach ($tables as $table)
2385 2385
 	{
2386 2386
 
2387 2387
 		if ($table == 'emails_beans') {
@@ -2390,27 +2390,27 @@  discard block
 block discarded – undo
2390 2390
 			$query = "SELECT * FROM $table WHERE $from_column='$from_id'";
2391 2391
 		}
2392 2392
 		$results = $db->query($query);
2393
-		while($row = $db->fetchByAssoc($results))
2393
+		while ($row = $db->fetchByAssoc($results))
2394 2394
 		{
2395 2395
 			$query = "INSERT INTO $table ";
2396 2396
 			$names = '';
2397 2397
 			$values = '';
2398 2398
 			$row[$from_column] = $to_id;
2399 2399
 			$row['id'] = create_guid();
2400
-			if ($table=='emails_beans') {
2401
-				$row['bean_module'] =='Contacts';
2400
+			if ($table == 'emails_beans') {
2401
+				$row['bean_module'] == 'Contacts';
2402 2402
 			}
2403 2403
 
2404
-			foreach($row as $name=>$value)
2404
+			foreach ($row as $name=>$value)
2405 2405
 			{
2406 2406
 
2407
-				if(empty($names))
2407
+				if (empty($names))
2408 2408
 				{
2409 2409
 					$names .= $name;
2410 2410
 					$values .= "'$value'";
2411 2411
 				} else
2412 2412
 				{
2413
-					$names .= ', '. $name;
2413
+					$names .= ', '.$name;
2414 2414
 					$values .= ", '$value'";
2415 2415
 				}
2416 2416
 			}
@@ -2423,9 +2423,9 @@  discard block
 block discarded – undo
2423 2423
 function get_unlinked_email_query($type, $bean) {
2424 2424
     global $current_user;
2425 2425
 
2426
-    $return_array['select']='SELECT emails.id ';
2427
-    $return_array['from']='FROM emails ';
2428
-    $return_array['where']="";
2426
+    $return_array['select'] = 'SELECT emails.id ';
2427
+    $return_array['from'] = 'FROM emails ';
2428
+    $return_array['where'] = "";
2429 2429
 	$return_array['join'] = " JOIN (select DISTINCT email_id from emails_email_addr_rel eear
2430 2430
 
2431 2431
 	join email_addr_bean_rel eabr on eabr.bean_id ='$bean->id' and eabr.bean_module = '$bean->module_dir' and
@@ -2439,17 +2439,17 @@  discard block
 block discarded – undo
2439 2439
 		return $return_array;
2440 2440
 	}
2441 2441
 
2442
-	return $return_array['select'] . $return_array['from'] . $return_array['where'] . $return_array['join'] ;
2442
+	return $return_array['select'].$return_array['from'].$return_array['where'].$return_array['join'];
2443 2443
 } // fn
2444 2444
 
2445 2445
 function get_emails_by_assign_or_link($params)
2446 2446
 {
2447 2447
     $relation = $params['link'];
2448 2448
 	$bean = $GLOBALS['app']->controller->bean;
2449
-    if(empty($bean->$relation)) {
2449
+    if (empty($bean->$relation)) {
2450 2450
         $bean->load_relationship($relation);
2451 2451
     }
2452
-    if(empty($bean->$relation)) {
2452
+    if (empty($bean->$relation)) {
2453 2453
         $GLOBALS['log']->error("Bad relation '$relation' for bean '{$bean->object_name}' id '{$bean->id}'");
2454 2454
         return array();
2455 2455
     }
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
     	'join_table_link_alias' => 'linkt',
2460 2460
     ));
2461 2461
     $rel_join = str_replace("{$bean->table_name}.id", "'{$bean->id}'", $rel_join);
2462
-    $return_array['select']='SELECT DISTINCT emails.id ';
2462
+    $return_array['select'] = 'SELECT DISTINCT emails.id ';
2463 2463
     $return_array['from'] = "FROM emails ";
2464 2464
 
2465 2465
     $return_array['join'] = array();
@@ -2531,15 +2531,15 @@  discard block
 block discarded – undo
2531 2531
         ";
2532 2532
     }
2533 2533
 
2534
-    $return_array['join'] = " INNER JOIN (" . implode(" UNION ", $return_array['join']). ") email_ids ON emails.id=email_ids.email_id ";
2534
+    $return_array['join'] = " INNER JOIN (".implode(" UNION ", $return_array['join']).") email_ids ON emails.id=email_ids.email_id ";
2535 2535
 
2536
-    $return_array['where']=" WHERE emails.deleted=0 ";
2536
+    $return_array['where'] = " WHERE emails.deleted=0 ";
2537 2537
 
2538 2538
     	//$return_array['join'] = '';
2539 2539
         $return_array['join_tables'][0] = '';
2540 2540
 
2541
-        if($bean->object_name == "Case" && !empty($bean->case_number)) {
2542
-            $where = str_replace("%1", $bean->case_number, 	$bean->getEmailSubjectMacro());
2541
+        if ($bean->object_name == "Case" && !empty($bean->case_number)) {
2542
+            $where = str_replace("%1", $bean->case_number, $bean->getEmailSubjectMacro());
2543 2543
     	    $return_array["where"] .= "\n AND (email_ids.source = 'direct' OR emails.name LIKE '%$where%')";
2544 2544
         }
2545 2545
 
@@ -2556,16 +2556,16 @@  discard block
 block discarded – undo
2556 2556
 	return empty($value) && $value != '0';
2557 2557
 }
2558 2558
 
2559
-function get_bean_select_array($add_blank=true, $bean_name, $display_columns, $where='', $order_by='', $blank_is_none=false)
2559
+function get_bean_select_array($add_blank = true, $bean_name, $display_columns, $where = '', $order_by = '', $blank_is_none = false)
2560 2560
 {
2561 2561
 	global $beanFiles;
2562 2562
 	require_once($beanFiles[$bean_name]);
2563 2563
 	$focus = new $bean_name();
2564 2564
 	$user_array = array();
2565 2565
 
2566
-    $key = ($bean_name == 'EmailTemplate') ?  $bean_name : $bean_name . $display_columns. $where . $order_by;
2567
-	$user_array = get_register_value('select_array', $key );
2568
-	if(!$user_array)
2566
+    $key = ($bean_name == 'EmailTemplate') ? $bean_name : $bean_name.$display_columns.$where.$order_by;
2567
+	$user_array = get_register_value('select_array', $key);
2568
+	if (!$user_array)
2569 2569
 	{
2570 2570
 
2571 2571
 		$db = DBManagerFactory::getInstance();
@@ -2573,16 +2573,16 @@  discard block
 block discarded – undo
2573 2573
 		$temp_result = Array();
2574 2574
 		$query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} ";
2575 2575
 		$query .= "where ";
2576
-		if ( $where != '')
2576
+		if ($where != '')
2577 2577
 		{
2578 2578
 			$query .= $where." AND ";
2579 2579
 		}
2580 2580
 
2581
-		$query .=  " {$focus->table_name}.deleted=0";
2581
+		$query .= " {$focus->table_name}.deleted=0";
2582 2582
 
2583 2583
         /* BEGIN - SECURITY GROUPS */
2584 2584
         global $current_user, $sugar_config;
2585
-        if($focus->module_dir == 'Users' && !is_admin($current_user)
2585
+        if ($focus->module_dir == 'Users' && !is_admin($current_user)
2586 2586
                 && isset($sugar_config['securitysuite_filter_user_list'])
2587 2587
                 && $sugar_config['securitysuite_filter_user_list'] == true
2588 2588
         ) {
@@ -2590,20 +2590,20 @@  discard block
 block discarded – undo
2590 2590
             $group_where = SecurityGroup::getGroupUsersWhere($current_user->id);
2591 2591
             $query .= " AND (".$group_where.") ";
2592 2592
         } else
2593
-        if($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list') )
2593
+        if ($focus->bean_implements('ACL') && ACLController::requireSecurityGroup($focus->module_dir, 'list'))
2594 2594
         {
2595 2595
             require_once('modules/SecurityGroups/SecurityGroup.php');
2596 2596
             $owner_where = $focus->getOwnerWhere($current_user->id);
2597
-            $group_where = SecurityGroup::getGroupWhere($focus->table_name,$focus->module_dir,$current_user->id);
2598
-            if(!empty($owner_where)){
2599
-                $query .= " AND (".  $owner_where." or ".$group_where.") ";
2597
+            $group_where = SecurityGroup::getGroupWhere($focus->table_name, $focus->module_dir, $current_user->id);
2598
+            if (!empty($owner_where)) {
2599
+                $query .= " AND (".$owner_where." or ".$group_where.") ";
2600 2600
             } else {
2601
-                $query .= ' AND '.  $group_where;
2601
+                $query .= ' AND '.$group_where;
2602 2602
             }
2603 2603
         }
2604 2604
         /* END - SECURITY GROUPS */
2605 2605
 
2606
-		if ( $order_by != '')
2606
+		if ($order_by != '')
2607 2607
 		{
2608 2608
 			$query .= " order by {$focus->table_name}.{$order_by}";
2609 2609
 		}
@@ -2611,9 +2611,9 @@  discard block
 block discarded – undo
2611 2611
 		$GLOBALS['log']->debug("get_user_array query: $query");
2612 2612
 		$result = $db->query($query, true, "Error filling in user array: ");
2613 2613
 
2614
-		if ($add_blank==true){
2614
+		if ($add_blank == true) {
2615 2615
 			// Add in a blank row
2616
-			if($blank_is_none == true) { // set 'blank row' to "--None--"
2616
+			if ($blank_is_none == true) { // set 'blank row' to "--None--"
2617 2617
 				global $app_strings;
2618 2618
 				$temp_result[''] = $app_strings['LBL_NONE'];
2619 2619
 			} else {
@@ -2622,13 +2622,13 @@  discard block
 block discarded – undo
2622 2622
 		}
2623 2623
 
2624 2624
 		// Get the id and the name.
2625
-		while($row = $db->fetchByAssoc($result))
2625
+		while ($row = $db->fetchByAssoc($result))
2626 2626
 		{
2627 2627
 			$temp_result[$row['id']] = $row['display'];
2628 2628
 		}
2629 2629
 
2630 2630
 		$user_array = $temp_result;
2631
-		set_register_value('select_array', $key ,$temp_result);
2631
+		set_register_value('select_array', $key, $temp_result);
2632 2632
 	}
2633 2633
 
2634 2634
 	return $user_array;
@@ -2646,21 +2646,21 @@  discard block
 block discarded – undo
2646 2646
 	global $modListHeader;
2647 2647
 	$returnArray = array();
2648 2648
 
2649
-	foreach($listArray as $optionName => $optionVal)
2649
+	foreach ($listArray as $optionName => $optionVal)
2650 2650
 	{
2651
-		if(array_key_exists($optionName, $modListHeader))
2651
+		if (array_key_exists($optionName, $modListHeader))
2652 2652
 		{
2653 2653
 			$returnArray[$optionName] = $optionVal;
2654 2654
 		}
2655 2655
 
2656 2656
 		// special case for projects
2657
-		if(array_key_exists('Project', $modListHeader))
2657
+		if (array_key_exists('Project', $modListHeader))
2658 2658
 		{
2659 2659
 			$returnArray['ProjectTask'] = $listArray['ProjectTask'];
2660 2660
 		}
2661 2661
 	}
2662
-	$acldenied = ACLController::disabledModuleList($listArray,false);
2663
-	foreach($acldenied as $denied){
2662
+	$acldenied = ACLController::disabledModuleList($listArray, false);
2663
+	foreach ($acldenied as $denied) {
2664 2664
 		unset($returnArray[$denied]);
2665 2665
 	}
2666 2666
 	asort($returnArray);
@@ -2668,21 +2668,21 @@  discard block
 block discarded – undo
2668 2668
 	return $returnArray;
2669 2669
 }
2670 2670
 
2671
-function display_notice($msg = false){
2671
+function display_notice($msg = false) {
2672 2672
 	global $error_notice;
2673 2673
 	//no error notice - lets just display the error to the user
2674
-	if(!isset($error_notice)){
2675
-		echo '<br>'.$msg . '<br>';
2676
-	}else{
2677
-		$error_notice .= $msg . '<br>';
2674
+	if (!isset($error_notice)) {
2675
+		echo '<br>'.$msg.'<br>';
2676
+	} else {
2677
+		$error_notice .= $msg.'<br>';
2678 2678
 	}
2679 2679
 }
2680 2680
 
2681 2681
 /* checks if it is a number that at least has the plus at the beginning.
2682 2682
  */
2683
-function skype_formatted($number){
2683
+function skype_formatted($number) {
2684 2684
 	//kbrill - BUG #15375
2685
-	if(isset($_REQUEST['action']) && $_REQUEST['action']=="Popup") {
2685
+	if (isset($_REQUEST['action']) && $_REQUEST['action'] == "Popup") {
2686 2686
 		return false;
2687 2687
 	} else {
2688 2688
 		return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 3) == '011';
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 }
2692 2692
 
2693 2693
 function format_skype($number) {
2694
-    return preg_replace('/[^\+0-9]/','',$number);
2694
+    return preg_replace('/[^\+0-9]/', '', $number);
2695 2695
 }
2696 2696
 
2697 2697
 function insert_charset_header() {
@@ -2701,23 +2701,23 @@  discard block
 block discarded – undo
2701 2701
 function getCurrentURL()
2702 2702
 {
2703 2703
 	$href = "http:";
2704
-	if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
2704
+	if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
2705 2705
 	{
2706 2706
 		$href = 'https:';
2707 2707
 	}
2708 2708
 
2709
-	$href.= "//".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
2709
+	$href .= "//".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
2710 2710
 	return $href;
2711 2711
 }
2712 2712
 
2713 2713
 function javascript_escape($str) {
2714 2714
 	$new_str = '';
2715 2715
 
2716
-	for($i = 0; $i < strlen($str); $i++) {
2716
+	for ($i = 0; $i < strlen($str); $i++) {
2717 2717
 
2718
-		if(ord(substr($str, $i, 1))==10){
2718
+		if (ord(substr($str, $i, 1)) == 10) {
2719 2719
 			$new_str .= '\n';
2720
-		}elseif(ord(substr($str, $i, 1))==13){
2720
+		}elseif (ord(substr($str, $i, 1)) == 13) {
2721 2721
 			$new_str .= '\r';
2722 2722
 		}
2723 2723
 		else {
@@ -2730,10 +2730,10 @@  discard block
 block discarded – undo
2730 2730
 	return $new_str;
2731 2731
 }
2732 2732
 
2733
-function js_escape($str, $keep=true){
2733
+function js_escape($str, $keep = true) {
2734 2734
 	$str = html_entity_decode(str_replace("\\", "", $str), ENT_QUOTES);
2735 2735
 
2736
-	if($keep){
2736
+	if ($keep) {
2737 2737
 		$str = javascript_escape($str);
2738 2738
 	}
2739 2739
 	else {
@@ -2750,11 +2750,11 @@  discard block
 block discarded – undo
2750 2750
 	$regex = "#<[^>]+br.+?>#i";
2751 2751
 	preg_match_all($regex, $str, $matches);
2752 2752
 
2753
-	foreach($matches[0] as $match) {
2753
+	foreach ($matches[0] as $match) {
2754 2754
 		$str = str_replace($match, "<br>", $str);
2755 2755
 	}
2756 2756
 
2757
-	$brs = array('<br>','<br/>', '<br />');
2757
+	$brs = array('<br>', '<br/>', '<br />');
2758 2758
 	$str = str_replace("\r\n", "\n", $str); // make from windows-returns, *nix-returns
2759 2759
 	$str = str_replace("\n\r", "\n", $str); // make from windows-returns, *nix-returns
2760 2760
 	$str = str_replace("\r", "\n", $str); // make from windows-returns, *nix-returns
@@ -2781,20 +2781,20 @@  discard block
 block discarded – undo
2781 2781
  * @param $die boolean end script flow
2782 2782
  * @param $displayStackTrace also show stack trace
2783 2783
  */
2784
-function _ppl($mixed, $die=false, $displayStackTrace=false, $loglevel="fatal") {
2785
-	if(!isset($GLOBALS['log']) || empty($GLOBALS['log'])) {
2784
+function _ppl($mixed, $die = false, $displayStackTrace = false, $loglevel = "fatal") {
2785
+	if (!isset($GLOBALS['log']) || empty($GLOBALS['log'])) {
2786 2786
 
2787 2787
 		$GLOBALS['log'] = LoggerManager :: getLogger('SugarCRM');
2788 2788
 	}
2789 2789
 
2790 2790
 
2791
-	$mix	= print_r($mixed, true); // send print_r() output to $mix
2792
-	$stack	= debug_backtrace();
2791
+	$mix = print_r($mixed, true); // send print_r() output to $mix
2792
+	$stack = debug_backtrace();
2793 2793
 
2794 2794
 	$GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output start -----------------------------');
2795 2795
 	$GLOBALS['log']->$loglevel($mix);
2796
-	if($displayStackTrace) {
2797
-		foreach($stack as $position) {
2796
+	if ($displayStackTrace) {
2797
+		foreach ($stack as $position) {
2798 2798
 			$GLOBALS['log']->$loglevel($position['file']."({$position['line']})");
2799 2799
 		}
2800 2800
 	}
@@ -2802,7 +2802,7 @@  discard block
 block discarded – undo
2802 2802
 	$GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output end -----------------------------');
2803 2803
 	$GLOBALS['log']->$loglevel('------------------------------ _ppLogger() file: '.$stack[0]['file'].' line#: '.$stack[0]['line'].'-----------------------------');
2804 2804
 
2805
-	if($die) {
2805
+	if ($die) {
2806 2806
 		die();
2807 2807
 	}
2808 2808
 }
@@ -2812,7 +2812,7 @@  discard block
 block discarded – undo
2812 2812
  * The ppf stands for Pre[formatted] Print Focus [object]
2813 2813
  * @param object bean The focus bean
2814 2814
  */
2815
-function _ppf($bean, $die=false) {
2815
+function _ppf($bean, $die = false) {
2816 2816
 }
2817 2817
 
2818 2818
 
@@ -2831,7 +2831,7 @@  discard block
 block discarded – undo
2831 2831
  * This function is only intended to be used for SugarCRM internal development.
2832 2832
  * The pp stands for Pre Print.
2833 2833
  */
2834
-function _pstack_trace($mixed=NULL)
2834
+function _pstack_trace($mixed = NULL)
2835 2835
 {
2836 2836
 }
2837 2837
 
@@ -2840,7 +2840,7 @@  discard block
 block discarded – undo
2840 2840
  * This function is only intended to be used for SugarCRM internal development.
2841 2841
  * The pp stands for Pre Print Trace.
2842 2842
  */
2843
-function _ppt($mixed, $textOnly=false)
2843
+function _ppt($mixed, $textOnly = false)
2844 2844
 {
2845 2845
 }
2846 2846
 
@@ -2877,7 +2877,7 @@  discard block
 block discarded – undo
2877 2877
 
2878 2878
 	// only the supported versions,
2879 2879
 	// should be mutually exclusive with $invalid_php_versions
2880
-	$supported_php_versions = array (
2880
+	$supported_php_versions = array(
2881 2881
     	'5.3.0'
2882 2882
 	);
2883 2883
 
@@ -2891,21 +2891,21 @@  discard block
 block discarded – undo
2891 2891
 	$retval = 0;
2892 2892
 
2893 2893
 	// versions below $min_considered_php_version are invalid
2894
-	if(1 == version_compare($sys_php_version, $min_considered_php_version, '<')) {
2894
+	if (1 == version_compare($sys_php_version, $min_considered_php_version, '<')) {
2895 2895
 		$retval = -1;
2896 2896
 	}
2897 2897
 
2898 2898
 	// supported version check overrides default unsupported
2899
-	foreach($supported_php_versions as $ver) {
2900
-		if(1 == version_compare($sys_php_version, $ver, 'eq') || strpos($sys_php_version,$ver) !== false) {
2899
+	foreach ($supported_php_versions as $ver) {
2900
+		if (1 == version_compare($sys_php_version, $ver, 'eq') || strpos($sys_php_version, $ver) !== false) {
2901 2901
 			$retval = 1;
2902 2902
 			break;
2903 2903
 		}
2904 2904
 	}
2905 2905
 
2906 2906
 	// invalid version check overrides default unsupported
2907
-	foreach($invalid_php_versions as $ver) {
2908
-		if(1 == version_compare($sys_php_version, $ver, 'eq') && strpos($sys_php_version,$ver) !== false) {
2907
+	foreach ($invalid_php_versions as $ver) {
2908
+		if (1 == version_compare($sys_php_version, $ver, 'eq') && strpos($sys_php_version, $ver) !== false) {
2909 2909
 			$retval = -1;
2910 2910
 			break;
2911 2911
 		}
@@ -2913,7 +2913,7 @@  discard block
 block discarded – undo
2913 2913
 
2914 2914
     //allow a redhat distro to install, regardless of version.  We are assuming the redhat naming convention is followed
2915 2915
     //and the php version contains 'rh' characters
2916
-    if(strpos($sys_php_version, 'rh') !== false) {
2916
+    if (strpos($sys_php_version, 'rh') !== false) {
2917 2917
         $retval = 1;
2918 2918
     }
2919 2919
 
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
 
2932 2932
 	$server_software = $_SERVER["SERVER_SOFTWARE"];
2933 2933
 	$iis_version = '';
2934
-	if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/",  $server_software, $out))
2934
+	if (strpos($server_software, 'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/", $server_software, $out))
2935 2935
 	    $iis_version = $out[1][0];
2936 2936
 
2937 2937
     $sys_iis_version = empty($sys_iis_version) ? $iis_version : $sys_iis_version;
@@ -2943,7 +2943,7 @@  discard block
 block discarded – undo
2943 2943
 
2944 2944
     // only the supported versions,
2945 2945
     // should be mutually exclusive with $invalid_iis_versions
2946
-    $supported_iis_versions = array ('6.0', '7.0',);
2946
+    $supported_iis_versions = array('6.0', '7.0',);
2947 2947
     $unsupported_iis_versions = array();
2948 2948
     $invalid_iis_versions = array('5.0',);
2949 2949
 
@@ -2951,29 +2951,29 @@  discard block
 block discarded – undo
2951 2951
     $retval = 0;
2952 2952
 
2953 2953
     // versions below $min_considered_iis_version are invalid
2954
-    if(1 == version_compare($sys_iis_version, $min_considered_iis_version, '<')) {
2954
+    if (1 == version_compare($sys_iis_version, $min_considered_iis_version, '<')) {
2955 2955
         $retval = -1;
2956 2956
     }
2957 2957
 
2958 2958
     // supported version check overrides default unsupported
2959
-    foreach($supported_iis_versions as $ver) {
2960
-        if(1 == version_compare($sys_iis_version, $ver, 'eq') || strpos($sys_iis_version,$ver) !== false) {
2959
+    foreach ($supported_iis_versions as $ver) {
2960
+        if (1 == version_compare($sys_iis_version, $ver, 'eq') || strpos($sys_iis_version, $ver) !== false) {
2961 2961
             $retval = 1;
2962 2962
             break;
2963 2963
         }
2964 2964
     }
2965 2965
 
2966 2966
     // unsupported version check overrides default unsupported
2967
-    foreach($unsupported_iis_versions as $ver) {
2968
-        if(1 == version_compare($sys_iis_version, $ver, 'eq') && strpos($sys_iis_version,$ver) !== false) {
2967
+    foreach ($unsupported_iis_versions as $ver) {
2968
+        if (1 == version_compare($sys_iis_version, $ver, 'eq') && strpos($sys_iis_version, $ver) !== false) {
2969 2969
             $retval = 0;
2970 2970
             break;
2971 2971
         }
2972 2972
     }
2973 2973
 
2974 2974
     // invalid version check overrides default unsupported
2975
-    foreach($invalid_iis_versions as $ver) {
2976
-        if(1 == version_compare($sys_iis_version, $ver, 'eq') && strpos($sys_iis_version,$ver) !== false) {
2975
+    foreach ($invalid_iis_versions as $ver) {
2976
+        if (1 == version_compare($sys_iis_version, $ver, 'eq') && strpos($sys_iis_version, $ver) !== false) {
2977 2977
             $retval = -1;
2978 2978
             break;
2979 2979
         }
@@ -2982,18 +2982,18 @@  discard block
 block discarded – undo
2982 2982
     return $retval;
2983 2983
 }
2984 2984
 
2985
-function pre_login_check(){
2985
+function pre_login_check() {
2986 2986
 	global $action, $login_error;
2987
-	if(!empty($action)&& $action == 'Login'){
2987
+	if (!empty($action) && $action == 'Login') {
2988 2988
 
2989
-		if(!empty($login_error)){
2989
+		if (!empty($login_error)) {
2990 2990
 			$login_error = htmlentities($login_error);
2991
-			$login_error = str_replace(array("&lt;pre&gt;","&lt;/pre&gt;","\r\n", "\n"), "<br>", $login_error);
2991
+			$login_error = str_replace(array("&lt;pre&gt;", "&lt;/pre&gt;", "\r\n", "\n"), "<br>", $login_error);
2992 2992
 			$_SESSION['login_error'] = $login_error;
2993 2993
 			echo '<script>
2994 2994
 						function set_focus() {}
2995 2995
 						if(document.getElementById("post_error")) {
2996
-							document.getElementById("post_error").innerHTML="'. $login_error. '";
2996
+							document.getElementById("post_error").innerHTML="'. $login_error.'";
2997 2997
 							document.getElementById("cant_login").value=1;
2998 2998
 							document.getElementById("login_button").disabled = true;
2999 2999
 							document.getElementById("user_name").disabled = true;
@@ -3008,10 +3008,10 @@  discard block
 block discarded – undo
3008 3008
 
3009 3009
 function sugar_cleanup($exit = false) {
3010 3010
 	static $called = false;
3011
-	if($called)return;
3011
+	if ($called)return;
3012 3012
 	$called = true;
3013
-	set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path());
3014
-	chdir(realpath(dirname(__FILE__) . '/..'));
3013
+	set_include_path(realpath(dirname(__FILE__).'/..').PATH_SEPARATOR.get_include_path());
3014
+	chdir(realpath(dirname(__FILE__).'/..'));
3015 3015
 	global $sugar_config;
3016 3016
 	require_once('include/utils/LogicHook.php');
3017 3017
 	LogicHook::initialize();
@@ -3027,20 +3027,20 @@  discard block
 block discarded – undo
3027 3027
 	}
3028 3028
 	Tracker::logPage();
3029 3029
 	// Now write the cached tracker_queries
3030
-	if(!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) {
3031
-	    if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User )
3030
+	if (!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) {
3031
+	    if (isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User)
3032 3032
 	        $GLOBALS['current_user']->savePreferencesToDB();
3033 3033
 	}
3034 3034
 
3035 3035
 	//check to see if this is not an `ajax call AND the user preference error flag is set
3036
-	if(
3036
+	if (
3037 3037
 		(isset($_SESSION['USER_PREFRENCE_ERRORS']) && $_SESSION['USER_PREFRENCE_ERRORS'])
3038
-		&& ($_REQUEST['action']!='modulelistmenu' && $_REQUEST['action']!='DynamicAction')
3039
-		&& ($_REQUEST['action']!='favorites' && $_REQUEST['action']!='DynamicAction')
3040
-		&& (empty($_REQUEST['to_pdf']) || !$_REQUEST['to_pdf'] )
3041
-		&& (empty($_REQUEST['sugar_body_only']) || !$_REQUEST['sugar_body_only'] )
3038
+		&& ($_REQUEST['action'] != 'modulelistmenu' && $_REQUEST['action'] != 'DynamicAction')
3039
+		&& ($_REQUEST['action'] != 'favorites' && $_REQUEST['action'] != 'DynamicAction')
3040
+		&& (empty($_REQUEST['to_pdf']) || !$_REQUEST['to_pdf'])
3041
+		&& (empty($_REQUEST['sugar_body_only']) || !$_REQUEST['sugar_body_only'])
3042 3042
 
3043
-	){
3043
+	) {
3044 3044
 		global $app_strings;
3045 3045
 		//this is not an ajax call and the user preference error flag is set, so reset the flag and print js to flash message
3046 3046
 		$err_mess = $app_strings['ERROR_USER_PREFS'];
@@ -3053,10 +3053,10 @@  discard block
 block discarded – undo
3053 3053
 	}
3054 3054
 
3055 3055
 	pre_login_check();
3056
-	if(class_exists('DBManagerFactory')) {
3056
+	if (class_exists('DBManagerFactory')) {
3057 3057
 		$db = DBManagerFactory::getInstance();
3058 3058
 		$db->disconnect();
3059
-		if($exit) {
3059
+		if ($exit) {
3060 3060
 			exit;
3061 3061
 		}
3062 3062
 	}
@@ -3070,27 +3070,27 @@  discard block
 block discarded – undo
3070 3070
  if not, it will add it. If the file isn't built yet, it will create the file
3071 3071
 
3072 3072
  */
3073
-function check_logic_hook_file($module_name, $event, $action_array){
3073
+function check_logic_hook_file($module_name, $event, $action_array) {
3074 3074
 	require_once('include/utils/logic_utils.php');
3075 3075
 	$add_logic = false;
3076 3076
 
3077
-	if(file_exists("custom/modules/$module_name/logic_hooks.php")){
3077
+	if (file_exists("custom/modules/$module_name/logic_hooks.php")) {
3078 3078
 
3079 3079
 		$hook_array = get_hook_array($module_name);
3080 3080
 
3081
-		if(check_existing_element($hook_array, $event, $action_array)==true){
3081
+		if (check_existing_element($hook_array, $event, $action_array) == true) {
3082 3082
 			//the hook at hand is present, so do nothing
3083 3083
 		} else {
3084 3084
 			$add_logic = true;
3085 3085
 
3086 3086
             $logic_count = 0;
3087
-            if(!empty($hook_array[$event]))
3087
+            if (!empty($hook_array[$event]))
3088 3088
             {
3089 3089
 			    $logic_count = count($hook_array[$event]);
3090 3090
             }
3091 3091
 
3092
-			if($action_array[0]==""){
3093
-				$action_array[0] = $logic_count  + 1;
3092
+			if ($action_array[0] == "") {
3093
+				$action_array[0] = $logic_count + 1;
3094 3094
 			}
3095 3095
 			$hook_array[$event][] = $action_array;
3096 3096
 
@@ -3098,14 +3098,14 @@  discard block
 block discarded – undo
3098 3098
 		//end if the file exists already
3099 3099
 	} else {
3100 3100
 		$add_logic = true;
3101
-		if($action_array[0]==""){
3101
+		if ($action_array[0] == "") {
3102 3102
 			$action_array[0] = 1;
3103 3103
 		}
3104 3104
 		$hook_array = array();
3105 3105
 		$hook_array[$event][] = $action_array;
3106 3106
 		//end if else file exists already
3107 3107
 	}
3108
-	if($add_logic == true){
3108
+	if ($add_logic == true) {
3109 3109
 
3110 3110
 		//reorder array by element[0]
3111 3111
 		//$hook_array = reorder_array($hook_array, $event);
@@ -3124,19 +3124,19 @@  discard block
 block discarded – undo
3124 3124
     require_once('include/utils/logic_utils.php');
3125 3125
 	$add_logic = false;
3126 3126
 
3127
-	if(file_exists("custom/modules/".$module_name."/logic_hooks.php")){
3127
+	if (file_exists("custom/modules/".$module_name."/logic_hooks.php")) {
3128 3128
         // The file exists, let's make sure the hook is there
3129 3129
 		$hook_array = get_hook_array($module_name);
3130 3130
 
3131
-		if(check_existing_element($hook_array, $event, $action_array)==true){
3131
+		if (check_existing_element($hook_array, $event, $action_array) == true) {
3132 3132
             // The hook is there, time to take it out.
3133 3133
 
3134
-            foreach ( $hook_array[$event] as $i => $hook ) {
3134
+            foreach ($hook_array[$event] as $i => $hook) {
3135 3135
                 // We don't do a full comparison below just in case the filename changes
3136
-                if ( $hook[0] == $action_array[0]
3136
+                if ($hook[0] == $action_array[0]
3137 3137
                      && $hook[1] == $action_array[1]
3138 3138
                      && $hook[3] == $action_array[3]
3139
-                     && $hook[4] == $action_array[4] ) {
3139
+                     && $hook[4] == $action_array[4]) {
3140 3140
                     unset($hook_array[$event][$i]);
3141 3141
                 }
3142 3142
             }
@@ -3148,53 +3148,53 @@  discard block
 block discarded – undo
3148 3148
     }
3149 3149
 }
3150 3150
 
3151
-function display_stack_trace($textOnly=false){
3151
+function display_stack_trace($textOnly = false) {
3152 3152
 
3153
-	$stack  = debug_backtrace();
3153
+	$stack = debug_backtrace();
3154 3154
 
3155
-	echo "\n\n display_stack_trace caller, file: " . $stack[0]['file']. ' line#: ' .$stack[0]['line'];
3155
+	echo "\n\n display_stack_trace caller, file: ".$stack[0]['file'].' line#: '.$stack[0]['line'];
3156 3156
 
3157
-	if(!$textOnly)
3157
+	if (!$textOnly)
3158 3158
 	echo '<br>';
3159 3159
 
3160 3160
 	$first = true;
3161 3161
 	$out = '';
3162 3162
 
3163
-	foreach($stack as $item) {
3163
+	foreach ($stack as $item) {
3164 3164
 		$file  = '';
3165 3165
 		$class = '';
3166 3166
 		$line  = '';
3167
-		$function  = '';
3167
+		$function = '';
3168 3168
 
3169
-		if(isset($item['file']))
3169
+		if (isset($item['file']))
3170 3170
 		$file = $item['file'];
3171
-		if(isset($item['class']))
3171
+		if (isset($item['class']))
3172 3172
 		$class = $item['class'];
3173
-		if(isset($item['line']))
3173
+		if (isset($item['line']))
3174 3174
 		$line = $item['line'];
3175
-		if(isset($item['function']))
3175
+		if (isset($item['function']))
3176 3176
 		$function = $item['function'];
3177 3177
 
3178
-		if(!$first) {
3179
-			if(!$textOnly) {
3178
+		if (!$first) {
3179
+			if (!$textOnly) {
3180 3180
 				$out .= '<font color="black"><b>';
3181 3181
 			}
3182 3182
 
3183 3183
 			$out .= $file;
3184 3184
 
3185
-			if(!$textOnly) {
3185
+			if (!$textOnly) {
3186 3186
 				$out .= '</b></font><font color="blue">';
3187 3187
 			}
3188 3188
 
3189 3189
 			$out .= "[L:{$line}]";
3190 3190
 
3191
-			if(!$textOnly) {
3191
+			if (!$textOnly) {
3192 3192
 				$out .= '</font><font color="red">';
3193 3193
 			}
3194 3194
 
3195 3195
 			$out .= "({$class}:{$function})";
3196 3196
 
3197
-			if(!$textOnly) {
3197
+			if (!$textOnly) {
3198 3198
 				$out .= '</font><br>';
3199 3199
 			} else {
3200 3200
 				$out .= "\n";
@@ -3207,14 +3207,14 @@  discard block
 block discarded – undo
3207 3207
 	echo $out;
3208 3208
 }
3209 3209
 
3210
-function StackTraceErrorHandler($errno, $errstr, $errfile,$errline, $errcontext) {
3211
-	$error_msg = " $errstr occurred in <b>$errfile</b> on line $errline [" . date("Y-m-d H:i:s") . ']';
3210
+function StackTraceErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) {
3211
+	$error_msg = " $errstr occurred in <b>$errfile</b> on line $errline [".date("Y-m-d H:i:s").']';
3212 3212
 	$halt_script = true;
3213
-	switch($errno){
3213
+	switch ($errno) {
3214 3214
 		case 2048: return; //depricated we have lots of these ignore them
3215 3215
 		case E_USER_NOTICE:
3216 3216
 		case E_NOTICE:
3217
-		    if ( error_reporting() & E_NOTICE ) {
3217
+		    if (error_reporting() & E_NOTICE) {
3218 3218
 		        $halt_script = false;
3219 3219
 		        $type = 'Notice';
3220 3220
 		    }
@@ -3249,10 +3249,10 @@  discard block
 block discarded – undo
3249 3249
 			$type = "Unknown Error ($errno)";
3250 3250
 			break;
3251 3251
 	}
3252
-	$error_msg = '<b>'.$type.'</b>:' . $error_msg;
3252
+	$error_msg = '<b>'.$type.'</b>:'.$error_msg;
3253 3253
 	echo $error_msg;
3254 3254
 	display_stack_trace();
3255
-	if($halt_script){
3255
+	if ($halt_script) {
3256 3256
 		exit -1;
3257 3257
 	}
3258 3258
 
@@ -3261,16 +3261,16 @@  discard block
 block discarded – undo
3261 3261
 }
3262 3262
 
3263 3263
 
3264
-if(isset($sugar_config['stack_trace_errors']) && $sugar_config['stack_trace_errors']){
3264
+if (isset($sugar_config['stack_trace_errors']) && $sugar_config['stack_trace_errors']) {
3265 3265
 
3266 3266
 	set_error_handler('StackTraceErrorHandler');
3267 3267
 }
3268
-function get_sub_cookies($name){
3268
+function get_sub_cookies($name) {
3269 3269
 	$cookies = array();
3270
-	if(isset($_COOKIE[$name])){
3270
+	if (isset($_COOKIE[$name])) {
3271 3271
 		$subs = explode('#', $_COOKIE[$name]);
3272
-		foreach($subs as $cookie){
3273
-			if(!empty($cookie)){
3272
+		foreach ($subs as $cookie) {
3273
+			if (!empty($cookie)) {
3274 3274
 				$cookie = explode('=', $cookie);
3275 3275
 
3276 3276
 				$cookies[$cookie[0]] = $cookie[1];
@@ -3282,16 +3282,16 @@  discard block
 block discarded – undo
3282 3282
 }
3283 3283
 
3284 3284
 
3285
-function mark_delete_components($sub_object_array, $run_second_level=false, $sub_sub_array=""){
3285
+function mark_delete_components($sub_object_array, $run_second_level = false, $sub_sub_array = "") {
3286 3286
 
3287
-	if(!empty($sub_object_array)){
3287
+	if (!empty($sub_object_array)) {
3288 3288
 
3289
-		foreach($sub_object_array as $sub_object){
3289
+		foreach ($sub_object_array as $sub_object) {
3290 3290
 
3291 3291
 			//run_second level is set to true if you need to remove sub-sub components
3292
-			if($run_second_level==true){
3292
+			if ($run_second_level == true) {
3293 3293
 
3294
-				mark_delete_components($sub_object->get_linked_beans($sub_sub_array['rel_field'],$sub_sub_array['rel_module']));
3294
+				mark_delete_components($sub_object->get_linked_beans($sub_sub_array['rel_field'], $sub_sub_array['rel_module']));
3295 3295
 
3296 3296
 				//end if run_second_level is true
3297 3297
 			}
@@ -3310,9 +3310,9 @@  discard block
 block discarded – undo
3310 3310
 function return_bytes($val)
3311 3311
 {
3312 3312
 	$val = trim($val);
3313
-	$last = strtolower($val{strlen($val)-1});
3313
+	$last = strtolower($val{strlen($val) - 1});
3314 3314
 
3315
-	switch($last)
3315
+	switch ($last)
3316 3316
 	{
3317 3317
 		// The 'G' modifier is available since PHP 5.1.0
3318 3318
 		case 'g':
@@ -3353,27 +3353,27 @@  discard block
 block discarded – undo
3353 3353
  * @return bool true if writable
3354 3354
  */
3355 3355
 function is_writable_windows($file) {
3356
-	if($file{strlen($file)-1}=='/') {
3356
+	if ($file{strlen($file) - 1} == '/') {
3357 3357
 		return is_writable_windows($file.uniqid(mt_rand()).'.tmp');
3358 3358
 	}
3359 3359
 
3360 3360
 	// the assumption here is that Windows has an inherited permissions scheme
3361 3361
 	// any file that is a descendant of an unwritable directory will inherit
3362 3362
 	// that property and will trigger a failure below.
3363
-	if(is_dir($file)) {
3363
+	if (is_dir($file)) {
3364 3364
 		return true;
3365 3365
 	}
3366 3366
 
3367 3367
 	$file = str_replace("/", '\\', $file);
3368 3368
 
3369
-	if(file_exists($file)) {
3369
+	if (file_exists($file)) {
3370 3370
 		if (!($f = @sugar_fopen($file, 'r+')))
3371 3371
 		return false;
3372 3372
 		fclose($f);
3373 3373
 		return true;
3374 3374
 	}
3375 3375
 
3376
-	if(!($f = @sugar_fopen($file, 'w')))
3376
+	if (!($f = @sugar_fopen($file, 'w')))
3377 3377
 	return false;
3378 3378
 	fclose($f);
3379 3379
 	unlink($file);
@@ -3389,16 +3389,16 @@  discard block
 block discarded – undo
3389 3389
     return TimeDate::guessTimezone($userOffset);
3390 3390
 }
3391 3391
 
3392
-function convert_module_to_singular($module_array){
3392
+function convert_module_to_singular($module_array) {
3393 3393
 	global $beanList;
3394 3394
 
3395
-	foreach($module_array as $key => $value){
3396
-		if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value];
3395
+	foreach ($module_array as $key => $value) {
3396
+		if (!empty($beanList[$value])) $module_array[$key] = $beanList[$value];
3397 3397
 
3398
-		if($value=="Cases") {
3398
+		if ($value == "Cases") {
3399 3399
 			$module_array[$key] = "Case";
3400 3400
 		}
3401
-		if($key=="projecttask"){
3401
+		if ($key == "projecttask") {
3402 3402
 			$module_array['ProjectTask'] = "Project Task";
3403 3403
 			unset($module_array[$key]);
3404 3404
 		}
@@ -3413,12 +3413,12 @@  discard block
 block discarded – undo
3413 3413
  * Given the bean_name which may be plural or singular return the singular
3414 3414
  * bean_name. This is important when you need to include files.
3415 3415
  */
3416
-function get_singular_bean_name($bean_name){
3416
+function get_singular_bean_name($bean_name) {
3417 3417
 	global $beanFiles, $beanList;
3418
-	if(array_key_exists($bean_name, $beanList)){
3418
+	if (array_key_exists($bean_name, $beanList)) {
3419 3419
 		return $beanList[$bean_name];
3420 3420
 	}
3421
-	else{
3421
+	else {
3422 3422
 		return $bean_name;
3423 3423
 	}
3424 3424
 }
@@ -3457,13 +3457,13 @@  discard block
 block discarded – undo
3457 3457
     return $singular;
3458 3458
 }
3459 3459
 
3460
-function get_label($label_tag, $temp_module_strings){
3460
+function get_label($label_tag, $temp_module_strings) {
3461 3461
 	global $app_strings;
3462
-	if(!empty($temp_module_strings[$label_tag])){
3462
+	if (!empty($temp_module_strings[$label_tag])) {
3463 3463
 
3464 3464
 		$label_name = $temp_module_strings[$label_tag];
3465 3465
 	} else {
3466
-		if(!empty($app_strings[$label_tag])){
3466
+		if (!empty($app_strings[$label_tag])) {
3467 3467
 			$label_name = $app_strings[$label_tag];
3468 3468
 		} else {
3469 3469
 			$label_name = $label_tag;
@@ -3475,16 +3475,16 @@  discard block
 block discarded – undo
3475 3475
 }
3476 3476
 
3477 3477
 
3478
-function search_filter_rel_info(& $focus, $tar_rel_module, $relationship_name){
3478
+function search_filter_rel_info(& $focus, $tar_rel_module, $relationship_name) {
3479 3479
 
3480 3480
 	$rel_list = array();
3481 3481
 
3482
-	foreach($focus->relationship_fields as $rel_key => $rel_value){
3483
-		if($rel_value == $relationship_name){
3482
+	foreach ($focus->relationship_fields as $rel_key => $rel_value) {
3483
+		if ($rel_value == $relationship_name) {
3484 3484
 			$temp_bean = get_module_info($tar_rel_module);
3485 3485
 	//		echo $focus->$rel_key;
3486 3486
 			$temp_bean->retrieve($focus->$rel_key);
3487
-			if($temp_bean->id!=""){
3487
+			if ($temp_bean->id != "") {
3488 3488
 
3489 3489
 				$rel_list[] = $temp_bean;
3490 3490
 				return $rel_list;
@@ -3492,9 +3492,9 @@  discard block
 block discarded – undo
3492 3492
 		}
3493 3493
 	}
3494 3494
 
3495
-	foreach($focus->field_defs as $field_name => $field_def){
3495
+	foreach ($focus->field_defs as $field_name => $field_def) {
3496 3496
 		//Check if the relationship_name matches a "relate" field
3497
-		if(!empty($field_def['type']) && $field_def['type'] == 'relate'
3497
+		if (!empty($field_def['type']) && $field_def['type'] == 'relate'
3498 3498
 		&& !empty($field_def['id_name']) && !empty($focus->field_defs[$field_def['id_name']])
3499 3499
 		&& !empty($focus->field_defs[$field_def['id_name']]['relationship'])
3500 3500
 		&& $focus->field_defs[$field_def['id_name']]['relationship'] == $relationship_name)
@@ -3502,17 +3502,17 @@  discard block
 block discarded – undo
3502 3502
 			$temp_bean = get_module_info($tar_rel_module);
3503 3503
 		//	echo $focus->$field_def['id_name'];
3504 3504
 			$temp_bean->retrieve($focus->$field_def['id_name']);
3505
-			if($temp_bean->id!=""){
3505
+			if ($temp_bean->id != "") {
3506 3506
 
3507 3507
 				$rel_list[] = $temp_bean;
3508 3508
 				return $rel_list;
3509 3509
 			}
3510 3510
 		//Check if the relationship_name matches a "link" in a relate field
3511
-		} else if(!empty($rel_value['link']) && !empty($rel_value['id_name']) && $rel_value['link'] == $relationship_name){
3511
+		} else if (!empty($rel_value['link']) && !empty($rel_value['id_name']) && $rel_value['link'] == $relationship_name) {
3512 3512
 			$temp_bean = get_module_info($tar_rel_module);
3513 3513
 		//	echo $focus->$rel_value['id_name'];
3514 3514
 			$temp_bean->retrieve($focus->$rel_value['id_name']);
3515
-			if($temp_bean->id!=""){
3515
+			if ($temp_bean->id != "") {
3516 3516
 
3517 3517
 				$rel_list[] = $temp_bean;
3518 3518
 				return $rel_list;
@@ -3521,10 +3521,10 @@  discard block
 block discarded – undo
3521 3521
 	}
3522 3522
 
3523 3523
 	// special case for unlisted parent-type relationships
3524
-	if( !empty($focus->parent_type) && $focus->parent_type == $tar_rel_module && !empty($focus->parent_id)) {
3524
+	if (!empty($focus->parent_type) && $focus->parent_type == $tar_rel_module && !empty($focus->parent_id)) {
3525 3525
 		$temp_bean = get_module_info($tar_rel_module);
3526 3526
 		$temp_bean->retrieve($focus->parent_id);
3527
-		if($temp_bean->id!=""){
3527
+		if ($temp_bean->id != "") {
3528 3528
 			$rel_list[] = $temp_bean;
3529 3529
 			return $rel_list;
3530 3530
 		}
@@ -3535,24 +3535,24 @@  discard block
 block discarded – undo
3535 3535
 	//end function search_filter_rel_info
3536 3536
 }
3537 3537
 
3538
-function get_module_info($module_name){
3538
+function get_module_info($module_name) {
3539 3539
 	global $beanList;
3540 3540
 	global $dictionary;
3541 3541
 
3542 3542
 	//Get dictionary and focus data for module
3543 3543
 	$vardef_name = $beanList[$module_name];
3544 3544
 
3545
-	if($vardef_name=="aCase"){
3545
+	if ($vardef_name == "aCase") {
3546 3546
 		$class_name = "Case";
3547 3547
 	} else {
3548 3548
 		$class_name = $vardef_name;
3549 3549
 	}
3550 3550
 
3551
-	if(!file_exists('modules/'. $module_name . '/'.$class_name.'.php')){
3551
+	if (!file_exists('modules/'.$module_name.'/'.$class_name.'.php')) {
3552 3552
 		return;
3553 3553
 	}
3554 3554
 
3555
-	include_once('modules/'. $module_name . '/'.$class_name.'.php');
3555
+	include_once('modules/'.$module_name.'/'.$class_name.'.php');
3556 3556
 
3557 3557
 	$module_bean = new $vardef_name();
3558 3558
 	return $module_bean;
@@ -3564,11 +3564,11 @@  discard block
 block discarded – undo
3564 3564
  *
3565 3565
  * @param string $moduleName
3566 3566
  */
3567
-function get_valid_bean_name($module_name){
3567
+function get_valid_bean_name($module_name) {
3568 3568
 	global $beanList;
3569 3569
 
3570 3570
 	$vardef_name = $beanList[$module_name];
3571
-	if($vardef_name=="aCase"){
3571
+	if ($vardef_name == "aCase") {
3572 3572
 		$bean_name = "Case";
3573 3573
 	} else {
3574 3574
 		$bean_name = $vardef_name;
@@ -3578,7 +3578,7 @@  discard block
 block discarded – undo
3578 3578
 
3579 3579
 
3580 3580
 
3581
-function  checkAuthUserStatus(){
3581
+function  checkAuthUserStatus() {
3582 3582
 
3583 3583
 	//authUserStatus();
3584 3584
 }
@@ -3592,7 +3592,7 @@  discard block
 block discarded – undo
3592 3592
  * @author	original by "code at adspeed dot com" Fron php.net
3593 3593
  * @author	customized for Sugar by Chris N.
3594 3594
  */
3595
-function getPhpInfo($level=-1) {
3595
+function getPhpInfo($level = -1) {
3596 3596
 	/**	Name (constant)		Value	Description
3597 3597
 		INFO_GENERAL		1		The configuration line, php.ini location, build date, Web Server, System and more.
3598 3598
 		INFO_CREDITS		2		PHP Credits. See also phpcredits().
@@ -3608,36 +3608,36 @@  discard block
 block discarded – undo
3608 3608
 	$phpinfo = ob_get_contents();
3609 3609
 	ob_end_clean();
3610 3610
 
3611
-	$phpinfo	= strip_tags($phpinfo,'<h1><h2><th><td>');
3612
-	$phpinfo	= preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$phpinfo);
3613
-	$phpinfo	= preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$phpinfo);
3611
+	$phpinfo	= strip_tags($phpinfo, '<h1><h2><th><td>');
3612
+	$phpinfo	= preg_replace('/<th[^>]*>([^<]+)<\/th>/', "<info>\\1</info>", $phpinfo);
3613
+	$phpinfo	= preg_replace('/<td[^>]*>([^<]+)<\/td>/', "<info>\\1</info>", $phpinfo);
3614 3614
 	$parsedInfo	= preg_split('/(<h.?>[^<]+<\/h.>)/', $phpinfo, -1, PREG_SPLIT_DELIM_CAPTURE);
3615
-	$match		= '';
3615
+	$match = '';
3616 3616
 	$version	= '';
3617 3617
 	$returnInfo	= array();
3618 3618
 
3619
-	if(preg_match('/<h1 class\=\"p\">PHP Version ([^<]+)<\/h1>/', $phpinfo, $version)) {
3619
+	if (preg_match('/<h1 class\=\"p\">PHP Version ([^<]+)<\/h1>/', $phpinfo, $version)) {
3620 3620
 		$returnInfo['PHP Version'] = $version[1];
3621 3621
 	}
3622 3622
 
3623 3623
 
3624
-	for ($i=1; $i<count($parsedInfo); $i++) {
3624
+	for ($i = 1; $i < count($parsedInfo); $i++) {
3625 3625
 		if (preg_match('/<h.>([^<]+)<\/h.>/', $parsedInfo[$i], $match)) {
3626 3626
 			$vName = trim($match[1]);
3627
-			$parsedInfo2 = explode("\n",$parsedInfo[$i+1]);
3627
+			$parsedInfo2 = explode("\n", $parsedInfo[$i + 1]);
3628 3628
 
3629 3629
 			foreach ($parsedInfo2 AS $vOne) {
3630
-				$vPat	= '<info>([^<]+)<\/info>';
3630
+				$vPat = '<info>([^<]+)<\/info>';
3631 3631
 				$vPat3	= "/$vPat\s*$vPat\s*$vPat/";
3632 3632
 				$vPat2	= "/$vPat\s*$vPat/";
3633 3633
 
3634
-				if (preg_match($vPat3,$vOne,$match)) { // 3cols
3635
-					$returnInfo[$vName][trim($match[1])] = array(trim($match[2]),trim($match[3]));
3636
-				} elseif (preg_match($vPat2,$vOne,$match)) { // 2cols
3634
+				if (preg_match($vPat3, $vOne, $match)) { // 3cols
3635
+					$returnInfo[$vName][trim($match[1])] = array(trim($match[2]), trim($match[3]));
3636
+				} elseif (preg_match($vPat2, $vOne, $match)) { // 2cols
3637 3637
 					$returnInfo[$vName][trim($match[1])] = trim($match[2]);
3638 3638
 				}
3639 3639
 			}
3640
-		} elseif(true) {
3640
+		} elseif (true) {
3641 3641
 
3642 3642
 		}
3643 3643
 	}
@@ -3652,7 +3652,7 @@  discard block
 block discarded – undo
3652 3652
  * @param	$args args to replace
3653 3653
  * @return	$result a formatted string
3654 3654
  */
3655
-function string_format($format, $args){
3655
+function string_format($format, $args) {
3656 3656
 	$result = $format;
3657 3657
 
3658 3658
     /** Bug47277 fix.
@@ -3670,7 +3670,7 @@  discard block
 block discarded – undo
3670 3670
     }
3671 3671
     /* End of fix */
3672 3672
 
3673
-	for($i = 0; $i < count($args); $i++){
3673
+	for ($i = 0; $i < count($args); $i++) {
3674 3674
 		$result = str_replace('{'.$i.'}', $args[$i], $result);
3675 3675
 	}
3676 3676
 	return $result;
@@ -3686,19 +3686,19 @@  discard block
 block discarded – undo
3686 3686
  * @param	$system_id from system
3687 3687
  * @return	$result a formatted string
3688 3688
  */
3689
-function format_number_display($num, $system_id){
3689
+function format_number_display($num, $system_id) {
3690 3690
 	global $sugar_config;
3691
-	if(isset($num) && !empty($num)){
3692
-		$num=unformat_number($num);
3693
-		if(isset($system_id) && $system_id == 1){
3691
+	if (isset($num) && !empty($num)) {
3692
+		$num = unformat_number($num);
3693
+		if (isset($system_id) && $system_id == 1) {
3694 3694
 			return sprintf("%d", $num);
3695 3695
 		}
3696
-		else{
3696
+		else {
3697 3697
 			return sprintf("%d-%d", $num, $system_id);
3698 3698
 		}
3699 3699
 	}
3700 3700
 }
3701
-function checkLoginUserStatus(){
3701
+function checkLoginUserStatus() {
3702 3702
 }
3703 3703
 
3704 3704
 /**
@@ -3712,11 +3712,11 @@  discard block
 block discarded – undo
3712 3712
 	$resulturl = $url;
3713 3713
 
3714 3714
 	// if no port, don't change the url
3715
-	if($port != '')
3715
+	if ($port != '')
3716 3716
 	{
3717 3717
 		$split = explode("/", $url);
3718 3718
 		//check if it starts with http, in case they didn't include that in url
3719
-		if(str_begin($url, 'http'))
3719
+		if (str_begin($url, 'http'))
3720 3720
 		{
3721 3721
 			//third index ($split[2]) will be the host
3722 3722
 			$split[2] .= ":".$port;
@@ -3739,7 +3739,7 @@  discard block
 block discarded – undo
3739 3739
  */
3740 3740
 function getJSONobj() {
3741 3741
 	static $json = null;
3742
-	if(!isset($json)) {
3742
+	if (!isset($json)) {
3743 3743
 		require_once('include/JSON.php');
3744 3744
 		$json = new JSON(JSON_LOOSE_TYPE);
3745 3745
 	}
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
 	// http://us3.php.net/manual/en/ref.pcre.php#ini.pcre.backtrack-limit
3772 3772
 	// starting with 5.2.0, backtrack_limit breaks JSON decoding
3773 3773
 	$backtrack_limit = ini_get('pcre.backtrack_limit');
3774
-	if(!empty($backtrack_limit)) {
3774
+	if (!empty($backtrack_limit)) {
3775 3775
 		ini_set('pcre.backtrack_limit', '-1');
3776 3776
 	}
3777 3777
 }
@@ -3788,19 +3788,19 @@  discard block
 block discarded – undo
3788 3788
  */
3789 3789
 function sugarLangArrayMerge($gimp, $dom)
3790 3790
 {
3791
-	if(is_array($gimp) && is_array($dom))
3791
+	if (is_array($gimp) && is_array($dom))
3792 3792
     {
3793
-		foreach($dom as $domKey => $domVal)
3793
+		foreach ($dom as $domKey => $domVal)
3794 3794
         {
3795
-			if(isset($gimp[$domKey]))
3795
+			if (isset($gimp[$domKey]))
3796 3796
             {
3797
-				if(is_array($domVal))
3797
+				if (is_array($domVal))
3798 3798
                 {
3799 3799
 					$tempArr = array();
3800
-                    foreach ( $domVal as $domArrKey => $domArrVal )
3800
+                    foreach ($domVal as $domArrKey => $domArrVal)
3801 3801
                         $tempArr[$domArrKey] = $domArrVal;
3802
-                    foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal )
3803
-                        if ( !isset($tempArr[$gimpArrKey]) )
3802
+                    foreach ($gimp[$domKey] as $gimpArrKey => $gimpArrVal)
3803
+                        if (!isset($tempArr[$gimpArrKey]))
3804 3804
                             $tempArr[$gimpArrKey] = $gimpArrVal;
3805 3805
                     $gimp[$domKey] = $tempArr;
3806 3806
 				}
@@ -3816,7 +3816,7 @@  discard block
 block discarded – undo
3816 3816
 		}
3817 3817
 	}
3818 3818
     // if the passed value for gimp isn't an array, then return the $dom
3819
-    elseif(is_array($dom))
3819
+    elseif (is_array($dom))
3820 3820
     {
3821 3821
         return $dom;
3822 3822
     }
@@ -3838,15 +3838,15 @@  discard block
 block discarded – undo
3838 3838
  * @return array beaten gimp
3839 3839
  */
3840 3840
 function sugarArrayMerge($gimp, $dom) {
3841
-	if(is_array($gimp) && is_array($dom)) {
3842
-		foreach($dom as $domKey => $domVal) {
3843
-			if(array_key_exists($domKey, $gimp)) {
3844
-				if(is_array($domVal)) {
3841
+	if (is_array($gimp) && is_array($dom)) {
3842
+		foreach ($dom as $domKey => $domVal) {
3843
+			if (array_key_exists($domKey, $gimp)) {
3844
+				if (is_array($domVal)) {
3845 3845
 					$tempArr = array();
3846
-                    foreach ( $domVal as $domArrKey => $domArrVal )
3846
+                    foreach ($domVal as $domArrKey => $domArrVal)
3847 3847
                         $tempArr[$domArrKey] = $domArrVal;
3848
-                    foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal )
3849
-                        if ( !array_key_exists($gimpArrKey, $tempArr) )
3848
+                    foreach ($gimp[$domKey] as $gimpArrKey => $gimpArrVal)
3849
+                        if (!array_key_exists($gimpArrKey, $tempArr))
3850 3850
                             $tempArr[$gimpArrKey] = $gimpArrVal;
3851 3851
                     $gimp[$domKey] = $tempArr;
3852 3852
 				} else {
@@ -3858,7 +3858,7 @@  discard block
 block discarded – undo
3858 3858
 		}
3859 3859
 	}
3860 3860
     // if the passed value for gimp isn't an array, then return the $dom
3861
-    elseif(is_array($dom))
3861
+    elseif (is_array($dom))
3862 3862
         return $dom;
3863 3863
 
3864 3864
 	return $gimp;
@@ -3872,10 +3872,10 @@  discard block
 block discarded – undo
3872 3872
  * @return array beaten gimp
3873 3873
  */
3874 3874
 function sugarArrayMergeRecursive($gimp, $dom) {
3875
-	if(is_array($gimp) && is_array($dom)) {
3876
-		foreach($dom as $domKey => $domVal) {
3877
-			if(array_key_exists($domKey, $gimp)) {
3878
-				if(is_array($domVal) && is_array($gimp[$domKey])) {
3875
+	if (is_array($gimp) && is_array($dom)) {
3876
+		foreach ($dom as $domKey => $domVal) {
3877
+			if (array_key_exists($domKey, $gimp)) {
3878
+				if (is_array($domVal) && is_array($gimp[$domKey])) {
3879 3879
 					$gimp[$domKey] = sugarArrayMergeRecursive($gimp[$domKey], $domVal);
3880 3880
 				} else {
3881 3881
 					$gimp[$domKey] = $domVal;
@@ -3886,7 +3886,7 @@  discard block
 block discarded – undo
3886 3886
 		}
3887 3887
 	}
3888 3888
     // if the passed value for gimp isn't an array, then return the $dom
3889
-    elseif(is_array($dom))
3889
+    elseif (is_array($dom))
3890 3890
         return $dom;
3891 3891
 
3892 3892
 	return $gimp;
@@ -3897,7 +3897,7 @@  discard block
 block discarded – undo
3897 3897
  * @return bool True if NOT found or WRONG version
3898 3898
  */
3899 3899
 function returnPhpJsonStatus() {
3900
-	if(function_exists('json_encode')) {
3900
+	if (function_exists('json_encode')) {
3901 3901
 		$phpInfo = getPhpInfo(8);
3902 3902
         return version_compare($phpInfo['json']['json version'], '1.1.1', '<');
3903 3903
 	}
@@ -3924,16 +3924,16 @@  discard block
 block discarded – undo
3924 3924
 
3925 3925
 	global $sugar_config;
3926 3926
 
3927
-	if(!isset($max_tracker_item_length)) {
3928
-		if(isset($sugar_config['tracker_max_display_length'])) {
3927
+	if (!isset($max_tracker_item_length)) {
3928
+		if (isset($sugar_config['tracker_max_display_length'])) {
3929 3929
 	      $max_tracker_item_length = (is_int($sugar_config['tracker_max_display_length']) && $sugar_config['tracker_max_display_length'] > 0 && $sugar_config['tracker_max_display_length'] < 50) ? $sugar_config['tracker_max_display_length'] : 15;
3930 3930
 		} else {
3931 3931
 	      $max_tracker_item_length = 15;
3932 3932
 		}
3933 3933
 	}
3934 3934
 
3935
-	if($strlen > $max_tracker_item_length) {
3936
-		$chopped = function_exists('mb_substr') ? mb_substr($name, 0, $max_tracker_item_length-3, "UTF-8") : substr($name, 0, $max_tracker_item_length-3);
3935
+	if ($strlen > $max_tracker_item_length) {
3936
+		$chopped = function_exists('mb_substr') ? mb_substr($name, 0, $max_tracker_item_length - 3, "UTF-8") : substr($name, 0, $max_tracker_item_length - 3);
3937 3937
 		$chopped .= "...";
3938 3938
 	} else {
3939 3939
 		$chopped = $name;
@@ -3941,51 +3941,51 @@  discard block
 block discarded – undo
3941 3941
 
3942 3942
 	return $chopped;
3943 3943
 }
3944
-function generate_search_where ($field_list=array(),$values=array(),&$bean,$add_custom_fields=false,$module='') {
3945
-	$where_clauses= array();
3946
-	$like_char='%';
3947
-	$table_name=$bean->object_name;
3944
+function generate_search_where($field_list = array(), $values = array(), &$bean, $add_custom_fields = false, $module = '') {
3945
+	$where_clauses = array();
3946
+	$like_char = '%';
3947
+	$table_name = $bean->object_name;
3948 3948
 	foreach ($field_list[$module] as $field=>$parms) {
3949
-		if(isset($values[$field]) && $values[$field] != "") {
3950
-			$operator='like';
3949
+		if (isset($values[$field]) && $values[$field] != "") {
3950
+			$operator = 'like';
3951 3951
 			if (!empty($parms['operator'])) {
3952
-				$operator=$parms['operator'];
3952
+				$operator = $parms['operator'];
3953 3953
 			}
3954 3954
 			if (is_array($values[$field])) {
3955
-				$operator='in';
3956
-				$field_value='';
3955
+				$operator = 'in';
3956
+				$field_value = '';
3957 3957
 				foreach ($values[$field] as $key => $val) {
3958 3958
 					if ($val != ' ' and $val != '') {
3959 3959
 						if (!empty($field_value)) {
3960
-							$field_value.=',';
3960
+							$field_value .= ',';
3961 3961
 						}
3962 3962
 						$field_value .= "'".$GLOBALS['db']->quote($val)."'";
3963 3963
 					}
3964 3964
 				}
3965 3965
 			} else {
3966
-				$field_value=$GLOBALS['db']->quote($values[$field]);
3966
+				$field_value = $GLOBALS['db']->quote($values[$field]);
3967 3967
 			}
3968 3968
 			//set db_fields array.
3969
-			if (!isset($parms['db_field']) )  {
3969
+			if (!isset($parms['db_field'])) {
3970 3970
 				$parms['db_field'] = array($field);
3971 3971
 			}
3972 3972
 			if (isset($parms['my_items']) and $parms['my_items'] == true) {
3973 3973
 				global $current_user;
3974 3974
 				$field_value = $GLOBALS['db']->quote($current_user->id);
3975
-				$operator='=';
3975
+				$operator = '=';
3976 3976
 			}
3977 3977
 
3978
-			$where='';
3979
-			$itr=0;
3978
+			$where = '';
3979
+			$itr = 0;
3980 3980
 			if ($field_value != '') {
3981 3981
 
3982 3982
 				foreach ($parms['db_field'] as $db_field) {
3983
-					if (strstr($db_field,'.')===false) {
3984
-						$db_field=$bean->table_name.".".$db_field;
3983
+					if (strstr($db_field, '.') === false) {
3984
+						$db_field = $bean->table_name.".".$db_field;
3985 3985
 					}
3986
-					if ($GLOBALS['db']->supports('case_sensitive') &&  isset($parms['query_type']) && $parms['query_type']=='case_insensitive') {
3987
-						$db_field='upper('.$db_field.")";
3988
-						$field_value=strtoupper($field_value);
3986
+					if ($GLOBALS['db']->supports('case_sensitive') && isset($parms['query_type']) && $parms['query_type'] == 'case_insensitive') {
3987
+						$db_field = 'upper('.$db_field.")";
3988
+						$field_value = strtoupper($field_value);
3989 3989
 					}
3990 3990
 
3991 3991
 					$itr++;
@@ -3994,19 +3994,19 @@  discard block
 block discarded – undo
3994 3994
 					}
3995 3995
 					switch (strtolower($operator)) {
3996 3996
 						case 'like' :
3997
-							$where .=  $db_field . " like '".$field_value.$like_char."'";
3997
+							$where .= $db_field." like '".$field_value.$like_char."'";
3998 3998
 							break;
3999 3999
 						case 'in':
4000
-							$where .=  $db_field . " in (".$field_value.')';
4000
+							$where .= $db_field." in (".$field_value.')';
4001 4001
 							break;
4002 4002
 						case '=':
4003
-							$where .=  $db_field . " = '".$field_value ."'";
4003
+							$where .= $db_field." = '".$field_value."'";
4004 4004
 							break;
4005 4005
 					}
4006 4006
 				}
4007 4007
 			}
4008 4008
 			if (!empty($where)) {
4009
-				if ($itr>1) {
4009
+				if ($itr > 1) {
4010 4010
 					array_push($where_clauses, '( '.$where.' )');
4011 4011
 				} else {
4012 4012
 					array_push($where_clauses, $where);
@@ -4034,13 +4034,13 @@  discard block
 block discarded – undo
4034 4034
  */
4035 4035
 function rebuildConfigFile($sugar_config, $sugar_version) {
4036 4036
 	// add defaults to missing values of in-memory sugar_config
4037
-	$sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config );
4037
+	$sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
4038 4038
 	// need to override version with default no matter what
4039 4039
 	$sugar_config['sugar_version'] = $sugar_version;
4040 4040
 
4041
-	ksort( $sugar_config );
4041
+	ksort($sugar_config);
4042 4042
 
4043
-	if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
4043
+	if (write_array_to_file("sugar_config", $sugar_config, "config.php")) {
4044 4044
 		return true;
4045 4045
 	}
4046 4046
 	else {
@@ -4073,40 +4073,40 @@  discard block
 block discarded – undo
4073 4073
  */
4074 4074
 function getJavascriptSiteURL() {
4075 4075
 	global $sugar_config;
4076
-	if(!empty($_SERVER['HTTP_REFERER'])) {
4076
+	if (!empty($_SERVER['HTTP_REFERER'])) {
4077 4077
 		$url = parse_url($_SERVER['HTTP_REFERER']);
4078 4078
 		$replacement_url = $url['scheme']."://".$url['host'];
4079
-		if(!empty($url['port']))
4079
+		if (!empty($url['port']))
4080 4080
 		$replacement_url .= ':'.$url['port'];
4081
-		$site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']);
4081
+		$site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/', $replacement_url, $sugar_config['site_url']);
4082 4082
 	} else {
4083
-		$site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/',"http$1://".$_SERVER['HTTP_HOST'],$sugar_config['site_url']);
4084
-		if(!empty($_SERVER['SERVER_PORT']) &&$_SERVER['SERVER_PORT'] == '443') {
4085
-			$site_url = preg_replace('/^http\:/','https:',$site_url);
4083
+		$site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/', "http$1://".$_SERVER['HTTP_HOST'], $sugar_config['site_url']);
4084
+		if (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
4085
+			$site_url = preg_replace('/^http\:/', 'https:', $site_url);
4086 4086
 		}
4087 4087
 	}
4088
-	$GLOBALS['log']->debug("getJavascriptSiteURL(), site_url=".  $site_url);
4088
+	$GLOBALS['log']->debug("getJavascriptSiteURL(), site_url=".$site_url);
4089 4089
 	return $site_url;
4090 4090
 }
4091 4091
 
4092 4092
 // works nicely with array_map() -- can be used to wrap single quotes around each element in an array
4093 4093
 function add_squotes($str) {
4094
-	return "'" . $str . "'";
4094
+	return "'".$str."'";
4095 4095
 }
4096 4096
 
4097 4097
 
4098 4098
 // recursive function to count the number of levels within an array
4099
-function array_depth($array, $depth_count=-1, $depth_array=array()){
4099
+function array_depth($array, $depth_count = -1, $depth_array = array()) {
4100 4100
 	$depth_count++;
4101
-	if (is_array($array)){
4102
-		foreach ($array as $key => $value){
4101
+	if (is_array($array)) {
4102
+		foreach ($array as $key => $value) {
4103 4103
 			$depth_array[] = array_depth($value, $depth_count);
4104 4104
 		}
4105 4105
 	}
4106
-	else{
4106
+	else {
4107 4107
 		return $depth_count;
4108 4108
 	}
4109
-	foreach ($depth_array as $value){
4109
+	foreach ($depth_array as $value) {
4110 4110
 		$depth_count = $value > $depth_count ? $value : $depth_count;
4111 4111
 	}
4112 4112
 	return $depth_count;
@@ -4125,7 +4125,7 @@  discard block
 block discarded – undo
4125 4125
 	$group->last_name	= $name;
4126 4126
 	$group->is_group	= 1;
4127 4127
 	$group->deleted		= 0;
4128
-	$group->status		= 'Active'; // cn: bug 6711
4128
+	$group->status = 'Active'; // cn: bug 6711
4129 4129
 	$group->setPreference('timezone', TimeDate::userTimezone());
4130 4130
 	$group->save();
4131 4131
 
@@ -4143,19 +4143,19 @@  discard block
 block discarded – undo
4143 4143
 {
4144 4144
 
4145 4145
 	$iconName = "icon_{$iconFileName}.gif";
4146
-    $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4146
+    $iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
4147 4147
 
4148 4148
     //First try un-ucfirst-ing the icon name
4149
-    if ( empty($iconFound) )
4150
-		$iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif";
4151
-        $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4149
+    if (empty($iconFound))
4150
+		$iconName = "icon_".strtolower(substr($iconFileName, 0, 1)).substr($iconFileName, 1).".gif";
4151
+        $iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
4152 4152
 
4153 4153
 	//Next try removing the icon prefix
4154
-    if ( empty($iconFound) )
4154
+    if (empty($iconFound))
4155 4155
 		$iconName = "{$iconFileName}.gif";
4156
-		$iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4156
+		$iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
4157 4157
 
4158
-	if ( empty($iconFound) )
4158
+	if (empty($iconFound))
4159 4159
 		$iconName = '';
4160 4160
 
4161 4161
   	return $iconName;
@@ -4171,12 +4171,12 @@  discard block
 block discarded – undo
4171 4171
  * @return string $string <img> tag with corresponding image
4172 4172
  */
4173 4173
 
4174
-function getStudioIcon($iconFileName='', $altFileName='', $width='48', $height='48', $align='baseline', $alt='' )
4174
+function getStudioIcon($iconFileName = '', $altFileName = '', $width = '48', $height = '48', $align = 'baseline', $alt = '')
4175 4175
 {
4176 4176
 	global $app_strings, $theme;
4177 4177
 
4178 4178
     $iconName = _getIcon($iconFileName);
4179
- 	if(empty($iconName)){
4179
+ 	if (empty($iconName)) {
4180 4180
  	    $iconName = _getIcon($altFileName);
4181 4181
  	    if (empty($iconName))
4182 4182
  	    {
@@ -4197,14 +4197,14 @@  discard block
 block discarded – undo
4197 4197
  * @return string $string <img> tag with corresponding image
4198 4198
  */
4199 4199
 
4200
-function get_dashlets_dialog_icon($module='', $width='32', $height='32', $align='absmiddle',$alt=''){
4200
+function get_dashlets_dialog_icon($module = '', $width = '32', $height = '32', $align = 'absmiddle', $alt = '') {
4201 4201
 	global $app_strings, $theme;
4202
- 	$iconName = _getIcon($module . "_32");
4202
+ 	$iconName = _getIcon($module."_32");
4203 4203
  	if (empty($iconName))
4204 4204
  	{
4205 4205
  		$iconName = _getIcon($module);
4206 4206
  	}
4207
- 	if(empty($iconName)){
4207
+ 	if (empty($iconName)) {
4208 4208
  		return $app_strings['LBL_NO_IMAGE'];
4209 4209
  	}
4210 4210
 	return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height);
@@ -4232,9 +4232,9 @@  discard block
 block discarded – undo
4232 4232
 function code2utf($num)
4233 4233
 {
4234 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);
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);
4238 4238
     return '';
4239 4239
 }
4240 4240
 
@@ -4287,7 +4287,7 @@  discard block
 block discarded – undo
4287 4287
  */
4288 4288
 function chartColors()
4289 4289
 {
4290
-	if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='')
4290
+	if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml') == '')
4291 4291
 	return SugarThemeRegistry::current()->getImageURL('sugarColors.xml');
4292 4292
     return SugarThemeRegistry::current()->getCSSURL('sugarColors.xml');
4293 4293
 }
@@ -4316,10 +4316,10 @@  discard block
 block discarded – undo
4316 4316
     $path = trim($path);
4317 4317
 
4318 4318
     // try to match absolute paths like \\server\share, /directory or c:\
4319
-    if ( ( substr($path,0,2) == '\\\\' )
4320
-            || ( $path[0] == '/' )
4321
-            || preg_match('/^[A-z]:/i',$path)
4322
-            || $currentServer )
4319
+    if ((substr($path, 0, 2) == '\\\\')
4320
+            || ($path[0] == '/')
4321
+            || preg_match('/^[A-z]:/i', $path)
4322
+            || $currentServer)
4323 4323
         return $path;
4324 4324
 
4325 4325
     return getcwd().'/'.$path;
@@ -4348,12 +4348,12 @@  discard block
 block discarded – undo
4348 4348
     $ua = empty($_SERVER['HTTP_USER_AGENT']) ? "undefined" : strtolower($_SERVER['HTTP_USER_AGENT']);
4349 4349
 
4350 4350
     // first check if we have forced use of the touch enhanced interface
4351
-    if ( isset($_COOKIE['touchscreen']) && $_COOKIE['touchscreen'] == '1' ) {
4351
+    if (isset($_COOKIE['touchscreen']) && $_COOKIE['touchscreen'] == '1') {
4352 4352
         return true;
4353 4353
     }
4354 4354
 
4355 4355
     // next check if we should use the touch interface with our device
4356
-    if ( strpos($ua, 'ipad') !== false ) {
4356
+    if (strpos($ua, 'ipad') !== false) {
4357 4357
         return true;
4358 4358
     }
4359 4359
 
@@ -4367,30 +4367,30 @@  discard block
 block discarded – undo
4367 4367
  */
4368 4368
 function get_alt_hot_key() {
4369 4369
 	$ua = '';
4370
-    if ( isset($_SERVER['HTTP_USER_AGENT']) )
4370
+    if (isset($_SERVER['HTTP_USER_AGENT']))
4371 4371
         $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
4372 4372
 	$isMac = strpos($ua, 'mac') !== false;
4373 4373
 	$isLinux = strpos($ua, 'linux') !== false;
4374 4374
 
4375
-	if(!$isMac && !$isLinux && strpos($ua, 'mozilla') !== false) {
4376
-	   if(preg_match('/firefox\/(\d)?\./', $ua, $matches)) {
4375
+	if (!$isMac && !$isLinux && strpos($ua, 'mozilla') !== false) {
4376
+	   if (preg_match('/firefox\/(\d)?\./', $ua, $matches)) {
4377 4377
 	   	  return $matches[1] < 2 ? 'Alt+' : 'Alt+Shift+';
4378 4378
 	   }
4379 4379
 	}
4380 4380
 	return $isMac ? 'Ctrl+' : 'Alt+';
4381 4381
 }
4382 4382
 
4383
-function can_start_session(){
4384
-	if(!empty($_GET['PHPSESSID'])) {
4383
+function can_start_session() {
4384
+	if (!empty($_GET['PHPSESSID'])) {
4385 4385
 	   return true;
4386 4386
 	}
4387 4387
 	$session_id = session_id();
4388 4388
 	return empty($session_id) ? true : false;
4389 4389
 }
4390 4390
 
4391
-function load_link_class($properties){
4391
+function load_link_class($properties) {
4392 4392
 	$class = 'Link2';
4393
-	if(!empty($properties['link_class']) && !empty($properties['link_file'])){
4393
+	if (!empty($properties['link_class']) && !empty($properties['link_file'])) {
4394 4394
     	require_once($properties['link_file']);
4395 4395
     	$class = $properties['link_class'];
4396 4396
     }
@@ -4410,9 +4410,9 @@  discard block
 block discarded – undo
4410 4410
  */
4411 4411
 function filterInboundEmailPopSelection($protocol)
4412 4412
 {
4413
-    if ( !isset($GLOBALS['sugar_config']['allow_pop_inbound']) || ! $GLOBALS['sugar_config']['allow_pop_inbound'] )
4413
+    if (!isset($GLOBALS['sugar_config']['allow_pop_inbound']) || !$GLOBALS['sugar_config']['allow_pop_inbound'])
4414 4414
     {
4415
-        if( isset($protocol['pop3']) )
4415
+        if (isset($protocol['pop3']))
4416 4416
 			unset($protocol['pop3']);
4417 4417
     }
4418 4418
     else
@@ -4427,10 +4427,10 @@  discard block
 block discarded – undo
4427 4427
  * The varchar in MySQL, Orcale, and nvarchar in FreeTDS, we can store $length mutilbyte charaters in it. we need mb_substr to keep more info.
4428 4428
 * @returns the substred strings.
4429 4429
  */
4430
-function sugar_substr($string, $length, $charset='UTF-8')
4430
+function sugar_substr($string, $length, $charset = 'UTF-8')
4431 4431
 {
4432
-    if(mb_strlen($string,$charset) > $length) {
4433
-        $string = trim(mb_substr(trim($string),0,$length,$charset));
4432
+    if (mb_strlen($string, $charset) > $length) {
4433
+        $string = trim(mb_substr(trim($string), 0, $length, $charset));
4434 4434
     }
4435 4435
     return $string;
4436 4436
 }
@@ -4439,8 +4439,8 @@  discard block
 block discarded – undo
4439 4439
  * The function is used because on FastCGI enviroment, the ucfirst(Chinese Characters) will produce bad charcters.
4440 4440
  * This will work even without setting the mbstring.*encoding
4441 4441
  */
4442
-function sugar_ucfirst($string, $charset='UTF-8') {
4443
-    return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset) . mb_substr($string, 1, mb_strlen($string), $charset);
4442
+function sugar_ucfirst($string, $charset = 'UTF-8') {
4443
+    return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_substr($string, 1, mb_strlen($string), $charset);
4444 4444
 }
4445 4445
 
4446 4446
 
@@ -4452,8 +4452,8 @@  discard block
 block discarded – undo
4452 4452
 	{
4453 4453
 	   return $string;
4454 4454
 	}
4455
-	if (substr($string, 0 ,1) == "^" && substr($string, -1) == "^") {
4456
-          $string = substr(substr($string, 1), 0, strlen($string) -2);
4455
+	if (substr($string, 0, 1) == "^" && substr($string, -1) == "^") {
4456
+          $string = substr(substr($string, 1), 0, strlen($string) - 2);
4457 4457
 	}
4458 4458
 
4459 4459
 	return explode('^,^', $string);
@@ -4466,7 +4466,7 @@  discard block
 block discarded – undo
4466 4466
     if (empty($arr))
4467 4467
         return "";
4468 4468
 
4469
-	$string = "^" . implode('^,^', $arr) . "^";
4469
+	$string = "^".implode('^,^', $arr)."^";
4470 4470
 
4471 4471
     return $string;
4472 4472
 }
@@ -4481,19 +4481,19 @@  discard block
 block discarded – undo
4481 4481
  * @return $ret_array['where']: corrected where clause
4482 4482
  * @return $ret_array['join']: extra join condition
4483 4483
  */
4484
-function create_export_query_relate_link_patch($module, $searchFields, $where){
4485
-	if(file_exists('modules/'.$module.'/SearchForm.html')){
4484
+function create_export_query_relate_link_patch($module, $searchFields, $where) {
4485
+	if (file_exists('modules/'.$module.'/SearchForm.html')) {
4486 4486
 		$ret_array['where'] = $where;
4487 4487
 		return $ret_array;
4488 4488
 	}
4489 4489
 	$seed = loadBean($module);
4490
-    foreach($seed->field_defs as $name=>$field)
4490
+    foreach ($seed->field_defs as $name=>$field)
4491 4491
 	{
4492 4492
 
4493
-		if( $field['type'] == 'relate' && isset($field['link']) && !empty($searchFields[$name]['value']) ){
4493
+		if ($field['type'] == 'relate' && isset($field['link']) && !empty($searchFields[$name]['value'])) {
4494 4494
 			$seed->load_relationship($field['link']);
4495 4495
 			$params = array();
4496
-			if(empty($join_type))
4496
+			if (empty($join_type))
4497 4497
 			{
4498 4498
 				$params['join_type'] = ' LEFT JOIN ';
4499 4499
 			}
@@ -4501,16 +4501,16 @@  discard block
 block discarded – undo
4501 4501
 			{
4502 4502
 				$params['join_type'] = $join_type;
4503 4503
 			}
4504
-			if(isset($data['join_name']))
4504
+			if (isset($data['join_name']))
4505 4505
 			{
4506 4506
 				$params['join_table_alias'] = $field['join_name'];
4507 4507
 			}
4508 4508
 			else
4509 4509
 			{
4510
-				$params['join_table_alias']	= 'join_'.$field['name'];
4510
+				$params['join_table_alias'] = 'join_'.$field['name'];
4511 4511
 
4512 4512
 			}
4513
-			if(isset($data['join_link_name']))
4513
+			if (isset($data['join_link_name']))
4514 4514
 			{
4515 4515
 				$params['join_table_link_alias'] = $field['join_link_name'];
4516 4516
 			}
@@ -4520,11 +4520,11 @@  discard block
 block discarded – undo
4520 4520
 			}
4521 4521
 			$join = $seed->$field['link']->getJoin($params, true);
4522 4522
 			$join_table_alias = 'join_'.$field['name'];
4523
-			if(isset($field['db_concat_fields'])){
4523
+			if (isset($field['db_concat_fields'])) {
4524 4524
 				$db_field = db_concat($join_table_alias, $field['db_concat_fields']);
4525 4525
 				$where = preg_replace('/'.$field['name'].'/', $db_field, $where);
4526
-			}else{
4527
-				$where = preg_replace('/(^|[\s(])' . $field['name'] . '/', '${1}' . $join_table_alias . '.'.$field['rname'], $where);
4526
+			} else {
4527
+				$where = preg_replace('/(^|[\s(])'.$field['name'].'/', '${1}'.$join_table_alias.'.'.$field['rname'], $where);
4528 4528
 			}
4529 4529
 		}
4530 4530
 	}
@@ -4537,11 +4537,11 @@  discard block
 block discarded – undo
4537 4537
   * @Depends on QuickRepairAndRebuild.php
4538 4538
   * @Relate bug 30642  ,23177
4539 4539
   */
4540
-function clearAllJsAndJsLangFilesWithoutOutput(){
4541
-		global $current_language , $mod_strings;
4540
+function clearAllJsAndJsLangFilesWithoutOutput() {
4541
+		global $current_language, $mod_strings;
4542 4542
 		$MBmodStrings = $mod_strings;
4543
-        $mod_strings = return_module_language ( $current_language, 'Administration' ) ;
4544
-        include_once ('modules/Administration/QuickRepairAndRebuild.php') ;
4543
+        $mod_strings = return_module_language($current_language, 'Administration');
4544
+        include_once ('modules/Administration/QuickRepairAndRebuild.php');
4545 4545
         $repair = new RepairAndClear();
4546 4546
         $repair->module_list = array();
4547 4547
 		$repair->show_output = false;
@@ -4553,13 +4553,13 @@  discard block
 block discarded – undo
4553 4553
 /**
4554 4554
  * This function will allow you to get a variable value from query string
4555 4555
  */
4556
-function getVariableFromQueryString($variable, $string){
4556
+function getVariableFromQueryString($variable, $string) {
4557 4557
 	$matches = array();
4558 4558
 	$number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches);
4559
-	if($number){
4559
+	if ($number) {
4560 4560
 		return $matches[1];
4561 4561
 	}
4562
-	else{
4562
+	else {
4563 4563
 		return false;
4564 4564
 	}
4565 4565
 }
@@ -4573,8 +4573,8 @@  discard block
 block discarded – undo
4573 4573
  */
4574 4574
 function should_hide_iframes() {
4575 4575
    //Remove the MySites module
4576
-   if(file_exists('modules/iFrames/iFrame.php')) {
4577
-        if(!class_exists("iFrame")) {
4576
+   if (file_exists('modules/iFrames/iFrame.php')) {
4577
+        if (!class_exists("iFrame")) {
4578 4578
                 require_once('modules/iFrames/iFrame.php');
4579 4579
         }
4580 4580
         return false;
@@ -4588,10 +4588,10 @@  discard block
 block discarded – undo
4588 4588
  * @param string $version
4589 4589
  * @return string RC, BETA, GA
4590 4590
  */
4591
-function getVersionStatus($version){
4592
-	if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) {
4591
+function getVersionStatus($version) {
4592
+	if (preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) {
4593 4593
 		return strtoupper($matches[1]);
4594
-	}else{
4594
+	} else {
4595 4595
 		return 'GA';
4596 4596
 	}
4597 4597
 }
@@ -4603,12 +4603,12 @@  discard block
 block discarded – undo
4603 4603
  * @param string $version
4604 4604
  * @return version
4605 4605
  */
4606
-function getMajorMinorVersion($version){
4607
-	if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){
4606
+function getMajorMinorVersion($version) {
4607
+	if (preg_match('/^([\d\.]+).*$/si', $version, $matches2)) {
4608 4608
 		$version = $matches2[1];
4609 4609
 		$arr = explode('.', $version);
4610
-		if(count($arr) > 2){
4611
-			if($arr[2] == '0'){
4610
+		if (count($arr) > 2) {
4611
+			if ($arr[2] == '0') {
4612 4612
 				$version = substr($version, 0, 3);
4613 4613
 			}
4614 4614
 		}
@@ -4636,10 +4636,10 @@  discard block
 block discarded – undo
4636 4636
 {
4637 4637
 	$lines = explode("<br>", trim($string));
4638 4638
 	$urls = array();
4639
-	foreach($lines as $line){
4639
+	foreach ($lines as $line) {
4640 4640
     	$regex = '/http?\:\/\/[^\" ]+/i';
4641 4641
     	preg_match_all($regex, $line, $matches);
4642
-    	foreach($matches[0] as $match){
4642
+    	foreach ($matches[0] as $match) {
4643 4643
     		$urls[] = $match;
4644 4644
     	}
4645 4645
 	}
@@ -4654,20 +4654,20 @@  discard block
 block discarded – undo
4654 4654
  */
4655 4655
 function verify_image_file($path, $jpeg = false)
4656 4656
 {
4657
-	if(function_exists('imagepng') && function_exists('imagejpeg') && function_exists('imagecreatefromstring')) {
4657
+	if (function_exists('imagepng') && function_exists('imagejpeg') && function_exists('imagecreatefromstring')) {
4658 4658
         $img = imagecreatefromstring(file_get_contents($path));
4659
-    	if(!$img) {
4659
+    	if (!$img) {
4660 4660
     	    return false;
4661 4661
     	}
4662 4662
     	$img_size = getimagesize($path);
4663 4663
 		$filetype = $img_size['mime'];
4664 4664
 		//if filetype is jpeg or if we are only allowing jpegs, create jpg image
4665
-        if($filetype == "image/jpeg" || $jpeg) {
4665
+        if ($filetype == "image/jpeg" || $jpeg) {
4666 4666
             ob_start();
4667 4667
             imagejpeg($img);
4668 4668
             $image = ob_get_clean();
4669 4669
             // not writing directly because imagejpeg does not work with streams
4670
-            if(file_put_contents($path, $image)) {
4670
+            if (file_put_contents($path, $image)) {
4671 4671
                 return true;
4672 4672
             }
4673 4673
         } elseif ($filetype == "image/png") {
@@ -4677,7 +4677,7 @@  discard block
 block discarded – undo
4677 4677
         	ob_start();
4678 4678
             imagepng($img);
4679 4679
             $image = ob_get_clean();
4680
-    	    if(file_put_contents($path, $image)) {
4680
+    	    if (file_put_contents($path, $image)) {
4681 4681
                 return true;
4682 4682
     	    }
4683 4683
         } else {
@@ -4686,15 +4686,15 @@  discard block
 block discarded – undo
4686 4686
 	} else {
4687 4687
 	    // check image manually
4688 4688
         $fp = fopen($path, "rb");
4689
-        if(!$fp) return false;
4689
+        if (!$fp) return false;
4690 4690
         $data = '';
4691 4691
         // read the whole file in chunks
4692
-        while(!feof($fp)) {
4693
-            $data .= fread($fp,8192);
4692
+        while (!feof($fp)) {
4693
+            $data .= fread($fp, 8192);
4694 4694
         }
4695 4695
 
4696 4696
 	    fclose($fp);
4697
-	    if(preg_match("/<(\?php|html|!doctype|script|body|head|plaintext|table|img |pre(>| )|frameset|iframe|object|link|base|style|font|applet|meta|center|form|isindex)/i",
4697
+	    if (preg_match("/<(\?php|html|!doctype|script|body|head|plaintext|table|img |pre(>| )|frameset|iframe|object|link|base|style|font|applet|meta|center|form|isindex)/i",
4698 4698
 	         $data, $m)) {
4699 4699
 	        $GLOBALS['log']->fatal("Found {$m[0]} in $path, not allowing upload");
4700 4700
 	        return false;
@@ -4713,18 +4713,18 @@  discard block
 block discarded – undo
4713 4713
 function verify_uploaded_image($path, $jpeg_only = false)
4714 4714
 {
4715 4715
     $supportedExtensions = array('jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg');
4716
-    if(!$jpeg_only) {
4716
+    if (!$jpeg_only) {
4717 4717
         $supportedExtensions['png'] = 'image/png';
4718 4718
     }
4719 4719
 
4720
-    if(!file_exists($path) || !is_file($path)) {
4720
+    if (!file_exists($path) || !is_file($path)) {
4721 4721
 	    return false;
4722 4722
 	}
4723 4723
 
4724 4724
 	$img_size = getimagesize($path);
4725 4725
 	$filetype = $img_size['mime'];
4726 4726
 	$ext = end(explode(".", $path));
4727
-	if(substr_count('..', $path) > 0 || ($ext !== $path && !isset($supportedExtensions[strtolower($ext)])) ||
4727
+	if (substr_count('..', $path) > 0 || ($ext !== $path && !isset($supportedExtensions[strtolower($ext)])) ||
4728 4728
 	    !in_array($filetype, array_values($supportedExtensions))) {
4729 4729
 	        return false;
4730 4730
 	}
@@ -4735,7 +4735,7 @@  discard block
 block discarded – undo
4735 4735
 {
4736 4736
     global $sugar_web_service_order_by;
4737 4737
     //If the order_by field is not valid, return 0;
4738
-    if (empty($sugar_web_service_order_by) || !isset($a->$sugar_web_service_order_by) || !isset($b->$sugar_web_service_order_by)){
4738
+    if (empty($sugar_web_service_order_by) || !isset($a->$sugar_web_service_order_by) || !isset($b->$sugar_web_service_order_by)) {
4739 4739
         return 0;
4740 4740
     }
4741 4741
     if (is_object($a->$sugar_web_service_order_by) || is_object($b->$sugar_web_service_order_by)
@@ -4778,13 +4778,13 @@  discard block
 block discarded – undo
4778 4778
     // add wildcard at the beginning of the search string
4779 4779
     if (isset($GLOBALS['sugar_config']['search_wildcard_infront']) &&
4780 4780
         $GLOBALS['sugar_config']['search_wildcard_infront'] == true) {
4781
-        if (substr($str,0,1) <> $wildcard)
4781
+        if (substr($str, 0, 1) <> $wildcard)
4782 4782
           $str = $wildcard.$str;
4783 4783
     }
4784 4784
 
4785 4785
     // add wildcard at the end of search string (default)
4786 4786
     if ($appendWildcard) {
4787
-        if(substr($str,-1) <> $wildcard) {
4787
+        if (substr($str, -1) <> $wildcard) {
4788 4788
             $str .= $wildcard;
4789 4789
         }
4790 4790
     }
@@ -4793,12 +4793,12 @@  discard block
 block discarded – undo
4793 4793
 }
4794 4794
 
4795 4795
 //check to see if custom utils exists
4796
-if(file_exists('custom/include/custom_utils.php')){
4796
+if (file_exists('custom/include/custom_utils.php')) {
4797 4797
 	include_once('custom/include/custom_utils.php');
4798 4798
 }
4799 4799
 
4800 4800
 //check to see if custom utils exists in Extension framework
4801
-if(file_exists('custom/application/Ext/Utils/custom_utils.ext.php')) {
4801
+if (file_exists('custom/application/Ext/Utils/custom_utils.ext.php')) {
4802 4802
     include_once('custom/application/Ext/Utils/custom_utils.ext.php');
4803 4803
 }
4804 4804
 /**
@@ -4852,8 +4852,8 @@  discard block
 block discarded – undo
4852 4852
 function utf8_recursive_encode($data)
4853 4853
 {
4854 4854
     $result = array();
4855
-    foreach($data as $key=>$val) {
4856
-        if(is_array($val)) {
4855
+    foreach ($data as $key=>$val) {
4856
+        if (is_array($val)) {
4857 4857
            $result[$key] = utf8_recursive_encode($val);
4858 4858
         } else {
4859 4859
            $result[$key] = utf8_encode($val);
@@ -4917,12 +4917,12 @@  discard block
 block discarded – undo
4917 4917
         $sendUrl = $sugar_config['custom_help_url'];
4918 4918
     } else {
4919 4919
         if (!empty($sugar_config['custom_help_base_url'])) {
4920
-            $baseUrl= $sugar_config['custom_help_base_url'];
4920
+            $baseUrl = $sugar_config['custom_help_base_url'];
4921 4921
         } else {
4922 4922
             $baseUrl = "http://www.sugarcrm.com/crm/product_doc.php";
4923 4923
         }
4924
-        $sendUrl = $baseUrl . "?edition={$send_edition}&version={$send_version}&lang={$send_lang}&module={$send_module}&help_action={$send_action}&status={$dev_status}&key={$send_key}";
4925
-        if(!empty($send_anchor)) {
4924
+        $sendUrl = $baseUrl."?edition={$send_edition}&version={$send_version}&lang={$send_lang}&module={$send_module}&help_action={$send_action}&status={$dev_status}&key={$send_key}";
4925
+        if (!empty($send_anchor)) {
4926 4926
             $sendUrl .= "&anchor=".$send_anchor;
4927 4927
         }
4928 4928
     }
@@ -4937,13 +4937,13 @@  discard block
 block discarded – undo
4937 4937
  *
4938 4938
  * @param string $etag ETag to use for this content.
4939 4939
  */
4940
-function generateETagHeader($etag){
4940
+function generateETagHeader($etag) {
4941 4941
 	header("cache-control:");
4942 4942
 	header('Expires: ');
4943
-	header("ETag: " . $etag);
4943
+	header("ETag: ".$etag);
4944 4944
 	header("Pragma:");
4945
-	if(isset($_SERVER["HTTP_IF_NONE_MATCH"])){
4946
-		if($etag == $_SERVER["HTTP_IF_NONE_MATCH"]){
4945
+	if (isset($_SERVER["HTTP_IF_NONE_MATCH"])) {
4946
+		if ($etag == $_SERVER["HTTP_IF_NONE_MATCH"]) {
4947 4947
 			ob_clean();
4948 4948
 			header("Status: 304 Not Modified");
4949 4949
 			header("HTTP/1.0 304 Not Modified");
@@ -4988,12 +4988,12 @@  discard block
 block discarded – undo
4988 4988
  */
4989 4989
 function clean_sensitive_data($defs, $data)
4990 4990
 {
4991
-    foreach($defs as $field => $def) {
4992
-        if(!empty($def['sensitive'])) {
4993
-            if(is_array($data)) {
4991
+    foreach ($defs as $field => $def) {
4992
+        if (!empty($def['sensitive'])) {
4993
+            if (is_array($data)) {
4994 4994
                 $data[$field] = '';
4995 4995
             }
4996
-            if($data instanceof SugarBean) {
4996
+            if ($data instanceof SugarBean) {
4997 4997
                 $data->$field = '';
4998 4998
             }
4999 4999
         }
@@ -5027,7 +5027,7 @@  discard block
 block discarded – undo
5027 5027
         // Add the relationship name for easier recognition
5028 5028
         foreach ($select_array as $key => $value)
5029 5029
         {
5030
-            $select_array[$key] .= ' (' . $key . ')';
5030
+            $select_array[$key] .= ' ('.$key.')';
5031 5031
         }
5032 5032
     }
5033 5033
     asort($select_array);
@@ -5056,7 +5056,7 @@  discard block
 block discarded – undo
5056 5056
  */
5057 5057
 function assignConcatenatedValue(SugarBean $bean, $fieldDef, $value)
5058 5058
 {
5059
-    $valueParts = explode(' ',$value);
5059
+    $valueParts = explode(' ', $value);
5060 5060
     $valueParts = array_filter($valueParts);
5061 5061
     $fieldNum   = count($fieldDef['db_concat_fields']);
5062 5062
 
@@ -5076,56 +5076,56 @@  discard block
 block discarded – undo
5076 5076
 
5077 5077
         if (!empty($valueParts))
5078 5078
         {
5079
-            $bean->$fieldName .= ' ' . implode(' ', $valueParts);
5079
+            $bean->$fieldName .= ' '.implode(' ', $valueParts);
5080 5080
         }
5081 5081
     }
5082 5082
 }
5083 5083
 
5084
-define("DEFAULT_UTIL_SUITE_ENCODING","UTF-8");
5084
+define("DEFAULT_UTIL_SUITE_ENCODING", "UTF-8");
5085 5085
 
5086 5086
 function suite_strlen($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5087 5087
 {
5088
-	if(function_exists('mb_strlen'))
5089
-		return mb_strlen($input,$encoding);
5088
+	if (function_exists('mb_strlen'))
5089
+		return mb_strlen($input, $encoding);
5090 5090
 	else
5091 5091
 		return strlen($input);
5092 5092
 }
5093 5093
 
5094
-function suite_substr($input, $start, $length = null,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5094
+function suite_substr($input, $start, $length = null, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5095 5095
 {
5096
-	if(function_exists('mb_substr'))
5097
-		return mb_substr($input,$start,$length,$encoding);
5096
+	if (function_exists('mb_substr'))
5097
+		return mb_substr($input, $start, $length, $encoding);
5098 5098
 	else
5099
-		return substr($input,$start,$length);
5099
+		return substr($input, $start, $length);
5100 5100
 }
5101 5101
 
5102
-function suite_strtoupper($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5102
+function suite_strtoupper($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5103 5103
 {
5104
-	if(function_exists('mb_strtoupper'))
5105
-		return mb_strtoupper($input,$encoding);
5104
+	if (function_exists('mb_strtoupper'))
5105
+		return mb_strtoupper($input, $encoding);
5106 5106
 	else
5107 5107
 		return strtoupper($input);
5108 5108
 }
5109
-function suite_strtolower($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5109
+function suite_strtolower($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5110 5110
 {
5111
-	if(function_exists('mb_strtolower'))
5112
-		return mb_strtolower($input,$encoding);
5111
+	if (function_exists('mb_strtolower'))
5112
+		return mb_strtolower($input, $encoding);
5113 5113
 	else
5114 5114
 		return strtolower($input);
5115 5115
 }
5116 5116
 
5117
-function suite_strpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5117
+function suite_strpos($haystack, $needle, $offset = 0, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5118 5118
 {
5119
-	if(function_exists('mb_strpos'))
5120
-		return mb_strpos($haystack,$needle,$offset,$encoding);
5119
+	if (function_exists('mb_strpos'))
5120
+		return mb_strpos($haystack, $needle, $offset, $encoding);
5121 5121
 	else
5122
-		return strpos($haystack,$needle,$offset);
5122
+		return strpos($haystack, $needle, $offset);
5123 5123
 }
5124 5124
 
5125
-function suite_strrpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5125
+function suite_strrpos($haystack, $needle, $offset = 0, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5126 5126
 {
5127
-	if(function_exists('mb_strrpos'))
5128
-		return mb_strrpos($haystack,$needle,$offset,$encoding);
5127
+	if (function_exists('mb_strrpos'))
5128
+		return mb_strrpos($haystack, $needle, $offset, $encoding);
5129 5129
 	else
5130
-		return strrpos($haystack,$needle,$offset);
5130
+		return strrpos($haystack, $needle, $offset);
5131 5131
 }
5132 5132
\ No newline at end of file
Please login to merge, or discard this patch.
include/Popups/PopupSmarty.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 require_once('include/TemplateHandler/TemplateHandler.php');
44 44
 require_once('include/SearchForm/SearchForm2.php');
45 45
 define("NUM_COLS", 2);
46
-class PopupSmarty extends ListViewSmarty{
46
+class PopupSmarty extends ListViewSmarty {
47 47
 
48 48
 	var $contextMenus = false;
49 49
 	var $export = false;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     var $module;
71 71
     var $massUpdateData = '';
72 72
 
73
-	function PopupSmarty($seed, $module){
73
+	function PopupSmarty($seed, $module) {
74 74
 		parent::ListViewSmarty();
75 75
 		$this->th = new TemplateHandler();
76 76
 		$this->th->loadSmarty();
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
      */
92 92
     function processArrowVars()
93 93
     {
94
-        $pathParts = pathinfo(SugarThemeRegistry::current()->getImageURL('arrow.gif',false));
94
+        $pathParts = pathinfo(SugarThemeRegistry::current()->getImageURL('arrow.gif', false));
95 95
 
96
-        list($width,$height) = getimagesize($pathParts['dirname'].'/'.$pathParts['basename']);
96
+        list($width, $height) = getimagesize($pathParts['dirname'].'/'.$pathParts['basename']);
97 97
 
98 98
         $this->th->ss->assign('arrowExt', $pathParts['extension']);
99 99
         $this->th->ss->assign('arrowWidth', $width);
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
 		$this->data = $data;
120 120
 
121 121
         $totalWidth = 0;
122
-        foreach($this->displayColumns as $name => $params) {
122
+        foreach ($this->displayColumns as $name => $params) {
123 123
             $totalWidth += $params['width'];
124 124
         }
125 125
         $adjustment = $totalWidth / 100;
126 126
 
127 127
         $contextMenuObjectsTypes = array();
128
-        foreach($this->displayColumns as $name => $params) {
128
+        foreach ($this->displayColumns as $name => $params) {
129 129
             $this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2);
130 130
             // figure out which contextMenu objectsTypes are required
131
-            if(!empty($params['contextMenu']['objectType']))
131
+            if (!empty($params['contextMenu']['objectType']))
132 132
                 $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
133 133
         }
134 134
 		$this->th->ss->assign('displayColumns', $this->displayColumns);
@@ -147,22 +147,22 @@  discard block
 block discarded – undo
147 147
 		$this->th->ss->assign('searchForm', $this->searchForm->display(false));
148 148
         //rrs
149 149
 
150
-		if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink());
150
+		if ($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink());
151 151
 		$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());
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());
154 154
 
155 155
 
156 156
 		if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
157 157
 			$this->multiSelect = true;
158 158
 		}
159 159
 		// handle save checks and stuff
160
-		if($this->multiSelect) {
160
+		if ($this->multiSelect) {
161 161
 			$this->th->ss->assign('selectedObjectsSpan', $this->buildSelectedObjectsSpan());
162 162
 			$this->th->ss->assign('multiSelectData', $this->getMultiSelectData());
163 163
 			$this->th->ss->assign('MODE', "<input type='hidden' name='mode' value='MultiSelect'>");
164 164
             $pageTotal = $this->data['pageData']['offsets']['next'] - $this->data['pageData']['offsets']['current'];
165
-            if($this->data['pageData']['offsets']['next'] < 0){ // If we are on the last page, 'next' is -1, which means we have to have a custom calculation
165
+            if ($this->data['pageData']['offsets']['next'] < 0) { // If we are on the last page, 'next' is -1, which means we have to have a custom calculation
166 166
                 $pageTotal = $this->data['pageData']['offsets']['total'] - $this->data['pageData']['offsets']['current'];
167 167
             }
168 168
     		$this->th->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal));
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         $this->th->ss->assign('contextMenus', $this->contextMenus);
176 176
 
177 177
 
178
-        if($this->contextMenus && !empty($contextMenuObjectsTypes)) {
178
+        if ($this->contextMenus && !empty($contextMenuObjectsTypes)) {
179 179
             $script = '';
180 180
             $cm = new contextMenu();
181
-            foreach($contextMenuObjectsTypes as $type => $value) {
181
+            foreach ($contextMenuObjectsTypes as $type => $value) {
182 182
                 $cm->loadFromFile($type);
183 183
                 $script .= $cm->getScript();
184 184
                 $cm->menuItems = array(); // clear menuItems out
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	function display($end = true) {
200 200
         global $app_strings;
201 201
 
202
-        if(!is_file(sugar_cached("jsLanguage/{$GLOBALS['current_language']}.js"))) {
202
+        if (!is_file(sugar_cached("jsLanguage/{$GLOBALS['current_language']}.js"))) {
203 203
             require_once('include/language/jsLanguage.php');
204 204
             jsLanguage::createAppStringsCache($GLOBALS['current_language']);
205 205
         }
206
-        $jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js",  $GLOBALS['sugar_config']['js_lang_version']);
206
+        $jsLang = getVersionedScript("cache/jsLanguage/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']);
207 207
 
208 208
         $this->th->ss->assign('data', $this->data['data']);
209 209
 		$this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']);
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 		$searchNameOverride = !empty($this->seed) && $this->seed instanceof Person && (isset($this->data['data'][0]['FIRST_NAME']) && isset($this->data['data'][0]['LAST_NAME'])) ? true : false;
224 224
 		
225 225
 		global $locale;
226
-		foreach($this->data['data'] as $val)
226
+		foreach ($this->data['data'] as $val)
227 227
 		{
228 228
 			$associated_row_data[$val['ID']] = $val;
229
-			if($searchNameOverride)
229
+			if ($searchNameOverride)
230 230
 			{
231 231
 			   $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']);
232 232
 			}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		$this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2));
238 238
         $this->th->ss->assign('headerTpl', $this->headerTpl);
239 239
         $this->th->ss->assign('footerTpl', $this->footerTpl);
240
-        $this->th->ss->assign('ASSOCIATED_JAVASCRIPT_DATA', 'var associated_javascript_data = '.$json->encode($associated_row_data). '; var is_show_fullname = '.$is_show_fullname.';');
240
+        $this->th->ss->assign('ASSOCIATED_JAVASCRIPT_DATA', 'var associated_javascript_data = '.$json->encode($associated_row_data).'; var is_show_fullname = '.$is_show_fullname.';');
241 241
 		$this->th->ss->assign('module', $this->seed->module_dir);
242 242
 		$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
243 243
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 		$this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']);
259 259
         $this->th->ss->assign('should_process', $this->should_process);
260 260
 
261
-		if($this->_create){
262
-			$this->th->ss->assign('ADDFORM', $this->getQuickCreate());//$this->_getAddForm());
261
+		if ($this->_create) {
262
+			$this->th->ss->assign('ADDFORM', $this->getQuickCreate()); //$this->_getAddForm());
263 263
 			$this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader());
264 264
 			$this->th->ss->assign('object_name', $this->seed->object_name);
265 265
 		}
@@ -278,15 +278,15 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 	function _setup($file) {
280 280
 
281
-	    if(isset($this->_popupMeta)){
282
-			if(isset($this->_popupMeta['create']['formBase'])) {
283
-				require_once('modules/' . $this->seed->module_dir . '/' . $this->_popupMeta['create']['formBase']);
281
+	    if (isset($this->_popupMeta)) {
282
+			if (isset($this->_popupMeta['create']['formBase'])) {
283
+				require_once('modules/'.$this->seed->module_dir.'/'.$this->_popupMeta['create']['formBase']);
284 284
 				$this->_create = true;
285 285
 			}
286 286
 		}
287
-	    if(!empty($this->_popupMeta['create'])){
287
+	    if (!empty($this->_popupMeta['create'])) {
288 288
 			$formBase = new $this->_popupMeta['create']['formBaseClass']();
289
-			if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save')
289
+			if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save')
290 290
 			{
291 291
 				//If it's a new record, set useRequired to false
292 292
 				$useRequired = empty($_REQUEST['id']) ? false : true;
@@ -295,19 +295,19 @@  discard block
 block discarded – undo
295 295
 		}
296 296
 
297 297
 		$params = array();
298
-		if(!empty($this->_popupMeta['orderBy'])){
298
+		if (!empty($this->_popupMeta['orderBy'])) {
299 299
 			$params['orderBy'] = $this->_popupMeta['orderBy'];
300 300
 		}
301 301
 
302
-		if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
302
+		if (file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')) {
303 303
 			require('custom/modules/'.$this->module.'/metadata/metafiles.php');
304
-		}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
304
+		}elseif (file_exists('modules/'.$this->module.'/metadata/metafiles.php')) {
305 305
 			require('modules/'.$this->module.'/metadata/metafiles.php');
306 306
 		}
307 307
 
308
-		if(!empty($metafiles[$this->module]['searchfields'])) {
308
+		if (!empty($metafiles[$this->module]['searchfields'])) {
309 309
 			require($metafiles[$this->module]['searchfields']);
310
-		} elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) {
310
+		} elseif (file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) {
311 311
 			require('modules/'.$this->module.'/metadata/SearchFields.php');
312 312
 	    }
313 313
         $this->searchdefs[$this->module]['templateMeta']['maxColumns'] = 2;
@@ -319,23 +319,23 @@  discard block
 block discarded – undo
319 319
 
320 320
 		$lv = new ListViewSmarty();
321 321
 		$displayColumns = array();
322
-		if(!empty($_REQUEST['displayColumns'])) {
323
-		    foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
324
-		        if(!empty($listViewDefs[$this->module][$col]))
322
+		if (!empty($_REQUEST['displayColumns'])) {
323
+		    foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
324
+		        if (!empty($listViewDefs[$this->module][$col]))
325 325
 		            $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
326 326
 		    }
327 327
 		}
328 328
 		else {
329
-		    foreach($this->listviewdefs[$this->module] as $col => $para) {
330
-		        if(!empty($para['default']) && $para['default'])
329
+		    foreach ($this->listviewdefs[$this->module] as $col => $para) {
330
+		        if (!empty($para['default']) && $para['default'])
331 331
 		            $displayColumns[$col] = $para;
332 332
 		    }
333 333
 		}
334 334
 		$params['massupdate'] = true;
335
-		if(!empty($_REQUEST['orderBy'])) {
335
+		if (!empty($_REQUEST['orderBy'])) {
336 336
 		    $params['orderBy'] = $_REQUEST['orderBy'];
337 337
 		    $params['overrideOrder'] = true;
338
-		    if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
338
+		    if (!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
339 339
 		}
340 340
 
341 341
 		$lv->displayColumns = $displayColumns;
@@ -350,27 +350,27 @@  discard block
 block discarded – undo
350 350
 
351 351
         $this->should_process = true;
352 352
 
353
-        if(isset($params['export'])) {
353
+        if (isset($params['export'])) {
354 354
           $this->export = $params['export'];
355 355
         }
356
-        if(!empty($params['multiSelectPopup'])) {
356
+        if (!empty($params['multiSelectPopup'])) {
357 357
 		  $this->multi_select_popup = $params['multiSelectPopup'];
358 358
         }
359
-		if(!empty($params['massupdate']) && $params['massupdate'] != false) {
359
+		if (!empty($params['massupdate']) && $params['massupdate'] != false) {
360 360
 			$this->show_mass_update_form = true;
361 361
 			$this->mass = new MassUpdate();
362 362
 			$this->mass->setSugarBean($this->seed);
363
-			if(!empty($params['handleMassupdate']) || !isset($params['handleMassupdate'])) {
363
+			if (!empty($params['handleMassupdate']) || !isset($params['handleMassupdate'])) {
364 364
                 $this->mass->handleMassUpdate();
365 365
             }
366 366
 		}
367 367
 
368 368
         // create filter fields based off of display columns
369
-        if(empty($this->filter_fields) || $this->mergeDisplayColumns) {
370
-            foreach($this->displayColumns as $columnName => $def) {
369
+        if (empty($this->filter_fields) || $this->mergeDisplayColumns) {
370
+            foreach ($this->displayColumns as $columnName => $def) {
371 371
                $this->filter_fields[strtolower($columnName)] = true;
372
-               if(!empty($def['related_fields'])) {
373
-                    foreach($def['related_fields'] as $field) {
372
+               if (!empty($def['related_fields'])) {
373
+                    foreach ($def['related_fields'] as $field) {
374 374
                         //id column is added by query construction function. This addition creates duplicates
375 375
                         //and causes issues in oracle. #10165
376 376
                         if ($field != 'id') {
@@ -379,15 +379,15 @@  discard block
 block discarded – undo
379 379
                     }
380 380
                 }
381 381
                 if (!empty($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'])) {
382
-	                foreach($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field){
383
-	                    if(!isset($this->filter_fields[strtolower($field)]) || !$this->filter_fields[strtolower($field)])
382
+	                foreach ($this->seed->field_defs[strtolower($columnName)]['db_concat_fields'] as $index=>$field) {
383
+	                    if (!isset($this->filter_fields[strtolower($field)]) || !$this->filter_fields[strtolower($field)])
384 384
 	                    {
385 385
 	                        $this->filter_fields[strtolower($field)] = true;
386 386
 	                    }
387 387
 	                }
388 388
                 }
389 389
             }
390
-            foreach ($this->searchColumns as $columnName => $def )
390
+            foreach ($this->searchColumns as $columnName => $def)
391 391
             {
392 392
                 $this->filter_fields[strtolower($columnName)] = true;
393 393
             }
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
          * By default bean's create_new_list_query function loads fields displayed on the page or used in the search
404 404
          * add fields used to populate forms from _viewdefs :: field_to_name_array to retrive from db
405 405
          */
406
-        if ( isset($_REQUEST['field_to_name']) && $_REQUEST['field_to_name'] )
406
+        if (isset($_REQUEST['field_to_name']) && $_REQUEST['field_to_name'])
407 407
         {
408 408
             $_REQUEST['field_to_name'] = is_array($_REQUEST['field_to_name']) ? $_REQUEST['field_to_name'] : array($_REQUEST['field_to_name']);
409
-            foreach ( $_REQUEST['field_to_name'] as $add_field )
409
+            foreach ($_REQUEST['field_to_name'] as $add_field)
410 410
             {
411 411
                 $add_field = strtolower($add_field);
412
-                if ( $add_field != 'id' && !isset($this->filter_fields[$add_field]) && isset($this->seed->field_defs[$add_field]) )
412
+                if ($add_field != 'id' && !isset($this->filter_fields[$add_field]) && isset($this->seed->field_defs[$add_field]))
413 413
                 {
414 414
                     $this->filter_fields[$add_field] = true;
415 415
                 }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			    'pageData'=>array(
428 428
 			    	'bean'=>array('moduleDir'=>$this->seed->module_dir),
429 429
 					'ordering'=>'',
430
-					'offsets'=>array('total'=>0,'next'=>0,'current'=>0),
430
+					'offsets'=>array('total'=>0, 'next'=>0, 'current'=>0),
431 431
 				),
432 432
 			);
433 433
 		}
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
 
448 448
 		// Bug 43452 - FG - Changed the way generated Where array is imploded into the string.
449 449
 		//                  Now it's imploding in the same way view.list.php do.
450
-		if (count($where_clauses) > 0 ) {
451
-		    $where = '( ' . implode(' and ', $where_clauses) . ' )';
450
+		if (count($where_clauses) > 0) {
451
+		    $where = '( '.implode(' and ', $where_clauses).' )';
452 452
         }
453 453
 
454 454
         // Need to include the default whereStatement
455
-		if(!empty($this->_popupMeta['whereStatement'])){
456
-            if(!empty($where))$where .= ' AND ';
455
+		if (!empty($this->_popupMeta['whereStatement'])) {
456
+            if (!empty($where))$where .= ' AND ';
457 457
             $where .= $this->_popupMeta['whereStatement'];
458 458
 		}
459 459
 
@@ -463,48 +463,48 @@  discard block
 block discarded – undo
463 463
 	/*
464 464
 	 * Generate the data for the search form on the header of the Popup.
465 465
 	 */
466
-		function _build_field_defs(){
466
+		function _build_field_defs() {
467 467
 		$this->formData = array();
468 468
 		$this->customFieldDefs = array();
469
-		foreach($this->searchdefs[$this->module]['layout']['advanced_search'] as $data){
470
-			if(is_array($data)){
469
+		foreach ($this->searchdefs[$this->module]['layout']['advanced_search'] as $data) {
470
+			if (is_array($data)) {
471 471
 
472 472
 				$this->formData[] = array('field' => $data);
473 473
 				$value = '';
474
-				$this->customFieldDefs[$data['name']]= $data;
475
-				if(!empty($_REQUEST[$data['name']]))
474
+				$this->customFieldDefs[$data['name']] = $data;
475
+				if (!empty($_REQUEST[$data['name']]))
476 476
 	            	$value = $_REQUEST[$data['name']];
477 477
 	            $this->customFieldDefs[$data['name']]['value'] = $value;
478
-			}else
478
+			} else
479 479
 				$this->formData[] = array('field' => array('name'=>$data));
480 480
 		}
481 481
 		$this->fieldDefs = array();
482
-		if($this->seed){
482
+		if ($this->seed) {
483 483
 			$this->seed->fill_in_additional_detail_fields();
484 484
 
485
-	        foreach($this->seed->toArray() as $name => $value) {
485
+	        foreach ($this->seed->toArray() as $name => $value) {
486 486
 	            $this->fieldDefs[$name] = $this->seed->field_defs[$name];
487 487
 	            //if we have a relate type then reset to name so that we end up with a textbox
488 488
 	            //rather than a select button
489 489
 	            $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name'];
490
-	            if($this->fieldDefs[$name]['type'] == 'relate')
490
+	            if ($this->fieldDefs[$name]['type'] == 'relate')
491 491
 	            	$this->fieldDefs[$name]['type'] = 'name';
492
-	            if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
492
+	            if (isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
493 493
 	                $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums
494 494
 	            }
495
-	            if(!empty($_REQUEST[$name]))
495
+	            if (!empty($_REQUEST[$name]))
496 496
 	            	$value = $_REQUEST[$name];
497 497
 	            $this->fieldDefs[$name]['value'] = $value;
498 498
 	        }
499 499
 		}
500 500
 	}
501 501
 
502
-	function _getAddForm(){
502
+	function _getAddForm() {
503 503
 		$addform = '';
504
-        if(!$this->seed->ACLAccess('save')){
504
+        if (!$this->seed->ACLAccess('save')) {
505 505
             return;
506 506
         }
507
-		if(!empty($this->_popupMeta['create'])){
507
+		if (!empty($this->_popupMeta['create'])) {
508 508
 			$formBase = new $this->_popupMeta['create']['formBaseClass']();
509 509
 
510 510
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		}
527 527
 	}
528 528
 
529
-	function _getAddFormHeader(){
529
+	function _getAddFormHeader() {
530 530
 		$lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE'];
531 531
 		$lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY'];
532 532
 		$lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL'];
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
 			<input type="hidden" name="return_action" value="Popup">
540 540
 EOQ;
541 541
 		// if metadata contains custom inputs for the quickcreate
542
-		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';
542
+		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';
545 545
 		}
546 546
 
547 547
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		return $addformheader;
550 550
 	}
551 551
 
552
-	function getQuickCreate(){
552
+	function getQuickCreate() {
553 553
 		require_once("include/EditView/PopupQuickCreate.php");
554 554
 		$qc = new PopupQuickCreate($this->module);
555 555
 		return $qc->process($this->module);
Please login to merge, or discard this patch.
include/language/getJSLanguage.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
         if (!preg_match("/^\w\w_\w\w$/", $lang)) {
36 36
             echo "did not match regex<br/>";
37 37
         } else {
38
-            echo  "$lang was not in list . <pre>" . print_r($languages, true) . "</pre>";
38
+            echo  "$lang was not in list . <pre>".print_r($languages, true)."</pre>";
39 39
         }
40 40
         echo "Invalid language specified";
41 41
 
42 42
         return;
43 43
     }
44 44
     if (empty($_REQUEST['module']) || $_REQUEST['module'] === 'app_strings') {
45
-        $file = sugar_cached('jsLanguage/') . $lang . '.js';
45
+        $file = sugar_cached('jsLanguage/').$lang.'.js';
46 46
         if (!sugar_is_file($file)) {
47 47
             jsLanguage::createAppStringsCache($lang);
48 48
         }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
             return;
56 56
         }
57
-        $file = sugar_cached('jsLanguage/') . $module . "/" . $lang . '.js';
57
+        $file = sugar_cached('jsLanguage/').$module."/".$lang.'.js';
58 58
         if (!sugar_is_file($file)) {
59 59
             jsLanguage::createModuleStringsCache($module, $lang);
60 60
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     header("Content-Type: application/javascript");
65 65
     header("Cache-Control: max-age=31556940, private");
66 66
     header("Pragma: ");
67
-    header("Expires: " . gmdate('D, d M Y H:i:s \G\M\T', time() + 31556940));
67
+    header("Expires: ".gmdate('D, d M Y H:i:s \G\M\T', time() + 31556940));
68 68
 
69 69
     readfile($file);
70 70
 }
Please login to merge, or discard this patch.
include/language/jsLanguage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 EOQ;
63 63
         
64 64
         $cacheDir = create_cache_directory('jsLanguage/');
65
-        if($fh = @sugar_fopen($cacheDir . $lang . '.js', "w")){
65
+        if ($fh = @sugar_fopen($cacheDir.$lang.'.js', "w")) {
66 66
             fputs($fh, $str);
67 67
             fclose($fh);
68 68
         }
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
         // cn: bug 8242 - non-US langpack chokes
75 75
         $mod_strings = return_module_language($lang, $moduleDir);
76 76
         $mod_strings_encoded = $json->encode($mod_strings);
77
-        $str = "SUGAR.language.setLanguage('" . $moduleDir . "', " . $mod_strings_encoded . ");";
77
+        $str = "SUGAR.language.setLanguage('".$moduleDir."', ".$mod_strings_encoded.");";
78 78
         
79
-        $cacheDir = create_cache_directory('jsLanguage/' . $moduleDir . '/');
79
+        $cacheDir = create_cache_directory('jsLanguage/'.$moduleDir.'/');
80 80
         
81
-        if($fh = @fopen($cacheDir . $lang . '.js', "w")){
81
+        if ($fh = @fopen($cacheDir.$lang.'.js', "w")) {
82 82
             fputs($fh, $str);
83 83
             fclose($fh);
84 84
         }
85 85
 
86
-        if($return) {
86
+        if ($return) {
87 87
             return $str;
88 88
         }
89 89
     }
Please login to merge, or discard this patch.
include/language/en_us.lang.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
 //the left value is the key stored in the db and the right value is ie display value
50 50
 //to translate, only modify the right value in each key/value pair
51
-$app_list_strings = array (
51
+$app_list_strings = array(
52 52
 //e.g. auf Deutsch 'Contacts'=>'Contakten',
53 53
   'language_pack_name' => 'US English',
54 54
   'moduleList' =>
55
-  array (
55
+  array(
56 56
     'Home' => 'Home',
57 57
     'Contacts' => 'Contacts',
58 58
     'Accounts' => 'Accounts',
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
   ),
114 114
 
115 115
   'moduleListSingular' =>
116
-  array (
116
+  array(
117 117
     'Home' => 'Home',
118 118
     'Dashboard' => 'Dashboard',
119 119
     'Contacts' => 'Contact',
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
   //e.g. en fran�ais 'Analyst'=>'Analyste',
155 155
   'account_type_dom' =>
156
-  array (
156
+  array(
157 157
     '' => '',
158 158
     'Analyst' => 'Analyst',
159 159
     'Competitor' => 'Competitor',
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
   ),
169 169
   //e.g. en espa�ol 'Apparel'=>'Ropa',
170 170
   'industry_dom' =>
171
-  array (
171
+  array(
172 172
     '' => '',
173 173
     'Apparel' => 'Apparel',
174 174
     'Banking' => 'Banking',
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
   ),
204 204
   'lead_source_default_key' => 'Self Generated',
205 205
   'lead_source_dom' =>
206
-  array (
206
+  array(
207 207
     '' => '',
208 208
     'Cold Call' => 'Cold Call',
209 209
     'Existing Customer' => 'Existing Customer',
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
     'Other' => 'Other',
222 222
   ),
223 223
   'opportunity_type_dom' =>
224
-  array (
224
+  array(
225 225
     '' => '',
226 226
     'Existing Business' => 'Existing Business',
227 227
     'New Business' => 'New Business',
228 228
   ),
229 229
   'roi_type_dom' =>
230
-    array (
230
+    array(
231 231
     'Revenue' => 'Revenue',
232 232
     'Investment'=>'Investment',
233 233
     'Expected_Revenue'=>'Expected Revenue',
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 //       it is the key for the default opportunity_relationship_type_dom value
239 239
   'opportunity_relationship_type_default_key' => 'Primary Decision Maker',
240 240
   'opportunity_relationship_type_dom' =>
241
-  array (
241
+  array(
242 242
     '' => '',
243 243
     'Primary Decision Maker' => 'Primary Decision Maker',
244 244
     'Business Decision Maker' => 'Business Decision Maker',
@@ -253,24 +253,24 @@  discard block
 block discarded – undo
253 253
 //       it is the key for the default case_relationship_type_dom value
254 254
   'case_relationship_type_default_key' => 'Primary Contact',
255 255
   'case_relationship_type_dom' =>
256
-  array (
256
+  array(
257 257
     '' => '',
258 258
     'Primary Contact' => 'Primary Contact',
259 259
     'Alternate Contact' => 'Alternate Contact',
260 260
   ),
261 261
   'payment_terms' =>
262
-  array (
262
+  array(
263 263
     '' => '',
264 264
     'Net 15' => 'Net 15',
265 265
     'Net 30' => 'Net 30',
266 266
   ),
267 267
   'sales_stage_default_key' => 'Prospecting',
268
-  'fts_type' => array (
268
+  'fts_type' => array(
269 269
       '' => '',
270 270
       'Elastic' => 'elasticsearch'
271 271
   ),
272 272
   'sales_stage_dom' =>
273
-  array (
273
+  array(
274 274
     'Prospecting' => 'Prospecting',
275 275
     'Qualification' => 'Qualification',
276 276
     'Needs Analysis' => 'Needs Analysis',
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     'Closed Won' => 'Closed Won',
283 283
     'Closed Lost' => 'Closed Lost',
284 284
   ),
285
-  'in_total_group_stages' => array (
285
+  'in_total_group_stages' => array(
286 286
     'Draft' => 'Draft',
287 287
     'Negotiation' => 'Negotiation',
288 288
     'Delivered' => 'Delivered',
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     'Closed Dead' => 'Closed Dead',
294 294
   ),
295 295
   'sales_probability_dom' => // keys must be the same as sales_stage_dom
296
-  array (
296
+  array(
297 297
     'Prospecting' => '10',
298 298
     'Qualification' => '20',
299 299
     'Needs Analysis' => '25',
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     'Closed Lost' => '0',
307 307
   ),
308 308
   'activity_dom' =>
309
-  array (
309
+  array(
310 310
     'Call' => 'Call',
311 311
     'Meeting' => 'Meeting',
312 312
     'Task' => 'Task',
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     'Note' => 'Note',
315 315
   ),
316 316
   'salutation_dom' =>
317
-      array (
317
+      array(
318 318
         '' => '',
319 319
         'Mr.' => 'Mr.',
320 320
         'Ms.' => 'Ms.',
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
       ),
325 325
   //time is in seconds; the greater the time the longer it takes;
326 326
   'reminder_max_time' => 90000,
327
-  'reminder_time_options' => array( 60=> '1 minute prior',
327
+  'reminder_time_options' => array(60=> '1 minute prior',
328 328
                                   300=> '5 minutes prior',
329 329
                                   600=> '10 minutes prior',
330 330
                                   900=> '15 minutes prior',
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 
339 339
   'task_priority_default' => 'Medium',
340 340
   'task_priority_dom' =>
341
-  array (
341
+  array(
342 342
     'High' => 'High',
343 343
     'Medium' => 'Medium',
344 344
     'Low' => 'Low',
345 345
   ),
346 346
   'task_status_default' => 'Not Started',
347 347
   'task_status_dom' =>
348
-  array (
348
+  array(
349 349
     'Not Started' => 'Not Started',
350 350
     'In Progress' => 'In Progress',
351 351
     'Completed' => 'Completed',
@@ -354,35 +354,35 @@  discard block
 block discarded – undo
354 354
   ),
355 355
   'meeting_status_default' => 'Planned',
356 356
   'meeting_status_dom' =>
357
-  array (
357
+  array(
358 358
     'Planned' => 'Planned',
359 359
     'Held' => 'Held',
360 360
     'Not Held' => 'Not Held',
361 361
   ),
362 362
   'extapi_meeting_password' =>
363
-  array (
363
+  array(
364 364
       'WebEx' => 'WebEx',
365 365
   ),
366 366
   'meeting_type_dom' =>
367
-   array (
367
+   array(
368 368
       'Other' => 'Other',
369 369
       'Sugar' => 'SuiteCRM',
370 370
    ),
371 371
   'call_status_default' => 'Planned',
372 372
   'call_status_dom' =>
373
-  array (
373
+  array(
374 374
     'Planned' => 'Planned',
375 375
     'Held' => 'Held',
376 376
     'Not Held' => 'Not Held',
377 377
   ),
378 378
   'call_direction_default' => 'Outbound',
379 379
   'call_direction_dom' =>
380
-  array (
380
+  array(
381 381
     'Inbound' => 'Inbound',
382 382
     'Outbound' => 'Outbound',
383 383
   ),
384 384
   'lead_status_dom' =>
385
-  array (
385
+  array(
386 386
     '' => '',
387 387
     'New' => 'New',
388 388
     'Assigned' => 'Assigned',
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     'Dead' => 'Dead',
393 393
   ),
394 394
    'gender_list' =>
395
-  array (
395
+  array(
396 396
     'male' => 'Male',
397 397
     'female' => 'Female',
398 398
   ),
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 //       it is the key for the default case_status_dom value
401 401
   'case_status_default_key' => 'New',
402 402
   'case_status_dom' =>
403
-  array (
403
+  array(
404 404
     'New' => 'New',
405 405
     'Assigned' => 'Assigned',
406 406
     'Closed' => 'Closed',
@@ -410,49 +410,49 @@  discard block
 block discarded – undo
410 410
   ),
411 411
   'case_priority_default_key' => 'P2',
412 412
   'case_priority_dom' =>
413
-  array (
413
+  array(
414 414
     'P1' => 'High',
415 415
     'P2' => 'Medium',
416 416
     'P3' => 'Low',
417 417
   ),
418 418
   'user_type_dom' =>
419
-  array (
419
+  array(
420 420
     'RegularUser' => 'Regular User',
421 421
     'Administrator' => 'Administrator',
422 422
   ),
423 423
   'user_status_dom' =>
424
-  array (
424
+  array(
425 425
     'Active' => 'Active',
426 426
     'Inactive' => 'Inactive',
427 427
   ),
428 428
   'employee_status_dom' =>
429
-  array (
429
+  array(
430 430
     'Active' => 'Active',
431 431
     'Terminated' => 'Terminated',
432 432
     'Leave of Absence' => 'Leave of Absence',
433 433
   ),
434 434
   'messenger_type_dom' =>
435
-  array (
435
+  array(
436 436
     '' => '',
437 437
     'MSN' => 'MSN',
438 438
     'Yahoo!' => 'Yahoo!',
439 439
     'AOL' => 'AOL',
440 440
   ),
441
-    'project_task_priority_options' => array (
441
+    'project_task_priority_options' => array(
442 442
         'High' => 'High',
443 443
         'Medium' => 'Medium',
444 444
         'Low' => 'Low',
445 445
     ),
446 446
     'project_task_priority_default' => 'Medium',
447 447
 
448
-    'project_task_status_options' => array (
448
+    'project_task_status_options' => array(
449 449
         'Not Started' => 'Not Started',
450 450
         'In Progress' => 'In Progress',
451 451
         'Completed' => 'Completed',
452 452
         'Pending Input' => 'Pending Input',
453 453
         'Deferred' => 'Deferred',
454 454
     ),
455
-    'project_task_utilization_options' => array (
455
+    'project_task_utilization_options' => array(
456 456
         '0' => 'none',
457 457
         '25' => '25',
458 458
         '50' => '50',
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         '100' => '100',
461 461
     ),
462 462
 
463
-    'project_status_dom' => array (
463
+    'project_status_dom' => array(
464 464
         'Draft' => 'Draft',
465 465
         'In Review' => 'In Review',
466 466
         'Underway' => 'Underway',
@@ -469,12 +469,12 @@  discard block
 block discarded – undo
469 469
     ),
470 470
     'project_status_default' => 'Draft',
471 471
 
472
-    'project_duration_units_dom' => array (
472
+    'project_duration_units_dom' => array(
473 473
         'Days' => 'Days',
474 474
         'Hours' => 'Hours',
475 475
     ),
476 476
 
477
-    'project_priority_options' => array (
477
+    'project_priority_options' => array(
478 478
         'High' => 'High',
479 479
         'Medium' => 'Medium',
480 480
         'Low' => 'Low',
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 //       it is the key for the default record_type_module value
485 485
   'record_type_default_key' => 'Accounts',
486 486
   'record_type_display' =>
487
-  array (
487
+  array(
488 488
     '' => '',
489 489
     'Accounts' => 'Account',
490 490
     'Opportunities' => 'Opportunity',
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
   ),
506 506
 
507 507
   'record_type_display_notes' =>
508
-  array (
508
+  array(
509 509
     'Accounts' => 'Account',
510 510
     'Contacts' => 'Contact',
511 511
     'Opportunities' => 'Opportunity',
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
   ),
525 525
 
526 526
   'parent_type_display' =>
527
-  array (
527
+  array(
528 528
     'Accounts' => 'Account',
529 529
     'Contacts' => 'Contact',
530 530
     'Tasks' => 'Task',
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
   'issue_priority_default_key' => 'Medium',
547 547
   'issue_priority_dom' =>
548
-  array (
548
+  array(
549 549
     'Urgent' => 'Urgent',
550 550
     'High' => 'High',
551 551
     'Medium' => 'Medium',
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
   ),
554 554
   'issue_resolution_default_key' => '',
555 555
   'issue_resolution_dom' =>
556
-  array (
556
+  array(
557 557
     '' => '',
558 558
     'Accepted' => 'Accepted',
559 559
     'Duplicate' => 'Duplicate',
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 
565 565
   'issue_status_default_key' => 'New',
566 566
   'issue_status_dom' =>
567
-  array (
567
+  array(
568 568
     'New' => 'New',
569 569
     'Assigned' => 'Assigned',
570 570
     'Closed' => 'Closed',
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 
575 575
   'bug_priority_default_key' => 'Medium',
576 576
   'bug_priority_dom' =>
577
-  array (
577
+  array(
578 578
     'Urgent' => 'Urgent',
579 579
     'High' => 'High',
580 580
     'Medium' => 'Medium',
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
   ),
583 583
    'bug_resolution_default_key' => '',
584 584
   'bug_resolution_dom' =>
585
-  array (
585
+  array(
586 586
     '' => '',
587 587
     'Accepted' => 'Accepted',
588 588
     'Duplicate' => 'Duplicate',
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
   ),
594 594
   'bug_status_default_key' => 'New',
595 595
   'bug_status_dom' =>
596
-  array (
596
+  array(
597 597
     'New' => 'New',
598 598
     'Assigned' => 'Assigned',
599 599
     'Closed' => 'Closed',
@@ -602,12 +602,12 @@  discard block
 block discarded – undo
602 602
   ),
603 603
    'bug_type_default_key' => 'Bug',
604 604
   'bug_type_dom' =>
605
-  array (
605
+  array(
606 606
     'Defect' => 'Defect',
607 607
     'Feature' => 'Feature',
608 608
   ),
609 609
  'case_type_dom' =>
610
-  array (
610
+  array(
611 611
     'Administration' => 'Administration',
612 612
     'Product' => 'Product',
613 613
     'User' => 'User',
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 
616 616
   'source_default_key' => '',
617 617
   'source_dom' =>
618
-  array (
618
+  array(
619 619
     '' => '',
620 620
     'Internal' => 'Internal',
621 621
     'Forum' => 'Forum',
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
   'product_category_default_key' => '',
627 627
   'product_category_dom' =>
628
-  array (
628
+  array(
629 629
     '' => '',
630 630
     'Accounts' => 'Accounts',
631 631
     'Activities' => 'Activities',
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
   ),
659 659
   /*Added entries 'Queued' and 'Sending' for 4.0 release..*/
660 660
   'campaign_status_dom' =>
661
-  array (
661
+  array(
662 662
         '' => '',
663 663
         'Planning' => 'Planning',
664 664
         'Active' => 'Active',
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
         'Sending'=> 'Sending',
669 669
   ),
670 670
   'campaign_type_dom' =>
671
-  array (
671
+  array(
672 672
         '' => '',
673 673
         'Telesales' => 'Telesales',
674 674
         'Mail' => 'Mail',
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
         ),
682 682
 
683 683
   'newsletter_frequency_dom' =>
684
-  array (
684
+  array(
685 685
         '' => '',
686 686
         'Weekly' => 'Weekly',
687 687
         'Monthly' => 'Monthly',
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
         ),
691 691
 
692 692
   'notifymail_sendtype' =>
693
-  array (
693
+  array(
694 694
     'SMTP' => 'SMTP',
695 695
   ),
696 696
       'dom_cal_month_long'=>array(
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
         'inbound'   => 'Inbound',
768 768
         'campaign'  => 'Campaign'
769 769
     ),
770
-    'dom_email_status' => array (
770
+    'dom_email_status' => array(
771 771
         'archived'  => 'Archived',
772 772
         'closed'    => 'Closed',
773 773
         'draft'     => 'In Draft',
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
         'send_error'=> 'Send Error',
778 778
         'unread'    => 'Unread',
779 779
     ),
780
-    'dom_email_archived_status' => array (
780
+    'dom_email_archived_status' => array(
781 781
         'archived'  => 'Archived',
782 782
     ),
783 783
 
784
-    'dom_email_server_type' => array(   ''          => '--None--',
784
+    'dom_email_server_type' => array(''          => '--None--',
785 785
                                         'imap'      => 'IMAP',
786 786
     ),
787 787
     'dom_mailbox_type'      => array(/*''           => '--None Specified--',*/
@@ -806,19 +806,19 @@  discard block
 block discarded – undo
806 806
     'dom_int_bool'          => array(1 => 'Yes',
807 807
                                      0 => 'No',
808 808
     ),
809
-    'dom_switch_bool'       => array ('on' => 'Yes',
809
+    'dom_switch_bool'       => array('on' => 'Yes',
810 810
                                         'off' => 'No',
811
-                                        '' => 'No', ),
811
+                                        '' => 'No',),
812 812
 
813
-    'dom_email_link_type'   => array(   'sugar'     => 'SuiteCRM Email Client',
813
+    'dom_email_link_type'   => array('sugar'     => 'SuiteCRM Email Client',
814 814
                                         'mailto'    => 'External Email Client'),
815 815
 
816 816
 
817
-    'dom_email_editor_option'=> array(  ''          => 'Default Email Format',
817
+    'dom_email_editor_option'=> array(''          => 'Default Email Format',
818 818
                                         'html'      => 'HTML Email',
819 819
                                         'plain'     => 'Plain Text Email'),
820 820
 
821
-    'schedulers_times_dom'  => array(   'not run'       => 'Past Run Time, Not Executed',
821
+    'schedulers_times_dom'  => array('not run'       => 'Past Run Time, Not Executed',
822 822
                                         'ready'         => 'Ready',
823 823
                                         'in progress'   => 'In Progress',
824 824
                                         'failed'        => 'Failed',
@@ -827,28 +827,28 @@  discard block
 block discarded – undo
827 827
     ),
828 828
 
829 829
     'scheduler_status_dom' =>
830
-        array (
830
+        array(
831 831
         'Active' => 'Active',
832 832
         'Inactive' => 'Inactive',
833 833
         ),
834 834
 
835 835
     'scheduler_period_dom' =>
836
-        array (
836
+        array(
837 837
         'min' => 'Minutes',
838 838
         'hour' => 'Hours',
839 839
         ),
840 840
     'forecast_schedule_status_dom' =>
841
-    array (
841
+    array(
842 842
     'Active' => 'Active',
843 843
     'Inactive' => 'Inactive',
844 844
   ),
845 845
     'forecast_type_dom' =>
846
-    array (
846
+    array(
847 847
     'Direct' => 'Direct',
848 848
     'Rollup' => 'Rollup',
849 849
   ),
850 850
     'document_category_dom' =>
851
-    array (
851
+    array(
852 852
     '' => '',
853 853
     'Marketing' => 'Marketing',
854 854
     'Knowledege Base' => 'Knowledge Base',
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
   ),
857 857
 
858 858
     'document_subcategory_dom' =>
859
-    array (
859
+    array(
860 860
     '' => '',
861 861
     'Marketing Collateral' => 'Marketing Collateral',
862 862
     'Product Brochures' => 'Product Brochures',
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
   ),
865 865
 
866 866
     'document_status_dom' =>
867
-    array (
867
+    array(
868 868
     'Active' => 'Active',
869 869
     'Draft' => 'Draft',
870 870
     'FAQ' => 'FAQ',
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
     'license'=>'License Agreement',
882 882
   ),
883 883
     'dom_meeting_accept_options' =>
884
-    array (
884
+    array(
885 885
     'accept' => 'Accept',
886 886
     'decline' => 'Decline',
887 887
     'tentative' => 'Tentative',
888 888
   ),
889 889
     'dom_meeting_accept_status' =>
890
-    array (
890
+    array(
891 891
     'accept' => 'Accepted',
892 892
     'decline' => 'Declined',
893 893
     'tentative' => 'Tentative',
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 */
940 940
 //prospect list type dom
941 941
   'prospect_list_type_dom' =>
942
-  array (
942
+  array(
943 943
     'default' => 'Default',
944 944
     'seed' => 'Seed',
945 945
     'exempt_domain' => 'Suppression List - By Domain',
@@ -955,14 +955,14 @@  discard block
 block discarded – undo
955 955
         '50'    => '50'
956 956
     ),
957 957
   'email_marketing_status_dom' =>
958
-  array (
958
+  array(
959 959
     '' => '',
960 960
     'active'=>'Active',
961 961
     'inactive'=>'Inactive'
962 962
   ),
963 963
 
964 964
   'campainglog_activity_type_dom' =>
965
-  array (
965
+  array(
966 966
     ''=>'',
967 967
     'targeted' => 'Message Sent/Attempted',
968 968
     'send error'=>'Bounced Messages,Other',
@@ -976,33 +976,33 @@  discard block
 block discarded – undo
976 976
   ),
977 977
 
978 978
   'campainglog_target_type_dom' =>
979
-  array (
979
+  array(
980 980
     'Contacts' => 'Contacts',
981 981
     'Users'=>'Users',
982 982
     'Prospects'=>'Targets',
983 983
     'Leads'=>'Leads',
984 984
     'Accounts'=>'Accounts',
985 985
   ),
986
-  'merge_operators_dom' => array (
986
+  'merge_operators_dom' => array(
987 987
     'like'=>'Contains',
988 988
     'exact'=>'Exactly',
989 989
     'start'=>'Starts With',
990 990
   ),
991 991
 
992
-  'custom_fields_importable_dom' => array (
992
+  'custom_fields_importable_dom' => array(
993 993
     'true'=>'Yes',
994 994
     'false'=>'No',
995 995
     'required'=>'Required',
996 996
   ),
997 997
 
998
-    'Elastic_boost_options' => array (
998
+    'Elastic_boost_options' => array(
999 999
         '0' =>'Disabled',
1000 1000
         '1'=>'Low Boost',
1001 1001
         '2'=>'Medium Boost',
1002 1002
         '3'=>'High Boost',
1003 1003
     ),
1004 1004
 
1005
-  'custom_fields_merge_dup_dom'=> array (
1005
+  'custom_fields_merge_dup_dom'=> array(
1006 1006
         0=>'Disabled',
1007 1007
         1=>'Enabled',
1008 1008
   ),
@@ -1013,19 +1013,19 @@  discard block
 block discarded – undo
1013 1013
   ),
1014 1014
 
1015 1015
 
1016
-    'projects_priority_options' => array (
1016
+    'projects_priority_options' => array(
1017 1017
         'high'      => 'High',
1018 1018
         'medium'    => 'Medium',
1019 1019
         'low'       => 'Low',
1020 1020
     ),
1021 1021
 
1022
-    'projects_status_options' => array (
1022
+    'projects_status_options' => array(
1023 1023
         'notstarted'    => 'Not Started',
1024 1024
         'inprogress'    => 'In Progress',
1025 1025
         'completed'     => 'Completed',
1026 1026
     ),
1027 1027
     // strings to pass to Flash charts
1028
-    'chart_strings' => array (
1028
+    'chart_strings' => array(
1029 1029
         'expandlegend'      => 'Expand Legend',
1030 1030
         'collapselegend'    => 'Collapse Legend',
1031 1031
         'clickfordrilldown' => 'Click for Drilldown',
@@ -1042,25 +1042,25 @@  discard block
 block discarded – undo
1042 1042
         'pieWedgeName'      => 'sections',
1043 1043
     ),
1044 1044
     'release_status_dom' =>
1045
-    array (
1045
+    array(
1046 1046
         'Active' => 'Active',
1047 1047
         'Inactive' => 'Inactive',
1048 1048
     ),
1049 1049
     'email_settings_for_ssl' =>
1050
-    array (
1050
+    array(
1051 1051
         '0' => '',
1052 1052
         '1' => 'SSL',
1053 1053
         '2' => 'TLS',
1054 1054
     ),
1055 1055
     'import_enclosure_options' =>
1056
-    array (
1056
+    array(
1057 1057
         '\'' => 'Single Quote (\')',
1058 1058
         '"' => 'Double Quote (")',
1059 1059
         '' => 'None',
1060 1060
         'other' => 'Other:',
1061 1061
     ),
1062 1062
     'import_delimeter_options' =>
1063
-    array (
1063
+    array(
1064 1064
         ',' => ',',
1065 1065
         ';' => ';',
1066 1066
         '\t' => '\t',
@@ -1070,12 +1070,12 @@  discard block
 block discarded – undo
1070 1070
         'other' => 'Other:',
1071 1071
     ),
1072 1072
     'link_target_dom' =>
1073
-    array (
1073
+    array(
1074 1074
         '_blank' => 'New Window',
1075 1075
         '_self' => 'Same Window',
1076 1076
     ),
1077 1077
     'dashlet_auto_refresh_options' =>
1078
-    array (
1078
+    array(
1079 1079
         '-1'  => 'Do not auto-refresh',
1080 1080
         '30'  => 'Every 30 seconds',
1081 1081
         '60'  => 'Every 1 minute',
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
         '600'   => 'Every 10 minutes',
1085 1085
     ),
1086 1086
   'dashlet_auto_refresh_options_admin' =>
1087
-    array (
1087
+    array(
1088 1088
         '-1'  => 'Never',
1089 1089
         '30'  => 'Every 30 seconds',
1090 1090
         '60'  => 'Every 1 minute',
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
   ),
1129 1129
 );
1130 1130
 
1131
-$app_strings = array (
1131
+$app_strings = array(
1132 1132
   'LBL_TOUR_NEXT' => 'Next',
1133 1133
   'LBL_TOUR_SKIP' => 'Skip',
1134 1134
   'LBL_TOUR_BACK' => 'Back',
@@ -2255,7 +2255,7 @@  discard block
 block discarded – undo
2255 2255
     'LBL_COPY_ADDRESS_FROM_LEFT' => 'Copy address from left:',
2256 2256
     'LBL_SAVE_AND_CONTINUE' => 'Save and Continue',
2257 2257
 
2258
-    'LBL_SEARCH_HELP_TEXT' => '<p><br /><strong>Multiselect controls</strong></p><ul><li>Click on the values to select an attribute.</li><li>Ctrl-click&nbsp;to&nbsp;select multiple. Mac users use CMD-click.</li><li>To select all values between two attributes,&nbsp; click first value&nbsp;and then shift-click last value.</li></ul><p><strong>Advanced Search & Layout Options</strong><br><br>Using the <b>Saved Search & Layout</b> option, you can save a set of search parameters and/or a custom List View layout in order to quickly obtain the desired search results in the future. You can save an unlimited number of custom searches and layouts. All saved searches appear by name in the Saved Searches list, with the last loaded saved search appearing at the top of the list.<br><br>To customize the List View layout, use the Hide Columns and Display Columns boxes to select which fields to display in the search results. For example, you can view or hide details such as the record name, and assigned user, and assigned team in the search results. To add a column to List View, select the field from the Hide Columns list and use the left arrow to move it to the Display Columns list. To remove a column from List View, select it from the Display Columns list and use the right arrow to move it to the Hide Columns list.<br><br>If you save layout settings, you will be able to load them at any time to view the search results in the custom layout.<br><br>To save and update a search and/or layout:<ol><li>Enter a name for the search results in the <b>Save this search as</b> field and click <b>Save</b>.The name now displays in the Saved Searches list adjacent to the <b>Clear</b> button.</li><li>To view a saved search, select it from the Saved Searches list. The search results are displayed in the List View.</li><li>To update the properties of a saved search, select the saved search from the list, enter the new search criteria and/or layout options in the Advanced Search area, and click <b>Update</b> next to <b>Modify Current Search</b>.</li><li>To delete a saved search, select it in the Saved Searches list, click <b>Delete</b> next to <b>Modify Current Search</b>, and then click <b>OK</b> to confirm the deletion.</li></ol><p><strong>Tips</strong><br><br>By using the % as a wildcard operator you can make your search more broad.  For example instead of just searching for results that equal "Apples" you could change your search to "Apples%" which would match all results that start with the word Apples but could contain other characters as well.</p>' ,
2258
+    'LBL_SEARCH_HELP_TEXT' => '<p><br /><strong>Multiselect controls</strong></p><ul><li>Click on the values to select an attribute.</li><li>Ctrl-click&nbsp;to&nbsp;select multiple. Mac users use CMD-click.</li><li>To select all values between two attributes,&nbsp; click first value&nbsp;and then shift-click last value.</li></ul><p><strong>Advanced Search & Layout Options</strong><br><br>Using the <b>Saved Search & Layout</b> option, you can save a set of search parameters and/or a custom List View layout in order to quickly obtain the desired search results in the future. You can save an unlimited number of custom searches and layouts. All saved searches appear by name in the Saved Searches list, with the last loaded saved search appearing at the top of the list.<br><br>To customize the List View layout, use the Hide Columns and Display Columns boxes to select which fields to display in the search results. For example, you can view or hide details such as the record name, and assigned user, and assigned team in the search results. To add a column to List View, select the field from the Hide Columns list and use the left arrow to move it to the Display Columns list. To remove a column from List View, select it from the Display Columns list and use the right arrow to move it to the Hide Columns list.<br><br>If you save layout settings, you will be able to load them at any time to view the search results in the custom layout.<br><br>To save and update a search and/or layout:<ol><li>Enter a name for the search results in the <b>Save this search as</b> field and click <b>Save</b>.The name now displays in the Saved Searches list adjacent to the <b>Clear</b> button.</li><li>To view a saved search, select it from the Saved Searches list. The search results are displayed in the List View.</li><li>To update the properties of a saved search, select the saved search from the list, enter the new search criteria and/or layout options in the Advanced Search area, and click <b>Update</b> next to <b>Modify Current Search</b>.</li><li>To delete a saved search, select it in the Saved Searches list, click <b>Delete</b> next to <b>Modify Current Search</b>, and then click <b>OK</b> to confirm the deletion.</li></ol><p><strong>Tips</strong><br><br>By using the % as a wildcard operator you can make your search more broad.  For example instead of just searching for results that equal "Apples" you could change your search to "Apples%" which would match all results that start with the word Apples but could contain other characters as well.</p>',
2259 2259
 
2260 2260
     //resource management
2261 2261
     'ERR_QUERY_LIMIT' => 'Error: Query limit of $limit reached for $module module.',
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
     'LBL_FIRST_INPUT_SEARCH_KEY' => '9',
2497 2497
     'LBL_GLOBAL_SEARCH_LNK_KEY' => '0',
2498 2498
     'LBL_KEYBOARD_SHORTCUTS_HELP_TITLE' => 'Keyboard Shortcuts',
2499
-    'LBL_KEYBOARD_SHORTCUTS_HELP' => '<p><strong>Form Functionality - Alt+</strong><br/> I = ed<b>I</b>t (detailview)<br/> U = d<b>U</b>plicate (detailview)<br/> D = <b>D</b>elete (detailview)<br/> A = s<b>A</b>ve (editview)<br/> L = cance<b>L</b> (editview) <br/><br/></p><p><strong>Search and Navigation  - Alt+</strong><br/> 7 = first input on Edit form<br/> 8 = Advanced Search link<br/> 9 = First Search Form input<br/> 0 = Unified search input<br></p>' ,
2499
+    'LBL_KEYBOARD_SHORTCUTS_HELP' => '<p><strong>Form Functionality - Alt+</strong><br/> I = ed<b>I</b>t (detailview)<br/> U = d<b>U</b>plicate (detailview)<br/> D = <b>D</b>elete (detailview)<br/> A = s<b>A</b>ve (editview)<br/> L = cance<b>L</b> (editview) <br/><br/></p><p><strong>Search and Navigation  - Alt+</strong><br/> 7 = first input on Edit form<br/> 8 = Advanced Search link<br/> 9 = First Search Form input<br/> 0 = Unified search input<br></p>',
2500 2500
 
2501 2501
     'ERR_CONNECTOR_NOT_ARRAY' => 'connector array in {0} been defined incorrectly or is empty and could not be used.',
2502 2502
     'ERR_SUHOSIN' => 'Upload stream is blocked by Suhosin, please add &quot;upload&quot; to suhosin.executor.include.whitelist (See suitecrm.log for more information)',
@@ -2521,13 +2521,13 @@  discard block
 block discarded – undo
2521 2521
 $app_list_strings['library_type'] = array('Books'=>'Book', 'Music'=>'Music', 'DVD'=>'DVD', 'Magazines'=>'Magazines');
2522 2522
 $app_list_strings['moduleList']['EmailAddresses'] = 'Email Address';
2523 2523
 $app_list_strings['project_priority_default'] = 'Medium';
2524
-$app_list_strings['project_priority_options'] = array (
2524
+$app_list_strings['project_priority_options'] = array(
2525 2525
     'High' => 'High',
2526 2526
     'Medium' => 'Medium',
2527 2527
     'Low' => 'Low',
2528 2528
 );
2529 2529
 
2530
-$app_list_strings['kbdocument_status_dom'] = array (
2530
+$app_list_strings['kbdocument_status_dom'] = array(
2531 2531
     'Draft' => 'Draft',
2532 2532
     'Expired' => 'Expired',
2533 2533
     'In Review' => 'In Review',
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
   );
2536 2536
 
2537 2537
    $app_list_strings['kbadmin_actions_dom'] =
2538
-    array (
2538
+    array(
2539 2539
     ''          => '--Admin Actions--',
2540 2540
     'Create New Tag' => 'Create New Tag',
2541 2541
     'Delete Tag'=>'Delete Tag',
@@ -3106,26 +3106,26 @@  discard block
 block discarded – undo
3106 3106
   'Asia/Magadan' => 'Asia/Magadan',
3107 3107
   'Asia/Kamchatka' => 'Asia/Kamchatka',
3108 3108
   'Asia/Anadyr' => 'Asia/Anadyr',
3109
-  'Europe/Belgrade' => 'Europe/Belgrade' ,
3110
-  'Europe/Madrid' =>'Europe/Madrid' ,
3109
+  'Europe/Belgrade' => 'Europe/Belgrade',
3110
+  'Europe/Madrid' =>'Europe/Madrid',
3111 3111
   'Africa/Ceuta' => 'Africa/Ceuta',
3112 3112
   'Atlantic/Canary' => 'Atlantic/Canary',
3113 3113
   'Europe/Stockholm' => 'Europe/Stockholm',
3114
-  'Europe/Zurich' => 'Europe/Zurich' ,
3114
+  'Europe/Zurich' => 'Europe/Zurich',
3115 3115
   'Europe/Istanbul' => 'Europe/Istanbul',
3116 3116
   'Europe/Kiev' => 'Europe/Kiev',
3117 3117
   'Europe/Uzhgorod' => 'Europe/Uzhgorod',
3118 3118
   'Europe/Zaporozhye' => 'Europe/Zaporozhye',
3119 3119
   'Europe/Simferopol' => 'Europe/Simferopol',
3120 3120
   'America/New_York' => 'America/New_York',
3121
-  'America/Chicago' =>'America/Chicago' ,
3121
+  'America/Chicago' =>'America/Chicago',
3122 3122
   'America/North_Dakota/Center' => 'America/North_Dakota/Center',
3123 3123
   'America/Denver' => 'America/Denver',
3124 3124
   'America/Los_Angeles' => 'America/Los_Angeles',
3125 3125
   'America/Juneau' => 'America/Juneau',
3126 3126
   'America/Yakutat' => 'America/Yakutat',
3127 3127
   'America/Anchorage' => 'America/Anchorage',
3128
-  'America/Nome' =>'America/Nome' ,
3128
+  'America/Nome' =>'America/Nome',
3129 3129
   'America/Adak' => 'America/Adak',
3130 3130
   'Pacific/Honolulu' => 'Pacific/Honolulu',
3131 3131
   'America/Phoenix' => 'America/Phoenix',
@@ -3134,17 +3134,17 @@  discard block
 block discarded – undo
3134 3134
   'America/Indiana/Marengo' => 'America/Indiana/Marengo',
3135 3135
   'America/Indiana/Knox' =>  'America/Indiana/Knox',
3136 3136
   'America/Indiana/Vevay' => 'America/Indiana/Vevay',
3137
-  'America/Kentucky/Louisville' =>'America/Kentucky/Louisville'  ,
3138
-  'America/Kentucky/Monticello' =>  'America/Kentucky/Monticello' ,
3137
+  'America/Kentucky/Louisville' =>'America/Kentucky/Louisville',
3138
+  'America/Kentucky/Monticello' =>  'America/Kentucky/Monticello',
3139 3139
   'America/Detroit' => 'America/Detroit',
3140 3140
   'America/Menominee' => 'America/Menominee',
3141 3141
   'America/St_Johns' => 'America/St_Johns',
3142
-  'America/Goose_Bay' => 'America/Goose_Bay' ,
3142
+  'America/Goose_Bay' => 'America/Goose_Bay',
3143 3143
   'America/Halifax' => 'America/Halifax',
3144
-  'America/Glace_Bay' =>'America/Glace_Bay' ,
3144
+  'America/Glace_Bay' =>'America/Glace_Bay',
3145 3145
   'America/Montreal' => 'America/Montreal',
3146 3146
   'America/Toronto' => 'America/Toronto',
3147
-  'America/Thunder_Bay' => 'America/Thunder_Bay' ,
3147
+  'America/Thunder_Bay' => 'America/Thunder_Bay',
3148 3148
   'America/Nipigon' => 'America/Nipigon',
3149 3149
   'America/Rainy_River' => 'America/Rainy_River',
3150 3150
   'America/Winnipeg' => 'America/Winnipeg',
@@ -3153,14 +3153,14 @@  discard block
 block discarded – undo
3153 3153
   'America/Edmonton' =>  'America/Edmonton',
3154 3154
   'America/Vancouver' => 'America/Vancouver',
3155 3155
   'America/Dawson_Creek' => 'America/Dawson_Creek',
3156
-  'America/Pangnirtung' => 'America/Pangnirtung'  ,
3157
-  'America/Iqaluit' => 'America/Iqaluit' ,
3158
-  'America/Coral_Harbour' => 'America/Coral_Harbour' ,
3156
+  'America/Pangnirtung' => 'America/Pangnirtung',
3157
+  'America/Iqaluit' => 'America/Iqaluit',
3158
+  'America/Coral_Harbour' => 'America/Coral_Harbour',
3159 3159
   'America/Rankin_Inlet' => 'America/Rankin_Inlet',
3160 3160
   'America/Cambridge_Bay' => 'America/Cambridge_Bay',
3161 3161
   'America/Yellowknife' => 'America/Yellowknife',
3162
-  'America/Inuvik' =>'America/Inuvik' ,
3163
-  'America/Whitehorse' => 'America/Whitehorse' ,
3162
+  'America/Inuvik' =>'America/Inuvik',
3163
+  'America/Whitehorse' => 'America/Whitehorse',
3164 3164
   'America/Dawson' => 'America/Dawson',
3165 3165
   'America/Cancun' => 'America/Cancun',
3166 3166
   'America/Merida' => 'America/Merida',
@@ -3172,7 +3172,7 @@  discard block
 block discarded – undo
3172 3172
   'America/Tijuana' => 'America/Tijuana',
3173 3173
   'America/Anguilla' => 'America/Anguilla',
3174 3174
   'America/Antigua' => 'America/Antigua',
3175
-  'America/Nassau' =>'America/Nassau' ,
3175
+  'America/Nassau' =>'America/Nassau',
3176 3176
   'America/Barbados' => 'America/Barbados',
3177 3177
   'America/Belize' => 'America/Belize',
3178 3178
   'Atlantic/Bermuda' => 'Atlantic/Bermuda',
@@ -3192,7 +3192,7 @@  discard block
 block discarded – undo
3192 3192
   'America/Montserrat' => 'America/Montserrat',
3193 3193
   'America/Managua' => 'America/Managua',
3194 3194
   'America/Panama' => 'America/Panama',
3195
-  'America/Puerto_Rico' =>'America/Puerto_Rico' ,
3195
+  'America/Puerto_Rico' =>'America/Puerto_Rico',
3196 3196
   'America/St_Kitts' => 'America/St_Kitts',
3197 3197
   'America/St_Lucia' => 'America/St_Lucia',
3198 3198
   'America/Miquelon' => 'America/Miquelon',
@@ -3228,11 +3228,11 @@  discard block
 block discarded – undo
3228 3228
   'America/Eirunepe' => 'America/Eirunepe',
3229 3229
   'America/Rio_Branco' => 'America/Rio_Branco',
3230 3230
   'America/Santiago' => 'America/Santiago',
3231
-  'Pacific/Easter' => 'Pacific/Easter' ,
3231
+  'Pacific/Easter' => 'Pacific/Easter',
3232 3232
   'America/Bogota' => 'America/Bogota',
3233 3233
   'America/Curacao' => 'America/Curacao',
3234 3234
   'America/Guayaquil' => 'America/Guayaquil',
3235
-  'Pacific/Galapagos' => 'Pacific/Galapagos' ,
3235
+  'Pacific/Galapagos' => 'Pacific/Galapagos',
3236 3236
   'Atlantic/Stanley' => 'Atlantic/Stanley',
3237 3237
   'America/Cayenne' => 'America/Cayenne',
3238 3238
   'America/Guyana' => 'America/Guyana',
@@ -3246,7 +3246,7 @@  discard block
 block discarded – undo
3246 3246
   );
3247 3247
 
3248 3248
   $app_list_strings['moduleList']['Sugar_Favorites'] = 'Favorites';
3249
-  $app_list_strings['eapm_list']= array(
3249
+  $app_list_strings['eapm_list'] = array(
3250 3250
     'Sugar'=>'SuiteCRM',
3251 3251
     'WebEx'=>'WebEx',
3252 3252
     'GoToMeeting'=>'GoToMeeting',
@@ -3256,10 +3256,10 @@  discard block
 block discarded – undo
3256 3256
     'Facebook'=>'Facebook',
3257 3257
     'Twitter'=>'Twitter',
3258 3258
   );
3259
-  $app_list_strings['eapm_list_import']= array(
3259
+  $app_list_strings['eapm_list_import'] = array(
3260 3260
   	'Google' => 'Google Contacts',
3261 3261
   );
3262
-$app_list_strings['eapm_list_documents']= array(
3262
+$app_list_strings['eapm_list_documents'] = array(
3263 3263
   	'Google' => 'Google Docs',
3264 3264
   );
3265 3265
 	$app_list_strings['token_status'] = array(
@@ -3268,23 +3268,23 @@  discard block
 block discarded – undo
3268 3268
         3 => 'Invalid',
3269 3269
     );
3270 3270
 
3271
-$app_list_strings ['emailTemplates_type_list'] = array (
3272
-    '' => '' ,
3273
-    'campaign' => 'Campaign' ,
3271
+$app_list_strings ['emailTemplates_type_list'] = array(
3272
+    '' => '',
3273
+    'campaign' => 'Campaign',
3274 3274
     'email' => 'Email',
3275 3275
   );
3276 3276
 
3277
-$app_list_strings ['emailTemplates_type_list_campaigns'] = array (
3278
-    '' => '' ,
3279
-    'campaign' => 'Campaign' ,
3277
+$app_list_strings ['emailTemplates_type_list_campaigns'] = array(
3278
+    '' => '',
3279
+    'campaign' => 'Campaign',
3280 3280
   );
3281 3281
 
3282
-$app_list_strings ['emailTemplates_type_list_no_workflow'] = array (
3283
-    '' => '' ,
3284
-    'campaign' => 'Campaign' ,
3282
+$app_list_strings ['emailTemplates_type_list_no_workflow'] = array(
3283
+    '' => '',
3284
+    'campaign' => 'Campaign',
3285 3285
     'email' => 'Email',
3286 3286
   );
3287
-$app_strings ['documentation'] = array (
3287
+$app_strings ['documentation'] = array(
3288 3288
     'LBL_DOCS' => 'Documentation',
3289 3289
     'ULT' => '02_Sugar_Ultimate',
3290 3290
 	'ENT' => '02_Sugar_Enterprise',
@@ -3342,14 +3342,14 @@  discard block
 block discarded – undo
3342 3342
 
3343 3343
 //aop
3344 3344
 $app_list_strings['case_state_dom'] =
3345
-    array (
3345
+    array(
3346 3346
         'Open' => 'Open',
3347 3347
         'Closed' => 'Closed',
3348 3348
     );
3349 3349
 $app_list_strings['case_state_default_key'] = 'Open';
3350 3350
 $app_list_strings['case_status_default_key'] = 'Open_New';
3351 3351
 $app_list_strings['case_status_dom'] =
3352
-    array (
3352
+    array(
3353 3353
         'Open_New' => 'New',
3354 3354
         'Open_Assigned' => 'Assigned',
3355 3355
         'Closed_Closed' => 'Closed',
@@ -3358,11 +3358,11 @@  discard block
 block discarded – undo
3358 3358
         'Closed_Duplicate' => 'Duplicate',
3359 3359
     );
3360 3360
 $app_list_strings['contact_portal_user_type_dom'] =
3361
-    array (
3361
+    array(
3362 3362
         'Single' => 'Single user',
3363 3363
         'Account' => 'Account user',
3364 3364
     );
3365
-$app_list_strings['dom_email_distribution_for_auto_create']=array (
3365
+$app_list_strings['dom_email_distribution_for_auto_create'] = array(
3366 3366
     'AOPDefault' => 'Use AOP Default',
3367 3367
     'singleUser' => 'Single User',
3368 3368
     'roundRobin' => 'Round-Robin',
@@ -3989,6 +3989,6 @@  discard block
 block discarded – undo
3989 3989
 
3990 3990
 $app_strings['LBL_DISCOVER_SUITECRM'] = 'Discover SuiteCRM';
3991 3991
 
3992
-$app_list_strings['collection_temp_list'] = array ( 'Tasks' => 'Tasks', 'Meetings' => 'Meetings', 'Calls' => 'Calls', 'Notes' => 'Notes', 'Emails' => 'Emails' );
3992
+$app_list_strings['collection_temp_list'] = array('Tasks' => 'Tasks', 'Meetings' => 'Meetings', 'Calls' => 'Calls', 'Notes' => 'Notes', 'Emails' => 'Emails');
3993 3993
 
3994 3994
 ?>
Please login to merge, or discard this patch.
include/SubPanel/SubPanelSearchDisplay.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
-ini_set('display_errors',1);
41
+ini_set('display_errors', 1);
42 42
 
43 43
 global $beanList;
44 44
 global $beanFiles;
45 45
 
46 46
 
47
-if(empty($_REQUEST['module']))
47
+if (empty($_REQUEST['module']))
48 48
 {
49 49
 	die("'module' was not defined");
50 50
 }
51 51
 
52
-if(!isset($beanList[$_REQUEST['module']]))
52
+if (!isset($beanList[$_REQUEST['module']]))
53 53
 {
54 54
 	die("'".$_REQUEST['module']."' is not defined in \$beanList");
55 55
 }
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 
67 67
 include('include/SubPanel/SubPanel.php');
68 68
 $layout_def_key = '';
69
-if(!empty($_REQUEST['layout_def_key'])){
69
+if (!empty($_REQUEST['layout_def_key'])) {
70 70
 	$layout_def_key = $_REQUEST['layout_def_key'];
71 71
 }
72 72
 
73
-$subpanel_object = new CustomSubPanel($module, $record, $subpanel,null, $layout_def_key, $collection);
73
+$subpanel_object = new CustomSubPanel($module, $record, $subpanel, null, $layout_def_key, $collection);
74 74
 
75 75
 echo $subpanel_object->getSearchForm();
76 76
 
Please login to merge, or discard this patch.