Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
include/utils/additional_details.php 1 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/ListView/ListViewSubPanel.php 1 patch
Braces   +42 added lines, -83 removed lines patch added patch discarded remove patch
@@ -111,8 +111,7 @@  discard block
 block discarded – undo
111 111
                     $this->smartyTemplate->assign("THEME", $this->local_theme);
112 112
                     $this->smartyTemplate->assign("IMAGE_PATH", $this->local_image_path);
113 113
                     $this->smartyTemplate->assign("MODULE_NAME", $this->local_current_module);
114
-                }
115
-                else {
114
+                } else {
116 115
                     $GLOBALS['log']->error("NO SMARTY TEMPLATE PATH DEFINED CANNOT CREATE SMARTY TEMPLATE");
117 116
                 }
118 117
             }
@@ -145,8 +144,7 @@  discard block
 block discarded – undo
145 144
 
146 145
             if ($subpanel_def->isCollection()) {
147 146
                 $thepanel = $subpanel_def->get_header_panel_def();
148
-            }
149
-            else {
147
+            } else {
150 148
                 $thepanel = $subpanel_def;
151 149
             }
152 150
 
@@ -212,15 +210,13 @@  discard block
 block discarded – undo
212 210
 
213 211
                         if (!isset($count)) {
214 212
                             $count = 0;
215
-                        }
216
-                        else {
213
+                        } else {
217 214
                             $count++;
218 215
                         }
219 216
 
220 217
                         if ($col_count == 0 || $column_name == 'name') {
221 218
                             $footable = 'data-toggle="true"';
222
-                        }
223
-                        else {
219
+                        } else {
224 220
                             $footable = 'data-hide="phone"';
225 221
                             if ($col_count > 2) {
226 222
                                 $footable = 'data-hide="phone,phonelandscape"';
@@ -230,8 +226,7 @@  discard block
 block discarded – undo
230 226
                             }
231 227
                         }
232 228
 
233
-                    }
234
-                    else {
229
+                    } else {
235 230
                         $buttons = true;
236 231
                     }
237 232
                 }
@@ -272,8 +267,7 @@  discard block
 block discarded – undo
272 267
             $subpanel_list = array();
273 268
             if ($subpanel_def->isCollection()) {
274 269
                 $subpanel_list = $subpanel_def->sub_subpanels;
275
-            }
276
-            else {
270
+            } else {
277 271
                 $subpanel_list[] = $subpanel_def;
278 272
             }
279 273
 
@@ -313,8 +307,7 @@  discard block
 block discarded – undo
313 307
                 if (isset($processed_ids[$aItem->id])) {
314 308
                     continue;
315 309
 
316
-                }
317
-                else {
310
+                } else {
318 311
                     $processed_ids[$aItem->id] = 1;
319 312
                 }
320 313
 
@@ -325,8 +318,7 @@  discard block
 block discarded – undo
325 318
                 if ($this->shouldProcess) {
326 319
                     if ($aItem->ACLAccess('EditView')) {
327 320
                         $widget_contents[$aVal][0] = "<input type='checkbox' class='checkbox' name='mass[]' value='" . $fields['ID'] . "' />";
328
-                    }
329
-                    else {
321
+                    } else {
330 322
                         $widget_contents[$aVal][0] = '';
331 323
                     }
332 324
 //                    if ($aItem->ACLAccess('DetailView')) {
@@ -353,8 +345,7 @@  discard block
 block discarded – undo
353 345
                 //the sub-panel and panel in the bean being processed.
354 346
                 if ($subpanel_def->isCollection()) {
355 347
                     $thepanel = $subpanel_def->sub_subpanels[$aItem->panel_name];
356
-                }
357
-                else {
348
+                } else {
358 349
                     $thepanel = $subpanel_def;
359 350
                 }
360 351
 
@@ -368,8 +359,7 @@  discard block
 block discarded – undo
368 359
                 global $current_user;
369 360
                 if (is_admin($current_user)) {
370 361
                     $aclaccess_is_owner = true;
371
-                }
372
-                else {
362
+                } else {
373 363
                     $aclaccess_is_owner = $aItem->isOwner($current_user->id);
374 364
                 }
375 365
 
@@ -410,8 +400,7 @@  discard block
 block discarded – undo
410 400
                         $count++;
411 401
                         $widget_contents[$aVal][$field_name] = '&nbsp;';
412 402
 
413
-                    }
414
-                    else {
403
+                    } else {
415 404
                         if ($usage != 'query_only') {
416 405
                             $list_field['name'] = $field_name;
417 406
 
@@ -422,15 +411,13 @@  discard block
 block discarded – undo
422 411
                                 $list_field['owner_id'] = $aItem->$owner_field;
423 412
                                 $list_field['owner_module'] = $aItem->$module_field;
424 413
 
425
-                            }
426
-                            else {
414
+                            } else {
427 415
                                 $list_field['owner_id'] = false;
428 416
                                 $list_field['owner_module'] = false;
429 417
                             }
430 418
                             if (isset($list_field['alias'])) {
431 419
                                 $list_field['name'] = $list_field['alias'];
432
-                            }
433
-                            else {
420
+                            } else {
434 421
                                 $list_field['name'] = $field_name;
435 422
                             }
436 423
                             $list_field['fields'] = $fields;
@@ -448,15 +435,13 @@  discard block
 block discarded – undo
448 435
                                 if (isset($vardef['type'])) {
449 436
                                     $fieldType = isset($vardef['custom_type']) ? $vardef['custom_type'] : $vardef['type'];
450 437
                                     $tmpField = SugarFieldHandler::getSugarField($fieldType, true);
451
-                                }
452
-                                else {
438
+                                } else {
453 439
                                     $tmpField = null;
454 440
                                 }
455 441
 
456 442
                                 if ($tmpField != null) {
457 443
                                     $widget_contents[$aVal][$field_name] = SugarFieldHandler::displaySmarty($list_field['fields'], $vardef, 'ListView', $list_field);
458
-                                }
459
-                                else {
444
+                                } else {
460 445
                                     // No SugarField for this particular type
461 446
                                     // Use the old, icky, SugarWidget for now
462 447
                                     $widget_contents[$aVal][$field_name] = $layout_manager->widgetDisplay($list_field);
@@ -476,8 +461,7 @@  discard block
 block discarded – undo
476 461
 
477 462
                                     }
478 463
                                     $widget_contents[$aVal][$field_name] = $layout_manager->widgetDisplay($list_field);
479
-                                }
480
-                                else {
464
+                                } else {
481 465
                                     if (isset($list_field['widget_class']) && $list_field['widget_class'] == 'SubPanelEmailLink') {
482 466
                                         $widget_contents[$aVal][$field_name] = $layout_manager->widgetDisplay($list_field);
483 467
                                     }
@@ -487,8 +471,7 @@  discard block
 block discarded – undo
487 471
                                 if (empty($widget_contents)) {
488 472
                                     $widget_contents[$aVal][$field_name] = '&nbsp;';
489 473
                                 }
490
-                            }
491
-                            else {
474
+                            } else {
492 475
                                 // This handles the edit and remove buttons and icon widget
493 476
                                 if (isset($list_field['widget_class']) && $list_field['widget_class'] == "SubPanelIcon") {
494 477
                                     $count++;
@@ -497,23 +480,20 @@  discard block
 block discarded – undo
497 480
                                     if (empty($widget_contents[$aVal][$field_name])) {
498 481
                                         $widget_contents[$aVal][$field_name] = '&nbsp;';
499 482
                                     }
500
-                                }
501
-                                elseif (preg_match("/button/i", $list_field['name'])) {
483
+                                } elseif (preg_match("/button/i", $list_field['name'])) {
502 484
                                     if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['Delete'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field))) {
503 485
                                         $button_contents[$aVal][] = $_content;
504 486
                                         unset($_content);
505
-                                    }
506
-                                    else {
487
+                                    } else {
507 488
                                         $doNotProcessTheseActions = array("edit_button", "close_button","remove_button");
508 489
                                         if(!in_array($list_field['name'],$doNotProcessTheseActions) && '' != ($_content = $layout_manager->widgetDisplay($list_field))){
509 490
                                             $button_contents[$aVal][] = $_content;
510 491
                                             unset($_content);
511
-                                        }else{
492
+                                        } else{
512 493
                                             $button_contents[$aVal][] = '';
513 494
                                         }
514 495
                                     }
515
-                                }
516
-                                else {
496
+                                } else {
517 497
                                     $count++;
518 498
 //                                    $this->smartyTemplate->assign('CLASS', "");
519 499
                                     $widget_contents[$aVal][$field_name] = $layout_manager->widgetDisplay($list_field);
@@ -563,8 +543,7 @@  discard block
 block discarded – undo
563 543
             // Determine the start location of the last page
564 544
             if ($row_count == 0) {
565 545
                 $number_pages = 0;
566
-            }
567
-            else {
546
+            } else {
568 547
                 $number_pages = floor(($row_count - 1) / $this->records_per_page);
569 548
             }
570 549
 
@@ -612,22 +591,18 @@  discard block
 block discarded – undo
612 591
                 if (0 == $current_offset) {
613 592
                     $start_link = "<button type='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("start_off", "aborder='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
614 593
                     $previous_link = "<button type='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("previous_off", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
615
-                }
616
-                else {
594
+                } else {
617 595
                     if ($this->multi_select_popup) {// nav links for multiselect popup, submit form to save checks.
618 596
                         $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='javascript:save_checks(0, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
619 597
                         $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='javascript:save_checks($previous_offset, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
620
-                    }
621
-                    elseif ($this->shouldProcess) {
598
+                    } elseif ($this->shouldProcess) {
622 599
                         $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick='location.href=\"$start_URL\"; sListView.save_checks(0, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
623 600
                         $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick='location.href=\"$previous_URL\"; sListView.save_checks($previous_offset, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
624
-                    }
625
-                    else {
601
+                    } else {
626 602
                         $onClick = '';
627 603
                         if (0 != preg_match('/javascript.*/', $start_URL)) {
628 604
                             $onClick = "\"$start_URL;\"";
629
-                        }
630
-                        else {
605
+                        } else {
631 606
                             $onClick = "'location.href=\"$start_URL\";'";
632 607
                         }
633 608
                         $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("start", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_START']) . "</button>";
@@ -635,8 +610,7 @@  discard block
 block discarded – undo
635 610
                         $onClick = '';
636 611
                         if (0 != preg_match('/javascript.*/', $previous_URL)) {
637 612
                             $onClick = "\"$previous_URL;\"";
638
-                        }
639
-                        else {
613
+                        } else {
640 614
                             $onClick = "'location.href=\"$previous_URL\";'";
641 615
                         }
642 616
                         $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("previous", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_PREVIOUS']) . "</button>";
@@ -646,25 +620,21 @@  discard block
 block discarded – undo
646 620
                 if ($last_offset <= $current_offset) {
647 621
                     $end_link = "<button type='button' name='listViewEndButton' title='{$this->local_app_strings['LNK_LIST_END']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("end_off", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
648 622
                     $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' disabled>" . SugarThemeRegistry::current()->getImage("next_off", "aborder='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
649
-                }
650
-                else {
623
+                } else {
651 624
                     if ($this->multi_select_popup) { // nav links for multiselect popup, submit form to save checks.
652 625
                         $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='javascript:save_checks($last_offset, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
653 626
                         if (!empty($sugar_config['disable_count_query'])) {
654 627
                             $end_link = '';
655 628
                         }
656 629
                         $next_link = "<button type='button' name='listViewNextButton' title='{$this->local_app_strings['LNK_LIST_NEXT']}' class='button' onClick='javascript:save_checks($next_offset, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
657
-                    }
658
-                    elseif ($this->shouldProcess) {
630
+                    } elseif ($this->shouldProcess) {
659 631
                         $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick='location.href=\"$end_URL\"; sListView.save_checks(\"end\", \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
660 632
                         $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick='location.href=\"$next_URL\"; sListView.save_checks($next_offset, \"{$moduleString}\");'>" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
661
-                    }
662
-                    else {
633
+                    } else {
663 634
                         $onClick = '';
664 635
                         if (0 != preg_match('/javascript.*/', $next_URL)) {
665 636
                             $onClick = "\"$next_URL;\"";
666
-                        }
667
-                        else {
637
+                        } else {
668 638
                             $onClick = "'location.href=\"$next_URL\";'";
669 639
                         }
670 640
                         $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("next", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_NEXT']) . "</button>";
@@ -672,8 +642,7 @@  discard block
 block discarded – undo
672 642
                         $onClick = '';
673 643
                         if (0 != preg_match('/javascript.*/', $end_URL)) {
674 644
                             $onClick = "\"$end_URL;\"";
675
-                        }
676
-                        else {
645
+                        } else {
677 646
                             $onClick = "'location.href=\"$end_URL\";'";
678 647
                         }
679 648
                         $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=" . $onClick . ">" . SugarThemeRegistry::current()->getImage("end", "border='0' align='absmiddle'", null, null, '.gif', $this->local_app_strings['LNK_LIST_END']) . "</button>";
@@ -711,8 +680,7 @@  discard block
 block discarded – undo
711 680
                         $this->show_plus = true;
712 681
                         $total = $pageTotal;
713 682
                         $total_label = $total . '+';
714
-                    }
715
-                    else {
683
+                    } else {
716 684
                         $this->show_plus = false;
717 685
                         $total_label = $total;
718 686
                     }
@@ -728,8 +696,7 @@  discard block
 block discarded – undo
728 696
                         'class' => 'clickMenu selectmenu', 'id' => 'selectLink', 'buttons' => $menuItems, 'flat' => false,
729 697
                     ), $this->smartyTemplate);
730 698
 
731
-                }
732
-                else {
699
+                } else {
733 700
                     $select_link = "&nbsp;";
734 701
                 }
735 702
 
@@ -737,8 +704,7 @@  discard block
 block discarded – undo
737 704
 
738 705
                 if ($this->show_delete_button) {
739 706
                     $delete_link = '<input class="button" type="button" id="delete_button" name="Delete" value="' . $this->local_app_strings['LBL_DELETE_BUTTON_LABEL'] . '" onclick="return sListView.send_mass_update(\'selected\',\'' . $this->local_app_strings['LBL_LISTVIEW_NO_SELECTED'] . '\', 1)">';
740
-                }
741
-                else {
707
+                } else {
742 708
                     $delete_link = '&nbsp;';
743 709
                 }
744 710
 
@@ -779,8 +745,7 @@  discard block
 block discarded – undo
779 745
                     }
780 746
                     $export_link = "&nbsp;";
781 747
                     $merge_link = "&nbsp;";
782
-                }
783
-                elseif ($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") {
748
+                } elseif ($_REQUEST['module'] != "Accounts" && $_REQUEST['module'] != "Cases" && $_REQUEST['module'] != "Contacts" && $_REQUEST['module'] != "Leads" && $_REQUEST['module'] != "Opportunities") {
784 749
                     $merge_link = "&nbsp;";
785 750
                 }
786 751
 
@@ -804,20 +769,17 @@  discard block
 block discarded – undo
804 769
                         //attempt to get the query to recreate this subpanel
805 770
                         if (!empty($this->response)) {
806 771
                             $response =& $this->response;
807
-                        }
808
-                        else {
772
+                        } else {
809 773
                             $response = SugarBean::get_union_related_list($sugarbean, $this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page, $this->query_limit, $subpanel_def);
810 774
                             $this->response = $response;
811 775
                         }
812 776
                         //if query is present, then pass it in as parameter
813 777
                         if (isset($response['query']) && !empty($response['query'])) {
814 778
                             $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']);
815
-                        }
816
-                        else {
779
+                        } else {
817 780
                             $html_text .= $subpanelTiles->get_buttons($subpanel_def);
818 781
                         }
819
-                    }
820
-                    else {
782
+                    } else {
821 783
                         $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  nowrap>$select_link&nbsp;$export_link&nbsp;$delete_link&nbsp;$selected_objects_span";
822 784
                     }
823 785
                     $html_text .= "</td>\n<td nowrap align=\"right\">" . $start_link . "&nbsp;&nbsp;" . $previous_link . "&nbsp;&nbsp;<span class='pageNumbers'>(" . $start_record . " - " . $end_record . " " . $this->local_app_strings['LBL_LIST_OF'] . " " . $row_count . ")</span>&nbsp;&nbsp;" . $next_link . "&nbsp;&nbsp;" . $end_link . "</td></tr></table>\n";
@@ -868,12 +830,10 @@  discard block
 block discarded – undo
868 830
 
869 831
                     if ($this->base_URL == "/index.php") {
870 832
                         $this->base_URL .= "?";
871
-                    }
872
-                    else {
833
+                    } else {
873 834
                         if ($fullRequestString == substr($this->baseURL, '-' . strlen($fullRequestString))) {
874 835
                             $this->base_URL = preg_replace("/&" . $key . "\=.*/", "", $this->base_URL);
875
-                        }
876
-                        else {
836
+                        } else {
877 837
                             $this->base_URL = preg_replace("/&" . $key . "\=.*?&/", "&", $this->base_URL);
878 838
                         }
879 839
                         $this->base_URL .= "&";
@@ -891,8 +851,7 @@  discard block
 block discarded – undo
891 851
                 $this->smartyTemplate->assign("ORDER_BY", $sort_URL_base);
892 852
 
893 853
                 return $sort_URL_base;
894
-            }
895
-            else {
854
+            } else {
896 855
                 return '';
897 856
             }
898 857
         }
Please login to merge, or discard this patch.
include/ListView/ListView.php 1 patch
Braces   +173 added lines, -101 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.
@@ -135,9 +137,13 @@  discard block
 block discarded – undo
135 137
     }
136 138
 
137 139
     //when processing a multi-select popup.
138
-    if($this->process_for_popups && $this->multi_select_popup)  $this->shouldProcess =true;
140
+    if($this->process_for_popups && $this->multi_select_popup) {
141
+        $this->shouldProcess =true;
142
+    }
139 143
     //mass update turned off?
140
-    if(!$this->show_mass_update) $this->shouldProcess = false;
144
+    if(!$this->show_mass_update) {
145
+        $this->shouldProcess = false;
146
+    }
141 147
     if(is_subclass_of($seed, "SugarBean")) {
142 148
         if($seed->bean_implements('ACL')) {
143 149
             if(!ACLController::checkAccess($seed->module_dir,'list',true)) {
@@ -188,8 +194,9 @@  discard block
 block discarded – undo
188 194
 {
189 195
         $this->source_module = $source_module;
190 196
         $this->subpanel_module = $subpanel_def->name;
191
-        if(!isset($this->xTemplate))
192
-            $this->createXTemplate();
197
+        if(!isset($this->xTemplate)) {
198
+                    $this->createXTemplate();
199
+        }
193 200
 
194 201
         $html_var = $this->subpanel_module . "_CELL";
195 202
 
@@ -280,8 +287,9 @@  discard block
 block discarded – undo
280 287
     if ( empty($data) ) {
281 288
         $this->xTemplate->assign("ROW_COLOR", 'oddListRow');
282 289
         $thepanel=$subpanel_def;
283
-        if($subpanel_def->isCollection())
284
-            $thepanel=$subpanel_def->get_header_panel_def();
290
+        if($subpanel_def->isCollection()) {
291
+                    $thepanel=$subpanel_def->get_header_panel_def();
292
+        }
285 293
         $this->xTemplate->assign("COL_COUNT", count($thepanel->get_list_fields()));
286 294
         $this->xTemplate->parse($xtemplateSection.".nodata");
287 295
     }
@@ -339,8 +347,7 @@  discard block
 block discarded – undo
339 347
         {
340 348
             $ROW_COLOR = 'oddListRow';
341 349
             $BG_COLOR =  $odd_bg;
342
-        }
343
-        else
350
+        } else
344 351
         {
345 352
             $ROW_COLOR = 'evenListRow';
346 353
             $BG_COLOR =  $even_bg;
@@ -353,8 +360,9 @@  discard block
 block discarded – undo
353 360
         $layout_manager->setAttribute('context','List');
354 361
         $layout_manager->setAttribute('image_path',$this->local_image_path);
355 362
         $layout_manager->setAttribute('module_name', $subpanel_def->_instance_properties['module']);
356
-        if(!empty($this->child_focus))
357
-            $layout_manager->setAttribute('related_module_name',$this->child_focus->module_dir);
363
+        if(!empty($this->child_focus)) {
364
+                    $layout_manager->setAttribute('related_module_name',$this->child_focus->module_dir);
365
+        }
358 366
 
359 367
         //AG$subpanel_data = $this->list_field_defs;
360 368
         //$bla = array_pop($subpanel_data);
@@ -389,7 +397,9 @@  discard block
 block discarded – undo
389 397
         $linked_field=$thepanel->get_data_source_name();
390 398
         $linked_field_set=$thepanel->get_data_source_name(true);
391 399
         static $count;
392
-        if(!isset($count))$count = 0;
400
+        if(!isset($count)) {
401
+            $count = 0;
402
+        }
393 403
 		/* BEGIN - SECURITY GROUPS */
394 404
 		/**
395 405
         $field_acl['DetailView'] = $aItem->ACLAccess('DetailView');
@@ -420,7 +430,7 @@  discard block
 block discarded – undo
420 430
                 $this->xTemplate->assign('CELL', $widget_contents);
421 431
                 $this->xTemplate->parse($xtemplateSection.".row.cell");
422 432
 
423
-            }else if($usage != 'query_only')
433
+            } else if($usage != 'query_only')
424 434
             {
425 435
                 $list_field['name']=$field_name;
426 436
 
@@ -435,8 +445,11 @@  discard block
 block discarded – undo
435 445
                     $list_field['owner_id'] = false;
436 446
                     $list_field['owner_module'] = false;
437 447
                 }
438
-                if(isset($list_field['alias'])) $list_field['name'] = $list_field['alias'];
439
-                else $list_field['name']=$field_name;
448
+                if(isset($list_field['alias'])) {
449
+                    $list_field['name'] = $list_field['alias'];
450
+                } else {
451
+                    $list_field['name']=$field_name;
452
+                }
440 453
                 $list_field['fields'] = $fields;
441 454
                 $list_field['module'] = $aItem->module_dir;
442 455
                 $list_field['start_link_wrapper'] = $this->start_link_wrapper;
@@ -485,7 +498,9 @@  discard block
 block discarded – undo
485 498
                  $count++;
486 499
                 $this->xTemplate->assign('CELL_COUNT', $count);
487 500
                 $this->xTemplate->assign('CLASS', "");
488
-                if ( empty($widget_contents) ) $widget_contents = '&nbsp;';
501
+                if ( empty($widget_contents) ) {
502
+                    $widget_contents = '&nbsp;';
503
+                }
489 504
                 $this->xTemplate->assign('CELL', $widget_contents);
490 505
                 $this->xTemplate->parse($xtemplateSection.".row.cell");
491 506
                 } else {
@@ -495,7 +510,9 @@  discard block
 block discarded – undo
495 510
 		                $widget_contents = $layout_manager->widgetDisplay($list_field);
496 511
 		                $this->xTemplate->assign('CELL_COUNT', $count);
497 512
 		                $this->xTemplate->assign('CLASS', "");
498
-		                if ( empty($widget_contents) ) $widget_contents = '&nbsp;';
513
+		                if ( empty($widget_contents) ) {
514
+		                    $widget_contents = '&nbsp;';
515
+		                }
499 516
 		                $this->xTemplate->assign('CELL', $widget_contents);
500 517
 		                $this->xTemplate->parse($xtemplateSection.".row.cell");
501 518
                 	} elseif (preg_match("/button/i", $list_field['name'])) {
@@ -503,8 +520,7 @@  discard block
 block discarded – undo
503 520
                         {
504 521
                             $button_contents[] = $_content;
505 522
                             unset($_content);
506
-                        }
507
-                        else
523
+                        } else
508 524
                         {
509 525
                             $button_contents[] = '';
510 526
                         }
@@ -513,7 +529,9 @@  discard block
 block discarded – undo
513 529
                			$this->xTemplate->assign('CLASS', "");
514 530
                			$widget_contents = $layout_manager->widgetDisplay($list_field);
515 531
 		                $this->xTemplate->assign('CELL_COUNT', $count);
516
-		                if ( empty($widget_contents) ) $widget_contents = '&nbsp;';
532
+		                if ( empty($widget_contents) ) {
533
+		                    $widget_contents = '&nbsp;';
534
+		                }
517 535
 		                $this->xTemplate->assign('CELL', $widget_contents);
518 536
 		                $this->xTemplate->parse($xtemplateSection.".row.cell");
519 537
                 	}
@@ -541,8 +559,7 @@  discard block
 block discarded – undo
541 559
                     'class' => 'clickMenu subpanel records fancymenu button',
542 560
                     'flat' => false //assign flat value as false to display dropdown menu at any other preferences.
543 561
                 ), $this->xTemplate);
544
-            }
545
-            else
562
+            } else
546 563
             {
547 564
                 $action_button = '';
548 565
             }
@@ -630,11 +647,13 @@  discard block
 block discarded – undo
630 647
 */
631 648
  function initNewXTemplate($XTemplatePath, $modString, $imagePath = null) {
632 649
     $this->setXTemplatePath($XTemplatePath);
633
-    if(isset($modString))
634
-        $this->setModStrings($modString);
635
-    if(isset($imagePath))
636
-        $this->setImagePath($imagePath);
637
-}
650
+    if(isset($modString)) {
651
+            $this->setModStrings($modString);
652
+    }
653
+    if(isset($imagePath)) {
654
+            $this->setImagePath($imagePath);
655
+    }
656
+    }
638 657
 
639 658
 
640 659
 function getOrderBy($varName, $defaultOrderBy='', $force_sortorder='') {
@@ -715,7 +734,7 @@  discard block
 block discarded – undo
715 734
             }
716 735
             //Just clear from url...
717 736
             $this->appendToBaseUrl[$orderByColumn] = false;
718
-    }else {
737
+    } else {
719 738
         $this->query_orderby = "";
720 739
     }
721 740
     $this->sortby = $sortBy;
@@ -760,8 +779,10 @@  discard block
 block discarded – undo
760 779
 */
761 780
  function setTheme($theme) {
762 781
     $this->local_theme = $theme;
763
-    if(isset($this->xTemplate))$this->xTemplate->assign("THEME", $this->local_theme);
764
-}
782
+    if(isset($this->xTemplate)) {
783
+        $this->xTemplate->assign("THEME", $this->local_theme);
784
+    }
785
+    }
765 786
 
766 787
 /**sets the AppStrings used only use if it is different from the global
767 788
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -771,8 +792,10 @@  discard block
 block discarded – undo
771 792
  function setAppStrings($app_strings) {
772 793
     unset($this->local_app_strings);
773 794
     $this->local_app_strings = $app_strings;
774
-    if(isset($this->xTemplate))$this->xTemplate->assign("APP", $this->local_app_strings);
775
-}
795
+    if(isset($this->xTemplate)) {
796
+        $this->xTemplate->assign("APP", $this->local_app_strings);
797
+    }
798
+    }
776 799
 
777 800
 /**sets the ModStrings used
778 801
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -782,8 +805,10 @@  discard block
 block discarded – undo
782 805
  function setModStrings($mod_strings) {
783 806
     unset($this->local_module_strings);
784 807
     $this->local_mod_strings = $mod_strings;
785
-    if(isset($this->xTemplate))$this->xTemplate->assign("MOD", $this->local_mod_strings);
786
-}
808
+    if(isset($this->xTemplate)) {
809
+        $this->xTemplate->assign("MOD", $this->local_mod_strings);
810
+    }
811
+    }
787 812
 
788 813
 /**sets the ImagePath used
789 814
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -795,8 +820,10 @@  discard block
 block discarded – undo
795 820
     if(empty($this->local_image_path)) {
796 821
         $this->local_image_path = SugarThemeRegistry::get($this->local_theme)->getImagePath();
797 822
     }
798
-    if(isset($this->xTemplate))$this->xTemplate->assign("IMAGE_PATH", $this->local_image_path);
799
-}
823
+    if(isset($this->xTemplate)) {
824
+        $this->xTemplate->assign("IMAGE_PATH", $this->local_image_path);
825
+    }
826
+    }
800 827
 
801 828
 /**sets the currentModule only use if this is different from the global
802 829
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -806,8 +833,10 @@  discard block
 block discarded – undo
806 833
  function setCurrentModule($currentModule) {
807 834
     unset($this->local_current_module);
808 835
     $this->local_current_module = $currentModule;
809
-    if(isset($this->xTemplate))$this->xTemplate->assign("MODULE_NAME", $this->local_current_module);
810
-}
836
+    if(isset($this->xTemplate)) {
837
+        $this->xTemplate->assign("MODULE_NAME", $this->local_current_module);
838
+    }
839
+    }
811 840
 
812 841
 /**INTERNAL FUNCTION creates an XTemplate DO NOT CALL THIS THIS IS AN INTERNAL FUNCTION
813 842
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -820,7 +849,9 @@  discard block
 block discarded – undo
820 849
 
821 850
             $this->xTemplate = new XTemplate($this->xTemplatePath);
822 851
             $this->xTemplate->assign("APP", $this->local_app_strings);
823
-            if(isset($this->local_mod_strings))$this->xTemplate->assign("MOD", $this->local_mod_strings);
852
+            if(isset($this->local_mod_strings)) {
853
+                $this->xTemplate->assign("MOD", $this->local_mod_strings);
854
+            }
824 855
             $this->xTemplate->assign("THEME", $this->local_theme);
825 856
             $this->xTemplate->assign("IMAGE_PATH", $this->local_image_path);
826 857
             $this->xTemplate->assign("MODULE_NAME", $this->local_current_module);
@@ -897,7 +928,9 @@  discard block
 block discarded – undo
897 928
 }
898 929
 
899 930
 function setUserVariable($localVarName,$varName, $value) {
900
-        if($this->is_dynamic ||  $localVarName == 'CELL')return;
931
+        if($this->is_dynamic ||  $localVarName == 'CELL') {
932
+            return;
933
+        }
901 934
         global $current_user;
902 935
         $current_user->setPreference($this->local_current_module."_".$localVarName."_".$varName, $value);
903 936
 }
@@ -921,7 +954,9 @@  discard block
 block discarded – undo
921 954
 
922 955
 function getUserVariable($localVarName, $varName) {
923 956
     global $current_user;
924
-    if($this->is_dynamic ||  $localVarName == 'CELL')return;
957
+    if($this->is_dynamic ||  $localVarName == 'CELL') {
958
+        return;
959
+    }
925 960
     if(isset($_REQUEST[$this->getSessionVariableName($localVarName, $varName)])) {
926 961
 
927 962
             $this->setUserVariable($localVarName,$varName,$_REQUEST[$this->getSessionVariableName($localVarName, $varName)]);
@@ -1000,11 +1035,21 @@  discard block
 block discarded – undo
1000 1035
         //$filter = array('id', 'full_name');
1001 1036
         $filter=array();
1002 1037
         $ret_array = $seed->create_new_list_query($this->query_orderby, $this->query_where, $filter, $params, 0, '', true, $seed, true);
1003
-        if(!is_array($params)) $params = array();
1004
-        if(!isset($params['custom_select'])) $params['custom_select'] = '';
1005
-        if(!isset($params['custom_from'])) $params['custom_from'] = '';
1006
-        if(!isset($params['custom_where'])) $params['custom_where'] = '';
1007
-        if(!isset($params['custom_order_by'])) $params['custom_order_by'] = '';
1038
+        if(!is_array($params)) {
1039
+            $params = array();
1040
+        }
1041
+        if(!isset($params['custom_select'])) {
1042
+            $params['custom_select'] = '';
1043
+        }
1044
+        if(!isset($params['custom_from'])) {
1045
+            $params['custom_from'] = '';
1046
+        }
1047
+        if(!isset($params['custom_where'])) {
1048
+            $params['custom_where'] = '';
1049
+        }
1050
+        if(!isset($params['custom_order_by'])) {
1051
+            $params['custom_order_by'] = '';
1052
+        }
1008 1053
         $main_query = $ret_array['select'] . $params['custom_select'] . $ret_array['from'] . $params['custom_from'] . $ret_array['where'] . $params['custom_where'] . $ret_array['order_by'] . $params['custom_order_by'];
1009 1054
         SugarVCR::store($seed->module_dir,  $main_query);
1010 1055
         //ADDING VCR CONTROL
@@ -1065,8 +1110,7 @@  discard block
 block discarded – undo
1065 1110
             {
1066 1111
                 $sort_order['session'] = $sort_order['session'] == 'asc' ? 'desc' : 'asc';
1067 1112
             }
1068
-        }
1069
-        else
1113
+        } else
1070 1114
         {
1071 1115
             $sort_order['session'] = null;
1072 1116
         }
@@ -1098,7 +1142,7 @@  discard block
 block discarded – undo
1098 1142
         if(!empty($this->response)){
1099 1143
             $response =& $this->response;
1100 1144
             echo 'cached';
1101
-        }else{
1145
+        } else{
1102 1146
             $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page,$this->query_limit,$subpanel_def);
1103 1147
             $this->response =& $response;
1104 1148
         }
@@ -1106,7 +1150,9 @@  discard block
 block discarded – undo
1106 1150
         $row_count = $response['row_count'];
1107 1151
         $next_offset = $response['next_offset'];
1108 1152
         $previous_offset = $response['previous_offset'];
1109
-        if(!empty($response['current_offset']))$current_offset = $response['current_offset'];
1153
+        if(!empty($response['current_offset'])) {
1154
+            $current_offset = $response['current_offset'];
1155
+        }
1110 1156
         global $list_view_row_count;
1111 1157
         $list_view_row_count = $row_count;
1112 1158
         $this->processListNavigation('dyn_list_view', $html_var, $current_offset, $next_offset, $previous_offset, $row_count, $sugarbean,$subpanel_def);
@@ -1117,7 +1163,9 @@  discard block
 block discarded – undo
1117 1163
     function getBaseURL($html_varName) {
1118 1164
         static $cache = array();
1119 1165
 
1120
-        if(!empty($cache[$html_varName]))return $cache[$html_varName];
1166
+        if(!empty($cache[$html_varName])) {
1167
+            return $cache[$html_varName];
1168
+        }
1121 1169
         $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount','current_query_by_page');
1122 1170
         if(!empty($this->base_URL)) {
1123 1171
             return $this->base_URL;
@@ -1137,10 +1185,11 @@  discard block
 block discarded – undo
1137 1185
                 {
1138 1186
                     if(is_array($value)) {
1139 1187
                         foreach($value as $valuename=>$valuevalue) {
1140
-                            if(substr_count($baseurl, '?') > 0)
1141
-                                $baseurl	.= "&{$name}[]=".$valuevalue;
1142
-                            else
1143
-                                $baseurl	.= "?{$name}[]=".$valuevalue;
1188
+                            if(substr_count($baseurl, '?') > 0) {
1189
+                                                            $baseurl	.= "&{$name}[]=".$valuevalue;
1190
+                            } else {
1191
+                                                            $baseurl	.= "?{$name}[]=".$valuevalue;
1192
+                            }
1144 1193
                         }
1145 1194
                     } else {
1146 1195
                         $value = urlencode($value);
@@ -1159,9 +1208,15 @@  discard block
 block discarded – undo
1159 1208
                 if(substr_count($baseurl, '?') == 0) {
1160 1209
                     $baseurl .= '?';
1161 1210
                 }
1162
-                if(isset($_REQUEST['action'])) $baseurl.= '&action='.$_REQUEST['action'];
1163
-                if(isset($_REQUEST['record'])) $baseurl .= '&record='.$_REQUEST['record'];
1164
-                if(isset($_REQUEST['module'])) $baseurl .= '&module='.$_REQUEST['module'];
1211
+                if(isset($_REQUEST['action'])) {
1212
+                    $baseurl.= '&action='.$_REQUEST['action'];
1213
+                }
1214
+                if(isset($_REQUEST['record'])) {
1215
+                    $baseurl .= '&record='.$_REQUEST['record'];
1216
+                }
1217
+                if(isset($_REQUEST['module'])) {
1218
+                    $baseurl .= '&module='.$_REQUEST['module'];
1219
+                }
1165 1220
             }
1166 1221
 
1167 1222
             $baseurl .= "&".ListView::getSessionVariableName($html_varName,"offset")."=";
@@ -1188,11 +1243,13 @@  discard block
 block discarded – undo
1188 1243
 
1189 1244
         $start_record = $current_offset + 1;
1190 1245
 
1191
-        if(!is_numeric($col_count))
1192
-            $col_count = 20;
1246
+        if(!is_numeric($col_count)) {
1247
+                    $col_count = 20;
1248
+        }
1193 1249
 
1194
-        if($row_count == 0)
1195
-            $start_record = 0;
1250
+        if($row_count == 0) {
1251
+                    $start_record = 0;
1252
+        }
1196 1253
 
1197 1254
         $end_record = $start_record + $this->records_per_page;
1198 1255
         // back up the the last page.
@@ -1200,10 +1257,11 @@  discard block
 block discarded – undo
1200 1257
             $end_record = $row_count+1;
1201 1258
         }
1202 1259
         // Determine the start location of the last page
1203
-        if($row_count == 0)
1204
-            $number_pages = 0;
1205
-        else
1206
-            $number_pages = floor(($row_count - 1) / $this->records_per_page);
1260
+        if($row_count == 0) {
1261
+                    $number_pages = 0;
1262
+        } else {
1263
+                    $number_pages = floor(($row_count - 1) / $this->records_per_page);
1264
+        }
1207 1265
 
1208 1266
         $last_offset = $number_pages * $this->records_per_page;
1209 1267
 
@@ -1263,7 +1321,7 @@  discard block
 block discarded – undo
1263 1321
                     $onClick = '';
1264 1322
                     if(0 != preg_match('/javascript.*/', $start_URL)){
1265 1323
                         $onClick = "\"$start_URL;\"";
1266
-                    }else{
1324
+                    } else{
1267 1325
                         $onClick ="'location.href=\"$start_URL\";'";
1268 1326
                     }
1269 1327
                     $start_link = "<button type='button' class='button' name='listViewStartButton' title='{$this->local_app_strings['LNK_LIST_START']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("start","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_START'])."</button>";
@@ -1271,7 +1329,7 @@  discard block
 block discarded – undo
1271 1329
                     $onClick = '';
1272 1330
                     if(0 != preg_match('/javascript.*/', $previous_URL)){
1273 1331
                         $onClick = "\"$previous_URL;\"";
1274
-                    }else{
1332
+                    } else{
1275 1333
                         $onClick = "'location.href=\"$previous_URL\";'";
1276 1334
                     }
1277 1335
                     $previous_link = "<button type='button' class='button' name='listViewPrevButton' title='{$this->local_app_strings['LNK_LIST_PREVIOUS']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("previous","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_PREVIOUS'])."</button>";
@@ -1295,7 +1353,7 @@  discard block
 block discarded – undo
1295 1353
                     $onClick = '';
1296 1354
                     if(0 != preg_match('/javascript.*/', $next_URL)){
1297 1355
                         $onClick = "\"$next_URL;\"";
1298
-                    }else{
1356
+                    } else{
1299 1357
                         $onClick ="'location.href=\"$next_URL\";'";
1300 1358
                     }
1301 1359
                     $next_link = "<button type='button' name='listViewNextButton' class='button' title='{$this->local_app_strings['LNK_LIST_NEXT']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("next","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_NEXT'])."</button>";
@@ -1303,7 +1361,7 @@  discard block
 block discarded – undo
1303 1361
                     $onClick = '';
1304 1362
                     if(0 != preg_match('/javascript.*/', $end_URL)){
1305 1363
                         $onClick = "\"$end_URL;\"";
1306
-                    }else{
1364
+                    } else{
1307 1365
                         $onClick = "'location.href=\"$end_URL\";'";
1308 1366
                     }
1309 1367
                     $end_link = "<button type='button' name='listViewEndButton' class='button' title='{$this->local_app_strings['LNK_LIST_END']}' onClick=".$onClick.">".SugarThemeRegistry::current()->getImage("end","border='0' align='absmiddle'",null,null,'.gif',$this->local_app_strings['LNK_LIST_END'])."</button>";
@@ -1452,18 +1510,17 @@  discard block
 block discarded – undo
1452 1510
                     //attempt to get the query to recreate this subpanel
1453 1511
                     if(!empty($this->response)){
1454 1512
                         $response =& $this->response;
1455
-                    }else{
1513
+                    } else{
1456 1514
                         $response = SugarBean::get_union_related_list($sugarbean,$this->sortby, $this->sort_order, $this->query_where, $current_offset, -1, $this->records_per_page,$this->query_limit,$subpanel_def);
1457 1515
                         $this->response = $response;
1458 1516
                     }
1459 1517
                     //if query is present, then pass it in as parameter
1460 1518
                     if (isset($response['query']) && !empty($response['query'])){
1461 1519
                         $html_text .= $subpanelTiles->get_buttons($subpanel_def, $response['query']);
1462
-                    }else{
1520
+                    } else{
1463 1521
                         $html_text .= $subpanelTiles->get_buttons($subpanel_def);
1464 1522
                     }
1465
-                }
1466
-                else {
1523
+                } else {
1467 1524
                     $html_text .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"  nowrap>$select_link&nbsp;$export_link&nbsp;$delete_link&nbsp;$selected_objects_span";
1468 1525
                 }
1469 1526
                 $html_text .= "</td>\n<td nowrap align=\"right\">".$start_link."&nbsp;&nbsp;".$previous_link."&nbsp;&nbsp;<span class='pageNumbers'>(".$start_record." - ".$end_record." ".$this->local_app_strings['LBL_LIST_OF']." ".$row_count.")</span>&nbsp;&nbsp;".$next_link."&nbsp;&nbsp;".$end_link."</td></tr></table>\n";
@@ -1491,9 +1548,15 @@  discard block
 block discarded – undo
1491 1548
             }
1492 1549
             if($_SERVER['REQUEST_METHOD'] == 'POST') {
1493 1550
                 $this->base_URL .= '?';
1494
-                if(isset($_REQUEST['action'])) $this->base_URL .= '&action='.$_REQUEST['action'];
1495
-                if(isset($_REQUEST['record'])) $this->base_URL .= '&record='.$_REQUEST['record'];
1496
-                if(isset($_REQUEST['module'])) $this->base_URL .= '&module='.$_REQUEST['module'];
1551
+                if(isset($_REQUEST['action'])) {
1552
+                    $this->base_URL .= '&action='.$_REQUEST['action'];
1553
+                }
1554
+                if(isset($_REQUEST['record'])) {
1555
+                    $this->base_URL .= '&record='.$_REQUEST['record'];
1556
+                }
1557
+                if(isset($_REQUEST['module'])) {
1558
+                    $this->base_URL .= '&module='.$_REQUEST['module'];
1559
+                }
1497 1560
             }
1498 1561
             $this->base_URL .= "&".$this->getSessionVariableName($html_varName,"offset")."=";
1499 1562
         }
@@ -1624,8 +1687,7 @@  discard block
 block discarded – undo
1624 1687
             {
1625 1688
                 $ROW_COLOR = 'oddListRow';
1626 1689
                 $BG_COLOR =  $odd_bg;
1627
-            }
1628
-            else
1690
+            } else
1629 1691
             {
1630 1692
                 $ROW_COLOR = 'evenListRow';
1631 1693
                 $BG_COLOR =  $even_bg;
@@ -1641,8 +1703,7 @@  discard block
 block discarded – undo
1641 1703
                 $this->xTemplate->assign('VALUE', $aItem);
1642 1704
                 $this->xTemplate->assign('INDEX', $count);
1643 1705
 
1644
-            }
1645
-            else
1706
+            } else
1646 1707
             {
1647 1708
     //AED -- some modules do not have their additionalDetails.php established. Add a check to ensure require_once does not fail
1648 1709
     // Bug #2786
@@ -1658,7 +1719,9 @@  discard block
 block discarded – undo
1658 1719
                     $results = $ad_function($fields);
1659 1720
                     $results['string'] = str_replace(array("&#039", "'"), '\&#039', $results['string']); // no xss!
1660 1721
 
1661
-                    if(trim($results['string']) == '') $results['string'] = $app_strings['LBL_NONE'];
1722
+                    if(trim($results['string']) == '') {
1723
+                        $results['string'] = $app_strings['LBL_NONE'];
1724
+                    }
1662 1725
                     $fields[$results['fieldToAddTo']] = $fields[$results['fieldToAddTo']].'</a>';
1663 1726
                 }
1664 1727
 
@@ -1782,12 +1845,21 @@  discard block
 block discarded – undo
1782 1845
 	                $cell_width = empty($widget_args['width']) ? '' : $widget_args['width'];
1783 1846
 	                $this->xTemplate->assign('HEADER_CELL', $widget_contents);
1784 1847
 	                static $count;
1785
-	            if(!isset($count))$count = 0; else $count++;
1786
-                    if($col_count == 0 || $column_name == 'name') $footable = 'data-toggle="true"';
1787
-                    else {
1848
+	            if(!isset($count)) {
1849
+	                $count = 0;
1850
+	            } else {
1851
+	                $count++;
1852
+	            }
1853
+                    if($col_count == 0 || $column_name == 'name') {
1854
+                        $footable = 'data-toggle="true"';
1855
+                    } else {
1788 1856
                         $footable = 'data-hide="phone"';
1789
-                        if ($col_count > 2) $footable = 'data-hide="phone,phonelandscape"';
1790
-                        if ($col_count > 4) $footable = 'data-hide="phone,phonelandscape,tablet"';
1857
+                        if ($col_count > 2) {
1858
+                            $footable = 'data-hide="phone,phonelandscape"';
1859
+                        }
1860
+                        if ($col_count > 4) {
1861
+                            $footable = 'data-hide="phone,phonelandscape,tablet"';
1862
+                        }
1791 1863
                     }
1792 1864
                     $this->xTemplate->assign('FOOTABLE', $footable);
1793 1865
 	                $this->xTemplate->assign('CELL_COUNT', $count);
@@ -1919,7 +1991,7 @@  discard block
 block discarded – undo
1919 1991
         $sortStr = translate('LBL_ALT_SORT');
1920 1992
         if($upDown == '_down'){
1921 1993
             $sortStr = translate('LBL_ALT_SORT_DESC');
1922
-        }elseif($upDown == '_up'){
1994
+        } elseif($upDown == '_up'){
1923 1995
             $sortStr = translate('LBL_ALT_SORT_ASC');
1924 1996
         }
1925 1997
         return " width='$width' height='$height' align='absmiddle' alt='$sortStr'>";
@@ -1933,8 +2005,9 @@  discard block
 block discarded – undo
1933 2005
 
1934 2006
         // Check the cache
1935 2007
         $result = sugar_cache_retrieve($cache_key);
1936
-        if(!empty($result))
1937
-        return $result;
2008
+        if(!empty($result)) {
2009
+                return $result;
2010
+        }
1938 2011
 
1939 2012
         // No cache hit.  Calculate the value and return.
1940 2013
         $result = getimagesize($image);
@@ -1950,8 +2023,9 @@  discard block
 block discarded – undo
1950 2023
 
1951 2024
         // Check the cache
1952 2025
         $result = sugar_cache_retrieve($cache_key);
1953
-        if(!empty($result))
1954
-        return $result;
2026
+        if(!empty($result)) {
2027
+                return $result;
2028
+        }
1955 2029
 
1956 2030
         // No cache hit.  Calculate the value and return.
1957 2031
         $result = getimagesize($image);
@@ -1984,12 +2058,10 @@  discard block
 block discarded – undo
1984 2058
 		if($orderBy == 'amount')
1985 2059
 		{
1986 2060
 			$this->xTemplateAssign('amount_arrow', $imgArrow);
1987
-		}
1988
-		else if($orderBy == 'amount_usdollar')
2061
+		} else if($orderBy == 'amount_usdollar')
1989 2062
 		{
1990 2063
 			$this->xTemplateAssign('amount_usdollar_arrow', $imgArrow);
1991
-		}
1992
-		else
2064
+		} else
1993 2065
 		{
1994 2066
 			$this->xTemplateAssign($orderBy.'_arrow', $imgArrow);
1995 2067
 		}
@@ -2019,8 +2091,7 @@  discard block
 block discarded – undo
2019 2091
             {
2020 2092
                 $list_field['label'] = translate($key,$child_focus->module_dir);
2021 2093
                 $this->list_field_defs[$i]['label'] = preg_replace('/:$/','',$list_field['label']);
2022
-            }
2023
-            else
2094
+            } else
2024 2095
             {
2025 2096
                 $this->list_field_defs[$i]['label'] ='&nbsp;';
2026 2097
             }
@@ -2050,8 +2121,7 @@  discard block
 block discarded – undo
2050 2121
  function getLocalSessionVariable($localVarName,$varName) {
2051 2122
     if(isset($_SESSION[$localVarName."_".$varName])) {
2052 2123
         return $_SESSION[$localVarName."_".$varName];
2053
-    }
2054
-    else{
2124
+    } else{
2055 2125
         return "";
2056 2126
     }
2057 2127
  }
@@ -2059,7 +2129,9 @@  discard block
 block discarded – undo
2059 2129
  /* Set to true if you want Additional Details to appear in the listview
2060 2130
   */
2061 2131
  function setAdditionalDetails($value = true, $function = '') {
2062
-    if(!empty($function)) $this->additionalDetailsFunction = $function;
2132
+    if(!empty($function)) {
2133
+        $this->additionalDetailsFunction = $function;
2134
+    }
2063 2135
     $this->_additionalDetails = $value;
2064 2136
  }
2065 2137
 
Please login to merge, or discard this patch.
include/utils.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -415,8 +415,7 @@  discard block
 block discarded – undo
415 415
     if ($runningUser == null) {  // matches null, false and ""
416 416
         if (is_windows()) {
417 417
             $runningUser = getenv('USERDOMAIN').'\\'.getenv('USERNAME');
418
-        }
419
-        else {
418
+        } else {
420 419
             $usr = posix_getpwuid(posix_geteuid());
421 420
             $runningUser = $usr['name'];
422 421
         }
@@ -4410,8 +4409,7 @@  discard block
 block discarded – undo
4410 4409
     if(file_exists(SugarThemeRegistry::current()->getImagePath().DIRECTORY_SEPARATOR.'icon_'.$iconFileName.'.svg')) {
4411 4410
         $iconName = "icon_{$iconFileName}.svg";
4412 4411
         $iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
4413
-    }
4414
-    else {
4412
+    } else {
4415 4413
         $iconName = "icon_{$iconFileName}.gif";
4416 4414
         $iconFound = SugarThemeRegistry::current()->getImageURL($iconName, false);
4417 4415
     }
Please login to merge, or discard this patch.
include/SugarTheme/SugarTheme.php 1 patch
Braces   +213 added lines, -156 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.
@@ -46,8 +48,9 @@  discard block
 block discarded – undo
46 48
  * theme basis.
47 49
  ********************************************************************************/
48 50
 
49
-if(!defined('JSMIN_AS_LIB'))
51
+if(!defined('JSMIN_AS_LIB')) {
50 52
     define('JSMIN_AS_LIB', true);
53
+}
51 54
 
52 55
 require_once("include/SugarTheme/cssmin.php");
53 56
 require_once("jssource/jsmin.php");
@@ -299,10 +302,11 @@  discard block
 block discarded – undo
299 302
                 if ( property_exists(__CLASS__,$key) ) {
300 303
                     // For all arrays ( except colors and fonts ) you can just specify the items
301 304
                     // to change instead of all of the values
302
-                    if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) )
303
-                        $this->$key = array_merge($this->$key,$value);
304
-                    else
305
-                        $this->$key = $value;
305
+                    if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) {
306
+                                            $this->$key = array_merge($this->$key,$value);
307
+                    } else {
308
+                                            $this->$key = $value;
309
+                    }
306 310
                 }
307 311
             }
308 312
         }
@@ -310,23 +314,28 @@  discard block
 block discarded – undo
310 314
             if ( property_exists(__CLASS__,$key) ) {
311 315
                 // For all arrays ( except colors and fonts ) you can just specify the items
312 316
                 // to change instead of all of the values
313
-                if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) )
314
-                    $this->$key = array_merge($this->$key,$value);
315
-                else
316
-                    $this->$key = $value;
317
+                if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) {
318
+                                    $this->$key = array_merge($this->$key,$value);
319
+                } else {
320
+                                    $this->$key = $value;
321
+                }
317 322
             }
318 323
         }
319 324
         if ( !inDeveloperMode() ) {
320 325
             if ( is_file($cachedfile = sugar_cached($this->getFilePath().'/pathCache.php'))) {
321 326
                 $caches = unserialize(file_get_contents($cachedfile));
322
-                if ( isset($caches['jsCache']) )
323
-                    $this->_jsCache       = $caches['jsCache'];
324
-                if ( isset($caches['cssCache']) )
325
-                    $this->_cssCache      = $caches['cssCache'];
326
-                if ( isset($caches['imageCache']) )
327
-                    $this->_imageCache    = $caches['imageCache'];
328
-                if ( isset($caches['templateCache']) )
329
-                    $this->_templateCache = $caches['templateCache'];
327
+                if ( isset($caches['jsCache']) ) {
328
+                                    $this->_jsCache       = $caches['jsCache'];
329
+                }
330
+                if ( isset($caches['cssCache']) ) {
331
+                                    $this->_cssCache      = $caches['cssCache'];
332
+                }
333
+                if ( isset($caches['imageCache']) ) {
334
+                                    $this->_imageCache    = $caches['imageCache'];
335
+                }
336
+                if ( isset($caches['templateCache']) ) {
337
+                                    $this->_templateCache = $caches['templateCache'];
338
+                }
330 339
             }
331 340
             $cachedfile = sugar_cached($this->getFilePath().'/spriteCache.php');
332 341
 			if(!empty($GLOBALS['sugar_config']['use_sprites']) && is_file($cachedfile)) {
@@ -378,17 +387,18 @@  discard block
 block discarded – undo
378 387
         // clear out the cache on destroy if we are asked to
379 388
         if ( $this->_clearCacheOnDestroy ) {
380 389
 
381
-            if (is_file("$cachedir/pathCache.php"))
382
-                unlink("$cachedir/pathCache.php");
383
-			if (is_file("$cachedir/spriteCache.php"))
384
-				unlink("$cachedir/spriteCache.php");
390
+            if (is_file("$cachedir/pathCache.php")) {
391
+                            unlink("$cachedir/pathCache.php");
392
+            }
393
+			if (is_file("$cachedir/spriteCache.php")) {
394
+							unlink("$cachedir/spriteCache.php");
395
+			}
385 396
 
386 397
             if(strlen($cachedir)>1) {
387 398
                 rmdir_recursive($cachedir.'/modules');
388 399
             }
389 400
 
390
-        }
391
-        elseif ( !inDeveloperMode() ) {
401
+        } elseif ( !inDeveloperMode() ) {
392 402
             // only update the caches if they have been changed in this request
393 403
             if ( count($this->_jsCache) != $this->_initialCacheSize['jsCache']
394 404
                     || count($this->_cssCache) != $this->_initialCacheSize['cssCache']
@@ -437,8 +447,9 @@  discard block
 block discarded – undo
437 447
         $key
438 448
         )
439 449
     {
440
-        if ( isset($this->$key) )
441
-            return $this->$key;
450
+        if ( isset($this->$key) ) {
451
+                    return $this->$key;
452
+        }
442 453
     }
443 454
 
444 455
     public function __isset($key){
@@ -611,38 +622,44 @@  discard block
 block discarded – undo
611 622
 		if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) {
612 623
 
613 624
 			// system wide sprites
614
-			if(file_exists("cache/sprites/default/sprites.css"))
615
-				$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />';
625
+			if(file_exists("cache/sprites/default/sprites.css")) {
626
+							$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />';
627
+			}
616 628
 
617 629
 			// theme specific sprites
618
-			if(file_exists("cache/sprites/{$this->dirName}/sprites.css"))
619
-				$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />';
630
+			if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) {
631
+							$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />';
632
+			}
620 633
 
621 634
 			// parent sprites
622 635
 			if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) {
623
-				if(file_exists("cache/sprites/{$parent->dirName}/sprites.css"))
624
-					$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />';
636
+				if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) {
637
+									$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />';
638
+				}
625 639
 			}
626 640
 
627 641
 			// repeatable sprites
628
-			if(file_exists("cache/sprites/Repeatable/sprites.css"))
629
-				$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />';
642
+			if(file_exists("cache/sprites/Repeatable/sprites.css")) {
643
+							$html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />';
644
+			}
630 645
 		}
631 646
 
632 647
         // for BC during upgrade
633 648
         if ( !empty($this->colors) ) {
634
-            if ( isset($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $this->colors))
635
-                $color = $_SESSION['authenticated_user_theme_color'];
636
-            else
637
-                $color = $this->colors[0];
649
+            if ( isset($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $this->colors)) {
650
+                            $color = $_SESSION['authenticated_user_theme_color'];
651
+            } else {
652
+                            $color = $this->colors[0];
653
+            }
638 654
             $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('colors.'.$color.'.css').'" id="current_color_style" />';
639 655
         }
640 656
 
641 657
         if ( !empty($this->fonts) ) {
642
-            if ( isset($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $this->fonts))
643
-                $font = $_SESSION['authenticated_user_theme_font'];
644
-            else
645
-                $font = $this->fonts[0];
658
+            if ( isset($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $this->fonts)) {
659
+                            $font = $_SESSION['authenticated_user_theme_font'];
660
+            } else {
661
+                            $font = $this->fonts[0];
662
+            }
646 663
             $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('fonts.'.$font.'.css').'" id="current_font_style" />';
647 664
         }
648 665
 
@@ -673,23 +690,24 @@  discard block
 block discarded – undo
673 690
         $templateName
674 691
         )
675 692
     {
676
-        if ( isset($this->_templateCache[$templateName]) )
677
-            return $this->_templateCache[$templateName];
693
+        if ( isset($this->_templateCache[$templateName]) ) {
694
+                    return $this->_templateCache[$templateName];
695
+        }
678 696
 
679 697
         $templatePath = '';
680
-        if (is_file('custom/'.$this->getTemplatePath().'/'.$templateName))
681
-            $templatePath = 'custom/'.$this->getTemplatePath().'/'.$templateName;
682
-        elseif (is_file($this->getTemplatePath().'/'.$templateName))
683
-            $templatePath = $this->getTemplatePath().'/'.$templateName;
684
-        elseif (isset($this->parentTheme)
698
+        if (is_file('custom/'.$this->getTemplatePath().'/'.$templateName)) {
699
+                    $templatePath = 'custom/'.$this->getTemplatePath().'/'.$templateName;
700
+        } elseif (is_file($this->getTemplatePath().'/'.$templateName)) {
701
+                    $templatePath = $this->getTemplatePath().'/'.$templateName;
702
+        } elseif (isset($this->parentTheme)
685 703
                 && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme
686
-                && ($filename = SugarThemeRegistry::get($this->parentTheme)->getTemplate($templateName)) != '')
687
-            $templatePath = $filename;
688
-        elseif (is_file('custom/'.$this->getDefaultTemplatePath().'/'.$templateName))
689
-            $templatePath = 'custom/'.$this->getDefaultTemplatePath().'/'.$templateName;
690
-        elseif (is_file($this->getDefaultTemplatePath().'/'.$templateName))
691
-            $templatePath = $this->getDefaultTemplatePath().'/'.$templateName;
692
-        else {
704
+                && ($filename = SugarThemeRegistry::get($this->parentTheme)->getTemplate($templateName)) != '') {
705
+                    $templatePath = $filename;
706
+        } elseif (is_file('custom/'.$this->getDefaultTemplatePath().'/'.$templateName)) {
707
+                    $templatePath = 'custom/'.$this->getDefaultTemplatePath().'/'.$templateName;
708
+        } elseif (is_file($this->getDefaultTemplatePath().'/'.$templateName)) {
709
+                    $templatePath = $this->getDefaultTemplatePath().'/'.$templateName;
710
+        } else {
693 711
             $GLOBALS['log']->warn("Template $templateName not found");
694 712
             return false;
695 713
         }
@@ -734,15 +752,17 @@  discard block
 block discarded – undo
734 752
 		// trap deprecated use of image extension
735 753
 		if(is_null($ext)) {
736 754
 			$imageNameExp = explode('.',$imageName);
737
-			if(count($imageNameExp) == 1)
738
-				$imageName .= '.gif';
755
+			if(count($imageNameExp) == 1) {
756
+							$imageName .= '.gif';
757
+			}
739 758
 		} else {
740 759
 			$imageName .= $ext;
741 760
 		}
742 761
 
743 762
 		// trap alt attributes in other_attributes
744
-		if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes))
745
-			$GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName");
763
+		if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) {
764
+					$GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName");
765
+		}
746 766
 		// sprite handler, makes use of own caching mechanism
747 767
 		if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) {
748 768
 			// get sprite metadata
@@ -764,8 +784,9 @@  discard block
 block discarded – undo
764 784
 		// img caching
765 785
 		if(empty($cached_results[$imageName])) {
766 786
 			$imageURL = $this->getImageURL($imageName,false);
767
-			if ( empty($imageURL) )
768
-				return false;
787
+			if ( empty($imageURL) ) {
788
+							return false;
789
+			}
769 790
             if(strpos($imageURL, '.svg', strlen($imageURL)-4)){
770 791
                 $cached_results[$imageName] = file_get_contents($imageURL);
771 792
             } else {
@@ -793,8 +814,9 @@  discard block
 block discarded – undo
793 814
 	public function getSpriteMeta($imageName) {
794 815
 
795 816
 		// return from cache
796
-	    if(isset($this->_spriteCache[$imageName]))
797
-			return $this->_spriteCache[$imageName];
817
+	    if(isset($this->_spriteCache[$imageName])) {
818
+	    			return $this->_spriteCache[$imageName];
819
+	    }
798 820
 
799 821
 			// sprite keys are base on imageURL
800 822
 		$imageURL = $this->getImageURL($imageName,false);
@@ -846,8 +868,9 @@  discard block
 block discarded – undo
846 868
 			$attr .= ' class="spr_'.$class.'"';
847 869
 		}
848 870
 
849
-		if($title)
850
-			$attr .= ' title="'.$title.'"';
871
+		if($title) {
872
+					$attr .= ' title="'.$title.'"';
873
+		}
851 874
 
852 875
 		// use </span> instead of /> to prevent weird UI results
853 876
 		$GLOBALS['log']->debug("Sprites: generated sprite -> $attr");
@@ -901,35 +924,37 @@  discard block
 block discarded – undo
901 924
         $addJSPath = true
902 925
         ){
903 926
         if ( isset($this->_imageCache[$imageName]) ) {
904
-            if ( $addJSPath )
905
-                return getJSPath($this->_imageCache[$imageName]);
906
-            else
907
-                return $this->_imageCache[$imageName];
927
+            if ( $addJSPath ) {
928
+                            return getJSPath($this->_imageCache[$imageName]);
929
+            } else {
930
+                            return $this->_imageCache[$imageName];
931
+            }
908 932
         }
909 933
         $imagePath = '';
910
-        if (($filename = $this->_getImageFileName('custom/'.$this->getImagePath().'/'.$imageName)) != '')
911
-            $imagePath = $filename;
912
-        elseif (($filename = $this->_getImageFileName($this->getImagePath().'/'.$imageName)) != '')
913
-            $imagePath = $filename;
914
-        elseif (isset($this->parentTheme)
934
+        if (($filename = $this->_getImageFileName('custom/'.$this->getImagePath().'/'.$imageName)) != '') {
935
+                    $imagePath = $filename;
936
+        } elseif (($filename = $this->_getImageFileName($this->getImagePath().'/'.$imageName)) != '') {
937
+                    $imagePath = $filename;
938
+        } elseif (isset($this->parentTheme)
915 939
                 && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme
916
-                && ($filename = SugarThemeRegistry::get($this->parentTheme)->getImageURL($imageName,false)) != '')
917
-            $imagePath = $filename;
918
-        elseif (($filename = $this->_getImageFileName('custom/'.$this->getDefaultImagePath().'/'.$imageName)) != '')
919
-            $imagePath = $filename;
920
-        elseif (($filename = $this->_getImageFileName($this->getDefaultImagePath().'/'.$imageName)) != '')
921
-            $imagePath = $filename;
922
-		elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '')
923
-			$imagePath = $filename;
924
-        else {
940
+                && ($filename = SugarThemeRegistry::get($this->parentTheme)->getImageURL($imageName,false)) != '') {
941
+                    $imagePath = $filename;
942
+        } elseif (($filename = $this->_getImageFileName('custom/'.$this->getDefaultImagePath().'/'.$imageName)) != '') {
943
+                    $imagePath = $filename;
944
+        } elseif (($filename = $this->_getImageFileName($this->getDefaultImagePath().'/'.$imageName)) != '') {
945
+                    $imagePath = $filename;
946
+        } elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') {
947
+					$imagePath = $filename;
948
+		} else {
925 949
             $GLOBALS['log']->warn("Image $imageName not found");
926 950
             return false;
927 951
         }
928 952
 
929 953
         $this->_imageCache[$imageName] = $imagePath;
930 954
 
931
-        if ( $addJSPath )
932
-            return getJSPath($imagePath);
955
+        if ( $addJSPath ) {
956
+                    return getJSPath($imagePath);
957
+        }
933 958
 
934 959
         return $imagePath;
935 960
     }
@@ -945,14 +970,16 @@  discard block
 block discarded – undo
945 970
         )
946 971
     {
947 972
         // return now if the extension matches that of which we are looking for
948
-        if ( is_file($imageName) )
949
-            return $imageName;
973
+        if ( is_file($imageName) ) {
974
+                    return $imageName;
975
+        }
950 976
         $pathParts = pathinfo($imageName);
951
-        foreach ( $this->imageExtensions as $extension )
952
-            if ( isset($pathParts['extension']) )
977
+        foreach ( $this->imageExtensions as $extension ) {
978
+                    if ( isset($pathParts['extension']) )
953 979
                 if ( ( $extension != $pathParts['extension'] )
954 980
                         && is_file($pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension) )
955 981
                     return $pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension;
982
+        }
956 983
 
957 984
         return '';
958 985
     }
@@ -968,10 +995,11 @@  discard block
 block discarded – undo
968 995
     public function getCSSURL($cssFileName, $returnURL = true)
969 996
     {
970 997
         if ( isset($this->_cssCache[$cssFileName]) && is_file(sugar_cached($this->_cssCache[$cssFileName])) ) {
971
-            if ( $returnURL )
972
-                return getJSPath("cache/".$this->_cssCache[$cssFileName]);
973
-            else
974
-                return sugar_cached($this->_cssCache[$cssFileName]);
998
+            if ( $returnURL ) {
999
+                            return getJSPath("cache/".$this->_cssCache[$cssFileName]);
1000
+            } else {
1001
+                            return sugar_cached($this->_cssCache[$cssFileName]);
1002
+            }
975 1003
         }
976 1004
 
977 1005
         $cssFileContents = '';
@@ -979,13 +1007,15 @@  discard block
 block discarded – undo
979 1007
         $fullFileName = $this->getCSSPath().'/'.$cssFileName;
980 1008
         if (isset($this->parentTheme)
981 1009
                 && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme
982
-                && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName,false)) != '')
983
-            $cssFileContents .= file_get_contents($filename);
984
-        else {
985
-            if (is_file($defaultFileName))
986
-                $cssFileContents .= file_get_contents($defaultFileName);
987
-            if (is_file('custom/'.$defaultFileName))
988
-                $cssFileContents .= file_get_contents('custom/'.$defaultFileName);
1010
+                && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName,false)) != '') {
1011
+                    $cssFileContents .= file_get_contents($filename);
1012
+        } else {
1013
+            if (is_file($defaultFileName)) {
1014
+                            $cssFileContents .= file_get_contents($defaultFileName);
1015
+            }
1016
+            if (is_file('custom/'.$defaultFileName)) {
1017
+                            $cssFileContents .= file_get_contents('custom/'.$defaultFileName);
1018
+            }
989 1019
         }
990 1020
         if (is_file($fullFileName)) {
991 1021
             $cssFileContents .= file_get_contents($fullFileName);
@@ -1009,10 +1039,11 @@  discard block
 block discarded – undo
1009 1039
         // if this is the style.css file, prepend the base.css and calendar-win2k-cold-1.css
1010 1040
         // files before the theme styles
1011 1041
         if ( $cssFileName == 'style.css' && !isset($this->parentTheme) ) {
1012
-            if ( inDeveloperMode() )
1013
-                $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents;
1014
-            else
1015
-                $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css') . $cssFileContents;
1042
+            if ( inDeveloperMode() ) {
1043
+                            $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents;
1044
+            } else {
1045
+                            $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css') . $cssFileContents;
1046
+            }
1016 1047
         }
1017 1048
 
1018 1049
         // minify the css
@@ -1025,8 +1056,9 @@  discard block
 block discarded – undo
1025 1056
 
1026 1057
         $this->_cssCache[$cssFileName] = $fullFileName;
1027 1058
 
1028
-        if ( $returnURL )
1029
-            return getJSPath("cache/".$fullFileName);
1059
+        if ( $returnURL ) {
1060
+                    return getJSPath("cache/".$fullFileName);
1061
+        }
1030 1062
 
1031 1063
         return sugar_cached($fullFileName);
1032 1064
     }
@@ -1042,10 +1074,11 @@  discard block
 block discarded – undo
1042 1074
     public function getJSURL($jsFileName, $returnURL = true)
1043 1075
     {
1044 1076
         if ( isset($this->_jsCache[$jsFileName]) && is_file(sugar_cached($this->_jsCache[$jsFileName])) ) {
1045
-            if ( $returnURL )
1046
-                return getJSPath("cache/".$this->_jsCache[$jsFileName]);
1047
-            else
1048
-                return sugar_cached($this->_jsCache[$jsFileName]);
1077
+            if ( $returnURL ) {
1078
+                            return getJSPath("cache/".$this->_jsCache[$jsFileName]);
1079
+            } else {
1080
+                            return sugar_cached($this->_jsCache[$jsFileName]);
1081
+            }
1049 1082
         }
1050 1083
 
1051 1084
         $jsFileContents = '';
@@ -1056,15 +1089,19 @@  discard block
 block discarded – undo
1056 1089
                 && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != ''    && !in_array($jsFileName,$this->ignoreParentFiles)) {
1057 1090
            $jsFileContents .= file_get_contents($filename);
1058 1091
        } else {
1059
-            if (is_file($defaultFileName))
1060
-                $jsFileContents .= file_get_contents($defaultFileName);
1061
-            if (is_file('custom/'.$defaultFileName))
1062
-                $jsFileContents .= file_get_contents('custom/'.$defaultFileName);
1092
+            if (is_file($defaultFileName)) {
1093
+                            $jsFileContents .= file_get_contents($defaultFileName);
1094
+            }
1095
+            if (is_file('custom/'.$defaultFileName)) {
1096
+                            $jsFileContents .= file_get_contents('custom/'.$defaultFileName);
1097
+            }
1098
+        }
1099
+        if (is_file($fullFileName)) {
1100
+                    $jsFileContents .= file_get_contents($fullFileName);
1101
+        }
1102
+        if (is_file('custom/'.$fullFileName)) {
1103
+                    $jsFileContents .= file_get_contents('custom/'.$fullFileName);
1063 1104
         }
1064
-        if (is_file($fullFileName))
1065
-            $jsFileContents .= file_get_contents($fullFileName);
1066
-        if (is_file('custom/'.$fullFileName))
1067
-            $jsFileContents .= file_get_contents('custom/'.$fullFileName);
1068 1105
         if (empty($jsFileContents)) {
1069 1106
             $GLOBALS['log']->warn("Javascript File $jsFileName not found");
1070 1107
             return false;
@@ -1085,8 +1122,9 @@  discard block
 block discarded – undo
1085 1122
 
1086 1123
         $this->_jsCache[$jsFileName] = $fullFileName;
1087 1124
 
1088
-        if ( $returnURL )
1089
-            return getJSPath("cache/".$fullFileName);
1125
+        if ( $returnURL ) {
1126
+                    return getJSPath("cache/".$fullFileName);
1127
+        }
1090 1128
 
1091 1129
         return sugar_cached($fullFileName);
1092 1130
     }
@@ -1111,7 +1149,9 @@  discard block
 block discarded – undo
1111 1149
         $imageArray = array();
1112 1150
         foreach ( $pathsToSearch as $path )
1113 1151
         {
1114
-            if (!is_dir($path)) $path = "custom/$path";
1152
+            if (!is_dir($path)) {
1153
+                $path = "custom/$path";
1154
+            }
1115 1155
             if (is_dir($path) && is_readable($path) && $dir = opendir($path)) {
1116 1156
                 while (($file = readdir($dir)) !== false) {
1117 1157
                     if ($file == ".."
@@ -1119,10 +1159,12 @@  discard block
 block discarded – undo
1119 1159
                             || $file == ".svn"
1120 1160
                             || $file == "CVS"
1121 1161
                             || $file == "Attic"
1122
-                            )
1123
-                        continue;
1124
-                    if ( !isset($imageArray[$file]) )
1125
-                        $imageArray[$file] = $this->getImageURL($file,false);
1162
+                            ) {
1163
+                                            continue;
1164
+                    }
1165
+                    if ( !isset($imageArray[$file]) ) {
1166
+                                            $imageArray[$file] = $this->getImageURL($file,false);
1167
+                    }
1126 1168
                 }
1127 1169
                 closedir($dir);
1128 1170
             }
@@ -1224,8 +1266,9 @@  discard block
 block discarded – undo
1224 1266
                 }
1225 1267
             }
1226 1268
         }
1227
-        if (!$versionOk)
1228
-            return false;
1269
+        if (!$versionOk) {
1270
+                    return false;
1271
+        }
1229 1272
 
1230 1273
         $theme = new SugarTheme($themedef);
1231 1274
         self::$_themes[$theme->dirName] = $theme;
@@ -1240,8 +1283,9 @@  discard block
 block discarded – undo
1240 1283
         $themeName
1241 1284
         )
1242 1285
     {
1243
-        if ( self::exists($themeName) )
1244
-            unset(self::$_themes[$themeName]);
1286
+        if ( self::exists($themeName) ) {
1287
+                    unset(self::$_themes[$themeName]);
1288
+        }
1245 1289
     }
1246 1290
 
1247 1291
     /**
@@ -1253,8 +1297,9 @@  discard block
 block discarded – undo
1253 1297
         $themeName
1254 1298
         )
1255 1299
     {
1256
-        if ( isset(self::$_themes[$themeName]) )
1257
-            return self::$_themes[$themeName];
1300
+        if ( isset(self::$_themes[$themeName]) ) {
1301
+                    return self::$_themes[$themeName];
1302
+        }
1258 1303
     }
1259 1304
 
1260 1305
     /**
@@ -1264,8 +1309,9 @@  discard block
 block discarded – undo
1264 1309
      */
1265 1310
     public static function current()
1266 1311
     {
1267
-        if ( !isset(self::$_currentTheme) )
1268
-            self::buildRegistry();
1312
+        if ( !isset(self::$_currentTheme) ) {
1313
+                    self::buildRegistry();
1314
+        }
1269 1315
 
1270 1316
         return self::$_themes[self::$_currentTheme];
1271 1317
     }
@@ -1277,8 +1323,9 @@  discard block
 block discarded – undo
1277 1323
      */
1278 1324
     public static function getDefault()
1279 1325
     {
1280
-        if ( !isset(self::$_currentTheme) )
1281
-            self::buildRegistry();
1326
+        if ( !isset(self::$_currentTheme) ) {
1327
+                    self::buildRegistry();
1328
+        }
1282 1329
 
1283 1330
         if ( isset($GLOBALS['sugar_config']['default_theme']) && self::exists($GLOBALS['sugar_config']['default_theme']) ) {
1284 1331
             return self::get($GLOBALS['sugar_config']['default_theme']);
@@ -1309,8 +1356,9 @@  discard block
 block discarded – undo
1309 1356
         $themeName
1310 1357
         )
1311 1358
     {
1312
-        if ( !self::exists($themeName) )
1313
-            return false;
1359
+        if ( !self::exists($themeName) ) {
1360
+                    return false;
1361
+        }
1314 1362
 
1315 1363
         self::$_currentTheme = $themeName;
1316 1364
 
@@ -1347,8 +1395,9 @@  discard block
 block discarded – undo
1347 1395
                             || $file == "default"
1348 1396
                             || !is_dir("./$dirPath".$file)
1349 1397
                             || !is_file("./{$dirPath}{$file}/themedef.php")
1350
-                            )
1351
-                        continue;
1398
+                            ) {
1399
+                                            continue;
1400
+                    }
1352 1401
                     $themedef = array();
1353 1402
                     require("./{$dirPath}{$file}/themedef.php");
1354 1403
                     $themedef = array_merge($themedef,$themedefDefault);
@@ -1357,9 +1406,10 @@  discard block
 block discarded – undo
1357 1406
                     // if so, then it will override the current one
1358 1407
                     if ( self::exists($themedef['dirName']) ) {
1359 1408
                         $existingTheme = self::get($themedef['dirName']);
1360
-                        foreach ( SugarTheme::getThemeDefFields() as $field )
1361
-                            if ( !isset($themedef[$field]) )
1409
+                        foreach ( SugarTheme::getThemeDefFields() as $field ) {
1410
+                                                    if ( !isset($themedef[$field]) )
1362 1411
                                 $themedef[$field] = $existingTheme->$field;
1412
+                        }
1363 1413
                         self::remove($themedef['dirName']);
1364 1414
                     }
1365 1415
                     if ( isset($themedef['name']) ) {
@@ -1414,12 +1464,14 @@  discard block
 block discarded – undo
1414 1464
     {
1415 1465
         $themelist = array();
1416 1466
         $disabledThemes = array();
1417
-        if ( isset($GLOBALS['sugar_config']['disabled_themes']) )
1418
-            $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']);
1467
+        if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) {
1468
+                    $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']);
1469
+        }
1419 1470
 
1420 1471
         foreach ( self::$_themes as $themename => $themeobject ) {
1421
-            if ( in_array($themename,$disabledThemes) )
1422
-                continue;
1472
+            if ( in_array($themename,$disabledThemes) ) {
1473
+                            continue;
1474
+            }
1423 1475
             $themelist[$themeobject->dirName] = $themeobject->name;
1424 1476
         }
1425 1477
         asort($themelist, SORT_STRING);
@@ -1438,12 +1490,14 @@  discard block
 block discarded – undo
1438 1490
     {
1439 1491
         $themelist = array();
1440 1492
         $disabledThemes = array();
1441
-        if ( isset($GLOBALS['sugar_config']['disabled_themes']) )
1442
-            $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']);
1493
+        if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) {
1494
+                    $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']);
1495
+        }
1443 1496
 
1444 1497
         foreach ( self::$_themes as $themename => $themeobject ) {
1445
-            if ( in_array($themename,$disabledThemes) )
1446
-                $themelist[$themeobject->dirName] = $themeobject->name;
1498
+            if ( in_array($themename,$disabledThemes) ) {
1499
+                            $themelist[$themeobject->dirName] = $themeobject->name;
1500
+            }
1447 1501
         }
1448 1502
 
1449 1503
         return $themelist;
@@ -1458,8 +1512,9 @@  discard block
 block discarded – undo
1458 1512
     {
1459 1513
         $themelist = array();
1460 1514
 
1461
-        foreach ( self::$_themes as $themename => $themeobject )
1462
-            $themelist[$themeobject->dirName] = $themeobject->name;
1515
+        foreach ( self::$_themes as $themename => $themeobject ) {
1516
+                    $themelist[$themeobject->dirName] = $themeobject->name;
1517
+        }
1463 1518
 
1464 1519
         return $themelist;
1465 1520
     }
@@ -1473,8 +1528,9 @@  discard block
 block discarded – undo
1473 1528
     {
1474 1529
         $themelist = array();
1475 1530
         $disabledThemes = array();
1476
-        if (isset($GLOBALS['sugar_config']['disabled_themes']))
1477
-            $disabledThemes = explode(',', $GLOBALS['sugar_config']['disabled_themes']);
1531
+        if (isset($GLOBALS['sugar_config']['disabled_themes'])) {
1532
+                    $disabledThemes = explode(',', $GLOBALS['sugar_config']['disabled_themes']);
1533
+        }
1478 1534
 
1479 1535
         foreach (self::$_themes as $themename => $themeobject) {
1480 1536
             $themearray['name'] = $themeobject->name;
@@ -1495,8 +1551,9 @@  discard block
 block discarded – undo
1495 1551
     {
1496 1552
         global $sugar_config;
1497 1553
 
1498
-        if ( !self::exists($themeName) )
1499
-            return false;
1554
+        if ( !self::exists($themeName) ) {
1555
+                    return false;
1556
+        }
1500 1557
 
1501 1558
         $config = array();
1502 1559
 
Please login to merge, or discard this patch.
include/SugarFields/Parsers/QuickCreateMetaParser.php 1 patch
Braces   +4 added lines, -3 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.
@@ -62,8 +64,7 @@  discard block
 block discarded – undo
62 64
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
63 65
         if(isset($GLOBALS['log'])) {
64 66
             $GLOBALS['log']->deprecated($deprecatedMessage);
65
-        }
66
-        else {
67
+        } else {
67 68
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
68 69
         }
69 70
         self::__construct();
Please login to merge, or discard this patch.
include/SugarFields/Parsers/SearchFormMetaParser.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -347,8 +347,7 @@
 block discarded – undo
347 347
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
348 348
         if(isset($GLOBALS['log'])) {
349 349
             $GLOBALS['log']->deprecated($deprecatedMessage);
350
-        }
351
-        else {
350
+        } else {
352 351
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
353 352
         }
354 353
         self::__construct();
Please login to merge, or discard this patch.
include/SugarFields/Parsers/DetailViewMetaParser.php 1 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/SugarFields/Fields/Text/SugarFieldText.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
                 $editor = $tiny->getInstance($vardef['name'], 'email_compose_light');
97 97
             }
98 98
             $this->ss->assign("tinymce", $editor);
99
-        }else{
99
+        } else{
100 100
             $this->ss->assign("tinymce", $editor);
101 101
         }
102 102
     }
Please login to merge, or discard this patch.