Test Failed
Push — CI ( 02428e...3e0292 )
by Adam
55:43
created
include/InlineEditing/InlineEditing.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@
 block discarded – undo
144 144
             $contents = str_replace('"' . $vardef['name'] . '"', '{/literal}"{$fields.' . $vardef['name'] . '.name}"{literal}', $contents);
145 145
             // regex below fixes button javascript for flexi relationship
146 146
             if($vardef['type'] == 'parent') {
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);
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
         }
150 150
 
Please login to merge, or discard this 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.
Braces   +28 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@  discard block
 block discarded – undo
75 75
             $vardef['type'] = 'varchar';
76 76
         }
77 77
 
78
-        if (isset($vardef['precision'])) unset($vardef['precision']);
78
+        if (isset($vardef['precision'])) {
79
+            unset($vardef['precision']);
80
+        }
79 81
 
80 82
         //$vardef['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
81 83
 
@@ -115,8 +117,9 @@  discard block
 block discarded – undo
115 117
         if (isset($vardef['function'])
116 118
             && ($vardef['function'] == 'getEmailAddressWidget'
117 119
                 || $vardef['function']['name'] == 'getEmailAddressWidget')
118
-        )
119
-            unset($vardef['function']);
120
+        ) {
121
+                    unset($vardef['function']);
122
+        }
120 123
 
121 124
         if (isset($vardef['name']) && ($vardef['name'] == 'date_modified')) {
122 125
             $vardef['name'] = 'aow_temp_date';
@@ -149,8 +152,9 @@  discard block
 block discarded – undo
149 152
         }
150 153
 
151 154
         // hack to disable one of the js calls in this control
152
-        if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown'))
153
-            $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
155
+        if (isset($vardef['function']) && ($vardef['function'] == 'getCurrencyDropDown' || $vardef['function']['name'] == 'getCurrencyDropDown')) {
156
+                    $contents .= "{literal}<script>function CurrencyConvertAll() { return; }</script>{/literal}";
157
+        }
154 158
 
155 159
 
156 160
 
@@ -186,8 +190,9 @@  discard block
 block discarded – undo
186 190
     $ss->assign('CALENDAR_FDOW', $current_user->get_first_day_of_week());
187 191
 
188 192
     $fieldlist = array();
189
-    if (!isset($focus) || !($focus instanceof SugarBean))
190
-        require_once($beanFiles[$beanList[$module]]);
193
+    if (!isset($focus) || !($focus instanceof SugarBean)) {
194
+            require_once($beanFiles[$beanList[$module]]);
195
+    }
191 196
     $focus = new $beanList[$module];
192 197
     // create the dropdowns for the parent type fields
193 198
     $vardefFields[$fieldname] = $focus->field_defs[$fieldname];
@@ -197,14 +202,17 @@  discard block
 block discarded – undo
197 202
     foreach ($vardefFields as $name => $properties) {
198 203
         $fieldlist[$name] = $properties;
199 204
         // fill in enums
200
-        if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']]))
201
-            $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
205
+        if (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($app_list_strings[$fieldlist[$name]['options']])) {
206
+                    $fieldlist[$name]['options'] = $app_list_strings[$fieldlist[$name]['options']];
207
+        }
202 208
         // Bug 32626: fall back on checking the mod_strings if not in the app_list_strings
203
-        elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']]))
204
-            $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
209
+        elseif (isset($fieldlist[$name]['options']) && is_string($fieldlist[$name]['options']) && isset($mod_strings[$fieldlist[$name]['options']])) {
210
+                    $fieldlist[$name]['options'] = $mod_strings[$fieldlist[$name]['options']];
211
+        }
205 212
         // Bug 22730: make sure all enums have the ability to select blank as the default value.
206
-        if (!isset($fieldlist[$name]['options']['']))
207
-            $fieldlist[$name]['options'][''] = '';
213
+        if (!isset($fieldlist[$name]['options'][''])) {
214
+                    $fieldlist[$name]['options'][''] = '';
215
+        }
208 216
     }
209 217
 
210 218
     // fill in function return values
@@ -212,8 +220,9 @@  discard block
 block discarded – undo
212 220
         if (!empty($fieldlist[$fieldname]['function']['returns']) && $fieldlist[$fieldname]['function']['returns'] == 'html') {
213 221
             $function = $fieldlist[$fieldname]['function']['name'];
214 222
             // include various functions required in the various vardefs
215
-            if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include']))
216
-                require_once($fieldlist[$fieldname]['function']['include']);
223
+            if (isset($fieldlist[$fieldname]['function']['include']) && is_file($fieldlist[$fieldname]['function']['include'])) {
224
+                            require_once($fieldlist[$fieldname]['function']['include']);
225
+            }
217 226
             $_REQUEST[$fieldname] = $value;
218 227
             $value = $function($focus, $fieldname, $value, $view);
219 228
 
@@ -311,14 +320,14 @@  discard block
 block discarded – undo
311 320
 
312 321
         if ($bean->field_defs[$field]['type'] == "multienum") {
313 322
             $bean->$field = encodeMultienumValue($value);
314
-        }else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){
323
+        } else if ($bean->field_defs[$field]['type'] == "relate" || $bean->field_defs[$field]['type'] == 'parent'){
315 324
             $save_field = $bean->field_defs[$field]['id_name'];
316 325
             $bean->$save_field = $value;
317 326
             if ($bean->field_defs[$field]['type'] == 'parent') {
318 327
                 $bean->parent_type = $_REQUEST['parent_type'];
319 328
                 $bean->fill_in_additional_parent_fields(); // get up to date parent info as need it to display name
320 329
             }
321
-        }else{
330
+        } else{
322 331
             $bean->$field = $value;
323 332
         }
324 333
 
@@ -449,7 +458,7 @@  discard block
 block discarded – undo
449 458
         if($vardef['ext2']){
450 459
             $value .= getFieldValueFromModule($vardef['rname'],$vardef['ext2'],$record) . "</a>";
451 460
 
452
-        }else if(!empty($vardef['rname'])){
461
+        } else if(!empty($vardef['rname'])){
453 462
             $value .= getFieldValueFromModule($vardef['rname'],$vardef['module'],$record) . "</a>";
454 463
 
455 464
         } else {
@@ -486,7 +495,7 @@  discard block
 block discarded – undo
486 495
 
487 496
     if($bean->ACLAccess('EditView')) {
488 497
         return true;
489
-    }else {
498
+    } else {
490 499
         return false;
491 500
     }
492 501
 }
Please login to merge, or discard this patch.
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -330,6 +330,9 @@  discard block
 block discarded – undo
330 330
 
331 331
 }
332 332
 
333
+/**
334
+ * @param SugarBean $bean
335
+ */
333 336
 function getDisplayValue($bean, $field, $method = "save")
334 337
 {
335 338
 
@@ -471,6 +474,9 @@  discard block
 block discarded – undo
471 474
 
472 475
 }
473 476
 
477
+/**
478
+ * @return string
479
+ */
474 480
 function convertDateUserToDB($value)
475 481
 {
476 482
     global $timedate;
@@ -482,6 +488,9 @@  discard block
 block discarded – undo
482 488
     return $value;
483 489
 }
484 490
 
491
+/**
492
+ * @param SugarBean $bean
493
+ */
485 494
 function checkAccess($bean){
486 495
 
487 496
     if($bean->ACLAccess('EditView')) {
Please login to merge, or discard this patch.
include/phpmailer/language/phpmailer.lang-ar.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 $PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.';
20 20
 $PHPMAILER_LANG['provide_address']      = 'يجب توفير عنوان البريد الإلكتروني لمستلم واحد على الأقل.';
21 21
 $PHPMAILER_LANG['recipients_failed']    = 'خطأ SMTP: الأخطاء التالية ' .
22
-                                          'فشل في الارسال لكل من : ';
22
+                                            'فشل في الارسال لكل من : ';
23 23
 $PHPMAILER_LANG['signing']              = 'خطأ في التوقيع: ';
24 24
 $PHPMAILER_LANG['smtp_connect_failed']  = 'SMTP Connect() غير ممكن.';
25 25
 $PHPMAILER_LANG['smtp_error']           = 'خطأ على مستوى الخادم SMTP: ';
Please login to merge, or discard this 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 4 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
  */
55 55
 function checkRequired($prefix, $required)
56 56
 {
57
-	foreach($required as $key)
58
-	{
59
-		if(!isset($_POST[$prefix.$key]) || number_empty($_POST[$prefix.$key]))
60
-		{
61
-			return false;
62
-		}
63
-	}
64
-	return true;
57
+    foreach($required as $key)
58
+    {
59
+        if(!isset($_POST[$prefix.$key]) || number_empty($_POST[$prefix.$key]))
60
+        {
61
+            return false;
62
+        }
63
+    }
64
+    return true;
65 65
 }
66 66
 
67 67
 /**
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function populateFromPost($prefix, &$focus, $skipRetrieve = false, $checkACL = false)
77 77
 {
78
-	global $current_user;
78
+    global $current_user;
79 79
 
80
-	if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve)
81
-		$focus->retrieve($_REQUEST[$prefix.'record']);
80
+    if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve)
81
+        $focus->retrieve($_REQUEST[$prefix.'record']);
82 82
 
83
-	if(!empty($_POST['assigned_user_id']) && 
84
-	    ($focus->assigned_user_id != $_POST['assigned_user_id']) && 
85
-	    ($_POST['assigned_user_id'] != $current_user->id)) {
86
-		$GLOBALS['check_notify'] = true;
87
-	}
83
+    if(!empty($_POST['assigned_user_id']) && 
84
+        ($focus->assigned_user_id != $_POST['assigned_user_id']) && 
85
+        ($_POST['assigned_user_id'] != $current_user->id)) {
86
+        $GLOBALS['check_notify'] = true;
87
+    }
88 88
     if(isset($_POST['dup_checked']) && $_POST['dup_checked'] && isset($_POST['id']) && $_POST['id'] != '' ){
89 89
         $focus->new_with_id = true;
90 90
     }
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
         $relatedFields[$def['id_name']] = $field;
107 107
     }
108 108
 
109
-	foreach($focus->field_defs as $field=>$def) {
109
+    foreach($focus->field_defs as $field=>$def) {
110 110
         if ( $field == 'id' && !empty($focus->id) ) {
111 111
             // Don't try and overwrite the ID
112 112
             continue;
113 113
         }
114 114
 
115 115
 
116
-	    $type = !empty($def['custom_type']) ? $def['custom_type'] : $def['type'];
117
-		$sf = $sfh->getSugarField($type);
116
+        $type = !empty($def['custom_type']) ? $def['custom_type'] : $def['type'];
117
+        $sf = $sfh->getSugarField($type);
118 118
         if($sf != null){
119 119
             $sf->save($focus, $_POST, $field, $def, $prefix);
120 120
         } else {
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 			$focus->$field = '';
153 153
 		}
154 154
 */
155
-	}
155
+    }
156 156
 
157
-	foreach($focus->additional_column_fields as $field) {
158
-		if(isset($_POST[$prefix.$field])) {
159
-			$value = $_POST[$prefix.$field];
160
-			$focus->$field = $value;
161
-		}
162
-	}
163
-	return $focus;
157
+    foreach($focus->additional_column_fields as $field) {
158
+        if(isset($_POST[$prefix.$field])) {
159
+            $value = $_POST[$prefix.$field];
160
+            $focus->$field = $value;
161
+        }
162
+    }
163
+    return $focus;
164 164
 }
165 165
 
166 166
 function add_hidden_elements($key, $value) {
@@ -182,73 +182,73 @@  discard block
 block discarded – undo
182 182
 
183 183
 function getPostToForm($ignore='', $isRegularExpression=false)
184 184
 {
185
-	$fields = '';
186
-	if(!empty($ignore) && $isRegularExpression) {
187
-		foreach ($_POST as $key=>$value){
188
-			if(!preg_match($ignore, $key)) {
185
+    $fields = '';
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
-			}
191
-		}	
192
-	} else {
193
-		foreach ($_POST as $key=>$value){
194
-			if($key != $ignore) {
190
+            }
191
+        }	
192
+    } else {
193
+        foreach ($_POST as $key=>$value){
194
+            if($key != $ignore) {
195 195
                                 $fields .= add_hidden_elements($key, $value);
196
-			}
197
-		}
198
-	}
199
-	return $fields;
196
+            }
197
+        }
198
+    }
199
+    return $fields;
200 200
 }
201 201
 
202 202
 function getGetToForm($ignore='', $usePostAsAuthority = false)
203 203
 {
204
-	$fields = '';
205
-	foreach ($_GET as $key=>$value)
206
-	{
207
-		if($key != $ignore){
208
-			if(!$usePostAsAuthority || !isset($_POST[$key])){
209
-				$fields.= "<input type='hidden' name='$key' value='$value'>";
210
-			}
211
-		}
212
-	}
213
-	return $fields;
204
+    $fields = '';
205
+    foreach ($_GET as $key=>$value)
206
+    {
207
+        if($key != $ignore){
208
+            if(!$usePostAsAuthority || !isset($_POST[$key])){
209
+                $fields.= "<input type='hidden' name='$key' value='$value'>";
210
+            }
211
+        }
212
+    }
213
+    return $fields;
214 214
 
215 215
 }
216 216
 function getAnyToForm($ignore='', $usePostAsAuthority = false)
217 217
 {
218
-	$fields = getPostToForm($ignore);
219
-	$fields .= getGetToForm($ignore, $usePostAsAuthority);
220
-	return $fields;
218
+    $fields = getPostToForm($ignore);
219
+    $fields .= getGetToForm($ignore, $usePostAsAuthority);
220
+    return $fields;
221 221
 
222 222
 }
223 223
 
224 224
 function handleRedirect($return_id='', $return_module='', $additionalFlags = false)
225 225
 {
226
-	if(isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "")
227
-	{
228
-		header("Location: ". $_REQUEST['return_url']);
229
-		exit;
230
-	}
231
-
232
-	$url = buildRedirectURL($return_id, $return_module);
233
-	header($url);
234
-	exit;	
226
+    if(isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "")
227
+    {
228
+        header("Location: ". $_REQUEST['return_url']);
229
+        exit;
230
+    }
231
+
232
+    $url = buildRedirectURL($return_id, $return_module);
233
+    header($url);
234
+    exit;	
235 235
 }
236 236
 
237 237
 //eggsurplus: abstract to simplify unit testing
238 238
 function buildRedirectURL($return_id='', $return_module='') 
239 239
 {
240 240
     if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
241
-	{
242
-		$return_module = $_REQUEST['return_module'];
243
-	}
244
-	else
245
-	{
246
-		$return_module = $return_module;
247
-	}
248
-	if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "")
249
-	{
241
+    {
242
+        $return_module = $_REQUEST['return_module'];
243
+    }
244
+    else
245
+    {
246
+        $return_module = $return_module;
247
+    }
248
+    if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "")
249
+    {
250 250
 	    
251
-	   //if we are doing a "Close and Create New"
251
+        //if we are doing a "Close and Create New"
252 252
         if(isCloseAndCreateNewPressed())
253 253
         {
254 254
             $return_action = "EditView";    
@@ -257,40 +257,40 @@  discard block
 block discarded – undo
257 257
             
258 258
             // Meeting Integration
259 259
             if(isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) {
260
-            	$additionalFlags = array('meetingIntegrationShowForm' => '1');
260
+                $additionalFlags = array('meetingIntegrationShowForm' => '1');
261 261
             }
262 262
             // END Meeting Integration
263 263
         } 
264
-		// if we create a new record "Save", we want to redirect to the DetailView
265
-		else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" 
266
-			&& $_REQUEST['return_module'] != 'Activities'
267
-			&& $_REQUEST['return_module'] != 'Home' 
268
-			&& $_REQUEST['return_module'] != 'Forecasts' 
269
-			&& $_REQUEST['return_module'] != 'Calendar'
270
-			&& $_REQUEST['return_module'] != 'MailMerge'
271
-			) 
272
-			{
273
-			    $return_action = 'DetailView';
274
-			} elseif($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') {
275
-			$return_module = $_REQUEST['module'];
276
-			$return_action = $_REQUEST['return_action']; 
277
-			// wp: return action needs to be set for one-click close in task list
278
-		} 
279
-		else 
280
-		{
281
-			// if we "Cancel", we go back to the list view.
282
-			$return_action = $_REQUEST['return_action'];
283
-		}
284
-	}
285
-	else
286
-	{
287
-		$return_action = "DetailView";
288
-	}
264
+        // if we create a new record "Save", we want to redirect to the DetailView
265
+        else if(isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" 
266
+            && $_REQUEST['return_module'] != 'Activities'
267
+            && $_REQUEST['return_module'] != 'Home' 
268
+            && $_REQUEST['return_module'] != 'Forecasts' 
269
+            && $_REQUEST['return_module'] != 'Calendar'
270
+            && $_REQUEST['return_module'] != 'MailMerge'
271
+            ) 
272
+            {
273
+                $return_action = 'DetailView';
274
+            } elseif($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') {
275
+            $return_module = $_REQUEST['module'];
276
+            $return_action = $_REQUEST['return_action']; 
277
+            // wp: return action needs to be set for one-click close in task list
278
+        } 
279
+        else 
280
+        {
281
+            // if we "Cancel", we go back to the list view.
282
+            $return_action = $_REQUEST['return_action'];
283
+        }
284
+    }
285
+    else
286
+    {
287
+        $return_action = "DetailView";
288
+    }
289 289
 	
290
-	if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "")
291
-	{
292
-		$return_id = $_REQUEST['return_id'];
293
-	}
290
+    if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "")
291
+    {
292
+        $return_id = $_REQUEST['return_id'];
293
+    }
294 294
 
295 295
     $add = "";
296 296
     if(isset($additionalFlags) && !empty($additionalFlags)) {
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
             return "Location: $url";
321 321
         }
322 322
     } else {
323
-    	$standard = "action=$return_action&module=$return_module&record=$return_id&isDuplicate=true&return_module=$return_module&return_action=$return_action&status=$status";
323
+        $standard = "action=$return_action&module=$return_module&record=$return_id&isDuplicate=true&return_module=$return_module&return_action=$return_action&status=$status";
324 324
         $url="index.php?{$standard}{$add}";
325 325
         if(!empty($_REQUEST['ajax_load']))
326 326
         {
327 327
             $ajax_ret = array(
328
-                 'content' => "<script>SUGAR.ajaxUI.loadContent('$url');</script>\n",
329
-                 'menu' => array(
330
-                     'module' => $return_module,
331
-                     'label' => translate($return_module),
332
-                 ),
328
+                    'content' => "<script>SUGAR.ajaxUI.loadContent('$url');</script>\n",
329
+                    'menu' => array(
330
+                        'module' => $return_module,
331
+                        'label' => translate($return_module),
332
+                    ),
333 333
             );
334 334
             $json = getJSONobj();
335 335
             echo $json->encode($ajax_ret);
@@ -341,21 +341,21 @@  discard block
 block discarded – undo
341 341
 
342 342
 function getLikeForEachWord($fieldname, $value, $minsize=4)
343 343
 {
344
-	$value = trim($value);
345
-	$values = explode(' ',$value);
346
-	$ret = '';
347
-	foreach($values as $val)
348
-	{
349
-		if(strlen($val) >= $minsize)
350
-		{
351
-			if(!empty($ret))
352
-			{
353
-				$ret .= ' or';
354
-			}
355
-			$ret .= ' '. $fieldname . ' LIKE %'.$val.'%';
356
-		}
344
+    $value = trim($value);
345
+    $values = explode(' ',$value);
346
+    $ret = '';
347
+    foreach($values as $val)
348
+    {
349
+        if(strlen($val) >= $minsize)
350
+        {
351
+            if(!empty($ret))
352
+            {
353
+                $ret .= ' or';
354
+            }
355
+            $ret .= ' '. $fieldname . ' LIKE %'.$val.'%';
356
+        }
357 357
 
358
-	}
358
+    }
359 359
 
360 360
 
361 361
 }
Please login to merge, or discard this 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.
Braces   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -77,8 +79,9 @@  discard block
 block discarded – undo
77 79
 {
78 80
 	global $current_user;
79 81
 
80
-	if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve)
81
-		$focus->retrieve($_REQUEST[$prefix.'record']);
82
+	if(!empty($_REQUEST[$prefix.'record']) && !$skipRetrieve) {
83
+			$focus->retrieve($_REQUEST[$prefix.'record']);
84
+	}
82 85
 
83 86
 	if(!empty($_POST['assigned_user_id']) && 
84 87
 	    ($focus->assigned_user_id != $_POST['assigned_user_id']) && 
@@ -240,8 +243,7 @@  discard block
 block discarded – undo
240 243
     if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
241 244
 	{
242 245
 		$return_module = $_REQUEST['return_module'];
243
-	}
244
-	else
246
+	} else
245 247
 	{
246 248
 		$return_module = $return_module;
247 249
 	}
@@ -275,14 +277,12 @@  discard block
 block discarded – undo
275 277
 			$return_module = $_REQUEST['module'];
276 278
 			$return_action = $_REQUEST['return_action']; 
277 279
 			// wp: return action needs to be set for one-click close in task list
278
-		} 
279
-		else 
280
+		} else 
280 281
 		{
281 282
 			// if we "Cancel", we go back to the list view.
282 283
 			$return_action = $_REQUEST['return_action'];
283 284
 		}
284
-	}
285
-	else
285
+	} else
286 286
 	{
287 287
 		$return_action = "DetailView";
288 288
 	}
@@ -378,8 +378,7 @@  discard block
 block discarded – undo
378 378
     $focus=BeanFactory::getBean('Prospects');
379 379
     if(is_array($child_id)){
380 380
         $uids = $child_id;
381
-    }
382
-    else{
381
+    } else{
383 382
         $uids = array($child_id);
384 383
     }
385 384
 
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -235,6 +235,9 @@  discard block
 block discarded – undo
235 235
 }
236 236
 
237 237
 //eggsurplus: abstract to simplify unit testing
238
+/**
239
+ * @return string
240
+ */
238 241
 function buildRedirectURL($return_id='', $return_module='') 
239 242
 {
240 243
     if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "")
@@ -339,6 +342,9 @@  discard block
 block discarded – undo
339 342
     }
340 343
 }
341 344
 
345
+/**
346
+ * @param string $fieldname
347
+ */
342 348
 function getLikeForEachWord($fieldname, $value, $minsize=4)
343 349
 {
344 350
 	$value = trim($value);
Please login to merge, or discard this patch.
include/utils.php 4 patches
Indentation   +2374 added lines, -2374 removed lines patch added patch discarded remove patch
@@ -51,381 +51,381 @@  discard block
 block discarded – undo
51 51
 
52 52
 function make_sugar_config(&$sugar_config)
53 53
 {
54
-	/* used to convert non-array config.php file to array format */
55
-	global $admin_export_only;
56
-	global $cache_dir;
57
-	global $calculate_response_time;
58
-	global $create_default_user;
59
-	global $dateFormats;
60
-	global $dbconfig;
61
-	global $dbconfigoption;
62
-	global $default_action;
63
-	global $default_charset;
64
-	global $default_currency_name;
65
-	global $default_currency_symbol;
54
+    /* used to convert non-array config.php file to array format */
55
+    global $admin_export_only;
56
+    global $cache_dir;
57
+    global $calculate_response_time;
58
+    global $create_default_user;
59
+    global $dateFormats;
60
+    global $dbconfig;
61
+    global $dbconfigoption;
62
+    global $default_action;
63
+    global $default_charset;
64
+    global $default_currency_name;
65
+    global $default_currency_symbol;
66 66
     global $default_currency_iso4217;
67
-	global $defaultDateFormat;
68
-	global $default_language;
69
-	global $default_module;
70
-	global $default_password;
71
-	global $default_permission_mode;
72
-	global $default_theme;
73
-	global $defaultTimeFormat;
74
-	global $default_user_is_admin;
75
-	global $default_user_name;
76
-	global $disable_export;
77
-	global $disable_persistent_connections;
78
-	global $display_email_template_variable_chooser;
79
-	global $display_inbound_email_buttons;
80
-	global $history_max_viewed;
81
-	global $host_name;
82
-	global $import_dir;
83
-	global $languages;
84
-	global $list_max_entries_per_page;
85
-	global $lock_default_user_name;
86
-	global $log_memory_usage;
67
+    global $defaultDateFormat;
68
+    global $default_language;
69
+    global $default_module;
70
+    global $default_password;
71
+    global $default_permission_mode;
72
+    global $default_theme;
73
+    global $defaultTimeFormat;
74
+    global $default_user_is_admin;
75
+    global $default_user_name;
76
+    global $disable_export;
77
+    global $disable_persistent_connections;
78
+    global $display_email_template_variable_chooser;
79
+    global $display_inbound_email_buttons;
80
+    global $history_max_viewed;
81
+    global $host_name;
82
+    global $import_dir;
83
+    global $languages;
84
+    global $list_max_entries_per_page;
85
+    global $lock_default_user_name;
86
+    global $log_memory_usage;
87 87
     global $nameFormats;
88
-	global $requireAccounts;
89
-	global $RSS_CACHE_TIME;
90
-	global $session_dir;
91
-	global $site_URL;
92
-	global $site_url;
93
-	global $sugar_version;
94
-	global $timeFormats;
95
-	global $tmp_dir;
96
-	global $translation_string_prefix;
97
-	global $unique_key;
98
-	global $upload_badext;
99
-	global $upload_dir;
100
-	global $upload_maxsize;
101
-	global $import_max_execution_time;
102
-	global $list_max_entries_per_subpanel;
103
-	global $passwordsetting;
104
-
105
-	// assumes the following variables must be set:
106
-	// $dbconfig, $dbconfigoption, $cache_dir,  $session_dir, $site_URL, $upload_dir
107
-
108
-	$sugar_config = array (
109
-	'admin_export_only' => empty($admin_export_only) ? false : $admin_export_only,
110
-	'export_delimiter' => empty($export_delimiter) ? ',' : $export_delimiter,
111
-	'cache_dir' => empty($cache_dir) ? 'cache/' : $cache_dir,
112
-	'calculate_response_time' => empty($calculate_response_time) ? true : $calculate_response_time,
113
-	'create_default_user' => empty($create_default_user) ? false : $create_default_user,
114
-	'chartEngine' => 'Jit',
115
-	'date_formats' => empty($dateFormats) ? array(
116
-	'Y-m-d'=>'2010-12-23',
117
-	'd-m-Y' => '23-12-2010',
118
-	'm-d-Y'=>'12-23-2010',
119
-	'Y/m/d'=>'2010/12/23',
120
-	'd/m/Y' => '23/12/2010',
121
-	'm/d/Y'=>'12/23/2010',
122
-	'Y.m.d' => '2010.12.23',
123
-	'd.m.Y' => '23.12.2010',
124
-	'm.d.Y' => '12.23.2010'
125
-		) : $dateFormats,
126
-	'dbconfig' => $dbconfig,  // this must be set!!
127
-	'dbconfigoption' => $dbconfigoption,  // this must be set!!
128
-	'default_action' => empty($default_action) ? 'index' : $default_action,
129
-	'default_charset' => empty($default_charset) ? 'UTF-8' : $default_charset,
130
-	'default_currency_name' => empty($default_currency_name) ? 'US Dollar' : $default_currency_name,
131
-	'default_currency_symbol' => empty($default_currency_symbol) ? '$' : $default_currency_symbol,
132
-	'default_currency_iso4217' => empty($default_currency_iso4217) ? '$' : $default_currency_iso4217,
133
-	'default_date_format' => empty($defaultDateFormat) ? 'm/d/Y' : $defaultDateFormat,
88
+    global $requireAccounts;
89
+    global $RSS_CACHE_TIME;
90
+    global $session_dir;
91
+    global $site_URL;
92
+    global $site_url;
93
+    global $sugar_version;
94
+    global $timeFormats;
95
+    global $tmp_dir;
96
+    global $translation_string_prefix;
97
+    global $unique_key;
98
+    global $upload_badext;
99
+    global $upload_dir;
100
+    global $upload_maxsize;
101
+    global $import_max_execution_time;
102
+    global $list_max_entries_per_subpanel;
103
+    global $passwordsetting;
104
+
105
+    // assumes the following variables must be set:
106
+    // $dbconfig, $dbconfigoption, $cache_dir,  $session_dir, $site_URL, $upload_dir
107
+
108
+    $sugar_config = array (
109
+    'admin_export_only' => empty($admin_export_only) ? false : $admin_export_only,
110
+    'export_delimiter' => empty($export_delimiter) ? ',' : $export_delimiter,
111
+    'cache_dir' => empty($cache_dir) ? 'cache/' : $cache_dir,
112
+    'calculate_response_time' => empty($calculate_response_time) ? true : $calculate_response_time,
113
+    'create_default_user' => empty($create_default_user) ? false : $create_default_user,
114
+    'chartEngine' => 'Jit',
115
+    'date_formats' => empty($dateFormats) ? array(
116
+    'Y-m-d'=>'2010-12-23',
117
+    'd-m-Y' => '23-12-2010',
118
+    'm-d-Y'=>'12-23-2010',
119
+    'Y/m/d'=>'2010/12/23',
120
+    'd/m/Y' => '23/12/2010',
121
+    'm/d/Y'=>'12/23/2010',
122
+    'Y.m.d' => '2010.12.23',
123
+    'd.m.Y' => '23.12.2010',
124
+    'm.d.Y' => '12.23.2010'
125
+        ) : $dateFormats,
126
+    'dbconfig' => $dbconfig,  // this must be set!!
127
+    'dbconfigoption' => $dbconfigoption,  // this must be set!!
128
+    'default_action' => empty($default_action) ? 'index' : $default_action,
129
+    'default_charset' => empty($default_charset) ? 'UTF-8' : $default_charset,
130
+    'default_currency_name' => empty($default_currency_name) ? 'US Dollar' : $default_currency_name,
131
+    'default_currency_symbol' => empty($default_currency_symbol) ? '$' : $default_currency_symbol,
132
+    'default_currency_iso4217' => empty($default_currency_iso4217) ? '$' : $default_currency_iso4217,
133
+    'default_date_format' => empty($defaultDateFormat) ? 'm/d/Y' : $defaultDateFormat,
134 134
     'default_locale_name_format' => empty($defaultNameFormat) ? 's f l' : $defaultNameFormat,
135
-	'default_export_charset' => 'UTF-8',
136
-	'default_language' => empty($default_language) ? 'en_us' : $default_language,
137
-	'default_module' => empty($default_module) ? 'Home' : $default_module,
138
-	'default_password' => empty($default_password) ? '' : $default_password,
139
-	'default_permissions' => array (
140
-		'dir_mode' => 02770,
141
-		'file_mode' => 0755,
142
-		'chown' => '',
143
-		'chgrp' => '',
144
-	),
135
+    'default_export_charset' => 'UTF-8',
136
+    'default_language' => empty($default_language) ? 'en_us' : $default_language,
137
+    'default_module' => empty($default_module) ? 'Home' : $default_module,
138
+    'default_password' => empty($default_password) ? '' : $default_password,
139
+    'default_permissions' => array (
140
+        'dir_mode' => 02770,
141
+        'file_mode' => 0755,
142
+        'chown' => '',
143
+        'chgrp' => '',
144
+    ),
145 145
     'default_theme' => empty($default_theme) ? 'Sugar5' : $default_theme,
146 146
     'default_time_format' => empty($defaultTimeFormat) ? 'h:ia' : $defaultTimeFormat,
147
-	'default_user_is_admin' => empty($default_user_is_admin) ? false : $default_user_is_admin,
148
-	'default_user_name' => empty($default_user_name) ? '' : $default_user_name,
149
-	'disable_export' => empty($disable_export) ? false : $disable_export,
147
+    'default_user_is_admin' => empty($default_user_is_admin) ? false : $default_user_is_admin,
148
+    'default_user_name' => empty($default_user_name) ? '' : $default_user_name,
149
+    'disable_export' => empty($disable_export) ? false : $disable_export,
150 150
     'disable_persistent_connections' => empty($disable_persistent_connections) ? false : $disable_persistent_connections,
151 151
     'display_email_template_variable_chooser' => empty($display_email_template_variable_chooser) ? false : $display_email_template_variable_chooser,
152
-	'display_inbound_email_buttons' => empty($display_inbound_email_buttons) ? false : $display_inbound_email_buttons,
153
-	'history_max_viewed' => empty($history_max_viewed) ? 50 : $history_max_viewed,
154
-	'host_name' => empty($host_name) ? 'localhost' : $host_name,
155
-	'import_dir' => $import_dir,  // this must be set!!
156
-	'import_max_records_per_file' => 100,
152
+    'display_inbound_email_buttons' => empty($display_inbound_email_buttons) ? false : $display_inbound_email_buttons,
153
+    'history_max_viewed' => empty($history_max_viewed) ? 50 : $history_max_viewed,
154
+    'host_name' => empty($host_name) ? 'localhost' : $host_name,
155
+    'import_dir' => $import_dir,  // this must be set!!
156
+    'import_max_records_per_file' => 100,
157 157
     'import_max_records_total_limit' => '',
158
-	'languages' => empty($languages) ? array('en_us' => 'English (US)') : $languages,
159
-	'list_max_entries_per_page' => empty($list_max_entries_per_page) ? 20 : $list_max_entries_per_page,
160
-	'list_max_entries_per_subpanel' => empty($list_max_entries_per_subpanel) ? 10 : $list_max_entries_per_subpanel,
161
-	'lock_default_user_name' => empty($lock_default_user_name) ? false : $lock_default_user_name,
162
-	'log_memory_usage' => empty($log_memory_usage) ? false : $log_memory_usage,
158
+    'languages' => empty($languages) ? array('en_us' => 'English (US)') : $languages,
159
+    'list_max_entries_per_page' => empty($list_max_entries_per_page) ? 20 : $list_max_entries_per_page,
160
+    'list_max_entries_per_subpanel' => empty($list_max_entries_per_subpanel) ? 10 : $list_max_entries_per_subpanel,
161
+    'lock_default_user_name' => empty($lock_default_user_name) ? false : $lock_default_user_name,
162
+    'log_memory_usage' => empty($log_memory_usage) ? false : $log_memory_usage,
163 163
     'name_formats' => empty($nameFormats) ? array(
164 164
         's f l' => 's f l', 'f l' => 'f l', 's l' => 's l', 'l, s f' => 'l, s f',
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 (
169
-	    'special_query_limit' => 50000,
170
-	    'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'),
171
-	    'default_limit' => 1000,
168
+    'resource_management' => array (
169
+        'special_query_limit' => 50000,
170
+        'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'),
171
+        'default_limit' => 1000,
172 172
     ),
173
-	'require_accounts' => empty($requireAccounts) ? true : $requireAccounts,
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!!
177
-	'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable
178
-	'showThemePicker' => true,
179
-	'sugar_version' => empty($sugar_version) ? 'unknown' : $sugar_version,
180
-	'time_formats' => empty($timeFormats) ? array (
181
-	'H:i'=>'23:00', 'h:ia'=>'11:00 pm', 'h:iA'=>'11:00PM',
182
-	'H.i'=>'23.00', 'h.ia'=>'11.00 pm', 'h.iA'=>'11.00PM' ) : $timeFormats,
183
-	'tmp_dir' => $tmp_dir,  // this must be set!!
184
-	'translation_string_prefix' => empty($translation_string_prefix) ? false : $translation_string_prefix,
185
-	'unique_key' => empty($unique_key) ? md5(create_guid()) : $unique_key,
186
-	'upload_badext' => empty($upload_badext) ? array (
187
-	'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py',
188
-	'asp', 'cfm', 'js', 'vbs', 'html', 'htm' ) : $upload_badext,
189
-	'upload_dir' => $upload_dir,  // this must be set!!
190
-	'upload_maxsize' => empty($upload_maxsize) ? 30000000 : $upload_maxsize,
191
-	'import_max_execution_time' => empty($import_max_execution_time) ? 3600 : $import_max_execution_time,
192
-	'lock_homepage' => false,
193
-	'lock_subpanels' => false,
194
-	'max_dashlets_homepage' => 15,
195
-	'dashlet_display_row_options' => array('1','3','5','10'),
196
-	'default_max_tabs' => empty($max_tabs) ? '7' : $max_tabs,
197
-	'default_subpanel_tabs' =>  empty($subpanel_tabs) ? true : $subpanel_tabs,
198
-	'default_subpanel_links' => empty($subpanel_links) ? false : $subpanel_links,
199
-	'default_swap_last_viewed' => empty($swap_last_viewed) ? false : $swap_last_viewed,
200
-	'default_swap_shortcuts' => empty($swap_shortcuts) ? false : $swap_shortcuts,
201
-	'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm,
173
+    'require_accounts' => empty($requireAccounts) ? true : $requireAccounts,
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!!
177
+    'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable
178
+    'showThemePicker' => true,
179
+    'sugar_version' => empty($sugar_version) ? 'unknown' : $sugar_version,
180
+    'time_formats' => empty($timeFormats) ? array (
181
+    'H:i'=>'23:00', 'h:ia'=>'11:00 pm', 'h:iA'=>'11:00PM',
182
+    'H.i'=>'23.00', 'h.ia'=>'11.00 pm', 'h.iA'=>'11.00PM' ) : $timeFormats,
183
+    'tmp_dir' => $tmp_dir,  // this must be set!!
184
+    'translation_string_prefix' => empty($translation_string_prefix) ? false : $translation_string_prefix,
185
+    'unique_key' => empty($unique_key) ? md5(create_guid()) : $unique_key,
186
+    'upload_badext' => empty($upload_badext) ? array (
187
+    'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py',
188
+    'asp', 'cfm', 'js', 'vbs', 'html', 'htm' ) : $upload_badext,
189
+    'upload_dir' => $upload_dir,  // this must be set!!
190
+    'upload_maxsize' => empty($upload_maxsize) ? 30000000 : $upload_maxsize,
191
+    'import_max_execution_time' => empty($import_max_execution_time) ? 3600 : $import_max_execution_time,
192
+    'lock_homepage' => false,
193
+    'lock_subpanels' => false,
194
+    'max_dashlets_homepage' => 15,
195
+    'dashlet_display_row_options' => array('1','3','5','10'),
196
+    'default_max_tabs' => empty($max_tabs) ? '7' : $max_tabs,
197
+    'default_subpanel_tabs' =>  empty($subpanel_tabs) ? true : $subpanel_tabs,
198
+    'default_subpanel_links' => empty($subpanel_links) ? false : $subpanel_links,
199
+    'default_swap_last_viewed' => empty($swap_last_viewed) ? false : $swap_last_viewed,
200
+    'default_swap_shortcuts' => empty($swap_shortcuts) ? false : $swap_shortcuts,
201
+    'default_navigation_paradigm' => empty($navigation_paradigm) ? 'gm' : $navigation_paradigm,
202 202
     'default_call_status' => 'Planned',
203
-	'js_lang_version' => 1,
204
-	'passwordsetting' => empty($passwordsetting) ? array (
205
-	    'SystemGeneratedPasswordON' => '',
206
-	    'generatepasswordtmpl' => '',
207
-	    'lostpasswordtmpl' => '',
208
-	    'forgotpasswordON' => true,
209
-    	'linkexpiration' => '1',
210
-    	'linkexpirationtime' => '30',
211
-    	'linkexpirationtype' => '1',
212
-	    'systexpiration' => '0',
213
-	    'systexpirationtime' => '',
214
-	    'systexpirationtype' => '0',
215
-	    'systexpirationlogin' => '',
216
-		) : $passwordsetting,
217
-		'use_sprites' => function_exists('imagecreatetruecolor'),
218
-    	'search_wildcard_infront' => false,
203
+    'js_lang_version' => 1,
204
+    'passwordsetting' => empty($passwordsetting) ? array (
205
+        'SystemGeneratedPasswordON' => '',
206
+        'generatepasswordtmpl' => '',
207
+        'lostpasswordtmpl' => '',
208
+        'forgotpasswordON' => true,
209
+        'linkexpiration' => '1',
210
+        'linkexpirationtime' => '30',
211
+        'linkexpirationtype' => '1',
212
+        'systexpiration' => '0',
213
+        'systexpirationtime' => '',
214
+        'systexpirationtype' => '0',
215
+        'systexpirationlogin' => '',
216
+        ) : $passwordsetting,
217
+        'use_sprites' => function_exists('imagecreatetruecolor'),
218
+        'search_wildcard_infront' => false,
219 219
         'search_wildcard_char' => '%',
220
-		'jobs' => array(
221
-		    'min_retry_interval' => 60, // minimal job retry delay
222
-		    'max_retries' => 5, // how many times to retry the job
223
-		    'timeout' => 86400, // how long a job may spend as running before being force-failed
224
-		    'soft_lifetime' => 7, // how many days until job record will be soft deleted after completion
225
-		    'hard_lifetime' => 21, // how many days until job record will be purged from DB
226
-		),
227
-		"cron" => array(
228
-			'max_cron_jobs' => 10, // max jobs per cron schedule run
229
-		    'max_cron_runtime' => 60, // max runtime for cron jobs
230
-		    'min_cron_interval' => 30, // minimal interval between cron jobs
231
-		),
232
-	);
220
+        'jobs' => array(
221
+            'min_retry_interval' => 60, // minimal job retry delay
222
+            'max_retries' => 5, // how many times to retry the job
223
+            'timeout' => 86400, // how long a job may spend as running before being force-failed
224
+            'soft_lifetime' => 7, // how many days until job record will be soft deleted after completion
225
+            'hard_lifetime' => 21, // how many days until job record will be purged from DB
226
+        ),
227
+        "cron" => array(
228
+            'max_cron_jobs' => 10, // max jobs per cron schedule run
229
+            'max_cron_runtime' => 60, // max runtime for cron jobs
230
+            'min_cron_interval' => 30, // minimal interval between cron jobs
231
+        ),
232
+    );
233 233
 }
234 234
 
235 235
 function get_sugar_config_defaults() {
236
-	global $locale;
237
-	/**
238
-	 * used for getting base values for array style config.php.  used by the
239
-	 * installer and to fill in new entries on upgrades.  see also:
240
-	 * sugar_config_union
241
-	 */
236
+    global $locale;
237
+    /**
238
+     * used for getting base values for array style config.php.  used by the
239
+     * installer and to fill in new entries on upgrades.  see also:
240
+     * sugar_config_union
241
+     */
242 242
 
243
-	$sugar_config_defaults = array (
244
-	'admin_export_only' => false,
245
-	'export_delimiter' => ',',
246
-	'export_excel_compatible' => false,
247
-	'cache_dir' => 'cache/',
248
-	'calculate_response_time' => true,
249
-	'create_default_user' => false,
250
- 	'chartEngine' => 'Jit',
251
-	'date_formats' => array (
252
-	'Y-m-d' => '2010-12-23', 'm-d-Y' => '12-23-2010', 'd-m-Y' => '23-12-2010',
253
-	'Y/m/d' => '2010/12/23', 'm/d/Y' => '12/23/2010', 'd/m/Y' => '23/12/2010',
254
-	'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010',),
243
+    $sugar_config_defaults = array (
244
+    'admin_export_only' => false,
245
+    'export_delimiter' => ',',
246
+    'export_excel_compatible' => false,
247
+    'cache_dir' => 'cache/',
248
+    'calculate_response_time' => true,
249
+    'create_default_user' => false,
250
+        'chartEngine' => 'Jit',
251
+    'date_formats' => array (
252
+    'Y-m-d' => '2010-12-23', 'm-d-Y' => '12-23-2010', 'd-m-Y' => '23-12-2010',
253
+    'Y/m/d' => '2010/12/23', 'm/d/Y' => '12/23/2010', 'd/m/Y' => '23/12/2010',
254
+    'Y.m.d' => '2010.12.23', 'd.m.Y' => '23.12.2010', 'm.d.Y' => '12.23.2010',),
255 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 (
260
-	'persistent' => true,
261
-	'autofree' => false,
262
-	'debug' => 0,
263
-	'ssl' => false ),
264
-	'default_action' => 'index',
265
-	'default_charset' => return_session_value_or_default('default_charset',
266
-	'UTF-8'),
267
-	'default_currency_name' => return_session_value_or_default('default_currency_name', 'US Dollar'),
268
-	'default_currency_symbol' => return_session_value_or_default('default_currency_symbol', '$'),
269
-	'default_currency_iso4217' => return_session_value_or_default('default_currency_iso4217', 'USD'),
270
-	'default_currency_significant_digits' => return_session_value_or_default('default_currency_significant_digits', 2),
271
-	'default_number_grouping_seperator' => return_session_value_or_default('default_number_grouping_seperator', ','),
272
-	'default_decimal_seperator' => return_session_value_or_default('default_decimal_seperator', '.'),
273
-	'default_date_format' => 'm/d/Y',
259
+    'dbconfigoption' => array (
260
+    'persistent' => true,
261
+    'autofree' => false,
262
+    'debug' => 0,
263
+    'ssl' => false ),
264
+    'default_action' => 'index',
265
+    'default_charset' => return_session_value_or_default('default_charset',
266
+    'UTF-8'),
267
+    'default_currency_name' => return_session_value_or_default('default_currency_name', 'US Dollar'),
268
+    'default_currency_symbol' => return_session_value_or_default('default_currency_symbol', '$'),
269
+    'default_currency_iso4217' => return_session_value_or_default('default_currency_iso4217', 'USD'),
270
+    'default_currency_significant_digits' => return_session_value_or_default('default_currency_significant_digits', 2),
271
+    'default_number_grouping_seperator' => return_session_value_or_default('default_number_grouping_seperator', ','),
272
+    'default_decimal_seperator' => return_session_value_or_default('default_decimal_seperator', '.'),
273
+    'default_date_format' => 'm/d/Y',
274 274
     'default_locale_name_format' => 's f l',
275
-	'default_export_charset' => 'UTF-8',
276
-	'default_language' => return_session_value_or_default('default_language',
277
-	'en_us'),
278
-	'default_module' => 'Home',
279
-	'default_password' => '',
280
-	'default_permissions' => array (
281
-		'dir_mode' => 02770,
282
-		'file_mode' => 0755,
283
-		'user' => '',
284
-		'group' => '',
285
-	),
286
-	'default_theme' => return_session_value_or_default('site_default_theme', 'Sugar5'),
287
-	'default_time_format' => 'h:ia',
288
-	'default_user_is_admin' => false,
289
-	'default_user_name' => '',
290
-	'disable_export' => false,
291
-	'disable_persistent_connections' =>
292
-	return_session_value_or_default('disable_persistent_connections',
293
-	'false'),
275
+    'default_export_charset' => 'UTF-8',
276
+    'default_language' => return_session_value_or_default('default_language',
277
+    'en_us'),
278
+    'default_module' => 'Home',
279
+    'default_password' => '',
280
+    'default_permissions' => array (
281
+        'dir_mode' => 02770,
282
+        'file_mode' => 0755,
283
+        'user' => '',
284
+        'group' => '',
285
+    ),
286
+    'default_theme' => return_session_value_or_default('site_default_theme', 'Sugar5'),
287
+    'default_time_format' => 'h:ia',
288
+    'default_user_is_admin' => false,
289
+    'default_user_name' => '',
290
+    'disable_export' => false,
291
+    'disable_persistent_connections' =>
292
+    return_session_value_or_default('disable_persistent_connections',
293
+    'false'),
294 294
     'display_email_template_variable_chooser' => false,
295
-	'display_inbound_email_buttons' => false,
296
-	'dump_slow_queries' => false,
297
-	'email_address_separator' => ',', // use RFC2368 spec unless we have a noncompliant email client
295
+    'display_inbound_email_buttons' => false,
296
+    'dump_slow_queries' => false,
297
+    'email_address_separator' => ',', // use RFC2368 spec unless we have a noncompliant email client
298 298
     'email_default_editor' => 'html',
299
-	'email_default_client' => 'sugar',
300
-	'email_default_delete_attachments' => true,
301
-	'history_max_viewed' => 50,
302
-	'installer_locked' => true,
303
-	'import_max_records_per_file' => 100,
299
+    'email_default_client' => 'sugar',
300
+    'email_default_delete_attachments' => true,
301
+    'history_max_viewed' => 50,
302
+    'installer_locked' => true,
303
+    'import_max_records_per_file' => 100,
304 304
     'import_max_records_total_limit' => '',
305
-	'languages' => array('en_us' => 'English (US)'),
306
-	'large_scale_test' => false,
307
-	'list_max_entries_per_page' => 20,
308
-	'list_max_entries_per_subpanel' => 10,
309
-	'lock_default_user_name' => false,
310
-	'log_memory_usage' => false,
311
-	'portal_view' => 'single_user',
305
+    'languages' => array('en_us' => 'English (US)'),
306
+    'large_scale_test' => false,
307
+    'list_max_entries_per_page' => 20,
308
+    'list_max_entries_per_subpanel' => 10,
309
+    'lock_default_user_name' => false,
310
+    'log_memory_usage' => false,
311
+    'portal_view' => 'single_user',
312 312
     'resource_management' => array (
313
-	    'special_query_limit' => 50000,
314
-	    'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'),
315
-	    'default_limit' => 1000,
313
+        'special_query_limit' => 50000,
314
+        'special_query_modules' => array('Reports', 'Export', 'Import', 'Administration', 'Sync'),
315
+        'default_limit' => 1000,
316 316
     ),
317
-	'require_accounts' => true,
318
-	'rss_cache_time' => return_session_value_or_default('rss_cache_time',
319
-	'10800'),
320
-	'save_query' => 'all',
321
-	'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable
322
-	'showThemePicker' => true,
323
-	'slow_query_time_msec' => '100',
317
+    'require_accounts' => true,
318
+    'rss_cache_time' => return_session_value_or_default('rss_cache_time',
319
+    '10800'),
320
+    'save_query' => 'all',
321
+    'showDetailData' => true, // if true, read-only ACL fields will still appear on EditViews as non-editable
322
+    'showThemePicker' => true,
323
+    'slow_query_time_msec' => '100',
324 324
     'sugarbeet' => true,
325 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
-	'translation_string_prefix' =>
330
-	return_session_value_or_default('translation_string_prefix', false),
331
-	'upload_badext' => array (
332
-	'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py',
333
-	'asp', 'cfm', 'js', 'vbs', 'html', 'htm', 'phtml' ),
334
-	'upload_maxsize' => 30000000,
335
-	'import_max_execution_time' => 3600,
329
+    'translation_string_prefix' =>
330
+    return_session_value_or_default('translation_string_prefix', false),
331
+    'upload_badext' => array (
332
+    'php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py',
333
+    'asp', 'cfm', 'js', 'vbs', 'html', 'htm', 'phtml' ),
334
+    'upload_maxsize' => 30000000,
335
+    'import_max_execution_time' => 3600,
336 336
 //	'use_php_code_json' => returnPhpJsonStatus(),
337
-	'verify_client_ip' => true,
338
-	'js_custom_version' => '',
339
-	'js_lang_version' => 1,
337
+    'verify_client_ip' => true,
338
+    'js_custom_version' => '',
339
+    'js_lang_version' => 1,
340 340
         'lead_conv_activity_opt' => 'donothing',
341
-	'default_number_grouping_seperator' => ',',
342
-	'default_decimal_seperator' => '.',
343
-	'lock_homepage' => false,
344
-	'lock_subpanels' => false,
345
-	'max_dashlets_homepage' => '15',
346
-	'default_max_tabs' => '7',
347
-	'dashlet_display_row_options' => array('1','3','5','10'),
348
-	'default_subpanel_tabs' =>  true,
349
-	'default_subpanel_links' => false,
350
-	'default_swap_last_viewed' => false,
351
-	'default_swap_shortcuts' => false,
352
-	'default_navigation_paradigm' => 'gm',
353
-	'admin_access_control' => false,
354
-  	'use_common_ml_dir'	=> false,
355
-  	'common_ml_dir' => '',
356
-	'vcal_time' => '2',
357
-	'calendar' => array(
358
-	  'default_view' => 'week',
359
-	  'show_calls_by_default' => true,
360
-	  'show_tasks_by_default' => true,
361
-	  'show_completed_by_default' => true,
362
-	  'editview_width' => 990,
363
-	  'editview_height' => 485,
364
-	  'day_timestep' => 15,
365
-	  'week_timestep' => 30,
366
-	  'items_draggable' => true,
367
-	  'items_resizable' => true,
368
-	  'enable_repeat' => true,
369
-	  'max_repeat_count' => 1000,
370
-	),
371
-	'passwordsetting' => empty($passwordsetting) ? array (
372
-	    'SystemGeneratedPasswordON' => '',
373
-	    'generatepasswordtmpl' => '',
374
-	    'lostpasswordtmpl' => '',
375
-	    'forgotpasswordON' => false,
376
-    	'linkexpiration' => '1',
377
-    	'linkexpirationtime' => '30',
378
-    	'linkexpirationtype' => '1',
379
-	    'systexpiration' => '0',
380
-	    'systexpirationtime' => '',
381
-	    'systexpirationtype' => '0',
382
-	    'systexpirationlogin' => '',
383
-		) : $passwordsetting,
384
-		'use_real_names' => true,
385
-
386
-		'search_wildcard_infront' => false,
341
+    'default_number_grouping_seperator' => ',',
342
+    'default_decimal_seperator' => '.',
343
+    'lock_homepage' => false,
344
+    'lock_subpanels' => false,
345
+    'max_dashlets_homepage' => '15',
346
+    'default_max_tabs' => '7',
347
+    'dashlet_display_row_options' => array('1','3','5','10'),
348
+    'default_subpanel_tabs' =>  true,
349
+    'default_subpanel_links' => false,
350
+    'default_swap_last_viewed' => false,
351
+    'default_swap_shortcuts' => false,
352
+    'default_navigation_paradigm' => 'gm',
353
+    'admin_access_control' => false,
354
+        'use_common_ml_dir'	=> false,
355
+        'common_ml_dir' => '',
356
+    'vcal_time' => '2',
357
+    'calendar' => array(
358
+        'default_view' => 'week',
359
+        'show_calls_by_default' => true,
360
+        'show_tasks_by_default' => true,
361
+        'show_completed_by_default' => true,
362
+        'editview_width' => 990,
363
+        'editview_height' => 485,
364
+        'day_timestep' => 15,
365
+        'week_timestep' => 30,
366
+        'items_draggable' => true,
367
+        'items_resizable' => true,
368
+        'enable_repeat' => true,
369
+        'max_repeat_count' => 1000,
370
+    ),
371
+    'passwordsetting' => empty($passwordsetting) ? array (
372
+        'SystemGeneratedPasswordON' => '',
373
+        'generatepasswordtmpl' => '',
374
+        'lostpasswordtmpl' => '',
375
+        'forgotpasswordON' => false,
376
+        'linkexpiration' => '1',
377
+        'linkexpirationtime' => '30',
378
+        'linkexpirationtype' => '1',
379
+        'systexpiration' => '0',
380
+        'systexpirationtime' => '',
381
+        'systexpirationtype' => '0',
382
+        'systexpirationlogin' => '',
383
+        ) : $passwordsetting,
384
+        'use_real_names' => true,
385
+
386
+        'search_wildcard_infront' => false,
387 387
         'search_wildcard_char' => '%',
388
-		'jobs' => array(
389
-		    'min_retry_interval' => 30, // 30 seconds minimal job retry
390
-		    'max_retries' => 5, // how many times to retry the job
391
-		    'timeout' => 86400, // how long a job may spend as running before being force-failed
392
-		),
393
-		"cron" => array(
394
-			'max_cron_jobs' => 10, // max jobs per cron schedule run
395
-		    'max_cron_runtime' => 30, // max runtime for cron jobs
396
-		    'min_cron_interval' => 30, // minimal interval between cron jobs
397
-		),
388
+        'jobs' => array(
389
+            'min_retry_interval' => 30, // 30 seconds minimal job retry
390
+            'max_retries' => 5, // how many times to retry the job
391
+            'timeout' => 86400, // how long a job may spend as running before being force-failed
392
+        ),
393
+        "cron" => array(
394
+            'max_cron_jobs' => 10, // max jobs per cron schedule run
395
+            'max_cron_runtime' => 30, // max runtime for cron jobs
396
+            'min_cron_interval' => 30, // minimal interval between cron jobs
397
+        ),
398 398
     );
399 399
 
400
-	if(!is_object($locale)) {
401
-		$locale = new Localization();
402
-	}
400
+    if(!is_object($locale)) {
401
+        $locale = new Localization();
402
+    }
403 403
 
404
-	$sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies();
404
+    $sugar_config_defaults['default_currencies'] = $locale->getDefaultCurrencies();
405 405
 
406
-	$sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults);
407
-	return( $sugar_config_defaults );
406
+    $sugar_config_defaults = sugarArrayMerge($locale->getLocaleConfigDefaults(), $sugar_config_defaults);
407
+    return( $sugar_config_defaults );
408 408
 }
409 409
 
410 410
 /**
411 411
  * @deprecated use SugarView::getMenu() instead
412 412
  */
413 413
 function load_menu($path){
414
-	global $module_menu;
414
+    global $module_menu;
415 415
 
416
-	if(file_exists($path . 'Menu.php'))
417
-	{
418
-		require($path . 'Menu.php');
419
-	}
420
-	if(file_exists('custom/' . $path . 'Ext/Menus/menu.ext.php'))
421
-	{
422
-		require('custom/' . $path . 'Ext/Menus/menu.ext.php');
423
-	}
424
-	if(file_exists('custom/application/Ext/Menus/menu.ext.php'))
425
-	{
426
-		require('custom/application/Ext/Menus/menu.ext.php');
427
-	}
428
-	return $module_menu;
416
+    if(file_exists($path . 'Menu.php'))
417
+    {
418
+        require($path . 'Menu.php');
419
+    }
420
+    if(file_exists('custom/' . $path . 'Ext/Menus/menu.ext.php'))
421
+    {
422
+        require('custom/' . $path . 'Ext/Menus/menu.ext.php');
423
+    }
424
+    if(file_exists('custom/application/Ext/Menus/menu.ext.php'))
425
+    {
426
+        require('custom/application/Ext/Menus/menu.ext.php');
427
+    }
428
+    return $module_menu;
429 429
 }
430 430
 
431 431
 /**
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
  * @return string relative file path to email notifications template file
436 436
  */
437 437
 function get_notify_template_file($language){
438
-	/*
438
+    /*
439 439
 	 * Order of operation:
440 440
 	 * 1) custom version of specified language
441 441
 	 * 2) stock version of specified language
@@ -443,61 +443,61 @@  discard block
 block discarded – undo
443 443
 	 * 4) stock en_us template
444 444
 	 */
445 445
 
446
-	// set $file to the base code template so it's set if none of the conditions pass
447
-	$file = "include/language/en_us.notify_template.html";
446
+    // set $file to the base code template so it's set if none of the conditions pass
447
+    $file = "include/language/en_us.notify_template.html";
448 448
 
449
-	if(file_exists("custom/include/language/{$language}.notify_template.html")){
450
-		$file = "custom/include/language/{$language}.notify_template.html";
451
-	}
452
-	else if(file_exists("include/language/{$language}.notify_template.html")){
453
-		$file = "include/language/{$language}.notify_template.html";
454
-	}
455
-	else if(file_exists("custom/include/language/en_us.notify_template.html")){
456
-		$file = "custom/include/language/en_us.notify_template.html";
457
-	}
449
+    if(file_exists("custom/include/language/{$language}.notify_template.html")){
450
+        $file = "custom/include/language/{$language}.notify_template.html";
451
+    }
452
+    else if(file_exists("include/language/{$language}.notify_template.html")){
453
+        $file = "include/language/{$language}.notify_template.html";
454
+    }
455
+    else if(file_exists("custom/include/language/en_us.notify_template.html")){
456
+        $file = "custom/include/language/en_us.notify_template.html";
457
+    }
458 458
 
459
-	return $file;
459
+    return $file;
460 460
 }
461 461
 
462 462
 function sugar_config_union( $default, $override ){
463
-	// a little different then array_merge and array_merge_recursive.  we want
464
-	// the second array to override the first array if the same value exists,
465
-	// otherwise merge the unique keys.  it handles arrays of arrays recursively
466
-	// might be suitable for a generic array_union
467
-	if( !is_array( $override ) ){
468
-		$override = array();
469
-	}
470
-	foreach( $default as $key => $value ){
471
-		if( !array_key_exists($key, $override) ){
472
-			$override[$key] = $value;
473
-		}
474
-		else if( is_array( $key ) ){
475
-			$override[$key] = sugar_config_union( $value, $override[$key] );
476
-		}
477
-	}
478
-	return( $override );
463
+    // a little different then array_merge and array_merge_recursive.  we want
464
+    // the second array to override the first array if the same value exists,
465
+    // otherwise merge the unique keys.  it handles arrays of arrays recursively
466
+    // might be suitable for a generic array_union
467
+    if( !is_array( $override ) ){
468
+        $override = array();
469
+    }
470
+    foreach( $default as $key => $value ){
471
+        if( !array_key_exists($key, $override) ){
472
+            $override[$key] = $value;
473
+        }
474
+        else if( is_array( $key ) ){
475
+            $override[$key] = sugar_config_union( $value, $override[$key] );
476
+        }
477
+    }
478
+    return( $override );
479 479
 }
480 480
 
481 481
 function make_not_writable( $file ){
482
-	// Returns true if the given file/dir has been made not writable
483
-	$ret_val = false;
484
-	if( is_file($file) || is_dir($file) ){
485
-		if( !is_writable($file) ){
486
-			$ret_val = true;
487
-		}
488
-		else {
489
-			$original_fileperms = fileperms($file);
490
-
491
-			// take away writable permissions
492
-			$new_fileperms = $original_fileperms & ~0x0092;
493
-			@sugar_chmod($file, $new_fileperms);
494
-
495
-			if( !is_writable($file) ){
496
-				$ret_val = true;
497
-			}
498
-		}
499
-	}
500
-	return $ret_val;
482
+    // Returns true if the given file/dir has been made not writable
483
+    $ret_val = false;
484
+    if( is_file($file) || is_dir($file) ){
485
+        if( !is_writable($file) ){
486
+            $ret_val = true;
487
+        }
488
+        else {
489
+            $original_fileperms = fileperms($file);
490
+
491
+            // take away writable permissions
492
+            $new_fileperms = $original_fileperms & ~0x0092;
493
+            @sugar_chmod($file, $new_fileperms);
494
+
495
+            if( !is_writable($file) ){
496
+                $ret_val = true;
497
+            }
498
+        }
499
+    }
500
+    return $ret_val;
501 501
 }
502 502
 
503 503
 
@@ -511,76 +511,76 @@  discard block
 block discarded – undo
511 511
  */
512 512
 function return_name($row, $first_column, $last_column)
513 513
 {
514
-	$first_name = "";
515
-	$last_name = "";
516
-	$full_name = "";
514
+    $first_name = "";
515
+    $last_name = "";
516
+    $full_name = "";
517 517
 
518
-	if(isset($row[$first_column]))
519
-	{
520
-		$first_name = stripslashes($row[$first_column]);
521
-	}
518
+    if(isset($row[$first_column]))
519
+    {
520
+        $first_name = stripslashes($row[$first_column]);
521
+    }
522 522
 
523
-	if(isset($row[$last_column]))
524
-	{
525
-		$last_name = stripslashes($row[$last_column]);
526
-	}
523
+    if(isset($row[$last_column]))
524
+    {
525
+        $last_name = stripslashes($row[$last_column]);
526
+    }
527 527
 
528
-	$full_name = $first_name;
528
+    $full_name = $first_name;
529 529
 
530
-	// If we have a first name and we have a last name
531
-	if($full_name != "" && $last_name != "")
532
-	{
533
-		// append a space, then the last name
534
-		$full_name .= " ".$last_name;
535
-	}
536
-	// If we have no first name, but we have a last name
537
-	else if($last_name != "")
538
-	{
539
-		// append the last name without the space.
540
-		$full_name .= $last_name;
541
-	}
530
+    // If we have a first name and we have a last name
531
+    if($full_name != "" && $last_name != "")
532
+    {
533
+        // append a space, then the last name
534
+        $full_name .= " ".$last_name;
535
+    }
536
+    // If we have no first name, but we have a last name
537
+    else if($last_name != "")
538
+    {
539
+        // append the last name without the space.
540
+        $full_name .= $last_name;
541
+    }
542 542
 
543
-	return $full_name;
543
+    return $full_name;
544 544
 }
545 545
 
546 546
 
547 547
 function get_languages()
548 548
 {
549
-	global $sugar_config;
550
-	$lang = $sugar_config['languages'];
549
+    global $sugar_config;
550
+    $lang = $sugar_config['languages'];
551 551
     if(!empty($sugar_config['disabled_languages'])){
552 552
         foreach(explode(',', $sugar_config['disabled_languages']) as $disable) {
553 553
             unset($lang[$disable]);
554 554
         }
555 555
     }
556
-	return $lang;
556
+    return $lang;
557 557
 }
558 558
 
559 559
 function get_all_languages()
560 560
 {
561
-	global $sugar_config;
562
-	return $sugar_config['languages'];
561
+    global $sugar_config;
562
+    return $sugar_config['languages'];
563 563
 }
564 564
 
565 565
 
566 566
 function get_language_display($key)
567 567
 {
568
-	global $sugar_config;
569
-	return $sugar_config['languages'][$key];
568
+    global $sugar_config;
569
+    return $sugar_config['languages'][$key];
570 570
 }
571 571
 
572 572
 function get_assigned_user_name($assigned_user_id, $is_group = '') {
573
-	static $saved_user_list = null;
573
+    static $saved_user_list = null;
574 574
 
575
-	if(empty($saved_user_list)) {
576
-		$saved_user_list = get_user_array(false, '', '', false, null, $is_group);
577
-	}
575
+    if(empty($saved_user_list)) {
576
+        $saved_user_list = get_user_array(false, '', '', false, null, $is_group);
577
+    }
578 578
 
579
-	if(isset($saved_user_list[$assigned_user_id])) {
580
-		return $saved_user_list[$assigned_user_id];
581
-	}
579
+    if(isset($saved_user_list[$assigned_user_id])) {
580
+        return $saved_user_list[$assigned_user_id];
581
+    }
582 582
 
583
-	return '';
583
+    return '';
584 584
 }
585 585
 
586 586
 /**
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
  * @return string
590 590
  */
591 591
 function get_user_name($id) {
592
-	global $db;
592
+    global $db;
593 593
 
594
-	if(empty($db))
595
-	$db = DBManagerFactory::getInstance();
594
+    if(empty($db))
595
+    $db = DBManagerFactory::getInstance();
596 596
 
597
-	$q = "SELECT user_name FROM users WHERE id='{$id}'";
598
-	$r = $db->query($q);
599
-	$a = $db->fetchByAssoc($r);
597
+    $q = "SELECT user_name FROM users WHERE id='{$id}'";
598
+    $r = $db->query($q);
599
+    $a = $db->fetchByAssoc($r);
600 600
 
601
-	return (empty($a)) ? '' : $a['user_name'];
601
+    return (empty($a)) ? '' : $a['user_name'];
602 602
 }
603 603
 
604 604
 
@@ -620,27 +620,27 @@  discard block
 block discarded – undo
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 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
-	global $locale, $sugar_config, $current_user;
623
+    global $locale, $sugar_config, $current_user;
624 624
 
625
-	if(empty($locale)) {
626
-		$locale = new Localization();
627
-	}
625
+    if(empty($locale)) {
626
+        $locale = new Localization();
627
+    }
628 628
 
629
-	if($from_cache) {
629
+    if($from_cache) {
630 630
         $key_name = $add_blank. $status . $user_id . $use_real_name . $user_name_filter . $portal_filter;
631
-		$user_array = get_register_value('user_array', $key_name);
632
-    }
633
-
634
-	if(empty($user_array)) {
635
-		$db = DBManagerFactory::getInstance();
636
-		$temp_result = Array();
637
-		// Including deleted users for now.
638
-		if (empty($status)) {
639
-			$query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter;
640
-		}
641
-		else {
642
-			$query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter;
643
-		}
631
+        $user_array = get_register_value('user_array', $key_name);
632
+    }
633
+
634
+    if(empty($user_array)) {
635
+        $db = DBManagerFactory::getInstance();
636
+        $temp_result = Array();
637
+        // Including deleted users for now.
638
+        if (empty($status)) {
639
+            $query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter;
640
+        }
641
+        else {
642
+            $query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter;
643
+        }
644 644
         /* BEGIN - SECURITY GROUPS */
645 645
         global $current_user, $sugar_config;
646 646
         if(!is_admin($current_user)
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
             $query .= " AND (".$group_where.") ";
656 656
         }
657 657
         /* END - SECURITY GROUPS */
658
-		if (!empty($user_name_filter)) {
659
-		    $user_name_filter = $db->quote($user_name_filter);
660
-			$query .= " AND user_name LIKE '$user_name_filter%' ";
661
-		}
662
-		if (!empty($user_id)) {
663
-			$query .= " OR id='{$user_id}'";
664
-		}
658
+        if (!empty($user_name_filter)) {
659
+            $user_name_filter = $db->quote($user_name_filter);
660
+            $query .= " AND user_name LIKE '$user_name_filter%' ";
661
+        }
662
+        if (!empty($user_id)) {
663
+            $query .= " OR id='{$user_id}'";
664
+        }
665 665
 
666 666
         //get the user preference for name formatting, to be used in order by
667 667
         $order_by_string =' user_name ASC ';
@@ -683,37 +683,37 @@  discard block
 block discarded – undo
683 683
             }
684 684
         }
685 685
 
686
-		$query = $query.' ORDER BY '.$order_by_string;
687
-		$GLOBALS['log']->debug("get_user_array query: $query");
688
-		$result = $db->query($query, true, "Error filling in user array: ");
689
-
690
-		if ($add_blank==true) {
691
-			// Add in a blank row
692
-			$temp_result[''] = '';
693
-		}
694
-
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']);
700
-				} else {
701
-					$temp_result[$row['id']] = $row['user_name'];
702
-				}
703
-			} else {
704
-				$temp_result[$row['id']] = $row['user_name'];
705
-			}
706
-		}
686
+        $query = $query.' ORDER BY '.$order_by_string;
687
+        $GLOBALS['log']->debug("get_user_array query: $query");
688
+        $result = $db->query($query, true, "Error filling in user array: ");
689
+
690
+        if ($add_blank==true) {
691
+            // Add in a blank row
692
+            $temp_result[''] = '';
693
+        }
694
+
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']);
700
+                } else {
701
+                    $temp_result[$row['id']] = $row['user_name'];
702
+                }
703
+            } else {
704
+                $temp_result[$row['id']] = $row['user_name'];
705
+            }
706
+        }
707 707
 
708
-		$user_array = $temp_result;
709
-		if($from_cache)
708
+        $user_array = $temp_result;
709
+        if($from_cache)
710 710
         {
711
-			set_register_value('user_array', $key_name, $temp_result);
711
+            set_register_value('user_array', $key_name, $temp_result);
712 712
         }
713
-	}
713
+    }
714 714
 
715 715
 
716
-	return $user_array;
716
+    return $user_array;
717 717
 }
718 718
 
719 719
 
@@ -724,11 +724,11 @@  discard block
 block discarded – undo
724 724
  * @return array Array of Users' details that match passed criteria
725 725
  */
726 726
 function getUserArrayFromFullName($args, $hide_portal_users = false) {
727
-	global $locale;
728
-	$db = DBManagerFactory::getInstance();
727
+    global $locale;
728
+    $db = DBManagerFactory::getInstance();
729 729
 
730
-	// jmorais@dri - Bug #51411
731
-	//
730
+    // jmorais@dri - Bug #51411
731
+    //
732 732
     // Refactor the code responsible for parsing supplied $args, this way we
733 733
     // ensure that if $args has at least one space (after trim), the $inClause
734 734
     // will be composed by several clauses ($inClauses) inside parenthesis.
@@ -754,11 +754,11 @@  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 ) {
759
-	    $query .= " portal_only=0 AND ";
760
-	}
761
-	$query .= $inClause;
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
+        $query .= " portal_only=0 AND ";
760
+    }
761
+    $query .= $inClause;
762 762
     /* BEGIN - SECURITY GROUPS */
763 763
     global $current_user, $sugar_config;
764 764
     if(!is_admin($current_user)
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
         $query .= " AND (".$group_where.") ";
772 772
     }
773 773
     /* END - SECURITY GROUPS */
774
-	$query .= " ORDER BY last_name ASC";
774
+    $query .= " ORDER BY last_name ASC";
775 775
 
776
-	$r = $db->query($query);
777
-	$ret = array();
778
-	while($a = $db->fetchByAssoc($r)) {
779
-		$ret[$a['id']] = $locale->getLocaleFormattedName($a['first_name'], $a['last_name']);
780
-	}
776
+    $r = $db->query($query);
777
+    $ret = array();
778
+    while($a = $db->fetchByAssoc($r)) {
779
+        $ret[$a['id']] = $locale->getLocaleFormattedName($a['first_name'], $a['last_name']);
780
+    }
781 781
 
782
-	return $ret;
782
+    return $ret;
783 783
 }
784 784
 
785 785
 /**
@@ -787,28 +787,28 @@  discard block
 block discarded – undo
787 787
  * based on user pref then system pref
788 788
  */
789 789
 function showFullName() {
790
-	global $sugar_config;
791
-	global $current_user;
792
-	static $showFullName = null;
793
-
794
-	if (is_null($showFullName)) {
795
-		$sysPref = !empty($sugar_config['use_real_names']);
796
-		$userPref = (is_object($current_user)) ? $current_user->getPreference('use_real_names') : null;
797
-
798
-		if($userPref != null) {
799
-			$showFullName = ($userPref == 'on');
800
-		} else {
801
-			$showFullName = $sysPref;
802
-		}
803
-	}
790
+    global $sugar_config;
791
+    global $current_user;
792
+    static $showFullName = null;
793
+
794
+    if (is_null($showFullName)) {
795
+        $sysPref = !empty($sugar_config['use_real_names']);
796
+        $userPref = (is_object($current_user)) ? $current_user->getPreference('use_real_names') : null;
797
+
798
+        if($userPref != null) {
799
+            $showFullName = ($userPref == 'on');
800
+        } else {
801
+            $showFullName = $sysPref;
802
+        }
803
+    }
804 804
 
805
-	return $showFullName;
805
+    return $showFullName;
806 806
 }
807 807
 
808 808
 function clean($string, $maxLength)
809 809
 {
810
-	$string = substr($string, 0, $maxLength);
811
-	return escapeshellcmd($string);
810
+    $string = substr($string, 0, $maxLength);
811
+    return escapeshellcmd($string);
812 812
 }
813 813
 
814 814
 /**
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
  */
821 821
 function safe_map($request_var, & $focus, $always_copy = false)
822 822
 {
823
-	safe_map_named($request_var, $focus, $request_var, $always_copy);
823
+    safe_map_named($request_var, $focus, $request_var, $always_copy);
824 824
 }
825 825
 
826 826
 /**
@@ -832,10 +832,10 @@  discard block
 block discarded – undo
832 832
  */
833 833
 function safe_map_named($request_var, & $focus, $member_var, $always_copy)
834 834
 {
835
-	if (isset($_REQUEST[$request_var]) && ($always_copy || is_null($focus->$member_var))) {
836
-		$GLOBALS['log']->debug("safe map named called assigning '{$_REQUEST[$request_var]}' to $member_var");
837
-		$focus->$member_var = $_REQUEST[$request_var];
838
-	}
835
+    if (isset($_REQUEST[$request_var]) && ($always_copy || is_null($focus->$member_var))) {
836
+        $GLOBALS['log']->debug("safe map named called assigning '{$_REQUEST[$request_var]}' to $member_var");
837
+        $focus->$member_var = $_REQUEST[$request_var];
838
+    }
839 839
 }
840 840
 
841 841
 /**
@@ -846,35 +846,35 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function return_app_list_strings_language($language)
848 848
 {
849
-	global $app_list_strings;
850
-	global $sugar_config;
849
+    global $app_list_strings;
850
+    global $sugar_config;
851 851
 
852
-	$cache_key = 'app_list_strings.'.$language;
852
+    $cache_key = 'app_list_strings.'.$language;
853 853
 
854
-	// Check for cached value
855
-	$cache_entry = sugar_cache_retrieve($cache_key);
856
-	if(!empty($cache_entry))
857
-	{
858
-		return $cache_entry;
859
-	}
854
+    // Check for cached value
855
+    $cache_entry = sugar_cache_retrieve($cache_key);
856
+    if(!empty($cache_entry))
857
+    {
858
+        return $cache_entry;
859
+    }
860 860
 
861
-	$default_language = isset($sugar_config['default_language']) ? $sugar_config['default_language'] : 'en_us';
862
-	$temp_app_list_strings = $app_list_strings;
861
+    $default_language = isset($sugar_config['default_language']) ? $sugar_config['default_language'] : 'en_us';
862
+    $temp_app_list_strings = $app_list_strings;
863 863
 
864
-	$langs = array();
865
-	if ($language != 'en_us') {
866
-	    $langs[] = 'en_us';
867
-	}
868
-	if ($default_language != 'en_us' && $language != $default_language) {
869
-	    $langs[] = $default_language;
870
-	}
871
-	$langs[] = $language;
864
+    $langs = array();
865
+    if ($language != 'en_us') {
866
+        $langs[] = 'en_us';
867
+    }
868
+    if ($default_language != 'en_us' && $language != $default_language) {
869
+        $langs[] = $default_language;
870
+    }
871
+    $langs[] = $language;
872 872
 
873
-	$app_list_strings_array = array();
873
+    $app_list_strings_array = array();
874 874
 
875
-	foreach ( $langs as $lang ) {
876
-	    $app_list_strings = array();
877
-	    if(file_exists("include/language/$lang.lang.php")) {
875
+    foreach ( $langs as $lang ) {
876
+        $app_list_strings = array();
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
         }
@@ -906,17 +906,17 @@  discard block
 block discarded – undo
906 906
         }
907 907
     }
908 908
 
909
-	if(!isset($app_list_strings)) {
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
-		return null;
912
-	}
909
+    if(!isset($app_list_strings)) {
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
+        return null;
912
+    }
913 913
 
914
-	$return_value = $app_list_strings;
915
-	$app_list_strings = $temp_app_list_strings;
914
+    $return_value = $app_list_strings;
915
+    $app_list_strings = $temp_app_list_strings;
916 916
 
917
-	sugar_cache_put($cache_key, $return_value);
917
+    sugar_cache_put($cache_key, $return_value);
918 918
 
919
-	return $return_value;
919
+    return $return_value;
920 920
 }
921 921
 
922 922
 /**
@@ -926,33 +926,33 @@  discard block
 block discarded – undo
926 926
  * @param app_list_strings array the golbal strings
927 927
  * @return array
928 928
  */
929
- //jchi 25347
929
+    //jchi 25347
930 930
 function _mergeCustomAppListStrings($file , $app_list_strings){
931
-	$app_list_strings_original = $app_list_strings;
932
-	unset($app_list_strings);
931
+    $app_list_strings_original = $app_list_strings;
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
-	include($file);
937
-	if(!isset($app_list_strings) || !is_array($app_list_strings)){
938
-		return $app_list_strings_original;
939
-	}
940
-	//Bug 25347: We should not merge custom dropdown fields unless they relate to parent fields or the module list.
936
+    include($file);
937
+    if(!isset($app_list_strings) || !is_array($app_list_strings)){
938
+        return $app_list_strings_original;
939
+    }
940
+    //Bug 25347: We should not merge custom dropdown fields unless they relate to parent fields or the module list.
941 941
 
942 942
         // FG - bug 45525 - Specific codelists must NOT be overwritten
943
-	$exemptDropdowns[] = "moduleList";
944
-	$exemptDropdowns[] = "moduleListSingular";
943
+    $exemptDropdowns[] = "moduleList";
944
+    $exemptDropdowns[] = "moduleListSingular";
945 945
         $exemptDropdowns = array_merge($exemptDropdowns, getTypeDisplayList());
946 946
 
947
-	foreach($app_list_strings as $key=>$value)
948
-	{
949
-		if (!in_array($key, $exemptDropdowns) && array_key_exists($key, $app_list_strings_original))
950
-		{
951
-	   		unset($app_list_strings_original["$key"]);
952
-		}
953
-   }
954
-   $app_list_strings = sugarArrayMergeRecursive($app_list_strings_original , $app_list_strings);
955
-   return $app_list_strings;
947
+    foreach($app_list_strings as $key=>$value)
948
+    {
949
+        if (!in_array($key, $exemptDropdowns) && array_key_exists($key, $app_list_strings_original))
950
+        {
951
+                unset($app_list_strings_original["$key"]);
952
+        }
953
+    }
954
+    $app_list_strings = sugarArrayMergeRecursive($app_list_strings_original , $app_list_strings);
955
+    return $app_list_strings;
956 956
 }
957 957
 
958 958
 /**
@@ -963,35 +963,35 @@  discard block
 block discarded – undo
963 963
  */
964 964
 function return_application_language($language)
965 965
 {
966
-	global $app_strings, $sugar_config;
966
+    global $app_strings, $sugar_config;
967 967
 
968
-	$cache_key = 'app_strings.'.$language;
968
+    $cache_key = 'app_strings.'.$language;
969 969
 
970
-	// Check for cached value
971
-	$cache_entry = sugar_cache_retrieve($cache_key);
972
-	if(!empty($cache_entry))
973
-	{
974
-		return $cache_entry;
975
-	}
970
+    // Check for cached value
971
+    $cache_entry = sugar_cache_retrieve($cache_key);
972
+    if(!empty($cache_entry))
973
+    {
974
+        return $cache_entry;
975
+    }
976 976
 
977
-	$temp_app_strings = $app_strings;
978
-	$default_language = $sugar_config['default_language'];
977
+    $temp_app_strings = $app_strings;
978
+    $default_language = $sugar_config['default_language'];
979 979
 
980
-	$langs = array();
981
-	if ($language != 'en_us') {
982
-	    $langs[] = 'en_us';
983
-	}
984
-	if ($default_language != 'en_us' && $language != $default_language) {
985
-	    $langs[] = $default_language;
986
-	}
980
+    $langs = array();
981
+    if ($language != 'en_us') {
982
+        $langs[] = 'en_us';
983
+    }
984
+    if ($default_language != 'en_us' && $language != $default_language) {
985
+        $langs[] = $default_language;
986
+    }
987 987
 
988
-	$langs[] = $language;
988
+    $langs[] = $language;
989 989
 
990
-	$app_strings_array = array();
990
+    $app_strings_array = array();
991 991
 
992
-	foreach ( $langs as $lang ) {
993
-	    $app_strings = array();
994
-	    if(file_exists("include/language/$lang.lang.php")) {
992
+    foreach ( $langs as $lang ) {
993
+        $app_strings = array();
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
         }
@@ -1012,40 +1012,40 @@  discard block
 block discarded – undo
1012 1012
             $GLOBALS['log']->info("Found custom language file: $lang.lang.php");
1013 1013
         }
1014 1014
         $app_strings_array[] = $app_strings;
1015
-	}
1015
+    }
1016 1016
 
1017
-	$app_strings = array();
1017
+    $app_strings = array();
1018 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)) {
1023
-		$GLOBALS['log']->fatal("Unable to load the application language strings");
1024
-		return null;
1025
-	}
1022
+    if(!isset($app_strings)) {
1023
+        $GLOBALS['log']->fatal("Unable to load the application language strings");
1024
+        return null;
1025
+    }
1026 1026
 
1027
-	// If we are in debug mode for translating, turn on the prefix now!
1027
+    // If we are in debug mode for translating, turn on the prefix now!
1028 1028
     if(!empty($sugar_config['translation_string_prefix']))
1029 1029
     {
1030
-		foreach($app_strings as $entry_key=>$entry_value) {
1031
-			$app_strings[$entry_key] = $language.' '.$entry_value;
1032
-		}
1033
-	}
1034
-	if(isset($_SESSION['show_deleted'])) {
1035
-		$app_strings['LBL_DELETE_BUTTON'] = $app_strings['LBL_UNDELETE_BUTTON'];
1036
-		$app_strings['LBL_DELETE_BUTTON_LABEL'] = $app_strings['LBL_UNDELETE_BUTTON_LABEL'];
1037
-		$app_strings['LBL_DELETE_BUTTON_TITLE'] = $app_strings['LBL_UNDELETE_BUTTON_TITLE'];
1038
-		$app_strings['LBL_DELETE'] = $app_strings['LBL_UNDELETE'];
1039
-	}
1030
+        foreach($app_strings as $entry_key=>$entry_value) {
1031
+            $app_strings[$entry_key] = $language.' '.$entry_value;
1032
+        }
1033
+    }
1034
+    if(isset($_SESSION['show_deleted'])) {
1035
+        $app_strings['LBL_DELETE_BUTTON'] = $app_strings['LBL_UNDELETE_BUTTON'];
1036
+        $app_strings['LBL_DELETE_BUTTON_LABEL'] = $app_strings['LBL_UNDELETE_BUTTON_LABEL'];
1037
+        $app_strings['LBL_DELETE_BUTTON_TITLE'] = $app_strings['LBL_UNDELETE_BUTTON_TITLE'];
1038
+        $app_strings['LBL_DELETE'] = $app_strings['LBL_UNDELETE'];
1039
+    }
1040 1040
 
1041
-	$app_strings['LBL_ALT_HOT_KEY'] = get_alt_hot_key();
1041
+    $app_strings['LBL_ALT_HOT_KEY'] = get_alt_hot_key();
1042 1042
 
1043
-	$return_value = $app_strings;
1044
-	$app_strings = $temp_app_strings;
1043
+    $return_value = $app_strings;
1044
+    $app_strings = $temp_app_strings;
1045 1045
 
1046
-	sugar_cache_put($cache_key, $return_value);
1046
+    sugar_cache_put($cache_key, $return_value);
1047 1047
 
1048
-	return $return_value;
1048
+    return $return_value;
1049 1049
 }
1050 1050
 
1051 1051
 /**
@@ -1058,16 +1058,16 @@  discard block
 block discarded – undo
1058 1058
  */
1059 1059
 function return_module_language($language, $module, $refresh=false)
1060 1060
 {
1061
-	global $mod_strings;
1062
-	global $sugar_config;
1063
-	global $currentModule;
1064
-
1065
-	// Jenny - Bug 8119: Need to check if $module is not empty
1066
-	if (empty($module)) {
1067
-		$stack  = debug_backtrace();
1068
-		$GLOBALS['log']->warn("Variable module is not in return_module_language ". var_export($stack, true));
1069
-		return array();
1070
-	}
1061
+    global $mod_strings;
1062
+    global $sugar_config;
1063
+    global $currentModule;
1064
+
1065
+    // Jenny - Bug 8119: Need to check if $module is not empty
1066
+    if (empty($module)) {
1067
+        $stack  = debug_backtrace();
1068
+        $GLOBALS['log']->warn("Variable module is not in return_module_language ". var_export($stack, true));
1069
+        return array();
1070
+    }
1071 1071
 
1072 1072
     if( !$refresh )
1073 1073
     {
@@ -1079,28 +1079,28 @@  discard block
 block discarded – undo
1079 1079
             return $cache_entry;
1080 1080
         }
1081 1081
     }
1082
-	// Store the current mod strings for later
1083
-	$temp_mod_strings = $mod_strings;
1084
-	$loaded_mod_strings = array();
1085
-	$language_used = $language;
1086
-	$default_language = $sugar_config['default_language'];
1087
-
1088
-	if(empty($language)) {
1089
-		$language = $default_language;
1090
-	}
1082
+    // Store the current mod strings for later
1083
+    $temp_mod_strings = $mod_strings;
1084
+    $loaded_mod_strings = array();
1085
+    $language_used = $language;
1086
+    $default_language = $sugar_config['default_language'];
1087
+
1088
+    if(empty($language)) {
1089
+        $language = $default_language;
1090
+    }
1091 1091
 
1092
-	// Bug 21559 - So we can get all the strings defined in the template, refresh
1093
-	// the vardefs file if the cached language file doesn't exist.
1092
+    // Bug 21559 - So we can get all the strings defined in the template, refresh
1093
+    // the vardefs file if the cached language file doesn't exist.
1094 1094
     if(!file_exists(sugar_cached('modules/'). $module . '/language/'.$language.'.lang.php')
1095
-			&& !empty($GLOBALS['beanList'][$module])){
1096
-		$object = BeanFactory::getObjectName($module);
1097
-		VardefManager::refreshVardefs($module,$object);
1098
-	}
1095
+            && !empty($GLOBALS['beanList'][$module])){
1096
+        $object = BeanFactory::getObjectName($module);
1097
+        VardefManager::refreshVardefs($module,$object);
1098
+    }
1099 1099
 
1100
-	$loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh);
1100
+    $loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh);
1101 1101
 
1102
-	// cn: bug 6048 - merge en_us with requested language
1103
-	if($language != $sugar_config['default_language'])
1102
+    // cn: bug 6048 - merge en_us with requested language
1103
+    if($language != $sugar_config['default_language'])
1104 1104
         $loaded_mod_strings = sugarLangArrayMerge(
1105 1105
             LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'],$refresh),
1106 1106
                 $loaded_mod_strings
@@ -1113,23 +1113,23 @@  discard block
 block discarded – undo
1113 1113
                 $loaded_mod_strings
1114 1114
             );
1115 1115
 
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) {
1119
-			$loaded_mod_strings[$entry_key] = $language_used.' '.$entry_value;
1120
-		}
1121
-	}
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) {
1119
+            $loaded_mod_strings[$entry_key] = $language_used.' '.$entry_value;
1120
+        }
1121
+    }
1122 1122
 
1123
-	$return_value = $loaded_mod_strings;
1124
-	if(!isset($mod_strings)){
1125
-		$mod_strings = $return_value;
1126
-	}
1127
-	else
1128
-		$mod_strings = $temp_mod_strings;
1123
+    $return_value = $loaded_mod_strings;
1124
+    if(!isset($mod_strings)){
1125
+        $mod_strings = $return_value;
1126
+    }
1127
+    else
1128
+        $mod_strings = $temp_mod_strings;
1129 1129
 
1130 1130
     $cache_key = LanguageManager::getLanguageCacheKey($module, $language);
1131 1131
     sugar_cache_put($cache_key, $return_value);
1132
-	return $return_value;
1132
+    return $return_value;
1133 1133
 }
1134 1134
 
1135 1135
 
@@ -1139,61 +1139,61 @@  discard block
 block discarded – undo
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 1141
 function return_mod_list_strings_language($language,$module) {
1142
-	global $mod_list_strings;
1143
-	global $sugar_config;
1144
-	global $currentModule;
1142
+    global $mod_list_strings;
1143
+    global $sugar_config;
1144
+    global $currentModule;
1145 1145
 
1146
-	$cache_key = "mod_list_str_lang.".$language.$module;
1146
+    $cache_key = "mod_list_str_lang.".$language.$module;
1147 1147
 
1148
-	// Check for cached value
1149
-	$cache_entry = sugar_cache_retrieve($cache_key);
1150
-	if(!empty($cache_entry))
1151
-	{
1152
-		return $cache_entry;
1153
-	}
1148
+    // Check for cached value
1149
+    $cache_entry = sugar_cache_retrieve($cache_key);
1150
+    if(!empty($cache_entry))
1151
+    {
1152
+        return $cache_entry;
1153
+    }
1154 1154
 
1155
-	$language_used = $language;
1156
-	$temp_mod_list_strings = $mod_list_strings;
1157
-	$default_language = $sugar_config['default_language'];
1155
+    $language_used = $language;
1156
+    $temp_mod_list_strings = $mod_list_strings;
1157
+    $default_language = $sugar_config['default_language'];
1158 1158
 
1159
-	if($currentModule == $module && isset($mod_list_strings) && $mod_list_strings != null) {
1160
-		return $mod_list_strings;
1161
-	}
1159
+    if($currentModule == $module && isset($mod_list_strings) && $mod_list_strings != null) {
1160
+        return $mod_list_strings;
1161
+    }
1162 1162
 
1163
-	// cn: bug 6351 - include en_us if file langpack not available
1164
-	// cn: bug 6048 - merge en_us with requested language
1165
-	include("modules/$module/language/en_us.lang.php");
1166
-	$en_mod_list_strings = array();
1167
-	if($language_used != $default_language)
1168
-	$en_mod_list_strings = $mod_list_strings;
1163
+    // cn: bug 6351 - include en_us if file langpack not available
1164
+    // cn: bug 6048 - merge en_us with requested language
1165
+    include("modules/$module/language/en_us.lang.php");
1166
+    $en_mod_list_strings = array();
1167
+    if($language_used != $default_language)
1168
+    $en_mod_list_strings = $mod_list_strings;
1169 1169
 
1170
-	if(file_exists("modules/$module/language/$language.lang.php")) {
1171
-		include("modules/$module/language/$language.lang.php");
1172
-	}
1170
+    if(file_exists("modules/$module/language/$language.lang.php")) {
1171
+        include("modules/$module/language/$language.lang.php");
1172
+    }
1173 1173
 
1174
-	if(file_exists("modules/$module/language/$language.lang.override.php")){
1175
-		include("modules/$module/language/$language.lang.override.php");
1176
-	}
1174
+    if(file_exists("modules/$module/language/$language.lang.override.php")){
1175
+        include("modules/$module/language/$language.lang.override.php");
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";
1180
-		include("modules/$module/language/$language.lang.php.override");
1181
-	}
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
+        include("modules/$module/language/$language.lang.php.override");
1181
+    }
1182 1182
 
1183
-	// cn: bug 6048 - merge en_us with requested language
1184
-	$mod_list_strings = sugarLangArrayMerge($en_mod_list_strings, $mod_list_strings);
1183
+    // cn: bug 6048 - merge en_us with requested language
1184
+    $mod_list_strings = sugarLangArrayMerge($en_mod_list_strings, $mod_list_strings);
1185 1185
 
1186
-	// if we still don't have a language pack, then log an error
1187
-	if(!isset($mod_list_strings)) {
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
-		return null;
1190
-	}
1186
+    // if we still don't have a language pack, then log an error
1187
+    if(!isset($mod_list_strings)) {
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
+        return null;
1190
+    }
1191 1191
 
1192
-	$return_value = $mod_list_strings;
1193
-	$mod_list_strings = $temp_mod_list_strings;
1192
+    $return_value = $mod_list_strings;
1193
+    $mod_list_strings = $temp_mod_list_strings;
1194 1194
 
1195
-	sugar_cache_put($cache_key, $return_value);
1196
-	return $return_value;
1195
+    sugar_cache_put($cache_key, $return_value);
1196
+    return $return_value;
1197 1197
 }
1198 1198
 
1199 1199
 
@@ -1204,42 +1204,42 @@  discard block
 block discarded – undo
1204 1204
  */
1205 1205
 function return_theme_language($language, $theme)
1206 1206
 {
1207
-	global $mod_strings, $sugar_config, $current_language;
1207
+    global $mod_strings, $sugar_config, $current_language;
1208 1208
 
1209
-	$language_used = $language;
1210
-	$default_language = $sugar_config['default_language'];
1209
+    $language_used = $language;
1210
+    $default_language = $sugar_config['default_language'];
1211 1211
 
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")){
1214
-		include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php");
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";
1218
-		include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override");
1219
-	}
1220
-	if(!isset($theme_strings))
1221
-	{
1222
-		$GLOBALS['log']->warn("Unable to find the theme file for language: ".$language." and theme: ".$theme);
1223
-		require(SugarThemeRegistry::get($theme)->getFilePath()."/language/$default_language.lang.php");
1224
-		$language_used = $default_language;
1225
-	}
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")){
1214
+        include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.override.php");
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";
1218
+        include(SugarThemeRegistry::get($theme)->getFilePath()."/language/$current_language.lang.php.override");
1219
+    }
1220
+    if(!isset($theme_strings))
1221
+    {
1222
+        $GLOBALS['log']->warn("Unable to find the theme file for language: ".$language." and theme: ".$theme);
1223
+        require(SugarThemeRegistry::get($theme)->getFilePath()."/language/$default_language.lang.php");
1224
+        $language_used = $default_language;
1225
+    }
1226 1226
 
1227
-	if(!isset($theme_strings))
1228
-	{
1229
-		$GLOBALS['log']->fatal("Unable to load the theme($theme) language file for the selected language($language) or the default language($default_language)");
1230
-		return null;
1231
-	}
1227
+    if(!isset($theme_strings))
1228
+    {
1229
+        $GLOBALS['log']->fatal("Unable to load the theme($theme) language file for the selected language($language) or the default language($default_language)");
1230
+        return null;
1231
+    }
1232 1232
 
1233
-	// If we are in debug mode for translating, turn on the prefix now!
1234
-	if($sugar_config['translation_string_prefix'])
1235
-	{
1236
-		foreach($theme_strings as $entry_key=>$entry_value)
1237
-		{
1238
-			$theme_strings[$entry_key] = $language_used.' '.$entry_value;
1239
-		}
1240
-	}
1233
+    // If we are in debug mode for translating, turn on the prefix now!
1234
+    if($sugar_config['translation_string_prefix'])
1235
+    {
1236
+        foreach($theme_strings as $entry_key=>$entry_value)
1237
+        {
1238
+            $theme_strings[$entry_key] = $language_used.' '.$entry_value;
1239
+        }
1240
+    }
1241 1241
 
1242
-	return $theme_strings;
1242
+    return $theme_strings;
1243 1243
 }
1244 1244
 
1245 1245
 
@@ -1251,12 +1251,12 @@  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] != "")
1255
-	{
1256
-		return $_SESSION[$varname];
1257
-	}
1254
+    if(isset($_SESSION[$varname]) && $_SESSION[$varname] != "")
1255
+    {
1256
+        return $_SESSION[$varname];
1257
+    }
1258 1258
 
1259
-	return $default;
1259
+    return $default;
1260 1260
 }
1261 1261
 
1262 1262
 /**
@@ -1271,15 +1271,15 @@  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)
1275
-	{
1276
-		$SQL_name = $variable_name;
1277
-	}
1274
+    if($SQL_name == null)
1275
+    {
1276
+        $SQL_name = $variable_name;
1277
+    }
1278 1278
 
1279
-	if(isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "")
1280
-	{
1281
-		array_push($where_clauses, "$SQL_name like '".$GLOBALS['db']->quote($_REQUEST[$variable_name])."%'");
1282
-	}
1279
+    if(isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "")
1280
+    {
1281
+        array_push($where_clauses, "$SQL_name like '".$GLOBALS['db']->quote($_REQUEST[$variable_name])."%'");
1282
+    }
1283 1283
 }
1284 1284
 
1285 1285
 /**
@@ -1292,16 +1292,16 @@  discard block
 block discarded – undo
1292 1292
  */
1293 1293
 function generate_where_statement($where_clauses)
1294 1294
 {
1295
-	$where = "";
1296
-	foreach($where_clauses as $clause)
1297
-	{
1298
-		if($where != "")
1299
-		$where .= " and ";
1300
-		$where .= $clause;
1301
-	}
1295
+    $where = "";
1296
+    foreach($where_clauses as $clause)
1297
+    {
1298
+        if($where != "")
1299
+        $where .= " and ";
1300
+        $where .= $clause;
1301
+    }
1302 1302
 
1303
-	$GLOBALS['log']->info("Here is the where clause for the list view: $where");
1304
-	return $where;
1303
+    $GLOBALS['log']->info("Here is the where clause for the list view: $where");
1304
+    return $where;
1305 1305
 }
1306 1306
 
1307 1307
 /**
@@ -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) {
1314
-		return false;
1315
-	}
1313
+    if(strlen($guid) != 36) {
1314
+        return false;
1315
+    }
1316 1316
 
1317
-	if(preg_match("/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i", $guid)) {
1318
-		return true;
1319
-	}
1317
+    if(preg_match("/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/i", $guid)) {
1318
+        return true;
1319
+    }
1320 1320
 
1321
-	return true;;
1321
+    return true;;
1322 1322
 }
1323 1323
 
1324 1324
 
@@ -1332,59 +1332,59 @@  discard block
 block discarded – undo
1332 1332
  */
1333 1333
 function create_guid()
1334 1334
 {
1335
-	$microTime = microtime();
1336
-	list($a_dec, $a_sec) = explode(" ", $microTime);
1335
+    $microTime = microtime();
1336
+    list($a_dec, $a_sec) = explode(" ", $microTime);
1337 1337
 
1338
-	$dec_hex = dechex($a_dec* 1000000);
1339
-	$sec_hex = dechex($a_sec);
1338
+    $dec_hex = dechex($a_dec* 1000000);
1339
+    $sec_hex = dechex($a_sec);
1340 1340
 
1341
-	ensure_length($dec_hex, 5);
1342
-	ensure_length($sec_hex, 6);
1341
+    ensure_length($dec_hex, 5);
1342
+    ensure_length($sec_hex, 6);
1343 1343
 
1344
-	$guid = "";
1345
-	$guid .= $dec_hex;
1346
-	$guid .= create_guid_section(3);
1347
-	$guid .= '-';
1348
-	$guid .= create_guid_section(4);
1349
-	$guid .= '-';
1350
-	$guid .= create_guid_section(4);
1351
-	$guid .= '-';
1352
-	$guid .= create_guid_section(4);
1353
-	$guid .= '-';
1354
-	$guid .= $sec_hex;
1355
-	$guid .= create_guid_section(6);
1344
+    $guid = "";
1345
+    $guid .= $dec_hex;
1346
+    $guid .= create_guid_section(3);
1347
+    $guid .= '-';
1348
+    $guid .= create_guid_section(4);
1349
+    $guid .= '-';
1350
+    $guid .= create_guid_section(4);
1351
+    $guid .= '-';
1352
+    $guid .= create_guid_section(4);
1353
+    $guid .= '-';
1354
+    $guid .= $sec_hex;
1355
+    $guid .= create_guid_section(6);
1356 1356
 
1357
-	return $guid;
1357
+    return $guid;
1358 1358
 
1359 1359
 }
1360 1360
 
1361 1361
 function create_guid_section($characters)
1362 1362
 {
1363
-	$return = "";
1364
-	for($i=0; $i<$characters; $i++)
1365
-	{
1366
-		$return .= dechex(mt_rand(0,15));
1367
-	}
1368
-	return $return;
1363
+    $return = "";
1364
+    for($i=0; $i<$characters; $i++)
1365
+    {
1366
+        $return .= dechex(mt_rand(0,15));
1367
+    }
1368
+    return $return;
1369 1369
 }
1370 1370
 
1371 1371
 function ensure_length(&$string, $length)
1372 1372
 {
1373
-	$strlen = strlen($string);
1374
-	if($strlen < $length)
1375
-	{
1376
-		$string = str_pad($string,$length,"0");
1377
-	}
1378
-	else if($strlen > $length)
1379
-	{
1380
-		$string = substr($string, 0, $length);
1381
-	}
1373
+    $strlen = strlen($string);
1374
+    if($strlen < $length)
1375
+    {
1376
+        $string = str_pad($string,$length,"0");
1377
+    }
1378
+    else if($strlen > $length)
1379
+    {
1380
+        $string = substr($string, 0, $length);
1381
+    }
1382 1382
 }
1383 1383
 
1384 1384
 function microtime_diff($a, $b) {
1385
-	list($a_dec, $a_sec) = explode(" ", $a);
1386
-	list($b_dec, $b_sec) = explode(" ", $b);
1387
-	return $b_sec - $a_sec + $b_dec - $a_dec;
1385
+    list($a_dec, $a_sec) = explode(" ", $a);
1386
+    list($b_dec, $b_sec) = explode(" ", $b);
1387
+    return $b_sec - $a_sec + $b_dec - $a_dec;
1388 1388
 }
1389 1389
 
1390 1390
 // check if Studio is displayed.
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 
1398 1398
 
1399 1399
 
1400
-	return true;
1400
+    return true;
1401 1401
 
1402 1402
 }
1403 1403
 
@@ -1420,7 +1420,7 @@  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
     }
@@ -1428,22 +1428,22 @@  discard block
 block discarded – undo
1428 1428
     global $moduleList;
1429 1429
     $workflow_mod_list = array();
1430 1430
     foreach($moduleList as $module){
1431
-		$workflow_mod_list[$module] = $module;
1432
-	}
1431
+        $workflow_mod_list[$module] = $module;
1432
+    }
1433 1433
 
1434
-	// This list is taken from teh previous version of workflow_utils.php
1434
+    // This list is taken from teh previous version of workflow_utils.php
1435 1435
     $workflow_mod_list['Tasks'] = "Tasks";
1436 1436
     $workflow_mod_list['Calls'] = "Calls";
1437 1437
     $workflow_mod_list['Meetings'] = "Meetings";
1438 1438
     $workflow_mod_list['Notes'] = "Notes";
1439 1439
     $workflow_mod_list['ProjectTask'] = "Project Tasks";
1440
-	$workflow_mod_list['Leads'] = "Leads";
1441
-	$workflow_mod_list['Opportunities'] = "Opportunities";
1442
-	// End of list
1440
+    $workflow_mod_list['Leads'] = "Leads";
1441
+    $workflow_mod_list['Opportunities'] = "Opportunities";
1442
+    // End of list
1443 1443
 
1444 1444
     $workflow_admin_modules = array();
1445 1445
     if(empty($user)) {
1446
-    	return $workflow_admin_modules;
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
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
         return false;
1498 1498
     }
1499 1499
 
1500
-	return $user->isAdmin();
1500
+    return $user->isAdmin();
1501 1501
 }
1502 1502
 
1503 1503
 /**
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
  */
1511 1511
 function get_theme_display($theme)
1512 1512
 {
1513
-	return SugarThemeRegistry::get($theme)->name;
1513
+    return SugarThemeRegistry::get($theme)->name;
1514 1514
 }
1515 1515
 
1516 1516
 /**
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
  * Contributor(s): ______________________________________..
1538 1538
  */
1539 1539
 function get_select_options ($option_list, $selected) {
1540
-	return get_select_options_with_id($option_list, $selected);
1540
+    return get_select_options_with_id($option_list, $selected);
1541 1541
 }
1542 1542
 
1543 1543
 /**
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
  * Contributor(s): ______________________________________..
1551 1551
  */
1552 1552
 function get_select_options_with_id ($option_list, $selected_key) {
1553
-	return get_select_options_with_id_separate_key($option_list, $option_list, $selected_key);
1553
+    return get_select_options_with_id_separate_key($option_list, $option_list, $selected_key);
1554 1554
 }
1555 1555
 
1556 1556
 
@@ -1565,23 +1565,23 @@  discard block
 block discarded – undo
1565 1565
  * Contributor(s): ______________________________________..
1566 1566
  */
1567 1567
 function get_select_options_with_id_separate_key ($label_list, $key_list, $selected_key, $massupdate=false) {
1568
-	global $app_strings;
1569
-	$select_options = "";
1568
+    global $app_strings;
1569
+    $select_options = "";
1570 1570
 
1571
-	//for setting null selection values to human readable --None--
1572
-	$pattern = "/'0?'></";
1573
-	$replacement = "''>".$app_strings['LBL_NONE']."<";
1571
+    //for setting null selection values to human readable --None--
1572
+    $pattern = "/'0?'></";
1573
+    $replacement = "''>".$app_strings['LBL_NONE']."<";
1574 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
 
1578
-	if (empty($key_list)) $key_list = array();
1579
-	//create the type dropdown domain and set the selected value if $opp value already exists
1580
-	foreach ($key_list as $option_key=>$option_value) {
1578
+    if (empty($key_list)) $key_list = array();
1579
+    //create the type dropdown domain and set the selected value if $opp value already exists
1580
+    foreach ($key_list as $option_key=>$option_value) {
1581 1581
 
1582
-		$selected_string = '';
1583
-		// the system is evaluating $selected_key == 0 || '' to true.  Be very careful when changing this.  Test all cases.
1584
-		// The bug was only happening with one of the users in the drop down.  It was being replaced by none.
1582
+        $selected_string = '';
1583
+        // the system is evaluating $selected_key == 0 || '' to true.  Be very careful when changing this.  Test all cases.
1584
+        // The bug was only happening with one of the users in the drop down.  It was being replaced by none.
1585 1585
         if (
1586 1586
             ($option_key != '' && $selected_key == $option_key)
1587 1587
             || (
@@ -1590,15 +1590,15 @@  discard block
 block discarded – undo
1590 1590
             )
1591 1591
             || (is_array($selected_key) &&  in_array($option_key, $selected_key))
1592 1592
         ) {
1593
-			$selected_string = 'selected ';
1594
-		}
1593
+            $selected_string = 'selected ';
1594
+        }
1595 1595
 
1596
-		$html_value = $option_key;
1596
+        $html_value = $option_key;
1597 1597
 
1598
-		$select_options .= "\n<OPTION ".$selected_string."value='$html_value'>$label_list[$option_key]</OPTION>";
1599
-	}
1600
-	$select_options = preg_replace($pattern, $replacement, $select_options);
1601
-	return $select_options;
1598
+        $select_options .= "\n<OPTION ".$selected_string."value='$html_value'>$label_list[$option_key]</OPTION>";
1599
+    }
1600
+    $select_options = preg_replace($pattern, $replacement, $select_options);
1601
+    return $select_options;
1602 1602
 }
1603 1603
 
1604 1604
 
@@ -1609,10 +1609,10 @@  discard block
 block discarded – undo
1609 1609
  */
1610 1610
 function sugar_die($error_message, $exit_code = 1)
1611 1611
 {
1612
-	global $focus;
1613
-	sugar_cleanup();
1614
-	echo $error_message;
1615
-	die($exit_code);
1612
+    global $focus;
1613
+    sugar_cleanup();
1614
+    echo $error_message;
1615
+    die($exit_code);
1616 1616
 }
1617 1617
 
1618 1618
 
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
  * Contributor(s): ______________________________________..
1624 1624
  */
1625 1625
 function get_clear_form_js () {
1626
-	$the_script = <<<EOQ
1626
+    $the_script = <<<EOQ
1627 1627
 <script type="text/javascript" language="JavaScript">
1628 1628
 function clear_form(form) {
1629 1629
 	var newLoc = 'index.php?action=' + form.action.value + '&module=' + form.module.value + '&query=true&clear_query=true';
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 </script>
1636 1636
 EOQ;
1637 1637
 
1638
-	return $the_script;
1638
+    return $the_script;
1639 1639
 }
1640 1640
 
1641 1641
 /**
@@ -1647,8 +1647,8 @@  discard block
 block discarded – undo
1647 1647
  * Contributor(s): ______________________________________..
1648 1648
  */
1649 1649
 function get_set_focus_js () {
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
-	$the_script = <<<EOQ
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
+    $the_script = <<<EOQ
1652 1652
 <script type="text/javascript" language="JavaScript">
1653 1653
 <!--
1654 1654
 function set_focus() {
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
 </script>
1673 1673
 EOQ;
1674 1674
 
1675
-	return $the_script;
1675
+    return $the_script;
1676 1676
 }
1677 1677
 
1678 1678
 /**
@@ -1688,26 +1688,26 @@  discard block
 block discarded – undo
1688 1688
  * Contributor(s): ______________________________________..
1689 1689
  */
1690 1690
 function array_csort() {
1691
-	$args = func_get_args();
1692
-	$marray = array_shift($args);
1693
-	$i = 0;
1694
-
1695
-	$msortline = "return(array_multisort(";
1696
-	foreach ($args as $arg) {
1697
-		$i++;
1698
-		if (is_string($arg)) {
1699
-			foreach ($marray as $row) {
1700
-				$sortarr[$i][] = $row[$arg];
1701
-			}
1702
-		} else {
1703
-			$sortarr[$i] = $arg;
1704
-		}
1705
-		$msortline .= "\$sortarr[".$i."],";
1706
-	}
1707
-	$msortline .= "\$marray));";
1691
+    $args = func_get_args();
1692
+    $marray = array_shift($args);
1693
+    $i = 0;
1694
+
1695
+    $msortline = "return(array_multisort(";
1696
+    foreach ($args as $arg) {
1697
+        $i++;
1698
+        if (is_string($arg)) {
1699
+            foreach ($marray as $row) {
1700
+                $sortarr[$i][] = $row[$arg];
1701
+            }
1702
+        } else {
1703
+            $sortarr[$i] = $arg;
1704
+        }
1705
+        $msortline .= "\$sortarr[".$i."],";
1706
+    }
1707
+    $msortline .= "\$marray));";
1708 1708
 
1709
-	eval($msortline);
1710
-	return $marray;
1709
+    eval($msortline);
1710
+    return $marray;
1711 1711
 }
1712 1712
 
1713 1713
 /**
@@ -1718,9 +1718,9 @@  discard block
 block discarded – undo
1718 1718
  * Contributor(s): ______________________________________..
1719 1719
  */
1720 1720
 function parse_calendardate($local_format) {
1721
-	preg_match('/\(?([^-]{1})[^-]*-([^-]{1})[^-]*-([^-]{1})[^-]*\)/', $local_format, $matches);
1722
-	$calendar_format = "%" . $matches[1] . "-%" . $matches[2] . "-%" . $matches[3];
1723
-	return str_replace(array("y", "ᅣ1�7", "a", "j"), array("Y", "Y", "Y", "d"), $calendar_format);
1721
+    preg_match('/\(?([^-]{1})[^-]*-([^-]{1})[^-]*-([^-]{1})[^-]*\)/', $local_format, $matches);
1722
+    $calendar_format = "%" . $matches[1] . "-%" . $matches[2] . "-%" . $matches[3];
1723
+    return str_replace(array("y", "ᅣ1�7", "a", "j"), array("Y", "Y", "Y", "d"), $calendar_format);
1724 1724
 }
1725 1725
 
1726 1726
 
@@ -1728,24 +1728,24 @@  discard block
 block discarded – undo
1728 1728
 
1729 1729
 
1730 1730
 function translate($string, $mod='', $selectedValue=''){
1731
-	//$test_start = microtime();
1732
-	//static $mod_strings_results = array();
1733
-	if(!empty($mod)){
1734
-		global $current_language;
1735
-		//Bug 31275
1736
-		if(isset($_REQUEST['login_language'])){
1737
-		    $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language'];
1738
-		}
1739
-		$mod_strings = return_module_language($current_language, $mod);
1731
+    //$test_start = microtime();
1732
+    //static $mod_strings_results = array();
1733
+    if(!empty($mod)){
1734
+        global $current_language;
1735
+        //Bug 31275
1736
+        if(isset($_REQUEST['login_language'])){
1737
+            $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language'];
1738
+        }
1739
+        $mod_strings = return_module_language($current_language, $mod);
1740 1740
         if ($mod == "")
1741 1741
         echo "Language is <pre>" . $mod_strings . "</pre>";
1742 1742
 
1743
-	}else{
1744
-		global $mod_strings;
1745
-	}
1743
+    }else{
1744
+        global $mod_strings;
1745
+    }
1746 1746
 
1747
-	$returnValue = '';
1748
-	global $app_strings, $app_list_strings;
1747
+    $returnValue = '';
1748
+    global $app_strings, $app_list_strings;
1749 1749
 
1750 1750
     if (isset($mod_strings[$string]))
1751 1751
         $returnValue = $mod_strings[$string];
@@ -1757,34 +1757,34 @@  discard block
 block discarded – undo
1757 1757
         $returnValue = $app_list_strings['moduleList'][$string];
1758 1758
 
1759 1759
 
1760
-	//$test_end = microtime();
1761
-	//
1762
-	//    $mod_strings_results[$mod] = microtime_diff($test_start,$test_end);
1763
-	//
1764
-	//    echo("translate results:");
1765
-	//    $total_time = 0;
1766
-	//    $total_strings = 0;
1767
-	//    foreach($mod_strings_results as $key=>$value)
1768
-	//    {
1769
-	//        echo("Module $key \t\t time $value \t\t<br>");
1770
-	//        $total_time += $value;
1771
-	//    }
1772
-	//
1773
-	//    echo("Total time: $total_time<br>");
1760
+    //$test_end = microtime();
1761
+    //
1762
+    //    $mod_strings_results[$mod] = microtime_diff($test_start,$test_end);
1763
+    //
1764
+    //    echo("translate results:");
1765
+    //    $total_time = 0;
1766
+    //    $total_strings = 0;
1767
+    //    foreach($mod_strings_results as $key=>$value)
1768
+    //    {
1769
+    //        echo("Module $key \t\t time $value \t\t<br>");
1770
+    //        $total_time += $value;
1771
+    //    }
1772
+    //
1773
+    //    echo("Total time: $total_time<br>");
1774 1774
 
1775 1775
 
1776 1776
 
1777
-	if(empty($returnValue)){
1778
-		return $string;
1779
-	}
1777
+    if(empty($returnValue)){
1778
+        return $string;
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]) ){
1784
-		return $returnValue[$selectedValue];
1785
-	}
1783
+    if(is_array($returnValue) && (!empty($selectedValue) || (is_numeric($selectedValue) && $selectedValue == 0))  && isset($returnValue[$selectedValue]) ){
1784
+        return $returnValue[$selectedValue];
1785
+    }
1786 1786
 
1787
-	return $returnValue;
1787
+    return $returnValue;
1788 1788
 }
1789 1789
 
1790 1790
 function unTranslateNum($num) {
@@ -1808,16 +1808,16 @@  discard block
 block discarded – undo
1808 1808
 }
1809 1809
 
1810 1810
 function add_http($url) {
1811
-	if(!preg_match("@://@i", $url)) {
1812
-		$scheme = "http";
1813
-		if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
1814
-			$scheme = 'https';
1815
-		}
1811
+    if(!preg_match("@://@i", $url)) {
1812
+        $scheme = "http";
1813
+        if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
1814
+            $scheme = 'https';
1815
+        }
1816 1816
 
1817
-		return "{$scheme}://{$url}";
1818
-	}
1817
+        return "{$scheme}://{$url}";
1818
+    }
1819 1819
 
1820
-	return $url;
1820
+    return $url;
1821 1821
 }
1822 1822
 
1823 1823
 /**
@@ -1825,25 +1825,25 @@  discard block
 block discarded – undo
1825 1825
  * @return array
1826 1826
  */
1827 1827
 function getDefaultXssTags() {
1828
-	$tmp = array(
1829
-	"applet" => "applet",
1830
-	"base" => "base",
1831
-	"embed" => "embed",
1832
-	"form" => "form",
1833
-	"frame" => "frame",
1834
-	"frameset" => "frameset",
1835
-	"iframe" => "iframe",
1836
-	"import" => "\?import",
1837
-	"layer" => "layer",
1838
-	"link" => "link",
1839
-	"object" => "object",
1840
-	"script" => "script",
1841
-	"xmp" => "xmp",
1842
-	);
1843
-
1844
-	$ret = base64_encode(serialize($tmp));
1845
-
1846
-	return $ret;
1828
+    $tmp = array(
1829
+    "applet" => "applet",
1830
+    "base" => "base",
1831
+    "embed" => "embed",
1832
+    "form" => "form",
1833
+    "frame" => "frame",
1834
+    "frameset" => "frameset",
1835
+    "iframe" => "iframe",
1836
+    "import" => "\?import",
1837
+    "layer" => "layer",
1838
+    "link" => "link",
1839
+    "object" => "object",
1840
+    "script" => "script",
1841
+    "xmp" => "xmp",
1842
+    );
1843
+
1844
+    $ret = base64_encode(serialize($tmp));
1845
+
1846
+    return $ret;
1847 1847
 }
1848 1848
 
1849 1849
 /**
@@ -1865,28 +1865,28 @@  discard block
 block discarded – undo
1865 1865
  * @return array Array of matches, empty on clean string
1866 1866
  */
1867 1867
 function clean_xss($str, $cleanImg=true) {
1868
-	global $sugar_config;
1868
+    global $sugar_config;
1869 1869
 
1870
-	if(empty($sugar_config['email_xss']))
1871
-	$sugar_config['email_xss'] = getDefaultXssTags();
1870
+    if(empty($sugar_config['email_xss']))
1871
+    $sugar_config['email_xss'] = getDefaultXssTags();
1872 1872
 
1873
-	$xsstags = unserialize(base64_decode($sugar_config['email_xss']));
1873
+    $xsstags = unserialize(base64_decode($sugar_config['email_xss']));
1874 1874
 
1875
-	// cn: bug 13079 - "on\w" matched too many non-events (cONTact, strONG, etc.)
1876
-	$jsEvents  = "onblur|onfocus|oncontextmenu|onresize|onscroll|onunload|ondblclick|onclick|";
1877
-	$jsEvents .= "onmouseup|onmouseover|onmousedown|onmouseenter|onmouseleave|onmousemove|onload|onchange|";
1878
-	$jsEvents .= "onreset|onselect|onsubmit|onkeydown|onkeypress|onkeyup|onabort|onerror|ondragdrop";
1875
+    // cn: bug 13079 - "on\w" matched too many non-events (cONTact, strONG, etc.)
1876
+    $jsEvents  = "onblur|onfocus|oncontextmenu|onresize|onscroll|onunload|ondblclick|onclick|";
1877
+    $jsEvents .= "onmouseup|onmouseover|onmousedown|onmouseenter|onmouseleave|onmousemove|onload|onchange|";
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
-	$tagsrex = '#<\/?(\w+)((?:\s+(?:\w|\w[\w-]*\w)(?:\s*=\s*(?:\".*?\"|\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?>#im';
1885
+    $tagsrex = '#<\/?(\w+)((?:\s+(?:\w|\w[\w-]*\w)(?:\s*=\s*(?:\".*?\"|\'.*?\'|[^\'\">\s]+))?)+\s*|\s*)\/?>#im';
1886 1886
 
1887
-	$tagmatches = array();
1888
-	$matches = array();
1889
-	preg_match_all($tagsrex, $str, $tagmatches, PREG_PATTERN_ORDER);
1887
+    $tagmatches = array();
1888
+    $matches = array();
1889
+    preg_match_all($tagsrex, $str, $tagmatches, PREG_PATTERN_ORDER);
1890 1890
     foreach($tagmatches[1] as $no => $tag) {
1891 1891
         if(in_array($tag, $xsstags)) {
1892 1892
             // dangerous tag - take out whole
@@ -1900,38 +1900,38 @@  discard block
 block discarded – undo
1900 1900
         }
1901 1901
     }
1902 1902
 
1903
-	$matches = array_merge($matches, xss_check_pattern($javascript_regex, $str));
1903
+    $matches = array_merge($matches, xss_check_pattern($javascript_regex, $str));
1904 1904
 
1905
-	if($cleanImg) {
1906
-		$matches = array_merge($matches,
1907
-		xss_check_pattern($imgsrc_regex, $str)
1908
-		);
1909
-	}
1905
+    if($cleanImg) {
1906
+        $matches = array_merge($matches,
1907
+        xss_check_pattern($imgsrc_regex, $str)
1908
+        );
1909
+    }
1910 1910
 
1911
-	// cn: bug 13498 - custom white-list of allowed domains that vet remote images
1912
-	preg_match_all($css_url, $str, $cssUrlMatches, PREG_PATTERN_ORDER);
1911
+    // cn: bug 13498 - custom white-list of allowed domains that vet remote images
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) {
1916
-			// normalize whitelist
1917
-			foreach($sugar_config['security_trusted_domains'] as $k => $v) {
1918
-				$sugar_config['security_trusted_domains'][$k] = strtolower($v);
1919
-			}
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
+            // normalize whitelist
1917
+            foreach($sugar_config['security_trusted_domains'] as $k => $v) {
1918
+                $sugar_config['security_trusted_domains'][$k] = strtolower($v);
1919
+            }
1920 1920
 
1921
-			foreach($cssUrlMatches[0] as $match) {
1922
-				$domain = strtolower(substr(strstr($match, "://"), 3));
1923
-				$baseUrl = substr($domain, 0, strpos($domain, "/"));
1921
+            foreach($cssUrlMatches[0] as $match) {
1922
+                $domain = strtolower(substr(strstr($match, "://"), 3));
1923
+                $baseUrl = substr($domain, 0, strpos($domain, "/"));
1924 1924
 
1925
-				if(!in_array($baseUrl, $sugar_config['security_trusted_domains'])) {
1926
-					$matches[] = $match;
1927
-				}
1928
-			}
1929
-		}
1930
-	} else {
1931
-		$matches = array_merge($matches, $cssUrlMatches[0]);
1932
-	}
1925
+                if(!in_array($baseUrl, $sugar_config['security_trusted_domains'])) {
1926
+                    $matches[] = $match;
1927
+                }
1928
+            }
1929
+        }
1930
+    } else {
1931
+        $matches = array_merge($matches, $cssUrlMatches[0]);
1932
+    }
1933 1933
 
1934
-	return $matches;
1934
+    return $matches;
1935 1935
 }
1936 1936
 
1937 1937
 /**
@@ -1941,8 +1941,8 @@  discard block
 block discarded – undo
1941 1941
  * @return array
1942 1942
  */
1943 1943
 function xss_check_pattern($pattern, $str) {
1944
-	preg_match_all($pattern, $str, $matches, PREG_PATTERN_ORDER);
1945
-	return $matches[1];
1944
+    preg_match_all($pattern, $str, $matches, PREG_PATTERN_ORDER);
1945
+    return $matches[1];
1946 1946
 }
1947 1947
 
1948 1948
 /**
@@ -1964,80 +1964,80 @@  discard block
 block discarded – undo
1964 1964
  */
1965 1965
 function clean_string($str, $filter = "STANDARD", $dieOnBadData = true)
1966 1966
 {
1967
-	global  $sugar_config;
1968
-
1969
-	$filters = Array(
1970
-	"STANDARD"        => '#[^A-Z0-9\-_\.\@]#i',
1971
-	"STANDARDSPACE"   => '#[^A-Z0-9\-_\.\@\ ]#i',
1972
-	"FILE"            => '#[^A-Z0-9\-_\.]#i',
1973
-	"NUMBER"          => '#[^0-9\-]#i',
1974
-	"SQL_COLUMN_LIST" => '#[^A-Z0-9\(\),_\.]#i',
1975
-	"PATH_NO_URL"     => '#://#i',
1976
-	"SAFED_GET"		  => '#[^A-Z0-9\@\=\&\?\.\/\-_~+]#i', /* range of allowed characters in a GET string */
1977
-	"UNIFIED_SEARCH"	=> "#[\\x00]#", /* cn: bug 3356 & 9236 - MBCS search strings */
1978
-	"AUTO_INCREMENT"	=> '#[^0-9\-,\ ]#i',
1979
-	"ALPHANUM"        => '#[^A-Z0-9\-]#i',
1980
-	);
1981
-
1982
-	if (preg_match($filters[$filter], $str)) {
1983
-		if (isset($GLOBALS['log']) && is_object($GLOBALS['log'])) {
1984
-			$GLOBALS['log']->fatal("SECURITY[$filter]: bad data passed in; string: {$str}");
1985
-		}
1986
-		if ( $dieOnBadData ) {
1987
-			die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
1988
-		}
1989
-		return false;
1990
-	}
1991
-	else {
1992
-		return $str;
1993
-	}
1967
+    global  $sugar_config;
1968
+
1969
+    $filters = Array(
1970
+    "STANDARD"        => '#[^A-Z0-9\-_\.\@]#i',
1971
+    "STANDARDSPACE"   => '#[^A-Z0-9\-_\.\@\ ]#i',
1972
+    "FILE"            => '#[^A-Z0-9\-_\.]#i',
1973
+    "NUMBER"          => '#[^0-9\-]#i',
1974
+    "SQL_COLUMN_LIST" => '#[^A-Z0-9\(\),_\.]#i',
1975
+    "PATH_NO_URL"     => '#://#i',
1976
+    "SAFED_GET"		  => '#[^A-Z0-9\@\=\&\?\.\/\-_~+]#i', /* range of allowed characters in a GET string */
1977
+    "UNIFIED_SEARCH"	=> "#[\\x00]#", /* cn: bug 3356 & 9236 - MBCS search strings */
1978
+    "AUTO_INCREMENT"	=> '#[^0-9\-,\ ]#i',
1979
+    "ALPHANUM"        => '#[^A-Z0-9\-]#i',
1980
+    );
1981
+
1982
+    if (preg_match($filters[$filter], $str)) {
1983
+        if (isset($GLOBALS['log']) && is_object($GLOBALS['log'])) {
1984
+            $GLOBALS['log']->fatal("SECURITY[$filter]: bad data passed in; string: {$str}");
1985
+        }
1986
+        if ( $dieOnBadData ) {
1987
+            die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
1988
+        }
1989
+        return false;
1990
+    }
1991
+    else {
1992
+        return $str;
1993
+    }
1994 1994
 }
1995 1995
 
1996 1996
 function clean_special_arguments() {
1997
-	if(isset($_SERVER['PHP_SELF'])) {
1998
-		if (!empty($_SERVER['PHP_SELF'])) clean_string($_SERVER['PHP_SELF'], 'SAFED_GET');
1999
-	}
2000
-	if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme'], "STANDARD");
2001
-	if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) clean_string($_REQUEST['login_module'], "STANDARD");
2002
-	if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) clean_string($_REQUEST['login_action'], "STANDARD");
2003
-	if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) clean_string($_REQUEST['ck_login_theme_20'], "STANDARD");
2004
-	if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme'], "STANDARD");
2005
-	if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) clean_string($_REQUEST['module_name'], "STANDARD");
2006
-	if (!empty($_REQUEST) && !empty($_REQUEST['module'])) clean_string($_REQUEST['module'], "STANDARD");
2007
-	if (!empty($_POST) && !empty($_POST['parent_type'])) clean_string($_POST['parent_type'], "STANDARD");
2008
-	if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) clean_string($_REQUEST['mod_lang'], "STANDARD");
2009
-	if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language'], "STANDARD");
2010
-	if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL");
2011
-	if (!empty($_GET) && !empty($_GET['from'])) clean_string($_GET['from']);
2012
-	if (!empty($_GET) && !empty($_GET['gmto'])) clean_string($_GET['gmto'], "NUMBER");
2013
-	if (!empty($_GET) && !empty($_GET['case_number'])) clean_string($_GET['case_number'], "AUTO_INCREMENT");
2014
-	if (!empty($_GET) && !empty($_GET['bug_number'])) clean_string($_GET['bug_number'], "AUTO_INCREMENT");
2015
-	if (!empty($_GET) && !empty($_GET['quote_num'])) clean_string($_GET['quote_num'], "AUTO_INCREMENT");
2016
-	clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls
2017
-	clean_superglobals('offset', 'ALPHANUM');
2018
-	clean_superglobals('return_action');
2019
-	clean_superglobals('return_module');
2020
-	return TRUE;
1997
+    if(isset($_SERVER['PHP_SELF'])) {
1998
+        if (!empty($_SERVER['PHP_SELF'])) clean_string($_SERVER['PHP_SELF'], 'SAFED_GET');
1999
+    }
2000
+    if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme'], "STANDARD");
2001
+    if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) clean_string($_REQUEST['login_module'], "STANDARD");
2002
+    if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) clean_string($_REQUEST['login_action'], "STANDARD");
2003
+    if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) clean_string($_REQUEST['ck_login_theme_20'], "STANDARD");
2004
+    if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme'], "STANDARD");
2005
+    if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) clean_string($_REQUEST['module_name'], "STANDARD");
2006
+    if (!empty($_REQUEST) && !empty($_REQUEST['module'])) clean_string($_REQUEST['module'], "STANDARD");
2007
+    if (!empty($_POST) && !empty($_POST['parent_type'])) clean_string($_POST['parent_type'], "STANDARD");
2008
+    if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) clean_string($_REQUEST['mod_lang'], "STANDARD");
2009
+    if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language'], "STANDARD");
2010
+    if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL");
2011
+    if (!empty($_GET) && !empty($_GET['from'])) clean_string($_GET['from']);
2012
+    if (!empty($_GET) && !empty($_GET['gmto'])) clean_string($_GET['gmto'], "NUMBER");
2013
+    if (!empty($_GET) && !empty($_GET['case_number'])) clean_string($_GET['case_number'], "AUTO_INCREMENT");
2014
+    if (!empty($_GET) && !empty($_GET['bug_number'])) clean_string($_GET['bug_number'], "AUTO_INCREMENT");
2015
+    if (!empty($_GET) && !empty($_GET['quote_num'])) clean_string($_GET['quote_num'], "AUTO_INCREMENT");
2016
+    clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls
2017
+    clean_superglobals('offset', 'ALPHANUM');
2018
+    clean_superglobals('return_action');
2019
+    clean_superglobals('return_module');
2020
+    return TRUE;
2021 2021
 }
2022 2022
 
2023 2023
 /**
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 2032
 function set_superglobals($key, $val){
2033
-	$_GET[$key] = $val;
2034
-	$_POST[$key] = $val;
2035
-	$_REQUEST[$key] = $val;
2033
+    $_GET[$key] = $val;
2034
+    $_POST[$key] = $val;
2035
+    $_REQUEST[$key] = $val;
2036 2036
 }
2037 2037
 
2038 2038
 // Works in conjunction with clean_string() to defeat SQL injection, file inclusion attacks, and XSS
2039 2039
 function clean_incoming_data() {
2040
-	global $sugar_config;
2040
+    global $sugar_config;
2041 2041
     global $RAW_REQUEST;
2042 2042
 
2043 2043
     if(get_magic_quotes_gpc()) {
@@ -2047,120 +2047,120 @@  discard block
 block discarded – undo
2047 2047
         $RAW_REQUEST = $_REQUEST;
2048 2048
     }
2049 2049
 
2050
-	if (get_magic_quotes_gpc() == 1) {
2051
-		$req  = array_map("preprocess_param", $_REQUEST);
2052
-		$post = array_map("preprocess_param", $_POST);
2053
-		$get  = array_map("preprocess_param", $_GET);
2054
-	} else {
2050
+    if (get_magic_quotes_gpc() == 1) {
2051
+        $req  = array_map("preprocess_param", $_REQUEST);
2052
+        $post = array_map("preprocess_param", $_POST);
2053
+        $get  = array_map("preprocess_param", $_GET);
2054
+    } else {
2055 2055
 
2056
-		$req  = array_map("securexss", $_REQUEST);
2057
-		$post = array_map("securexss", $_POST);
2058
-		$get  = array_map("securexss", $_GET);
2059
-	}
2056
+        $req  = array_map("securexss", $_REQUEST);
2057
+        $post = array_map("securexss", $_POST);
2058
+        $get  = array_map("securexss", $_GET);
2059
+    }
2060 2060
 
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) {
2065
-		 $_REQUEST[$k] = $v;
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) {
2065
+            $_REQUEST[$k] = $v;
2066 2066
 
2067
-	    //ensure the keys are safe as well.  If mbstring encoding translation is on, the post keys don't
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'){
2069
+        if(ini_get('mbstring.encoding_translation')==='1'){
2070 2070
             securexsskey($k,false);
2071 2071
         }else{
2072
-		    securexsskey($k,true);
2072
+            securexsskey($k,true);
2073 2073
         }
2074 2074
 
2075
-	}
2076
-	// Any additional variables that need to be cleaned should be added here
2077
-	if (isset($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme']);
2078
-	if (isset($_REQUEST['login_module'])) clean_string($_REQUEST['login_module']);
2079
-	if (isset($_REQUEST['login_action'])) clean_string($_REQUEST['login_action']);
2080
-	if (isset($_REQUEST['login_language'])) clean_string($_REQUEST['login_language']);
2081
-	if (isset($_REQUEST['action'])) clean_string($_REQUEST['action']);
2082
-	if (isset($_REQUEST['module'])) clean_string($_REQUEST['module']);
2083
-	if (isset($_REQUEST['record'])) clean_string($_REQUEST['record'], 'STANDARDSPACE');
2084
-	if (isset($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme']);
2085
-	if (isset($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language']);
2086
-	if (isset($_REQUEST['language'])) clean_string($_REQUEST['language']);
2087
-	if (isset($sugar_config['default_theme'])) clean_string($sugar_config['default_theme']);
2088
-	if (isset($_REQUEST['offset'])) clean_string($_REQUEST['offset']);
2089
-	if (isset($_REQUEST['stamp'])) clean_string($_REQUEST['stamp']);
2090
-
2091
-	if(isset($_REQUEST['lvso'])){
2092
-			set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc');
2093
-	}
2094
-	// Clean "offset" and "order_by" parameters in URL
2095
-	foreach ($_REQUEST as $key => $val) {
2096
-		if (str_end($key, "_offset")) {
2097
-			clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query
2098
-			set_superglobals($key, $_REQUEST[$key]);
2099
-		}
2100
-		elseif (str_end($key, "_ORDER_BY")) {
2101
-			clean_string($_REQUEST[$key], "SQL_COLUMN_LIST");
2102
-			set_superglobals($key, $_REQUEST[$key]);
2103
-		}
2104
-	}
2075
+    }
2076
+    // Any additional variables that need to be cleaned should be added here
2077
+    if (isset($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme']);
2078
+    if (isset($_REQUEST['login_module'])) clean_string($_REQUEST['login_module']);
2079
+    if (isset($_REQUEST['login_action'])) clean_string($_REQUEST['login_action']);
2080
+    if (isset($_REQUEST['login_language'])) clean_string($_REQUEST['login_language']);
2081
+    if (isset($_REQUEST['action'])) clean_string($_REQUEST['action']);
2082
+    if (isset($_REQUEST['module'])) clean_string($_REQUEST['module']);
2083
+    if (isset($_REQUEST['record'])) clean_string($_REQUEST['record'], 'STANDARDSPACE');
2084
+    if (isset($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme']);
2085
+    if (isset($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language']);
2086
+    if (isset($_REQUEST['language'])) clean_string($_REQUEST['language']);
2087
+    if (isset($sugar_config['default_theme'])) clean_string($sugar_config['default_theme']);
2088
+    if (isset($_REQUEST['offset'])) clean_string($_REQUEST['offset']);
2089
+    if (isset($_REQUEST['stamp'])) clean_string($_REQUEST['stamp']);
2090
+
2091
+    if(isset($_REQUEST['lvso'])){
2092
+            set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc');
2093
+    }
2094
+    // Clean "offset" and "order_by" parameters in URL
2095
+    foreach ($_REQUEST as $key => $val) {
2096
+        if (str_end($key, "_offset")) {
2097
+            clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query
2098
+            set_superglobals($key, $_REQUEST[$key]);
2099
+        }
2100
+        elseif (str_end($key, "_ORDER_BY")) {
2101
+            clean_string($_REQUEST[$key], "SQL_COLUMN_LIST");
2102
+            set_superglobals($key, $_REQUEST[$key]);
2103
+        }
2104
+    }
2105 2105
 
2106 2106
 
2107
-	return 0;
2107
+    return 0;
2108 2108
 }
2109 2109
 
2110 2110
 // Returns TRUE if $str begins with $begin
2111 2111
 function str_begin($str, $begin) {
2112
-	return (substr($str, 0, strlen($begin)) == $begin);
2112
+    return (substr($str, 0, strlen($begin)) == $begin);
2113 2113
 }
2114 2114
 
2115 2115
 // Returns TRUE if $str ends with $end
2116 2116
 function str_end($str, $end) {
2117
-	return (substr($str, strlen($str) - strlen($end)) == $end);
2117
+    return (substr($str, strlen($str) - strlen($end)) == $end);
2118 2118
 }
2119 2119
 
2120 2120
 function securexss($value) {
2121
-	if(is_array($value)){
2122
-    	$new = array();
2121
+    if(is_array($value)){
2122
+        $new = array();
2123 2123
         foreach($value as $key=>$val){
2124
-       		$new[$key] = securexss($val);
2124
+                $new[$key] = securexss($val);
2125 2125
         }
2126 2126
         return $new;
2127 2127
     }
2128
-	static $xss_cleanup=  array("&quot;" => "&#38;", '"' =>'&quot;', "'" =>  '&#039;' , '<' =>'&lt;' , '>'=>'&gt;');
2129
-	$value = preg_replace(array('/javascript:/i', '/\0/'), array('java script:', ''), $value);
2130
-	$value = preg_replace('/javascript:/i', 'java script:', $value);
2131
-	return str_replace(array_keys($xss_cleanup), array_values($xss_cleanup), $value);
2128
+    static $xss_cleanup=  array("&quot;" => "&#38;", '"' =>'&quot;', "'" =>  '&#039;' , '<' =>'&lt;' , '>'=>'&gt;');
2129
+    $value = preg_replace(array('/javascript:/i', '/\0/'), array('java script:', ''), $value);
2130
+    $value = preg_replace('/javascript:/i', 'java script:', $value);
2131
+    return str_replace(array_keys($xss_cleanup), array_values($xss_cleanup), $value);
2132 2132
 }
2133 2133
 
2134 2134
 function securexsskey($value, $die=true){
2135
-	global $sugar_config;
2136
-	$matches = array();
2137
-	preg_match('/[\'"<>]/', $value, $matches);
2138
-	if(!empty($matches)){
2139
-		if($die){
2140
-			die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
2141
-		}else{
2142
-			unset($_REQUEST[$value]);
2143
-			unset($_POST[$value]);
2144
-			unset($_GET[$value]);
2145
-		}
2146
-	}
2135
+    global $sugar_config;
2136
+    $matches = array();
2137
+    preg_match('/[\'"<>]/', $value, $matches);
2138
+    if(!empty($matches)){
2139
+        if($die){
2140
+            die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
2141
+        }else{
2142
+            unset($_REQUEST[$value]);
2143
+            unset($_POST[$value]);
2144
+            unset($_GET[$value]);
2145
+        }
2146
+    }
2147 2147
 }
2148 2148
 
2149 2149
 function preprocess_param($value){
2150
-	if(is_string($value)){
2151
-		if(get_magic_quotes_gpc() == 1){
2152
-			$value = stripslashes($value);
2153
-		}
2150
+    if(is_string($value)){
2151
+        if(get_magic_quotes_gpc() == 1){
2152
+            $value = stripslashes($value);
2153
+        }
2154 2154
 
2155
-		$value = securexss($value);
2156
-	}
2157
-	else if (is_array($value)){
2158
-	    foreach ($value as $key => $element) {
2159
-	        $value[$key] = preprocess_param($element);
2160
-	    }
2161
-	}
2155
+        $value = securexss($value);
2156
+    }
2157
+    else if (is_array($value)){
2158
+        foreach ($value as $key => $element) {
2159
+            $value[$key] = preprocess_param($element);
2160
+        }
2161
+    }
2162 2162
 
2163
-	return $value;
2163
+    return $value;
2164 2164
 }
2165 2165
 
2166 2166
 function cleanup_slashes($value)
@@ -2184,13 +2184,13 @@  discard block
 block discarded – undo
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\-]|',
2188
-	create_function(
2189
-	// single quotes are essential here,
2190
-	// or alternative escape all $ as \$
2191
-	'$matches',
2192
-	'return ord($matches[0]);'
2193
-         ) ,$string);
2187
+    return preg_replace_callback( '|[^A-Za-z0-9\-]|',
2188
+    create_function(
2189
+    // single quotes are essential here,
2190
+    // or alternative escape all $ as \$
2191
+    '$matches',
2192
+    'return ord($matches[0]);'
2193
+            ) ,$string);
2194 2194
 }
2195 2195
 
2196 2196
 /**
@@ -2201,41 +2201,41 @@  discard block
 block discarded – undo
2201 2201
     return SugarThemeRegistry::current()->getImage(basename($image), $other_attributes, empty($width) ? null : $width, empty($height) ? null : $height, $ext, $alt );
2202 2202
 }
2203 2203
 /**
2204
- * @deprecated use SugarTheme::getImageURL()
2205
- */
2204
+     * @deprecated use SugarTheme::getImageURL()
2205
+     */
2206 2206
 function getImagePath($image_name)
2207 2207
 {
2208 2208
     return SugarThemeRegistry::current()->getImageURL($image_name);
2209 2209
 }
2210 2210
 
2211 2211
 function getWebPath($relative_path){
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);
2215
-	return $relative_path;
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);
2215
+    return $relative_path;
2216 2216
 }
2217 2217
 
2218 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()) {
2223
-	    static $rand;
2224
-	    if(empty($rand)) $rand = mt_rand();
2225
-	    $dev = $rand;
2226
-	} else {
2227
-	    $dev = '';
2228
-	}
2229
-	if(is_array($additional_attrs)) {
2230
-	    $additional_attrs = join("|",$additional_attrs);
2231
-	}
2232
-	// cutting 2 last chars here because since md5 is 32 chars, it's always ==
2233
-	$str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2);
2234
-	// remove / - it confuses some parsers
2235
-	$str = strtr($str, '/+', '-_');
2236
-	if(empty($path)) return $str;
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
+        static $rand;
2224
+        if(empty($rand)) $rand = mt_rand();
2225
+        $dev = $rand;
2226
+    } else {
2227
+        $dev = '';
2228
+    }
2229
+    if(is_array($additional_attrs)) {
2230
+        $additional_attrs = join("|",$additional_attrs);
2231
+    }
2232
+    // cutting 2 last chars here because since md5 is 32 chars, it's always ==
2233
+    $str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2);
2234
+    // remove / - it confuses some parsers
2235
+    $str = strtr($str, '/+', '-_');
2236
+    if(empty($path)) return $str;
2237 2237
 
2238
-	return $path . "?v=$str";
2238
+    return $path . "?v=$str";
2239 2239
 }
2240 2240
 
2241 2241
 function getVersionedScript($path, $additional_attrs='')
@@ -2245,19 +2245,19 @@  discard block
 block discarded – undo
2245 2245
 
2246 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 2252
 function getSWFPath($relative_path, $additional_params=''){
2253
-	$path = $relative_path;
2254
-	if (!empty($additional_params)){
2255
-		$path .= '?' . $additional_params;
2256
-	}
2257
-	if (defined('TEMPLATE_URL')){
2258
-		$path = TEMPLATE_URL . '/' . $path;
2259
-	}
2260
-	return $path;
2253
+    $path = $relative_path;
2254
+    if (!empty($additional_params)){
2255
+        $path .= '?' . $additional_params;
2256
+    }
2257
+    if (defined('TEMPLATE_URL')){
2258
+        $path = TEMPLATE_URL . '/' . $path;
2259
+    }
2260
+    return $path;
2261 2261
 }
2262 2262
 
2263 2263
 
@@ -2266,158 +2266,158 @@  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))
2270
-	{
2271
-		if ( strlen($match[2]) == 1)
2272
-		{
2273
-			$match[2] = "0".$match[2];
2274
-		}
2275
-		if ( strlen($match[1]) == 1)
2276
-		{
2277
-			$match[1] = "0".$match[1];
2278
-		}
2279
-		return "{$match[3]}-{$match[1]}-{$match[2]}";
2280
-	}
2281
-	else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match))
2282
-	{
2283
-		if ( strlen($match[2]) == 1)
2284
-		{
2285
-			$match[2] = "0".$match[2];
2286
-		}
2287
-		if ( strlen($match[1]) == 1)
2288
-		{
2289
-			$match[1] = "0".$match[1];
2290
-		}
2291
-		return "{$match[3]}-{$match[1]}-{$match[2]}";
2292
-	}
2293
-	else
2294
-	{
2295
-		return "";
2296
-	}
2269
+    if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/',$date_str,$match))
2270
+    {
2271
+        if ( strlen($match[2]) == 1)
2272
+        {
2273
+            $match[2] = "0".$match[2];
2274
+        }
2275
+        if ( strlen($match[1]) == 1)
2276
+        {
2277
+            $match[1] = "0".$match[1];
2278
+        }
2279
+        return "{$match[3]}-{$match[1]}-{$match[2]}";
2280
+    }
2281
+    else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match))
2282
+    {
2283
+        if ( strlen($match[2]) == 1)
2284
+        {
2285
+            $match[2] = "0".$match[2];
2286
+        }
2287
+        if ( strlen($match[1]) == 1)
2288
+        {
2289
+            $match[1] = "0".$match[1];
2290
+        }
2291
+        return "{$match[3]}-{$match[1]}-{$match[2]}";
2292
+    }
2293
+    else
2294
+    {
2295
+        return "";
2296
+    }
2297 2297
 }
2298 2298
 
2299 2299
 function clone_history(&$db, $from_id,$to_id, $to_type)
2300 2300
 {
2301
-	global $timedate;
2302
-	$old_note_id=null;
2303
-	$old_filename=null;
2304
-	require_once('include/upload_file.php');
2305
-	$tables = array('calls'=>'Call', 'meetings'=>'Meeting', 'notes'=>'Note', 'tasks'=>'Task');
2306
-
2307
-	$location=array('Email'=>"modules/Emails/Email.php",
2308
-	'Call'=>"modules/Calls/Call.php",
2309
-	'Meeting'=>"modules/Meetings/Meeting.php",
2310
-	'Note'=>"modules/Notes/Note.php",
2311
-	'Tasks'=>"modules/Tasks/Task.php",
2312
-	);
2313
-
2314
-
2315
-	foreach($tables as $table=>$bean_class)
2316
-	{
2317
-
2318
-		if (!class_exists($bean_class))
2319
-		{
2320
-			require_once($location[$bean_class]);
2321
-		}
2322
-
2323
-		$bProcessingNotes=false;
2324
-		if ($table=='notes')
2325
-		{
2326
-			$bProcessingNotes=true;
2327
-		}
2328
-		$query = "SELECT id FROM $table WHERE parent_id='$from_id'";
2329
-		$results = $db->query($query);
2330
-		while($row = $db->fetchByAssoc($results))
2331
-		{
2332
-			//retrieve existing record.
2333
-			$bean= new $bean_class();
2334
-			$bean->retrieve($row['id']);
2335
-			//process for new instance.
2336
-			if ($bProcessingNotes)
2337
-			{
2338
-				$old_note_id=$row['id'];
2339
-				$old_filename=$bean->filename;
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))
2345
-			{
2346
-				$bean->contact_id=$to_id;
2347
-			}
2348
-			$bean->update_date_modified = false;
2301
+    global $timedate;
2302
+    $old_note_id=null;
2303
+    $old_filename=null;
2304
+    require_once('include/upload_file.php');
2305
+    $tables = array('calls'=>'Call', 'meetings'=>'Meeting', 'notes'=>'Note', 'tasks'=>'Task');
2306
+
2307
+    $location=array('Email'=>"modules/Emails/Email.php",
2308
+    'Call'=>"modules/Calls/Call.php",
2309
+    'Meeting'=>"modules/Meetings/Meeting.php",
2310
+    'Note'=>"modules/Notes/Note.php",
2311
+    'Tasks'=>"modules/Tasks/Task.php",
2312
+    );
2313
+
2314
+
2315
+    foreach($tables as $table=>$bean_class)
2316
+    {
2317
+
2318
+        if (!class_exists($bean_class))
2319
+        {
2320
+            require_once($location[$bean_class]);
2321
+        }
2322
+
2323
+        $bProcessingNotes=false;
2324
+        if ($table=='notes')
2325
+        {
2326
+            $bProcessingNotes=true;
2327
+        }
2328
+        $query = "SELECT id FROM $table WHERE parent_id='$from_id'";
2329
+        $results = $db->query($query);
2330
+        while($row = $db->fetchByAssoc($results))
2331
+        {
2332
+            //retrieve existing record.
2333
+            $bean= new $bean_class();
2334
+            $bean->retrieve($row['id']);
2335
+            //process for new instance.
2336
+            if ($bProcessingNotes)
2337
+            {
2338
+                $old_note_id=$row['id'];
2339
+                $old_filename=$bean->filename;
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))
2345
+            {
2346
+                $bean->contact_id=$to_id;
2347
+            }
2348
+            $bean->update_date_modified = false;
2349 2349
             $bean->update_modified_by = false;
2350 2350
             if(isset($bean->date_modified))
2351 2351
                 $bean->date_modified = $timedate->to_db($bean->date_modified);
2352 2352
             if(isset($bean->date_entered))
2353 2353
                 $bean->date_entered = $timedate->to_db($bean->date_entered);
2354
-			//save
2355
-			$new_id=$bean->save();
2354
+            //save
2355
+            $new_id=$bean->save();
2356 2356
 
2357
-			//duplicate the file now. for notes.
2358
-			if ($bProcessingNotes && !empty($old_filename))
2359
-			{
2360
-				UploadFile::duplicate_file($old_note_id,$new_id,$old_filename);
2361
-			}
2362
-			//reset the values needed for attachment duplication.
2363
-			$old_note_id=null;
2364
-			$old_filename=null;
2365
-		}
2366
-	}
2357
+            //duplicate the file now. for notes.
2358
+            if ($bProcessingNotes && !empty($old_filename))
2359
+            {
2360
+                UploadFile::duplicate_file($old_note_id,$new_id,$old_filename);
2361
+            }
2362
+            //reset the values needed for attachment duplication.
2363
+            $old_note_id=null;
2364
+            $old_filename=null;
2365
+        }
2366
+    }
2367 2367
 }
2368 2368
 
2369 2369
 function values_to_keys($array)
2370 2370
 {
2371
-	$new_array = array();
2372
-	if(!is_array($array))
2373
-	{
2374
-		return $new_array;
2375
-	}
2376
-	foreach($array as $arr){
2377
-		$new_array[$arr] = $arr;
2378
-	}
2379
-	return $new_array;
2371
+    $new_array = array();
2372
+    if(!is_array($array))
2373
+    {
2374
+        return $new_array;
2375
+    }
2376
+    foreach($array as $arr){
2377
+        $new_array[$arr] = $arr;
2378
+    }
2379
+    return $new_array;
2380 2380
 }
2381 2381
 
2382 2382
 function clone_relationship(&$db, $tables = array(), $from_column, $from_id, $to_id)
2383 2383
 {
2384
-	foreach($tables as $table)
2385
-	{
2386
-
2387
-		if ($table == 'emails_beans') {
2388
-			$query = "SELECT * FROM $table WHERE $from_column='$from_id' and bean_module='Leads'";
2389
-		} else {
2390
-			$query = "SELECT * FROM $table WHERE $from_column='$from_id'";
2391
-		}
2392
-		$results = $db->query($query);
2393
-		while($row = $db->fetchByAssoc($results))
2394
-		{
2395
-			$query = "INSERT INTO $table ";
2396
-			$names = '';
2397
-			$values = '';
2398
-			$row[$from_column] = $to_id;
2399
-			$row['id'] = create_guid();
2400
-			if ($table=='emails_beans') {
2401
-				$row['bean_module'] =='Contacts';
2402
-			}
2384
+    foreach($tables as $table)
2385
+    {
2403 2386
 
2404
-			foreach($row as $name=>$value)
2405
-			{
2406
-
2407
-				if(empty($names))
2408
-				{
2409
-					$names .= $name;
2410
-					$values .= "'$value'";
2411
-				} else
2412
-				{
2413
-					$names .= ', '. $name;
2414
-					$values .= ", '$value'";
2415
-				}
2416
-			}
2417
-			$query .= "($names)	VALUES ($values)";
2418
-			$db->query($query);
2419
-		}
2420
-	}
2387
+        if ($table == 'emails_beans') {
2388
+            $query = "SELECT * FROM $table WHERE $from_column='$from_id' and bean_module='Leads'";
2389
+        } else {
2390
+            $query = "SELECT * FROM $table WHERE $from_column='$from_id'";
2391
+        }
2392
+        $results = $db->query($query);
2393
+        while($row = $db->fetchByAssoc($results))
2394
+        {
2395
+            $query = "INSERT INTO $table ";
2396
+            $names = '';
2397
+            $values = '';
2398
+            $row[$from_column] = $to_id;
2399
+            $row['id'] = create_guid();
2400
+            if ($table=='emails_beans') {
2401
+                $row['bean_module'] =='Contacts';
2402
+            }
2403
+
2404
+            foreach($row as $name=>$value)
2405
+            {
2406
+
2407
+                if(empty($names))
2408
+                {
2409
+                    $names .= $name;
2410
+                    $values .= "'$value'";
2411
+                } else
2412
+                {
2413
+                    $names .= ', '. $name;
2414
+                    $values .= ", '$value'";
2415
+                }
2416
+            }
2417
+            $query .= "($names)	VALUES ($values)";
2418
+            $db->query($query);
2419
+        }
2420
+    }
2421 2421
 }
2422 2422
 
2423 2423
 function get_unlinked_email_query($type, $bean) {
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
     $return_array['select']='SELECT emails.id ';
2427 2427
     $return_array['from']='FROM emails ';
2428 2428
     $return_array['where']="";
2429
-	$return_array['join'] = " JOIN (select DISTINCT email_id from emails_email_addr_rel eear
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
2432 2432
 	eabr.email_address_id = eear.email_address_id and eabr.deleted=0
@@ -2435,17 +2435,17 @@  discard block
 block discarded – undo
2435 2435
 	) derivedemails on derivedemails.email_id = emails.id";
2436 2436
     $return_array['join_tables'][0] = '';
2437 2437
 
2438
-	if (isset($type) and !empty($type['return_as_array'])) {
2439
-		return $return_array;
2440
-	}
2438
+    if (isset($type) and !empty($type['return_as_array'])) {
2439
+        return $return_array;
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
-	$bean = $GLOBALS['app']->controller->bean;
2448
+    $bean = $GLOBALS['app']->controller->bean;
2449 2449
     if(empty($bean->$relation)) {
2450 2450
         $bean->load_relationship($relation);
2451 2451
     }
@@ -2455,8 +2455,8 @@  discard block
 block discarded – undo
2455 2455
     }
2456 2456
     $rel_module = $bean->$relation->getRelatedModuleName();
2457 2457
     $rel_join = $bean->$relation->getJoin(array(
2458
-    	'join_table_alias' => 'link_bean',
2459
-    	'join_table_link_alias' => 'linkt',
2458
+        'join_table_alias' => 'link_bean',
2459
+        'join_table_link_alias' => 'linkt',
2460 2460
     ));
2461 2461
     $rel_join = str_replace("{$bean->table_name}.id", "'{$bean->id}'", $rel_join);
2462 2462
     $return_array['select']='SELECT DISTINCT emails.id ';
@@ -2535,12 +2535,12 @@  discard block
 block discarded – undo
2535 2535
 
2536 2536
     $return_array['where']=" WHERE emails.deleted=0 ";
2537 2537
 
2538
-    	//$return_array['join'] = '';
2538
+        //$return_array['join'] = '';
2539 2539
         $return_array['join_tables'][0] = '';
2540 2540
 
2541 2541
         if($bean->object_name == "Case" && !empty($bean->case_number)) {
2542 2542
             $where = str_replace("%1", $bean->case_number, 	$bean->getEmailSubjectMacro());
2543
-    	    $return_array["where"] .= "\n AND (email_ids.source = 'direct' OR emails.name LIKE '%$where%')";
2543
+            $return_array["where"] .= "\n AND (email_ids.source = 'direct' OR emails.name LIKE '%$where%')";
2544 2544
         }
2545 2545
 
2546 2546
         return $return_array;
@@ -2553,32 +2553,32 @@  discard block
 block discarded – undo
2553 2553
  **/
2554 2554
 function number_empty($value)
2555 2555
 {
2556
-	return empty($value) && $value != '0';
2556
+    return empty($value) && $value != '0';
2557 2557
 }
2558 2558
 
2559 2559
 function get_bean_select_array($add_blank=true, $bean_name, $display_columns, $where='', $order_by='', $blank_is_none=false)
2560 2560
 {
2561
-	global $beanFiles;
2562
-	require_once($beanFiles[$bean_name]);
2563
-	$focus = new $bean_name();
2564
-	$user_array = array();
2561
+    global $beanFiles;
2562
+    require_once($beanFiles[$bean_name]);
2563
+    $focus = new $bean_name();
2564
+    $user_array = array();
2565 2565
 
2566 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
-	{
2567
+    $user_array = get_register_value('select_array', $key );
2568
+    if(!$user_array)
2569
+    {
2570 2570
 
2571
-		$db = DBManagerFactory::getInstance();
2571
+        $db = DBManagerFactory::getInstance();
2572 2572
 
2573
-		$temp_result = Array();
2574
-		$query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} ";
2575
-		$query .= "where ";
2576
-		if ( $where != '')
2577
-		{
2578
-			$query .= $where." AND ";
2579
-		}
2573
+        $temp_result = Array();
2574
+        $query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} ";
2575
+        $query .= "where ";
2576
+        if ( $where != '')
2577
+        {
2578
+            $query .= $where." AND ";
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;
@@ -2603,35 +2603,35 @@  discard block
 block discarded – undo
2603 2603
         }
2604 2604
         /* END - SECURITY GROUPS */
2605 2605
 
2606
-		if ( $order_by != '')
2607
-		{
2608
-			$query .= " order by {$focus->table_name}.{$order_by}";
2609
-		}
2610
-
2611
-		$GLOBALS['log']->debug("get_user_array query: $query");
2612
-		$result = $db->query($query, true, "Error filling in user array: ");
2613
-
2614
-		if ($add_blank==true){
2615
-			// Add in a blank row
2616
-			if($blank_is_none == true) { // set 'blank row' to "--None--"
2617
-				global $app_strings;
2618
-				$temp_result[''] = $app_strings['LBL_NONE'];
2619
-			} else {
2620
-				$temp_result[''] = '';
2621
-			}
2622
-		}
2606
+        if ( $order_by != '')
2607
+        {
2608
+            $query .= " order by {$focus->table_name}.{$order_by}";
2609
+        }
2623 2610
 
2624
-		// Get the id and the name.
2625
-		while($row = $db->fetchByAssoc($result))
2626
-		{
2627
-			$temp_result[$row['id']] = $row['display'];
2628
-		}
2611
+        $GLOBALS['log']->debug("get_user_array query: $query");
2612
+        $result = $db->query($query, true, "Error filling in user array: ");
2629 2613
 
2630
-		$user_array = $temp_result;
2631
-		set_register_value('select_array', $key ,$temp_result);
2632
-	}
2614
+        if ($add_blank==true){
2615
+            // Add in a blank row
2616
+            if($blank_is_none == true) { // set 'blank row' to "--None--"
2617
+                global $app_strings;
2618
+                $temp_result[''] = $app_strings['LBL_NONE'];
2619
+            } else {
2620
+                $temp_result[''] = '';
2621
+            }
2622
+        }
2623
+
2624
+        // Get the id and the name.
2625
+        while($row = $db->fetchByAssoc($result))
2626
+        {
2627
+            $temp_result[$row['id']] = $row['display'];
2628
+        }
2629
+
2630
+        $user_array = $temp_result;
2631
+        set_register_value('select_array', $key ,$temp_result);
2632
+    }
2633 2633
 
2634
-	return $user_array;
2634
+    return $user_array;
2635 2635
 
2636 2636
 }
2637 2637
 /**
@@ -2643,50 +2643,50 @@  discard block
 block discarded – undo
2643 2643
 // searches a list for items in a user's allowed tabs and returns an array that removes unallowed tabs from list
2644 2644
 function parse_list_modules(&$listArray)
2645 2645
 {
2646
-	global $modListHeader;
2647
-	$returnArray = array();
2648
-
2649
-	foreach($listArray as $optionName => $optionVal)
2650
-	{
2651
-		if(array_key_exists($optionName, $modListHeader))
2652
-		{
2653
-			$returnArray[$optionName] = $optionVal;
2654
-		}
2655
-
2656
-		// special case for projects
2657
-		if(array_key_exists('Project', $modListHeader))
2658
-		{
2659
-			$returnArray['ProjectTask'] = $listArray['ProjectTask'];
2660
-		}
2661
-	}
2662
-	$acldenied = ACLController::disabledModuleList($listArray,false);
2663
-	foreach($acldenied as $denied){
2664
-		unset($returnArray[$denied]);
2665
-	}
2666
-	asort($returnArray);
2646
+    global $modListHeader;
2647
+    $returnArray = array();
2648
+
2649
+    foreach($listArray as $optionName => $optionVal)
2650
+    {
2651
+        if(array_key_exists($optionName, $modListHeader))
2652
+        {
2653
+            $returnArray[$optionName] = $optionVal;
2654
+        }
2655
+
2656
+        // special case for projects
2657
+        if(array_key_exists('Project', $modListHeader))
2658
+        {
2659
+            $returnArray['ProjectTask'] = $listArray['ProjectTask'];
2660
+        }
2661
+    }
2662
+    $acldenied = ACLController::disabledModuleList($listArray,false);
2663
+    foreach($acldenied as $denied){
2664
+        unset($returnArray[$denied]);
2665
+    }
2666
+    asort($returnArray);
2667 2667
 
2668
-	return $returnArray;
2668
+    return $returnArray;
2669 2669
 }
2670 2670
 
2671 2671
 function display_notice($msg = false){
2672
-	global $error_notice;
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>';
2678
-	}
2672
+    global $error_notice;
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>';
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 2683
 function skype_formatted($number){
2684
-	//kbrill - BUG #15375
2685
-	if(isset($_REQUEST['action']) && $_REQUEST['action']=="Popup") {
2686
-		return false;
2687
-	} else {
2688
-		return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 3) == '011';
2689
-	}
2684
+    //kbrill - BUG #15375
2685
+    if(isset($_REQUEST['action']) && $_REQUEST['action']=="Popup") {
2686
+        return false;
2687
+    } else {
2688
+        return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 3) == '011';
2689
+    }
2690 2690
 //	return substr($number, 0, 1) == '+' || substr($number, 0, 2) == '00' || substr($number, 0, 2) == '011';
2691 2691
 }
2692 2692
 
@@ -2695,72 +2695,72 @@  discard block
 block discarded – undo
2695 2695
 }
2696 2696
 
2697 2697
 function insert_charset_header() {
2698
-	header('Content-Type: text/html; charset=UTF-8');
2698
+    header('Content-Type: text/html; charset=UTF-8');
2699 2699
 }
2700 2700
 
2701 2701
 function getCurrentURL()
2702 2702
 {
2703
-	$href = "http:";
2704
-	if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
2705
-	{
2706
-		$href = 'https:';
2707
-	}
2703
+    $href = "http:";
2704
+    if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
2705
+    {
2706
+        $href = 'https:';
2707
+    }
2708 2708
 
2709
-	$href.= "//".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
2710
-	return $href;
2709
+    $href.= "//".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
2710
+    return $href;
2711 2711
 }
2712 2712
 
2713 2713
 function javascript_escape($str) {
2714
-	$new_str = '';
2715
-
2716
-	for($i = 0; $i < strlen($str); $i++) {
2717
-
2718
-		if(ord(substr($str, $i, 1))==10){
2719
-			$new_str .= '\n';
2720
-		}elseif(ord(substr($str, $i, 1))==13){
2721
-			$new_str .= '\r';
2722
-		}
2723
-		else {
2724
-			$new_str .= $str{$i};
2725
-		}
2726
-	}
2714
+    $new_str = '';
2715
+
2716
+    for($i = 0; $i < strlen($str); $i++) {
2717
+
2718
+        if(ord(substr($str, $i, 1))==10){
2719
+            $new_str .= '\n';
2720
+        }elseif(ord(substr($str, $i, 1))==13){
2721
+            $new_str .= '\r';
2722
+        }
2723
+        else {
2724
+            $new_str .= $str{$i};
2725
+        }
2726
+    }
2727 2727
 
2728
-	$new_str = str_replace("'", "\\'", $new_str);
2728
+    $new_str = str_replace("'", "\\'", $new_str);
2729 2729
 
2730
-	return $new_str;
2730
+    return $new_str;
2731 2731
 }
2732 2732
 
2733 2733
 function js_escape($str, $keep=true){
2734
-	$str = html_entity_decode(str_replace("\\", "", $str), ENT_QUOTES);
2734
+    $str = html_entity_decode(str_replace("\\", "", $str), ENT_QUOTES);
2735 2735
 
2736
-	if($keep){
2737
-		$str = javascript_escape($str);
2738
-	}
2739
-	else {
2740
-		$str = str_replace("'", " ", $str);
2741
-		$str = str_replace('"', " ", $str);
2742
-	}
2736
+    if($keep){
2737
+        $str = javascript_escape($str);
2738
+    }
2739
+    else {
2740
+        $str = str_replace("'", " ", $str);
2741
+        $str = str_replace('"', " ", $str);
2742
+    }
2743 2743
 
2744
-	return $str;
2744
+    return $str;
2745 2745
 
2746
-	//end function js_escape
2746
+    //end function js_escape
2747 2747
 }
2748 2748
 
2749 2749
 function br2nl($str) {
2750
-	$regex = "#<[^>]+br.+?>#i";
2751
-	preg_match_all($regex, $str, $matches);
2750
+    $regex = "#<[^>]+br.+?>#i";
2751
+    preg_match_all($regex, $str, $matches);
2752 2752
 
2753
-	foreach($matches[0] as $match) {
2754
-		$str = str_replace($match, "<br>", $str);
2755
-	}
2753
+    foreach($matches[0] as $match) {
2754
+        $str = str_replace($match, "<br>", $str);
2755
+    }
2756 2756
 
2757
-	$brs = array('<br>','<br/>', '<br />');
2758
-	$str = str_replace("\r\n", "\n", $str); // make from windows-returns, *nix-returns
2759
-	$str = str_replace("\n\r", "\n", $str); // make from windows-returns, *nix-returns
2760
-	$str = str_replace("\r", "\n", $str); // make from windows-returns, *nix-returns
2761
-	$str = str_ireplace($brs, "\n", $str); // to retrieve it
2757
+    $brs = array('<br>','<br/>', '<br />');
2758
+    $str = str_replace("\r\n", "\n", $str); // make from windows-returns, *nix-returns
2759
+    $str = str_replace("\n\r", "\n", $str); // make from windows-returns, *nix-returns
2760
+    $str = str_replace("\r", "\n", $str); // make from windows-returns, *nix-returns
2761
+    $str = str_ireplace($brs, "\n", $str); // to retrieve it
2762 2762
 
2763
-	return $str;
2763
+    return $str;
2764 2764
 }
2765 2765
 
2766 2766
 /**
@@ -2782,29 +2782,29 @@  discard block
 block discarded – undo
2782 2782
  * @param $displayStackTrace also show stack trace
2783 2783
  */
2784 2784
 function _ppl($mixed, $die=false, $displayStackTrace=false, $loglevel="fatal") {
2785
-	if(!isset($GLOBALS['log']) || empty($GLOBALS['log'])) {
2785
+    if(!isset($GLOBALS['log']) || empty($GLOBALS['log'])) {
2786 2786
 
2787
-		$GLOBALS['log'] = LoggerManager :: getLogger('SugarCRM');
2788
-	}
2787
+        $GLOBALS['log'] = LoggerManager :: getLogger('SugarCRM');
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
-	$GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output start -----------------------------');
2795
-	$GLOBALS['log']->$loglevel($mix);
2796
-	if($displayStackTrace) {
2797
-		foreach($stack as $position) {
2798
-			$GLOBALS['log']->$loglevel($position['file']."({$position['line']})");
2799
-		}
2800
-	}
2794
+    $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output start -----------------------------');
2795
+    $GLOBALS['log']->$loglevel($mix);
2796
+    if($displayStackTrace) {
2797
+        foreach($stack as $position) {
2798
+            $GLOBALS['log']->$loglevel($position['file']."({$position['line']})");
2799
+        }
2800
+    }
2801 2801
 
2802
-	$GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output end -----------------------------');
2803
-	$GLOBALS['log']->$loglevel('------------------------------ _ppLogger() file: '.$stack[0]['file'].' line#: '.$stack[0]['line'].'-----------------------------');
2802
+    $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() output end -----------------------------');
2803
+    $GLOBALS['log']->$loglevel('------------------------------ _ppLogger() file: '.$stack[0]['file'].' line#: '.$stack[0]['line'].'-----------------------------');
2804 2804
 
2805
-	if($die) {
2806
-		die();
2807
-	}
2805
+    if($die) {
2806
+        die();
2807
+    }
2808 2808
 }
2809 2809
 
2810 2810
 /**
@@ -2869,47 +2869,47 @@  discard block
 block discarded – undo
2869 2869
  * @return 1 implies supported, 0 implies unsupported, -1 implies invalid
2870 2870
  */
2871 2871
 function check_php_version($sys_php_version = '') {
2872
-	$sys_php_version = empty($sys_php_version) ? constant('PHP_VERSION') : $sys_php_version;
2873
-	// versions below $min_considered_php_version considered invalid by default,
2874
-	// versions equal to or above this ver will be considered depending
2875
-	// on the rules that follow
2876
-	$min_considered_php_version = '5.3.0';
2877
-
2878
-	// only the supported versions,
2879
-	// should be mutually exclusive with $invalid_php_versions
2880
-	$supported_php_versions = array (
2881
-    	'5.3.0'
2882
-	);
2883
-
2884
-	// invalid versions above the $min_considered_php_version,
2885
-	// should be mutually exclusive with $supported_php_versions
2886
-
2887
-	// SugarCRM prohibits install on PHP 5.2.7 on all platforms
2888
-	$invalid_php_versions = array('5.2.7');
2889
-
2890
-	// default unsupported
2891
-	$retval = 0;
2892
-
2893
-	// versions below $min_considered_php_version are invalid
2894
-	if(1 == version_compare($sys_php_version, $min_considered_php_version, '<')) {
2895
-		$retval = -1;
2896
-	}
2872
+    $sys_php_version = empty($sys_php_version) ? constant('PHP_VERSION') : $sys_php_version;
2873
+    // versions below $min_considered_php_version considered invalid by default,
2874
+    // versions equal to or above this ver will be considered depending
2875
+    // on the rules that follow
2876
+    $min_considered_php_version = '5.3.0';
2897 2877
 
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) {
2901
-			$retval = 1;
2902
-			break;
2903
-		}
2904
-	}
2878
+    // only the supported versions,
2879
+    // should be mutually exclusive with $invalid_php_versions
2880
+    $supported_php_versions = array (
2881
+        '5.3.0'
2882
+    );
2905 2883
 
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) {
2909
-			$retval = -1;
2910
-			break;
2911
-		}
2912
-	}
2884
+    // invalid versions above the $min_considered_php_version,
2885
+    // should be mutually exclusive with $supported_php_versions
2886
+
2887
+    // SugarCRM prohibits install on PHP 5.2.7 on all platforms
2888
+    $invalid_php_versions = array('5.2.7');
2889
+
2890
+    // default unsupported
2891
+    $retval = 0;
2892
+
2893
+    // versions below $min_considered_php_version are invalid
2894
+    if(1 == version_compare($sys_php_version, $min_considered_php_version, '<')) {
2895
+        $retval = -1;
2896
+    }
2897
+
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) {
2901
+            $retval = 1;
2902
+            break;
2903
+        }
2904
+    }
2905
+
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) {
2909
+            $retval = -1;
2910
+            break;
2911
+        }
2912
+    }
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
@@ -2917,7 +2917,7 @@  discard block
 block discarded – undo
2917 2917
         $retval = 1;
2918 2918
     }
2919 2919
 
2920
-	return $retval;
2920
+    return $retval;
2921 2921
 }
2922 2922
 
2923 2923
 /**
@@ -2929,10 +2929,10 @@  discard block
 block discarded – undo
2929 2929
  */
2930 2930
 function check_iis_version($sys_iis_version = '') {
2931 2931
 
2932
-	$server_software = $_SERVER["SERVER_SOFTWARE"];
2933
-	$iis_version = '';
2934
-	if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/",  $server_software, $out))
2935
-	    $iis_version = $out[1][0];
2932
+    $server_software = $_SERVER["SERVER_SOFTWARE"];
2933
+    $iis_version = '';
2934
+    if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/",  $server_software, $out))
2935
+        $iis_version = $out[1][0];
2936 2936
 
2937 2937
     $sys_iis_version = empty($sys_iis_version) ? $iis_version : $sys_iis_version;
2938 2938
 
@@ -2983,14 +2983,14 @@  discard block
 block discarded – undo
2983 2983
 }
2984 2984
 
2985 2985
 function pre_login_check(){
2986
-	global $action, $login_error;
2987
-	if(!empty($action)&& $action == 'Login'){
2988
-
2989
-		if(!empty($login_error)){
2990
-			$login_error = htmlentities($login_error);
2991
-			$login_error = str_replace(array("&lt;pre&gt;","&lt;/pre&gt;","\r\n", "\n"), "<br>", $login_error);
2992
-			$_SESSION['login_error'] = $login_error;
2993
-			echo '<script>
2986
+    global $action, $login_error;
2987
+    if(!empty($action)&& $action == 'Login'){
2988
+
2989
+        if(!empty($login_error)){
2990
+            $login_error = htmlentities($login_error);
2991
+            $login_error = str_replace(array("&lt;pre&gt;","&lt;/pre&gt;","\r\n", "\n"), "<br>", $login_error);
2992
+            $_SESSION['login_error'] = $login_error;
2993
+            echo '<script>
2994 2994
 						function set_focus() {}
2995 2995
 						if(document.getElementById("post_error")) {
2996 2996
 							document.getElementById("post_error").innerHTML="'. $login_error. '";
@@ -3000,66 +3000,66 @@  discard block
 block discarded – undo
3000 3000
 							//document.getElementById("user_password").disabled = true;
3001 3001
 						}
3002 3002
 						</script>';
3003
-		}
3004
-	}
3003
+        }
3004
+    }
3005 3005
 }
3006 3006
 
3007 3007
 
3008 3008
 
3009 3009
 function sugar_cleanup($exit = false) {
3010
-	static $called = false;
3011
-	if($called)return;
3012
-	$called = true;
3013
-	set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path());
3014
-	chdir(realpath(dirname(__FILE__) . '/..'));
3015
-	global $sugar_config;
3016
-	require_once('include/utils/LogicHook.php');
3017
-	LogicHook::initialize();
3018
-	$GLOBALS['logic_hook']->call_custom_logic('', 'server_round_trip');
3019
-
3020
-	//added this check to avoid errors during install.
3021
-	if (empty($sugar_config['dbconfig'])) {
3022
-		if ($exit) exit; else return;
3023
-	}
3010
+    static $called = false;
3011
+    if($called)return;
3012
+    $called = true;
3013
+    set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path());
3014
+    chdir(realpath(dirname(__FILE__) . '/..'));
3015
+    global $sugar_config;
3016
+    require_once('include/utils/LogicHook.php');
3017
+    LogicHook::initialize();
3018
+    $GLOBALS['logic_hook']->call_custom_logic('', 'server_round_trip');
3019
+
3020
+    //added this check to avoid errors during install.
3021
+    if (empty($sugar_config['dbconfig'])) {
3022
+        if ($exit) exit; else return;
3023
+    }
3024 3024
 
3025 3025
     if (!class_exists('Tracker', true)) {
3026
-		require_once 'modules/Trackers/Tracker.php';
3027
-	}
3028
-	Tracker::logPage();
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 )
3032
-	        $GLOBALS['current_user']->savePreferencesToDB();
3033
-	}
3026
+        require_once 'modules/Trackers/Tracker.php';
3027
+    }
3028
+    Tracker::logPage();
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 )
3032
+            $GLOBALS['current_user']->savePreferencesToDB();
3033
+    }
3034 3034
 
3035
-	//check to see if this is not an `ajax call AND the user preference error flag is set
3036
-	if(
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'] )
3042
-
3043
-	){
3044
-		global $app_strings;
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
-		$err_mess = $app_strings['ERROR_USER_PREFS'];
3047
-		$_SESSION['USER_PREFRENCE_ERRORS'] = false;
3048
-		echo "
3035
+    //check to see if this is not an `ajax call AND the user preference error flag is set
3036
+    if(
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'] )
3042
+
3043
+    ){
3044
+        global $app_strings;
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
+        $err_mess = $app_strings['ERROR_USER_PREFS'];
3047
+        $_SESSION['USER_PREFRENCE_ERRORS'] = false;
3048
+        echo "
3049 3049
 		<script>
3050 3050
 			ajaxStatus.flashStatus('$err_mess',7000);
3051 3051
 		</script>";
3052 3052
 
3053
-	}
3053
+    }
3054 3054
 
3055
-	pre_login_check();
3056
-	if(class_exists('DBManagerFactory')) {
3057
-		$db = DBManagerFactory::getInstance();
3058
-		$db->disconnect();
3059
-		if($exit) {
3060
-			exit;
3061
-		}
3062
-	}
3055
+    pre_login_check();
3056
+    if(class_exists('DBManagerFactory')) {
3057
+        $db = DBManagerFactory::getInstance();
3058
+        $db->disconnect();
3059
+        if($exit) {
3060
+            exit;
3061
+        }
3062
+    }
3063 3063
 }
3064 3064
 
3065 3065
 register_shutdown_function('sugar_cleanup');
@@ -3071,64 +3071,64 @@  discard block
 block discarded – undo
3071 3071
 
3072 3072
  */
3073 3073
 function check_logic_hook_file($module_name, $event, $action_array){
3074
-	require_once('include/utils/logic_utils.php');
3075
-	$add_logic = false;
3074
+    require_once('include/utils/logic_utils.php');
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
-		$hook_array = get_hook_array($module_name);
3079
+        $hook_array = get_hook_array($module_name);
3080 3080
 
3081
-		if(check_existing_element($hook_array, $event, $action_array)==true){
3082
-			//the hook at hand is present, so do nothing
3083
-		} else {
3084
-			$add_logic = true;
3081
+        if(check_existing_element($hook_array, $event, $action_array)==true){
3082
+            //the hook at hand is present, so do nothing
3083
+        } else {
3084
+            $add_logic = true;
3085 3085
 
3086 3086
             $logic_count = 0;
3087 3087
             if(!empty($hook_array[$event]))
3088 3088
             {
3089
-			    $logic_count = count($hook_array[$event]);
3089
+                $logic_count = count($hook_array[$event]);
3090 3090
             }
3091 3091
 
3092
-			if($action_array[0]==""){
3093
-				$action_array[0] = $logic_count  + 1;
3094
-			}
3095
-			$hook_array[$event][] = $action_array;
3096
-
3097
-		}
3098
-		//end if the file exists already
3099
-	} else {
3100
-		$add_logic = true;
3101
-		if($action_array[0]==""){
3102
-			$action_array[0] = 1;
3103
-		}
3104
-		$hook_array = array();
3105
-		$hook_array[$event][] = $action_array;
3106
-		//end if else file exists already
3107
-	}
3108
-	if($add_logic == true){
3092
+            if($action_array[0]==""){
3093
+                $action_array[0] = $logic_count  + 1;
3094
+            }
3095
+            $hook_array[$event][] = $action_array;
3096
+
3097
+        }
3098
+        //end if the file exists already
3099
+    } else {
3100
+        $add_logic = true;
3101
+        if($action_array[0]==""){
3102
+            $action_array[0] = 1;
3103
+        }
3104
+        $hook_array = array();
3105
+        $hook_array[$event][] = $action_array;
3106
+        //end if else file exists already
3107
+    }
3108
+    if($add_logic == true){
3109 3109
 
3110
-		//reorder array by element[0]
3111
-		//$hook_array = reorder_array($hook_array, $event);
3112
-		//!!!Finish this above TODO
3110
+        //reorder array by element[0]
3111
+        //$hook_array = reorder_array($hook_array, $event);
3112
+        //!!!Finish this above TODO
3113 3113
 
3114
-		$new_contents = replace_or_add_logic_type($hook_array);
3115
-		write_logic_file($module_name, $new_contents);
3114
+        $new_contents = replace_or_add_logic_type($hook_array);
3115
+        write_logic_file($module_name, $new_contents);
3116 3116
 
3117
-		//end if add_element is true
3118
-	}
3117
+        //end if add_element is true
3118
+    }
3119 3119
 
3120
-	//end function check_logic_hook_file
3120
+    //end function check_logic_hook_file
3121 3121
 }
3122 3122
 
3123 3123
 function remove_logic_hook($module_name, $event, $action_array) {
3124 3124
     require_once('include/utils/logic_utils.php');
3125
-	$add_logic = false;
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
-		$hook_array = get_hook_array($module_name);
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 3134
             foreach ( $hook_array[$event] as $i => $hook ) {
@@ -3150,111 +3150,111 @@  discard block
 block discarded – undo
3150 3150
 
3151 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)
3158
-	echo '<br>';
3157
+    if(!$textOnly)
3158
+    echo '<br>';
3159 3159
 
3160
-	$first = true;
3161
-	$out = '';
3160
+    $first = true;
3161
+    $out = '';
3162 3162
 
3163
-	foreach($stack as $item) {
3164
-		$file  = '';
3165
-		$class = '';
3166
-		$line  = '';
3167
-		$function  = '';
3163
+    foreach($stack as $item) {
3164
+        $file  = '';
3165
+        $class = '';
3166
+        $line  = '';
3167
+        $function  = '';
3168 3168
 
3169
-		if(isset($item['file']))
3170
-		$file = $item['file'];
3171
-		if(isset($item['class']))
3172
-		$class = $item['class'];
3173
-		if(isset($item['line']))
3174
-		$line = $item['line'];
3175
-		if(isset($item['function']))
3176
-		$function = $item['function'];
3169
+        if(isset($item['file']))
3170
+        $file = $item['file'];
3171
+        if(isset($item['class']))
3172
+        $class = $item['class'];
3173
+        if(isset($item['line']))
3174
+        $line = $item['line'];
3175
+        if(isset($item['function']))
3176
+        $function = $item['function'];
3177 3177
 
3178
-		if(!$first) {
3179
-			if(!$textOnly) {
3180
-				$out .= '<font color="black"><b>';
3181
-			}
3178
+        if(!$first) {
3179
+            if(!$textOnly) {
3180
+                $out .= '<font color="black"><b>';
3181
+            }
3182 3182
 
3183
-			$out .= $file;
3183
+            $out .= $file;
3184 3184
 
3185
-			if(!$textOnly) {
3186
-				$out .= '</b></font><font color="blue">';
3187
-			}
3185
+            if(!$textOnly) {
3186
+                $out .= '</b></font><font color="blue">';
3187
+            }
3188 3188
 
3189
-			$out .= "[L:{$line}]";
3189
+            $out .= "[L:{$line}]";
3190 3190
 
3191
-			if(!$textOnly) {
3192
-				$out .= '</font><font color="red">';
3193
-			}
3191
+            if(!$textOnly) {
3192
+                $out .= '</font><font color="red">';
3193
+            }
3194 3194
 
3195
-			$out .= "({$class}:{$function})";
3195
+            $out .= "({$class}:{$function})";
3196 3196
 
3197
-			if(!$textOnly) {
3198
-				$out .= '</font><br>';
3199
-			} else {
3200
-				$out .= "\n";
3201
-			}
3202
-		} else {
3203
-			$first = false;
3204
-		}
3205
-	}
3197
+            if(!$textOnly) {
3198
+                $out .= '</font><br>';
3199
+            } else {
3200
+                $out .= "\n";
3201
+            }
3202
+        } else {
3203
+            $first = false;
3204
+        }
3205
+    }
3206 3206
 
3207
-	echo $out;
3207
+    echo $out;
3208 3208
 }
3209 3209
 
3210 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
-	$halt_script = true;
3213
-	switch($errno){
3214
-		case 2048: return; //depricated we have lots of these ignore them
3215
-		case E_USER_NOTICE:
3216
-		case E_NOTICE:
3217
-		    if ( error_reporting() & E_NOTICE ) {
3218
-		        $halt_script = false;
3219
-		        $type = 'Notice';
3220
-		    }
3221
-		    else
3222
-		        return;
3223
-			break;
3224
-		case E_USER_WARNING:
3225
-		case E_COMPILE_WARNING:
3226
-		case E_CORE_WARNING:
3227
-		case E_WARNING:
3228
-
3229
-			$halt_script = false;
3230
-			$type = "Warning";
3231
-			break;
3232
-
3233
-		case E_USER_ERROR:
3234
-		case E_COMPILE_ERROR:
3235
-		case E_CORE_ERROR:
3236
-		case E_ERROR:
3237
-
3238
-			$type = "Fatal Error";
3239
-			break;
3240
-
3241
-		case E_PARSE:
3242
-
3243
-			$type = "Parse Error";
3244
-			break;
3245
-
3246
-		default:
3247
-			//don't know what it is might not be so bad
3248
-			$halt_script = false;
3249
-			$type = "Unknown Error ($errno)";
3250
-			break;
3251
-	}
3252
-	$error_msg = '<b>'.$type.'</b>:' . $error_msg;
3253
-	echo $error_msg;
3254
-	display_stack_trace();
3255
-	if($halt_script){
3256
-		exit -1;
3257
-	}
3211
+    $error_msg = " $errstr occurred in <b>$errfile</b> on line $errline [" . date("Y-m-d H:i:s") . ']';
3212
+    $halt_script = true;
3213
+    switch($errno){
3214
+        case 2048: return; //depricated we have lots of these ignore them
3215
+        case E_USER_NOTICE:
3216
+        case E_NOTICE:
3217
+            if ( error_reporting() & E_NOTICE ) {
3218
+                $halt_script = false;
3219
+                $type = 'Notice';
3220
+            }
3221
+            else
3222
+                return;
3223
+            break;
3224
+        case E_USER_WARNING:
3225
+        case E_COMPILE_WARNING:
3226
+        case E_CORE_WARNING:
3227
+        case E_WARNING:
3228
+
3229
+            $halt_script = false;
3230
+            $type = "Warning";
3231
+            break;
3232
+
3233
+        case E_USER_ERROR:
3234
+        case E_COMPILE_ERROR:
3235
+        case E_CORE_ERROR:
3236
+        case E_ERROR:
3237
+
3238
+            $type = "Fatal Error";
3239
+            break;
3240
+
3241
+        case E_PARSE:
3242
+
3243
+            $type = "Parse Error";
3244
+            break;
3245
+
3246
+        default:
3247
+            //don't know what it is might not be so bad
3248
+            $halt_script = false;
3249
+            $type = "Unknown Error ($errno)";
3250
+            break;
3251
+    }
3252
+    $error_msg = '<b>'.$type.'</b>:' . $error_msg;
3253
+    echo $error_msg;
3254
+    display_stack_trace();
3255
+    if($halt_script){
3256
+        exit -1;
3257
+    }
3258 3258
 
3259 3259
 
3260 3260
 
@@ -3263,45 +3263,45 @@  discard block
 block discarded – undo
3263 3263
 
3264 3264
 if(isset($sugar_config['stack_trace_errors']) && $sugar_config['stack_trace_errors']){
3265 3265
 
3266
-	set_error_handler('StackTraceErrorHandler');
3266
+    set_error_handler('StackTraceErrorHandler');
3267 3267
 }
3268 3268
 function get_sub_cookies($name){
3269
-	$cookies = array();
3270
-	if(isset($_COOKIE[$name])){
3271
-		$subs = explode('#', $_COOKIE[$name]);
3272
-		foreach($subs as $cookie){
3273
-			if(!empty($cookie)){
3274
-				$cookie = explode('=', $cookie);
3275
-
3276
-				$cookies[$cookie[0]] = $cookie[1];
3277
-			}
3278
-		}
3279
-	}
3280
-	return $cookies;
3269
+    $cookies = array();
3270
+    if(isset($_COOKIE[$name])){
3271
+        $subs = explode('#', $_COOKIE[$name]);
3272
+        foreach($subs as $cookie){
3273
+            if(!empty($cookie)){
3274
+                $cookie = explode('=', $cookie);
3275
+
3276
+                $cookies[$cookie[0]] = $cookie[1];
3277
+            }
3278
+        }
3279
+    }
3280
+    return $cookies;
3281 3281
 
3282 3282
 }
3283 3283
 
3284 3284
 
3285 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
-			//run_second level is set to true if you need to remove sub-sub components
3292
-			if($run_second_level==true){
3291
+            //run_second level is set to true if you need to remove sub-sub components
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
-				//end if run_second_level is true
3297
-			}
3298
-			$sub_object->mark_deleted($sub_object->id);
3299
-			//end foreach sub component
3300
-		}
3301
-		//end if this is not empty
3302
-	}
3296
+                //end if run_second_level is true
3297
+            }
3298
+            $sub_object->mark_deleted($sub_object->id);
3299
+            //end foreach sub component
3300
+        }
3301
+        //end if this is not empty
3302
+    }
3303 3303
 
3304
-	//end function mark_delete_components
3304
+    //end function mark_delete_components
3305 3305
 }
3306 3306
 
3307 3307
 /**
@@ -3309,30 +3309,30 @@  discard block
 block discarded – undo
3309 3309
  */
3310 3310
 function return_bytes($val)
3311 3311
 {
3312
-	$val = trim($val);
3313
-	$last = strtolower($val{strlen($val)-1});
3314
-
3315
-	switch($last)
3316
-	{
3317
-		// The 'G' modifier is available since PHP 5.1.0
3318
-		case 'g':
3319
-			$val *= 1024;
3320
-		case 'm':
3321
-			$val *= 1024;
3322
-		case 'k':
3323
-			$val *= 1024;
3324
-	}
3312
+    $val = trim($val);
3313
+    $last = strtolower($val{strlen($val)-1});
3325 3314
 
3326
-	return $val;
3315
+    switch($last)
3316
+    {
3317
+        // The 'G' modifier is available since PHP 5.1.0
3318
+        case 'g':
3319
+            $val *= 1024;
3320
+        case 'm':
3321
+            $val *= 1024;
3322
+        case 'k':
3323
+            $val *= 1024;
3324
+    }
3325
+
3326
+    return $val;
3327 3327
 }
3328 3328
 
3329 3329
 /**
3330 3330
  * Adds the href HTML tags around any URL in the $string
3331 3331
  */
3332 3332
 function url2html($string) {
3333
-	//
3334
-	$return_string = preg_replace('/(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_new"  style="font-weight: normal;">\\1\\2</a>', $string);
3335
-	return $return_string;
3333
+    //
3334
+    $return_string = preg_replace('/(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_new"  style="font-weight: normal;">\\1\\2</a>', $string);
3335
+    return $return_string;
3336 3336
 }
3337 3337
 // End customization by Julian
3338 3338
 
@@ -3353,31 +3353,31 @@  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}=='/') {
3357
-		return is_writable_windows($file.uniqid(mt_rand()).'.tmp');
3358
-	}
3356
+    if($file{strlen($file)-1}=='/') {
3357
+        return is_writable_windows($file.uniqid(mt_rand()).'.tmp');
3358
+    }
3359 3359
 
3360
-	// the assumption here is that Windows has an inherited permissions scheme
3361
-	// any file that is a descendant of an unwritable directory will inherit
3362
-	// that property and will trigger a failure below.
3363
-	if(is_dir($file)) {
3364
-		return true;
3365
-	}
3360
+    // the assumption here is that Windows has an inherited permissions scheme
3361
+    // any file that is a descendant of an unwritable directory will inherit
3362
+    // that property and will trigger a failure below.
3363
+    if(is_dir($file)) {
3364
+        return true;
3365
+    }
3366 3366
 
3367
-	$file = str_replace("/", '\\', $file);
3367
+    $file = str_replace("/", '\\', $file);
3368 3368
 
3369
-	if(file_exists($file)) {
3370
-		if (!($f = @sugar_fopen($file, 'r+')))
3371
-		return false;
3372
-		fclose($f);
3373
-		return true;
3374
-	}
3369
+    if(file_exists($file)) {
3370
+        if (!($f = @sugar_fopen($file, 'r+')))
3371
+        return false;
3372
+        fclose($f);
3373
+        return true;
3374
+    }
3375 3375
 
3376
-	if(!($f = @sugar_fopen($file, 'w')))
3377
-	return false;
3378
-	fclose($f);
3379
-	unlink($file);
3380
-	return true;
3376
+    if(!($f = @sugar_fopen($file, 'w')))
3377
+    return false;
3378
+    fclose($f);
3379
+    unlink($file);
3380
+    return true;
3381 3381
 }
3382 3382
 
3383 3383
 
@@ -3390,23 +3390,23 @@  discard block
 block discarded – undo
3390 3390
 }
3391 3391
 
3392 3392
 function convert_module_to_singular($module_array){
3393
-	global $beanList;
3394
-
3395
-	foreach($module_array as $key => $value){
3396
-		if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value];
3397
-
3398
-		if($value=="Cases") {
3399
-			$module_array[$key] = "Case";
3400
-		}
3401
-		if($key=="projecttask"){
3402
-			$module_array['ProjectTask'] = "Project Task";
3403
-			unset($module_array[$key]);
3404
-		}
3405
-	}
3393
+    global $beanList;
3406 3394
 
3407
-	return $module_array;
3395
+    foreach($module_array as $key => $value){
3396
+        if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value];
3397
+
3398
+        if($value=="Cases") {
3399
+            $module_array[$key] = "Case";
3400
+        }
3401
+        if($key=="projecttask"){
3402
+            $module_array['ProjectTask'] = "Project Task";
3403
+            unset($module_array[$key]);
3404
+        }
3405
+    }
3408 3406
 
3409
-	//end function convert_module_to_singular
3407
+    return $module_array;
3408
+
3409
+    //end function convert_module_to_singular
3410 3410
 }
3411 3411
 
3412 3412
 /*
@@ -3414,13 +3414,13 @@  discard block
 block discarded – undo
3414 3414
  * bean_name. This is important when you need to include files.
3415 3415
  */
3416 3416
 function get_singular_bean_name($bean_name){
3417
-	global $beanFiles, $beanList;
3418
-	if(array_key_exists($bean_name, $beanList)){
3419
-		return $beanList[$bean_name];
3420
-	}
3421
-	else{
3422
-		return $bean_name;
3423
-	}
3417
+    global $beanFiles, $beanList;
3418
+    if(array_key_exists($bean_name, $beanList)){
3419
+        return $beanList[$bean_name];
3420
+    }
3421
+    else{
3422
+        return $bean_name;
3423
+    }
3424 3424
 }
3425 3425
 
3426 3426
 /*
@@ -3458,105 +3458,105 @@  discard block
 block discarded – undo
3458 3458
 }
3459 3459
 
3460 3460
 function get_label($label_tag, $temp_module_strings){
3461
-	global $app_strings;
3462
-	if(!empty($temp_module_strings[$label_tag])){
3463
-
3464
-		$label_name = $temp_module_strings[$label_tag];
3465
-	} else {
3466
-		if(!empty($app_strings[$label_tag])){
3467
-			$label_name = $app_strings[$label_tag];
3468
-		} else {
3469
-			$label_name = $label_tag;
3470
-		}
3471
-	}
3472
-	return $label_name;
3461
+    global $app_strings;
3462
+    if(!empty($temp_module_strings[$label_tag])){
3463
+
3464
+        $label_name = $temp_module_strings[$label_tag];
3465
+    } else {
3466
+        if(!empty($app_strings[$label_tag])){
3467
+            $label_name = $app_strings[$label_tag];
3468
+        } else {
3469
+            $label_name = $label_tag;
3470
+        }
3471
+    }
3472
+    return $label_name;
3473 3473
 
3474
-	//end function get_label
3474
+    //end function get_label
3475 3475
 }
3476 3476
 
3477 3477
 
3478 3478
 function search_filter_rel_info(& $focus, $tar_rel_module, $relationship_name){
3479 3479
 
3480
-	$rel_list = array();
3480
+    $rel_list = array();
3481 3481
 
3482
-	foreach($focus->relationship_fields as $rel_key => $rel_value){
3483
-		if($rel_value == $relationship_name){
3484
-			$temp_bean = get_module_info($tar_rel_module);
3485
-	//		echo $focus->$rel_key;
3486
-			$temp_bean->retrieve($focus->$rel_key);
3487
-			if($temp_bean->id!=""){
3482
+    foreach($focus->relationship_fields as $rel_key => $rel_value){
3483
+        if($rel_value == $relationship_name){
3484
+            $temp_bean = get_module_info($tar_rel_module);
3485
+    //		echo $focus->$rel_key;
3486
+            $temp_bean->retrieve($focus->$rel_key);
3487
+            if($temp_bean->id!=""){
3488 3488
 
3489
-				$rel_list[] = $temp_bean;
3490
-				return $rel_list;
3491
-			}
3492
-		}
3493
-	}
3489
+                $rel_list[] = $temp_bean;
3490
+                return $rel_list;
3491
+            }
3492
+        }
3493
+    }
3494 3494
 
3495
-	foreach($focus->field_defs as $field_name => $field_def){
3496
-		//Check if the relationship_name matches a "relate" field
3497
-		if(!empty($field_def['type']) && $field_def['type'] == 'relate'
3498
-		&& !empty($field_def['id_name']) && !empty($focus->field_defs[$field_def['id_name']])
3499
-		&& !empty($focus->field_defs[$field_def['id_name']]['relationship'])
3500
-		&& $focus->field_defs[$field_def['id_name']]['relationship'] == $relationship_name)
3501
-		{
3502
-			$temp_bean = get_module_info($tar_rel_module);
3503
-		//	echo $focus->$field_def['id_name'];
3504
-			$temp_bean->retrieve($focus->$field_def['id_name']);
3505
-			if($temp_bean->id!=""){
3506
-
3507
-				$rel_list[] = $temp_bean;
3508
-				return $rel_list;
3509
-			}
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){
3512
-			$temp_bean = get_module_info($tar_rel_module);
3513
-		//	echo $focus->$rel_value['id_name'];
3514
-			$temp_bean->retrieve($focus->$rel_value['id_name']);
3515
-			if($temp_bean->id!=""){
3516
-
3517
-				$rel_list[] = $temp_bean;
3518
-				return $rel_list;
3519
-			}
3520
-		}
3521
-	}
3495
+    foreach($focus->field_defs as $field_name => $field_def){
3496
+        //Check if the relationship_name matches a "relate" field
3497
+        if(!empty($field_def['type']) && $field_def['type'] == 'relate'
3498
+        && !empty($field_def['id_name']) && !empty($focus->field_defs[$field_def['id_name']])
3499
+        && !empty($focus->field_defs[$field_def['id_name']]['relationship'])
3500
+        && $focus->field_defs[$field_def['id_name']]['relationship'] == $relationship_name)
3501
+        {
3502
+            $temp_bean = get_module_info($tar_rel_module);
3503
+        //	echo $focus->$field_def['id_name'];
3504
+            $temp_bean->retrieve($focus->$field_def['id_name']);
3505
+            if($temp_bean->id!=""){
3522 3506
 
3523
-	// special case for unlisted parent-type relationships
3524
-	if( !empty($focus->parent_type) && $focus->parent_type == $tar_rel_module && !empty($focus->parent_id)) {
3525
-		$temp_bean = get_module_info($tar_rel_module);
3526
-		$temp_bean->retrieve($focus->parent_id);
3527
-		if($temp_bean->id!=""){
3528
-			$rel_list[] = $temp_bean;
3529
-			return $rel_list;
3530
-		}
3531
-	}
3507
+                $rel_list[] = $temp_bean;
3508
+                return $rel_list;
3509
+            }
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){
3512
+            $temp_bean = get_module_info($tar_rel_module);
3513
+        //	echo $focus->$rel_value['id_name'];
3514
+            $temp_bean->retrieve($focus->$rel_value['id_name']);
3515
+            if($temp_bean->id!=""){
3516
+
3517
+                $rel_list[] = $temp_bean;
3518
+                return $rel_list;
3519
+            }
3520
+        }
3521
+    }
3522
+
3523
+    // special case for unlisted parent-type relationships
3524
+    if( !empty($focus->parent_type) && $focus->parent_type == $tar_rel_module && !empty($focus->parent_id)) {
3525
+        $temp_bean = get_module_info($tar_rel_module);
3526
+        $temp_bean->retrieve($focus->parent_id);
3527
+        if($temp_bean->id!=""){
3528
+            $rel_list[] = $temp_bean;
3529
+            return $rel_list;
3530
+        }
3531
+    }
3532 3532
 
3533
-	return $rel_list;
3533
+    return $rel_list;
3534 3534
 
3535
-	//end function search_filter_rel_info
3535
+    //end function search_filter_rel_info
3536 3536
 }
3537 3537
 
3538 3538
 function get_module_info($module_name){
3539
-	global $beanList;
3540
-	global $dictionary;
3539
+    global $beanList;
3540
+    global $dictionary;
3541 3541
 
3542
-	//Get dictionary and focus data for module
3543
-	$vardef_name = $beanList[$module_name];
3542
+    //Get dictionary and focus data for module
3543
+    $vardef_name = $beanList[$module_name];
3544 3544
 
3545
-	if($vardef_name=="aCase"){
3546
-		$class_name = "Case";
3547
-	} else {
3548
-		$class_name = $vardef_name;
3549
-	}
3545
+    if($vardef_name=="aCase"){
3546
+        $class_name = "Case";
3547
+    } else {
3548
+        $class_name = $vardef_name;
3549
+    }
3550 3550
 
3551
-	if(!file_exists('modules/'. $module_name . '/'.$class_name.'.php')){
3552
-		return;
3553
-	}
3551
+    if(!file_exists('modules/'. $module_name . '/'.$class_name.'.php')){
3552
+        return;
3553
+    }
3554 3554
 
3555
-	include_once('modules/'. $module_name . '/'.$class_name.'.php');
3555
+    include_once('modules/'. $module_name . '/'.$class_name.'.php');
3556 3556
 
3557
-	$module_bean = new $vardef_name();
3558
-	return $module_bean;
3559
-	//end function get_module_table
3557
+    $module_bean = new $vardef_name();
3558
+    return $module_bean;
3559
+    //end function get_module_table
3560 3560
 }
3561 3561
 
3562 3562
 /**
@@ -3565,22 +3565,22 @@  discard block
 block discarded – undo
3565 3565
  * @param string $moduleName
3566 3566
  */
3567 3567
 function get_valid_bean_name($module_name){
3568
-	global $beanList;
3568
+    global $beanList;
3569 3569
 
3570
-	$vardef_name = $beanList[$module_name];
3571
-	if($vardef_name=="aCase"){
3572
-		$bean_name = "Case";
3573
-	} else {
3574
-		$bean_name = $vardef_name;
3575
-	}
3576
-	return $bean_name;
3570
+    $vardef_name = $beanList[$module_name];
3571
+    if($vardef_name=="aCase"){
3572
+        $bean_name = "Case";
3573
+    } else {
3574
+        $bean_name = $vardef_name;
3575
+    }
3576
+    return $bean_name;
3577 3577
 }
3578 3578
 
3579 3579
 
3580 3580
 
3581 3581
 function  checkAuthUserStatus(){
3582 3582
 
3583
-	//authUserStatus();
3583
+    //authUserStatus();
3584 3584
 }
3585 3585
 
3586 3586
 
@@ -3593,7 +3593,7 @@  discard block
 block discarded – undo
3593 3593
  * @author	customized for Sugar by Chris N.
3594 3594
  */
3595 3595
 function getPhpInfo($level=-1) {
3596
-	/**	Name (constant)		Value	Description
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().
3599 3599
 		INFO_CONFIGURATION	4		Current Local and Master values for PHP directives. See also ini_get().
@@ -3602,47 +3602,47 @@  discard block
 block discarded – undo
3602 3602
 		INFO_VARIABLES		32		Shows all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server).
3603 3603
 		INFO_LICENSE		64		PHP License information. See also the license FAQ.
3604 3604
 		INFO_ALL			-1		Shows all of the above. This is the default value.
3605
-	 */
3606
-	ob_start();
3607
-	phpinfo($level);
3608
-	$phpinfo = ob_get_contents();
3609
-	ob_end_clean();
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);
3614
-	$parsedInfo	= preg_split('/(<h.?>[^<]+<\/h.>)/', $phpinfo, -1, PREG_SPLIT_DELIM_CAPTURE);
3615
-	$match		= '';
3616
-	$version	= '';
3617
-	$returnInfo	= array();
3618
-
3619
-	if(preg_match('/<h1 class\=\"p\">PHP Version ([^<]+)<\/h1>/', $phpinfo, $version)) {
3620
-		$returnInfo['PHP Version'] = $version[1];
3621
-	}
3605
+     */
3606
+    ob_start();
3607
+    phpinfo($level);
3608
+    $phpinfo = ob_get_contents();
3609
+    ob_end_clean();
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);
3614
+    $parsedInfo	= preg_split('/(<h.?>[^<]+<\/h.>)/', $phpinfo, -1, PREG_SPLIT_DELIM_CAPTURE);
3615
+    $match		= '';
3616
+    $version	= '';
3617
+    $returnInfo	= array();
3618
+
3619
+    if(preg_match('/<h1 class\=\"p\">PHP Version ([^<]+)<\/h1>/', $phpinfo, $version)) {
3620
+        $returnInfo['PHP Version'] = $version[1];
3621
+    }
3622 3622
 
3623 3623
 
3624
-	for ($i=1; $i<count($parsedInfo); $i++) {
3625
-		if (preg_match('/<h.>([^<]+)<\/h.>/', $parsedInfo[$i], $match)) {
3626
-			$vName = trim($match[1]);
3627
-			$parsedInfo2 = explode("\n",$parsedInfo[$i+1]);
3624
+    for ($i=1; $i<count($parsedInfo); $i++) {
3625
+        if (preg_match('/<h.>([^<]+)<\/h.>/', $parsedInfo[$i], $match)) {
3626
+            $vName = trim($match[1]);
3627
+            $parsedInfo2 = explode("\n",$parsedInfo[$i+1]);
3628 3628
 
3629
-			foreach ($parsedInfo2 AS $vOne) {
3630
-				$vPat	= '<info>([^<]+)<\/info>';
3631
-				$vPat3	= "/$vPat\s*$vPat\s*$vPat/";
3632
-				$vPat2	= "/$vPat\s*$vPat/";
3629
+            foreach ($parsedInfo2 AS $vOne) {
3630
+                $vPat	= '<info>([^<]+)<\/info>';
3631
+                $vPat3	= "/$vPat\s*$vPat\s*$vPat/";
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
3637
-					$returnInfo[$vName][trim($match[1])] = trim($match[2]);
3638
-				}
3639
-			}
3640
-		} elseif(true) {
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
+                    $returnInfo[$vName][trim($match[1])] = trim($match[2]);
3638
+                }
3639
+            }
3640
+        } elseif(true) {
3641 3641
 
3642
-		}
3643
-	}
3642
+        }
3643
+    }
3644 3644
 
3645
-	return $returnInfo;
3645
+    return $returnInfo;
3646 3646
 }
3647 3647
 
3648 3648
 /**
@@ -3653,7 +3653,7 @@  discard block
 block discarded – undo
3653 3653
  * @return	$result a formatted string
3654 3654
  */
3655 3655
 function string_format($format, $args){
3656
-	$result = $format;
3656
+    $result = $format;
3657 3657
 
3658 3658
     /** Bug47277 fix.
3659 3659
      * If args array has only one argument, and it's empty, so empty single quotes are used '' . That's because
@@ -3670,10 +3670,10 @@  discard block
 block discarded – undo
3670 3670
     }
3671 3671
     /* End of fix */
3672 3672
 
3673
-	for($i = 0; $i < count($args); $i++){
3674
-		$result = str_replace('{'.$i.'}', $args[$i], $result);
3675
-	}
3676
-	return $result;
3673
+    for($i = 0; $i < count($args); $i++){
3674
+        $result = str_replace('{'.$i.'}', $args[$i], $result);
3675
+    }
3676
+    return $result;
3677 3677
 }
3678 3678
 
3679 3679
 /**
@@ -3687,16 +3687,16 @@  discard block
 block discarded – undo
3687 3687
  * @return	$result a formatted string
3688 3688
  */
3689 3689
 function format_number_display($num, $system_id){
3690
-	global $sugar_config;
3691
-	if(isset($num) && !empty($num)){
3692
-		$num=unformat_number($num);
3693
-		if(isset($system_id) && $system_id == 1){
3694
-			return sprintf("%d", $num);
3695
-		}
3696
-		else{
3697
-			return sprintf("%d-%d", $num, $system_id);
3698
-		}
3699
-	}
3690
+    global $sugar_config;
3691
+    if(isset($num) && !empty($num)){
3692
+        $num=unformat_number($num);
3693
+        if(isset($system_id) && $system_id == 1){
3694
+            return sprintf("%d", $num);
3695
+        }
3696
+        else{
3697
+            return sprintf("%d-%d", $num, $system_id);
3698
+        }
3699
+    }
3700 3700
 }
3701 3701
 function checkLoginUserStatus(){
3702 3702
 }
@@ -3709,28 +3709,28 @@  discard block
 block discarded – undo
3709 3709
  */
3710 3710
 function appendPortToHost($url, $port)
3711 3711
 {
3712
-	$resulturl = $url;
3713
-
3714
-	// if no port, don't change the url
3715
-	if($port != '')
3716
-	{
3717
-		$split = explode("/", $url);
3718
-		//check if it starts with http, in case they didn't include that in url
3719
-		if(str_begin($url, 'http'))
3720
-		{
3721
-			//third index ($split[2]) will be the host
3722
-			$split[2] .= ":".$port;
3723
-		}
3724
-		else // otherwise assumed to start with host name
3725
-		{
3726
-			//first index ($split[0]) will be the host
3727
-			$split[0] .= ":".$port;
3728
-		}
3729
-
3730
-		$resulturl = implode("/", $split);
3731
-	}
3712
+    $resulturl = $url;
3713
+
3714
+    // if no port, don't change the url
3715
+    if($port != '')
3716
+    {
3717
+        $split = explode("/", $url);
3718
+        //check if it starts with http, in case they didn't include that in url
3719
+        if(str_begin($url, 'http'))
3720
+        {
3721
+            //third index ($split[2]) will be the host
3722
+            $split[2] .= ":".$port;
3723
+        }
3724
+        else // otherwise assumed to start with host name
3725
+        {
3726
+            //first index ($split[0]) will be the host
3727
+            $split[0] .= ":".$port;
3728
+        }
3729
+
3730
+        $resulturl = implode("/", $split);
3731
+    }
3732 3732
 
3733
-	return $resulturl;
3733
+    return $resulturl;
3734 3734
 }
3735 3735
 
3736 3736
 /**
@@ -3738,12 +3738,12 @@  discard block
 block discarded – undo
3738 3738
  * @return	JSON object
3739 3739
  */
3740 3740
 function getJSONobj() {
3741
-	static $json = null;
3742
-	if(!isset($json)) {
3743
-		require_once('include/JSON.php');
3744
-		$json = new JSON(JSON_LOOSE_TYPE);
3745
-	}
3746
-	return $json;
3741
+    static $json = null;
3742
+    if(!isset($json)) {
3743
+        require_once('include/JSON.php');
3744
+        $json = new JSON(JSON_LOOSE_TYPE);
3745
+    }
3746
+    return $json;
3747 3747
 }
3748 3748
 
3749 3749
 require_once('include/utils/db_utils.php');
@@ -3752,28 +3752,28 @@  discard block
 block discarded – undo
3752 3752
  * Set default php.ini settings for entry points
3753 3753
  */
3754 3754
 function setPhpIniSettings() {
3755
-	// zlib module
3756
-	// Bug 37579 - Comment out force enabling zlib.output_compression, since it can cause problems on certain hosts
3757
-	/*
3755
+    // zlib module
3756
+    // Bug 37579 - Comment out force enabling zlib.output_compression, since it can cause problems on certain hosts
3757
+    /*
3758 3758
     if(function_exists('gzclose') && headers_sent() == false) {
3759 3759
 		ini_set('zlib.output_compression', 1);
3760 3760
 	}
3761 3761
 	*/
3762
-	// mbstring module
3763
-	//nsingh: breaks zip/unzip functionality. Commenting out 4/23/08
3762
+    // mbstring module
3763
+    //nsingh: breaks zip/unzip functionality. Commenting out 4/23/08
3764 3764
 
3765
-	/*if(function_exists('mb_strlen')) {
3765
+    /*if(function_exists('mb_strlen')) {
3766 3766
 		ini_set('mbstring.func_overload', 7);
3767 3767
 		ini_set('mbstring.internal_encoding', 'UTF-8');
3768 3768
 	}*/
3769 3769
 
3770 3770
 
3771
-	// http://us3.php.net/manual/en/ref.pcre.php#ini.pcre.backtrack-limit
3772
-	// starting with 5.2.0, backtrack_limit breaks JSON decoding
3773
-	$backtrack_limit = ini_get('pcre.backtrack_limit');
3774
-	if(!empty($backtrack_limit)) {
3775
-		ini_set('pcre.backtrack_limit', '-1');
3776
-	}
3771
+    // http://us3.php.net/manual/en/ref.pcre.php#ini.pcre.backtrack-limit
3772
+    // starting with 5.2.0, backtrack_limit breaks JSON decoding
3773
+    $backtrack_limit = ini_get('pcre.backtrack_limit');
3774
+    if(!empty($backtrack_limit)) {
3775
+        ini_set('pcre.backtrack_limit', '-1');
3776
+    }
3777 3777
 }
3778 3778
 
3779 3779
 /**
@@ -3788,80 +3788,80 @@  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
-					$tempArr = array();
3799
+                    $tempArr = array();
3800 3800
                     foreach ( $domVal as $domArrKey => $domArrVal )
3801 3801
                         $tempArr[$domArrKey] = $domArrVal;
3802 3802
                     foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal )
3803 3803
                         if ( !isset($tempArr[$gimpArrKey]) )
3804 3804
                             $tempArr[$gimpArrKey] = $gimpArrVal;
3805 3805
                     $gimp[$domKey] = $tempArr;
3806
-				}
3806
+                }
3807 3807
                 else
3808 3808
                 {
3809
-					$gimp[$domKey] = $domVal;
3810
-				}
3811
-			}
3809
+                    $gimp[$domKey] = $domVal;
3810
+                }
3811
+            }
3812 3812
             else
3813 3813
             {
3814
-				$gimp[$domKey] = $domVal;
3815
-			}
3816
-		}
3817
-	}
3814
+                $gimp[$domKey] = $domVal;
3815
+            }
3816
+        }
3817
+    }
3818 3818
     // if the passed value for gimp isn't an array, then return the $dom
3819 3819
     elseif(is_array($dom))
3820 3820
     {
3821 3821
         return $dom;
3822 3822
     }
3823 3823
 
3824
-	return $gimp;
3824
+    return $gimp;
3825 3825
 }
3826 3826
 /**
3827
- * like array_merge() but will handle array elements that are themselves arrays;
3828
- * PHP's version just overwrites the element with the new one.
3829
- *
3830
- * @internal Note that this function deviates from the internal array_merge()
3831
- *           functions in that it does does not treat numeric keys differently
3832
- *           than string keys.  Additionally, it deviates from
3833
- *           array_merge_recursive() by not creating an array when like values
3834
- *           found.
3835
- *
3836
- * @param array gimp the array whose values will be overloaded
3837
- * @param array dom the array whose values will pwn the gimp's
3838
- * @return array beaten gimp
3839
- */
3827
+     * like array_merge() but will handle array elements that are themselves arrays;
3828
+     * PHP's version just overwrites the element with the new one.
3829
+     *
3830
+     * @internal Note that this function deviates from the internal array_merge()
3831
+     *           functions in that it does does not treat numeric keys differently
3832
+     *           than string keys.  Additionally, it deviates from
3833
+     *           array_merge_recursive() by not creating an array when like values
3834
+     *           found.
3835
+     *
3836
+     * @param array gimp the array whose values will be overloaded
3837
+     * @param array dom the array whose values will pwn the gimp's
3838
+     * @return array beaten gimp
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)) {
3845
-					$tempArr = array();
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
+                    $tempArr = array();
3846 3846
                     foreach ( $domVal as $domArrKey => $domArrVal )
3847 3847
                         $tempArr[$domArrKey] = $domArrVal;
3848 3848
                     foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal )
3849 3849
                         if ( !array_key_exists($gimpArrKey, $tempArr) )
3850 3850
                             $tempArr[$gimpArrKey] = $gimpArrVal;
3851 3851
                     $gimp[$domKey] = $tempArr;
3852
-				} else {
3853
-					$gimp[$domKey] = $domVal;
3854
-				}
3855
-			} else {
3856
-				$gimp[$domKey] = $domVal;
3857
-			}
3858
-		}
3859
-	}
3852
+                } else {
3853
+                    $gimp[$domKey] = $domVal;
3854
+                }
3855
+            } else {
3856
+                $gimp[$domKey] = $domVal;
3857
+            }
3858
+        }
3859
+    }
3860 3860
     // if the passed value for gimp isn't an array, then return the $dom
3861 3861
     elseif(is_array($dom))
3862 3862
         return $dom;
3863 3863
 
3864
-	return $gimp;
3864
+    return $gimp;
3865 3865
 }
3866 3866
 
3867 3867
 /**
@@ -3872,24 +3872,24 @@  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])) {
3879
-					$gimp[$domKey] = sugarArrayMergeRecursive($gimp[$domKey], $domVal);
3880
-				} else {
3881
-					$gimp[$domKey] = $domVal;
3882
-				}
3883
-			} else {
3884
-				$gimp[$domKey] = $domVal;
3885
-			}
3886
-		}
3887
-	}
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
+                    $gimp[$domKey] = sugarArrayMergeRecursive($gimp[$domKey], $domVal);
3880
+                } else {
3881
+                    $gimp[$domKey] = $domVal;
3882
+                }
3883
+            } else {
3884
+                $gimp[$domKey] = $domVal;
3885
+            }
3886
+        }
3887
+    }
3888 3888
     // if the passed value for gimp isn't an array, then return the $dom
3889 3889
     elseif(is_array($dom))
3890 3890
         return $dom;
3891 3891
 
3892
-	return $gimp;
3892
+    return $gimp;
3893 3893
 }
3894 3894
 
3895 3895
 /**
@@ -3897,11 +3897,11 @@  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')) {
3901
-		$phpInfo = getPhpInfo(8);
3900
+    if(function_exists('json_encode')) {
3901
+        $phpInfo = getPhpInfo(8);
3902 3902
         return version_compare($phpInfo['json']['json version'], '1.1.1', '<');
3903
-	}
3904
-	return true; // not found
3903
+    }
3904
+    return true; // not found
3905 3905
 }
3906 3906
 
3907 3907
 
@@ -3916,114 +3916,114 @@  discard block
 block discarded – undo
3916 3916
  * @return string [number]-char formatted string if length of string exceeds the max allowed
3917 3917
  */
3918 3918
 function getTrackerSubstring($name) {
3919
-	static $max_tracker_item_length;
3919
+    static $max_tracker_item_length;
3920 3920
 
3921
-	//Trim the name
3922
-	$name = html_entity_decode($name, ENT_QUOTES, 'UTF-8');
3923
-	$strlen = function_exists('mb_strlen') ? mb_strlen($name) : strlen($name);
3921
+    //Trim the name
3922
+    $name = html_entity_decode($name, ENT_QUOTES, 'UTF-8');
3923
+    $strlen = function_exists('mb_strlen') ? mb_strlen($name) : strlen($name);
3924 3924
 
3925
-	global $sugar_config;
3925
+    global $sugar_config;
3926 3926
 
3927
-	if(!isset($max_tracker_item_length)) {
3928
-		if(isset($sugar_config['tracker_max_display_length'])) {
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
-		} else {
3931
-	      $max_tracker_item_length = 15;
3932
-		}
3933
-	}
3927
+    if(!isset($max_tracker_item_length)) {
3928
+        if(isset($sugar_config['tracker_max_display_length'])) {
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
+        } else {
3931
+            $max_tracker_item_length = 15;
3932
+        }
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);
3937
-		$chopped .= "...";
3938
-	} else {
3939
-		$chopped = $name;
3940
-	}
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
+        $chopped .= "...";
3938
+    } else {
3939
+        $chopped = $name;
3940
+    }
3941 3941
 
3942
-	return $chopped;
3942
+    return $chopped;
3943 3943
 }
3944 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
-	foreach ($field_list[$module] as $field=>$parms) {
3949
-		if(isset($values[$field]) && $values[$field] != "") {
3950
-			$operator='like';
3951
-			if (!empty($parms['operator'])) {
3952
-				$operator=$parms['operator'];
3953
-			}
3954
-			if (is_array($values[$field])) {
3955
-				$operator='in';
3956
-				$field_value='';
3957
-				foreach ($values[$field] as $key => $val) {
3958
-					if ($val != ' ' and $val != '') {
3959
-						if (!empty($field_value)) {
3960
-							$field_value.=',';
3961
-						}
3962
-						$field_value .= "'".$GLOBALS['db']->quote($val)."'";
3963
-					}
3964
-				}
3965
-			} else {
3966
-				$field_value=$GLOBALS['db']->quote($values[$field]);
3967
-			}
3968
-			//set db_fields array.
3969
-			if (!isset($parms['db_field']) )  {
3970
-				$parms['db_field'] = array($field);
3971
-			}
3972
-			if (isset($parms['my_items']) and $parms['my_items'] == true) {
3973
-				global $current_user;
3974
-				$field_value = $GLOBALS['db']->quote($current_user->id);
3975
-				$operator='=';
3976
-			}
3945
+    $where_clauses= array();
3946
+    $like_char='%';
3947
+    $table_name=$bean->object_name;
3948
+    foreach ($field_list[$module] as $field=>$parms) {
3949
+        if(isset($values[$field]) && $values[$field] != "") {
3950
+            $operator='like';
3951
+            if (!empty($parms['operator'])) {
3952
+                $operator=$parms['operator'];
3953
+            }
3954
+            if (is_array($values[$field])) {
3955
+                $operator='in';
3956
+                $field_value='';
3957
+                foreach ($values[$field] as $key => $val) {
3958
+                    if ($val != ' ' and $val != '') {
3959
+                        if (!empty($field_value)) {
3960
+                            $field_value.=',';
3961
+                        }
3962
+                        $field_value .= "'".$GLOBALS['db']->quote($val)."'";
3963
+                    }
3964
+                }
3965
+            } else {
3966
+                $field_value=$GLOBALS['db']->quote($values[$field]);
3967
+            }
3968
+            //set db_fields array.
3969
+            if (!isset($parms['db_field']) )  {
3970
+                $parms['db_field'] = array($field);
3971
+            }
3972
+            if (isset($parms['my_items']) and $parms['my_items'] == true) {
3973
+                global $current_user;
3974
+                $field_value = $GLOBALS['db']->quote($current_user->id);
3975
+                $operator='=';
3976
+            }
3977 3977
 
3978
-			$where='';
3979
-			$itr=0;
3980
-			if ($field_value != '') {
3981
-
3982
-				foreach ($parms['db_field'] as $db_field) {
3983
-					if (strstr($db_field,'.')===false) {
3984
-						$db_field=$bean->table_name.".".$db_field;
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);
3989
-					}
3990
-
3991
-					$itr++;
3992
-					if (!empty($where)) {
3993
-						$where .= " OR ";
3994
-					}
3995
-					switch (strtolower($operator)) {
3996
-						case 'like' :
3997
-							$where .=  $db_field . " like '".$field_value.$like_char."'";
3998
-							break;
3999
-						case 'in':
4000
-							$where .=  $db_field . " in (".$field_value.')';
4001
-							break;
4002
-						case '=':
4003
-							$where .=  $db_field . " = '".$field_value ."'";
4004
-							break;
4005
-					}
4006
-				}
4007
-			}
4008
-			if (!empty($where)) {
4009
-				if ($itr>1) {
4010
-					array_push($where_clauses, '( '.$where.' )');
4011
-				} else {
4012
-					array_push($where_clauses, $where);
4013
-				}
4014
-			}
4015
-		}
4016
-	}
4017
-	if ($add_custom_fields) {
4018
-		require_once('modules/DynamicFields/DynamicField.php');
4019
-		$bean->setupCustomFields($module);
4020
-		$bean->custom_fields->setWhereClauses($where_clauses);
4021
-	}
4022
-	return $where_clauses;
3978
+            $where='';
3979
+            $itr=0;
3980
+            if ($field_value != '') {
3981
+
3982
+                foreach ($parms['db_field'] as $db_field) {
3983
+                    if (strstr($db_field,'.')===false) {
3984
+                        $db_field=$bean->table_name.".".$db_field;
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);
3989
+                    }
3990
+
3991
+                    $itr++;
3992
+                    if (!empty($where)) {
3993
+                        $where .= " OR ";
3994
+                    }
3995
+                    switch (strtolower($operator)) {
3996
+                        case 'like' :
3997
+                            $where .=  $db_field . " like '".$field_value.$like_char."'";
3998
+                            break;
3999
+                        case 'in':
4000
+                            $where .=  $db_field . " in (".$field_value.')';
4001
+                            break;
4002
+                        case '=':
4003
+                            $where .=  $db_field . " = '".$field_value ."'";
4004
+                            break;
4005
+                    }
4006
+                }
4007
+            }
4008
+            if (!empty($where)) {
4009
+                if ($itr>1) {
4010
+                    array_push($where_clauses, '( '.$where.' )');
4011
+                } else {
4012
+                    array_push($where_clauses, $where);
4013
+                }
4014
+            }
4015
+        }
4016
+    }
4017
+    if ($add_custom_fields) {
4018
+        require_once('modules/DynamicFields/DynamicField.php');
4019
+        $bean->setupCustomFields($module);
4020
+        $bean->custom_fields->setWhereClauses($where_clauses);
4021
+    }
4022
+    return $where_clauses;
4023 4023
 }
4024 4024
 
4025 4025
 function add_quotes($str) {
4026
-	return "'{$str}'";
4026
+    return "'{$str}'";
4027 4027
 }
4028 4028
 
4029 4029
 /**
@@ -4033,19 +4033,19 @@  discard block
 block discarded – undo
4033 4033
  * @return	bool true if successful
4034 4034
  */
4035 4035
 function rebuildConfigFile($sugar_config, $sugar_version) {
4036
-	// add defaults to missing values of in-memory sugar_config
4037
-	$sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config );
4038
-	// need to override version with default no matter what
4039
-	$sugar_config['sugar_version'] = $sugar_version;
4036
+    // add defaults to missing values of in-memory sugar_config
4037
+    $sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config );
4038
+    // need to override version with default no matter what
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" ) ){
4044
-		return true;
4045
-	}
4046
-	else {
4047
-		return false;
4048
-	}
4043
+    if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
4044
+        return true;
4045
+    }
4046
+    else {
4047
+        return false;
4048
+    }
4049 4049
 }
4050 4050
 
4051 4051
 /**
@@ -4072,44 +4072,44 @@  discard block
 block discarded – undo
4072 4072
  * @return $site_url The url used to refer to the website
4073 4073
  */
4074 4074
 function getJavascriptSiteURL() {
4075
-	global $sugar_config;
4076
-	if(!empty($_SERVER['HTTP_REFERER'])) {
4077
-		$url = parse_url($_SERVER['HTTP_REFERER']);
4078
-		$replacement_url = $url['scheme']."://".$url['host'];
4079
-		if(!empty($url['port']))
4080
-		$replacement_url .= ':'.$url['port'];
4081
-		$site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']);
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);
4086
-		}
4087
-	}
4088
-	$GLOBALS['log']->debug("getJavascriptSiteURL(), site_url=".  $site_url);
4089
-	return $site_url;
4075
+    global $sugar_config;
4076
+    if(!empty($_SERVER['HTTP_REFERER'])) {
4077
+        $url = parse_url($_SERVER['HTTP_REFERER']);
4078
+        $replacement_url = $url['scheme']."://".$url['host'];
4079
+        if(!empty($url['port']))
4080
+        $replacement_url .= ':'.$url['port'];
4081
+        $site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']);
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);
4086
+        }
4087
+    }
4088
+    $GLOBALS['log']->debug("getJavascriptSiteURL(), site_url=".  $site_url);
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 4099
 function array_depth($array, $depth_count=-1, $depth_array=array()){
4100
-	$depth_count++;
4101
-	if (is_array($array)){
4102
-		foreach ($array as $key => $value){
4103
-			$depth_array[] = array_depth($value, $depth_count);
4104
-		}
4105
-	}
4106
-	else{
4107
-		return $depth_count;
4108
-	}
4109
-	foreach ($depth_array as $value){
4110
-		$depth_count = $value > $depth_count ? $value : $depth_count;
4111
-	}
4112
-	return $depth_count;
4100
+    $depth_count++;
4101
+    if (is_array($array)){
4102
+        foreach ($array as $key => $value){
4103
+            $depth_array[] = array_depth($value, $depth_count);
4104
+        }
4105
+    }
4106
+    else{
4107
+        return $depth_count;
4108
+    }
4109
+    foreach ($depth_array as $value){
4110
+        $depth_count = $value > $depth_count ? $value : $depth_count;
4111
+    }
4112
+    return $depth_count;
4113 4113
 }
4114 4114
 
4115 4115
 /**
@@ -4120,16 +4120,16 @@  discard block
 block discarded – undo
4120 4120
 function createGroupUser($name) {
4121 4121
 
4122 4122
 
4123
-	$group = new User();
4124
-	$group->user_name	= $name;
4125
-	$group->last_name	= $name;
4126
-	$group->is_group	= 1;
4127
-	$group->deleted		= 0;
4128
-	$group->status		= 'Active'; // cn: bug 6711
4129
-	$group->setPreference('timezone', TimeDate::userTimezone());
4130
-	$group->save();
4123
+    $group = new User();
4124
+    $group->user_name	= $name;
4125
+    $group->last_name	= $name;
4126
+    $group->is_group	= 1;
4127
+    $group->deleted		= 0;
4128
+    $group->status		= 'Active'; // cn: bug 6711
4129
+    $group->setPreference('timezone', TimeDate::userTimezone());
4130
+    $group->save();
4131 4131
 
4132
-	return $group->id;
4132
+    return $group->id;
4133 4133
 }
4134 4134
 
4135 4135
 /*
@@ -4142,48 +4142,48 @@  discard block
 block discarded – undo
4142 4142
 function _getIcon($iconFileName)
4143 4143
 {
4144 4144
 
4145
-	$iconName = "icon_{$iconFileName}.gif";
4145
+    $iconName = "icon_{$iconFileName}.gif";
4146 4146
     $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4147 4147
 
4148 4148
     //First try un-ucfirst-ing the icon name
4149 4149
     if ( empty($iconFound) )
4150
-		$iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif";
4150
+        $iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif";
4151 4151
         $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4152 4152
 
4153
-	//Next try removing the icon prefix
4153
+    //Next try removing the icon prefix
4154 4154
     if ( empty($iconFound) )
4155
-		$iconName = "{$iconFileName}.gif";
4156
-		$iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4155
+        $iconName = "{$iconFileName}.gif";
4156
+        $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4157 4157
 
4158
-	if ( empty($iconFound) )
4159
-		$iconName = '';
4158
+    if ( empty($iconFound) )
4159
+        $iconName = '';
4160 4160
 
4161
-  	return $iconName;
4161
+        return $iconName;
4162 4162
 }
4163 4163
 /**
4164
- * Function to grab the correct icon image for Studio
4165
- * @param string $iconFileName Name of the icon file
4166
- * @param string $altfilename Name of a fallback icon file (displayed if the imagefilename doesn't exist)
4167
- * @param string $width Width of image
4168
- * @param string $height Height of image
4169
- * @param string $align Alignment of image
4170
- * @param string $alt Alt tag of image
4171
- * @return string $string <img> tag with corresponding image
4172
- */
4164
+         * Function to grab the correct icon image for Studio
4165
+         * @param string $iconFileName Name of the icon file
4166
+         * @param string $altfilename Name of a fallback icon file (displayed if the imagefilename doesn't exist)
4167
+         * @param string $width Width of image
4168
+         * @param string $height Height of image
4169
+         * @param string $align Alignment of image
4170
+         * @param string $alt Alt tag of image
4171
+         * @return string $string <img> tag with corresponding image
4172
+         */
4173 4173
 
4174 4174
 function getStudioIcon($iconFileName='', $altFileName='', $width='48', $height='48', $align='baseline', $alt='' )
4175 4175
 {
4176
-	global $app_strings, $theme;
4176
+    global $app_strings, $theme;
4177 4177
 
4178 4178
     $iconName = _getIcon($iconFileName);
4179
- 	if(empty($iconName)){
4180
- 	    $iconName = _getIcon($altFileName);
4181
- 	    if (empty($iconName))
4182
- 	    {
4179
+        if(empty($iconName)){
4180
+            $iconName = _getIcon($altFileName);
4181
+            if (empty($iconName))
4182
+            {
4183 4183
             return $app_strings['LBL_NO_IMAGE'];
4184
- 	    }
4185
- 	}
4186
-	return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height);
4184
+            }
4185
+        }
4186
+    return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height);
4187 4187
 }
4188 4188
 
4189 4189
 /**
@@ -4198,16 +4198,16 @@  discard block
 block discarded – undo
4198 4198
  */
4199 4199
 
4200 4200
 function get_dashlets_dialog_icon($module='', $width='32', $height='32', $align='absmiddle',$alt=''){
4201
-	global $app_strings, $theme;
4202
- 	$iconName = _getIcon($module . "_32");
4203
- 	if (empty($iconName))
4204
- 	{
4205
- 		$iconName = _getIcon($module);
4206
- 	}
4207
- 	if(empty($iconName)){
4208
- 		return $app_strings['LBL_NO_IMAGE'];
4209
- 	}
4210
-	return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height);
4201
+    global $app_strings, $theme;
4202
+        $iconName = _getIcon($module . "_32");
4203
+        if (empty($iconName))
4204
+        {
4205
+            $iconName = _getIcon($module);
4206
+        }
4207
+        if(empty($iconName)){
4208
+            return $app_strings['LBL_NO_IMAGE'];
4209
+        }
4210
+    return SugarThemeRegistry::current()->getImage($iconName, "align=\"$align\" border=\"0\"", $width, $height);
4211 4211
 }
4212 4212
 
4213 4213
 // works nicely to change UTF8 strings that are html entities - good for PDF conversions
@@ -4239,23 +4239,23 @@  discard block
 block discarded – undo
4239 4239
 }
4240 4240
 
4241 4241
 function str_split_php4($string, $length = 1) {
4242
-	$string_length = strlen($string);
4243
-	$return = array();
4244
-	$cursor = 0;
4245
-	if ($length > $string_length) {
4246
-		// use the string_length as the string is shorter than the length
4247
-		$length = $string_length;
4248
-	}
4249
-	for ($cursor = 0; $cursor < $string_length; $cursor = $cursor + $length) {
4250
-		$return[] = substr($string, $cursor, $length);
4251
-	}
4252
-	return $return;
4242
+    $string_length = strlen($string);
4243
+    $return = array();
4244
+    $cursor = 0;
4245
+    if ($length > $string_length) {
4246
+        // use the string_length as the string is shorter than the length
4247
+        $length = $string_length;
4248
+    }
4249
+    for ($cursor = 0; $cursor < $string_length; $cursor = $cursor + $length) {
4250
+        $return[] = substr($string, $cursor, $length);
4251
+    }
4252
+    return $return;
4253 4253
 }
4254 4254
 
4255 4255
 if (version_compare(phpversion(), '5.0.0', '<')) {
4256
-	function str_split($string, $length = 1) {
4257
-		return str_split_php4($string, $length);
4258
-	}
4256
+    function str_split($string, $length = 1) {
4257
+        return str_split_php4($string, $length);
4258
+    }
4259 4259
 }
4260 4260
 
4261 4261
 /*
@@ -4287,8 +4287,8 @@  discard block
 block discarded – undo
4287 4287
  */
4288 4288
 function chartColors()
4289 4289
 {
4290
-	if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='')
4291
-	return SugarThemeRegistry::current()->getImageURL('sugarColors.xml');
4290
+    if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='')
4291
+    return SugarThemeRegistry::current()->getImageURL('sugarColors.xml');
4292 4292
     return SugarThemeRegistry::current()->getCSSURL('sugarColors.xml');
4293 4293
 }
4294 4294
 /* End Chart Dashlet helper functions */
@@ -4299,7 +4299,7 @@  discard block
 block discarded – undo
4299 4299
  */
4300 4300
 
4301 4301
 function ajaxInit() {
4302
-	ini_set('display_errors', 'false');
4302
+    ini_set('display_errors', 'false');
4303 4303
 }
4304 4304
 
4305 4305
 /**
@@ -4366,33 +4366,33 @@  discard block
 block discarded – undo
4366 4366
  * @return String value of the shortcut keys
4367 4367
  */
4368 4368
 function get_alt_hot_key() {
4369
-	$ua = '';
4369
+    $ua = '';
4370 4370
     if ( isset($_SERVER['HTTP_USER_AGENT']) )
4371 4371
         $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
4372
-	$isMac = strpos($ua, 'mac') !== false;
4373
-	$isLinux = strpos($ua, 'linux') !== false;
4372
+    $isMac = strpos($ua, 'mac') !== false;
4373
+    $isLinux = strpos($ua, 'linux') !== false;
4374 4374
 
4375
-	if(!$isMac && !$isLinux && strpos($ua, 'mozilla') !== false) {
4376
-	   if(preg_match('/firefox\/(\d)?\./', $ua, $matches)) {
4377
-	   	  return $matches[1] < 2 ? 'Alt+' : 'Alt+Shift+';
4378
-	   }
4379
-	}
4380
-	return $isMac ? 'Ctrl+' : 'Alt+';
4375
+    if(!$isMac && !$isLinux && strpos($ua, 'mozilla') !== false) {
4376
+        if(preg_match('/firefox\/(\d)?\./', $ua, $matches)) {
4377
+                return $matches[1] < 2 ? 'Alt+' : 'Alt+Shift+';
4378
+        }
4379
+    }
4380
+    return $isMac ? 'Ctrl+' : 'Alt+';
4381 4381
 }
4382 4382
 
4383 4383
 function can_start_session(){
4384
-	if(!empty($_GET['PHPSESSID'])) {
4385
-	   return true;
4386
-	}
4387
-	$session_id = session_id();
4388
-	return empty($session_id) ? true : false;
4384
+    if(!empty($_GET['PHPSESSID'])) {
4385
+        return true;
4386
+    }
4387
+    $session_id = session_id();
4388
+    return empty($session_id) ? true : false;
4389 4389
 }
4390 4390
 
4391 4391
 function load_link_class($properties){
4392
-	$class = 'Link2';
4393
-	if(!empty($properties['link_class']) && !empty($properties['link_file'])){
4394
-    	require_once($properties['link_file']);
4395
-    	$class = $properties['link_class'];
4392
+    $class = 'Link2';
4393
+    if(!empty($properties['link_class']) && !empty($properties['link_file'])){
4394
+        require_once($properties['link_file']);
4395
+        $class = $properties['link_class'];
4396 4396
     }
4397 4397
     return $class;
4398 4398
 }
@@ -4413,7 +4413,7 @@  discard block
 block discarded – undo
4413 4413
     if ( !isset($GLOBALS['sugar_config']['allow_pop_inbound']) || ! $GLOBALS['sugar_config']['allow_pop_inbound'] )
4414 4414
     {
4415 4415
         if( isset($protocol['pop3']) )
4416
-			unset($protocol['pop3']);
4416
+            unset($protocol['pop3']);
4417 4417
     }
4418 4418
     else
4419 4419
         $protocol['pop3'] = 'POP3';
@@ -4448,15 +4448,15 @@  discard block
 block discarded – undo
4448 4448
  *
4449 4449
  */
4450 4450
 function unencodeMultienum($string) {
4451
-	if (is_array($string))
4452
-	{
4453
-	   return $string;
4454
-	}
4455
-	if (substr($string, 0 ,1) == "^" && substr($string, -1) == "^") {
4456
-          $string = substr(substr($string, 1), 0, strlen($string) -2);
4457
-	}
4451
+    if (is_array($string))
4452
+    {
4453
+        return $string;
4454
+    }
4455
+    if (substr($string, 0 ,1) == "^" && substr($string, -1) == "^") {
4456
+            $string = substr(substr($string, 1), 0, strlen($string) -2);
4457
+    }
4458 4458
 
4459
-	return explode('^,^', $string);
4459
+    return explode('^,^', $string);
4460 4460
 }
4461 4461
 
4462 4462
 function encodeMultienumValue($arr) {
@@ -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
 }
@@ -4482,86 +4482,86 @@  discard block
 block discarded – undo
4482 4482
  * @return $ret_array['join']: extra join condition
4483 4483
  */
4484 4484
 function create_export_query_relate_link_patch($module, $searchFields, $where){
4485
-	if(file_exists('modules/'.$module.'/SearchForm.html')){
4486
-		$ret_array['where'] = $where;
4487
-		return $ret_array;
4488
-	}
4489
-	$seed = loadBean($module);
4485
+    if(file_exists('modules/'.$module.'/SearchForm.html')){
4486
+        $ret_array['where'] = $where;
4487
+        return $ret_array;
4488
+    }
4489
+    $seed = loadBean($module);
4490 4490
     foreach($seed->field_defs as $name=>$field)
4491
-	{
4492
-
4493
-		if( $field['type'] == 'relate' && isset($field['link']) && !empty($searchFields[$name]['value']) ){
4494
-			$seed->load_relationship($field['link']);
4495
-			$params = array();
4496
-			if(empty($join_type))
4497
-			{
4498
-				$params['join_type'] = ' LEFT JOIN ';
4499
-			}
4500
-			else
4501
-			{
4502
-				$params['join_type'] = $join_type;
4503
-			}
4504
-			if(isset($data['join_name']))
4505
-			{
4506
-				$params['join_table_alias'] = $field['join_name'];
4507
-			}
4508
-			else
4509
-			{
4510
-				$params['join_table_alias']	= 'join_'.$field['name'];
4491
+    {
4511 4492
 
4512
-			}
4513
-			if(isset($data['join_link_name']))
4514
-			{
4515
-				$params['join_table_link_alias'] = $field['join_link_name'];
4516
-			}
4517
-			else
4518
-			{
4519
-				$params['join_table_link_alias'] = 'join_link_'.$field['name'];
4520
-			}
4521
-			$join = $seed->$field['link']->getJoin($params, true);
4522
-			$join_table_alias = 'join_'.$field['name'];
4523
-			if(isset($field['db_concat_fields'])){
4524
-				$db_field = db_concat($join_table_alias, $field['db_concat_fields']);
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);
4528
-			}
4529
-		}
4530
-	}
4493
+        if( $field['type'] == 'relate' && isset($field['link']) && !empty($searchFields[$name]['value']) ){
4494
+            $seed->load_relationship($field['link']);
4495
+            $params = array();
4496
+            if(empty($join_type))
4497
+            {
4498
+                $params['join_type'] = ' LEFT JOIN ';
4499
+            }
4500
+            else
4501
+            {
4502
+                $params['join_type'] = $join_type;
4503
+            }
4504
+            if(isset($data['join_name']))
4505
+            {
4506
+                $params['join_table_alias'] = $field['join_name'];
4507
+            }
4508
+            else
4509
+            {
4510
+                $params['join_table_alias']	= 'join_'.$field['name'];
4511
+
4512
+            }
4513
+            if(isset($data['join_link_name']))
4514
+            {
4515
+                $params['join_table_link_alias'] = $field['join_link_name'];
4516
+            }
4517
+            else
4518
+            {
4519
+                $params['join_table_link_alias'] = 'join_link_'.$field['name'];
4520
+            }
4521
+            $join = $seed->$field['link']->getJoin($params, true);
4522
+            $join_table_alias = 'join_'.$field['name'];
4523
+            if(isset($field['db_concat_fields'])){
4524
+                $db_field = db_concat($join_table_alias, $field['db_concat_fields']);
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);
4528
+            }
4529
+        }
4530
+    }
4531 4531
     $ret_array = array('where'=>$where, 'join'=> isset($join['join']) ? $join['join'] : '');
4532
-	return $ret_array;
4532
+    return $ret_array;
4533 4533
 }
4534 4534
 
4535 4535
 /**
4536
-  * We need to clear all the js cache files, including the js language files  in serval places in MB. So I extract them into a util function here.
4537
-  * @Depends on QuickRepairAndRebuild.php
4538
-  * @Relate bug 30642  ,23177
4539
-  */
4536
+ * We need to clear all the js cache files, including the js language files  in serval places in MB. So I extract them into a util function here.
4537
+ * @Depends on QuickRepairAndRebuild.php
4538
+ * @Relate bug 30642  ,23177
4539
+ */
4540 4540
 function clearAllJsAndJsLangFilesWithoutOutput(){
4541
-		global $current_language , $mod_strings;
4542
-		$MBmodStrings = $mod_strings;
4541
+        global $current_language , $mod_strings;
4542
+        $MBmodStrings = $mod_strings;
4543 4543
         $mod_strings = return_module_language ( $current_language, 'Administration' ) ;
4544 4544
         include_once ('modules/Administration/QuickRepairAndRebuild.php') ;
4545 4545
         $repair = new RepairAndClear();
4546 4546
         $repair->module_list = array();
4547
-		$repair->show_output = false;
4548
-		$repair->clearJsLangFiles();
4549
-		$repair->clearJsFiles();
4550
-		$mod_strings = $MBmodStrings;
4547
+        $repair->show_output = false;
4548
+        $repair->clearJsLangFiles();
4549
+        $repair->clearJsFiles();
4550
+        $mod_strings = $MBmodStrings;
4551 4551
 }
4552 4552
 
4553 4553
 /**
4554 4554
  * This function will allow you to get a variable value from query string
4555 4555
  */
4556 4556
 function getVariableFromQueryString($variable, $string){
4557
-	$matches = array();
4558
-	$number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches);
4559
-	if($number){
4560
-		return $matches[1];
4561
-	}
4562
-	else{
4563
-		return false;
4564
-	}
4557
+    $matches = array();
4558
+    $number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches);
4559
+    if($number){
4560
+        return $matches[1];
4561
+    }
4562
+    else{
4563
+        return false;
4564
+    }
4565 4565
 }
4566 4566
 
4567 4567
 /**
@@ -4572,14 +4572,14 @@  discard block
 block discarded – undo
4572 4572
  * @return boolean flag indicating whether or not iframes module should be hidden
4573 4573
  */
4574 4574
 function should_hide_iframes() {
4575
-   //Remove the MySites module
4576
-   if(file_exists('modules/iFrames/iFrame.php')) {
4575
+    //Remove the MySites module
4576
+    if(file_exists('modules/iFrames/iFrame.php')) {
4577 4577
         if(!class_exists("iFrame")) {
4578 4578
                 require_once('modules/iFrames/iFrame.php');
4579 4579
         }
4580 4580
         return false;
4581
-   }
4582
-   return true;
4581
+    }
4582
+    return true;
4583 4583
 }
4584 4584
 
4585 4585
 /**
@@ -4589,11 +4589,11 @@  discard block
 block discarded – undo
4589 4589
  * @return string RC, BETA, GA
4590 4590
  */
4591 4591
 function getVersionStatus($version){
4592
-	if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) {
4593
-		return strtoupper($matches[1]);
4594
-	}else{
4595
-		return 'GA';
4596
-	}
4592
+    if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) {
4593
+        return strtoupper($matches[1]);
4594
+    }else{
4595
+        return 'GA';
4596
+    }
4597 4597
 }
4598 4598
 
4599 4599
 /**
@@ -4604,16 +4604,16 @@  discard block
 block discarded – undo
4604 4604
  * @return version
4605 4605
  */
4606 4606
 function getMajorMinorVersion($version){
4607
-	if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){
4608
-		$version = $matches2[1];
4609
-		$arr = explode('.', $version);
4610
-		if(count($arr) > 2){
4611
-			if($arr[2] == '0'){
4612
-				$version = substr($version, 0, 3);
4613
-			}
4614
-		}
4615
-	}
4616
-	return $version;
4607
+    if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){
4608
+        $version = $matches2[1];
4609
+        $arr = explode('.', $version);
4610
+        if(count($arr) > 2){
4611
+            if($arr[2] == '0'){
4612
+                $version = substr($version, 0, 3);
4613
+            }
4614
+        }
4615
+    }
4616
+    return $version;
4617 4617
 }
4618 4618
 
4619 4619
 /**
@@ -4622,9 +4622,9 @@  discard block
 block discarded – undo
4622 4622
  */
4623 4623
 function sugar_microtime()
4624 4624
 {
4625
-	$now = explode(' ', microtime());
4626
-	$unique_id = $now[1].str_replace('.', '', $now[0]);
4627
-	return $unique_id;
4625
+    $now = explode(' ', microtime());
4626
+    $unique_id = $now[1].str_replace('.', '', $now[0]);
4627
+    return $unique_id;
4628 4628
 }
4629 4629
 
4630 4630
 /**
@@ -4634,15 +4634,15 @@  discard block
 block discarded – undo
4634 4634
  */
4635 4635
 function getUrls($string)
4636 4636
 {
4637
-	$lines = explode("<br>", trim($string));
4638
-	$urls = array();
4639
-	foreach($lines as $line){
4640
-    	$regex = '/http?\:\/\/[^\" ]+/i';
4641
-    	preg_match_all($regex, $line, $matches);
4642
-    	foreach($matches[0] as $match){
4643
-    		$urls[] = $match;
4644
-    	}
4645
-	}
4637
+    $lines = explode("<br>", trim($string));
4638
+    $urls = array();
4639
+    foreach($lines as $line){
4640
+        $regex = '/http?\:\/\/[^\" ]+/i';
4641
+        preg_match_all($regex, $line, $matches);
4642
+        foreach($matches[0] as $match){
4643
+            $urls[] = $match;
4644
+        }
4645
+    }
4646 4646
     return $urls;
4647 4647
 }
4648 4648
 
@@ -4654,14 +4654,14 @@  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) {
4660
-    	    return false;
4661
-    	}
4662
-    	$img_size = getimagesize($path);
4663
-		$filetype = $img_size['mime'];
4664
-		//if filetype is jpeg or if we are only allowing jpegs, create jpg image
4659
+        if(!$img) {
4660
+            return false;
4661
+        }
4662
+        $img_size = getimagesize($path);
4663
+        $filetype = $img_size['mime'];
4664
+        //if filetype is jpeg or if we are only allowing jpegs, create jpg image
4665 4665
         if($filetype == "image/jpeg" || $jpeg) {
4666 4666
             ob_start();
4667 4667
             imagejpeg($img);
@@ -4672,19 +4672,19 @@  discard block
 block discarded – undo
4672 4672
             }
4673 4673
         } elseif ($filetype == "image/png") {
4674 4674
             // else if the filetype is png, create png
4675
-        	imagealphablending($img, true);
4676
-        	imagesavealpha($img, true);
4677
-        	ob_start();
4675
+            imagealphablending($img, true);
4676
+            imagesavealpha($img, true);
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 {
4684
-        	return false;
4684
+            return false;
4685 4685
         }
4686
-	} else {
4687
-	    // check image manually
4686
+    } else {
4687
+        // check image manually
4688 4688
         $fp = fopen($path, "rb");
4689 4689
         if(!$fp) return false;
4690 4690
         $data = '';
@@ -4693,15 +4693,15 @@  discard block
 block discarded – undo
4693 4693
             $data .= fread($fp,8192);
4694 4694
         }
4695 4695
 
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",
4698
-	         $data, $m)) {
4699
-	        $GLOBALS['log']->fatal("Found {$m[0]} in $path, not allowing upload");
4700
-	        return false;
4701
-	    }
4702
-	    return true;
4703
-	}
4704
-	return false;
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",
4698
+                $data, $m)) {
4699
+            $GLOBALS['log']->fatal("Found {$m[0]} in $path, not allowing upload");
4700
+            return false;
4701
+        }
4702
+        return true;
4703
+    }
4704
+    return false;
4705 4705
 }
4706 4706
 
4707 4707
 /**
@@ -4718,16 +4718,16 @@  discard block
 block discarded – undo
4718 4718
     }
4719 4719
 
4720 4720
     if(!file_exists($path) || !is_file($path)) {
4721
-	    return false;
4722
-	}
4721
+        return false;
4722
+    }
4723 4723
 
4724
-	$img_size = getimagesize($path);
4725
-	$filetype = $img_size['mime'];
4726
-	$ext = end(explode(".", $path));
4727
-	if(substr_count('..', $path) > 0 || ($ext !== $path && !isset($supportedExtensions[strtolower($ext)])) ||
4728
-	    !in_array($filetype, array_values($supportedExtensions))) {
4729
-	        return false;
4730
-	}
4724
+    $img_size = getimagesize($path);
4725
+    $filetype = $img_size['mime'];
4726
+    $ext = end(explode(".", $path));
4727
+    if(substr_count('..', $path) > 0 || ($ext !== $path && !isset($supportedExtensions[strtolower($ext)])) ||
4728
+        !in_array($filetype, array_values($supportedExtensions))) {
4729
+            return false;
4730
+    }
4731 4731
     return verify_image_file($path, $jpeg_only);
4732 4732
 }
4733 4733
 
@@ -4779,7 +4779,7 @@  discard block
 block discarded – undo
4779 4779
     if (isset($GLOBALS['sugar_config']['search_wildcard_infront']) &&
4780 4780
         $GLOBALS['sugar_config']['search_wildcard_infront'] == true) {
4781 4781
         if (substr($str,0,1) <> $wildcard)
4782
-          $str = $wildcard.$str;
4782
+            $str = $wildcard.$str;
4783 4783
     }
4784 4784
 
4785 4785
     // add wildcard at the end of search string (default)
@@ -4794,7 +4794,7 @@  discard block
 block discarded – undo
4794 4794
 
4795 4795
 //check to see if custom utils exists
4796 4796
 if(file_exists('custom/include/custom_utils.php')){
4797
-	include_once('custom/include/custom_utils.php');
4797
+    include_once('custom/include/custom_utils.php');
4798 4798
 }
4799 4799
 
4800 4800
 //check to see if custom utils exists in Extension framework
@@ -4802,12 +4802,12 @@  discard block
 block discarded – undo
4802 4802
     include_once('custom/application/Ext/Utils/custom_utils.ext.php');
4803 4803
 }
4804 4804
 /**
4805
- * @param $input - the input string to sanitize
4806
- * @param int $quotes - use quotes
4807
- * @param string $charset - the default charset
4808
- * @param bool $remove - strip tags or not
4809
- * @return string - the sanitized string
4810
- */
4805
+     * @param $input - the input string to sanitize
4806
+     * @param int $quotes - use quotes
4807
+     * @param string $charset - the default charset
4808
+     * @param bool $remove - strip tags or not
4809
+     * @return string - the sanitized string
4810
+     */
4811 4811
 function sanitize($input, $quotes = ENT_QUOTES, $charset = 'UTF-8', $remove = false)
4812 4812
 {
4813 4813
     return htmlentities($input, $quotes, $charset);
@@ -4854,9 +4854,9 @@  discard block
 block discarded – undo
4854 4854
     $result = array();
4855 4855
     foreach($data as $key=>$val) {
4856 4856
         if(is_array($val)) {
4857
-           $result[$key] = utf8_recursive_encode($val);
4857
+            $result[$key] = utf8_recursive_encode($val);
4858 4858
         } else {
4859
-           $result[$key] = utf8_encode($val);
4859
+            $result[$key] = utf8_encode($val);
4860 4860
         }
4861 4861
     }
4862 4862
     return $result;
@@ -4938,18 +4938,18 @@  discard block
 block discarded – undo
4938 4938
  * @param string $etag ETag to use for this content.
4939 4939
  */
4940 4940
 function generateETagHeader($etag){
4941
-	header("cache-control:");
4942
-	header('Expires: ');
4943
-	header("ETag: " . $etag);
4944
-	header("Pragma:");
4945
-	if(isset($_SERVER["HTTP_IF_NONE_MATCH"])){
4946
-		if($etag == $_SERVER["HTTP_IF_NONE_MATCH"]){
4947
-			ob_clean();
4948
-			header("Status: 304 Not Modified");
4949
-			header("HTTP/1.0 304 Not Modified");
4950
-			die();
4951
-		}
4952
-	}
4941
+    header("cache-control:");
4942
+    header('Expires: ');
4943
+    header("ETag: " . $etag);
4944
+    header("Pragma:");
4945
+    if(isset($_SERVER["HTTP_IF_NONE_MATCH"])){
4946
+        if($etag == $_SERVER["HTTP_IF_NONE_MATCH"]){
4947
+            ob_clean();
4948
+            header("Status: 304 Not Modified");
4949
+            header("HTTP/1.0 304 Not Modified");
4950
+            die();
4951
+        }
4952
+    }
4953 4953
 }
4954 4954
 
4955 4955
 /**
@@ -4962,22 +4962,22 @@  discard block
 block discarded – undo
4962 4962
  * @return string translated report name
4963 4963
  */
4964 4964
 function getReportNameTranslation($reportName) {
4965
-	global $current_language;
4965
+    global $current_language;
4966 4966
 
4967
-	// Used for translating reports
4967
+    // Used for translating reports
4968 4968
     $mod_strings = return_module_language($current_language, 'Reports');
4969 4969
 
4970
-	// Search for the report name in the default language and get the key
4971
-	$key = array_search($reportName, return_module_language("", "Reports"));
4970
+    // Search for the report name in the default language and get the key
4971
+    $key = array_search($reportName, return_module_language("", "Reports"));
4972 4972
 
4973
-	// If the key was found, use it to get a translation, otherwise just use report name
4974
-	if (!empty($key)) {
4975
-		$title = $mod_strings[$key];
4976
-	} else {
4977
-		$title = $reportName;
4978
-	}
4973
+    // If the key was found, use it to get a translation, otherwise just use report name
4974
+    if (!empty($key)) {
4975
+        $title = $mod_strings[$key];
4976
+    } else {
4977
+        $title = $reportName;
4978
+    }
4979 4979
 
4980
-	return $title;
4980
+    return $title;
4981 4981
 }
4982 4982
 
4983 4983
 /**
@@ -5085,47 +5085,47 @@  discard block
 block discarded – undo
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);
5090
-	else
5091
-		return strlen($input);
5088
+    if(function_exists('mb_strlen'))
5089
+        return mb_strlen($input,$encoding);
5090
+    else
5091
+        return strlen($input);
5092 5092
 }
5093 5093
 
5094 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);
5098
-	else
5099
-		return substr($input,$start,$length);
5096
+    if(function_exists('mb_substr'))
5097
+        return mb_substr($input,$start,$length,$encoding);
5098
+    else
5099
+        return substr($input,$start,$length);
5100 5100
 }
5101 5101
 
5102 5102
 function suite_strtoupper($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5103 5103
 {
5104
-	if(function_exists('mb_strtoupper'))
5105
-		return mb_strtoupper($input,$encoding);
5106
-	else
5107
-		return strtoupper($input);
5104
+    if(function_exists('mb_strtoupper'))
5105
+        return mb_strtoupper($input,$encoding);
5106
+    else
5107
+        return strtoupper($input);
5108 5108
 }
5109 5109
 function suite_strtolower($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5110 5110
 {
5111
-	if(function_exists('mb_strtolower'))
5112
-		return mb_strtolower($input,$encoding);
5113
-	else
5114
-		return strtolower($input);
5111
+    if(function_exists('mb_strtolower'))
5112
+        return mb_strtolower($input,$encoding);
5113
+    else
5114
+        return strtolower($input);
5115 5115
 }
5116 5116
 
5117 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);
5121
-	else
5122
-		return strpos($haystack,$needle,$offset);
5119
+    if(function_exists('mb_strpos'))
5120
+        return mb_strpos($haystack,$needle,$offset,$encoding);
5121
+    else
5122
+        return strpos($haystack,$needle,$offset);
5123 5123
 }
5124 5124
 
5125 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);
5129
-	else
5130
-		return strrpos($haystack,$needle,$offset);
5127
+    if(function_exists('mb_strrpos'))
5128
+        return mb_strrpos($haystack,$needle,$offset,$encoding);
5129
+    else
5130
+        return strrpos($haystack,$needle,$offset);
5131 5131
 }
5132 5132
\ No newline at end of file
Please login to merge, or discard this 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.
Braces   +343 added lines, -225 removed lines patch added patch discarded remove patch
@@ -448,11 +448,9 @@  discard block
 block discarded – undo
448 448
 
449 449
 	if(file_exists("custom/include/language/{$language}.notify_template.html")){
450 450
 		$file = "custom/include/language/{$language}.notify_template.html";
451
-	}
452
-	else if(file_exists("include/language/{$language}.notify_template.html")){
451
+	} else if(file_exists("include/language/{$language}.notify_template.html")){
453 452
 		$file = "include/language/{$language}.notify_template.html";
454
-	}
455
-	else if(file_exists("custom/include/language/en_us.notify_template.html")){
453
+	} else if(file_exists("custom/include/language/en_us.notify_template.html")){
456 454
 		$file = "custom/include/language/en_us.notify_template.html";
457 455
 	}
458 456
 
@@ -470,8 +468,7 @@  discard block
 block discarded – undo
470 468
 	foreach( $default as $key => $value ){
471 469
 		if( !array_key_exists($key, $override) ){
472 470
 			$override[$key] = $value;
473
-		}
474
-		else if( is_array( $key ) ){
471
+		} else if( is_array( $key ) ){
475 472
 			$override[$key] = sugar_config_union( $value, $override[$key] );
476 473
 		}
477 474
 	}
@@ -484,8 +481,7 @@  discard block
 block discarded – undo
484 481
 	if( is_file($file) || is_dir($file) ){
485 482
 		if( !is_writable($file) ){
486 483
 			$ret_val = true;
487
-		}
488
-		else {
484
+		} else {
489 485
 			$original_fileperms = fileperms($file);
490 486
 
491 487
 			// take away writable permissions
@@ -591,8 +587,9 @@  discard block
 block discarded – undo
591 587
 function get_user_name($id) {
592 588
 	global $db;
593 589
 
594
-	if(empty($db))
595
-	$db = DBManagerFactory::getInstance();
590
+	if(empty($db)) {
591
+		$db = DBManagerFactory::getInstance();
592
+	}
596 593
 
597 594
 	$q = "SELECT user_name FROM users WHERE id='{$id}'";
598 595
 	$r = $db->query($q);
@@ -637,8 +634,7 @@  discard block
 block discarded – undo
637 634
 		// Including deleted users for now.
638 635
 		if (empty($status)) {
639 636
 			$query = "SELECT id, first_name, last_name, user_name from users WHERE 1=1".$portal_filter;
640
-		}
641
-		else {
637
+		} else {
642 638
 			$query = "SELECT id, first_name, last_name, user_name from users WHERE status='$status'".$portal_filter;
643 639
 		}
644 640
         /* BEGIN - SECURITY GROUPS */
@@ -677,7 +673,7 @@  discard block
 block discarded – undo
677 673
                 //its possible for first name to be skipped, check for this
678 674
                 if($firstNamePos===false){
679 675
                     $order_by_string =  'last_name ASC';
680
-                }else{
676
+                } else{
681 677
                     $order_by_string =  ($lastNamePos < $firstNamePos) ? "last_name, first_name ASC" : "first_name, last_name ASC";
682 678
                 }
683 679
             }
@@ -1100,18 +1096,20 @@  discard block
 block discarded – undo
1100 1096
 	$loaded_mod_strings = LanguageManager::loadModuleLanguage($module, $language,$refresh);
1101 1097
 
1102 1098
 	// cn: bug 6048 - merge en_us with requested language
1103
-	if($language != $sugar_config['default_language'])
1104
-        $loaded_mod_strings = sugarLangArrayMerge(
1099
+	if($language != $sugar_config['default_language']) {
1100
+	        $loaded_mod_strings = sugarLangArrayMerge(
1105 1101
             LanguageManager::loadModuleLanguage($module, $sugar_config['default_language'],$refresh),
1106 1102
                 $loaded_mod_strings
1107 1103
             );
1104
+	}
1108 1105
 
1109 1106
     // Load in en_us strings by default
1110
-    if($language != 'en_us' && $sugar_config['default_language'] != 'en_us')
1111
-        $loaded_mod_strings = sugarLangArrayMerge(
1107
+    if($language != 'en_us' && $sugar_config['default_language'] != 'en_us') {
1108
+            $loaded_mod_strings = sugarLangArrayMerge(
1112 1109
             LanguageManager::loadModuleLanguage($module, 'en_us', $refresh),
1113 1110
                 $loaded_mod_strings
1114 1111
             );
1112
+    }
1115 1113
 
1116 1114
 	// If we are in debug mode for translating, turn on the prefix now!
1117 1115
 	if($sugar_config['translation_string_prefix']) {
@@ -1123,9 +1121,9 @@  discard block
 block discarded – undo
1123 1121
 	$return_value = $loaded_mod_strings;
1124 1122
 	if(!isset($mod_strings)){
1125 1123
 		$mod_strings = $return_value;
1124
+	} else {
1125
+			$mod_strings = $temp_mod_strings;
1126 1126
 	}
1127
-	else
1128
-		$mod_strings = $temp_mod_strings;
1129 1127
 
1130 1128
     $cache_key = LanguageManager::getLanguageCacheKey($module, $language);
1131 1129
     sugar_cache_put($cache_key, $return_value);
@@ -1164,8 +1162,9 @@  discard block
 block discarded – undo
1164 1162
 	// cn: bug 6048 - merge en_us with requested language
1165 1163
 	include("modules/$module/language/en_us.lang.php");
1166 1164
 	$en_mod_list_strings = array();
1167
-	if($language_used != $default_language)
1168
-	$en_mod_list_strings = $mod_list_strings;
1165
+	if($language_used != $default_language) {
1166
+		$en_mod_list_strings = $mod_list_strings;
1167
+	}
1169 1168
 
1170 1169
 	if(file_exists("modules/$module/language/$language.lang.php")) {
1171 1170
 		include("modules/$module/language/$language.lang.php");
@@ -1295,8 +1294,9 @@  discard block
 block discarded – undo
1295 1294
 	$where = "";
1296 1295
 	foreach($where_clauses as $clause)
1297 1296
 	{
1298
-		if($where != "")
1299
-		$where .= " and ";
1297
+		if($where != "") {
1298
+				$where .= " and ";
1299
+		}
1300 1300
 		$where .= $clause;
1301 1301
 	}
1302 1302
 
@@ -1374,8 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 	if($strlen < $length)
1375 1375
 	{
1376 1376
 		$string = str_pad($string,$length,"0");
1377
-	}
1378
-	else if($strlen > $length)
1377
+	} else if($strlen > $length)
1379 1378
 	{
1380 1379
 		$string = substr($string, 0, $length);
1381 1380
 	}
@@ -1575,7 +1574,9 @@  discard block
 block discarded – undo
1575 1574
         $replacement .= "/OPTION>\n<OPTION value='__SugarMassUpdateClearField__'><"; // Giving the user the option to unset a drop down list. I.e. none means that it won't get updated
1576 1575
     }
1577 1576
 
1578
-	if (empty($key_list)) $key_list = array();
1577
+	if (empty($key_list)) {
1578
+	    $key_list = array();
1579
+	}
1579 1580
 	//create the type dropdown domain and set the selected value if $opp value already exists
1580 1581
 	foreach ($key_list as $option_key=>$option_value) {
1581 1582
 
@@ -1737,24 +1738,26 @@  discard block
 block discarded – undo
1737 1738
 		    $current_language = ($_REQUEST['login_language'] == $current_language)? $current_language : $_REQUEST['login_language'];
1738 1739
 		}
1739 1740
 		$mod_strings = return_module_language($current_language, $mod);
1740
-        if ($mod == "")
1741
-        echo "Language is <pre>" . $mod_strings . "</pre>";
1741
+        if ($mod == "") {
1742
+                echo "Language is <pre>" . $mod_strings . "</pre>";
1743
+        }
1742 1744
 
1743
-	}else{
1745
+	} else{
1744 1746
 		global $mod_strings;
1745 1747
 	}
1746 1748
 
1747 1749
 	$returnValue = '';
1748 1750
 	global $app_strings, $app_list_strings;
1749 1751
 
1750
-    if (isset($mod_strings[$string]))
1751
-        $returnValue = $mod_strings[$string];
1752
-    else if (isset($app_strings[$string]))
1753
-        $returnValue = $app_strings[$string];
1754
-    else if (isset($app_list_strings[$string]))
1755
-        $returnValue = $app_list_strings[$string];
1756
-    else if (isset($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$string]))
1757
-        $returnValue = $app_list_strings['moduleList'][$string];
1752
+    if (isset($mod_strings[$string])) {
1753
+            $returnValue = $mod_strings[$string];
1754
+    } else if (isset($app_strings[$string])) {
1755
+            $returnValue = $app_strings[$string];
1756
+    } else if (isset($app_list_strings[$string])) {
1757
+            $returnValue = $app_list_strings[$string];
1758
+    } else if (isset($app_list_strings['moduleList']) && isset($app_list_strings['moduleList'][$string])) {
1759
+            $returnValue = $app_list_strings['moduleList'][$string];
1760
+    }
1758 1761
 
1759 1762
 
1760 1763
 	//$test_end = microtime();
@@ -1867,8 +1870,9 @@  discard block
 block discarded – undo
1867 1870
 function clean_xss($str, $cleanImg=true) {
1868 1871
 	global $sugar_config;
1869 1872
 
1870
-	if(empty($sugar_config['email_xss']))
1871
-	$sugar_config['email_xss'] = getDefaultXssTags();
1873
+	if(empty($sugar_config['email_xss'])) {
1874
+		$sugar_config['email_xss'] = getDefaultXssTags();
1875
+	}
1872 1876
 
1873 1877
 	$xsstags = unserialize(base64_decode($sugar_config['email_xss']));
1874 1878
 
@@ -1987,32 +1991,65 @@  discard block
 block discarded – undo
1987 1991
 			die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
1988 1992
 		}
1989 1993
 		return false;
1990
-	}
1991
-	else {
1994
+	} else {
1992 1995
 		return $str;
1993 1996
 	}
1994 1997
 }
1995 1998
 
1996 1999
 function clean_special_arguments() {
1997 2000
 	if(isset($_SERVER['PHP_SELF'])) {
1998
-		if (!empty($_SERVER['PHP_SELF'])) clean_string($_SERVER['PHP_SELF'], 'SAFED_GET');
1999
-	}
2000
-	if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme'], "STANDARD");
2001
-	if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) clean_string($_REQUEST['login_module'], "STANDARD");
2002
-	if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) clean_string($_REQUEST['login_action'], "STANDARD");
2003
-	if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) clean_string($_REQUEST['ck_login_theme_20'], "STANDARD");
2004
-	if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme'], "STANDARD");
2005
-	if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) clean_string($_REQUEST['module_name'], "STANDARD");
2006
-	if (!empty($_REQUEST) && !empty($_REQUEST['module'])) clean_string($_REQUEST['module'], "STANDARD");
2007
-	if (!empty($_POST) && !empty($_POST['parent_type'])) clean_string($_POST['parent_type'], "STANDARD");
2008
-	if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) clean_string($_REQUEST['mod_lang'], "STANDARD");
2009
-	if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language'], "STANDARD");
2010
-	if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL");
2011
-	if (!empty($_GET) && !empty($_GET['from'])) clean_string($_GET['from']);
2012
-	if (!empty($_GET) && !empty($_GET['gmto'])) clean_string($_GET['gmto'], "NUMBER");
2013
-	if (!empty($_GET) && !empty($_GET['case_number'])) clean_string($_GET['case_number'], "AUTO_INCREMENT");
2014
-	if (!empty($_GET) && !empty($_GET['bug_number'])) clean_string($_GET['bug_number'], "AUTO_INCREMENT");
2015
-	if (!empty($_GET) && !empty($_GET['quote_num'])) clean_string($_GET['quote_num'], "AUTO_INCREMENT");
2001
+		if (!empty($_SERVER['PHP_SELF'])) {
2002
+		    clean_string($_SERVER['PHP_SELF'], 'SAFED_GET');
2003
+		}
2004
+	}
2005
+	if (!empty($_REQUEST) && !empty($_REQUEST['login_theme'])) {
2006
+	    clean_string($_REQUEST['login_theme'], "STANDARD");
2007
+	}
2008
+	if (!empty($_REQUEST) && !empty($_REQUEST['login_module'])) {
2009
+	    clean_string($_REQUEST['login_module'], "STANDARD");
2010
+	}
2011
+	if (!empty($_REQUEST) && !empty($_REQUEST['login_action'])) {
2012
+	    clean_string($_REQUEST['login_action'], "STANDARD");
2013
+	}
2014
+	if (!empty($_REQUEST) && !empty($_REQUEST['ck_login_theme_20'])) {
2015
+	    clean_string($_REQUEST['ck_login_theme_20'], "STANDARD");
2016
+	}
2017
+	if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_theme'])) {
2018
+	    clean_string($_SESSION['authenticated_user_theme'], "STANDARD");
2019
+	}
2020
+	if (!empty($_REQUEST) && !empty($_REQUEST['module_name'])) {
2021
+	    clean_string($_REQUEST['module_name'], "STANDARD");
2022
+	}
2023
+	if (!empty($_REQUEST) && !empty($_REQUEST['module'])) {
2024
+	    clean_string($_REQUEST['module'], "STANDARD");
2025
+	}
2026
+	if (!empty($_POST) && !empty($_POST['parent_type'])) {
2027
+	    clean_string($_POST['parent_type'], "STANDARD");
2028
+	}
2029
+	if (!empty($_REQUEST) && !empty($_REQUEST['mod_lang'])) {
2030
+	    clean_string($_REQUEST['mod_lang'], "STANDARD");
2031
+	}
2032
+	if (!empty($_SESSION) && !empty($_SESSION['authenticated_user_language'])) {
2033
+	    clean_string($_SESSION['authenticated_user_language'], "STANDARD");
2034
+	}
2035
+	if (!empty($_SESSION) && !empty($_SESSION['dyn_layout_file'])) {
2036
+	    clean_string($_SESSION['dyn_layout_file'], "PATH_NO_URL");
2037
+	}
2038
+	if (!empty($_GET) && !empty($_GET['from'])) {
2039
+	    clean_string($_GET['from']);
2040
+	}
2041
+	if (!empty($_GET) && !empty($_GET['gmto'])) {
2042
+	    clean_string($_GET['gmto'], "NUMBER");
2043
+	}
2044
+	if (!empty($_GET) && !empty($_GET['case_number'])) {
2045
+	    clean_string($_GET['case_number'], "AUTO_INCREMENT");
2046
+	}
2047
+	if (!empty($_GET) && !empty($_GET['bug_number'])) {
2048
+	    clean_string($_GET['bug_number'], "AUTO_INCREMENT");
2049
+	}
2050
+	if (!empty($_GET) && !empty($_GET['quote_num'])) {
2051
+	    clean_string($_GET['quote_num'], "AUTO_INCREMENT");
2052
+	}
2016 2053
 	clean_superglobals('stamp', 'ALPHANUM'); // for vcr controls
2017 2054
 	clean_superglobals('offset', 'ALPHANUM');
2018 2055
 	clean_superglobals('return_action');
@@ -2024,10 +2061,16 @@  discard block
 block discarded – undo
2024 2061
  * cleans the given key in superglobals $_GET, $_POST, $_REQUEST
2025 2062
  */
2026 2063
 function clean_superglobals($key, $filter = 'STANDARD') {
2027
-	if(isset($_GET[$key])) clean_string($_GET[$key], $filter);
2028
-	if(isset($_POST[$key])) clean_string($_POST[$key], $filter);
2029
-	if(isset($_REQUEST[$key])) clean_string($_REQUEST[$key], $filter);
2030
-}
2064
+	if(isset($_GET[$key])) {
2065
+	    clean_string($_GET[$key], $filter);
2066
+	}
2067
+	if(isset($_POST[$key])) {
2068
+	    clean_string($_POST[$key], $filter);
2069
+	}
2070
+	if(isset($_REQUEST[$key])) {
2071
+	    clean_string($_REQUEST[$key], $filter);
2072
+	}
2073
+	}
2031 2074
 
2032 2075
 function set_superglobals($key, $val){
2033 2076
 	$_GET[$key] = $val;
@@ -2068,25 +2111,51 @@  discard block
 block discarded – undo
2068 2111
         //get translated, so scrub the data but don't die
2069 2112
 	    if(ini_get('mbstring.encoding_translation')==='1'){
2070 2113
             securexsskey($k,false);
2071
-        }else{
2114
+        } else{
2072 2115
 		    securexsskey($k,true);
2073 2116
         }
2074 2117
 
2075 2118
 	}
2076 2119
 	// Any additional variables that need to be cleaned should be added here
2077
-	if (isset($_REQUEST['login_theme'])) clean_string($_REQUEST['login_theme']);
2078
-	if (isset($_REQUEST['login_module'])) clean_string($_REQUEST['login_module']);
2079
-	if (isset($_REQUEST['login_action'])) clean_string($_REQUEST['login_action']);
2080
-	if (isset($_REQUEST['login_language'])) clean_string($_REQUEST['login_language']);
2081
-	if (isset($_REQUEST['action'])) clean_string($_REQUEST['action']);
2082
-	if (isset($_REQUEST['module'])) clean_string($_REQUEST['module']);
2083
-	if (isset($_REQUEST['record'])) clean_string($_REQUEST['record'], 'STANDARDSPACE');
2084
-	if (isset($_SESSION['authenticated_user_theme'])) clean_string($_SESSION['authenticated_user_theme']);
2085
-	if (isset($_SESSION['authenticated_user_language'])) clean_string($_SESSION['authenticated_user_language']);
2086
-	if (isset($_REQUEST['language'])) clean_string($_REQUEST['language']);
2087
-	if (isset($sugar_config['default_theme'])) clean_string($sugar_config['default_theme']);
2088
-	if (isset($_REQUEST['offset'])) clean_string($_REQUEST['offset']);
2089
-	if (isset($_REQUEST['stamp'])) clean_string($_REQUEST['stamp']);
2120
+	if (isset($_REQUEST['login_theme'])) {
2121
+	    clean_string($_REQUEST['login_theme']);
2122
+	}
2123
+	if (isset($_REQUEST['login_module'])) {
2124
+	    clean_string($_REQUEST['login_module']);
2125
+	}
2126
+	if (isset($_REQUEST['login_action'])) {
2127
+	    clean_string($_REQUEST['login_action']);
2128
+	}
2129
+	if (isset($_REQUEST['login_language'])) {
2130
+	    clean_string($_REQUEST['login_language']);
2131
+	}
2132
+	if (isset($_REQUEST['action'])) {
2133
+	    clean_string($_REQUEST['action']);
2134
+	}
2135
+	if (isset($_REQUEST['module'])) {
2136
+	    clean_string($_REQUEST['module']);
2137
+	}
2138
+	if (isset($_REQUEST['record'])) {
2139
+	    clean_string($_REQUEST['record'], 'STANDARDSPACE');
2140
+	}
2141
+	if (isset($_SESSION['authenticated_user_theme'])) {
2142
+	    clean_string($_SESSION['authenticated_user_theme']);
2143
+	}
2144
+	if (isset($_SESSION['authenticated_user_language'])) {
2145
+	    clean_string($_SESSION['authenticated_user_language']);
2146
+	}
2147
+	if (isset($_REQUEST['language'])) {
2148
+	    clean_string($_REQUEST['language']);
2149
+	}
2150
+	if (isset($sugar_config['default_theme'])) {
2151
+	    clean_string($sugar_config['default_theme']);
2152
+	}
2153
+	if (isset($_REQUEST['offset'])) {
2154
+	    clean_string($_REQUEST['offset']);
2155
+	}
2156
+	if (isset($_REQUEST['stamp'])) {
2157
+	    clean_string($_REQUEST['stamp']);
2158
+	}
2090 2159
 
2091 2160
 	if(isset($_REQUEST['lvso'])){
2092 2161
 			set_superglobals('lvso', (strtolower($_REQUEST['lvso']) === 'desc')?'desc':'asc');
@@ -2096,8 +2165,7 @@  discard block
 block discarded – undo
2096 2165
 		if (str_end($key, "_offset")) {
2097 2166
 			clean_string($_REQUEST[$key], "ALPHANUM"); // keep this ALPHANUM for disable_count_query
2098 2167
 			set_superglobals($key, $_REQUEST[$key]);
2099
-		}
2100
-		elseif (str_end($key, "_ORDER_BY")) {
2168
+		} elseif (str_end($key, "_ORDER_BY")) {
2101 2169
 			clean_string($_REQUEST[$key], "SQL_COLUMN_LIST");
2102 2170
 			set_superglobals($key, $_REQUEST[$key]);
2103 2171
 		}
@@ -2138,7 +2206,7 @@  discard block
 block discarded – undo
2138 2206
 	if(!empty($matches)){
2139 2207
 		if($die){
2140 2208
 			die("Bad data passed in; <a href=\"{$sugar_config['site_url']}\">Return to Home</a>");
2141
-		}else{
2209
+		} else{
2142 2210
 			unset($_REQUEST[$value]);
2143 2211
 			unset($_POST[$value]);
2144 2212
 			unset($_GET[$value]);
@@ -2153,8 +2221,7 @@  discard block
 block discarded – undo
2153 2221
 		}
2154 2222
 
2155 2223
 		$value = securexss($value);
2156
-	}
2157
-	else if (is_array($value)){
2224
+	} else if (is_array($value)){
2158 2225
 	    foreach ($value as $key => $element) {
2159 2226
 	        $value[$key] = preprocess_param($element);
2160 2227
 	    }
@@ -2165,7 +2232,9 @@  discard block
 block discarded – undo
2165 2232
 
2166 2233
 function cleanup_slashes($value)
2167 2234
 {
2168
-    if(is_string($value)) return stripslashes($value);
2235
+    if(is_string($value)) {
2236
+        return stripslashes($value);
2237
+    }
2169 2238
     return $value;
2170 2239
 }
2171 2240
 
@@ -2210,18 +2279,26 @@  discard block
 block discarded – undo
2210 2279
 
2211 2280
 function getWebPath($relative_path){
2212 2281
 	//if it has  a :// then it isn't a relative path
2213
-	if(substr_count($relative_path, '://') > 0) return $relative_path;
2214
-	if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2282
+	if(substr_count($relative_path, '://') > 0) {
2283
+	    return $relative_path;
2284
+	}
2285
+	if(defined('TEMPLATE_URL')) {
2286
+	    $relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2287
+	}
2215 2288
 	return $relative_path;
2216 2289
 }
2217 2290
 
2218 2291
 function getVersionedPath($path, $additional_attrs='')
2219 2292
 {
2220
-	if(empty($GLOBALS['sugar_config']['js_custom_version'])) $GLOBALS['sugar_config']['js_custom_version'] = 1;
2293
+	if(empty($GLOBALS['sugar_config']['js_custom_version'])) {
2294
+	    $GLOBALS['sugar_config']['js_custom_version'] = 1;
2295
+	}
2221 2296
 	$js_version_key = isset($GLOBALS['js_version_key'])?$GLOBALS['js_version_key']:'';
2222 2297
 	if(inDeveloperMode()) {
2223 2298
 	    static $rand;
2224
-	    if(empty($rand)) $rand = mt_rand();
2299
+	    if(empty($rand)) {
2300
+	        $rand = mt_rand();
2301
+	    }
2225 2302
 	    $dev = $rand;
2226 2303
 	} else {
2227 2304
 	    $dev = '';
@@ -2233,7 +2310,9 @@  discard block
 block discarded – undo
2233 2310
 	$str = substr(base64_encode(md5("$js_version_key|{$GLOBALS['sugar_config']['js_custom_version']}|$dev|$additional_attrs", true)), 0, -2);
2234 2311
 	// remove / - it confuses some parsers
2235 2312
 	$str = strtr($str, '/+', '-_');
2236
-	if(empty($path)) return $str;
2313
+	if(empty($path)) {
2314
+	    return $str;
2315
+	}
2237 2316
 
2238 2317
 	return $path . "?v=$str";
2239 2318
 }
@@ -2245,7 +2324,9 @@  discard block
 block discarded – undo
2245 2324
 
2246 2325
 function getJSPath($relative_path, $additional_attrs='')
2247 2326
 {
2248
-	if(defined('TEMPLATE_URL'))$relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2327
+	if(defined('TEMPLATE_URL')) {
2328
+	    $relative_path = SugarTemplateUtilities::getWebPath($relative_path);
2329
+	}
2249 2330
 	return getVersionedPath($relative_path).(!empty($additional_attrs)?"&$additional_attrs":"");
2250 2331
 }
2251 2332
 
@@ -2277,8 +2358,7 @@  discard block
 block discarded – undo
2277 2358
 			$match[1] = "0".$match[1];
2278 2359
 		}
2279 2360
 		return "{$match[3]}-{$match[1]}-{$match[2]}";
2280
-	}
2281
-	else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match))
2361
+	} else if (preg_match('/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/',$date_str,$match))
2282 2362
 	{
2283 2363
 		if ( strlen($match[2]) == 1)
2284 2364
 		{
@@ -2289,8 +2369,7 @@  discard block
 block discarded – undo
2289 2369
 			$match[1] = "0".$match[1];
2290 2370
 		}
2291 2371
 		return "{$match[3]}-{$match[1]}-{$match[2]}";
2292
-	}
2293
-	else
2372
+	} else
2294 2373
 	{
2295 2374
 		return "";
2296 2375
 	}
@@ -2347,10 +2426,12 @@  discard block
 block discarded – undo
2347 2426
 			}
2348 2427
 			$bean->update_date_modified = false;
2349 2428
             $bean->update_modified_by = false;
2350
-            if(isset($bean->date_modified))
2351
-                $bean->date_modified = $timedate->to_db($bean->date_modified);
2352
-            if(isset($bean->date_entered))
2353
-                $bean->date_entered = $timedate->to_db($bean->date_entered);
2429
+            if(isset($bean->date_modified)) {
2430
+                            $bean->date_modified = $timedate->to_db($bean->date_modified);
2431
+            }
2432
+            if(isset($bean->date_entered)) {
2433
+                            $bean->date_entered = $timedate->to_db($bean->date_entered);
2434
+            }
2354 2435
 			//save
2355 2436
 			$new_id=$bean->save();
2356 2437
 
@@ -2673,7 +2754,7 @@  discard block
 block discarded – undo
2673 2754
 	//no error notice - lets just display the error to the user
2674 2755
 	if(!isset($error_notice)){
2675 2756
 		echo '<br>'.$msg . '<br>';
2676
-	}else{
2757
+	} else{
2677 2758
 		$error_notice .= $msg . '<br>';
2678 2759
 	}
2679 2760
 }
@@ -2717,10 +2798,9 @@  discard block
 block discarded – undo
2717 2798
 
2718 2799
 		if(ord(substr($str, $i, 1))==10){
2719 2800
 			$new_str .= '\n';
2720
-		}elseif(ord(substr($str, $i, 1))==13){
2801
+		} elseif(ord(substr($str, $i, 1))==13){
2721 2802
 			$new_str .= '\r';
2722
-		}
2723
-		else {
2803
+		} else {
2724 2804
 			$new_str .= $str{$i};
2725 2805
 		}
2726 2806
 	}
@@ -2735,8 +2815,7 @@  discard block
 block discarded – undo
2735 2815
 
2736 2816
 	if($keep){
2737 2817
 		$str = javascript_escape($str);
2738
-	}
2739
-	else {
2818
+	} else {
2740 2819
 		$str = str_replace("'", " ", $str);
2741 2820
 		$str = str_replace('"', " ", $str);
2742 2821
 	}
@@ -2931,8 +3010,9 @@  discard block
 block discarded – undo
2931 3010
 
2932 3011
 	$server_software = $_SERVER["SERVER_SOFTWARE"];
2933 3012
 	$iis_version = '';
2934
-	if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/",  $server_software, $out))
2935
-	    $iis_version = $out[1][0];
3013
+	if(strpos($server_software,'Microsoft-IIS') !== false && preg_match_all("/^.*\/(\d+\.?\d*)$/",  $server_software, $out)) {
3014
+		    $iis_version = $out[1][0];
3015
+	}
2936 3016
 
2937 3017
     $sys_iis_version = empty($sys_iis_version) ? $iis_version : $sys_iis_version;
2938 3018
 
@@ -3008,7 +3088,9 @@  discard block
 block discarded – undo
3008 3088
 
3009 3089
 function sugar_cleanup($exit = false) {
3010 3090
 	static $called = false;
3011
-	if($called)return;
3091
+	if($called) {
3092
+	    return;
3093
+	}
3012 3094
 	$called = true;
3013 3095
 	set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path());
3014 3096
 	chdir(realpath(dirname(__FILE__) . '/..'));
@@ -3019,7 +3101,11 @@  discard block
 block discarded – undo
3019 3101
 
3020 3102
 	//added this check to avoid errors during install.
3021 3103
 	if (empty($sugar_config['dbconfig'])) {
3022
-		if ($exit) exit; else return;
3104
+		if ($exit) {
3105
+		    exit;
3106
+		} else {
3107
+		    return;
3108
+		}
3023 3109
 	}
3024 3110
 
3025 3111
     if (!class_exists('Tracker', true)) {
@@ -3028,8 +3114,9 @@  discard block
 block discarded – undo
3028 3114
 	Tracker::logPage();
3029 3115
 	// Now write the cached tracker_queries
3030 3116
 	if(!empty($GLOBALS['savePreferencesToDB']) && $GLOBALS['savePreferencesToDB']) {
3031
-	    if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User )
3032
-	        $GLOBALS['current_user']->savePreferencesToDB();
3117
+	    if ( isset($GLOBALS['current_user']) && $GLOBALS['current_user'] instanceOf User ) {
3118
+	    	        $GLOBALS['current_user']->savePreferencesToDB();
3119
+	    }
3033 3120
 	}
3034 3121
 
3035 3122
 	//check to see if this is not an `ajax call AND the user preference error flag is set
@@ -3154,8 +3241,9 @@  discard block
 block discarded – undo
3154 3241
 
3155 3242
 	echo "\n\n display_stack_trace caller, file: " . $stack[0]['file']. ' line#: ' .$stack[0]['line'];
3156 3243
 
3157
-	if(!$textOnly)
3158
-	echo '<br>';
3244
+	if(!$textOnly) {
3245
+		echo '<br>';
3246
+	}
3159 3247
 
3160 3248
 	$first = true;
3161 3249
 	$out = '';
@@ -3166,14 +3254,18 @@  discard block
 block discarded – undo
3166 3254
 		$line  = '';
3167 3255
 		$function  = '';
3168 3256
 
3169
-		if(isset($item['file']))
3170
-		$file = $item['file'];
3171
-		if(isset($item['class']))
3172
-		$class = $item['class'];
3173
-		if(isset($item['line']))
3174
-		$line = $item['line'];
3175
-		if(isset($item['function']))
3176
-		$function = $item['function'];
3257
+		if(isset($item['file'])) {
3258
+				$file = $item['file'];
3259
+		}
3260
+		if(isset($item['class'])) {
3261
+				$class = $item['class'];
3262
+		}
3263
+		if(isset($item['line'])) {
3264
+				$line = $item['line'];
3265
+		}
3266
+		if(isset($item['function'])) {
3267
+				$function = $item['function'];
3268
+		}
3177 3269
 
3178 3270
 		if(!$first) {
3179 3271
 			if(!$textOnly) {
@@ -3217,9 +3309,9 @@  discard block
 block discarded – undo
3217 3309
 		    if ( error_reporting() & E_NOTICE ) {
3218 3310
 		        $halt_script = false;
3219 3311
 		        $type = 'Notice';
3312
+		    } else {
3313
+		    		        return;
3220 3314
 		    }
3221
-		    else
3222
-		        return;
3223 3315
 			break;
3224 3316
 		case E_USER_WARNING:
3225 3317
 		case E_COMPILE_WARNING:
@@ -3367,14 +3459,16 @@  discard block
 block discarded – undo
3367 3459
 	$file = str_replace("/", '\\', $file);
3368 3460
 
3369 3461
 	if(file_exists($file)) {
3370
-		if (!($f = @sugar_fopen($file, 'r+')))
3371
-		return false;
3462
+		if (!($f = @sugar_fopen($file, 'r+'))) {
3463
+				return false;
3464
+		}
3372 3465
 		fclose($f);
3373 3466
 		return true;
3374 3467
 	}
3375 3468
 
3376
-	if(!($f = @sugar_fopen($file, 'w')))
3377
-	return false;
3469
+	if(!($f = @sugar_fopen($file, 'w'))) {
3470
+		return false;
3471
+	}
3378 3472
 	fclose($f);
3379 3473
 	unlink($file);
3380 3474
 	return true;
@@ -3393,7 +3487,9 @@  discard block
 block discarded – undo
3393 3487
 	global $beanList;
3394 3488
 
3395 3489
 	foreach($module_array as $key => $value){
3396
-		if(!empty($beanList[$value])) $module_array[$key] = $beanList[$value];
3490
+		if(!empty($beanList[$value])) {
3491
+		    $module_array[$key] = $beanList[$value];
3492
+		}
3397 3493
 
3398 3494
 		if($value=="Cases") {
3399 3495
 			$module_array[$key] = "Case";
@@ -3417,8 +3513,7 @@  discard block
 block discarded – undo
3417 3513
 	global $beanFiles, $beanList;
3418 3514
 	if(array_key_exists($bean_name, $beanList)){
3419 3515
 		return $beanList[$bean_name];
3420
-	}
3421
-	else{
3516
+	} else{
3422 3517
 		return $bean_name;
3423 3518
 	}
3424 3519
 }
@@ -3692,8 +3787,7 @@  discard block
 block discarded – undo
3692 3787
 		$num=unformat_number($num);
3693 3788
 		if(isset($system_id) && $system_id == 1){
3694 3789
 			return sprintf("%d", $num);
3695
-		}
3696
-		else{
3790
+		} else{
3697 3791
 			return sprintf("%d-%d", $num, $system_id);
3698 3792
 		}
3699 3793
 	}
@@ -3720,8 +3814,7 @@  discard block
 block discarded – undo
3720 3814
 		{
3721 3815
 			//third index ($split[2]) will be the host
3722 3816
 			$split[2] .= ":".$port;
3723
-		}
3724
-		else // otherwise assumed to start with host name
3817
+		} else // otherwise assumed to start with host name
3725 3818
 		{
3726 3819
 			//first index ($split[0]) will be the host
3727 3820
 			$split[0] .= ":".$port;
@@ -3797,19 +3890,19 @@  discard block
 block discarded – undo
3797 3890
 				if(is_array($domVal))
3798 3891
                 {
3799 3892
 					$tempArr = array();
3800
-                    foreach ( $domVal as $domArrKey => $domArrVal )
3801
-                        $tempArr[$domArrKey] = $domArrVal;
3802
-                    foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal )
3803
-                        if ( !isset($tempArr[$gimpArrKey]) )
3893
+                    foreach ( $domVal as $domArrKey => $domArrVal ) {
3894
+                                            $tempArr[$domArrKey] = $domArrVal;
3895
+                    }
3896
+                    foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) {
3897
+                                            if ( !isset($tempArr[$gimpArrKey]) )
3804 3898
                             $tempArr[$gimpArrKey] = $gimpArrVal;
3899
+                    }
3805 3900
                     $gimp[$domKey] = $tempArr;
3806
-				}
3807
-                else
3901
+				} else
3808 3902
                 {
3809 3903
 					$gimp[$domKey] = $domVal;
3810 3904
 				}
3811
-			}
3812
-            else
3905
+			} else
3813 3906
             {
3814 3907
 				$gimp[$domKey] = $domVal;
3815 3908
 			}
@@ -3843,11 +3936,13 @@  discard block
 block discarded – undo
3843 3936
 			if(array_key_exists($domKey, $gimp)) {
3844 3937
 				if(is_array($domVal)) {
3845 3938
 					$tempArr = array();
3846
-                    foreach ( $domVal as $domArrKey => $domArrVal )
3847
-                        $tempArr[$domArrKey] = $domArrVal;
3848
-                    foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal )
3849
-                        if ( !array_key_exists($gimpArrKey, $tempArr) )
3939
+                    foreach ( $domVal as $domArrKey => $domArrVal ) {
3940
+                                            $tempArr[$domArrKey] = $domArrVal;
3941
+                    }
3942
+                    foreach ( $gimp[$domKey] as $gimpArrKey => $gimpArrVal ) {
3943
+                                            if ( !array_key_exists($gimpArrKey, $tempArr) )
3850 3944
                             $tempArr[$gimpArrKey] = $gimpArrVal;
3945
+                    }
3851 3946
                     $gimp[$domKey] = $tempArr;
3852 3947
 				} else {
3853 3948
 					$gimp[$domKey] = $domVal;
@@ -3858,8 +3953,9 @@  discard block
 block discarded – undo
3858 3953
 		}
3859 3954
 	}
3860 3955
     // if the passed value for gimp isn't an array, then return the $dom
3861
-    elseif(is_array($dom))
3862
-        return $dom;
3956
+    elseif(is_array($dom)) {
3957
+            return $dom;
3958
+    }
3863 3959
 
3864 3960
 	return $gimp;
3865 3961
 }
@@ -3886,8 +3982,9 @@  discard block
 block discarded – undo
3886 3982
 		}
3887 3983
 	}
3888 3984
     // if the passed value for gimp isn't an array, then return the $dom
3889
-    elseif(is_array($dom))
3890
-        return $dom;
3985
+    elseif(is_array($dom)) {
3986
+            return $dom;
3987
+    }
3891 3988
 
3892 3989
 	return $gimp;
3893 3990
 }
@@ -4042,8 +4139,7 @@  discard block
 block discarded – undo
4042 4139
 
4043 4140
 	if( write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
4044 4141
 		return true;
4045
-	}
4046
-	else {
4142
+	} else {
4047 4143
 		return false;
4048 4144
 	}
4049 4145
 }
@@ -4076,8 +4172,9 @@  discard block
 block discarded – undo
4076 4172
 	if(!empty($_SERVER['HTTP_REFERER'])) {
4077 4173
 		$url = parse_url($_SERVER['HTTP_REFERER']);
4078 4174
 		$replacement_url = $url['scheme']."://".$url['host'];
4079
-		if(!empty($url['port']))
4080
-		$replacement_url .= ':'.$url['port'];
4175
+		if(!empty($url['port'])) {
4176
+				$replacement_url .= ':'.$url['port'];
4177
+		}
4081 4178
 		$site_url = preg_replace('/^http[s]?\:\/\/[^\/]+/',$replacement_url,$sugar_config['site_url']);
4082 4179
 	} else {
4083 4180
 		$site_url = preg_replace('/^http(s)?\:\/\/[^\/]+/',"http$1://".$_SERVER['HTTP_HOST'],$sugar_config['site_url']);
@@ -4102,8 +4199,7 @@  discard block
 block discarded – undo
4102 4199
 		foreach ($array as $key => $value){
4103 4200
 			$depth_array[] = array_depth($value, $depth_count);
4104 4201
 		}
4105
-	}
4106
-	else{
4202
+	} else{
4107 4203
 		return $depth_count;
4108 4204
 	}
4109 4205
 	foreach ($depth_array as $value){
@@ -4146,17 +4242,20 @@  discard block
 block discarded – undo
4146 4242
     $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4147 4243
 
4148 4244
     //First try un-ucfirst-ing the icon name
4149
-    if ( empty($iconFound) )
4150
-		$iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif";
4245
+    if ( empty($iconFound) ) {
4246
+    		$iconName = "icon_" . strtolower(substr($iconFileName,0,1)).substr($iconFileName,1) . ".gif";
4247
+    }
4151 4248
         $iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4152 4249
 
4153 4250
 	//Next try removing the icon prefix
4154
-    if ( empty($iconFound) )
4155
-		$iconName = "{$iconFileName}.gif";
4251
+    if ( empty($iconFound) ) {
4252
+    		$iconName = "{$iconFileName}.gif";
4253
+    }
4156 4254
 		$iconFound = SugarThemeRegistry::current()->getImageURL($iconName,false);
4157 4255
 
4158
-	if ( empty($iconFound) )
4159
-		$iconName = '';
4256
+	if ( empty($iconFound) ) {
4257
+			$iconName = '';
4258
+	}
4160 4259
 
4161 4260
   	return $iconName;
4162 4261
 }
@@ -4222,8 +4321,9 @@  discard block
 block discarded – undo
4222 4321
     if (!isset($trans_tbl))
4223 4322
     {
4224 4323
         $trans_tbl = array();
4225
-        foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key)
4226
-            $trans_tbl[$key] = utf8_encode($val);
4324
+        foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) {
4325
+                    $trans_tbl[$key] = utf8_encode($val);
4326
+        }
4227 4327
     }
4228 4328
     return strtr($string, $trans_tbl);
4229 4329
 }
@@ -4231,10 +4331,18 @@  discard block
 block discarded – undo
4231 4331
 // Returns the utf string corresponding to the unicode value
4232 4332
 function code2utf($num)
4233 4333
 {
4234
-    if ($num < 128) return chr($num);
4235
-    if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
4236
-    if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
4237
-    if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
4334
+    if ($num < 128) {
4335
+        return chr($num);
4336
+    }
4337
+    if ($num < 2048) {
4338
+        return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
4339
+    }
4340
+    if ($num < 65536) {
4341
+        return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
4342
+    }
4343
+    if ($num < 2097152) {
4344
+        return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
4345
+    }
4238 4346
     return '';
4239 4347
 }
4240 4348
 
@@ -4287,8 +4395,9 @@  discard block
 block discarded – undo
4287 4395
  */
4288 4396
 function chartColors()
4289 4397
 {
4290
-	if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='')
4291
-	return SugarThemeRegistry::current()->getImageURL('sugarColors.xml');
4398
+	if (SugarThemeRegistry::current()->getCSSURL('sugarColors.xml')=='') {
4399
+		return SugarThemeRegistry::current()->getImageURL('sugarColors.xml');
4400
+	}
4292 4401
     return SugarThemeRegistry::current()->getCSSURL('sugarColors.xml');
4293 4402
 }
4294 4403
 /* End Chart Dashlet helper functions */
@@ -4319,8 +4428,9 @@  discard block
 block discarded – undo
4319 4428
     if ( ( substr($path,0,2) == '\\\\' )
4320 4429
             || ( $path[0] == '/' )
4321 4430
             || preg_match('/^[A-z]:/i',$path)
4322
-            || $currentServer )
4323
-        return $path;
4431
+            || $currentServer ) {
4432
+            return $path;
4433
+    }
4324 4434
 
4325 4435
     return getcwd().'/'.$path;
4326 4436
 }
@@ -4367,8 +4477,9 @@  discard block
 block discarded – undo
4367 4477
  */
4368 4478
 function get_alt_hot_key() {
4369 4479
 	$ua = '';
4370
-    if ( isset($_SERVER['HTTP_USER_AGENT']) )
4371
-        $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
4480
+    if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
4481
+            $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
4482
+    }
4372 4483
 	$isMac = strpos($ua, 'mac') !== false;
4373 4484
 	$isLinux = strpos($ua, 'linux') !== false;
4374 4485
 
@@ -4412,11 +4523,12 @@  discard block
 block discarded – undo
4412 4523
 {
4413 4524
     if ( !isset($GLOBALS['sugar_config']['allow_pop_inbound']) || ! $GLOBALS['sugar_config']['allow_pop_inbound'] )
4414 4525
     {
4415
-        if( isset($protocol['pop3']) )
4416
-			unset($protocol['pop3']);
4526
+        if( isset($protocol['pop3']) ) {
4527
+        			unset($protocol['pop3']);
4528
+        }
4529
+    } else {
4530
+            $protocol['pop3'] = 'POP3';
4417 4531
     }
4418
-    else
4419
-        $protocol['pop3'] = 'POP3';
4420 4532
 
4421 4533
     return $protocol;
4422 4534
 }
@@ -4460,11 +4572,13 @@  discard block
 block discarded – undo
4460 4572
 }
4461 4573
 
4462 4574
 function encodeMultienumValue($arr) {
4463
-    if (!is_array($arr))
4464
-        return $arr;
4575
+    if (!is_array($arr)) {
4576
+            return $arr;
4577
+    }
4465 4578
 
4466
-    if (empty($arr))
4467
-        return "";
4579
+    if (empty($arr)) {
4580
+            return "";
4581
+    }
4468 4582
 
4469 4583
 	$string = "^" . implode('^,^', $arr) . "^";
4470 4584
 
@@ -4496,16 +4610,14 @@  discard block
 block discarded – undo
4496 4610
 			if(empty($join_type))
4497 4611
 			{
4498 4612
 				$params['join_type'] = ' LEFT JOIN ';
4499
-			}
4500
-			else
4613
+			} else
4501 4614
 			{
4502 4615
 				$params['join_type'] = $join_type;
4503 4616
 			}
4504 4617
 			if(isset($data['join_name']))
4505 4618
 			{
4506 4619
 				$params['join_table_alias'] = $field['join_name'];
4507
-			}
4508
-			else
4620
+			} else
4509 4621
 			{
4510 4622
 				$params['join_table_alias']	= 'join_'.$field['name'];
4511 4623
 
@@ -4513,8 +4625,7 @@  discard block
 block discarded – undo
4513 4625
 			if(isset($data['join_link_name']))
4514 4626
 			{
4515 4627
 				$params['join_table_link_alias'] = $field['join_link_name'];
4516
-			}
4517
-			else
4628
+			} else
4518 4629
 			{
4519 4630
 				$params['join_table_link_alias'] = 'join_link_'.$field['name'];
4520 4631
 			}
@@ -4523,7 +4634,7 @@  discard block
 block discarded – undo
4523 4634
 			if(isset($field['db_concat_fields'])){
4524 4635
 				$db_field = db_concat($join_table_alias, $field['db_concat_fields']);
4525 4636
 				$where = preg_replace('/'.$field['name'].'/', $db_field, $where);
4526
-			}else{
4637
+			} else{
4527 4638
 				$where = preg_replace('/(^|[\s(])' . $field['name'] . '/', '${1}' . $join_table_alias . '.'.$field['rname'], $where);
4528 4639
 			}
4529 4640
 		}
@@ -4558,8 +4669,7 @@  discard block
 block discarded – undo
4558 4669
 	$number = preg_match("/{$variable}=([a-zA-Z0-9_-]+)[&]?/", $string, $matches);
4559 4670
 	if($number){
4560 4671
 		return $matches[1];
4561
-	}
4562
-	else{
4672
+	} else{
4563 4673
 		return false;
4564 4674
 	}
4565 4675
 }
@@ -4591,7 +4701,7 @@  discard block
 block discarded – undo
4591 4701
 function getVersionStatus($version){
4592 4702
 	if(preg_match('/^[\d\.]+?([a-zA-Z]+?)[\d]*?$/si', $version, $matches)) {
4593 4703
 		return strtoupper($matches[1]);
4594
-	}else{
4704
+	} else{
4595 4705
 		return 'GA';
4596 4706
 	}
4597 4707
 }
@@ -4686,7 +4796,9 @@  discard block
 block discarded – undo
4686 4796
 	} else {
4687 4797
 	    // check image manually
4688 4798
         $fp = fopen($path, "rb");
4689
-        if(!$fp) return false;
4799
+        if(!$fp) {
4800
+            return false;
4801
+        }
4690 4802
         $data = '';
4691 4803
         // read the whole file in chunks
4692 4804
         while(!feof($fp)) {
@@ -4778,8 +4890,9 @@  discard block
 block discarded – undo
4778 4890
     // add wildcard at the beginning of the search string
4779 4891
     if (isset($GLOBALS['sugar_config']['search_wildcard_infront']) &&
4780 4892
         $GLOBALS['sugar_config']['search_wildcard_infront'] == true) {
4781
-        if (substr($str,0,1) <> $wildcard)
4782
-          $str = $wildcard.$str;
4893
+        if (substr($str,0,1) <> $wildcard) {
4894
+                  $str = $wildcard.$str;
4895
+        }
4783 4896
     }
4784 4897
 
4785 4898
     // add wildcard at the end of search string (default)
@@ -4834,8 +4947,7 @@  discard block
 block discarded – undo
4834 4947
 {
4835 4948
     if (isset($GLOBALS['app_list_strings'][$optionName])) {
4836 4949
         return $GLOBALS['app_list_strings'][$optionName];
4837
-    }
4838
-    else {
4950
+    } else {
4839 4951
         return array();
4840 4952
     }
4841 4953
 }
@@ -5085,47 +5197,53 @@  discard block
 block discarded – undo
5085 5197
 
5086 5198
 function suite_strlen($input, $encoding = DEFAULT_UTIL_SUITE_ENCODING)
5087 5199
 {
5088
-	if(function_exists('mb_strlen'))
5089
-		return mb_strlen($input,$encoding);
5090
-	else
5091
-		return strlen($input);
5092
-}
5200
+	if(function_exists('mb_strlen')) {
5201
+			return mb_strlen($input,$encoding);
5202
+	} else {
5203
+			return strlen($input);
5204
+	}
5205
+	}
5093 5206
 
5094 5207
 function suite_substr($input, $start, $length = null,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5095 5208
 {
5096
-	if(function_exists('mb_substr'))
5097
-		return mb_substr($input,$start,$length,$encoding);
5098
-	else
5099
-		return substr($input,$start,$length);
5100
-}
5209
+	if(function_exists('mb_substr')) {
5210
+			return mb_substr($input,$start,$length,$encoding);
5211
+	} else {
5212
+			return substr($input,$start,$length);
5213
+	}
5214
+	}
5101 5215
 
5102 5216
 function suite_strtoupper($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5103 5217
 {
5104
-	if(function_exists('mb_strtoupper'))
5105
-		return mb_strtoupper($input,$encoding);
5106
-	else
5107
-		return strtoupper($input);
5108
-}
5218
+	if(function_exists('mb_strtoupper')) {
5219
+			return mb_strtoupper($input,$encoding);
5220
+	} else {
5221
+			return strtoupper($input);
5222
+	}
5223
+	}
5109 5224
 function suite_strtolower($input,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5110 5225
 {
5111
-	if(function_exists('mb_strtolower'))
5112
-		return mb_strtolower($input,$encoding);
5113
-	else
5114
-		return strtolower($input);
5115
-}
5226
+	if(function_exists('mb_strtolower')) {
5227
+			return mb_strtolower($input,$encoding);
5228
+	} else {
5229
+			return strtolower($input);
5230
+	}
5231
+	}
5116 5232
 
5117 5233
 function suite_strpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5118 5234
 {
5119
-	if(function_exists('mb_strpos'))
5120
-		return mb_strpos($haystack,$needle,$offset,$encoding);
5121
-	else
5122
-		return strpos($haystack,$needle,$offset);
5123
-}
5235
+	if(function_exists('mb_strpos')) {
5236
+			return mb_strpos($haystack,$needle,$offset,$encoding);
5237
+	} else {
5238
+			return strpos($haystack,$needle,$offset);
5239
+	}
5240
+	}
5124 5241
 
5125 5242
 function suite_strrpos($haystack,$needle,$offset=0,$encoding = DEFAULT_UTIL_SUITE_ENCODING)
5126 5243
 {
5127
-	if(function_exists('mb_strrpos'))
5128
-		return mb_strrpos($haystack,$needle,$offset,$encoding);
5129
-	else
5130
-		return strrpos($haystack,$needle,$offset);
5131
-}
5132 5244
\ No newline at end of file
5245
+	if(function_exists('mb_strrpos')) {
5246
+			return mb_strrpos($haystack,$needle,$offset,$encoding);
5247
+	} else {
5248
+			return strrpos($haystack,$needle,$offset);
5249
+	}
5250
+	}
5133 5251
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +73 added lines, -7 removed lines patch added patch discarded remove patch
@@ -829,6 +829,7 @@  discard block
 block discarded – undo
829 829
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
830 830
  * All Rights Reserved.
831 831
  * Contributor(s): ______________________________________..
832
+ * @param boolean $always_copy
832 833
  */
833 834
 function safe_map_named($request_var, & $focus, $member_var, $always_copy)
834 835
 {
@@ -1248,6 +1249,7 @@  discard block
 block discarded – undo
1248 1249
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
1249 1250
  * All Rights Reserved.
1250 1251
  * Contributor(s): ______________________________________..
1252
+ * @param string $varname
1251 1253
  */
1252 1254
 function return_session_value_or_default($varname, $default)
1253 1255
 {
@@ -1358,6 +1360,9 @@  discard block
 block discarded – undo
1358 1360
 
1359 1361
 }
1360 1362
 
1363
+/**
1364
+ * @param integer $characters
1365
+ */
1361 1366
 function create_guid_section($characters)
1362 1367
 {
1363 1368
 	$return = "";
@@ -1368,6 +1373,10 @@  discard block
 block discarded – undo
1368 1373
 	return $return;
1369 1374
 }
1370 1375
 
1376
+/**
1377
+ * @param string $string
1378
+ * @param integer $length
1379
+ */
1371 1380
 function ensure_length(&$string, $length)
1372 1381
 {
1373 1382
 	$strlen = strlen($string);
@@ -1475,6 +1484,9 @@  discard block
 block discarded – undo
1475 1484
 
1476 1485
 
1477 1486
 // Check if user is admin for a specific module.
1487
+/**
1488
+ * @param string $module
1489
+ */
1478 1490
 function is_admin_for_module($user,$module) {
1479 1491
     if (!isset($user)) {
1480 1492
         return false;
@@ -1535,6 +1547,7 @@  discard block
 block discarded – undo
1535 1547
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
1536 1548
  * All Rights Reserved.
1537 1549
  * Contributor(s): ______________________________________..
1550
+ * @param string $selected
1538 1551
  */
1539 1552
 function get_select_options ($option_list, $selected) {
1540 1553
 	return get_select_options_with_id($option_list, $selected);
@@ -1822,7 +1835,7 @@  discard block
 block discarded – undo
1822 1835
 
1823 1836
 /**
1824 1837
  * returns a default array of XSS tags to clean
1825
- * @return array
1838
+ * @return string
1826 1839
  */
1827 1840
 function getDefaultXssTags() {
1828 1841
 	$tmp = array(
@@ -1849,6 +1862,7 @@  discard block
 block discarded – undo
1849 1862
 /**
1850 1863
  * Remove potential xss vectors from strings
1851 1864
  * @param string str String to search for XSS attack vectors
1865
+ * @param string $str
1852 1866
  * @deprecated
1853 1867
  * @return string
1854 1868
  */
@@ -1862,6 +1876,7 @@  discard block
 block discarded – undo
1862 1876
  * @deprecated
1863 1877
  * @param string str String to search for XSS attack vectors
1864 1878
  * @param bool cleanImg Flag to allow <img> tags to survive - only used by InboundEmail for inline images.
1879
+ * @param string $str
1865 1880
  * @return array Array of matches, empty on clean string
1866 1881
  */
1867 1882
 function clean_xss($str, $cleanImg=true) {
@@ -1938,6 +1953,7 @@  discard block
 block discarded – undo
1938 1953
  * Helper function used by clean_xss() to parse for known-bad vectors
1939 1954
  * @param string pattern Regex pattern to use
1940 1955
  * @param string str String to parse for badness
1956
+ * @param string $pattern
1941 1957
  * @return array
1942 1958
  */
1943 1959
 function xss_check_pattern($pattern, $str) {
@@ -2022,6 +2038,7 @@  discard block
 block discarded – undo
2022 2038
 
2023 2039
 /**
2024 2040
  * cleans the given key in superglobals $_GET, $_POST, $_REQUEST
2041
+ * @param string $key
2025 2042
  */
2026 2043
 function clean_superglobals($key, $filter = 'STANDARD') {
2027 2044
 	if(isset($_GET[$key])) clean_string($_GET[$key], $filter);
@@ -2029,6 +2046,9 @@  discard block
 block discarded – undo
2029 2046
 	if(isset($_REQUEST[$key])) clean_string($_REQUEST[$key], $filter);
2030 2047
 }
2031 2048
 
2049
+/**
2050
+ * @param string $key
2051
+ */
2032 2052
 function set_superglobals($key, $val){
2033 2053
 	$_GET[$key] = $val;
2034 2054
 	$_POST[$key] = $val;
@@ -2108,11 +2128,18 @@  discard block
 block discarded – undo
2108 2128
 }
2109 2129
 
2110 2130
 // Returns TRUE if $str begins with $begin
2131
+/**
2132
+ * @param string $begin
2133
+ */
2111 2134
 function str_begin($str, $begin) {
2112 2135
 	return (substr($str, 0, strlen($begin)) == $begin);
2113 2136
 }
2114 2137
 
2115 2138
 // Returns TRUE if $str ends with $end
2139
+/**
2140
+ * @param string $str
2141
+ * @param string $end
2142
+ */
2116 2143
 function str_end($str, $end) {
2117 2144
 	return (substr($str, strlen($str) - strlen($end)) == $end);
2118 2145
 }
@@ -2170,14 +2197,24 @@  discard block
 block discarded – undo
2170 2197
 }
2171 2198
 
2172 2199
 
2200
+/**
2201
+ * @param string $category
2202
+ */
2173 2203
 function set_register_value($category, $name, $value){
2174 2204
     return sugar_cache_put("{$category}:{$name}", $value);
2175 2205
 }
2176 2206
 
2207
+/**
2208
+ * @param string $category
2209
+ */
2177 2210
 function get_register_value($category,$name){
2178 2211
     return sugar_cache_retrieve("{$category}:{$name}");
2179 2212
 }
2180 2213
 
2214
+/**
2215
+ * @param string $category
2216
+ * @param string $name
2217
+ */
2181 2218
 function clear_register_value($category,$name){
2182 2219
     return sugar_cache_clear("{$category}:{$name}");
2183 2220
 }
@@ -2379,6 +2416,11 @@  discard block
 block discarded – undo
2379 2416
 	return $new_array;
2380 2417
 }
2381 2418
 
2419
+/**
2420
+ * @param DBManager $db
2421
+ * @param string $from_column
2422
+ * @param string $to_id
2423
+ */
2382 2424
 function clone_relationship(&$db, $tables = array(), $from_column, $from_id, $to_id)
2383 2425
 {
2384 2426
 	foreach($tables as $table)
@@ -2556,6 +2598,10 @@  discard block
 block discarded – undo
2556 2598
 	return empty($value) && $value != '0';
2557 2599
 }
2558 2600
 
2601
+/**
2602
+ * @param string $bean_name
2603
+ * @param string $display_columns
2604
+ */
2559 2605
 function get_bean_select_array($add_blank=true, $bean_name, $display_columns, $where='', $order_by='', $blank_is_none=false)
2560 2606
 {
2561 2607
 	global $beanFiles;
@@ -2746,6 +2792,11 @@  discard block
 block discarded – undo
2746 2792
 	//end function js_escape
2747 2793
 }
2748 2794
 
2795
+/**
2796
+ * @param string $str
2797
+ *
2798
+ * @return string
2799
+ */
2749 2800
 function br2nl($str) {
2750 2801
 	$regex = "#<[^>]+br.+?>#i";
2751 2802
 	preg_match_all($regex, $str, $matches);
@@ -3265,6 +3316,9 @@  discard block
 block discarded – undo
3265 3316
 
3266 3317
 	set_error_handler('StackTraceErrorHandler');
3267 3318
 }
3319
+/**
3320
+ * @param string $name
3321
+ */
3268 3322
 function get_sub_cookies($name){
3269 3323
 	$cookies = array();
3270 3324
 	if(isset($_COOKIE[$name])){
@@ -3306,6 +3360,7 @@  discard block
 block discarded – undo
3306 3360
 
3307 3361
 /**
3308 3362
  * For translating the php.ini memory values into bytes.  e.g. input value of '8M' will return 8388608.
3363
+ * @param string $val
3309 3364
  */
3310 3365
 function return_bytes($val)
3311 3366
 {
@@ -3413,6 +3468,9 @@  discard block
 block discarded – undo
3413 3468
  * Given the bean_name which may be plural or singular return the singular
3414 3469
  * bean_name. This is important when you need to include files.
3415 3470
  */
3471
+/**
3472
+ * @return string
3473
+ */
3416 3474
 function get_singular_bean_name($bean_name){
3417 3475
 	global $beanFiles, $beanList;
3418 3476
 	if(array_key_exists($bean_name, $beanList)){
@@ -3457,6 +3515,9 @@  discard block
 block discarded – undo
3457 3515
     return $singular;
3458 3516
 }
3459 3517
 
3518
+/**
3519
+ * @return string
3520
+ */
3460 3521
 function get_label($label_tag, $temp_module_strings){
3461 3522
 	global $app_strings;
3462 3523
 	if(!empty($temp_module_strings[$label_tag])){
@@ -3562,7 +3623,7 @@  discard block
 block discarded – undo
3562 3623
 /**
3563 3624
  * In order to have one place to obtain the proper object name. aCase for example causes issues throughout the application.
3564 3625
  *
3565
- * @param string $moduleName
3626
+ * @param string $module_name
3566 3627
  */
3567 3628
 function get_valid_bean_name($module_name){
3568 3629
 	global $beanList;
@@ -4139,6 +4200,9 @@  discard block
 block discarded – undo
4139 4200
  * @return string Relative pathname of the located icon, or '' if not found
4140 4201
  */
4141 4202
 
4203
+/**
4204
+ * @param string $iconFileName
4205
+ */
4142 4206
 function _getIcon($iconFileName)
4143 4207
 {
4144 4208
 
@@ -4163,7 +4227,7 @@  discard block
 block discarded – undo
4163 4227
 /**
4164 4228
  * Function to grab the correct icon image for Studio
4165 4229
  * @param string $iconFileName Name of the icon file
4166
- * @param string $altfilename Name of a fallback icon file (displayed if the imagefilename doesn't exist)
4230
+ * @param string $altFileName Name of a fallback icon file (displayed if the imagefilename doesn't exist)
4167 4231
  * @param string $width Width of image
4168 4232
  * @param string $height Height of image
4169 4233
  * @param string $align Alignment of image
@@ -4188,7 +4252,6 @@  discard block
 block discarded – undo
4188 4252
 
4189 4253
 /**
4190 4254
  * Function to grab the correct icon image for Dashlets Dialog
4191
- * @param string $filename Location of the icon file
4192 4255
  * @param string $module Name of the module to fall back onto if file does not exist
4193 4256
  * @param string $width Width of image
4194 4257
  * @param string $height Height of image
@@ -4601,7 +4664,7 @@  discard block
 block discarded – undo
4601 4664
  * 5.5.1RC1 then return 5.5.1
4602 4665
  *
4603 4666
  * @param string $version
4604
- * @return version
4667
+ * @return string
4605 4668
  */
4606 4669
 function getMajorMinorVersion($version){
4607 4670
 	if(preg_match('/^([\d\.]+).*$/si', $version, $matches2)){
@@ -4751,6 +4814,9 @@  discard block
 block discarded – undo
4751 4814
     }
4752 4815
 }
4753 4816
 
4817
+/**
4818
+ * @param string $field_name
4819
+ */
4754 4820
 function order_beans($beans, $field_name)
4755 4821
 {
4756 4822
     //Since php 5.2 doesn't include closures, we must use a global to pass the order field to cmp_beans.
@@ -4885,7 +4951,7 @@  discard block
 block discarded – undo
4885 4951
  * otherwise it return $file
4886 4952
  *
4887 4953
  * @param $file String of filename to check
4888
- * @return $file String of filename including custom directory if found
4954
+ * @return string String of filename including custom directory if found
4889 4955
  */
4890 4956
 function get_custom_file_if_exists($file)
4891 4957
 {
@@ -5037,7 +5103,7 @@  discard block
 block discarded – undo
5037 5103
 /**
5038 5104
  * Gets the list of "*type_display*".
5039 5105
  * 
5040
- * @return array
5106
+ * @return string[]
5041 5107
  */
5042 5108
 function getTypeDisplayList()
5043 5109
 {
Please login to merge, or discard this patch.
include/Popups/PopupSmarty.php 4 patches
Indentation   +277 added lines, -277 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 define("NUM_COLS", 2);
46 46
 class PopupSmarty extends ListViewSmarty{
47 47
 
48
-	var $contextMenus = false;
49
-	var $export = false;
50
-	var $mailmerge = false;
51
-	var $mergeduplicates = false;
52
-	var $quickViewLinks = false;
53
-	var $multiSelect = false;
54
-	var $headerTpl;
48
+    var $contextMenus = false;
49
+    var $export = false;
50
+    var $mailmerge = false;
51
+    var $mergeduplicates = false;
52
+    var $quickViewLinks = false;
53
+    var $multiSelect = false;
54
+    var $headerTpl;
55 55
     var $footerTpl;
56 56
     var $th;
57 57
     var $tpl;
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
     var $module;
71 71
     var $massUpdateData = '';
72 72
 
73
-	function PopupSmarty($seed, $module){
74
-		parent::ListViewSmarty();
75
-		$this->th = new TemplateHandler();
76
-		$this->th->loadSmarty();
77
-		$this->seed = $seed;
78
-		$this->view = 'Popup';
79
-		$this->module = $module;
80
-		$this->searchForm = new SearchForm($this->seed, $this->module);
81
-		$this->th->deleteTemplate($module, $this->view);
73
+    function PopupSmarty($seed, $module){
74
+        parent::ListViewSmarty();
75
+        $this->th = new TemplateHandler();
76
+        $this->th->loadSmarty();
77
+        $this->seed = $seed;
78
+        $this->view = 'Popup';
79
+        $this->module = $module;
80
+        $this->searchForm = new SearchForm($this->seed, $this->module);
81
+        $this->th->deleteTemplate($module, $this->view);
82 82
         $this->headerTpl = 'include/Popups/tpls/header.tpl';
83 83
         $this->footerTpl = 'include/Popups/tpls/footer.tpl';
84 84
 
85
-	}
85
+    }
86 86
 
87 87
     /**
88 88
      * Assign several arrow image attributes to TemplateHandler smarty. Such as width, height, etc.
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $this->th->ss->assign('arrowAlt', translate('LBL_SORT'));
102 102
     }
103 103
 
104
-	/**
104
+    /**
105 105
      * Processes the request. Calls ListViewData process. Also assigns all lang strings, export links,
106 106
      * This is called from ListViewDisplay
107 107
      *
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
      * @param html_var string the corresponding html var in xtpl per row
111 111
      *
112 112
      */
113
-	function process($file, $data, $htmlVar) {
113
+    function process($file, $data, $htmlVar) {
114 114
 
115
-		global $odd_bg, $even_bg, $hilite_bg, $click_bg, $app_strings;
116
-		parent::process($file, $data, $htmlVar);
115
+        global $odd_bg, $even_bg, $hilite_bg, $click_bg, $app_strings;
116
+        parent::process($file, $data, $htmlVar);
117 117
 
118
-		$this->tpl = $file;
119
-		$this->data = $data;
118
+        $this->tpl = $file;
119
+        $this->data = $data;
120 120
 
121 121
         $totalWidth = 0;
122 122
         foreach($this->displayColumns as $name => $params) {
@@ -131,47 +131,47 @@  discard block
 block discarded – undo
131 131
             if(!empty($params['contextMenu']['objectType']))
132 132
                 $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
133 133
         }
134
-		$this->th->ss->assign('displayColumns', $this->displayColumns);
134
+        $this->th->ss->assign('displayColumns', $this->displayColumns);
135 135
 
136 136
 
137
-		$this->th->ss->assign('bgHilite', $hilite_bg);
138
-		$this->th->ss->assign('colCount', count($this->displayColumns) + 1);
139
-		$this->th->ss->assign('htmlVar', strtoupper($htmlVar));
140
-		$this->th->ss->assign('moduleString', $this->moduleString);
137
+        $this->th->ss->assign('bgHilite', $hilite_bg);
138
+        $this->th->ss->assign('colCount', count($this->displayColumns) + 1);
139
+        $this->th->ss->assign('htmlVar', strtoupper($htmlVar));
140
+        $this->th->ss->assign('moduleString', $this->moduleString);
141 141
         $this->th->ss->assign('editLinkString', $GLOBALS['app_strings']['LBL_EDIT_BUTTON']);
142 142
         $this->th->ss->assign('viewLinkString', $GLOBALS['app_strings']['LBL_VIEW_BUTTON']);
143 143
 
144 144
         //rrs
145 145
         $this->searchForm->parsedView = 'popup_query_form';
146 146
         $this->searchForm->displayType = 'popupView';
147
-		$this->th->ss->assign('searchForm', $this->searchForm->display(false));
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());
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());
150
+        if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink());
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());
154 154
 
155 155
 
156
-		if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
157
-			$this->multiSelect = true;
158
-		}
159
-		// handle save checks and stuff
160
-		if($this->multiSelect) {
161
-			$this->th->ss->assign('selectedObjectsSpan', $this->buildSelectedObjectsSpan());
162
-			$this->th->ss->assign('multiSelectData', $this->getMultiSelectData());
163
-			$this->th->ss->assign('MODE', "<input type='hidden' name='mode' value='MultiSelect'>");
156
+        if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
157
+            $this->multiSelect = true;
158
+        }
159
+        // handle save checks and stuff
160
+        if($this->multiSelect) {
161
+            $this->th->ss->assign('selectedObjectsSpan', $this->buildSelectedObjectsSpan());
162
+            $this->th->ss->assign('multiSelectData', $this->getMultiSelectData());
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 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
-    		$this->th->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal));
169
-		}
168
+            $this->th->ss->assign('selectLink', $this->buildSelectLink('select_link', $this->data['pageData']['offsets']['total'], $pageTotal));
169
+        }
170 170
 
171
-		$this->processArrows($data['pageData']['ordering']);
172
-		$this->th->ss->assign('prerow', $this->multiSelect);
173
-		$this->th->ss->assign('rowColor', array('oddListRow', 'evenListRow'));
174
-		$this->th->ss->assign('bgColor', array($odd_bg, $even_bg));
171
+        $this->processArrows($data['pageData']['ordering']);
172
+        $this->th->ss->assign('prerow', $this->multiSelect);
173
+        $this->th->ss->assign('rowColor', array('oddListRow', 'evenListRow'));
174
+        $this->th->ss->assign('bgColor', array($odd_bg, $even_bg));
175 175
         $this->th->ss->assign('contextMenus', $this->contextMenus);
176 176
 
177 177
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 
192 192
             // arrow image attributes
193 193
             $this->processArrowVars();
194
-	}
194
+    }
195 195
 
196
-	/*
196
+    /*
197 197
 	 * Display the Smarty template.  Here we are using the TemplateHandler for caching per the module.
198 198
 	 */
199
-	function display($end = true) {
199
+    function display($end = true) {
200 200
         global $app_strings;
201 201
 
202 202
         if(!is_file(sugar_cached("jsLanguage/{$GLOBALS['current_language']}.js"))) {
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 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
-		$this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']);
210
-		$this->th->ss->assign('pageData', $this->data['pageData']);
209
+        $this->data['pageData']['offsets']['lastOffsetOnPage'] = $this->data['pageData']['offsets']['current'] + count($this->data['data']);
210
+        $this->th->ss->assign('pageData', $this->data['pageData']);
211 211
 
212 212
         $navStrings = array('next' => $GLOBALS['app_strings']['LNK_LIST_NEXT'],
213 213
                             'previous' => $GLOBALS['app_strings']['LNK_LIST_PREVIOUS'],
@@ -217,128 +217,128 @@  discard block
 block discarded – undo
217 217
         $this->th->ss->assign('navStrings', $navStrings);
218 218
 
219 219
 
220
-		$associated_row_data = array();
220
+        $associated_row_data = array();
221 221
 		
222
-		//C.L. - Bug 44324 - Override the NAME entry to not display salutation so that the data returned from the popup can be searched on correctly
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;
222
+        //C.L. - Bug 44324 - Override the NAME entry to not display salutation so that the data returned from the popup can be searched on correctly
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
-		global $locale;
226
-		foreach($this->data['data'] as $val)
227
-		{
228
-			$associated_row_data[$val['ID']] = $val;
229
-			if($searchNameOverride)
230
-			{
231
-			   $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']);
232
-			}
233
-		}
234
-		$is_show_fullname = showFullName() ? 1 : 0;
235
-		$json = getJSONobj();
236
-		$this->th->ss->assign('jsLang', $jsLang);
237
-		$this->th->ss->assign('lang', substr($GLOBALS['current_language'], 0, 2));
225
+        global $locale;
226
+        foreach($this->data['data'] as $val)
227
+        {
228
+            $associated_row_data[$val['ID']] = $val;
229
+            if($searchNameOverride)
230
+            {
231
+                $associated_row_data[$val['ID']]['NAME'] = $locale->getLocaleFormattedName($val['FIRST_NAME'], $val['LAST_NAME']);
232
+            }
233
+        }
234
+        $is_show_fullname = showFullName() ? 1 : 0;
235
+        $json = getJSONobj();
236
+        $this->th->ss->assign('jsLang', $jsLang);
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 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
-		$this->th->ss->assign('module', $this->seed->module_dir);
242
-		$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
243
-
244
-		$this->th->ss->assign('request_data', $request_data);
245
-		$this->th->ss->assign('fields', $this->fieldDefs);
246
-		$this->th->ss->assign('formData', $this->formData);
247
-		$this->th->ss->assign('APP', $GLOBALS['app_strings']);
248
-		$this->th->ss->assign('MOD', $GLOBALS['mod_strings']);
241
+        $this->th->ss->assign('module', $this->seed->module_dir);
242
+        $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
243
+
244
+        $this->th->ss->assign('request_data', $request_data);
245
+        $this->th->ss->assign('fields', $this->fieldDefs);
246
+        $this->th->ss->assign('formData', $this->formData);
247
+        $this->th->ss->assign('APP', $GLOBALS['app_strings']);
248
+        $this->th->ss->assign('MOD', $GLOBALS['mod_strings']);
249 249
         if (isset($this->_popupMeta['create']['createButton'])) 
250
-		{
251
-           $this->_popupMeta['create']['createButton'] = translate($this->_popupMeta['create']['createButton']);
250
+        {
251
+            $this->_popupMeta['create']['createButton'] = translate($this->_popupMeta['create']['createButton']);
252 252
         }
253
-		$this->th->ss->assign('popupMeta', $this->_popupMeta);
253
+        $this->th->ss->assign('popupMeta', $this->_popupMeta);
254 254
         $this->th->ss->assign('current_query', base64_encode(serialize($_REQUEST)));
255
-		$this->th->ss->assign('customFields', $this->customFieldDefs);
256
-		$this->th->ss->assign('numCols', NUM_COLS);
257
-		$this->th->ss->assign('massUpdateData', $this->massUpdateData);
258
-		$this->th->ss->assign('sugarVersion', $GLOBALS['sugar_version']);
255
+        $this->th->ss->assign('customFields', $this->customFieldDefs);
256
+        $this->th->ss->assign('numCols', NUM_COLS);
257
+        $this->th->ss->assign('massUpdateData', $this->massUpdateData);
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());
263
-			$this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader());
264
-			$this->th->ss->assign('object_name', $this->seed->object_name);
265
-		}
266
-		$this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false));
267
-		$this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false));
268
-		$str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl);
269
-		return $str;
270
-	}
271
-
272
-	/*
261
+        if($this->_create){
262
+            $this->th->ss->assign('ADDFORM', $this->getQuickCreate());//$this->_getAddForm());
263
+            $this->th->ss->assign('ADDFORMHEADER', $this->_getAddFormHeader());
264
+            $this->th->ss->assign('object_name', $this->seed->object_name);
265
+        }
266
+        $this->th->ss->assign('LIST_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_LIST_FORM_TITLE'], '', false));
267
+        $this->th->ss->assign('SEARCH_FORM_HEADER', get_form_header($GLOBALS['mod_strings']['LBL_SEARCH_FORM_TITLE'], '', false));
268
+        $str = $this->th->displayTemplate($this->seed->module_dir, $this->view, $this->tpl);
269
+        return $str;
270
+    }
271
+
272
+    /*
273 273
 	 * Setup up the smarty template. we added an extra step here to add the order by from the popupdefs.
274 274
 	 */
275
-	function setup($seed, $file = null, $where = null, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id') {
276
-		$args = func_get_args();
277
-		return call_user_func_array(array($this, '_setup'), $args);
278
-	}
279
-	function _setup($file) {
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']);
284
-				$this->_create = true;
285
-			}
286
-		}
287
-	    if(!empty($this->_popupMeta['create'])){
288
-			$formBase = new $this->_popupMeta['create']['formBaseClass']();
289
-			if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save')
290
-			{
291
-				//If it's a new record, set useRequired to false
292
-				$useRequired = empty($_REQUEST['id']) ? false : true;
293
-				$formBase->handleSave('', false, $useRequired);
294
-			}
295
-		}
296
-
297
-		$params = array();
298
-		if(!empty($this->_popupMeta['orderBy'])){
299
-			$params['orderBy'] = $this->_popupMeta['orderBy'];
300
-		}
301
-
302
-		if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
303
-			require('custom/modules/'.$this->module.'/metadata/metafiles.php');
304
-		}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
305
-			require('modules/'.$this->module.'/metadata/metafiles.php');
306
-		}
307
-
308
-		if(!empty($metafiles[$this->module]['searchfields'])) {
309
-			require($metafiles[$this->module]['searchfields']);
310
-		} elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) {
311
-			require('modules/'.$this->module.'/metadata/SearchFields.php');
312
-	    }
275
+    function setup($seed, $file = null, $where = null, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id') {
276
+        $args = func_get_args();
277
+        return call_user_func_array(array($this, '_setup'), $args);
278
+    }
279
+    function _setup($file) {
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']);
284
+                $this->_create = true;
285
+            }
286
+        }
287
+        if(!empty($this->_popupMeta['create'])){
288
+            $formBase = new $this->_popupMeta['create']['formBaseClass']();
289
+            if(isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save')
290
+            {
291
+                //If it's a new record, set useRequired to false
292
+                $useRequired = empty($_REQUEST['id']) ? false : true;
293
+                $formBase->handleSave('', false, $useRequired);
294
+            }
295
+        }
296
+
297
+        $params = array();
298
+        if(!empty($this->_popupMeta['orderBy'])){
299
+            $params['orderBy'] = $this->_popupMeta['orderBy'];
300
+        }
301
+
302
+        if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
303
+            require('custom/modules/'.$this->module.'/metadata/metafiles.php');
304
+        }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
305
+            require('modules/'.$this->module.'/metadata/metafiles.php');
306
+        }
307
+
308
+        if(!empty($metafiles[$this->module]['searchfields'])) {
309
+            require($metafiles[$this->module]['searchfields']);
310
+        } elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) {
311
+            require('modules/'.$this->module.'/metadata/SearchFields.php');
312
+        }
313 313
         $this->searchdefs[$this->module]['templateMeta']['maxColumns'] = 2;
314 314
         $this->searchdefs[$this->module]['templateMeta']['widths']['label'] = 10;
315 315
         $this->searchdefs[$this->module]['templateMeta']['widths']['field'] = 30;
316 316
 
317 317
         $this->searchForm->view = 'PopupSearchForm';
318
-		$this->searchForm->setup($this->searchdefs, $searchFields, 'SearchFormGenericAdvanced.tpl', 'advanced_search', $this->listviewdefs);
319
-
320
-		$lv = new ListViewSmarty();
321
-		$displayColumns = array();
322
-		if(!empty($_REQUEST['displayColumns'])) {
323
-		    foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
324
-		        if(!empty($listViewDefs[$this->module][$col]))
325
-		            $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
326
-		    }
327
-		}
328
-		else {
329
-		    foreach($this->listviewdefs[$this->module] as $col => $para) {
330
-		        if(!empty($para['default']) && $para['default'])
331
-		            $displayColumns[$col] = $para;
332
-		    }
333
-		}
334
-		$params['massupdate'] = true;
335
-		if(!empty($_REQUEST['orderBy'])) {
336
-		    $params['orderBy'] = $_REQUEST['orderBy'];
337
-		    $params['overrideOrder'] = true;
338
-		    if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
339
-		}
340
-
341
-		$lv->displayColumns = $displayColumns;
318
+        $this->searchForm->setup($this->searchdefs, $searchFields, 'SearchFormGenericAdvanced.tpl', 'advanced_search', $this->listviewdefs);
319
+
320
+        $lv = new ListViewSmarty();
321
+        $displayColumns = array();
322
+        if(!empty($_REQUEST['displayColumns'])) {
323
+            foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
324
+                if(!empty($listViewDefs[$this->module][$col]))
325
+                    $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
326
+            }
327
+        }
328
+        else {
329
+            foreach($this->listviewdefs[$this->module] as $col => $para) {
330
+                if(!empty($para['default']) && $para['default'])
331
+                    $displayColumns[$col] = $para;
332
+            }
333
+        }
334
+        $params['massupdate'] = true;
335
+        if(!empty($_REQUEST['orderBy'])) {
336
+            $params['orderBy'] = $_REQUEST['orderBy'];
337
+            $params['overrideOrder'] = true;
338
+            if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
339
+        }
340
+
341
+        $lv->displayColumns = $displayColumns;
342 342
         $this->searchForm->lv = $lv;
343 343
         $this->searchForm->displaySavedSearch = false;
344 344
 
@@ -351,25 +351,25 @@  discard block
 block discarded – undo
351 351
         $this->should_process = true;
352 352
 
353 353
         if(isset($params['export'])) {
354
-          $this->export = $params['export'];
354
+            $this->export = $params['export'];
355 355
         }
356 356
         if(!empty($params['multiSelectPopup'])) {
357
-		  $this->multi_select_popup = $params['multiSelectPopup'];
357
+            $this->multi_select_popup = $params['multiSelectPopup'];
358 358
         }
359
-		if(!empty($params['massupdate']) && $params['massupdate'] != false) {
360
-			$this->show_mass_update_form = true;
361
-			$this->mass = new MassUpdate();
362
-			$this->mass->setSugarBean($this->seed);
363
-			if(!empty($params['handleMassupdate']) || !isset($params['handleMassupdate'])) {
359
+        if(!empty($params['massupdate']) && $params['massupdate'] != false) {
360
+            $this->show_mass_update_form = true;
361
+            $this->mass = new MassUpdate();
362
+            $this->mass->setSugarBean($this->seed);
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 369
         if(empty($this->filter_fields) || $this->mergeDisplayColumns) {
370 370
             foreach($this->displayColumns as $columnName => $def) {
371
-               $this->filter_fields[strtolower($columnName)] = true;
372
-               if(!empty($def['related_fields'])) {
371
+                $this->filter_fields[strtolower($columnName)] = true;
372
+                if(!empty($def['related_fields'])) {
373 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
@@ -379,12 +379,12 @@  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)])
384
-	                    {
385
-	                        $this->filter_fields[strtolower($field)] = true;
386
-	                    }
387
-	                }
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
+                        {
385
+                            $this->filter_fields[strtolower($field)] = true;
386
+                        }
387
+                    }
388 388
                 }
389 389
             }
390 390
             foreach ($this->searchColumns as $columnName => $def )
@@ -418,119 +418,119 @@  discard block
 block discarded – undo
418 418
         }
419 419
 
420 420
 
421
-		if (!empty($_REQUEST['query']) || (!empty($GLOBALS['sugar_config']['save_query']) && $GLOBALS['sugar_config']['save_query'] != 'populate_only')) {
422
-			$data = $this->lvd->getListViewData($this->seed, $searchWhere, 0, -1, $this->filter_fields, $params, 'id');
423
-		} else {
424
-			$this->should_process = false;
425
-			$data = array(
426
-				'data'=>array(),
427
-			    'pageData'=>array(
428
-			    	'bean'=>array('moduleDir'=>$this->seed->module_dir),
429
-					'ordering'=>'',
430
-					'offsets'=>array('total'=>0,'next'=>0,'current'=>0),
431
-				),
432
-			);
433
-		}
421
+        if (!empty($_REQUEST['query']) || (!empty($GLOBALS['sugar_config']['save_query']) && $GLOBALS['sugar_config']['save_query'] != 'populate_only')) {
422
+            $data = $this->lvd->getListViewData($this->seed, $searchWhere, 0, -1, $this->filter_fields, $params, 'id');
423
+        } else {
424
+            $this->should_process = false;
425
+            $data = array(
426
+                'data'=>array(),
427
+                'pageData'=>array(
428
+                    'bean'=>array('moduleDir'=>$this->seed->module_dir),
429
+                    'ordering'=>'',
430
+                    'offsets'=>array('total'=>0,'next'=>0,'current'=>0),
431
+                ),
432
+            );
433
+        }
434 434
 
435 435
         $this->fillDisplayColumnsWithVardefs();
436 436
 
437
-		$this->process($file, $data, $this->seed->object_name);
438
-	}
437
+        $this->process($file, $data, $this->seed->object_name);
438
+    }
439 439
 
440
-	/*
440
+    /*
441 441
 	 * Return the where clause as per the REQUEST.
442 442
 	 */
443
-	function _get_where_clause()
444
-	{
445
-		$where = '';
446
-		$where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir);
447
-
448
-		// Bug 43452 - FG - Changed the way generated Where array is imploded into the string.
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) . ' )';
443
+    function _get_where_clause()
444
+    {
445
+        $where = '';
446
+        $where_clauses = $this->searchForm->generateSearchWhere(true, $this->seed->module_dir);
447
+
448
+        // Bug 43452 - FG - Changed the way generated Where array is imploded into the string.
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) . ' )';
452 452
         }
453 453
 
454 454
         // Need to include the default whereStatement
455
-		if(!empty($this->_popupMeta['whereStatement'])){
455
+        if(!empty($this->_popupMeta['whereStatement'])){
456 456
             if(!empty($where))$where .= ' AND ';
457 457
             $where .= $this->_popupMeta['whereStatement'];
458
-		}
458
+        }
459 459
 
460
-		return $where;
461
-	}
460
+        return $where;
461
+    }
462 462
 
463
-	/*
463
+    /*
464 464
 	 * Generate the data for the search form on the header of the Popup.
465 465
 	 */
466
-		function _build_field_defs(){
467
-		$this->formData = array();
468
-		$this->customFieldDefs = array();
469
-		foreach($this->searchdefs[$this->module]['layout']['advanced_search'] as $data){
470
-			if(is_array($data)){
471
-
472
-				$this->formData[] = array('field' => $data);
473
-				$value = '';
474
-				$this->customFieldDefs[$data['name']]= $data;
475
-				if(!empty($_REQUEST[$data['name']]))
476
-	            	$value = $_REQUEST[$data['name']];
477
-	            $this->customFieldDefs[$data['name']]['value'] = $value;
478
-			}else
479
-				$this->formData[] = array('field' => array('name'=>$data));
480
-		}
481
-		$this->fieldDefs = array();
482
-		if($this->seed){
483
-			$this->seed->fill_in_additional_detail_fields();
484
-
485
-	        foreach($this->seed->toArray() as $name => $value) {
486
-	            $this->fieldDefs[$name] = $this->seed->field_defs[$name];
487
-	            //if we have a relate type then reset to name so that we end up with a textbox
488
-	            //rather than a select button
489
-	            $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name'];
490
-	            if($this->fieldDefs[$name]['type'] == 'relate')
491
-	            	$this->fieldDefs[$name]['type'] = 'name';
492
-	            if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
493
-	                $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums
494
-	            }
495
-	            if(!empty($_REQUEST[$name]))
496
-	            	$value = $_REQUEST[$name];
497
-	            $this->fieldDefs[$name]['value'] = $value;
498
-	        }
499
-		}
500
-	}
501
-
502
-	function _getAddForm(){
503
-		$addform = '';
466
+        function _build_field_defs(){
467
+        $this->formData = array();
468
+        $this->customFieldDefs = array();
469
+        foreach($this->searchdefs[$this->module]['layout']['advanced_search'] as $data){
470
+            if(is_array($data)){
471
+
472
+                $this->formData[] = array('field' => $data);
473
+                $value = '';
474
+                $this->customFieldDefs[$data['name']]= $data;
475
+                if(!empty($_REQUEST[$data['name']]))
476
+                    $value = $_REQUEST[$data['name']];
477
+                $this->customFieldDefs[$data['name']]['value'] = $value;
478
+            }else
479
+                $this->formData[] = array('field' => array('name'=>$data));
480
+        }
481
+        $this->fieldDefs = array();
482
+        if($this->seed){
483
+            $this->seed->fill_in_additional_detail_fields();
484
+
485
+            foreach($this->seed->toArray() as $name => $value) {
486
+                $this->fieldDefs[$name] = $this->seed->field_defs[$name];
487
+                //if we have a relate type then reset to name so that we end up with a textbox
488
+                //rather than a select button
489
+                $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name'];
490
+                if($this->fieldDefs[$name]['type'] == 'relate')
491
+                    $this->fieldDefs[$name]['type'] = 'name';
492
+                if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
493
+                    $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums
494
+                }
495
+                if(!empty($_REQUEST[$name]))
496
+                    $value = $_REQUEST[$name];
497
+                $this->fieldDefs[$name]['value'] = $value;
498
+            }
499
+        }
500
+    }
501
+
502
+    function _getAddForm(){
503
+        $addform = '';
504 504
         if(!$this->seed->ACLAccess('save')){
505 505
             return;
506 506
         }
507
-		if(!empty($this->_popupMeta['create'])){
508
-			$formBase = new $this->_popupMeta['create']['formBaseClass']();
507
+        if(!empty($this->_popupMeta['create'])){
508
+            $formBase = new $this->_popupMeta['create']['formBaseClass']();
509 509
 
510 510
 
511 511
 
512
-				// TODO: cleanup the construction of $addform
513
-				$prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0];
514
-				$mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1];
515
-				$formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2];
512
+                // TODO: cleanup the construction of $addform
513
+                $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0];
514
+                $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1];
515
+                $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2];
516 516
 
517
-				$getFormMethod = (empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']);
518
-				$formbody = $formBase->$getFormMethod($prefix, $mod, $formBody);
517
+                $getFormMethod = (empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']);
518
+                $formbody = $formBase->$getFormMethod($prefix, $mod, $formBody);
519 519
 
520
-				$addform = '<table><tr><td nowrap="nowrap" valign="top">'
521
-					. str_replace('<br>', '</td><td nowrap="nowrap" valign="top">&nbsp;', $formbody)
522
-					. '</td></tr></table>'
523
-					. '<input type="hidden" name="action" value="Popup" />';
520
+                $addform = '<table><tr><td nowrap="nowrap" valign="top">'
521
+                    . str_replace('<br>', '</td><td nowrap="nowrap" valign="top">&nbsp;', $formbody)
522
+                    . '</td></tr></table>'
523
+                    . '<input type="hidden" name="action" value="Popup" />';
524 524
 
525
-			return $addform;
526
-		}
527
-	}
525
+            return $addform;
526
+        }
527
+    }
528 528
 
529
-	function _getAddFormHeader(){
530
-		$lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE'];
531
-		$lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY'];
532
-		$lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL'];
533
-		$module_dir = $this->seed->module_dir;
529
+    function _getAddFormHeader(){
530
+        $lbl_save_button_title = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_TITLE'];
531
+        $lbl_save_button_key = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_KEY'];
532
+        $lbl_save_button_label = $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL'];
533
+        $module_dir = $this->seed->module_dir;
534 534
 $formSave = <<<EOQ
535 535
 			<input type="hidden" name="create" value="true">
536 536
 			<input type="hidden" name="popup" value="true">
@@ -538,21 +538,21 @@  discard block
 block discarded – undo
538 538
 			<input type="hidden" name="return_module" value="$module_dir">
539 539
 			<input type="hidden" name="return_action" value="Popup">
540 540
 EOQ;
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';
545
-		}
546
-
547
-
548
-		$addformheader = get_form_header(translate($this->_popupMeta['create']['createButton']), $formSave, false);
549
-		return $addformheader;
550
-	}
551
-
552
-	function getQuickCreate(){
553
-		require_once("include/EditView/PopupQuickCreate.php");
554
-		$qc = new PopupQuickCreate($this->module);
555
-		return $qc->process($this->module);
556
-	}
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';
545
+        }
546
+
547
+
548
+        $addformheader = get_form_header(translate($this->_popupMeta['create']['createButton']), $formSave, false);
549
+        return $addformheader;
550
+    }
551
+
552
+    function getQuickCreate(){
553
+        require_once("include/EditView/PopupQuickCreate.php");
554
+        $qc = new PopupQuickCreate($this->module);
555
+        return $qc->process($this->module);
556
+    }
557 557
 }
558 558
 ?>
Please login to merge, or discard this 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.
Braces   +45 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -128,8 +130,9 @@  discard block
 block discarded – undo
128 130
         foreach($this->displayColumns as $name => $params) {
129 131
             $this->displayColumns[$name]['width'] = round($this->displayColumns[$name]['width'] / $adjustment, 2);
130 132
             // figure out which contextMenu objectsTypes are required
131
-            if(!empty($params['contextMenu']['objectType']))
132
-                $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
133
+            if(!empty($params['contextMenu']['objectType'])) {
134
+                            $contextMenuObjectsTypes[$params['contextMenu']['objectType']] = true;
135
+            }
133 136
         }
134 137
 		$this->th->ss->assign('displayColumns', $this->displayColumns);
135 138
 
@@ -147,10 +150,17 @@  discard block
 block discarded – undo
147 150
 		$this->th->ss->assign('searchForm', $this->searchForm->display(false));
148 151
         //rrs
149 152
 
150
-		if($this->export) $this->th->ss->assign('exportLink', $this->buildExportLink());
153
+		if($this->export) {
154
+		    $this->th->ss->assign('exportLink', $this->buildExportLink());
155
+		}
151 156
 		$this->th->ss->assign('quickViewLinks', $this->quickViewLinks);
152
-		if($this->mailMerge) $this->th->ss->assign('mergeLink', $this->buildMergeLink()); // still check for mailmerge access
153
-		if($this->mergeduplicates) $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink());
157
+		if($this->mailMerge) {
158
+		    $this->th->ss->assign('mergeLink', $this->buildMergeLink());
159
+		}
160
+		// still check for mailmerge access
161
+		if($this->mergeduplicates) {
162
+		    $this->th->ss->assign('mergedupLink', $this->buildMergeDuplicatesLink());
163
+		}
154 164
 
155 165
 
156 166
 		if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
@@ -301,7 +311,7 @@  discard block
 block discarded – undo
301 311
 
302 312
 		if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
303 313
 			require('custom/modules/'.$this->module.'/metadata/metafiles.php');
304
-		}elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
314
+		} elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
305 315
 			require('modules/'.$this->module.'/metadata/metafiles.php');
306 316
 		}
307 317
 
@@ -321,21 +331,24 @@  discard block
 block discarded – undo
321 331
 		$displayColumns = array();
322 332
 		if(!empty($_REQUEST['displayColumns'])) {
323 333
 		    foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
324
-		        if(!empty($listViewDefs[$this->module][$col]))
325
-		            $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
334
+		        if(!empty($listViewDefs[$this->module][$col])) {
335
+		        		            $displayColumns[$col] = $this->listviewdefs[$this->module][$col];
336
+		        }
326 337
 		    }
327
-		}
328
-		else {
338
+		} else {
329 339
 		    foreach($this->listviewdefs[$this->module] as $col => $para) {
330
-		        if(!empty($para['default']) && $para['default'])
331
-		            $displayColumns[$col] = $para;
340
+		        if(!empty($para['default']) && $para['default']) {
341
+		        		            $displayColumns[$col] = $para;
342
+		        }
332 343
 		    }
333 344
 		}
334 345
 		$params['massupdate'] = true;
335 346
 		if(!empty($_REQUEST['orderBy'])) {
336 347
 		    $params['orderBy'] = $_REQUEST['orderBy'];
337 348
 		    $params['overrideOrder'] = true;
338
-		    if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
349
+		    if(!empty($_REQUEST['sortOrder'])) {
350
+		        $params['sortOrder'] = $_REQUEST['sortOrder'];
351
+		    }
339 352
 		}
340 353
 
341 354
 		$lv->displayColumns = $displayColumns;
@@ -453,7 +466,9 @@  discard block
 block discarded – undo
453 466
 
454 467
         // Need to include the default whereStatement
455 468
 		if(!empty($this->_popupMeta['whereStatement'])){
456
-            if(!empty($where))$where .= ' AND ';
469
+            if(!empty($where)) {
470
+                $where .= ' AND ';
471
+            }
457 472
             $where .= $this->_popupMeta['whereStatement'];
458 473
 		}
459 474
 
@@ -472,11 +487,13 @@  discard block
 block discarded – undo
472 487
 				$this->formData[] = array('field' => $data);
473 488
 				$value = '';
474 489
 				$this->customFieldDefs[$data['name']]= $data;
475
-				if(!empty($_REQUEST[$data['name']]))
476
-	            	$value = $_REQUEST[$data['name']];
490
+				if(!empty($_REQUEST[$data['name']])) {
491
+					            	$value = $_REQUEST[$data['name']];
492
+				}
477 493
 	            $this->customFieldDefs[$data['name']]['value'] = $value;
478
-			}else
479
-				$this->formData[] = array('field' => array('name'=>$data));
494
+			} else {
495
+							$this->formData[] = array('field' => array('name'=>$data));
496
+			}
480 497
 		}
481 498
 		$this->fieldDefs = array();
482 499
 		if($this->seed){
@@ -487,13 +504,15 @@  discard block
 block discarded – undo
487 504
 	            //if we have a relate type then reset to name so that we end up with a textbox
488 505
 	            //rather than a select button
489 506
 	            $this->fieldDefs[$name]['name'] = $this->fieldDefs[$name]['name'];
490
-	            if($this->fieldDefs[$name]['type'] == 'relate')
491
-	            	$this->fieldDefs[$name]['type'] = 'name';
507
+	            if($this->fieldDefs[$name]['type'] == 'relate') {
508
+	            	            	$this->fieldDefs[$name]['type'] = 'name';
509
+	            }
492 510
 	            if(isset($this->fieldDefs[$name]['options']) && isset($GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']])) {
493 511
 	                $this->fieldDefs[$name]['options'] = $GLOBALS['app_list_strings'][$this->fieldDefs[$name]['options']]; // fill in enums
494 512
 	            }
495
-	            if(!empty($_REQUEST[$name]))
496
-	            	$value = $_REQUEST[$name];
513
+	            if(!empty($_REQUEST[$name])) {
514
+	            	            	$value = $_REQUEST[$name];
515
+	            }
497 516
 	            $this->fieldDefs[$name]['value'] = $value;
498 517
 	        }
499 518
 		}
@@ -540,8 +559,9 @@  discard block
 block discarded – undo
540 559
 EOQ;
541 560
 		// if metadata contains custom inputs for the quickcreate
542 561
 		if(!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) {
543
-			foreach($this->_popupMeta['customInput'] as $key => $value)
544
-				$formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n';
562
+			foreach($this->_popupMeta['customInput'] as $key => $value) {
563
+							$formSave .= '<input type="hidden" name="' . $key . '" value="'. $value .'">\n';
564
+			}
545 565
 		}
546 566
 
547 567
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -70,6 +70,9 @@  discard block
 block discarded – undo
70 70
     var $module;
71 71
     var $massUpdateData = '';
72 72
 
73
+	/**
74
+	 * @param string $module
75
+	 */
73 76
 	function PopupSmarty($seed, $module){
74 77
 		parent::ListViewSmarty();
75 78
 		$this->th = new TemplateHandler();
@@ -108,6 +111,7 @@  discard block
 block discarded – undo
108 111
      * @param file file Template file to use
109 112
      * @param data array from ListViewData
110 113
      * @param html_var string the corresponding html var in xtpl per row
114
+     * @param string $htmlVar
111 115
      *
112 116
      */
113 117
 	function process($file, $data, $htmlVar) {
Please login to merge, or discard this patch.
include/language/getJSLanguage.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
     die('Not A Valid Entry Point');
14 14
 }
15 15
 /**
16
- * Retrieves the requested js language file, building it if it doesn't exist.
17
- */
16
+     * Retrieves the requested js language file, building it if it doesn't exist.
17
+     */
18 18
 function getJSLanguage()
19 19
 {
20 20
 
Please login to merge, or discard this 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 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
include/language/en_us.lang.php 3 patches
Indentation   +759 added lines, -759 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 //to translate, only modify the right value in each key/value pair
51 51
 $app_list_strings = array (
52 52
 //e.g. auf Deutsch 'Contacts'=>'Contakten',
53
-  'language_pack_name' => 'US English',
54
-  'moduleList' =>
55
-  array (
53
+    'language_pack_name' => 'US English',
54
+    'moduleList' =>
55
+    array (
56 56
     'Home' => 'Home',
57 57
     'Contacts' => 'Contacts',
58 58
     'Accounts' => 'Accounts',
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
     'Newsletters' => 'Newsletters',
107 107
     'SugarFeed'=>'SuiteCRM Feed',
108 108
     'KBDocuments' => 'Knowledge Base',
109
-  'SugarFavorites'=>'SuiteCRM Favorites',
109
+    'SugarFavorites'=>'SuiteCRM Favorites',
110 110
 
111 111
     'OAuthKeys' => 'OAuth Consumer Keys',
112 112
     'OAuthTokens' => 'OAuth Tokens',
113
-  ),
113
+    ),
114 114
 
115
-  'moduleListSingular' =>
116
-  array (
115
+    'moduleListSingular' =>
116
+    array (
117 117
     'Home' => 'Home',
118 118
     'Dashboard' => 'Dashboard',
119 119
     'Contacts' => 'Contact',
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
     'SugarFollowing'=>'SuiteCRM Following',
142 142
     'Sync'=>'Sync',
143 143
     'Users' => 'User',
144
-  'SugarFavorites'=>'SuiteCRM Favorites'
144
+    'SugarFavorites'=>'SuiteCRM Favorites'
145 145
 
146 146
         ),
147 147
 
148
-  'checkbox_dom'=> array(
148
+    'checkbox_dom'=> array(
149 149
     ''=>'',
150 150
     '1'=>'Yes',
151 151
     '2'=>'No',
152
-  ),
152
+    ),
153 153
 
154
-  //e.g. en fran�ais 'Analyst'=>'Analyste',
155
-  'account_type_dom' =>
156
-  array (
154
+    //e.g. en fran�ais 'Analyst'=>'Analyste',
155
+    'account_type_dom' =>
156
+    array (
157 157
     '' => '',
158 158
     'Analyst' => 'Analyst',
159 159
     'Competitor' => 'Competitor',
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
     'Prospect' => 'Prospect',
166 166
     'Reseller' => 'Reseller',
167 167
     'Other' => 'Other',
168
-  ),
169
-  //e.g. en espa�ol 'Apparel'=>'Ropa',
170
-  'industry_dom' =>
171
-  array (
168
+    ),
169
+    //e.g. en espa�ol 'Apparel'=>'Ropa',
170
+    'industry_dom' =>
171
+    array (
172 172
     '' => '',
173 173
     'Apparel' => 'Apparel',
174 174
     'Banking' => 'Banking',
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
     'Transportation' => 'Transportation',
201 201
     'Utilities' => 'Utilities',
202 202
     'Other' => 'Other',
203
-  ),
204
-  'lead_source_default_key' => 'Self Generated',
205
-  'lead_source_dom' =>
206
-  array (
203
+    ),
204
+    'lead_source_default_key' => 'Self Generated',
205
+    'lead_source_dom' =>
206
+    array (
207 207
     '' => '',
208 208
     'Cold Call' => 'Cold Call',
209 209
     'Existing Customer' => 'Existing Customer',
@@ -219,26 +219,26 @@  discard block
 block discarded – undo
219 219
     'Email' => 'Email',
220 220
     'Campaign'=>'Campaign',
221 221
     'Other' => 'Other',
222
-  ),
223
-  'opportunity_type_dom' =>
224
-  array (
222
+    ),
223
+    'opportunity_type_dom' =>
224
+    array (
225 225
     '' => '',
226 226
     'Existing Business' => 'Existing Business',
227 227
     'New Business' => 'New Business',
228
-  ),
229
-  'roi_type_dom' =>
228
+    ),
229
+    'roi_type_dom' =>
230 230
     array (
231 231
     'Revenue' => 'Revenue',
232 232
     'Investment'=>'Investment',
233 233
     'Expected_Revenue'=>'Expected Revenue',
234 234
     'Budget'=>'Budget',
235 235
 
236
-  ),
237
-  //Note:  do not translate opportunity_relationship_type_default_key
236
+    ),
237
+    //Note:  do not translate opportunity_relationship_type_default_key
238 238
 //       it is the key for the default opportunity_relationship_type_dom value
239
-  'opportunity_relationship_type_default_key' => 'Primary Decision Maker',
240
-  'opportunity_relationship_type_dom' =>
241
-  array (
239
+    'opportunity_relationship_type_default_key' => 'Primary Decision Maker',
240
+    'opportunity_relationship_type_dom' =>
241
+    array (
242 242
     '' => '',
243 243
     'Primary Decision Maker' => 'Primary Decision Maker',
244 244
     'Business Decision Maker' => 'Business Decision Maker',
@@ -248,29 +248,29 @@  discard block
 block discarded – undo
248 248
     'Executive Sponsor' => 'Executive Sponsor',
249 249
     'Influencer' => 'Influencer',
250 250
     'Other' => 'Other',
251
-  ),
252
-  //Note:  do not translate case_relationship_type_default_key
251
+    ),
252
+    //Note:  do not translate case_relationship_type_default_key
253 253
 //       it is the key for the default case_relationship_type_dom value
254
-  'case_relationship_type_default_key' => 'Primary Contact',
255
-  'case_relationship_type_dom' =>
256
-  array (
254
+    'case_relationship_type_default_key' => 'Primary Contact',
255
+    'case_relationship_type_dom' =>
256
+    array (
257 257
     '' => '',
258 258
     'Primary Contact' => 'Primary Contact',
259 259
     'Alternate Contact' => 'Alternate Contact',
260
-  ),
261
-  'payment_terms' =>
262
-  array (
260
+    ),
261
+    'payment_terms' =>
262
+    array (
263 263
     '' => '',
264 264
     'Net 15' => 'Net 15',
265 265
     'Net 30' => 'Net 30',
266
-  ),
267
-  'sales_stage_default_key' => 'Prospecting',
268
-  'fts_type' => array (
269
-      '' => '',
270
-      'Elastic' => 'elasticsearch'
271
-  ),
272
-  'sales_stage_dom' =>
273
-  array (
266
+    ),
267
+    'sales_stage_default_key' => 'Prospecting',
268
+    'fts_type' => array (
269
+        '' => '',
270
+        'Elastic' => 'elasticsearch'
271
+    ),
272
+    'sales_stage_dom' =>
273
+    array (
274 274
     'Prospecting' => 'Prospecting',
275 275
     'Qualification' => 'Qualification',
276 276
     'Needs Analysis' => 'Needs Analysis',
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
     'Negotiation/Review' => 'Negotiation/Review',
282 282
     'Closed Won' => 'Closed Won',
283 283
     'Closed Lost' => 'Closed Lost',
284
-  ),
285
-  'in_total_group_stages' => array (
284
+    ),
285
+    'in_total_group_stages' => array (
286 286
     'Draft' => 'Draft',
287 287
     'Negotiation' => 'Negotiation',
288 288
     'Delivered' => 'Delivered',
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
     'Closed Accepted' => 'Closed Accepted',
292 292
     'Closed Lost' => 'Closed Lost',
293 293
     'Closed Dead' => 'Closed Dead',
294
-  ),
295
-  'sales_probability_dom' => // keys must be the same as sales_stage_dom
296
-  array (
294
+    ),
295
+    'sales_probability_dom' => // keys must be the same as sales_stage_dom
296
+    array (
297 297
     'Prospecting' => '10',
298 298
     'Qualification' => '20',
299 299
     'Needs Analysis' => '25',
@@ -304,85 +304,85 @@  discard block
 block discarded – undo
304 304
     'Negotiation/Review' => '80',
305 305
     'Closed Won' => '100',
306 306
     'Closed Lost' => '0',
307
-  ),
308
-  'activity_dom' =>
309
-  array (
307
+    ),
308
+    'activity_dom' =>
309
+    array (
310 310
     'Call' => 'Call',
311 311
     'Meeting' => 'Meeting',
312 312
     'Task' => 'Task',
313 313
     'Email' => 'Email',
314 314
     'Note' => 'Note',
315
-  ),
316
-  'salutation_dom' =>
317
-      array (
315
+    ),
316
+    'salutation_dom' =>
317
+        array (
318 318
         '' => '',
319 319
         'Mr.' => 'Mr.',
320 320
         'Ms.' => 'Ms.',
321 321
         'Mrs.' => 'Mrs.',
322 322
         'Dr.' => 'Dr.',
323 323
         'Prof.' => 'Prof.',
324
-      ),
325
-  //time is in seconds; the greater the time the longer it takes;
326
-  'reminder_max_time' => 90000,
327
-  'reminder_time_options' => array( 60=> '1 minute prior',
328
-                                  300=> '5 minutes prior',
329
-                                  600=> '10 minutes prior',
330
-                                  900=> '15 minutes prior',
331
-                                  1800=> '30 minutes prior',
332
-                                  3600=> '1 hour prior',
333
-                                  7200 => '2 hours prior',
334
-                                  10800 => '3 hours prior',
335
-                                  18000 => '5 hours prior',
336
-                                  86400 => '1 day prior',
337
-                                 ),
338
-
339
-  'task_priority_default' => 'Medium',
340
-  'task_priority_dom' =>
341
-  array (
324
+        ),
325
+    //time is in seconds; the greater the time the longer it takes;
326
+    'reminder_max_time' => 90000,
327
+    'reminder_time_options' => array( 60=> '1 minute prior',
328
+                                    300=> '5 minutes prior',
329
+                                    600=> '10 minutes prior',
330
+                                    900=> '15 minutes prior',
331
+                                    1800=> '30 minutes prior',
332
+                                    3600=> '1 hour prior',
333
+                                    7200 => '2 hours prior',
334
+                                    10800 => '3 hours prior',
335
+                                    18000 => '5 hours prior',
336
+                                    86400 => '1 day prior',
337
+                                    ),
338
+
339
+    'task_priority_default' => 'Medium',
340
+    'task_priority_dom' =>
341
+    array (
342 342
     'High' => 'High',
343 343
     'Medium' => 'Medium',
344 344
     'Low' => 'Low',
345
-  ),
346
-  'task_status_default' => 'Not Started',
347
-  'task_status_dom' =>
348
-  array (
345
+    ),
346
+    'task_status_default' => 'Not Started',
347
+    'task_status_dom' =>
348
+    array (
349 349
     'Not Started' => 'Not Started',
350 350
     'In Progress' => 'In Progress',
351 351
     'Completed' => 'Completed',
352 352
     'Pending Input' => 'Pending Input',
353 353
     'Deferred' => 'Deferred',
354
-  ),
355
-  'meeting_status_default' => 'Planned',
356
-  'meeting_status_dom' =>
357
-  array (
354
+    ),
355
+    'meeting_status_default' => 'Planned',
356
+    'meeting_status_dom' =>
357
+    array (
358 358
     'Planned' => 'Planned',
359 359
     'Held' => 'Held',
360 360
     'Not Held' => 'Not Held',
361
-  ),
362
-  'extapi_meeting_password' =>
363
-  array (
364
-      'WebEx' => 'WebEx',
365
-  ),
366
-  'meeting_type_dom' =>
367
-   array (
368
-      'Other' => 'Other',
369
-      'Sugar' => 'SuiteCRM',
370
-   ),
371
-  'call_status_default' => 'Planned',
372
-  'call_status_dom' =>
373
-  array (
361
+    ),
362
+    'extapi_meeting_password' =>
363
+    array (
364
+        'WebEx' => 'WebEx',
365
+    ),
366
+    'meeting_type_dom' =>
367
+    array (
368
+        'Other' => 'Other',
369
+        'Sugar' => 'SuiteCRM',
370
+    ),
371
+    'call_status_default' => 'Planned',
372
+    'call_status_dom' =>
373
+    array (
374 374
     'Planned' => 'Planned',
375 375
     'Held' => 'Held',
376 376
     'Not Held' => 'Not Held',
377
-  ),
378
-  'call_direction_default' => 'Outbound',
379
-  'call_direction_dom' =>
380
-  array (
377
+    ),
378
+    'call_direction_default' => 'Outbound',
379
+    'call_direction_dom' =>
380
+    array (
381 381
     'Inbound' => 'Inbound',
382 382
     'Outbound' => 'Outbound',
383
-  ),
384
-  'lead_status_dom' =>
385
-  array (
383
+    ),
384
+    'lead_status_dom' =>
385
+    array (
386 386
     '' => '',
387 387
     'New' => 'New',
388 388
     'Assigned' => 'Assigned',
@@ -390,54 +390,54 @@  discard block
 block discarded – undo
390 390
     'Converted' => 'Converted',
391 391
     'Recycled' => 'Recycled',
392 392
     'Dead' => 'Dead',
393
-  ),
394
-   'gender_list' =>
395
-  array (
393
+    ),
394
+    'gender_list' =>
395
+    array (
396 396
     'male' => 'Male',
397 397
     'female' => 'Female',
398
-  ),
399
-  //Note:  do not translate case_status_default_key
398
+    ),
399
+    //Note:  do not translate case_status_default_key
400 400
 //       it is the key for the default case_status_dom value
401
-  'case_status_default_key' => 'New',
402
-  'case_status_dom' =>
403
-  array (
401
+    'case_status_default_key' => 'New',
402
+    'case_status_dom' =>
403
+    array (
404 404
     'New' => 'New',
405 405
     'Assigned' => 'Assigned',
406 406
     'Closed' => 'Closed',
407 407
     'Pending Input' => 'Pending Input',
408 408
     'Rejected' => 'Rejected',
409 409
     'Duplicate' => 'Duplicate',
410
-  ),
411
-  'case_priority_default_key' => 'P2',
412
-  'case_priority_dom' =>
413
-  array (
410
+    ),
411
+    'case_priority_default_key' => 'P2',
412
+    'case_priority_dom' =>
413
+    array (
414 414
     'P1' => 'High',
415 415
     'P2' => 'Medium',
416 416
     'P3' => 'Low',
417
-  ),
418
-  'user_type_dom' =>
419
-  array (
417
+    ),
418
+    'user_type_dom' =>
419
+    array (
420 420
     'RegularUser' => 'Regular User',
421 421
     'Administrator' => 'Administrator',
422
-  ),
423
-  'user_status_dom' =>
424
-  array (
422
+    ),
423
+    'user_status_dom' =>
424
+    array (
425 425
     'Active' => 'Active',
426 426
     'Inactive' => 'Inactive',
427
-  ),
428
-  'employee_status_dom' =>
429
-  array (
427
+    ),
428
+    'employee_status_dom' =>
429
+    array (
430 430
     'Active' => 'Active',
431 431
     'Terminated' => 'Terminated',
432 432
     'Leave of Absence' => 'Leave of Absence',
433
-  ),
434
-  'messenger_type_dom' =>
435
-  array (
433
+    ),
434
+    'messenger_type_dom' =>
435
+    array (
436 436
     '' => '',
437 437
     'MSN' => 'MSN',
438 438
     'Yahoo!' => 'Yahoo!',
439 439
     'AOL' => 'AOL',
440
-  ),
440
+    ),
441 441
     'project_task_priority_options' => array (
442 442
         'High' => 'High',
443 443
         'Medium' => 'Medium',
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
         'Low' => 'Low',
481 481
     ),
482 482
     'project_priority_default' => 'Medium',
483
-  //Note:  do not translate record_type_default_key
483
+    //Note:  do not translate record_type_default_key
484 484
 //       it is the key for the default record_type_module value
485
-  'record_type_default_key' => 'Accounts',
486
-  'record_type_display' =>
487
-  array (
485
+    'record_type_default_key' => 'Accounts',
486
+    'record_type_display' =>
487
+    array (
488 488
     '' => '',
489 489
     'Accounts' => 'Account',
490 490
     'Opportunities' => 'Opportunity',
@@ -502,10 +502,10 @@  discard block
 block discarded – undo
502 502
 
503 503
     'Tasks' => 'Task',
504 504
 
505
-  ),
505
+    ),
506 506
 
507
-  'record_type_display_notes' =>
508
-  array (
507
+    'record_type_display_notes' =>
508
+    array (
509 509
     'Accounts' => 'Account',
510 510
     'Contacts' => 'Contact',
511 511
     'Opportunities' => 'Opportunity',
@@ -521,10 +521,10 @@  discard block
 block discarded – undo
521 521
 
522 522
     'Meetings' => 'Meeting',
523 523
     'Calls' => 'Call',
524
-  ),
524
+    ),
525 525
 
526
-  'parent_type_display' =>
527
-  array (
526
+    'parent_type_display' =>
527
+    array (
528 528
     'Accounts' => 'Account',
529 529
     'Contacts' => 'Contact',
530 530
     'Tasks' => 'Task',
@@ -541,48 +541,48 @@  discard block
 block discarded – undo
541 541
 
542 542
     'Prospects' => 'Target',
543 543
 
544
-  ),
544
+    ),
545 545
 
546
-  'issue_priority_default_key' => 'Medium',
547
-  'issue_priority_dom' =>
548
-  array (
546
+    'issue_priority_default_key' => 'Medium',
547
+    'issue_priority_dom' =>
548
+    array (
549 549
     'Urgent' => 'Urgent',
550 550
     'High' => 'High',
551 551
     'Medium' => 'Medium',
552 552
     'Low' => 'Low',
553
-  ),
554
-  'issue_resolution_default_key' => '',
555
-  'issue_resolution_dom' =>
556
-  array (
553
+    ),
554
+    'issue_resolution_default_key' => '',
555
+    'issue_resolution_dom' =>
556
+    array (
557 557
     '' => '',
558 558
     'Accepted' => 'Accepted',
559 559
     'Duplicate' => 'Duplicate',
560 560
     'Closed' => 'Closed',
561 561
     'Out of Date' => 'Out of Date',
562 562
     'Invalid' => 'Invalid',
563
-  ),
563
+    ),
564 564
 
565
-  'issue_status_default_key' => 'New',
566
-  'issue_status_dom' =>
567
-  array (
565
+    'issue_status_default_key' => 'New',
566
+    'issue_status_dom' =>
567
+    array (
568 568
     'New' => 'New',
569 569
     'Assigned' => 'Assigned',
570 570
     'Closed' => 'Closed',
571 571
     'Pending' => 'Pending',
572 572
     'Rejected' => 'Rejected',
573
-  ),
573
+    ),
574 574
 
575
-  'bug_priority_default_key' => 'Medium',
576
-  'bug_priority_dom' =>
577
-  array (
575
+    'bug_priority_default_key' => 'Medium',
576
+    'bug_priority_dom' =>
577
+    array (
578 578
     'Urgent' => 'Urgent',
579 579
     'High' => 'High',
580 580
     'Medium' => 'Medium',
581 581
     'Low' => 'Low',
582
-  ),
583
-   'bug_resolution_default_key' => '',
584
-  'bug_resolution_dom' =>
585
-  array (
582
+    ),
583
+    'bug_resolution_default_key' => '',
584
+    'bug_resolution_dom' =>
585
+    array (
586 586
     '' => '',
587 587
     'Accepted' => 'Accepted',
588 588
     'Duplicate' => 'Duplicate',
@@ -590,42 +590,42 @@  discard block
 block discarded – undo
590 590
     'Out of Date' => 'Out of Date',
591 591
     'Invalid' => 'Invalid',
592 592
     'Later' => 'Later',
593
-  ),
594
-  'bug_status_default_key' => 'New',
595
-  'bug_status_dom' =>
596
-  array (
593
+    ),
594
+    'bug_status_default_key' => 'New',
595
+    'bug_status_dom' =>
596
+    array (
597 597
     'New' => 'New',
598 598
     'Assigned' => 'Assigned',
599 599
     'Closed' => 'Closed',
600 600
     'Pending' => 'Pending',
601 601
     'Rejected' => 'Rejected',
602
-  ),
603
-   'bug_type_default_key' => 'Bug',
604
-  'bug_type_dom' =>
605
-  array (
602
+    ),
603
+    'bug_type_default_key' => 'Bug',
604
+    'bug_type_dom' =>
605
+    array (
606 606
     'Defect' => 'Defect',
607 607
     'Feature' => 'Feature',
608
-  ),
609
- 'case_type_dom' =>
610
-  array (
608
+    ),
609
+    'case_type_dom' =>
610
+    array (
611 611
     'Administration' => 'Administration',
612 612
     'Product' => 'Product',
613 613
     'User' => 'User',
614
-  ),
614
+    ),
615 615
 
616
-  'source_default_key' => '',
617
-  'source_dom' =>
618
-  array (
616
+    'source_default_key' => '',
617
+    'source_dom' =>
618
+    array (
619 619
     '' => '',
620 620
     'Internal' => 'Internal',
621 621
     'Forum' => 'Forum',
622 622
     'Web' => 'Web',
623 623
     'InboundEmail' => 'Email'
624
-  ),
624
+    ),
625 625
 
626
-  'product_category_default_key' => '',
627
-  'product_category_dom' =>
628
-  array (
626
+    'product_category_default_key' => '',
627
+    'product_category_dom' =>
628
+    array (
629 629
     '' => '',
630 630
     'Accounts' => 'Accounts',
631 631
     'Activities' => 'Activities',
@@ -636,15 +636,15 @@  discard block
 block discarded – undo
636 636
     'Cases' => 'Cases',
637 637
     'Contacts' => 'Contacts',
638 638
     'Currencies' => 'Currencies',
639
-  'Dashboard' => 'Dashboard',
640
-  'Documents' => 'Documents',
639
+    'Dashboard' => 'Dashboard',
640
+    'Documents' => 'Documents',
641 641
     'Emails' => 'Emails',
642 642
     'Feeds' => 'Feeds',
643 643
     'Forecasts' => 'Forecasts',
644 644
     'Help' => 'Help',
645 645
     'Home' => 'Home',
646
-  'Leads' => 'Leads',
647
-  'Meetings' => 'Meetings',
646
+    'Leads' => 'Leads',
647
+    'Meetings' => 'Meetings',
648 648
     'Notes' => 'Notes',
649 649
     'Opportunities' => 'Opportunities',
650 650
     'Outlook Plugin' => 'Outlook Plugin',
@@ -655,10 +655,10 @@  discard block
 block discarded – undo
655 655
     'Studio' => 'Studio',
656 656
     'Upgrade' => 'Upgrade',
657 657
     'Users' => 'Users',
658
-  ),
659
-  /*Added entries 'Queued' and 'Sending' for 4.0 release..*/
660
-  'campaign_status_dom' =>
661
-  array (
658
+    ),
659
+    /*Added entries 'Queued' and 'Sending' for 4.0 release..*/
660
+    'campaign_status_dom' =>
661
+    array (
662 662
         '' => '',
663 663
         'Planning' => 'Planning',
664 664
         'Active' => 'Active',
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
         'Complete' => 'Complete',
667 667
         'In Queue' => 'In Queue',
668 668
         'Sending'=> 'Sending',
669
-  ),
670
-  'campaign_type_dom' =>
671
-  array (
669
+    ),
670
+    'campaign_type_dom' =>
671
+    array (
672 672
         '' => '',
673 673
         'Telesales' => 'Telesales',
674 674
         'Mail' => 'Mail',
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
         'NewsLetter' => 'Newsletter',
681 681
         ),
682 682
 
683
-  'newsletter_frequency_dom' =>
684
-  array (
683
+    'newsletter_frequency_dom' =>
684
+    array (
685 685
         '' => '',
686 686
         'Weekly' => 'Weekly',
687 687
         'Monthly' => 'Monthly',
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
         'Annually' => 'Annually',
690 690
         ),
691 691
 
692
-  'notifymail_sendtype' =>
693
-  array (
692
+    'notifymail_sendtype' =>
693
+    array (
694 694
     'SMTP' => 'SMTP',
695
-  ),
696
-      'dom_cal_month_long'=>array(
695
+    ),
696
+        'dom_cal_month_long'=>array(
697 697
                 '0'=>"",
698 698
                 '1'=>"January",
699 699
                 '2'=>"February",
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
                 'pm'=>"pm"
749 749
         ),
750 750
     'dom_meridiem_uppercase'=>array(
751
-                 'AM'=>'AM',
752
-                 'PM'=>'PM'
751
+                    'AM'=>'AM',
752
+                    'PM'=>'PM'
753 753
         ),
754 754
 
755 755
     'dom_report_types'=>array(
@@ -785,26 +785,26 @@  discard block
 block discarded – undo
785 785
                                         'imap'      => 'IMAP',
786 786
     ),
787 787
     'dom_mailbox_type'      => array(/*''           => '--None Specified--',*/
788
-                                     'pick'     => '--None--',
789
-                                     'createcase'  => 'Create Case',
790
-                                     'bounce'   => 'Bounce Handling',
788
+                                        'pick'     => '--None--',
789
+                                        'createcase'  => 'Create Case',
790
+                                        'bounce'   => 'Bounce Handling',
791 791
     ),
792 792
     'dom_email_distribution'=> array(''             => '--None--',
793
-                                     'direct'       => 'Direct Assign',
794
-                                     'roundRobin'   => 'Round-Robin',
795
-                                     'leastBusy'    => 'Least-Busy',
793
+                                        'direct'       => 'Direct Assign',
794
+                                        'roundRobin'   => 'Round-Robin',
795
+                                        'leastBusy'    => 'Least-Busy',
796 796
     ),
797 797
     'dom_email_distribution_for_auto_create'=> array('roundRobin'   => 'Round-Robin',
798
-                                                     'leastBusy'    => 'Least-Busy',
798
+                                                        'leastBusy'    => 'Least-Busy',
799 799
     ),
800 800
     'dom_email_errors'      => array(1 => 'Only select one user when Direct Assigning items.',
801
-                                     2 => 'You must assign Only Checked Items when Direct Assigning items.',
801
+                                        2 => 'You must assign Only Checked Items when Direct Assigning items.',
802 802
     ),
803 803
     'dom_email_bool'        => array('bool_true' => 'Yes',
804
-                                     'bool_false' => 'No',
804
+                                        'bool_false' => 'No',
805 805
     ),
806 806
     'dom_int_bool'          => array(1 => 'Yes',
807
-                                     0 => 'No',
807
+                                        0 => 'No',
808 808
     ),
809 809
     'dom_switch_bool'       => array ('on' => 'Yes',
810 810
                                         'off' => 'No',
@@ -841,19 +841,19 @@  discard block
 block discarded – undo
841 841
     array (
842 842
     'Active' => 'Active',
843 843
     'Inactive' => 'Inactive',
844
-  ),
844
+    ),
845 845
     'forecast_type_dom' =>
846 846
     array (
847 847
     'Direct' => 'Direct',
848 848
     'Rollup' => 'Rollup',
849
-  ),
849
+    ),
850 850
     'document_category_dom' =>
851 851
     array (
852 852
     '' => '',
853 853
     'Marketing' => 'Marketing',
854 854
     'Knowledege Base' => 'Knowledge Base',
855 855
     'Sales' => 'Sales',
856
-  ),
856
+    ),
857 857
 
858 858
     'document_subcategory_dom' =>
859 859
     array (
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
     'Marketing Collateral' => 'Marketing Collateral',
862 862
     'Product Brochures' => 'Product Brochures',
863 863
     'FAQ' => 'FAQ',
864
-  ),
864
+    ),
865 865
 
866 866
     'document_status_dom' =>
867 867
     array (
@@ -871,39 +871,39 @@  discard block
 block discarded – undo
871 871
     'Expired' => 'Expired',
872 872
     'Under Review' => 'Under Review',
873 873
     'Pending' => 'Pending',
874
-  ),
875
-  'document_template_type_dom' =>
876
-  array(
874
+    ),
875
+    'document_template_type_dom' =>
876
+    array(
877 877
     ''=>'',
878 878
     'mailmerge'=>'Mail Merge',
879 879
     'eula'=>'EULA',
880 880
     'nda'=>'NDA',
881 881
     'license'=>'License Agreement',
882
-  ),
882
+    ),
883 883
     'dom_meeting_accept_options' =>
884 884
     array (
885 885
     'accept' => 'Accept',
886 886
     'decline' => 'Decline',
887 887
     'tentative' => 'Tentative',
888
-  ),
888
+    ),
889 889
     'dom_meeting_accept_status' =>
890 890
     array (
891 891
     'accept' => 'Accepted',
892 892
     'decline' => 'Declined',
893 893
     'tentative' => 'Tentative',
894 894
     'none'      => 'None',
895
-  ),
895
+    ),
896 896
     'duration_intervals' => array('0'=>'00',
897 897
                                     '15'=>'15',
898 898
                                     '30'=>'30',
899 899
                                     '45'=>'45',
900
-  ),
900
+    ),
901 901
     'repeat_type_dom' => array(
902
-    	'' => 'None',
903
-    	'Daily'	=> 'Daily',
904
-	'Weekly' => 'Weekly',
905
-	'Monthly' => 'Monthly',
906
-	'Yearly' => 'Yearly',
902
+        '' => 'None',
903
+        'Daily'	=> 'Daily',
904
+    'Weekly' => 'Weekly',
905
+    'Monthly' => 'Monthly',
906
+    'Yearly' => 'Yearly',
907 907
     ),
908 908
 
909 909
     'repeat_intervals' => array(
@@ -915,19 +915,19 @@  discard block
 block discarded – undo
915 915
     ),
916 916
 
917 917
     'duration_dom' => array(
918
-    	'' => 'None',
919
-    	'900' => '15 minutes',
920
-	'1800' => '30 minutes',
921
-	'2700' => '45 minutes',
922
-	'3600' => '1 hour',
923
-	'5400' => '1.5 hours',
924
-	'7200' => '2 hours',
925
-	'10800' => '3 hours',
926
-	'21600' => '6 hours',
927
-	'86400' => '1 day',
928
-	'172800' => '2 days',
929
-	'259200' => '3 days',
930
-	'604800' => '1 week',
918
+        '' => 'None',
919
+        '900' => '15 minutes',
920
+    '1800' => '30 minutes',
921
+    '2700' => '45 minutes',
922
+    '3600' => '1 hour',
923
+    '5400' => '1.5 hours',
924
+    '7200' => '2 hours',
925
+    '10800' => '3 hours',
926
+    '21600' => '6 hours',
927
+    '86400' => '1 day',
928
+    '172800' => '2 days',
929
+    '259200' => '3 days',
930
+    '604800' => '1 week',
931 931
     ),
932 932
 
933 933
 // deferred
@@ -938,31 +938,31 @@  discard block
 block discarded – undo
938 938
 ),
939 939
 */
940 940
 //prospect list type dom
941
-  'prospect_list_type_dom' =>
942
-  array (
941
+    'prospect_list_type_dom' =>
942
+    array (
943 943
     'default' => 'Default',
944 944
     'seed' => 'Seed',
945 945
     'exempt_domain' => 'Suppression List - By Domain',
946 946
     'exempt_address' => 'Suppression List - By Email Address',
947 947
     'exempt' => 'Suppression List - By Id',
948 948
     'test' => 'Test',
949
-  ),
949
+    ),
950 950
 
951
-  'email_settings_num_dom' =>
952
-  array(
951
+    'email_settings_num_dom' =>
952
+    array(
953 953
         '10'    => '10',
954 954
         '20'    => '20',
955 955
         '50'    => '50'
956 956
     ),
957
-  'email_marketing_status_dom' =>
958
-  array (
957
+    'email_marketing_status_dom' =>
958
+    array (
959 959
     '' => '',
960 960
     'active'=>'Active',
961 961
     'inactive'=>'Inactive'
962
-  ),
962
+    ),
963 963
 
964
-  'campainglog_activity_type_dom' =>
965
-  array (
964
+    'campainglog_activity_type_dom' =>
965
+    array (
966 966
     ''=>'',
967 967
     'targeted' => 'Message Sent/Attempted',
968 968
     'send error'=>'Bounced Messages,Other',
@@ -973,27 +973,27 @@  discard block
 block discarded – undo
973 973
     'lead'=>'Leads Created',
974 974
     'contact'=>'Contacts Created',
975 975
     'blocked'=>'Suppressed by address or domain',
976
-  ),
976
+    ),
977 977
 
978
-  'campainglog_target_type_dom' =>
979
-  array (
978
+    'campainglog_target_type_dom' =>
979
+    array (
980 980
     'Contacts' => 'Contacts',
981 981
     'Users'=>'Users',
982 982
     'Prospects'=>'Targets',
983 983
     'Leads'=>'Leads',
984 984
     'Accounts'=>'Accounts',
985
-  ),
986
-  'merge_operators_dom' => array (
985
+    ),
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 998
     'Elastic_boost_options' => array (
999 999
         '0' =>'Disabled',
@@ -1002,15 +1002,15 @@  discard block
 block discarded – undo
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
+    ),
1009 1009
 
1010
-  'navigation_paradigms' => array(
1010
+    'navigation_paradigms' => array(
1011 1011
         'm'=>'Modules',
1012 1012
         'gm'=>'Grouped Modules',
1013
-  ),
1013
+    ),
1014 1014
 
1015 1015
 
1016 1016
     'projects_priority_options' => array (
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
         '300'   => 'Every 5 minutes',
1084 1084
         '600'   => 'Every 10 minutes',
1085 1085
     ),
1086
-  'dashlet_auto_refresh_options_admin' =>
1086
+    'dashlet_auto_refresh_options_admin' =>
1087 1087
     array (
1088 1088
         '-1'  => 'Never',
1089 1089
         '30'  => 'Every 30 seconds',
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
         '300'   => 'Every 5 minutes',
1093 1093
         '600'   => 'Every 10 minutes',
1094 1094
     ),
1095
-  'date_range_search_dom' =>
1096
-  array(
1095
+    'date_range_search_dom' =>
1096
+    array(
1097 1097
     '=' => 'Equals',
1098 1098
     'not_equal' => 'Not On',
1099 1099
     'greater_than' => 'After',
@@ -1109,9 +1109,9 @@  discard block
 block discarded – undo
1109 1109
     'this_year' => 'This Year',
1110 1110
     'next_year' => 'Next Year',
1111 1111
     'between' => 'Is Between',
1112
-  ),
1113
-  'numeric_range_search_dom' =>
1114
-  array(
1112
+    ),
1113
+    'numeric_range_search_dom' =>
1114
+    array(
1115 1115
     '=' => 'Equals',
1116 1116
     'not_equal' => 'Does Not Equal',
1117 1117
     'greater_than' => 'Greater Than',
@@ -1119,46 +1119,46 @@  discard block
 block discarded – undo
1119 1119
     'less_than' => 'Less Than',
1120 1120
     'less_than_equals' => 'Less Than Or Equal To',
1121 1121
     'between' => 'Is Between',
1122
-  ),
1123
-  'lead_conv_activity_opt' =>
1124
-  array(
1122
+    ),
1123
+    'lead_conv_activity_opt' =>
1124
+    array(
1125 1125
         'copy' => 'Copy',
1126 1126
         'move' => 'Move',
1127 1127
         'donothing' => 'Do Nothing',
1128
-  ),
1128
+    ),
1129 1129
 );
1130 1130
 
1131 1131
 $app_strings = array (
1132
-  'LBL_TOUR_NEXT' => 'Next',
1133
-  'LBL_TOUR_SKIP' => 'Skip',
1134
-  'LBL_TOUR_BACK' => 'Back',
1135
-  'LBL_TOUR_CLOSE' => 'Close',
1136
-  'LBL_TOUR_TAKE_TOUR' => 'Take the tour',
1137
-  'LBL_MY_AREA_LINKS' => 'My area links: ' /*for 508 compliance fix*/,
1138
-  'LBL_GETTINGAIR' => 'Getting Air' /*for 508 compliance fix*/,
1139
-  'LBL_WELCOMEBAR' => 'Welcome' /*for 508 compliance fix*/,
1140
-  'LBL_ADVANCEDSEARCH' => 'Advanced Search' /*for 508 compliance fix*/,
1141
-  'LBL_MOREDETAIL' => 'More Detail' /*for 508 compliance fix*/,
1142
-  'LBL_EDIT_INLINE' => 'Edit Inline' /*for 508 compliance fix*/,
1143
-  'LBL_VIEW_INLINE' => 'View' /*for 508 compliance fix*/,
1144
-  'LBL_BASIC_SEARCH' => 'Search' /*for 508 compliance fix*/,
1145
-  'LBL_PROJECT_MINUS' => 'Remove' /*for 508 compliance fix*/,
1146
-  'LBL_PROJECT_PLUS' => 'Add' /*for 508 compliance fix*/,
1147
-  'LBL_Blank' => ' ' /*for 508 compliance fix*/,
1148
-  'LBL_ICON_COLUMN_1' => 'Column' /*for 508 compliance fix*/,
1149
-  'LBL_ICON_COLUMN_2' => '2 Columns' /*for 508 compliance fix*/,
1150
-  'LBL_ICON_COLUMN_3' => '3 Columns' /*for 508 compliance fix*/,
1151
-  'LBL_ADVANCED_SEARCH' => 'Advanced Search' /*for 508 compliance fix*/,
1152
-  'LBL_ID_FF_ADD' => 'Add' /*for 508 compliance fix*/,
1153
-  'LBL_HIDE_SHOW' => 'Hide/Show' /*for 508 compliance fix*/,
1154
-  'LBL_DELETE_INLINE' => 'Delete' /*for 508 compliance fix*/,
1155
-  'LBL_PLUS_INLINE' => 'Add' /*for 508 compliance fix*/,
1156
-  'LBL_ID_FF_CLEAR' => 'Clear' /*for 508 compliance fix*/,
1157
-  'LBL_ID_FF_VCARD' => 'vCard' /*for 508 compliance fix*/,
1158
-  'LBL_ID_FF_REMOVE' => 'Remove' /*for 508 compliance fix*/,
1159
-  'LBL_ADD' => 'Add' /*for 508 compliance fix*/,
1160
-  'LBL_COMPANY_LOGO' => 'Company logo' /*for 508 compliance fix*/,
1161
-  'LBL_JS_CALENDAR' => 'Calendar' /*for 508 compliance fix*/,
1132
+    'LBL_TOUR_NEXT' => 'Next',
1133
+    'LBL_TOUR_SKIP' => 'Skip',
1134
+    'LBL_TOUR_BACK' => 'Back',
1135
+    'LBL_TOUR_CLOSE' => 'Close',
1136
+    'LBL_TOUR_TAKE_TOUR' => 'Take the tour',
1137
+    'LBL_MY_AREA_LINKS' => 'My area links: ' /*for 508 compliance fix*/,
1138
+    'LBL_GETTINGAIR' => 'Getting Air' /*for 508 compliance fix*/,
1139
+    'LBL_WELCOMEBAR' => 'Welcome' /*for 508 compliance fix*/,
1140
+    'LBL_ADVANCEDSEARCH' => 'Advanced Search' /*for 508 compliance fix*/,
1141
+    'LBL_MOREDETAIL' => 'More Detail' /*for 508 compliance fix*/,
1142
+    'LBL_EDIT_INLINE' => 'Edit Inline' /*for 508 compliance fix*/,
1143
+    'LBL_VIEW_INLINE' => 'View' /*for 508 compliance fix*/,
1144
+    'LBL_BASIC_SEARCH' => 'Search' /*for 508 compliance fix*/,
1145
+    'LBL_PROJECT_MINUS' => 'Remove' /*for 508 compliance fix*/,
1146
+    'LBL_PROJECT_PLUS' => 'Add' /*for 508 compliance fix*/,
1147
+    'LBL_Blank' => ' ' /*for 508 compliance fix*/,
1148
+    'LBL_ICON_COLUMN_1' => 'Column' /*for 508 compliance fix*/,
1149
+    'LBL_ICON_COLUMN_2' => '2 Columns' /*for 508 compliance fix*/,
1150
+    'LBL_ICON_COLUMN_3' => '3 Columns' /*for 508 compliance fix*/,
1151
+    'LBL_ADVANCED_SEARCH' => 'Advanced Search' /*for 508 compliance fix*/,
1152
+    'LBL_ID_FF_ADD' => 'Add' /*for 508 compliance fix*/,
1153
+    'LBL_HIDE_SHOW' => 'Hide/Show' /*for 508 compliance fix*/,
1154
+    'LBL_DELETE_INLINE' => 'Delete' /*for 508 compliance fix*/,
1155
+    'LBL_PLUS_INLINE' => 'Add' /*for 508 compliance fix*/,
1156
+    'LBL_ID_FF_CLEAR' => 'Clear' /*for 508 compliance fix*/,
1157
+    'LBL_ID_FF_VCARD' => 'vCard' /*for 508 compliance fix*/,
1158
+    'LBL_ID_FF_REMOVE' => 'Remove' /*for 508 compliance fix*/,
1159
+    'LBL_ADD' => 'Add' /*for 508 compliance fix*/,
1160
+    'LBL_COMPANY_LOGO' => 'Company logo' /*for 508 compliance fix*/,
1161
+    'LBL_JS_CALENDAR' => 'Calendar' /*for 508 compliance fix*/,
1162 1162
     'LBL_ADVANCED' => 'Advanced',
1163 1163
     'LBL_BASIC' => 'Basic',
1164 1164
     'LBL_MODULE_FILTER' => 'Filter By',
@@ -1228,8 +1228,8 @@  discard block
 block discarded – undo
1228 1228
     'LBL_ROUTING_TO'                        => 'to',
1229 1229
     'LBL_ROUTING_TO_ADDRESS'                => 'to address',
1230 1230
     'LBL_ROUTING_WITH_TEMPLATE'             => 'with template',
1231
-  'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM' => 'This record currently contains values in the Office Phone and Address fields. To overwrite these values with the following Office Phone and Address of the Account that you selected, click "OK". To keep the current values, click "Cancel".',
1232
-  'LBL_DROP_HERE' => '[Drop Here]',
1231
+    'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM' => 'This record currently contains values in the Office Phone and Address fields. To overwrite these values with the following Office Phone and Address of the Account that you selected, click "OK". To keep the current values, click "Cancel".',
1232
+    'LBL_DROP_HERE' => '[Drop Here]',
1233 1233
     'LBL_EMAIL_ACCOUNTS_EDIT'               => 'Edit',
1234 1234
     'LBL_EMAIL_ACCOUNTS_GMAIL_DEFAULTS'     => 'Prefill Gmail&#153; Defaults',
1235 1235
     'LBL_EMAIL_ACCOUNTS_NAME'               => 'Name',
@@ -1247,8 +1247,8 @@  discard block
 block discarded – undo
1247 1247
     'LBL_EMAIL_ACCOUNTS_SMTPPASS_REQD'      => 'SMTP Password is required',
1248 1248
     'LBL_EMAIL_ACCOUNTS_TITLE'              => 'Mail Account Management',
1249 1249
     'LBL_EMAIL_POP3_REMOVE_MESSAGE'     => 'Mail Server Protocol of type POP3 will not be supported in the next release. Only IMAP will be supported.',
1250
-  'LBL_EMAIL_ACCOUNTS_SUBTITLE'           => 'Set up Mail Accounts to view incoming emails from your email accounts.',
1251
-  'LBL_EMAIL_ACCOUNTS_OUTBOUND_SUBTITLE'  => 'Provide SMTP mail server information to use for outgoing email in Mail Accounts.',
1250
+    'LBL_EMAIL_ACCOUNTS_SUBTITLE'           => 'Set up Mail Accounts to view incoming emails from your email accounts.',
1251
+    'LBL_EMAIL_ACCOUNTS_OUTBOUND_SUBTITLE'  => 'Provide SMTP mail server information to use for outgoing email in Mail Accounts.',
1252 1252
     'LBL_EMAIL_ADD'                         => 'Add Address',
1253 1253
 
1254 1254
     'LBL_EMAIL_ADDRESS_BOOK_ADD'            => 'Done',
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
     'LBL_EMAIL_MULT_GROUP_FOLDER_ACCOUNTS'  => 'Multiple',
1319 1319
     'LBL_EMAIL_MULT_GROUP_FOLDER_ACCOUNTS_EMPTY' => 'Empty',
1320 1320
     'LBL_EMAIL_DATE_SENT_BY_SENDER'         => 'Date Sent by Sender',
1321
-  'LBL_EMAIL_DATE_RECEIVED'               => 'Date Received',
1321
+    'LBL_EMAIL_DATE_RECEIVED'               => 'Date Received',
1322 1322
     'LBL_EMAIL_ASSIGNED_TO_USER'            => 'Assigned to User',
1323 1323
     'LBL_EMAIL_DATE_TODAY'                  => 'Today',
1324 1324
     'LBL_EMAIL_DATE_YESTERDAY'              => 'Yesterday',
@@ -1563,17 +1563,17 @@  discard block
 block discarded – undo
1563 1563
     'LBL_EMAIL_SETTINGS_TOGGLE_ADV'         => 'Show Advanced',
1564 1564
     'LBL_EMAIL_SETTINGS_USER_FOLDERS'       => 'Available User Folders',
1565 1565
     'LBL_EMAIL_ERROR_PREPEND'               => 'Error:',
1566
-  'LBL_EMAIL_INVALID_PERSONAL_OUTBOUND' => 'The outbound mail server selected for the mail account you are using is invalid.  Check the settings or select a different mail server for the mail account.',
1567
-  'LBL_EMAIL_INVALID_SYSTEM_OUTBOUND' => 'An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.',
1566
+    'LBL_EMAIL_INVALID_PERSONAL_OUTBOUND' => 'The outbound mail server selected for the mail account you are using is invalid.  Check the settings or select a different mail server for the mail account.',
1567
+    'LBL_EMAIL_INVALID_SYSTEM_OUTBOUND' => 'An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.',
1568 1568
     'LBL_EMAIL_SHOW_READ'                   => 'Show All',
1569 1569
     'LBL_EMAIL_SHOW_UNREAD_ONLY'            => 'Show Unread Only',
1570 1570
     'LBL_EMAIL_SIGNATURES'                  => 'Signatures',
1571 1571
     'LBL_EMAIL_SIGNATURE_CREATE'            => 'Create Signature',
1572 1572
     'LBL_EMAIL_SIGNATURE_NAME'              => 'Signature Name',
1573 1573
     'LBL_EMAIL_SIGNATURE_TEXT'              => 'Signature Body',
1574
-  'LBL_SMTPTYPE_GMAIL'                    => 'Gmail',
1575
-  'LBL_SMTPTYPE_YAHOO'                    => 'Yahoo! Mail',
1576
-  'LBL_SMTPTYPE_EXCHANGE'                 => 'Microsoft Exchange',
1574
+    'LBL_SMTPTYPE_GMAIL'                    => 'Gmail',
1575
+    'LBL_SMTPTYPE_YAHOO'                    => 'Yahoo! Mail',
1576
+    'LBL_SMTPTYPE_EXCHANGE'                 => 'Microsoft Exchange',
1577 1577
     'LBL_SMTPTYPE_OTHER'                  => 'Other',
1578 1578
     'LBL_EMAIL_SPACER_MAIL_SERVER'          => '[ Remote Folders ]',
1579 1579
     'LBL_EMAIL_SPACER_LOCAL_FOLDER'         => '[ SuiteCRM Folders ]',
@@ -1880,8 +1880,8 @@  discard block
 block discarded – undo
1880 1880
     'LBL_PRIMARY_ADDRESS_STREET' => 'Primary Address Street:',
1881 1881
     'LBL_PRIMARY_ADDRESS' => 'Primary Address:',
1882 1882
 
1883
-	'LBL_BILLING_STREET'=> 'Street:',
1884
-	'LBL_SHIPPING_STREET'=> 'Street:',
1883
+    'LBL_BILLING_STREET'=> 'Street:',
1884
+    'LBL_SHIPPING_STREET'=> 'Street:',
1885 1885
 
1886 1886
     'LBL_PROSPECTS'=>'Prospects',
1887 1887
     'LBL_PRODUCT_BUNDLES'=>'Product Bundles',
@@ -2151,16 +2151,16 @@  discard block
 block discarded – undo
2151 2151
     'MSG_JS_ALERT_MTG_REMINDER_STATUS' => 'Status: ',
2152 2152
     'MSG_JS_ALERT_MTG_REMINDER_RELATED_TO' => 'Related To: ',
2153 2153
     'MSG_JS_ALERT_MTG_REMINDER_CALL_MSG' => "\nClick OK to view this call or click Cancel to dismiss this message.",
2154
-  	'MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG' => "\nClick OK to view this meeting or click Cancel to dismiss this message.",
2155
-	'MSG_JS_ALERT_MTG_REMINDER_NO_EVENT_NAME' => 'Event',
2156
-	'MSG_JS_ALERT_MTG_REMINDER_NO_DESCRIPTION' => '',
2157
-	'MSG_JS_ALERT_MTG_REMINDER_NO_LOCATION' => 'Location isn\'t set.',
2158
-	'MSG_JS_ALERT_MTG_REMINDER_NO_START_DATE' => 'Start date isn\'t defined.',
2159
- 	'MSG_LIST_VIEW_NO_RESULTS_BASIC' => "No results found.",
2160
-	'MSG_LIST_VIEW_NO_RESULTS' => "No results found for <item1>",
2161
- 	'MSG_LIST_VIEW_NO_RESULTS_SUBMSG' => "Create <item1> as a new <item2>",
2162
-	'MSG_EMPTY_LIST_VIEW_NO_RESULTS' => "You currently have no records saved. <item2> or <item3> one now.",
2163
-	'MSG_EMPTY_LIST_VIEW_NO_RESULTS_SUBMSG' =>	"<item4> to learn more about the <item1> module. In order to access more information, use the user menu drop down located on the main navigation bar to access Help.",
2154
+        'MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG' => "\nClick OK to view this meeting or click Cancel to dismiss this message.",
2155
+    'MSG_JS_ALERT_MTG_REMINDER_NO_EVENT_NAME' => 'Event',
2156
+    'MSG_JS_ALERT_MTG_REMINDER_NO_DESCRIPTION' => '',
2157
+    'MSG_JS_ALERT_MTG_REMINDER_NO_LOCATION' => 'Location isn\'t set.',
2158
+    'MSG_JS_ALERT_MTG_REMINDER_NO_START_DATE' => 'Start date isn\'t defined.',
2159
+        'MSG_LIST_VIEW_NO_RESULTS_BASIC' => "No results found.",
2160
+    'MSG_LIST_VIEW_NO_RESULTS' => "No results found for <item1>",
2161
+        'MSG_LIST_VIEW_NO_RESULTS_SUBMSG' => "Create <item1> as a new <item2>",
2162
+    'MSG_EMPTY_LIST_VIEW_NO_RESULTS' => "You currently have no records saved. <item2> or <item3> one now.",
2163
+    'MSG_EMPTY_LIST_VIEW_NO_RESULTS_SUBMSG' =>	"<item4> to learn more about the <item1> module. In order to access more information, use the user menu drop down located on the main navigation bar to access Help.",
2164 2164
 
2165 2165
     'LBL_CLICK_HERE' => "Click here",
2166 2166
     // contextMenu strings
@@ -2187,13 +2187,13 @@  discard block
 block discarded – undo
2187 2187
     'LBL_TRAINING' => 'Support',
2188 2188
     'ERR_DATABASE_CONN_DROPPED'=>'Error executing a query. Possibly, your database dropped the connection. Please refresh this page, you may need to restart you web server.',
2189 2189
     'ERR_MSSQL_DB_CONTEXT' =>'Changed database context to',
2190
-  'ERR_MSSQL_WARNING' =>'Warning:',
2190
+    'ERR_MSSQL_WARNING' =>'Warning:',
2191 2191
 
2192 2192
     //Meta-Data framework
2193 2193
     'ERR_MISSING_VARDEF_NAME' => 'Warning: field [[field]] does not have a mapped entry in [moduleDir] vardefs.php file',
2194 2194
     'ERR_CANNOT_CREATE_METADATA_FILE' => 'Error: File [[file]] is missing.  Unable to create because no corresponding HTML file was found.',
2195
-  'ERR_CANNOT_FIND_MODULE' => 'Error: Module [module] does not exist.',
2196
-  'LBL_ALT_ADDRESS' => 'Other Address:',
2195
+    'ERR_CANNOT_FIND_MODULE' => 'Error: Module [module] does not exist.',
2196
+    'LBL_ALT_ADDRESS' => 'Other Address:',
2197 2197
     'ERR_SMARTY_UNEQUAL_RELATED_FIELD_PARAMETERS' => 'Error: There are an unequal number of arguments for the \'key\' and \'copy\' elements in the displayParams array.',
2198 2198
     'ERR_SMARTY_MISSING_DISPLAY_PARAMS' => 'Missing index in displayParams Array for: ',
2199 2199
 
@@ -2284,10 +2284,10 @@  discard block
 block discarded – undo
2284 2284
 
2285 2285
     //jc:#12287 - For javascript validation messages
2286 2286
     'MSG_IS_NOT_BEFORE' => 'is not before',
2287
-  'MSG_IS_MORE_THAN' => 'is more than',
2288
-  'MSG_IS_LESS_THAN' => 'is less than',
2289
-  'MSG_SHOULD_BE' => 'should be',
2290
-  'MSG_OR_GREATER' => 'or greater',
2287
+    'MSG_IS_MORE_THAN' => 'is more than',
2288
+    'MSG_IS_LESS_THAN' => 'is less than',
2289
+    'MSG_SHOULD_BE' => 'should be',
2290
+    'MSG_OR_GREATER' => 'or greater',
2291 2291
 
2292 2292
     'LBL_PORTAL_WELCOME_TITLE' => 'Welcome to SuiteCRM Portal',
2293 2293
     'LBL_PORTAL_WELCOME_INFO' => 'SuiteCRM Portal is a framework which provides real-time view of cases, bugs & newsletters etc to customers. This is an external facing interface to SuiteCRM that can be deployed within any website.',
@@ -2319,13 +2319,13 @@  discard block
 block discarded – undo
2319 2319
     'LBL_OPERATOR_NOT_IN_TEXT' => 'is not one of the following:',
2320 2320
 
2321 2321
 
2322
-  //Connector
2322
+    //Connector
2323 2323
     'ERR_CONNECTOR_FILL_BEANS_SIZE_MISMATCH' => 'Error: The Array count of the bean parameter does not match the Array count of the results.',
2324
-  'ERR_MISSING_MAPPING_ENTRY_FORM_MODULE' => 'Error: Missing mapping entry for module.',
2325
-  'ERROR_UNABLE_TO_RETRIEVE_DATA' => 'Error: Unable to retrieve data for {0} Connector.  The service may currently be inaccessible or the configuration settings may be invalid.  Connector error message: ({1}).',
2326
-  'LBL_MERGE_CONNECTORS' => 'Get Data',
2327
-  'LBL_MERGE_CONNECTORS_BUTTON_KEY' => '[D]',
2328
-  'LBL_REMOVE_MODULE_ENTRY' => 'Are you sure you want to disable connector integration for this module?',
2324
+    'ERR_MISSING_MAPPING_ENTRY_FORM_MODULE' => 'Error: Missing mapping entry for module.',
2325
+    'ERROR_UNABLE_TO_RETRIEVE_DATA' => 'Error: Unable to retrieve data for {0} Connector.  The service may currently be inaccessible or the configuration settings may be invalid.  Connector error message: ({1}).',
2326
+    'LBL_MERGE_CONNECTORS' => 'Get Data',
2327
+    'LBL_MERGE_CONNECTORS_BUTTON_KEY' => '[D]',
2328
+    'LBL_REMOVE_MODULE_ENTRY' => 'Are you sure you want to disable connector integration for this module?',
2329 2329
 
2330 2330
     // fastcgi checks
2331 2331
     'LBL_FASTCGI_LOGGING'      => 'For optimal experience using IIS/FastCGI sapi, set fastcgi.logging to 0 in your php.ini file.',
@@ -2336,28 +2336,28 @@  discard block
 block discarded – undo
2336 2336
 
2337 2337
     //martin #25548
2338 2338
     'LBL_NO_FLASH_PLAYER' => 'You either have Abobe Flash turned off or are using an older version of the Adobe Flash Player. To get the latest version of the Flash Player, <a href="http://www.adobe.com/go/getflashplayer/">click here</a>.',
2339
-  //Collection Field
2340
-  'LBL_COLLECTION_NAME' => 'Name',
2341
-  'LBL_COLLECTION_PRIMARY' => 'Primary',
2342
-  'ERROR_MISSING_COLLECTION_SELECTION' => 'Empty required field',
2339
+    //Collection Field
2340
+    'LBL_COLLECTION_NAME' => 'Name',
2341
+    'LBL_COLLECTION_PRIMARY' => 'Primary',
2342
+    'ERROR_MISSING_COLLECTION_SELECTION' => 'Empty required field',
2343 2343
     'LBL_COLLECTION_EXACT' => 'Exact',
2344 2344
 
2345 2345
     //MB -Fixed Bug #32812 -Max
2346 2346
     'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
2347 2347
     'LBL_DESCRIPTION' => 'Description',
2348 2348
 
2349
-  'LBL_YESTERDAY'=> 'yesterday',
2350
-  'LBL_TODAY'=>'today',
2351
-  'LBL_TOMORROW'=>'tomorrow',
2352
-  'LBL_NEXT_WEEK'=> 'next week',
2353
-  'LBL_NEXT_MONDAY'=>'next monday',
2354
-  'LBL_NEXT_FRIDAY'=>'next friday',
2355
-  'LBL_TWO_WEEKS'=> 'two weeks',
2356
-  'LBL_NEXT_MONTH'=> 'next month',
2357
-  'LBL_FIRST_DAY_OF_NEXT_MONTH'=> 'first day of next month',
2358
-  'LBL_THREE_MONTHS'=> 'three months',
2359
-  'LBL_SIXMONTHS'=> 'six months',
2360
-  'LBL_NEXT_YEAR'=> 'next year',
2349
+    'LBL_YESTERDAY'=> 'yesterday',
2350
+    'LBL_TODAY'=>'today',
2351
+    'LBL_TOMORROW'=>'tomorrow',
2352
+    'LBL_NEXT_WEEK'=> 'next week',
2353
+    'LBL_NEXT_MONDAY'=>'next monday',
2354
+    'LBL_NEXT_FRIDAY'=>'next friday',
2355
+    'LBL_TWO_WEEKS'=> 'two weeks',
2356
+    'LBL_NEXT_MONTH'=> 'next month',
2357
+    'LBL_FIRST_DAY_OF_NEXT_MONTH'=> 'first day of next month',
2358
+    'LBL_THREE_MONTHS'=> 'three months',
2359
+    'LBL_SIXMONTHS'=> 'six months',
2360
+    'LBL_NEXT_YEAR'=> 'next year',
2361 2361
     'LBL_FILTERED' => 'Filtered',
2362 2362
 
2363 2363
     //Datetimecombo fields
@@ -2384,7 +2384,7 @@  discard block
 block discarded – undo
2384 2384
 
2385 2385
     //File write error label
2386 2386
     'ERR_FILE_WRITE' => 'Error: Could not write file {0}.  Please check system and web server permissions.',
2387
-  'ERR_FILE_NOT_FOUND' => 'Error: Could not load file {0}.  Please check system and web server permissions.',
2387
+    'ERR_FILE_NOT_FOUND' => 'Error: Could not load file {0}.  Please check system and web server permissions.',
2388 2388
 
2389 2389
     'LBL_AND' => 'And',
2390 2390
     'LBL_BEFORE' => 'Before',
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
     'LBL_ALT_MOVE_COLUMN_UP' =>'Move selected entry up in the displayed list order',
2457 2457
     'LBL_ALT_MOVE_COLUMN_DOWN' => 'Move selected entry down in the displayed list order',
2458 2458
     'LBL_ALT_INFO' => 'Information',
2459
-	'MSG_DUPLICATE' => 'The {0} record you are about to create might be a duplicate of an {0} record that already exists. {1} records containing similar names are listed below.<br>Click Create {1} to continue creating this new {0}, or select an existing {0} listed below.',
2459
+    'MSG_DUPLICATE' => 'The {0} record you are about to create might be a duplicate of an {0} record that already exists. {1} records containing similar names are listed below.<br>Click Create {1} to continue creating this new {0}, or select an existing {0} listed below.',
2460 2460
     'MSG_SHOW_DUPLICATES' => 'The {0} record you are about to create might be a duplicate of a {0} record that already exists. {1} records containing similar names are listed below.  Click Save to continue creating this new {0}, or click Cancel to return to the module without creating the {0}.',
2461 2461
     'LBL_EMAIL_TITLE' => 'email address',
2462 2462
     'LBL_EMAIL_OPT_TITLE' => 'opted out email address',
@@ -2532,9 +2532,9 @@  discard block
 block discarded – undo
2532 2532
     'Expired' => 'Expired',
2533 2533
     'In Review' => 'In Review',
2534 2534
     'Published' => 'Published',
2535
-  );
2535
+    );
2536 2536
 
2537
-   $app_list_strings['kbadmin_actions_dom'] =
2537
+    $app_list_strings['kbadmin_actions_dom'] =
2538 2538
     array (
2539 2539
     ''          => '--Admin Actions--',
2540 2540
     'Create New Tag' => 'Create New Tag',
@@ -2543,10 +2543,10 @@  discard block
 block discarded – undo
2543 2543
     'Move Selected Articles'=>'Move Selected Articles',
2544 2544
     'Apply Tags On Articles'=>'Apply Tags To Articles',
2545 2545
     'Delete Selected Articles'=>'Delete Selected Articles',
2546
-  );
2546
+    );
2547 2547
 
2548 2548
 
2549
-  $app_list_strings['kbdocument_attachment_option_dom'] =
2549
+    $app_list_strings['kbdocument_attachment_option_dom'] =
2550 2550
     array(
2551 2551
         ''=>'',
2552 2552
         'some' => 'Has Attachments',
@@ -2555,10 +2555,10 @@  discard block
 block discarded – undo
2555 2555
         'name' => 'Specify Name',
2556 2556
     );
2557 2557
 
2558
-  $app_list_strings['moduleList']['KBDocuments'] = 'Knowledge Base';
2559
-  $app_strings['LBL_CREATE_KB_DOCUMENT'] = 'Create Article';
2560
-  $app_list_strings['kbdocument_viewing_frequency_dom'] =
2561
-  array(
2558
+    $app_list_strings['moduleList']['KBDocuments'] = 'Knowledge Base';
2559
+    $app_strings['LBL_CREATE_KB_DOCUMENT'] = 'Create Article';
2560
+    $app_list_strings['kbdocument_viewing_frequency_dom'] =
2561
+    array(
2562 2562
     ''=>'',
2563 2563
     'Top_5'  => 'Top 5',
2564 2564
     'Top_10' => 'Top 10',
@@ -2566,9 +2566,9 @@  discard block
 block discarded – undo
2566 2566
     'Bot_5'  => 'Bottom 5',
2567 2567
     'Bot_10' => 'Bottom 10',
2568 2568
     'Bot_20' => 'Bottom 20',
2569
-  );
2569
+    );
2570 2570
 
2571
-   $app_list_strings['kbdocument_canned_search'] =
2571
+    $app_list_strings['kbdocument_canned_search'] =
2572 2572
     array(
2573 2573
         'all'=>'All',
2574 2574
         'added' => 'Added Last 30 days',
@@ -2835,7 +2835,7 @@  discard block
 block discarded – undo
2835 2835
         'ZIMBABWE' => 'ZIMBABWE',
2836 2836
     );
2837 2837
 
2838
-  $app_list_strings['charset_dom'] = array(
2838
+    $app_list_strings['charset_dom'] = array(
2839 2839
     'BIG-5'     => 'BIG-5 (Taiwan and Hong Kong)',
2840 2840
     /*'CP866'     => 'CP866', // ms-dos Cyrillic */
2841 2841
     /*'CP949'     => 'CP949 (Microsoft Korean)', */
@@ -2864,389 +2864,389 @@  discard block
 block discarded – undo
2864 2864
     'KOI8-U'    => 'KOI8-U (Cyrillic Ukranian)',
2865 2865
     'SJIS'      => 'SJIS (MS Japanese)',
2866 2866
     'UTF-8'     => 'UTF-8',
2867
-  );
2868
-
2869
-  $app_list_strings['timezone_dom'] = array(
2870
-
2871
-  'Africa/Algiers' => 'Africa/Algiers',
2872
-  'Africa/Luanda' => 'Africa/Luanda',
2873
-  'Africa/Porto-Novo' => 'Africa/Porto-Novo',
2874
-  'Africa/Gaborone' => 'Africa/Gaborone',
2875
-  'Africa/Ouagadougou' => 'Africa/Ouagadougou',
2876
-  'Africa/Bujumbura' => 'Africa/Bujumbura',
2877
-  'Africa/Douala' => 'Africa/Douala',
2878
-  'Atlantic/Cape_Verde' => 'Atlantic/Cape_Verde',
2879
-  'Africa/Bangui' => 'Africa/Bangui',
2880
-  'Africa/Ndjamena' => 'Africa/Ndjamena',
2881
-  'Indian/Comoro' => 'Indian/Comoro',
2882
-  'Africa/Kinshasa' => 'Africa/Kinshasa',
2883
-  'Africa/Lubumbashi' => 'Africa/Lubumbashi',
2884
-  'Africa/Brazzaville' => 'Africa/Brazzaville',
2885
-  'Africa/Abidjan' => 'Africa/Abidjan',
2886
-  'Africa/Djibouti' => 'Africa/Djibouti',
2887
-  'Africa/Cairo' => 'Africa/Cairo',
2888
-  'Africa/Malabo' => 'Africa/Malabo',
2889
-  'Africa/Asmera' => 'Africa/Asmera',
2890
-  'Africa/Addis_Ababa' => 'Africa/Addis_Ababa',
2891
-  'Africa/Libreville' => 'Africa/Libreville',
2892
-  'Africa/Banjul' => 'Africa/Banjul',
2893
-  'Africa/Accra' => 'Africa/Accra',
2894
-  'Africa/Conakry' => 'Africa/Conakry',
2895
-  'Africa/Bissau' => 'Africa/Bissau',
2896
-  'Africa/Nairobi' => 'Africa/Nairobi',
2897
-  'Africa/Maseru' => 'Africa/Maseru',
2898
-  'Africa/Monrovia' => 'Africa/Monrovia',
2899
-  'Africa/Tripoli' => 'Africa/Tripoli',
2900
-  'Indian/Antananarivo' => 'Indian/Antananarivo',
2901
-  'Africa/Blantyre' => 'Africa/Blantyre',
2902
-  'Africa/Bamako' => 'Africa/Bamako',
2903
-  'Africa/Nouakchott' => 'Africa/Nouakchott',
2904
-  'Indian/Mauritius' => 'Indian/Mauritius',
2905
-  'Indian/Mayotte' => 'Indian/Mayotte',
2906
-  'Africa/Casablanca' => 'Africa/Casablanca',
2907
-  'Africa/El_Aaiun' => 'Africa/El_Aaiun',
2908
-  'Africa/Maputo' => 'Africa/Maputo',
2909
-  'Africa/Windhoek' => 'Africa/Windhoek',
2910
-  'Africa/Niamey' => 'Africa/Niamey',
2911
-  'Africa/Lagos' => 'Africa/Lagos',
2912
-  'Indian/Reunion' => 'Indian/Reunion',
2913
-  'Africa/Kigali' => 'Africa/Kigali',
2914
-  'Atlantic/St_Helena' => 'Atlantic/St_Helena',
2915
-  'Africa/Sao_Tome' => 'Africa/Sao_Tome',
2916
-  'Africa/Dakar' => 'Africa/Dakar',
2917
-  'Indian/Mahe' => 'Indian/Mahe',
2918
-  'Africa/Freetown' => 'Africa/Freetown',
2919
-  'Africa/Mogadishu' => 'Africa/Mogadishu',
2920
-  'Africa/Johannesburg' => 'Africa/Johannesburg',
2921
-  'Africa/Khartoum' => 'Africa/Khartoum',
2922
-  'Africa/Mbabane' => 'Africa/Mbabane',
2923
-  'Africa/Dar_es_Salaam' => 'Africa/Dar_es_Salaam',
2924
-  'Africa/Lome' => 'Africa/Lome',
2925
-  'Africa/Tunis' => 'Africa/Tunis',
2926
-  'Africa/Kampala' => 'Africa/Kampala',
2927
-  'Africa/Lusaka' => 'Africa/Lusaka',
2928
-  'Africa/Harare' => 'Africa/Harare',
2929
-  'Antarctica/Casey' => 'Antarctica/Casey',
2930
-  'Antarctica/Davis' => 'Antarctica/Davis',
2931
-  'Antarctica/Mawson' => 'Antarctica/Mawson',
2932
-  'Indian/Kerguelen' => 'Indian/Kerguelen',
2933
-  'Antarctica/DumontDUrville' => 'Antarctica/DumontDUrville',
2934
-  'Antarctica/Syowa' => 'Antarctica/Syowa',
2935
-  'Antarctica/Vostok' => 'Antarctica/Vostok',
2936
-  'Antarctica/Rothera' => 'Antarctica/Rothera',
2937
-  'Antarctica/Palmer' => 'Antarctica/Palmer',
2938
-  'Antarctica/McMurdo' => 'Antarctica/McMurdo',
2939
-  'Asia/Kabul' => 'Asia/Kabul',
2940
-  'Asia/Yerevan' => 'Asia/Yerevan',
2941
-  'Asia/Baku' => 'Asia/Baku',
2942
-  'Asia/Bahrain' => 'Asia/Bahrain',
2943
-  'Asia/Dhaka' => 'Asia/Dhaka',
2944
-  'Asia/Thimphu' => 'Asia/Thimphu',
2945
-  'Indian/Chagos' => 'Indian/Chagos',
2946
-  'Asia/Brunei' => 'Asia/Brunei',
2947
-  'Asia/Rangoon' => 'Asia/Rangoon',
2948
-  'Asia/Phnom_Penh' => 'Asia/Phnom_Penh',
2949
-  'Asia/Beijing' => 'Asia/Beijing',
2950
-  'Asia/Harbin' => 'Asia/Harbin',
2951
-  'Asia/Shanghai' => 'Asia/Shanghai',
2952
-  'Asia/Chongqing' => 'Asia/Chongqing',
2953
-  'Asia/Urumqi' => 'Asia/Urumqi',
2954
-  'Asia/Kashgar' => 'Asia/Kashgar',
2955
-  'Asia/Hong_Kong' => 'Asia/Hong_Kong',
2956
-  'Asia/Taipei' => 'Asia/Taipei',
2957
-  'Asia/Macau' => 'Asia/Macau',
2958
-  'Asia/Nicosia' => 'Asia/Nicosia',
2959
-  'Asia/Tbilisi' => 'Asia/Tbilisi',
2960
-  'Asia/Dili' => 'Asia/Dili',
2961
-  'Asia/Calcutta' => 'Asia/Calcutta',
2962
-  'Asia/Jakarta' => 'Asia/Jakarta',
2963
-  'Asia/Pontianak' => 'Asia/Pontianak',
2964
-  'Asia/Makassar' => 'Asia/Makassar',
2965
-  'Asia/Jayapura' => 'Asia/Jayapura',
2966
-  'Asia/Tehran' => 'Asia/Tehran',
2967
-  'Asia/Baghdad' => 'Asia/Baghdad',
2968
-  'Asia/Jerusalem' => 'Asia/Jerusalem',
2969
-  'Asia/Tokyo' => 'Asia/Tokyo',
2970
-  'Asia/Amman' => 'Asia/Amman',
2971
-  'Asia/Almaty' => 'Asia/Almaty',
2972
-  'Asia/Qyzylorda' => 'Asia/Qyzylorda',
2973
-  'Asia/Aqtobe' => 'Asia/Aqtobe',
2974
-  'Asia/Aqtau' => 'Asia/Aqtau',
2975
-  'Asia/Oral' => 'Asia/Oral',
2976
-  'Asia/Bishkek' => 'Asia/Bishkek',
2977
-  'Asia/Seoul' => 'Asia/Seoul',
2978
-  'Asia/Pyongyang' => 'Asia/Pyongyang',
2979
-  'Asia/Kuwait' => 'Asia/Kuwait',
2980
-  'Asia/Vientiane' => 'Asia/Vientiane',
2981
-  'Asia/Beirut' => 'Asia/Beirut',
2982
-  'Asia/Kuala_Lumpur' => 'Asia/Kuala_Lumpur',
2983
-  'Asia/Kuching' => 'Asia/Kuching',
2984
-  'Indian/Maldives' => 'Indian/Maldives',
2985
-  'Asia/Hovd' => 'Asia/Hovd',
2986
-  'Asia/Ulaanbaatar' => 'Asia/Ulaanbaatar',
2987
-  'Asia/Choibalsan' => 'Asia/Choibalsan',
2988
-  'Asia/Katmandu' => 'Asia/Katmandu',
2989
-  'Asia/Muscat' => 'Asia/Muscat',
2990
-  'Asia/Karachi' => 'Asia/Karachi',
2991
-  'Asia/Gaza' => 'Asia/Gaza',
2992
-  'Asia/Manila' => 'Asia/Manila',
2993
-  'Asia/Qatar' => 'Asia/Qatar',
2994
-  'Asia/Riyadh' => 'Asia/Riyadh',
2995
-  'Asia/Singapore' => 'Asia/Singapore',
2996
-  'Asia/Colombo' => 'Asia/Colombo',
2997
-  'Asia/Damascus' => 'Asia/Damascus',
2998
-  'Asia/Dushanbe' => 'Asia/Dushanbe',
2999
-  'Asia/Bangkok' => 'Asia/Bangkok',
3000
-  'Asia/Ashgabat' => 'Asia/Ashgabat',
3001
-  'Asia/Dubai' => 'Asia/Dubai',
3002
-  'Asia/Samarkand' => 'Asia/Samarkand',
3003
-  'Asia/Tashkent' => 'Asia/Tashkent',
3004
-  'Asia/Saigon' => 'Asia/Saigon',
3005
-  'Asia/Aden' => 'Asia/Aden',
3006
-  'Australia/Darwin' => 'Australia/Darwin',
3007
-  'Australia/Perth' => 'Australia/Perth',
3008
-  'Australia/Brisbane' => 'Australia/Brisbane',
3009
-  'Australia/Lindeman' => 'Australia/Lindeman',
3010
-  'Australia/Adelaide' => 'Australia/Adelaide',
3011
-  'Australia/Hobart' => 'Australia/Hobart',
3012
-  'Australia/Currie' => 'Australia/Currie',
3013
-  'Australia/Melbourne' => 'Australia/Melbourne',
3014
-  'Australia/Sydney' => 'Australia/Sydney',
3015
-  'Australia/Broken_Hill' => 'Australia/Broken_Hill',
3016
-  'Indian/Christmas' => 'Indian/Christmas',
3017
-  'Pacific/Rarotonga' => 'Pacific/Rarotonga',
3018
-  'Indian/Cocos' => 'Indian/Cocos',
3019
-  'Pacific/Fiji' => 'Pacific/Fiji',
3020
-  'Pacific/Gambier' => 'Pacific/Gambier',
3021
-  'Pacific/Marquesas' => 'Pacific/Marquesas',
3022
-  'Pacific/Tahiti' => 'Pacific/Tahiti',
3023
-  'Pacific/Guam' => 'Pacific/Guam',
3024
-  'Pacific/Tarawa' => 'Pacific/Tarawa',
3025
-  'Pacific/Enderbury' => 'Pacific/Enderbury',
3026
-  'Pacific/Kiritimati' => 'Pacific/Kiritimati',
3027
-  'Pacific/Saipan' => 'Pacific/Saipan',
3028
-  'Pacific/Majuro' => 'Pacific/Majuro',
3029
-  'Pacific/Kwajalein' => 'Pacific/Kwajalein',
3030
-  'Pacific/Truk' => 'Pacific/Truk',
3031
-  'Pacific/Ponape' => 'Pacific/Ponape',
3032
-  'Pacific/Kosrae' => 'Pacific/Kosrae',
3033
-  'Pacific/Nauru' => 'Pacific/Nauru',
3034
-  'Pacific/Noumea' => 'Pacific/Noumea',
3035
-  'Pacific/Auckland' => 'Pacific/Auckland',
3036
-  'Pacific/Chatham' => 'Pacific/Chatham',
3037
-  'Pacific/Niue' => 'Pacific/Niue',
3038
-  'Pacific/Norfolk' => 'Pacific/Norfolk',
3039
-  'Pacific/Palau' => 'Pacific/Palau',
3040
-  'Pacific/Port_Moresby' => 'Pacific/Port_Moresby',
3041
-  'Pacific/Pitcairn' => 'Pacific/Pitcairn',
3042
-  'Pacific/Pago_Pago' => 'Pacific/Pago_Pago',
3043
-  'Pacific/Apia' => 'Pacific/Apia',
3044
-  'Pacific/Guadalcanal' => 'Pacific/Guadalcanal',
3045
-  'Pacific/Fakaofo' => 'Pacific/Fakaofo',
3046
-  'Pacific/Tongatapu' => 'Pacific/Tongatapu',
3047
-  'Pacific/Funafuti' => 'Pacific/Funafuti',
3048
-  'Pacific/Johnston' => 'Pacific/Johnston',
3049
-  'Pacific/Midway' => 'Pacific/Midway',
3050
-  'Pacific/Wake' => 'Pacific/Wake',
3051
-  'Pacific/Efate' => 'Pacific/Efate',
3052
-  'Pacific/Wallis' => 'Pacific/Wallis',
3053
-  'Europe/London' => 'Europe/London',
3054
-  'Europe/Dublin' => 'Europe/Dublin',
3055
-  'WET' => 'WET',
3056
-  'CET' => 'CET',
3057
-  'MET' => 'MET',
3058
-  'EET' => 'EET',
3059
-  'Europe/Tirane' => 'Europe/Tirane',
3060
-  'Europe/Andorra' => 'Europe/Andorra',
3061
-  'Europe/Vienna' => 'Europe/Vienna',
3062
-  'Europe/Minsk' => 'Europe/Minsk',
3063
-  'Europe/Brussels' => 'Europe/Brussels',
3064
-  'Europe/Sofia' => 'Europe/Sofia',
3065
-  'Europe/Prague' => 'Europe/Prague',
3066
-  'Europe/Copenhagen' => 'Europe/Copenhagen',
3067
-  'Atlantic/Faeroe' => 'Atlantic/Faeroe',
3068
-  'America/Danmarkshavn' => 'America/Danmarkshavn',
3069
-  'America/Scoresbysund' => 'America/Scoresbysund',
3070
-  'America/Godthab' => 'America/Godthab',
3071
-  'America/Thule' => 'America/Thule',
3072
-  'Europe/Tallinn' => 'Europe/Tallinn',
3073
-  'Europe/Helsinki' => 'Europe/Helsinki',
3074
-  'Europe/Paris' => 'Europe/Paris',
3075
-  'Europe/Berlin' => 'Europe/Berlin',
3076
-  'Europe/Gibraltar' => 'Europe/Gibraltar',
3077
-  'Europe/Athens' => 'Europe/Athens',
3078
-  'Europe/Budapest' => 'Europe/Budapest',
3079
-  'Atlantic/Reykjavik' => 'Atlantic/Reykjavik',
3080
-  'Europe/Rome' => 'Europe/Rome',
3081
-  'Europe/Riga' => 'Europe/Riga',
3082
-  'Europe/Vaduz' => 'Europe/Vaduz',
3083
-  'Europe/Vilnius' => 'Europe/Vilnius',
3084
-  'Europe/Luxembourg' => 'Europe/Luxembourg',
3085
-  'Europe/Malta' => 'Europe/Malta',
3086
-  'Europe/Chisinau' => 'Europe/Chisinau',
3087
-  'Europe/Monaco' => 'Europe/Monaco',
3088
-  'Europe/Amsterdam' => 'Europe/Amsterdam',
3089
-  'Europe/Oslo' => 'Europe/Oslo',
3090
-  'Europe/Warsaw' => 'Europe/Warsaw',
3091
-  'Europe/Lisbon' => 'Europe/Lisbon',
3092
-  'Atlantic/Azores' => 'Atlantic/Azores',
3093
-  'Atlantic/Madeira' => 'Atlantic/Madeira',
3094
-  'Europe/Bucharest' => 'Europe/Bucharest',
3095
-  'Europe/Kaliningrad' => 'Europe/Kaliningrad',
3096
-  'Europe/Moscow' => 'Europe/Moscow',
3097
-  'Europe/Samara' => 'Europe/Samara',
3098
-  'Asia/Yekaterinburg' => 'Asia/Yekaterinburg',
3099
-  'Asia/Omsk' => 'Asia/Omsk',
3100
-  'Asia/Novosibirsk' => 'Asia/Novosibirsk',
3101
-  'Asia/Krasnoyarsk' => 'Asia/Krasnoyarsk',
3102
-  'Asia/Irkutsk' => 'Asia/Irkutsk',
3103
-  'Asia/Yakutsk' => 'Asia/Yakutsk',
3104
-  'Asia/Vladivostok' => 'Asia/Vladivostok',
3105
-  'Asia/Sakhalin' => 'Asia/Sakhalin',
3106
-  'Asia/Magadan' => 'Asia/Magadan',
3107
-  'Asia/Kamchatka' => 'Asia/Kamchatka',
3108
-  'Asia/Anadyr' => 'Asia/Anadyr',
3109
-  'Europe/Belgrade' => 'Europe/Belgrade' ,
3110
-  'Europe/Madrid' =>'Europe/Madrid' ,
3111
-  'Africa/Ceuta' => 'Africa/Ceuta',
3112
-  'Atlantic/Canary' => 'Atlantic/Canary',
3113
-  'Europe/Stockholm' => 'Europe/Stockholm',
3114
-  'Europe/Zurich' => 'Europe/Zurich' ,
3115
-  'Europe/Istanbul' => 'Europe/Istanbul',
3116
-  'Europe/Kiev' => 'Europe/Kiev',
3117
-  'Europe/Uzhgorod' => 'Europe/Uzhgorod',
3118
-  'Europe/Zaporozhye' => 'Europe/Zaporozhye',
3119
-  'Europe/Simferopol' => 'Europe/Simferopol',
3120
-  'America/New_York' => 'America/New_York',
3121
-  'America/Chicago' =>'America/Chicago' ,
3122
-  'America/North_Dakota/Center' => 'America/North_Dakota/Center',
3123
-  'America/Denver' => 'America/Denver',
3124
-  'America/Los_Angeles' => 'America/Los_Angeles',
3125
-  'America/Juneau' => 'America/Juneau',
3126
-  'America/Yakutat' => 'America/Yakutat',
3127
-  'America/Anchorage' => 'America/Anchorage',
3128
-  'America/Nome' =>'America/Nome' ,
3129
-  'America/Adak' => 'America/Adak',
3130
-  'Pacific/Honolulu' => 'Pacific/Honolulu',
3131
-  'America/Phoenix' => 'America/Phoenix',
3132
-  'America/Boise' => 'America/Boise',
3133
-  'America/Indiana/Indianapolis' => 'America/Indiana/Indianapolis',
3134
-  'America/Indiana/Marengo' => 'America/Indiana/Marengo',
3135
-  'America/Indiana/Knox' =>  'America/Indiana/Knox',
3136
-  'America/Indiana/Vevay' => 'America/Indiana/Vevay',
3137
-  'America/Kentucky/Louisville' =>'America/Kentucky/Louisville'  ,
3138
-  'America/Kentucky/Monticello' =>  'America/Kentucky/Monticello' ,
3139
-  'America/Detroit' => 'America/Detroit',
3140
-  'America/Menominee' => 'America/Menominee',
3141
-  'America/St_Johns' => 'America/St_Johns',
3142
-  'America/Goose_Bay' => 'America/Goose_Bay' ,
3143
-  'America/Halifax' => 'America/Halifax',
3144
-  'America/Glace_Bay' =>'America/Glace_Bay' ,
3145
-  'America/Montreal' => 'America/Montreal',
3146
-  'America/Toronto' => 'America/Toronto',
3147
-  'America/Thunder_Bay' => 'America/Thunder_Bay' ,
3148
-  'America/Nipigon' => 'America/Nipigon',
3149
-  'America/Rainy_River' => 'America/Rainy_River',
3150
-  'America/Winnipeg' => 'America/Winnipeg',
3151
-  'America/Regina' => 'America/Regina',
3152
-  'America/Swift_Current' => 'America/Swift_Current',
3153
-  'America/Edmonton' =>  'America/Edmonton',
3154
-  'America/Vancouver' => 'America/Vancouver',
3155
-  'America/Dawson_Creek' => 'America/Dawson_Creek',
3156
-  'America/Pangnirtung' => 'America/Pangnirtung'  ,
3157
-  'America/Iqaluit' => 'America/Iqaluit' ,
3158
-  'America/Coral_Harbour' => 'America/Coral_Harbour' ,
3159
-  'America/Rankin_Inlet' => 'America/Rankin_Inlet',
3160
-  'America/Cambridge_Bay' => 'America/Cambridge_Bay',
3161
-  'America/Yellowknife' => 'America/Yellowknife',
3162
-  'America/Inuvik' =>'America/Inuvik' ,
3163
-  'America/Whitehorse' => 'America/Whitehorse' ,
3164
-  'America/Dawson' => 'America/Dawson',
3165
-  'America/Cancun' => 'America/Cancun',
3166
-  'America/Merida' => 'America/Merida',
3167
-  'America/Monterrey' => 'America/Monterrey',
3168
-  'America/Mexico_City' => 'America/Mexico_City',
3169
-  'America/Chihuahua' => 'America/Chihuahua',
3170
-  'America/Hermosillo' => 'America/Hermosillo',
3171
-  'America/Mazatlan' => 'America/Mazatlan',
3172
-  'America/Tijuana' => 'America/Tijuana',
3173
-  'America/Anguilla' => 'America/Anguilla',
3174
-  'America/Antigua' => 'America/Antigua',
3175
-  'America/Nassau' =>'America/Nassau' ,
3176
-  'America/Barbados' => 'America/Barbados',
3177
-  'America/Belize' => 'America/Belize',
3178
-  'Atlantic/Bermuda' => 'Atlantic/Bermuda',
3179
-  'America/Cayman' => 'America/Cayman',
3180
-  'America/Costa_Rica' => 'America/Costa_Rica',
3181
-  'America/Havana' => 'America/Havana',
3182
-  'America/Dominica' => 'America/Dominica',
3183
-  'America/Santo_Domingo' => 'America/Santo_Domingo',
3184
-  'America/El_Salvador' => 'America/El_Salvador',
3185
-  'America/Grenada' => 'America/Grenada',
3186
-  'America/Guadeloupe' => 'America/Guadeloupe',
3187
-  'America/Guatemala' => 'America/Guatemala',
3188
-  'America/Port-au-Prince' => 'America/Port-au-Prince',
3189
-  'America/Tegucigalpa' => 'America/Tegucigalpa',
3190
-  'America/Jamaica' => 'America/Jamaica',
3191
-  'America/Martinique' => 'America/Martinique',
3192
-  'America/Montserrat' => 'America/Montserrat',
3193
-  'America/Managua' => 'America/Managua',
3194
-  'America/Panama' => 'America/Panama',
3195
-  'America/Puerto_Rico' =>'America/Puerto_Rico' ,
3196
-  'America/St_Kitts' => 'America/St_Kitts',
3197
-  'America/St_Lucia' => 'America/St_Lucia',
3198
-  'America/Miquelon' => 'America/Miquelon',
3199
-  'America/St_Vincent' => 'America/St_Vincent',
3200
-  'America/Grand_Turk' => 'America/Grand_Turk',
3201
-  'America/Tortola' => 'America/Tortola',
3202
-  'America/St_Thomas' => 'America/St_Thomas',
3203
-  'America/Argentina/Buenos_Aires' => 'America/Argentina/Buenos_Aires',
3204
-  'America/Argentina/Cordoba' => 'America/Argentina/Cordoba',
3205
-  'America/Argentina/Tucuman' => 'America/Argentina/Tucuman',
3206
-  'America/Argentina/La_Rioja' => 'America/Argentina/La_Rioja',
3207
-  'America/Argentina/San_Juan' => 'America/Argentina/San_Juan',
3208
-  'America/Argentina/Jujuy' => 'America/Argentina/Jujuy',
3209
-  'America/Argentina/Catamarca' => 'America/Argentina/Catamarca',
3210
-  'America/Argentina/Mendoza' => 'America/Argentina/Mendoza',
3211
-  'America/Argentina/Rio_Gallegos' => 'America/Argentina/Rio_Gallegos',
3212
-  'America/Argentina/Ushuaia' =>  'America/Argentina/Ushuaia',
3213
-  'America/Aruba' => 'America/Aruba',
3214
-  'America/La_Paz' => 'America/La_Paz',
3215
-  'America/Noronha' => 'America/Noronha',
3216
-  'America/Belem' => 'America/Belem',
3217
-  'America/Fortaleza' => 'America/Fortaleza',
3218
-  'America/Recife' => 'America/Recife',
3219
-  'America/Araguaina' => 'America/Araguaina',
3220
-  'America/Maceio' => 'America/Maceio',
3221
-  'America/Bahia' => 'America/Bahia',
3222
-  'America/Sao_Paulo' => 'America/Sao_Paulo',
3223
-  'America/Campo_Grande' => 'America/Campo_Grande',
3224
-  'America/Cuiaba' => 'America/Cuiaba',
3225
-  'America/Porto_Velho' => 'America/Porto_Velho',
3226
-  'America/Boa_Vista' => 'America/Boa_Vista',
3227
-  'America/Manaus' => 'America/Manaus',
3228
-  'America/Eirunepe' => 'America/Eirunepe',
3229
-  'America/Rio_Branco' => 'America/Rio_Branco',
3230
-  'America/Santiago' => 'America/Santiago',
3231
-  'Pacific/Easter' => 'Pacific/Easter' ,
3232
-  'America/Bogota' => 'America/Bogota',
3233
-  'America/Curacao' => 'America/Curacao',
3234
-  'America/Guayaquil' => 'America/Guayaquil',
3235
-  'Pacific/Galapagos' => 'Pacific/Galapagos' ,
3236
-  'Atlantic/Stanley' => 'Atlantic/Stanley',
3237
-  'America/Cayenne' => 'America/Cayenne',
3238
-  'America/Guyana' => 'America/Guyana',
3239
-  'America/Asuncion' => 'America/Asuncion',
3240
-  'America/Lima' => 'America/Lima',
3241
-  'Atlantic/South_Georgia' => 'Atlantic/South_Georgia',
3242
-  'America/Paramaribo' => 'America/Paramaribo',
3243
-  'America/Port_of_Spain' => 'America/Port_of_Spain',
3244
-  'America/Montevideo' => 'America/Montevideo',
3245
-  'America/Caracas' => 'America/Caracas',
3246
-  );
3247
-
3248
-  $app_list_strings['moduleList']['Sugar_Favorites'] = 'Favorites';
3249
-  $app_list_strings['eapm_list']= array(
2867
+    );
2868
+
2869
+    $app_list_strings['timezone_dom'] = array(
2870
+
2871
+    'Africa/Algiers' => 'Africa/Algiers',
2872
+    'Africa/Luanda' => 'Africa/Luanda',
2873
+    'Africa/Porto-Novo' => 'Africa/Porto-Novo',
2874
+    'Africa/Gaborone' => 'Africa/Gaborone',
2875
+    'Africa/Ouagadougou' => 'Africa/Ouagadougou',
2876
+    'Africa/Bujumbura' => 'Africa/Bujumbura',
2877
+    'Africa/Douala' => 'Africa/Douala',
2878
+    'Atlantic/Cape_Verde' => 'Atlantic/Cape_Verde',
2879
+    'Africa/Bangui' => 'Africa/Bangui',
2880
+    'Africa/Ndjamena' => 'Africa/Ndjamena',
2881
+    'Indian/Comoro' => 'Indian/Comoro',
2882
+    'Africa/Kinshasa' => 'Africa/Kinshasa',
2883
+    'Africa/Lubumbashi' => 'Africa/Lubumbashi',
2884
+    'Africa/Brazzaville' => 'Africa/Brazzaville',
2885
+    'Africa/Abidjan' => 'Africa/Abidjan',
2886
+    'Africa/Djibouti' => 'Africa/Djibouti',
2887
+    'Africa/Cairo' => 'Africa/Cairo',
2888
+    'Africa/Malabo' => 'Africa/Malabo',
2889
+    'Africa/Asmera' => 'Africa/Asmera',
2890
+    'Africa/Addis_Ababa' => 'Africa/Addis_Ababa',
2891
+    'Africa/Libreville' => 'Africa/Libreville',
2892
+    'Africa/Banjul' => 'Africa/Banjul',
2893
+    'Africa/Accra' => 'Africa/Accra',
2894
+    'Africa/Conakry' => 'Africa/Conakry',
2895
+    'Africa/Bissau' => 'Africa/Bissau',
2896
+    'Africa/Nairobi' => 'Africa/Nairobi',
2897
+    'Africa/Maseru' => 'Africa/Maseru',
2898
+    'Africa/Monrovia' => 'Africa/Monrovia',
2899
+    'Africa/Tripoli' => 'Africa/Tripoli',
2900
+    'Indian/Antananarivo' => 'Indian/Antananarivo',
2901
+    'Africa/Blantyre' => 'Africa/Blantyre',
2902
+    'Africa/Bamako' => 'Africa/Bamako',
2903
+    'Africa/Nouakchott' => 'Africa/Nouakchott',
2904
+    'Indian/Mauritius' => 'Indian/Mauritius',
2905
+    'Indian/Mayotte' => 'Indian/Mayotte',
2906
+    'Africa/Casablanca' => 'Africa/Casablanca',
2907
+    'Africa/El_Aaiun' => 'Africa/El_Aaiun',
2908
+    'Africa/Maputo' => 'Africa/Maputo',
2909
+    'Africa/Windhoek' => 'Africa/Windhoek',
2910
+    'Africa/Niamey' => 'Africa/Niamey',
2911
+    'Africa/Lagos' => 'Africa/Lagos',
2912
+    'Indian/Reunion' => 'Indian/Reunion',
2913
+    'Africa/Kigali' => 'Africa/Kigali',
2914
+    'Atlantic/St_Helena' => 'Atlantic/St_Helena',
2915
+    'Africa/Sao_Tome' => 'Africa/Sao_Tome',
2916
+    'Africa/Dakar' => 'Africa/Dakar',
2917
+    'Indian/Mahe' => 'Indian/Mahe',
2918
+    'Africa/Freetown' => 'Africa/Freetown',
2919
+    'Africa/Mogadishu' => 'Africa/Mogadishu',
2920
+    'Africa/Johannesburg' => 'Africa/Johannesburg',
2921
+    'Africa/Khartoum' => 'Africa/Khartoum',
2922
+    'Africa/Mbabane' => 'Africa/Mbabane',
2923
+    'Africa/Dar_es_Salaam' => 'Africa/Dar_es_Salaam',
2924
+    'Africa/Lome' => 'Africa/Lome',
2925
+    'Africa/Tunis' => 'Africa/Tunis',
2926
+    'Africa/Kampala' => 'Africa/Kampala',
2927
+    'Africa/Lusaka' => 'Africa/Lusaka',
2928
+    'Africa/Harare' => 'Africa/Harare',
2929
+    'Antarctica/Casey' => 'Antarctica/Casey',
2930
+    'Antarctica/Davis' => 'Antarctica/Davis',
2931
+    'Antarctica/Mawson' => 'Antarctica/Mawson',
2932
+    'Indian/Kerguelen' => 'Indian/Kerguelen',
2933
+    'Antarctica/DumontDUrville' => 'Antarctica/DumontDUrville',
2934
+    'Antarctica/Syowa' => 'Antarctica/Syowa',
2935
+    'Antarctica/Vostok' => 'Antarctica/Vostok',
2936
+    'Antarctica/Rothera' => 'Antarctica/Rothera',
2937
+    'Antarctica/Palmer' => 'Antarctica/Palmer',
2938
+    'Antarctica/McMurdo' => 'Antarctica/McMurdo',
2939
+    'Asia/Kabul' => 'Asia/Kabul',
2940
+    'Asia/Yerevan' => 'Asia/Yerevan',
2941
+    'Asia/Baku' => 'Asia/Baku',
2942
+    'Asia/Bahrain' => 'Asia/Bahrain',
2943
+    'Asia/Dhaka' => 'Asia/Dhaka',
2944
+    'Asia/Thimphu' => 'Asia/Thimphu',
2945
+    'Indian/Chagos' => 'Indian/Chagos',
2946
+    'Asia/Brunei' => 'Asia/Brunei',
2947
+    'Asia/Rangoon' => 'Asia/Rangoon',
2948
+    'Asia/Phnom_Penh' => 'Asia/Phnom_Penh',
2949
+    'Asia/Beijing' => 'Asia/Beijing',
2950
+    'Asia/Harbin' => 'Asia/Harbin',
2951
+    'Asia/Shanghai' => 'Asia/Shanghai',
2952
+    'Asia/Chongqing' => 'Asia/Chongqing',
2953
+    'Asia/Urumqi' => 'Asia/Urumqi',
2954
+    'Asia/Kashgar' => 'Asia/Kashgar',
2955
+    'Asia/Hong_Kong' => 'Asia/Hong_Kong',
2956
+    'Asia/Taipei' => 'Asia/Taipei',
2957
+    'Asia/Macau' => 'Asia/Macau',
2958
+    'Asia/Nicosia' => 'Asia/Nicosia',
2959
+    'Asia/Tbilisi' => 'Asia/Tbilisi',
2960
+    'Asia/Dili' => 'Asia/Dili',
2961
+    'Asia/Calcutta' => 'Asia/Calcutta',
2962
+    'Asia/Jakarta' => 'Asia/Jakarta',
2963
+    'Asia/Pontianak' => 'Asia/Pontianak',
2964
+    'Asia/Makassar' => 'Asia/Makassar',
2965
+    'Asia/Jayapura' => 'Asia/Jayapura',
2966
+    'Asia/Tehran' => 'Asia/Tehran',
2967
+    'Asia/Baghdad' => 'Asia/Baghdad',
2968
+    'Asia/Jerusalem' => 'Asia/Jerusalem',
2969
+    'Asia/Tokyo' => 'Asia/Tokyo',
2970
+    'Asia/Amman' => 'Asia/Amman',
2971
+    'Asia/Almaty' => 'Asia/Almaty',
2972
+    'Asia/Qyzylorda' => 'Asia/Qyzylorda',
2973
+    'Asia/Aqtobe' => 'Asia/Aqtobe',
2974
+    'Asia/Aqtau' => 'Asia/Aqtau',
2975
+    'Asia/Oral' => 'Asia/Oral',
2976
+    'Asia/Bishkek' => 'Asia/Bishkek',
2977
+    'Asia/Seoul' => 'Asia/Seoul',
2978
+    'Asia/Pyongyang' => 'Asia/Pyongyang',
2979
+    'Asia/Kuwait' => 'Asia/Kuwait',
2980
+    'Asia/Vientiane' => 'Asia/Vientiane',
2981
+    'Asia/Beirut' => 'Asia/Beirut',
2982
+    'Asia/Kuala_Lumpur' => 'Asia/Kuala_Lumpur',
2983
+    'Asia/Kuching' => 'Asia/Kuching',
2984
+    'Indian/Maldives' => 'Indian/Maldives',
2985
+    'Asia/Hovd' => 'Asia/Hovd',
2986
+    'Asia/Ulaanbaatar' => 'Asia/Ulaanbaatar',
2987
+    'Asia/Choibalsan' => 'Asia/Choibalsan',
2988
+    'Asia/Katmandu' => 'Asia/Katmandu',
2989
+    'Asia/Muscat' => 'Asia/Muscat',
2990
+    'Asia/Karachi' => 'Asia/Karachi',
2991
+    'Asia/Gaza' => 'Asia/Gaza',
2992
+    'Asia/Manila' => 'Asia/Manila',
2993
+    'Asia/Qatar' => 'Asia/Qatar',
2994
+    'Asia/Riyadh' => 'Asia/Riyadh',
2995
+    'Asia/Singapore' => 'Asia/Singapore',
2996
+    'Asia/Colombo' => 'Asia/Colombo',
2997
+    'Asia/Damascus' => 'Asia/Damascus',
2998
+    'Asia/Dushanbe' => 'Asia/Dushanbe',
2999
+    'Asia/Bangkok' => 'Asia/Bangkok',
3000
+    'Asia/Ashgabat' => 'Asia/Ashgabat',
3001
+    'Asia/Dubai' => 'Asia/Dubai',
3002
+    'Asia/Samarkand' => 'Asia/Samarkand',
3003
+    'Asia/Tashkent' => 'Asia/Tashkent',
3004
+    'Asia/Saigon' => 'Asia/Saigon',
3005
+    'Asia/Aden' => 'Asia/Aden',
3006
+    'Australia/Darwin' => 'Australia/Darwin',
3007
+    'Australia/Perth' => 'Australia/Perth',
3008
+    'Australia/Brisbane' => 'Australia/Brisbane',
3009
+    'Australia/Lindeman' => 'Australia/Lindeman',
3010
+    'Australia/Adelaide' => 'Australia/Adelaide',
3011
+    'Australia/Hobart' => 'Australia/Hobart',
3012
+    'Australia/Currie' => 'Australia/Currie',
3013
+    'Australia/Melbourne' => 'Australia/Melbourne',
3014
+    'Australia/Sydney' => 'Australia/Sydney',
3015
+    'Australia/Broken_Hill' => 'Australia/Broken_Hill',
3016
+    'Indian/Christmas' => 'Indian/Christmas',
3017
+    'Pacific/Rarotonga' => 'Pacific/Rarotonga',
3018
+    'Indian/Cocos' => 'Indian/Cocos',
3019
+    'Pacific/Fiji' => 'Pacific/Fiji',
3020
+    'Pacific/Gambier' => 'Pacific/Gambier',
3021
+    'Pacific/Marquesas' => 'Pacific/Marquesas',
3022
+    'Pacific/Tahiti' => 'Pacific/Tahiti',
3023
+    'Pacific/Guam' => 'Pacific/Guam',
3024
+    'Pacific/Tarawa' => 'Pacific/Tarawa',
3025
+    'Pacific/Enderbury' => 'Pacific/Enderbury',
3026
+    'Pacific/Kiritimati' => 'Pacific/Kiritimati',
3027
+    'Pacific/Saipan' => 'Pacific/Saipan',
3028
+    'Pacific/Majuro' => 'Pacific/Majuro',
3029
+    'Pacific/Kwajalein' => 'Pacific/Kwajalein',
3030
+    'Pacific/Truk' => 'Pacific/Truk',
3031
+    'Pacific/Ponape' => 'Pacific/Ponape',
3032
+    'Pacific/Kosrae' => 'Pacific/Kosrae',
3033
+    'Pacific/Nauru' => 'Pacific/Nauru',
3034
+    'Pacific/Noumea' => 'Pacific/Noumea',
3035
+    'Pacific/Auckland' => 'Pacific/Auckland',
3036
+    'Pacific/Chatham' => 'Pacific/Chatham',
3037
+    'Pacific/Niue' => 'Pacific/Niue',
3038
+    'Pacific/Norfolk' => 'Pacific/Norfolk',
3039
+    'Pacific/Palau' => 'Pacific/Palau',
3040
+    'Pacific/Port_Moresby' => 'Pacific/Port_Moresby',
3041
+    'Pacific/Pitcairn' => 'Pacific/Pitcairn',
3042
+    'Pacific/Pago_Pago' => 'Pacific/Pago_Pago',
3043
+    'Pacific/Apia' => 'Pacific/Apia',
3044
+    'Pacific/Guadalcanal' => 'Pacific/Guadalcanal',
3045
+    'Pacific/Fakaofo' => 'Pacific/Fakaofo',
3046
+    'Pacific/Tongatapu' => 'Pacific/Tongatapu',
3047
+    'Pacific/Funafuti' => 'Pacific/Funafuti',
3048
+    'Pacific/Johnston' => 'Pacific/Johnston',
3049
+    'Pacific/Midway' => 'Pacific/Midway',
3050
+    'Pacific/Wake' => 'Pacific/Wake',
3051
+    'Pacific/Efate' => 'Pacific/Efate',
3052
+    'Pacific/Wallis' => 'Pacific/Wallis',
3053
+    'Europe/London' => 'Europe/London',
3054
+    'Europe/Dublin' => 'Europe/Dublin',
3055
+    'WET' => 'WET',
3056
+    'CET' => 'CET',
3057
+    'MET' => 'MET',
3058
+    'EET' => 'EET',
3059
+    'Europe/Tirane' => 'Europe/Tirane',
3060
+    'Europe/Andorra' => 'Europe/Andorra',
3061
+    'Europe/Vienna' => 'Europe/Vienna',
3062
+    'Europe/Minsk' => 'Europe/Minsk',
3063
+    'Europe/Brussels' => 'Europe/Brussels',
3064
+    'Europe/Sofia' => 'Europe/Sofia',
3065
+    'Europe/Prague' => 'Europe/Prague',
3066
+    'Europe/Copenhagen' => 'Europe/Copenhagen',
3067
+    'Atlantic/Faeroe' => 'Atlantic/Faeroe',
3068
+    'America/Danmarkshavn' => 'America/Danmarkshavn',
3069
+    'America/Scoresbysund' => 'America/Scoresbysund',
3070
+    'America/Godthab' => 'America/Godthab',
3071
+    'America/Thule' => 'America/Thule',
3072
+    'Europe/Tallinn' => 'Europe/Tallinn',
3073
+    'Europe/Helsinki' => 'Europe/Helsinki',
3074
+    'Europe/Paris' => 'Europe/Paris',
3075
+    'Europe/Berlin' => 'Europe/Berlin',
3076
+    'Europe/Gibraltar' => 'Europe/Gibraltar',
3077
+    'Europe/Athens' => 'Europe/Athens',
3078
+    'Europe/Budapest' => 'Europe/Budapest',
3079
+    'Atlantic/Reykjavik' => 'Atlantic/Reykjavik',
3080
+    'Europe/Rome' => 'Europe/Rome',
3081
+    'Europe/Riga' => 'Europe/Riga',
3082
+    'Europe/Vaduz' => 'Europe/Vaduz',
3083
+    'Europe/Vilnius' => 'Europe/Vilnius',
3084
+    'Europe/Luxembourg' => 'Europe/Luxembourg',
3085
+    'Europe/Malta' => 'Europe/Malta',
3086
+    'Europe/Chisinau' => 'Europe/Chisinau',
3087
+    'Europe/Monaco' => 'Europe/Monaco',
3088
+    'Europe/Amsterdam' => 'Europe/Amsterdam',
3089
+    'Europe/Oslo' => 'Europe/Oslo',
3090
+    'Europe/Warsaw' => 'Europe/Warsaw',
3091
+    'Europe/Lisbon' => 'Europe/Lisbon',
3092
+    'Atlantic/Azores' => 'Atlantic/Azores',
3093
+    'Atlantic/Madeira' => 'Atlantic/Madeira',
3094
+    'Europe/Bucharest' => 'Europe/Bucharest',
3095
+    'Europe/Kaliningrad' => 'Europe/Kaliningrad',
3096
+    'Europe/Moscow' => 'Europe/Moscow',
3097
+    'Europe/Samara' => 'Europe/Samara',
3098
+    'Asia/Yekaterinburg' => 'Asia/Yekaterinburg',
3099
+    'Asia/Omsk' => 'Asia/Omsk',
3100
+    'Asia/Novosibirsk' => 'Asia/Novosibirsk',
3101
+    'Asia/Krasnoyarsk' => 'Asia/Krasnoyarsk',
3102
+    'Asia/Irkutsk' => 'Asia/Irkutsk',
3103
+    'Asia/Yakutsk' => 'Asia/Yakutsk',
3104
+    'Asia/Vladivostok' => 'Asia/Vladivostok',
3105
+    'Asia/Sakhalin' => 'Asia/Sakhalin',
3106
+    'Asia/Magadan' => 'Asia/Magadan',
3107
+    'Asia/Kamchatka' => 'Asia/Kamchatka',
3108
+    'Asia/Anadyr' => 'Asia/Anadyr',
3109
+    'Europe/Belgrade' => 'Europe/Belgrade' ,
3110
+    'Europe/Madrid' =>'Europe/Madrid' ,
3111
+    'Africa/Ceuta' => 'Africa/Ceuta',
3112
+    'Atlantic/Canary' => 'Atlantic/Canary',
3113
+    'Europe/Stockholm' => 'Europe/Stockholm',
3114
+    'Europe/Zurich' => 'Europe/Zurich' ,
3115
+    'Europe/Istanbul' => 'Europe/Istanbul',
3116
+    'Europe/Kiev' => 'Europe/Kiev',
3117
+    'Europe/Uzhgorod' => 'Europe/Uzhgorod',
3118
+    'Europe/Zaporozhye' => 'Europe/Zaporozhye',
3119
+    'Europe/Simferopol' => 'Europe/Simferopol',
3120
+    'America/New_York' => 'America/New_York',
3121
+    'America/Chicago' =>'America/Chicago' ,
3122
+    'America/North_Dakota/Center' => 'America/North_Dakota/Center',
3123
+    'America/Denver' => 'America/Denver',
3124
+    'America/Los_Angeles' => 'America/Los_Angeles',
3125
+    'America/Juneau' => 'America/Juneau',
3126
+    'America/Yakutat' => 'America/Yakutat',
3127
+    'America/Anchorage' => 'America/Anchorage',
3128
+    'America/Nome' =>'America/Nome' ,
3129
+    'America/Adak' => 'America/Adak',
3130
+    'Pacific/Honolulu' => 'Pacific/Honolulu',
3131
+    'America/Phoenix' => 'America/Phoenix',
3132
+    'America/Boise' => 'America/Boise',
3133
+    'America/Indiana/Indianapolis' => 'America/Indiana/Indianapolis',
3134
+    'America/Indiana/Marengo' => 'America/Indiana/Marengo',
3135
+    'America/Indiana/Knox' =>  'America/Indiana/Knox',
3136
+    'America/Indiana/Vevay' => 'America/Indiana/Vevay',
3137
+    'America/Kentucky/Louisville' =>'America/Kentucky/Louisville'  ,
3138
+    'America/Kentucky/Monticello' =>  'America/Kentucky/Monticello' ,
3139
+    'America/Detroit' => 'America/Detroit',
3140
+    'America/Menominee' => 'America/Menominee',
3141
+    'America/St_Johns' => 'America/St_Johns',
3142
+    'America/Goose_Bay' => 'America/Goose_Bay' ,
3143
+    'America/Halifax' => 'America/Halifax',
3144
+    'America/Glace_Bay' =>'America/Glace_Bay' ,
3145
+    'America/Montreal' => 'America/Montreal',
3146
+    'America/Toronto' => 'America/Toronto',
3147
+    'America/Thunder_Bay' => 'America/Thunder_Bay' ,
3148
+    'America/Nipigon' => 'America/Nipigon',
3149
+    'America/Rainy_River' => 'America/Rainy_River',
3150
+    'America/Winnipeg' => 'America/Winnipeg',
3151
+    'America/Regina' => 'America/Regina',
3152
+    'America/Swift_Current' => 'America/Swift_Current',
3153
+    'America/Edmonton' =>  'America/Edmonton',
3154
+    'America/Vancouver' => 'America/Vancouver',
3155
+    'America/Dawson_Creek' => 'America/Dawson_Creek',
3156
+    'America/Pangnirtung' => 'America/Pangnirtung'  ,
3157
+    'America/Iqaluit' => 'America/Iqaluit' ,
3158
+    'America/Coral_Harbour' => 'America/Coral_Harbour' ,
3159
+    'America/Rankin_Inlet' => 'America/Rankin_Inlet',
3160
+    'America/Cambridge_Bay' => 'America/Cambridge_Bay',
3161
+    'America/Yellowknife' => 'America/Yellowknife',
3162
+    'America/Inuvik' =>'America/Inuvik' ,
3163
+    'America/Whitehorse' => 'America/Whitehorse' ,
3164
+    'America/Dawson' => 'America/Dawson',
3165
+    'America/Cancun' => 'America/Cancun',
3166
+    'America/Merida' => 'America/Merida',
3167
+    'America/Monterrey' => 'America/Monterrey',
3168
+    'America/Mexico_City' => 'America/Mexico_City',
3169
+    'America/Chihuahua' => 'America/Chihuahua',
3170
+    'America/Hermosillo' => 'America/Hermosillo',
3171
+    'America/Mazatlan' => 'America/Mazatlan',
3172
+    'America/Tijuana' => 'America/Tijuana',
3173
+    'America/Anguilla' => 'America/Anguilla',
3174
+    'America/Antigua' => 'America/Antigua',
3175
+    'America/Nassau' =>'America/Nassau' ,
3176
+    'America/Barbados' => 'America/Barbados',
3177
+    'America/Belize' => 'America/Belize',
3178
+    'Atlantic/Bermuda' => 'Atlantic/Bermuda',
3179
+    'America/Cayman' => 'America/Cayman',
3180
+    'America/Costa_Rica' => 'America/Costa_Rica',
3181
+    'America/Havana' => 'America/Havana',
3182
+    'America/Dominica' => 'America/Dominica',
3183
+    'America/Santo_Domingo' => 'America/Santo_Domingo',
3184
+    'America/El_Salvador' => 'America/El_Salvador',
3185
+    'America/Grenada' => 'America/Grenada',
3186
+    'America/Guadeloupe' => 'America/Guadeloupe',
3187
+    'America/Guatemala' => 'America/Guatemala',
3188
+    'America/Port-au-Prince' => 'America/Port-au-Prince',
3189
+    'America/Tegucigalpa' => 'America/Tegucigalpa',
3190
+    'America/Jamaica' => 'America/Jamaica',
3191
+    'America/Martinique' => 'America/Martinique',
3192
+    'America/Montserrat' => 'America/Montserrat',
3193
+    'America/Managua' => 'America/Managua',
3194
+    'America/Panama' => 'America/Panama',
3195
+    'America/Puerto_Rico' =>'America/Puerto_Rico' ,
3196
+    'America/St_Kitts' => 'America/St_Kitts',
3197
+    'America/St_Lucia' => 'America/St_Lucia',
3198
+    'America/Miquelon' => 'America/Miquelon',
3199
+    'America/St_Vincent' => 'America/St_Vincent',
3200
+    'America/Grand_Turk' => 'America/Grand_Turk',
3201
+    'America/Tortola' => 'America/Tortola',
3202
+    'America/St_Thomas' => 'America/St_Thomas',
3203
+    'America/Argentina/Buenos_Aires' => 'America/Argentina/Buenos_Aires',
3204
+    'America/Argentina/Cordoba' => 'America/Argentina/Cordoba',
3205
+    'America/Argentina/Tucuman' => 'America/Argentina/Tucuman',
3206
+    'America/Argentina/La_Rioja' => 'America/Argentina/La_Rioja',
3207
+    'America/Argentina/San_Juan' => 'America/Argentina/San_Juan',
3208
+    'America/Argentina/Jujuy' => 'America/Argentina/Jujuy',
3209
+    'America/Argentina/Catamarca' => 'America/Argentina/Catamarca',
3210
+    'America/Argentina/Mendoza' => 'America/Argentina/Mendoza',
3211
+    'America/Argentina/Rio_Gallegos' => 'America/Argentina/Rio_Gallegos',
3212
+    'America/Argentina/Ushuaia' =>  'America/Argentina/Ushuaia',
3213
+    'America/Aruba' => 'America/Aruba',
3214
+    'America/La_Paz' => 'America/La_Paz',
3215
+    'America/Noronha' => 'America/Noronha',
3216
+    'America/Belem' => 'America/Belem',
3217
+    'America/Fortaleza' => 'America/Fortaleza',
3218
+    'America/Recife' => 'America/Recife',
3219
+    'America/Araguaina' => 'America/Araguaina',
3220
+    'America/Maceio' => 'America/Maceio',
3221
+    'America/Bahia' => 'America/Bahia',
3222
+    'America/Sao_Paulo' => 'America/Sao_Paulo',
3223
+    'America/Campo_Grande' => 'America/Campo_Grande',
3224
+    'America/Cuiaba' => 'America/Cuiaba',
3225
+    'America/Porto_Velho' => 'America/Porto_Velho',
3226
+    'America/Boa_Vista' => 'America/Boa_Vista',
3227
+    'America/Manaus' => 'America/Manaus',
3228
+    'America/Eirunepe' => 'America/Eirunepe',
3229
+    'America/Rio_Branco' => 'America/Rio_Branco',
3230
+    'America/Santiago' => 'America/Santiago',
3231
+    'Pacific/Easter' => 'Pacific/Easter' ,
3232
+    'America/Bogota' => 'America/Bogota',
3233
+    'America/Curacao' => 'America/Curacao',
3234
+    'America/Guayaquil' => 'America/Guayaquil',
3235
+    'Pacific/Galapagos' => 'Pacific/Galapagos' ,
3236
+    'Atlantic/Stanley' => 'Atlantic/Stanley',
3237
+    'America/Cayenne' => 'America/Cayenne',
3238
+    'America/Guyana' => 'America/Guyana',
3239
+    'America/Asuncion' => 'America/Asuncion',
3240
+    'America/Lima' => 'America/Lima',
3241
+    'Atlantic/South_Georgia' => 'Atlantic/South_Georgia',
3242
+    'America/Paramaribo' => 'America/Paramaribo',
3243
+    'America/Port_of_Spain' => 'America/Port_of_Spain',
3244
+    'America/Montevideo' => 'America/Montevideo',
3245
+    'America/Caracas' => 'America/Caracas',
3246
+    );
3247
+
3248
+    $app_list_strings['moduleList']['Sugar_Favorites'] = 'Favorites';
3249
+    $app_list_strings['eapm_list']= array(
3250 3250
     'Sugar'=>'SuiteCRM',
3251 3251
     'WebEx'=>'WebEx',
3252 3252
     'GoToMeeting'=>'GoToMeeting',
@@ -3255,14 +3255,14 @@  discard block
 block discarded – undo
3255 3255
     'Box' => 'Box.net',
3256 3256
     'Facebook'=>'Facebook',
3257 3257
     'Twitter'=>'Twitter',
3258
-  );
3259
-  $app_list_strings['eapm_list_import']= array(
3260
-  	'Google' => 'Google Contacts',
3261
-  );
3258
+    );
3259
+    $app_list_strings['eapm_list_import']= array(
3260
+        'Google' => 'Google Contacts',
3261
+    );
3262 3262
 $app_list_strings['eapm_list_documents']= array(
3263
-  	'Google' => 'Google Docs',
3264
-  );
3265
-	$app_list_strings['token_status'] = array(
3263
+        'Google' => 'Google Docs',
3264
+    );
3265
+    $app_list_strings['token_status'] = array(
3266 3266
         1 => 'Request',
3267 3267
         2 => 'Access',
3268 3268
         3 => 'Invalid',
@@ -3272,25 +3272,25 @@  discard block
 block discarded – undo
3272 3272
     '' => '' ,
3273 3273
     'campaign' => 'Campaign' ,
3274 3274
     'email' => 'Email',
3275
-  );
3275
+    );
3276 3276
 
3277 3277
 $app_list_strings ['emailTemplates_type_list_campaigns'] = array (
3278 3278
     '' => '' ,
3279 3279
     'campaign' => 'Campaign' ,
3280
-  );
3280
+    );
3281 3281
 
3282 3282
 $app_list_strings ['emailTemplates_type_list_no_workflow'] = array (
3283 3283
     '' => '' ,
3284 3284
     'campaign' => 'Campaign' ,
3285 3285
     'email' => 'Email',
3286
-  );
3286
+    );
3287 3287
 $app_strings ['documentation'] = array (
3288 3288
     'LBL_DOCS' => 'Documentation',
3289 3289
     'ULT' => '02_Sugar_Ultimate',
3290
-	'ENT' => '02_Sugar_Enterprise',
3291
-	'CORP' => '03_Sugar_Corporate',
3292
-	'PRO' => '04_Sugar_Professional',
3293
-	'COM' => '05_Sugar_Community_Edition'
3290
+    'ENT' => '02_Sugar_Enterprise',
3291
+    'CORP' => '03_Sugar_Corporate',
3292
+    'PRO' => '04_Sugar_Professional',
3293
+    'COM' => '05_Sugar_Community_Edition'
3294 3294
 );
3295 3295
 
3296 3296
 
Please login to merge, or discard this 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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
include/SubPanel/SubPanelSearchDisplay.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 
47 47
 if(empty($_REQUEST['module']))
48 48
 {
49
-	die("'module' was not defined");
49
+    die("'module' was not defined");
50 50
 }
51 51
 
52 52
 if(!isset($beanList[$_REQUEST['module']]))
53 53
 {
54
-	die("'".$_REQUEST['module']."' is not defined in \$beanList");
54
+    die("'".$_REQUEST['module']."' is not defined in \$beanList");
55 55
 }
56 56
 
57 57
 if (!isset($_REQUEST['subpanel'])) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 include('include/SubPanel/SubPanel.php');
68 68
 $layout_def_key = '';
69 69
 if(!empty($_REQUEST['layout_def_key'])){
70
-	$layout_def_key = $_REQUEST['layout_def_key'];
70
+    $layout_def_key = $_REQUEST['layout_def_key'];
71 71
 }
72 72
 
73 73
 $subpanel_object = new CustomSubPanel($module, $record, $subpanel,null, $layout_def_key, $collection);
Please login to merge, or discard this 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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.