Completed
Push — master ( e40fee...8e8f82 )
by Adam
19:18
created
include/connectors/ConnectorFactory.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,45 +44,45 @@
 block discarded – undo
44 44
  */
45 45
 class ConnectorFactory{
46 46
 
47
-	static $source_map = array();
47
+    static $source_map = array();
48 48
 
49
-	public static function getInstance($source_name){
50
-		if(empty(self::$source_map[$source_name])) {
51
-			require_once('include/connectors/sources/SourceFactory.php');
52
-			require_once('include/connectors/component.php');
53
-			$source = SourceFactory::getSource($source_name);
54
-			$component = new component();
55
-			$component->setSource($source);
56
-			$component->init();
57
-			self::$source_map[$source_name] = $component;
58
-		}
59
-		return self::$source_map[$source_name];
60
-	}
49
+    public static function getInstance($source_name){
50
+        if(empty(self::$source_map[$source_name])) {
51
+            require_once('include/connectors/sources/SourceFactory.php');
52
+            require_once('include/connectors/component.php');
53
+            $source = SourceFactory::getSource($source_name);
54
+            $component = new component();
55
+            $component->setSource($source);
56
+            $component->init();
57
+            self::$source_map[$source_name] = $component;
58
+        }
59
+        return self::$source_map[$source_name];
60
+    }
61 61
 
62
-	/**
63
-	 * Split the class name by _ and go through the class name
64
-	 * which represents the inheritance structure to load up all required parents.
65
-	 * @param string $class the root class we want to load.
66
-	 */
67
-	public static function load($class, $type){
68
-		self::loadClass($class, $type);
69
-	}
62
+    /**
63
+     * Split the class name by _ and go through the class name
64
+     * which represents the inheritance structure to load up all required parents.
65
+     * @param string $class the root class we want to load.
66
+     */
67
+    public static function load($class, $type){
68
+        self::loadClass($class, $type);
69
+    }
70 70
 
71
-	/**
72
-	 * include a source class file.
73
-	 * @param string $class a class file to include.
74
-	 */
75
-	public static function loadClass($class, $type){
76
-		$dir = str_replace('_','/',$class);
77
-		$parts = explode("/", $dir);
78
-		$file = $parts[count($parts)-1] . '.php';
79
-		if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){
80
-			require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file");
81
-		} else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) {
82
-			require_once("modules/Connectors/connectors/{$type}/{$dir}/$file");
83
-		} else if(file_exists("connectors/{$type}/{$dir}/$file")) {
84
-			require_once("connectors/{$type}/{$dir}/$file");
85
-		}
86
-	}
71
+    /**
72
+     * include a source class file.
73
+     * @param string $class a class file to include.
74
+     */
75
+    public static function loadClass($class, $type){
76
+        $dir = str_replace('_','/',$class);
77
+        $parts = explode("/", $dir);
78
+        $file = $parts[count($parts)-1] . '.php';
79
+        if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){
80
+            require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file");
81
+        } else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) {
82
+            require_once("modules/Connectors/connectors/{$type}/{$dir}/$file");
83
+        } else if(file_exists("connectors/{$type}/{$dir}/$file")) {
84
+            require_once("connectors/{$type}/{$dir}/$file");
85
+        }
86
+    }
87 87
 }
88 88
 ?>
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
  * Connector factory
43 43
  * @api
44 44
  */
45
-class ConnectorFactory{
45
+class ConnectorFactory {
46 46
 
47 47
 	static $source_map = array();
48 48
 
49
-	public static function getInstance($source_name){
50
-		if(empty(self::$source_map[$source_name])) {
49
+	public static function getInstance($source_name) {
50
+		if (empty(self::$source_map[$source_name])) {
51 51
 			require_once('include/connectors/sources/SourceFactory.php');
52 52
 			require_once('include/connectors/component.php');
53 53
 			$source = SourceFactory::getSource($source_name);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * which represents the inheritance structure to load up all required parents.
65 65
 	 * @param string $class the root class we want to load.
66 66
 	 */
67
-	public static function load($class, $type){
67
+	public static function load($class, $type) {
68 68
 		self::loadClass($class, $type);
69 69
 	}
70 70
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	 * include a source class file.
73 73
 	 * @param string $class a class file to include.
74 74
 	 */
75
-	public static function loadClass($class, $type){
76
-		$dir = str_replace('_','/',$class);
75
+	public static function loadClass($class, $type) {
76
+		$dir = str_replace('_', '/', $class);
77 77
 		$parts = explode("/", $dir);
78
-		$file = $parts[count($parts)-1] . '.php';
79
-		if(file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")){
78
+		$file = $parts[count($parts) - 1].'.php';
79
+		if (file_exists("custom/modules/Connectors/connectors/{$type}/{$dir}/$file")) {
80 80
 			require_once("custom/modules/Connectors/connectors/{$type}/{$dir}/$file");
81
-		} else if(file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) {
81
+		} else if (file_exists("modules/Connectors/connectors/{$type}/{$dir}/$file")) {
82 82
 			require_once("modules/Connectors/connectors/{$type}/{$dir}/$file");
83
-		} else if(file_exists("connectors/{$type}/{$dir}/$file")) {
83
+		} else if (file_exists("connectors/{$type}/{$dir}/$file")) {
84 84
 			require_once("connectors/{$type}/{$dir}/$file");
85 85
 		}
86 86
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
include/MVC/View/SugarView.php 4 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1387,18 +1387,18 @@
 block discarded – undo
1387 1387
 		//$params = array();
1388 1388
         if (isset($this->action)){
1389 1389
             switch ($this->action) {
1390
-            case 'EditView':
1391
-                if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) {
1392
-                    $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>";
1393
-                    $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
1394
-                }
1395
-                else
1396
-                    $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
1397
-                break;
1398
-            case 'DetailView':
1399
-                $beanName = $this->bean->get_summary_text();
1400
-                $params[] = $beanName;
1401
-                break;
1390
+                case 'EditView':
1391
+                    if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) {
1392
+                        $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>";
1393
+                        $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
1394
+                    }
1395
+                    else
1396
+                        $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
1397
+                    break;
1398
+                case 'DetailView':
1399
+                    $beanName = $this->bean->get_summary_text();
1400
+                    $params[] = $beanName;
1401
+                    break;
1402 1402
             }
1403 1403
         }
1404 1404
 
Please login to merge, or discard this patch.
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
 
126 126
         //For the ajaxUI, we need to use output buffering to return the page in an ajax friendly format
127 127
         if ($this->_getOption('json_output')){
128
-			ob_start();
129
-			if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) {
130
-				echo $this->_getModLanguageJS();
131
-			}
132
-		}
128
+            ob_start();
129
+            if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) {
130
+                echo $this->_getModLanguageJS();
131
+            }
132
+        }
133 133
 
134 134
         if ($this->_getOption('show_header')) {
135 135
             $this->displayHeader();
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
             $module = $this->module;
176 176
             $ajax_ret = array(
177 177
                 'content' => mb_detect_encoding($content) == "UTF-8" ? $content : utf8_encode($content),
178
-                 'menu' => array(
179
-                     'module' => $module,
180
-                     'label' => translate($module),
181
-                     $this->getMenu($module),
182
-                 ),
178
+                    'menu' => array(
179
+                        'module' => $module,
180
+                        'label' => translate($module),
181
+                        $this->getMenu($module),
182
+                    ),
183 183
                 'title' => $this->getBrowserTitle(),
184 184
                 'action' => isset($_REQUEST['action']) ? $_REQUEST['action'] : "",
185 185
                 'record' => isset($_REQUEST['record']) ? $_REQUEST['record'] : "",
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
                         "URL"   => current($attributevalue),
423 423
                         "SUBMENU" => array(),
424 424
                         );
425
-                   if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") {
426
-                       $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11);
427
-                       $gcls[$key]["URL"] = "javascript:void(0)";
428
-                   }
425
+                    if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") {
426
+                        $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11);
427
+                        $gcls[$key]["URL"] = "javascript:void(0)";
428
+                    }
429 429
                 }
430 430
                 // and now the sublinks
431 431
                 if ( $linkattribute == 'submenu' && is_array($attributevalue) ) {
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
                             "LABEL" => key($submenulinkinfo),
435 435
                             "URL"   => current($submenulinkinfo),
436 436
                         );
437
-                       if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
438
-                           $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11);
439
-                           $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)";
440
-                       }
437
+                        if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
438
+                            $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11);
439
+                            $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)";
440
+                        }
441 441
                 }
442 442
             }
443 443
         }
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
             $ss->assign("shortcutExtraMenu",$shortcutExtraMenu);
666 666
         }
667 667
 
668
-       if(!empty($current_user)){
669
-       	$ss->assign("max_tabs", $current_user->getPreference("max_tabs"));
670
-       }
668
+        if(!empty($current_user)){
669
+            $ss->assign("max_tabs", $current_user->getPreference("max_tabs"));
670
+        }
671 671
 
672 672
 
673 673
         $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png");
674 674
         $homeImage = "<img src='$imageURL'>";
675
-		$ss->assign("homeImage",$homeImage);
675
+        $ss->assign("homeImage",$homeImage);
676 676
         global $mod_strings;
677 677
         $mod_strings = $bakModStrings;
678 678
         $headerTpl = $themeObject->getTemplate('header.tpl');
@@ -777,12 +777,12 @@  discard block
 block discarded – undo
777 777
         list ($num_grp_sep, $dec_sep) = get_number_seperators();
778 778
 
779 779
         $the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" .
780
-             $timereg['format'] . "';\n" . "\tvar date_reg_format = '" .
781
-             $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" .
782
-             "\tvar time_separator = '$time_separator';\n" .
783
-             "\tvar cal_date_format = '$cal_date_format';\n" .
784
-             "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" .
785
-             "\tvar dec_sep = '$dec_sep';\n" . "</script>";
780
+                $timereg['format'] . "';\n" . "\tvar date_reg_format = '" .
781
+                $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" .
782
+                "\tvar time_separator = '$time_separator';\n" .
783
+                "\tvar cal_date_format = '$cal_date_format';\n" .
784
+                "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" .
785
+                "\tvar dec_sep = '$dec_sep';\n" . "</script>";
786 786
 
787 787
         return $the_script;
788 788
     }
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
             }
848 848
             echo getVersionedScript('cache/jsLanguage/'. $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']);
849 849
 
850
-			echo $this->_getModLanguageJS();
850
+            echo $this->_getModLanguageJS();
851 851
 
852 852
             if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client'])
853 853
                 echo getVersionedScript('modules/Sync/headersync.js');
@@ -863,13 +863,13 @@  discard block
 block discarded – undo
863 863
         }
864 864
     }
865 865
 
866
-	protected function _getModLanguageJS(){
867
-		if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) {
868
-			require_once ('include/language/jsLanguage.php');
869
-			jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']);
870
-		}
871
-		return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']);
872
-	}
866
+    protected function _getModLanguageJS(){
867
+        if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) {
868
+            require_once ('include/language/jsLanguage.php');
869
+            jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']);
870
+        }
871
+        return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']);
872
+    }
873 873
 
874 874
     /**
875 875
      * Called from process(). This method will display the footer on the page.
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
         global $sugar_config;
883 883
         global $app_strings;
884 884
         global $mod_strings;
885
-		$themeObject = SugarThemeRegistry::current();
885
+        $themeObject = SugarThemeRegistry::current();
886 886
         //decide whether or not to show themepicker, default is to show
887 887
         $showThemePicker = true;
888 888
         if (isset($sugar_config['showThemePicker'])) {
@@ -893,30 +893,30 @@  discard block
 block discarded – undo
893 893
         $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"]));
894 894
         $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users'));
895 895
 
896
-		$bottomLinkList = array();
897
-		 if (isset($this->action) && $this->action != "EditView") {
898
-			 $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink());
899
-		}
900
-		$bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();');
901
-
902
-		$bottomLinksStr = "";
903
-		foreach($bottomLinkList as $key => $value) {
904
-			foreach($value as $text => $link) {
905
-				   $href = $link;
906
-				   if(substr($link, 0, 11) == "javascript:") {
907
-                       $onclick = " onclick=\"".substr($link,11)."\"";
908
-                       $href = "javascript:void(0)";
909
-                   } else {
910
-                   		$onclick = "";
911
-                   	}
896
+        $bottomLinkList = array();
897
+            if (isset($this->action) && $this->action != "EditView") {
898
+                $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink());
899
+        }
900
+        $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();');
901
+
902
+        $bottomLinksStr = "";
903
+        foreach($bottomLinkList as $key => $value) {
904
+            foreach($value as $text => $link) {
905
+                    $href = $link;
906
+                    if(substr($link, 0, 11) == "javascript:") {
907
+                        $onclick = " onclick=\"".substr($link,11)."\"";
908
+                        $href = "javascript:void(0)";
909
+                    } else {
910
+                            $onclick = "";
911
+                        }
912 912
                 $imageURL = SugarThemeRegistry::current()->getImageURL($key.'.gif');
913
-				$bottomLinksStr .= "<a href=\"{$href}\"";
914
-				$bottomLinksStr .= (isset($onclick)) ? $onclick : "";
915
-				$bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead)
916
-				$bottomLinksStr .= " ".$text."</a>";
917
-			}
918
-		}
919
-		$ss->assign("BOTTOMLINKS",$bottomLinksStr);
913
+                $bottomLinksStr .= "<a href=\"{$href}\"";
914
+                $bottomLinksStr .= (isset($onclick)) ? $onclick : "";
915
+                $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead)
916
+                $bottomLinksStr .= " ".$text."</a>";
917
+            }
918
+        }
919
+        $ss->assign("BOTTOMLINKS",$bottomLinksStr);
920 920
         if (SugarConfig::getInstance()->get('calculate_response_time', false))
921 921
             $ss->assign('STATISTICS',$this->_getStatistics());
922 922
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
         $attribLinkImg = "<img style='margin-top: 2px' border='0' width='120' height='34' src='include/images/poweredby_sugarcrm_65.png' alt='Powered By SugarCRM'>\n";
947 947
 
948 948
 
949
-		// handle resizing of the company logo correctly on the fly
949
+        // handle resizing of the company logo correctly on the fly
950 950
         $companyLogoURL = $themeObject->getImageURL('company_logo.png');
951 951
         $companyLogoURL_arr = explode('?', $companyLogoURL);
952 952
         $companyLogoURL = $companyLogoURL_arr[0];
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 
1071 1071
         $trackerManager = TrackerManager::getInstance();
1072
-	    $trackerManager->save();
1072
+        $trackerManager->save();
1073 1073
 
1074 1074
     }
1075 1075
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
         $deltaTime = $endTime - $GLOBALS['startTime'];
1110 1110
         $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS'];
1111 1111
         $return = $response_time_string;
1112
-       // $return .= '<br />';
1112
+        // $return .= '<br />';
1113 1113
         if (!empty($GLOBALS['sugar_config']['show_page_resources'])) {
1114 1114
             // Print out the resources used in constructing the page.
1115 1115
             $included_files = get_included_files();
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
             {
1171 1171
                 $data = array
1172 1172
                 (
1173
-                   !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'],
1174
-                   !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'],
1173
+                    !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'],
1174
+                    !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'],
1175 1175
                 );
1176 1176
 
1177 1177
                 $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data) . $newline;
@@ -1240,15 +1240,15 @@  discard block
 block discarded – undo
1240 1240
     }
1241 1241
 
1242 1242
     /**
1243
-    * Returns the module name which should be highlighted in the module menu
1243
+     * Returns the module name which should be highlighted in the module menu
1244 1244
      */
1245 1245
     protected function _getModuleTab()
1246 1246
     {
1247 1247
         global $app_list_strings, $moduleTabMap, $current_user;
1248 1248
 
1249
-		$userTabs = query_module_access_list($current_user);
1250
-		//If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array
1251
-		$defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs);
1249
+        $userTabs = query_module_access_list($current_user);
1250
+        //If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array
1251
+        $defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs);
1252 1252
 
1253 1253
         // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
1254 1254
         if ( !empty($_REQUEST['module_tab']) )
@@ -1264,17 +1264,17 @@  discard block
 block discarded – undo
1264 1264
         elseif ( !isset($app_list_strings['moduleList'][$this->module]) )
1265 1265
             return $defaultTab;
1266 1266
         elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" )
1267
-        	return $defaultTab;
1267
+            return $defaultTab;
1268 1268
         else
1269 1269
             return $this->module;
1270 1270
     }
1271 1271
 
1272
-   /**
1273
-    * Return the "breadcrumbs" to display at the top of the page
1274
-    *
1275
-    * @param  bool $show_help optional, true if we show the help links
1276
-    * @return HTML string containing breadcrumb title
1277
-    */
1272
+    /**
1273
+     * Return the "breadcrumbs" to display at the top of the page
1274
+     *
1275
+     * @param  bool $show_help optional, true if we show the help links
1276
+     * @return HTML string containing breadcrumb title
1277
+     */
1278 1278
     public function getModuleTitle(
1279 1279
         $show_help = true
1280 1280
         )
@@ -1288,13 +1288,13 @@  discard block
 block discarded – undo
1288 1288
         $params = $this->_getModuleTitleParams();
1289 1289
         $index = 0;
1290 1290
 
1291
-		if(SugarThemeRegistry::current()->directionality == "rtl") {
1292
-			$params = array_reverse($params);
1293
-		}
1294
-		if(count($params) > 1) {
1295
-			array_shift($params);
1296
-		}
1297
-		$count = count($params);
1291
+        if(SugarThemeRegistry::current()->directionality == "rtl") {
1292
+            $params = array_reverse($params);
1293
+        }
1294
+        if(count($params) > 1) {
1295
+            array_shift($params);
1296
+        }
1297
+        $count = count($params);
1298 1298
         $paramString = '';
1299 1299
         foreach($params as $parm){
1300 1300
             $index++;
@@ -1305,13 +1305,13 @@  discard block
 block discarded – undo
1305 1305
         }
1306 1306
 
1307 1307
         if(!empty($paramString)){
1308
-               $theTitle .= "<h2> $paramString </h2>";
1308
+                $theTitle .= "<h2> $paramString </h2>";
1309 1309
 
1310 1310
             if($this->type == "detail"){
1311 1311
                 $theTitle .= "<div class='favorite' record_id='" . $this->bean->id . "' module='" . $this->bean->module_dir . "'><div class='favorite_icon_outline'>" . SugarThemeRegistry::current()->getImage('favorite-star-outline','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0"  align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div>
1312 1312
                                                     <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0"  align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div></div>";
1313 1313
             }
1314
-           }
1314
+            }
1315 1315
 
1316 1316
         // bug 56131 - restore conditional so that link doesn't appear where it shouldn't
1317 1317
         if($show_help || $this->type == 'list') {
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
     protected function _getModuleTitleParams($browserTitle = false)
1385 1385
     {
1386 1386
         $params = array($this->_getModuleTitleListParam($browserTitle));
1387
-		//$params = array();
1387
+        //$params = array();
1388 1388
         if (isset($this->action)){
1389 1389
             switch ($this->action) {
1390 1390
             case 'EditView':
@@ -1414,48 +1414,48 @@  discard block
 block discarded – undo
1414 1414
      */
1415 1415
     protected function _getModuleTitleListParam( $browserTitle = false )
1416 1416
     {
1417
-    	global $current_user;
1418
-    	global $app_strings;
1419
-
1420
-    	if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module]))
1421
-    		$firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module];
1422
-    	else
1423
-    		$firstParam = $this->module;
1424
-
1425
-    	$iconPath = $this->getModuleTitleIconPath($this->module);
1426
-    	if($this->action == "ListView" || $this->action == "index") {
1427
-    	    if (!empty($iconPath) && !$browserTitle) {
1428
-    	    	if (SugarThemeRegistry::current()->directionality == "ltr") {
1429
-    	    		return $app_strings['LBL_SEARCH']."&nbsp;"
1430
-    	    			 . "$firstParam";
1431
-
1432
-    	    	} else {
1433
-					return "$firstParam"
1434
-					     . "&nbsp;".$app_strings['LBL_SEARCH'];
1435
-    	    	}
1436
-			} else {
1437
-				return $firstParam;
1438
-			}
1439
-    	}
1440
-    	else {
1441
-		    if (!empty($iconPath) && !$browserTitle) {
1442
-				//return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>";
1443
-			} else {
1444
-				return $firstParam;
1445
-			}
1446
-    	}
1417
+        global $current_user;
1418
+        global $app_strings;
1419
+
1420
+        if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module]))
1421
+            $firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module];
1422
+        else
1423
+            $firstParam = $this->module;
1424
+
1425
+        $iconPath = $this->getModuleTitleIconPath($this->module);
1426
+        if($this->action == "ListView" || $this->action == "index") {
1427
+            if (!empty($iconPath) && !$browserTitle) {
1428
+                if (SugarThemeRegistry::current()->directionality == "ltr") {
1429
+                    return $app_strings['LBL_SEARCH']."&nbsp;"
1430
+                            . "$firstParam";
1431
+
1432
+                } else {
1433
+                    return "$firstParam"
1434
+                            . "&nbsp;".$app_strings['LBL_SEARCH'];
1435
+                }
1436
+            } else {
1437
+                return $firstParam;
1438
+            }
1439
+        }
1440
+        else {
1441
+            if (!empty($iconPath) && !$browserTitle) {
1442
+                //return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>";
1443
+            } else {
1444
+                return $firstParam;
1445
+            }
1446
+        }
1447 1447
     }
1448 1448
 
1449 1449
     protected function getModuleTitleIconPath($module)
1450 1450
     {
1451
-    	$iconPath = "";
1452
-    	if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) {
1453
-    		$iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png');
1454
-    	}
1455
-    	else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) {
1456
-    		$iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png');
1457
-    	}
1458
-    	return $iconPath;
1451
+        $iconPath = "";
1452
+        if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) {
1453
+            $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png');
1454
+        }
1455
+        else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) {
1456
+            $iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png');
1457
+        }
1458
+        return $iconPath;
1459 1459
     }
1460 1460
 
1461 1461
     /**
@@ -1485,11 +1485,11 @@  discard block
 block discarded – undo
1485 1485
      */
1486 1486
     public function getBreadCrumbSymbol()
1487 1487
     {
1488
-    	if(SugarThemeRegistry::current()->directionality == "ltr") {
1489
-        	return "<span class='pointer'>&raquo;</span>";
1488
+        if(SugarThemeRegistry::current()->directionality == "ltr") {
1489
+            return "<span class='pointer'>&raquo;</span>";
1490 1490
         }
1491 1491
         else {
1492
-        	return "<span class='pointer'>&laquo;</span>";
1492
+            return "<span class='pointer'>&laquo;</span>";
1493 1493
         }
1494 1494
     }
1495 1495
 
@@ -1658,20 +1658,20 @@  discard block
 block discarded – undo
1658 1658
     }
1659 1659
 
1660 1660
     /**
1661
-	 * Determines whether the state of the post global array indicates there was an error uploading a
1661
+     * Determines whether the state of the post global array indicates there was an error uploading a
1662 1662
      * file that exceeds the post_max_size setting.  Such an error can be detected if:
1663 1663
      *  1. The Server['REQUEST_METHOD'] will still point to POST
1664 1664
      *  2. POST and FILES global arrays will be returned empty despite the request method
1665 1665
      * This also results in a redirect to the home page (due to lack of module and action in POST)
1666 1666
      *
1667
-	 * @return boolean indicating true or false
1668
-	 */
1667
+     * @return boolean indicating true or false
1668
+     */
1669 1669
     public function checkPostMaxSizeError(){
1670
-         //if the referrer is post, and the post array is empty, then an error has occurred, most likely
1671
-         //while uploading a file that exceeds the post_max_size.
1672
-         if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){
1673
-             $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']);
1674
-             return true;
1670
+            //if the referrer is post, and the post array is empty, then an error has occurred, most likely
1671
+            //while uploading a file that exceeds the post_max_size.
1672
+            if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){
1673
+                $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']);
1674
+                return true;
1675 1675
         }
1676 1676
         return false;
1677 1677
     }
Please login to merge, or discard this patch.
Spacing   +230 added lines, -231 removed lines patch added patch discarded remove patch
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function SugarView($bean = null,
100 100
         $view_object_map = array()
101
-        ){
101
+        ) {
102 102
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
103
-        if(isset($GLOBALS['log'])) {
103
+        if (isset($GLOBALS['log'])) {
104 104
             $GLOBALS['log']->deprecated($deprecatedMessage);
105 105
         }
106 106
         else {
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
         $this->_trackView();
142 142
 
143 143
         //For the ajaxUI, we need to use output buffering to return the page in an ajax friendly format
144
-        if ($this->_getOption('json_output')){
144
+        if ($this->_getOption('json_output')) {
145 145
 			ob_start();
146
-			if(!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) {
146
+			if (!empty($_REQUEST['ajax_load']) && !empty($_REQUEST['loadLanguageJS'])) {
147 147
 				echo $this->_getModLanguageJS();
148 148
 			}
149 149
 		}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $this->preDisplay();
159 159
         $this->displayErrors();
160 160
         $this->display();
161
-        if ( !empty($this->module) ) {
161
+        if (!empty($this->module)) {
162 162
             $GLOBALS['logic_hook']->call_custom_logic($this->module, 'after_ui_frame');
163 163
         } else {
164 164
             $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_frame');
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
                 'favicon' => $this->getFavicon(),
204 204
             );
205 205
 
206
-            if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic)
206
+            if (SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic)
207 207
                 $ajax_ret['moduleList'] = $this->displayHeader(true);
208 208
 
209
-            if(empty($this->responseTime))
209
+            if (empty($this->responseTime))
210 210
                 $this->_calculateFooterMetrics();
211 211
             $ajax_ret['responseTime'] = $this->responseTime;
212 212
             $json = getJSONobj();
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
     {
226 226
         $errors = '';
227 227
 
228
-        foreach($this->errors as $error) {
229
-            $errors .= '<span class="error">' . $error . '</span><br>';
228
+        foreach ($this->errors as $error) {
229
+            $errors .= '<span class="error">'.$error.'</span><br>';
230 230
         }
231 231
 
232
-        if ( !$this->suppressDisplayErrors ) {
232
+        if (!$this->suppressDisplayErrors) {
233 233
             echo $errors;
234 234
         }
235 235
         else {
@@ -266,14 +266,14 @@  discard block
 block discarded – undo
266 266
     {
267 267
         $action = strtolower($this->action);
268 268
         //Skip save, tracked in SugarBean instead
269
-        if($action == 'save') {
269
+        if ($action == 'save') {
270 270
         return;
271 271
         }
272 272
 
273 273
 
274 274
         $trackerManager = TrackerManager::getInstance();
275 275
         $timeStamp = TimeDate::getInstance()->nowDb();
276
-        if($monitor = $trackerManager->getMonitor('tracker')){
276
+        if ($monitor = $trackerManager->getMonitor('tracker')) {
277 277
             $monitor->setValue('action', $action);
278 278
             $monitor->setValue('user_id', $GLOBALS['current_user']->id);
279 279
             $monitor->setValue('module_name', $this->module);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
             //If visible is true, but there is no bean, do not track (invalid/unauthorized reference)
290 290
             //Also, do not track save actions where there is no bean id
291
-            if($monitor->visible && empty($this->bean->id)) {
291
+            if ($monitor->visible && empty($this->bean->id)) {
292 292
             $trackerManager->unsetMonitor($monitor);
293 293
             return;
294 294
             }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     /**
301 301
      * Displays the header on section of the page; basically everything before the content
302 302
      */
303
-    public function displayHeader($retModTabs=false)
303
+    public function displayHeader($retModTabs = false)
304 304
     {
305 305
         global $theme;
306 306
         global $max_tabs;
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $ss->assign("APP", $app_strings);
321 321
         $ss->assign("THEME", $theme);
322 322
         $ss->assign("THEME_CONFIG", $themeObject->getConfig());
323
-        $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true':'false');
323
+        $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false');
324 324
         $ss->assign("MODULE_NAME", $this->module);
325 325
         $ss->assign("langHeader", get_language_header());
326 326
 
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
         if ($this->_getOption('view_print')) {
337 337
             $css .= '<link rel="stylesheet" type="text/css" href="'.$themeObject->getCSSURL('print.css').'" media="all" />';
338 338
         }
339
-        $ss->assign("SUGAR_CSS",$css);
339
+        $ss->assign("SUGAR_CSS", $css);
340 340
 
341 341
         // get javascript
342 342
         ob_start();
343 343
         $this->renderJavascript();
344 344
 
345
-        $ss->assign("SUGAR_JS",ob_get_contents().$themeObject->getJS());
345
+        $ss->assign("SUGAR_JS", ob_get_contents().$themeObject->getJS());
346 346
         ob_end_clean();
347 347
 
348 348
         // get favicon
349
-        if(isset($GLOBALS['sugar_config']['default_module_favicon']))
349
+        if (isset($GLOBALS['sugar_config']['default_module_favicon']))
350 350
             $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
351 351
         else
352 352
             $module_favicon = false;
@@ -356,24 +356,24 @@  discard block
 block discarded – undo
356 356
 
357 357
         // build the shortcut menu
358 358
         $shortcut_menu = array();
359
-        foreach ( $this->getMenu() as $key => $menu_item )
359
+        foreach ($this->getMenu() as $key => $menu_item)
360 360
             $shortcut_menu[$key] = array(
361 361
                 "URL"         => $menu_item[0],
362 362
                 "LABEL"       => $menu_item[1],
363 363
                 "MODULE_NAME" => $menu_item[2],
364 364
                 "IMAGE"       => $themeObject
365
-                    ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]),
365
+                    ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]),
366 366
                 );
367
-        $ss->assign("SHORTCUT_MENU",$shortcut_menu);
367
+        $ss->assign("SHORTCUT_MENU", $shortcut_menu);
368 368
 
369 369
         // handle rtl text direction
370
-        if(isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL'){
370
+        if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
371 371
             $_SESSION['RTL'] = true;
372 372
         }
373
-        if(isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR'){
373
+        if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
374 374
             unset($_SESSION['RTL']);
375 375
         }
376
-        if(isset($_SESSION['RTL']) && $_SESSION['RTL']){
376
+        if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
377 377
             $ss->assign("DIR", 'dir="RTL"');
378 378
         }
379 379
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         $companyLogoURL = $companyLogoURL_arr[0];
384 384
 
385 385
         $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
386
-        if(!empty($company_logo_attributes)) {
386
+        if (!empty($company_logo_attributes)) {
387 387
             $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
388 388
             $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
389 389
             $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
@@ -392,16 +392,16 @@  discard block
 block discarded – undo
392 392
             // Always need to md5 the file
393 393
             $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
394 394
 
395
-            list($width,$height) = getimagesize($companyLogoURL);
396
-            if ( $width > 212 || $height > 40 ) {
397
-                $resizePctWidth  = ($width - 212)/212;
398
-                $resizePctHeight = ($height - 40)/40;
399
-                if ( $resizePctWidth > $resizePctHeight )
395
+            list($width, $height) = getimagesize($companyLogoURL);
396
+            if ($width > 212 || $height > 40) {
397
+                $resizePctWidth  = ($width - 212) / 212;
398
+                $resizePctHeight = ($height - 40) / 40;
399
+                if ($resizePctWidth > $resizePctHeight)
400 400
                     $resizeAmount = $width / 212;
401 401
                 else
402 402
                     $resizeAmount = $height / 40;
403
-                $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount)));
404
-                $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount)));
403
+                $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
404
+                $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
405 405
             }
406 406
             else {
407 407
                 $ss->assign("COMPANY_LOGO_WIDTH", $width);
@@ -417,110 +417,110 @@  discard block
 block discarded – undo
417 417
                                 )
418 418
             );
419 419
         }
420
-        $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5"));
420
+        $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5"));
421 421
 
422 422
         // get the global links
423 423
         $gcls = array();
424 424
         $global_control_links = array();
425 425
         require("include/globalControlLinks.php");
426 426
 
427
-        foreach($global_control_links as $key => $value) {
428
-            if ($key == 'users')  {   //represents logout link.
427
+        foreach ($global_control_links as $key => $value) {
428
+            if ($key == 'users') {   //represents logout link.
429 429
                 $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]);
430
-                $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));//key value for first element.
430
+                $ss->assign("LOGOUT_LABEL", key($value['linkinfo'])); //key value for first element.
431 431
                 continue;
432 432
             }
433 433
 
434 434
             foreach ($value as $linkattribute => $attributevalue) {
435 435
                 // get the main link info
436
-                if ( $linkattribute == 'linkinfo' ) {
436
+                if ($linkattribute == 'linkinfo') {
437 437
                     $gcls[$key] = array(
438 438
                         "LABEL" => key($attributevalue),
439 439
                         "URL"   => current($attributevalue),
440 440
                         "SUBMENU" => array(),
441 441
                         );
442
-                   if(substr($gcls[$key]["URL"], 0, 11) == "javascript:") {
443
-                       $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"],11);
442
+                   if (substr($gcls[$key]["URL"], 0, 11) == "javascript:") {
443
+                       $gcls[$key]["ONCLICK"] = substr($gcls[$key]["URL"], 11);
444 444
                        $gcls[$key]["URL"] = "javascript:void(0)";
445 445
                    }
446 446
                 }
447 447
                 // and now the sublinks
448
-                if ( $linkattribute == 'submenu' && is_array($attributevalue) ) {
448
+                if ($linkattribute == 'submenu' && is_array($attributevalue)) {
449 449
                     foreach ($attributevalue as $submenulinkkey => $submenulinkinfo)
450 450
                         $gcls[$key]['SUBMENU'][$submenulinkkey] = array(
451 451
                             "LABEL" => key($submenulinkinfo),
452 452
                             "URL"   => current($submenulinkinfo),
453 453
                         );
454
-                       if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
455
-                           $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11);
454
+                       if (substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
455
+                           $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 11);
456 456
                            $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)";
457 457
                        }
458 458
                 }
459 459
             }
460 460
         }
461
-        $ss->assign("GCLS",$gcls);
461
+        $ss->assign("GCLS", $gcls);
462 462
 
463 463
         $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : '');
464 464
 
465 465
         if ($this->action == "EditView" || $this->action == "Login")
466 466
             $ss->assign("ONLOAD", 'onload="set_focus()"');
467 467
 
468
-        $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"]));
468
+        $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
469 469
 
470 470
         // get other things needed for page style popup
471 471
         if (isset($_SESSION["authenticated_user_id"])) {
472 472
             // get the current user name and id
473 473
             $ss->assign("CURRENT_USER", $current_user->full_name == '' || !showFullName()
474
-                ? $current_user->user_name : $current_user->full_name );
474
+                ? $current_user->user_name : $current_user->full_name);
475 475
             $ss->assign("CURRENT_USER_ID", $current_user->id);
476 476
 
477 477
             // get the last viewed records
478 478
             require_once("modules/Favorites/Favorites.php");
479 479
             $favorites = new Favorites();
480 480
             $favorite_records = $favorites->getCurrentUserSidebarFavorites();
481
-            $ss->assign("favoriteRecords",$favorite_records);
481
+            $ss->assign("favoriteRecords", $favorite_records);
482 482
 
483 483
             $tracker = new Tracker();
484 484
             $history = $tracker->get_recently_viewed($current_user->id);
485
-            $ss->assign("recentRecords",$this->processRecentRecords($history));
485
+            $ss->assign("recentRecords", $this->processRecentRecords($history));
486 486
         }
487 487
 
488 488
         $bakModStrings = $mod_strings;
489
-        if (isset($_SESSION["authenticated_user_id"]) ) {
489
+        if (isset($_SESSION["authenticated_user_id"])) {
490 490
             // get the module list
491 491
             $moduleTopMenu = array();
492 492
 
493 493
             $max_tabs = $current_user->getPreference('max_tabs');
494 494
             // Attempt to correct if max tabs count is extremely high.
495
-            if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10 ) {
495
+            if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) {
496 496
                 $max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
497 497
                 $current_user->setPreference('max_tabs', $max_tabs, 0, 'global');
498 498
             }
499 499
 
500 500
             $moduleTab = $this->_getModuleTab();
501
-            $ss->assign('MODULE_TAB',$moduleTab);
501
+            $ss->assign('MODULE_TAB', $moduleTab);
502 502
 
503 503
 
504 504
             // See if they are using grouped tabs or not (removed in 6.0, returned in 6.1)
505 505
             $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
506
-            if ( !isset($user_navigation_paradigm) ) {
506
+            if (!isset($user_navigation_paradigm)) {
507 507
                 $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
508 508
             }
509 509
 
510 510
 
511 511
             // Get the full module list for later use
512
-            foreach ( query_module_access_list($current_user) as $module ) {
512
+            foreach (query_module_access_list($current_user) as $module) {
513 513
                 // Bug 25948 - Check for the module being in the moduleList
514
-                if ( isset($app_list_strings['moduleList'][$module]) ) {
514
+                if (isset($app_list_strings['moduleList'][$module])) {
515 515
                     $fullModuleList[$module] = $app_list_strings['moduleList'][$module];
516 516
                 }
517 517
             }
518 518
 
519 519
 
520
-            if(!should_hide_iframes()) {
520
+            if (!should_hide_iframes()) {
521 521
                 $iFrame = new iFrame();
522 522
                 $frames = $iFrame->lookup_frames('tab');
523
-                foreach($frames as $key => $values){
523
+                foreach ($frames as $key => $values) {
524 524
                         $fullModuleList[$key] = $values;
525 525
                 }
526 526
             }
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                 unset($fullModuleList['iFrames']);
529 529
             }
530 530
 
531
-            if ( $user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) {
531
+            if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) {
532 532
                 // We are using grouped tabs
533 533
                 require_once('include/GroupedTabs/GroupedTabStructure.php');
534 534
                 $groupedTabsClass = new GroupedTabStructure();
@@ -537,12 +537,12 @@  discard block
 block discarded – undo
537 537
                 //handle with submoremodules
538 538
                 $max_tabs = $current_user->getPreference('max_tabs');
539 539
                 // If the max_tabs isn't set incorrectly, set it within the range, to the default max sub tabs size
540
-                if ( !isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10){
540
+                if (!isset($max_tabs) || $max_tabs <= 0 || $max_tabs > 10) {
541 541
                     // We have a default value. Use it
542
-                    if(isset($GLOBALS['sugar_config']['default_max_tabs'])){
542
+                    if (isset($GLOBALS['sugar_config']['default_max_tabs'])) {
543 543
                         $max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
544 544
                     }
545
-                    else{
545
+                    else {
546 546
                         $max_tabs = 8;
547 547
                     }
548 548
                 }
@@ -555,22 +555,22 @@  discard block
 block discarded – undo
555 555
 
556 556
                 // Setup the default group tab.
557 557
                 $allGroup = $app_strings['LBL_TABGROUP_ALL'];
558
-                $ss->assign('currentGroupTab',$allGroup);
558
+                $ss->assign('currentGroupTab', $allGroup);
559 559
                 $currentGroupTab = $allGroup;
560 560
                 $usersGroup = $current_user->getPreference('theme_current_group');
561 561
                 // Figure out which tab they currently have selected (stored as a user preference)
562
-                if ( !empty($usersGroup) && isset($groupTabs[$usersGroup]) ) {
562
+                if (!empty($usersGroup) && isset($groupTabs[$usersGroup])) {
563 563
                     $currentGroupTab = $usersGroup;
564 564
                 } else {
565
-                    $current_user->setPreference('theme_current_group',$currentGroupTab);
565
+                    $current_user->setPreference('theme_current_group', $currentGroupTab);
566 566
                 }
567 567
 
568
-                $ss->assign('currentGroupTab',$currentGroupTab);
568
+                $ss->assign('currentGroupTab', $currentGroupTab);
569 569
                 $usingGroupTabs = true;
570 570
 
571 571
             } else {
572 572
                 // Setup the default group tab.
573
-                $ss->assign('currentGroupTab',$app_strings['LBL_TABGROUP_ALL']);
573
+                $ss->assign('currentGroupTab', $app_strings['LBL_TABGROUP_ALL']);
574 574
 
575 575
                 $usingGroupTabs = false;
576 576
                 $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules'] = $fullModuleList;
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
             $topTabList = array();
582 582
 
583 583
             // Now time to go through each of the tab sets and fix them up.
584
-            foreach ( $groupTabs as $tabIdx => $tabData ) {
584
+            foreach ($groupTabs as $tabIdx => $tabData) {
585 585
                 $topTabs = $tabData['modules'];
586
-                if ( ! is_array($topTabs) ) {
586
+                if (!is_array($topTabs)) {
587 587
                     $topTabs = array();
588 588
                 }
589 589
                 $extraTabs = array();
590 590
 
591 591
                 // Split it in to the tabs that go across the top, and the ones that are on the extra menu.
592
-                if ( count($topTabs) > $max_tabs ) {
593
-                    $extraTabs = array_splice($topTabs,$max_tabs);
592
+                if (count($topTabs) > $max_tabs) {
593
+                    $extraTabs = array_splice($topTabs, $max_tabs);
594 594
                 }
595 595
                 // Make sure the current module is accessable through one of the top tabs
596
-                if ( !isset($topTabs[$moduleTab]) ) {
596
+                if (!isset($topTabs[$moduleTab])) {
597 597
                     // Nope, we need to add it.
598 598
                     // First, take it out of the extra menu, if it's there
599
-                    if ( isset($extraTabs[$moduleTab]) ) {
599
+                    if (isset($extraTabs[$moduleTab])) {
600 600
                         unset($extraTabs[$moduleTab]);
601 601
                     }
602
-                    if ( count($topTabs) >= $max_tabs - 1 ) {
602
+                    if (count($topTabs) >= $max_tabs - 1) {
603 603
                         // We already have the maximum number of tabs, so we need to shuffle the last one
604 604
                         // from the top to the first one of the extras
605
-                        $lastElem = array_splice($topTabs,$max_tabs-1);
605
+                        $lastElem = array_splice($topTabs, $max_tabs - 1);
606 606
                         $extraTabs = $lastElem + $extraTabs;
607 607
                     }
608
-                    if ( !empty($moduleTab) ) {
608
+                    if (!empty($moduleTab)) {
609 609
                         $topTabs[$moduleTab] = $app_list_strings['moduleList'][$moduleTab];
610 610
                     }
611 611
                 }
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
                 */
625 625
 
626 626
                 // Get a unique list of the top tabs so we can build the popup menus for them
627
-                foreach ( $topTabs as $moduleKey => $module ) {
627
+                foreach ($topTabs as $moduleKey => $module) {
628 628
                     $topTabList[$moduleKey] = $module;
629 629
                 }
630 630
 
@@ -633,67 +633,67 @@  discard block
 block discarded – undo
633 633
             }
634 634
         }
635 635
 
636
-        if ( isset($topTabList) && is_array($topTabList) ) {
636
+        if (isset($topTabList) && is_array($topTabList)) {
637 637
             // Adding shortcuts array to menu array for displaying shortcuts associated with each module
638 638
             $shortcutTopMenu = array();
639
-            foreach($topTabList as $module_key => $label) {
639
+            foreach ($topTabList as $module_key => $label) {
640 640
                 global $mod_strings;
641 641
                 $mod_strings = return_module_language($current_language, $module_key);
642
-                foreach ( $this->getMenu($module_key) as $key => $menu_item ) {
642
+                foreach ($this->getMenu($module_key) as $key => $menu_item) {
643 643
                     $shortcutTopMenu[$module_key][$key] = array(
644 644
                         "URL"         => $menu_item[0],
645 645
                         "LABEL"       => $menu_item[1],
646 646
                         "MODULE_NAME" => $menu_item[2],
647 647
                         "IMAGE"       => $themeObject
648
-                        ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]),
648
+                        ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]),
649 649
                         "ID"          => $menu_item[2]."_link",
650 650
                         );
651 651
                 }
652 652
             }
653
-            if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true);
654
-            $ss->assign("groupTabs",$groupTabs);
655
-            $ss->assign("shortcutTopMenu",$shortcutTopMenu);
656
-            $ss->assign('USE_GROUP_TABS',$usingGroupTabs);
653
+            if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true);
654
+            $ss->assign("groupTabs", $groupTabs);
655
+            $ss->assign("shortcutTopMenu", $shortcutTopMenu);
656
+            $ss->assign('USE_GROUP_TABS', $usingGroupTabs);
657 657
 
658 658
             // This is here for backwards compatibility, someday, somewhere, it will be able to be removed
659
-            $ss->assign("moduleTopMenu",$groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']);
660
-            $ss->assign("moduleExtraMenu",$groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']);
659
+            $ss->assign("moduleTopMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['modules']);
660
+            $ss->assign("moduleExtraMenu", $groupTabs[$app_strings['LBL_TABGROUP_ALL']]['extra']);
661 661
 
662 662
 
663 663
         }
664 664
 
665
-        if ( isset($extraTabs) && is_array($extraTabs) ) {
665
+        if (isset($extraTabs) && is_array($extraTabs)) {
666 666
             // Adding shortcuts array to extra menu array for displaying shortcuts associated with each module
667 667
             $shortcutExtraMenu = array();
668
-            foreach($extraTabs as $module_key => $label) {
668
+            foreach ($extraTabs as $module_key => $label) {
669 669
                 global $mod_strings;
670 670
                 $mod_strings = return_module_language($current_language, $module_key);
671
-                foreach ( $this->getMenu($module_key) as $key => $menu_item ) {
671
+                foreach ($this->getMenu($module_key) as $key => $menu_item) {
672 672
                     $shortcutExtraMenu[$module_key][$key] = array(
673 673
                         "URL"         => $menu_item[0],
674 674
                         "LABEL"       => $menu_item[1],
675 675
                         "MODULE_NAME" => $menu_item[2],
676 676
                         "IMAGE"       => $themeObject
677
-                        ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]),
677
+                        ->getImage($menu_item[2], "border='0' align='absmiddle'", null, null, '.gif', $menu_item[1]),
678 678
                         "ID"          => $menu_item[2]."_link",
679 679
                         );
680 680
                 }
681 681
             }
682
-            $ss->assign("shortcutExtraMenu",$shortcutExtraMenu);
682
+            $ss->assign("shortcutExtraMenu", $shortcutExtraMenu);
683 683
         }
684 684
 
685
-       if(!empty($current_user)){
685
+       if (!empty($current_user)) {
686 686
        	$ss->assign("max_tabs", $current_user->getPreference("max_tabs"));
687 687
        }
688 688
 
689 689
 
690 690
         $imageURL = SugarThemeRegistry::current()->getImageURL("dashboard.png");
691 691
         $homeImage = "<img src='$imageURL'>";
692
-		$ss->assign("homeImage",$homeImage);
692
+		$ss->assign("homeImage", $homeImage);
693 693
         global $mod_strings;
694 694
         $mod_strings = $bakModStrings;
695 695
         $headerTpl = $themeObject->getTemplate('header.tpl');
696
-        if (inDeveloperMode() )
696
+        if (inDeveloperMode())
697 697
             $ss->clear_compiled_tpl($headerTpl);
698 698
 
699 699
         if ($retModTabs)
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
             $this->includeClassicFile('modules/Administration/DisplayWarnings.php');
706 706
 
707 707
             $errorMessages = SugarApplication::getErrorMessages();
708
-            if ( !empty($errorMessages)) {
709
-                foreach ( $errorMessages as $error_message ) {
710
-                    echo('<p class="error">' . $error_message.'</p>');
708
+            if (!empty($errorMessages)) {
709
+                foreach ($errorMessages as $error_message) {
710
+                    echo('<p class="error">'.$error_message.'</p>');
711 711
                 }
712 712
             }
713 713
         }
@@ -744,15 +744,15 @@  discard block
 block discarded – undo
744 744
 
745 745
         $template = new Sugar_Smarty();
746 746
 
747
-        if(isset($this->bean->module_dir)){
747
+        if (isset($this->bean->module_dir)) {
748 748
             $template->assign('MODULE_SUGAR_GRP1', $this->bean->module_dir);
749 749
         }
750
-        if(isset($_REQUEST['action'])){
750
+        if (isset($_REQUEST['action'])) {
751 751
             $template->assign('ACTION_SUGAR_GRP1', $_REQUEST['action']);
752 752
         }
753 753
 
754 754
 
755
-        echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>';
755
+        echo '<script>jscal_today = 1000*'.$timedate->asUserTs($timedate->getNow()).'; if(typeof app_strings == "undefined") app_strings = new Array();</script>';
756 756
         if (!is_file(sugar_cached("include/javascript/sugar_grp1.js"))) {
757 757
             $_REQUEST['root_directory'] = ".";
758 758
             require_once("jssource/minify_utils.php");
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
         $template->assign('SUGAR_GRP1', getVersionedPath('cache/include/javascript/sugar_grp1.js'));
764 764
         $template->assign('CALENDAR', getVersionedPath('include/javascript/calendar.js'));
765 765
 
766
-        if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) {
766
+        if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) {
767 767
             $template->assign('HEADERSYNC', getVersionedPath('modules/Sync/headersync.js'));
768 768
         }
769 769
         echo $template->fetch('include/MVC/View/tpls/displayLoginJS.tpl');
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
         require_once ('modules/Currencies/Currency.php');
795 795
         list ($num_grp_sep, $dec_sep) = get_number_seperators();
796 796
 
797
-        $the_script = "<script type=\"text/javascript\">\n" . "\tvar time_reg_format = '" .
798
-             $timereg['format'] . "';\n" . "\tvar date_reg_format = '" .
799
-             $datereg['format'] . "';\n" . "\tvar date_reg_positions = { $date_pos };\n" .
800
-             "\tvar time_separator = '$time_separator';\n" .
801
-             "\tvar cal_date_format = '$cal_date_format';\n" .
802
-             "\tvar time_offset = $hour_offset;\n" . "\tvar num_grp_sep = '$num_grp_sep';\n" .
803
-             "\tvar dec_sep = '$dec_sep';\n" . "</script>";
797
+        $the_script = "<script type=\"text/javascript\">\n"."\tvar time_reg_format = '".
798
+             $timereg['format']."';\n"."\tvar date_reg_format = '".
799
+             $datereg['format']."';\n"."\tvar date_reg_positions = { $date_pos };\n".
800
+             "\tvar time_separator = '$time_separator';\n".
801
+             "\tvar cal_date_format = '$cal_date_format';\n".
802
+             "\tvar time_offset = $hour_offset;\n"."\tvar num_grp_sep = '$num_grp_sep';\n".
803
+             "\tvar dec_sep = '$dec_sep';\n"."</script>";
804 804
 
805 805
         return $the_script;
806 806
     }
@@ -828,13 +828,13 @@  discard block
 block discarded – undo
828 828
                 "sugar_cache_dir" => "cache/",
829 829
                 );
830 830
 
831
-            if(isset($this->bean->module_dir)){
831
+            if (isset($this->bean->module_dir)) {
832 832
                 $js_vars['module_sugar_grp1'] = $this->bean->module_dir;
833 833
             }
834
-            if(isset($_REQUEST['action'])){
834
+            if (isset($_REQUEST['action'])) {
835 835
                 $js_vars['action_sugar_grp1'] = $_REQUEST['action'];
836 836
             }
837
-            echo '<script>jscal_today = 1000*' . $timedate->asUserTs($timedate->getNow()) . '; if(typeof app_strings == "undefined") app_strings = new Array();</script>';
837
+            echo '<script>jscal_today = 1000*'.$timedate->asUserTs($timedate->getNow()).'; if(typeof app_strings == "undefined") app_strings = new Array();</script>';
838 838
             if (!is_file(sugar_cached("include/javascript/sugar_grp1.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_yui.js")) || !is_file(sugar_cached("include/javascript/sugar_grp1_jquery.js"))) {
839 839
                 $_REQUEST['root_directory'] = ".";
840 840
                 require_once("jssource/minify_utils.php");
@@ -847,33 +847,33 @@  discard block
 block discarded – undo
847 847
 
848 848
             // output necessary config js in the top of the page
849 849
             $config_js = $this->getSugarConfigJS();
850
-            if(!empty($config_js)){
850
+            if (!empty($config_js)) {
851 851
                 echo "<script>\n".implode("\n", $config_js)."</script>\n";
852 852
             }
853 853
 
854
-            if ( isset($sugar_config['email_sugarclient_listviewmaxselect']) ) {
854
+            if (isset($sugar_config['email_sugarclient_listviewmaxselect'])) {
855 855
                 echo "<script>SUGAR.config.email_sugarclient_listviewmaxselect = {$GLOBALS['sugar_config']['email_sugarclient_listviewmaxselect']};</script>";
856 856
             }
857 857
 
858
-            $image_server = (defined('TEMPLATE_URL'))?TEMPLATE_URL . '/':'';
859
-            echo '<script type="text/javascript">SUGAR.themes.image_server="' . $image_server . '";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF
860
-            echo '<script type="text/javascript">var name_format = "' . $locale->getLocaleFormatMacro() . '";</script>';
858
+            $image_server = (defined('TEMPLATE_URL')) ? TEMPLATE_URL.'/' : '';
859
+            echo '<script type="text/javascript">SUGAR.themes.image_server="'.$image_server.'";</script>'; // cn: bug 12274 - create session-stored key to defend against CSRF
860
+            echo '<script type="text/javascript">var name_format = "'.$locale->getLocaleFormatMacro().'";</script>';
861 861
             echo self::getJavascriptValidation();
862
-            if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) {
862
+            if (!is_file(sugar_cached('jsLanguage/').$GLOBALS['current_language'].'.js')) {
863 863
                 require_once ('include/language/jsLanguage.php');
864 864
                 jsLanguage::createAppStringsCache($GLOBALS['current_language']);
865 865
             }
866
-            echo getVersionedScript('cache/jsLanguage/'. $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']);
866
+            echo getVersionedScript('cache/jsLanguage/'.$GLOBALS['current_language'].'.js', $GLOBALS['sugar_config']['js_lang_version']);
867 867
 
868 868
 			echo $this->_getModLanguageJS();
869 869
 
870
-            if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client'])
870
+            if (isset($sugar_config['disc_client']) && $sugar_config['disc_client'])
871 871
                 echo getVersionedScript('modules/Sync/headersync.js');
872 872
 
873 873
 
874 874
             //echo out the $js_vars variables as javascript variables
875 875
             echo "<script type='text/javascript'>\n";
876
-            foreach($js_vars as $var=>$value)
876
+            foreach ($js_vars as $var=>$value)
877 877
             {
878 878
                 echo "var {$var} = '{$value}';\n";
879 879
             }
@@ -881,12 +881,12 @@  discard block
 block discarded – undo
881 881
         }
882 882
     }
883 883
 
884
-	protected function _getModLanguageJS(){
885
-		if (!is_file(sugar_cached('jsLanguage/') . $this->module . '/' . $GLOBALS['current_language'] . '.js')) {
884
+	protected function _getModLanguageJS() {
885
+		if (!is_file(sugar_cached('jsLanguage/').$this->module.'/'.$GLOBALS['current_language'].'.js')) {
886 886
 			require_once ('include/language/jsLanguage.php');
887 887
 			jsLanguage::createModuleStringsCache($this->module, $GLOBALS['current_language']);
888 888
 		}
889
-		return getVersionedScript("cache/jsLanguage/{$this->module}/". $GLOBALS['current_language'] . '.js', $GLOBALS['sugar_config']['js_lang_version']);
889
+		return getVersionedScript("cache/jsLanguage/{$this->module}/".$GLOBALS['current_language'].'.js', $GLOBALS['sugar_config']['js_lang_version']);
890 890
 	}
891 891
 
892 892
     /**
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
         }
909 909
 
910 910
         $ss = new Sugar_Smarty();
911
-        $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"]));
912
-        $ss->assign('MOD',return_module_language($GLOBALS['current_language'], 'Users'));
911
+        $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
912
+        $ss->assign('MOD', return_module_language($GLOBALS['current_language'], 'Users'));
913 913
 
914 914
 		$bottomLinkList = array();
915 915
 		 if (isset($this->action) && $this->action != "EditView") {
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
 		$bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();');
919 919
 
920 920
 		$bottomLinksStr = "";
921
-		foreach($bottomLinkList as $key => $value) {
922
-			foreach($value as $text => $link) {
921
+		foreach ($bottomLinkList as $key => $value) {
922
+			foreach ($value as $text => $link) {
923 923
 				   $href = $link;
924
-				   if(substr($link, 0, 11) == "javascript:") {
925
-                       $onclick = " onclick=\"".substr($link,11)."\"";
924
+				   if (substr($link, 0, 11) == "javascript:") {
925
+                       $onclick = " onclick=\"".substr($link, 11)."\"";
926 926
                        $href = "javascript:void(0)";
927 927
                    } else {
928 928
                    		$onclick = "";
@@ -934,9 +934,9 @@  discard block
 block discarded – undo
934 934
 				$bottomLinksStr .= " ".$text."</a>";
935 935
 			}
936 936
 		}
937
-		$ss->assign("BOTTOMLINKS",$bottomLinksStr);
937
+		$ss->assign("BOTTOMLINKS", $bottomLinksStr);
938 938
         if (SugarConfig::getInstance()->get('calculate_response_time', false))
939
-            $ss->assign('STATISTICS',$this->_getStatistics());
939
+            $ss->assign('STATISTICS', $this->_getStatistics());
940 940
 
941 941
         // Under the License referenced above, you are required to leave in all copyright statements in both
942 942
         // the code and end-user application.
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
         $companyLogoURL = $companyLogoURL_arr[0];
971 971
 
972 972
         $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
973
-        if(!empty($company_logo_attributes)) {
973
+        if (!empty($company_logo_attributes)) {
974 974
             $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
975 975
             $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
976 976
             $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
@@ -979,16 +979,16 @@  discard block
 block discarded – undo
979 979
             // Always need to md5 the file
980 980
             $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
981 981
 
982
-            list($width,$height) = getimagesize($companyLogoURL);
983
-            if ( $width > 212 || $height > 40 ) {
984
-                $resizePctWidth  = ($width - 212)/212;
985
-                $resizePctHeight = ($height - 40)/40;
986
-                if ( $resizePctWidth > $resizePctHeight )
982
+            list($width, $height) = getimagesize($companyLogoURL);
983
+            if ($width > 212 || $height > 40) {
984
+                $resizePctWidth  = ($width - 212) / 212;
985
+                $resizePctHeight = ($height - 40) / 40;
986
+                if ($resizePctWidth > $resizePctHeight)
987 987
                     $resizeAmount = $width / 212;
988 988
                 else
989 989
                     $resizeAmount = $height / 40;
990
-                $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount)));
991
-                $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount)));
990
+                $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
991
+                $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
992 992
             }
993 993
             else {
994 994
                 $ss->assign("COMPANY_LOGO_WIDTH", $width);
@@ -1004,28 +1004,28 @@  discard block
 block discarded – undo
1004 1004
                                 )
1005 1005
             );
1006 1006
         }
1007
-        $ss->assign("COMPANY_LOGO_URL",getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5"));
1007
+        $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL)."&logo_md5=".$ss->get_template_vars("COMPANY_LOGO_MD5"));
1008 1008
 
1009 1009
         // Bug 38594 - Add in Trademark wording
1010 1010
         $copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.<br />';
1011 1011
 
1012 1012
         //rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displayed regardless, so no need
1013 1013
         //to display an empty image here.
1014
-        if(file_exists('include/images/poweredby_sugarcrm_65.png')){
1014
+        if (file_exists('include/images/poweredby_sugarcrm_65.png')) {
1015 1015
             $copyright .= $attribLinkImg;
1016 1016
         }
1017 1017
         // End Required Image
1018
-        $ss->assign('COPYRIGHT',$copyright);
1018
+        $ss->assign('COPYRIGHT', $copyright);
1019 1019
 
1020 1020
         // here we allocate the help link data
1021 1021
         $help_actions_blacklist = array('Login'); // we don't want to show a context help link here
1022
-        if (!in_array($this->action,$help_actions_blacklist)) {
1022
+        if (!in_array($this->action, $help_actions_blacklist)) {
1023 1023
             $url = 'javascript:void(window.open(\'index.php?module=Administration&action=SupportPortal&view=documentation&version='.$GLOBALS['sugar_version'].'&edition='.$GLOBALS['sugar_flavor'].'&lang='.$GLOBALS['current_language'].
1024 1024
                         '&help_module='.$this->module.'&help_action='.$this->action.'&key='.$GLOBALS['server_unique_key'].'\'))';
1025 1025
             $label = (isset($GLOBALS['app_list_strings']['moduleList'][$this->module]) ?
1026
-                        $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module). ' '.$app_strings['LNK_HELP'];
1027
-            $ss->assign('HELP_LINK',SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'",
1028
-                'help-dashlet.png', 'class="icon"',null,null,'','left'));
1026
+                        $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module).' '.$app_strings['LNK_HELP'];
1027
+            $ss->assign('HELP_LINK', SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'",
1028
+                'help-dashlet.png', 'class="icon"', null, null, '', 'left'));
1029 1029
         }
1030 1030
         // end
1031 1031
 
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
      */
1039 1039
     protected function _displaySubPanels()
1040 1040
     {
1041
-        if (isset($this->bean) && !empty($this->bean->id) && (file_exists('modules/' . $this->module . '/metadata/subpaneldefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/subpaneldefs.php') || file_exists('custom/modules/' . $this->module . '/Ext/Layoutdefs/layoutdefs.ext.php'))) {
1041
+        if (isset($this->bean) && !empty($this->bean->id) && (file_exists('modules/'.$this->module.'/metadata/subpaneldefs.php') || file_exists('custom/modules/'.$this->module.'/metadata/subpaneldefs.php') || file_exists('custom/modules/'.$this->module.'/Ext/Layoutdefs/layoutdefs.ext.php'))) {
1042 1042
             $GLOBALS['focus'] = $this->bean;
1043 1043
             require_once ('include/SubPanel/SubPanelTiles.php');
1044 1044
             $subpanel = new SubPanelTiles($this->bean, $this->module);
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
      */
1097 1097
     protected function _checkModule()
1098 1098
     {
1099
-        if(!empty($this->module) && !file_exists('modules/'.$this->module)){
1099
+        if (!empty($this->module) && !file_exists('modules/'.$this->module)) {
1100 1100
             $error = str_replace("[module]", "$this->module", $GLOBALS['app_strings']['ERR_CANNOT_FIND_MODULE']);
1101 1101
             $GLOBALS['log']->fatal($error);
1102 1102
             echo $error;
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
     {
1126 1126
         $endTime = microtime(true);
1127 1127
         $deltaTime = $endTime - $GLOBALS['startTime'];
1128
-        $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS'];
1128
+        $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'].' '.number_format(round($deltaTime, 2), 2).' '.$GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS'];
1129 1129
         $return = $response_time_string;
1130 1130
        // $return .= '<br />';
1131 1131
         if (!empty($GLOBALS['sugar_config']['show_page_resources'])) {
@@ -1136,16 +1136,16 @@  discard block
 block discarded – undo
1136 1136
             // I believe the full get_include_files result set appears to have one entry for each file in real
1137 1137
             // case, and one entry in all lower case.
1138 1138
             $list_of_files_case_insensitive = array();
1139
-            foreach($included_files as $key => $name) {
1139
+            foreach ($included_files as $key => $name) {
1140 1140
                 // preserve the first capitalization encountered.
1141
-                $list_of_files_case_insensitive[mb_strtolower($name) ] = $name;
1141
+                $list_of_files_case_insensitive[mb_strtolower($name)] = $name;
1142 1142
             }
1143
-            $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'] . '(' . DBManager::getQueryCount() . ',' . sizeof($list_of_files_case_insensitive) . ')<br>';
1143
+            $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'].'('.DBManager::getQueryCount().','.sizeof($list_of_files_case_insensitive).')<br>';
1144 1144
             // Display performance of the internal and external caches....
1145 1145
             $cacheStats = SugarCache::instance()->getCacheStats();
1146
-            $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=" . round($cacheStats['localHits']*100/$cacheStats['requests'], 0) . "%)";
1147
-            $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=" . round($cacheStats['externalHits']*100/$cacheStats['requests'], 0) . "%)<br />";
1148
-            $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=" . round($cacheStats['misses']*100/$cacheStats['requests'], 0) . "%)<br />";
1146
+            $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=".round($cacheStats['localHits'] * 100 / $cacheStats['requests'], 0)."%)";
1147
+            $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=".round($cacheStats['externalHits'] * 100 / $cacheStats['requests'], 0)."%)<br />";
1148
+            $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=".round($cacheStats['misses'] * 100 / $cacheStats['requests'], 0)."%)<br />";
1149 1149
         }
1150 1150
 
1151 1151
         $return .= $this->logMemoryStatistics();
@@ -1162,37 +1162,36 @@  discard block
 block discarded – undo
1162 1162
      * @param $newline String of newline character to use (defaults to </ br>)
1163 1163
      * @return $message String formatted message about memory statistics
1164 1164
      */
1165
-    protected function logMemoryStatistics($newline='<br>')
1165
+    protected function logMemoryStatistics($newline = '<br>')
1166 1166
     {
1167 1167
         $log_message = '';
1168 1168
 
1169
-        if(!empty($GLOBALS['sugar_config']['log_memory_usage']))
1169
+        if (!empty($GLOBALS['sugar_config']['log_memory_usage']))
1170 1170
         {
1171
-            if(function_exists('memory_get_usage'))
1171
+            if (function_exists('memory_get_usage'))
1172 1172
             {
1173 1173
                 $memory_usage = memory_get_usage();
1174 1174
                 $bytes = $GLOBALS['app_strings']['LBL_SERVER_MEMORY_BYTES'];
1175 1175
                 $data = array($memory_usage, $bytes);
1176
-                $log_message = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_USAGE'], $data) . $newline;
1176
+                $log_message = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_USAGE'], $data).$newline;
1177 1177
             }
1178 1178
 
1179
-            if(function_exists('memory_get_peak_usage'))
1179
+            if (function_exists('memory_get_peak_usage'))
1180 1180
             {
1181 1181
                 $memory_peak_usage = memory_get_peak_usage();
1182 1182
                 $bytes = $GLOBALS['app_strings']['LBL_SERVER_MEMORY_BYTES'];
1183 1183
                 $data = array($memory_peak_usage, $bytes);
1184
-                $log_message .= string_format($GLOBALS['app_strings']['LBL_SERVER_PEAK_MEMORY_USAGE'], $data) . $newline;
1184
+                $log_message .= string_format($GLOBALS['app_strings']['LBL_SERVER_PEAK_MEMORY_USAGE'], $data).$newline;
1185 1185
             }
1186 1186
 
1187
-            if(!empty($log_message))
1187
+            if (!empty($log_message))
1188 1188
             {
1189
-                $data = array
1190
-                (
1189
+                $data = array(
1191 1190
                    !empty($this->module) ? $this->module : $GLOBALS['app_strings']['LBL_LINK_NONE'],
1192 1191
                    !empty($this->action) ? $this->action : $GLOBALS['app_strings']['LBL_LINK_NONE'],
1193 1192
                 );
1194 1193
 
1195
-                $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data) . $newline;
1194
+                $output = string_format($GLOBALS['app_strings']['LBL_SERVER_MEMORY_LOG_MESSAGE'], $data).$newline;
1196 1195
                 $output .= $log_message;
1197 1196
                 $fp = fopen("memory_usage.log", "ab");
1198 1197
                 fwrite($fp, $output);
@@ -1216,30 +1215,30 @@  discard block
 block discarded – undo
1216 1215
     {
1217 1216
         global $current_language, $current_user, $mod_strings, $app_strings, $module_menu;
1218 1217
 
1219
-        if ( empty($module) )
1218
+        if (empty($module))
1220 1219
             $module = $this->module;
1221 1220
 
1222 1221
         //Need to make sure the mod_strings match the requested module or Menus may fail
1223 1222
         $curr_mod_strings = $mod_strings;
1224
-        $mod_strings = return_module_language ( $current_language, $module ) ;
1223
+        $mod_strings = return_module_language($current_language, $module);
1225 1224
 
1226 1225
         $module_menu = array();
1227 1226
 
1228
-        if (file_exists('modules/' . $module . '/Menu.php')) {
1229
-            require('modules/' . $module . '/Menu.php');
1227
+        if (file_exists('modules/'.$module.'/Menu.php')) {
1228
+            require('modules/'.$module.'/Menu.php');
1230 1229
         }
1231
-        if (file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php')) {
1232
-            require('custom/modules/' . $module . '/Ext/Menus/menu.ext.php');
1230
+        if (file_exists('custom/modules/'.$module.'/Ext/Menus/menu.ext.php')) {
1231
+            require('custom/modules/'.$module.'/Ext/Menus/menu.ext.php');
1233 1232
         }
1234
-        if (!file_exists('modules/' . $module . '/Menu.php')
1235
-                && !file_exists('custom/modules/' . $module . '/Ext/Menus/menu.ext.php')
1233
+        if (!file_exists('modules/'.$module.'/Menu.php')
1234
+                && !file_exists('custom/modules/'.$module.'/Ext/Menus/menu.ext.php')
1236 1235
                 && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) {
1237 1236
             $module_menu[] = array("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView",
1238
-                $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module );
1237
+                $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module", $module);
1239 1238
             $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'],
1240 1239
                 $module, $module);
1241
-            if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) )
1242
-                if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) )
1240
+            if (($this->bean instanceOf SugarBean) && !empty($this->bean->importable))
1241
+                if (!empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]))
1243 1242
                     $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index",
1244 1243
                         $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module);
1245 1244
                 else
@@ -1266,22 +1265,22 @@  discard block
 block discarded – undo
1266 1265
 
1267 1266
 		$userTabs = query_module_access_list($current_user);
1268 1267
 		//If the home tab is in the user array use it as the default tab, otherwise use the first element in the tab array
1269
-		$defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs);
1268
+		$defaultTab = (in_array("Home", $userTabs)) ? "Home" : key($userTabs);
1270 1269
 
1271 1270
         // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
1272
-        if ( !empty($_REQUEST['module_tab']) )
1271
+        if (!empty($_REQUEST['module_tab']))
1273 1272
             return $_REQUEST['module_tab'];
1274
-        elseif ( isset($moduleTabMap[$this->module]) )
1273
+        elseif (isset($moduleTabMap[$this->module]))
1275 1274
             return $moduleTabMap[$this->module];
1276 1275
         // Special cases
1277
-        elseif ( $this->module == 'MergeRecords' )
1276
+        elseif ($this->module == 'MergeRecords')
1278 1277
             return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module'];
1279
-        elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' )
1278
+        elseif ($this->module == 'Users' && $this->action == 'SetTimezone')
1280 1279
             return $defaultTab;
1281 1280
         // Default anonymous pages to be under Home
1282
-        elseif ( !isset($app_list_strings['moduleList'][$this->module]) )
1281
+        elseif (!isset($app_list_strings['moduleList'][$this->module]))
1283 1282
             return $defaultTab;
1284
-        elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" )
1283
+        elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui")
1285 1284
         	return $defaultTab;
1286 1285
         else
1287 1286
             return $this->module;
@@ -1301,42 +1300,42 @@  discard block
 block discarded – undo
1301 1300
 
1302 1301
         $theTitle = "<div class='moduleTitle'>\n";
1303 1302
 
1304
-        $module = preg_replace("/ /","",$this->module);
1303
+        $module = preg_replace("/ /", "", $this->module);
1305 1304
 
1306 1305
         $params = $this->_getModuleTitleParams();
1307 1306
         $index = 0;
1308 1307
 
1309
-		if(SugarThemeRegistry::current()->directionality == "rtl") {
1308
+		if (SugarThemeRegistry::current()->directionality == "rtl") {
1310 1309
 			$params = array_reverse($params);
1311 1310
 		}
1312
-		if(count($params) > 1) {
1311
+		if (count($params) > 1) {
1313 1312
 			array_shift($params);
1314 1313
 		}
1315 1314
 		$count = count($params);
1316 1315
         $paramString = '';
1317
-        foreach($params as $parm){
1316
+        foreach ($params as $parm) {
1318 1317
             $index++;
1319 1318
             $paramString .= $parm;
1320
-            if($index < $count){
1319
+            if ($index < $count) {
1321 1320
                 $paramString .= $this->getBreadCrumbSymbol();
1322 1321
             }
1323 1322
         }
1324 1323
 
1325
-        if(!empty($paramString)){
1324
+        if (!empty($paramString)) {
1326 1325
                $theTitle .= "<h2> $paramString </h2>";
1327 1326
 
1328
-            if($this->type == "detail"){
1329
-                $theTitle .= "<div class='favorite' record_id='" . $this->bean->id . "' module='" . $this->bean->module_dir . "'><div class='favorite_icon_outline'>" . SugarThemeRegistry::current()->getImage('favorite-star-outline','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0"  align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div>
1330
-                                                    <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0"  align="absmiddle"', null,null,'.gif',translate('LBL_DASHLET_EDIT', 'Home')) . "</div></div>";
1327
+            if ($this->type == "detail") {
1328
+                $theTitle .= "<div class='favorite' record_id='".$this->bean->id."' module='".$this->bean->module_dir."'><div class='favorite_icon_outline'>".SugarThemeRegistry::current()->getImage('favorite-star-outline', 'title="'.translate('LBL_DASHLET_EDIT', 'Home').'" border="0"  align="absmiddle"', null, null, '.gif', translate('LBL_DASHLET_EDIT', 'Home'))."</div>
1329
+                                                    <div class='favorite_icon_fill'>" . SugarThemeRegistry::current()->getImage('favorite-star', 'title="'.translate('LBL_DASHLET_EDIT', 'Home').'" border="0"  align="absmiddle"', null, null, '.gif', translate('LBL_DASHLET_EDIT', 'Home'))."</div></div>";
1331 1330
             }
1332 1331
            }
1333 1332
 
1334 1333
         // bug 56131 - restore conditional so that link doesn't appear where it shouldn't
1335
-        if($show_help || $this->type == 'list') {
1334
+        if ($show_help || $this->type == 'list') {
1336 1335
             $theTitle .= "<span class='utils'>";
1337 1336
             $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif');
1338
-            if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView");
1339
-            if($show_help) {
1337
+            if ($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>'; $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView");
1338
+            if ($show_help) {
1340 1339
                 $theTitle .= <<<EOHTML
1341 1340
 &nbsp;
1342 1341
 <a id="create_image" href="{$url}" class="utilsLink">
@@ -1362,31 +1361,31 @@  discard block
 block discarded – undo
1362 1361
     {
1363 1362
         $metadataFile = null;
1364 1363
         $foundViewDefs = false;
1365
-        $viewDef = strtolower($this->type) . 'viewdefs';
1366
-        $coreMetaPath = 'modules/'.$this->module.'/metadata/' . $viewDef . '.php';
1367
-        if(file_exists('custom/' .$coreMetaPath )){
1368
-            $metadataFile = 'custom/' . $coreMetaPath;
1364
+        $viewDef = strtolower($this->type).'viewdefs';
1365
+        $coreMetaPath = 'modules/'.$this->module.'/metadata/'.$viewDef.'.php';
1366
+        if (file_exists('custom/'.$coreMetaPath)) {
1367
+            $metadataFile = 'custom/'.$coreMetaPath;
1369 1368
             $foundViewDefs = true;
1370
-        }else{
1371
-            if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
1369
+        } else {
1370
+            if (file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')) {
1372 1371
                 require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
1373
-                if(!empty($metafiles[$this->module][$viewDef])){
1372
+                if (!empty($metafiles[$this->module][$viewDef])) {
1374 1373
                     $metadataFile = $metafiles[$this->module][$viewDef];
1375 1374
                     $foundViewDefs = true;
1376 1375
                 }
1377
-            }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
1376
+            }elseif (file_exists('modules/'.$this->module.'/metadata/metafiles.php')) {
1378 1377
                 require_once('modules/'.$this->module.'/metadata/metafiles.php');
1379
-                if(!empty($metafiles[$this->module][$viewDef])){
1378
+                if (!empty($metafiles[$this->module][$viewDef])) {
1380 1379
                     $metadataFile = $metafiles[$this->module][$viewDef];
1381 1380
                     $foundViewDefs = true;
1382 1381
                 }
1383 1382
             }
1384 1383
         }
1385 1384
 
1386
-        if(!$foundViewDefs && file_exists($coreMetaPath)){
1385
+        if (!$foundViewDefs && file_exists($coreMetaPath)) {
1387 1386
                 $metadataFile = $coreMetaPath;
1388 1387
         }
1389
-        $GLOBALS['log']->debug("metadatafile=". $metadataFile);
1388
+        $GLOBALS['log']->debug("metadatafile=".$metadataFile);
1390 1389
 
1391 1390
         return $metadataFile;
1392 1391
     }
@@ -1403,10 +1402,10 @@  discard block
 block discarded – undo
1403 1402
     {
1404 1403
         $params = array($this->_getModuleTitleListParam($browserTitle));
1405 1404
 		//$params = array();
1406
-        if (isset($this->action)){
1405
+        if (isset($this->action)) {
1407 1406
             switch ($this->action) {
1408 1407
             case 'EditView':
1409
-                if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) {
1408
+                if (!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) {
1410 1409
                     $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>";
1411 1410
                     $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
1412 1411
                 }
@@ -1430,18 +1429,18 @@  discard block
 block discarded – undo
1430 1429
      *                           there should be no HTML in the string
1431 1430
      * @return string
1432 1431
      */
1433
-    protected function _getModuleTitleListParam( $browserTitle = false )
1432
+    protected function _getModuleTitleListParam($browserTitle = false)
1434 1433
     {
1435 1434
     	global $current_user;
1436 1435
     	global $app_strings;
1437 1436
 
1438
-    	if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module]))
1437
+    	if (!empty($GLOBALS['app_list_strings']['moduleList'][$this->module]))
1439 1438
     		$firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module];
1440 1439
     	else
1441 1440
     		$firstParam = $this->module;
1442 1441
 
1443 1442
     	$iconPath = $this->getModuleTitleIconPath($this->module);
1444
-    	if($this->action == "ListView" || $this->action == "index") {
1443
+    	if ($this->action == "ListView" || $this->action == "index") {
1445 1444
     	    if (!empty($iconPath) && !$browserTitle) {
1446 1445
     	    	if (SugarThemeRegistry::current()->directionality == "ltr") {
1447 1446
     	    		return $app_strings['LBL_SEARCH']."&nbsp;"
@@ -1467,10 +1466,10 @@  discard block
 block discarded – undo
1467 1466
     protected function getModuleTitleIconPath($module)
1468 1467
     {
1469 1468
     	$iconPath = "";
1470
-    	if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) {
1469
+    	if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png', false))) {
1471 1470
     		$iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png');
1472 1471
     	}
1473
-    	else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) {
1472
+    	else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png', false))) {
1474 1473
     		$iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png');
1475 1474
     	}
1476 1475
     	return $iconPath;
@@ -1487,11 +1486,11 @@  discard block
 block discarded – undo
1487 1486
         global $app_strings;
1488 1487
 
1489 1488
         $browserTitle = $app_strings['LBL_BROWSER_TITLE'];
1490
-        if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') )
1489
+        if ($this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login'))
1491 1490
             return $browserTitle;
1492 1491
         $params = $this->_getModuleTitleParams(true);
1493
-        foreach ($params as $value )
1494
-            $browserTitle = strip_tags($value) . ' &raquo; ' . $browserTitle;
1492
+        foreach ($params as $value)
1493
+            $browserTitle = strip_tags($value).' &raquo; '.$browserTitle;
1495 1494
 
1496 1495
         return $browserTitle;
1497 1496
     }
@@ -1503,7 +1502,7 @@  discard block
 block discarded – undo
1503 1502
      */
1504 1503
     public function getBreadCrumbSymbol()
1505 1504
     {
1506
-    	if(SugarThemeRegistry::current()->directionality == "ltr") {
1505
+    	if (SugarThemeRegistry::current()->directionality == "ltr") {
1507 1506
         	return "<span class='pointer'>&raquo;</span>";
1508 1507
         }
1509 1508
         else {
@@ -1516,29 +1515,29 @@  discard block
 block discarded – undo
1516 1515
      *
1517 1516
      * @return array
1518 1517
      */
1519
-    protected function getSugarConfigJS(){
1518
+    protected function getSugarConfigJS() {
1520 1519
         global $sugar_config;
1521 1520
 
1522 1521
         // Set all the config parameters in the JS config as necessary
1523 1522
         $config_js = array();
1524 1523
         // AjaxUI stock banned modules
1525 1524
         $config_js[] = "SUGAR.config.stockAjaxBannedModules = ".json_encode(ajaxBannedModules()).";";
1526
-        if ( isset($sugar_config['quicksearch_querydelay']) ) {
1525
+        if (isset($sugar_config['quicksearch_querydelay'])) {
1527 1526
             $config_js[] = $this->prepareConfigVarForJs('quicksearch_querydelay', $sugar_config['quicksearch_querydelay']);
1528 1527
         }
1529
-        if ( empty($sugar_config['disableAjaxUI']) ) {
1528
+        if (empty($sugar_config['disableAjaxUI'])) {
1530 1529
             $config_js[] = "SUGAR.config.disableAjaxUI = false;";
1531 1530
         }
1532
-        else{
1531
+        else {
1533 1532
             $config_js[] = "SUGAR.config.disableAjaxUI = true;";
1534 1533
         }
1535
-        if ( !empty($sugar_config['addAjaxBannedModules']) ){
1534
+        if (!empty($sugar_config['addAjaxBannedModules'])) {
1536 1535
             $config_js[] = $this->prepareConfigVarForJs('addAjaxBannedModules', $sugar_config['addAjaxBannedModules']);
1537 1536
         }
1538
-        if ( !empty($sugar_config['overrideAjaxBannedModules']) ){
1537
+        if (!empty($sugar_config['overrideAjaxBannedModules'])) {
1539 1538
             $config_js[] = $this->prepareConfigVarForJs('overrideAjaxBannedModules', $sugar_config['overrideAjaxBannedModules']);
1540 1539
         }
1541
-        if (!empty($sugar_config['js_available']) && is_array ($sugar_config['js_available']))
1540
+        if (!empty($sugar_config['js_available']) && is_array($sugar_config['js_available']))
1542 1541
         {
1543 1542
             foreach ($sugar_config['js_available'] as $configKey)
1544 1543
             {
@@ -1599,7 +1598,7 @@  discard block
 block discarded – undo
1599 1598
     protected function getFavicon()
1600 1599
     {
1601 1600
         // get favicon
1602
-        if(isset($GLOBALS['sugar_config']['default_module_favicon']))
1601
+        if (isset($GLOBALS['sugar_config']['default_module_favicon']))
1603 1602
             $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
1604 1603
         else
1605 1604
             $module_favicon = false;
@@ -1607,10 +1606,10 @@  discard block
 block discarded – undo
1607 1606
         $themeObject = SugarThemeRegistry::current();
1608 1607
 
1609 1608
         $favicon = '';
1610
-        if ( $module_favicon )
1611
-            $favicon = $themeObject->getImageURL($this->module.'.gif',false);
1612
-        if ( !sugar_is_file($favicon) || !$module_favicon )
1613
-            $favicon = $themeObject->getImageURL('sugar_icon.ico',false);
1609
+        if ($module_favicon)
1610
+            $favicon = $themeObject->getImageURL($this->module.'.gif', false);
1611
+        if (!sugar_is_file($favicon) || !$module_favicon)
1612
+            $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
1614 1613
 
1615 1614
         $extension = pathinfo($favicon, PATHINFO_EXTENSION);
1616 1615
         switch ($extension)
@@ -1667,10 +1666,10 @@  discard block
 block discarded – undo
1667 1666
      * @return array augmented history with image link and shortened name
1668 1667
      */
1669 1668
     protected function processRecentRecords($history) {
1670
-        foreach ( $history as $key => $row ) {
1669
+        foreach ($history as $key => $row) {
1671 1670
             $history[$key]['item_summary_short'] = to_html(getTrackerSubstring($row['item_summary'])); //bug 56373 - need to re-HTML-encode
1672 1671
             $history[$key]['image'] = SugarThemeRegistry::current()
1673
-                ->getImage($row['module_name'],'border="0" align="absmiddle"',null,null,'.gif',$row['item_summary']);
1672
+                ->getImage($row['module_name'], 'border="0" align="absmiddle"', null, null, '.gif', $row['item_summary']);
1674 1673
         }
1675 1674
         return $history;
1676 1675
     }
@@ -1684,10 +1683,10 @@  discard block
 block discarded – undo
1684 1683
      *
1685 1684
 	 * @return boolean indicating true or false
1686 1685
 	 */
1687
-    public function checkPostMaxSizeError(){
1686
+    public function checkPostMaxSizeError() {
1688 1687
          //if the referrer is post, and the post array is empty, then an error has occurred, most likely
1689 1688
          //while uploading a file that exceeds the post_max_size.
1690
-         if(empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){
1689
+         if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
1691 1690
              $GLOBALS['log']->fatal($GLOBALS['app_strings']['UPLOAD_ERROR_HOME_TEXT']);
1692 1691
              return true;
1693 1692
         }
Please login to merge, or discard this patch.
Braces   +129 added lines, -105 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
103 103
         if(isset($GLOBALS['log'])) {
104 104
             $GLOBALS['log']->deprecated($deprecatedMessage);
105
-        }
106
-        else {
105
+        } else {
107 106
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
108 107
         }
109 108
         self::__construct($bean, $view_object_map);
@@ -178,13 +177,17 @@  discard block
 block discarded – undo
178 177
             echo $jsAlerts->getScript();
179 178
         }
180 179
 
181
-        if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) $this->_displaySubPanels();
180
+        if ($this->_getOption('show_subpanels') && !empty($_REQUEST['record'])) {
181
+            $this->_displaySubPanels();
182
+        }
182 183
 
183 184
         if ($this->action === 'Login') {
184 185
             //this is needed for a faster loading login page ie won't render unless the tables are closed
185 186
             ob_flush();
186 187
         }
187
-        if ($this->_getOption('show_footer')) $this->displayFooter();
188
+        if ($this->_getOption('show_footer')) {
189
+            $this->displayFooter();
190
+        }
188 191
         $GLOBALS['logic_hook']->call_custom_logic('', 'after_ui_footer');
189 192
         if ($this->_getOption('json_output'))
190 193
         {
@@ -203,11 +206,13 @@  discard block
 block discarded – undo
203 206
                 'favicon' => $this->getFavicon(),
204 207
             );
205 208
 
206
-            if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic)
207
-                $ajax_ret['moduleList'] = $this->displayHeader(true);
209
+            if(SugarThemeRegistry::current()->name == 'Classic' || SugarThemeRegistry::current()->classic) {
210
+                            $ajax_ret['moduleList'] = $this->displayHeader(true);
211
+            }
208 212
 
209
-            if(empty($this->responseTime))
210
-                $this->_calculateFooterMetrics();
213
+            if(empty($this->responseTime)) {
214
+                            $this->_calculateFooterMetrics();
215
+            }
211 216
             $ajax_ret['responseTime'] = $this->responseTime;
212 217
             $json = getJSONobj();
213 218
             echo $json->encode($ajax_ret);
@@ -231,8 +236,7 @@  discard block
 block discarded – undo
231 236
 
232 237
         if ( !$this->suppressDisplayErrors ) {
233 238
             echo $errors;
234
-        }
235
-        else {
239
+        } else {
236 240
             return $errors;
237 241
         }
238 242
     }
@@ -346,24 +350,26 @@  discard block
 block discarded – undo
346 350
         ob_end_clean();
347 351
 
348 352
         // get favicon
349
-        if(isset($GLOBALS['sugar_config']['default_module_favicon']))
350
-            $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
351
-        else
352
-            $module_favicon = false;
353
+        if(isset($GLOBALS['sugar_config']['default_module_favicon'])) {
354
+                    $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
355
+        } else {
356
+                    $module_favicon = false;
357
+        }
353 358
 
354 359
         $favicon = $this->getFavicon();
355 360
         $ss->assign('FAVICON_URL', $favicon['url']);
356 361
 
357 362
         // build the shortcut menu
358 363
         $shortcut_menu = array();
359
-        foreach ( $this->getMenu() as $key => $menu_item )
360
-            $shortcut_menu[$key] = array(
364
+        foreach ( $this->getMenu() as $key => $menu_item ) {
365
+                    $shortcut_menu[$key] = array(
361 366
                 "URL"         => $menu_item[0],
362 367
                 "LABEL"       => $menu_item[1],
363 368
                 "MODULE_NAME" => $menu_item[2],
364 369
                 "IMAGE"       => $themeObject
365 370
                     ->getImage($menu_item[2],"border='0' align='absmiddle'",null,null,'.gif',$menu_item[1]),
366 371
                 );
372
+        }
367 373
         $ss->assign("SHORTCUT_MENU",$shortcut_menu);
368 374
 
369 375
         // handle rtl text direction
@@ -387,8 +393,7 @@  discard block
 block discarded – undo
387 393
             $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
388 394
             $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
389 395
             $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
390
-        }
391
-        else {
396
+        } else {
392 397
             // Always need to md5 the file
393 398
             $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
394 399
 
@@ -396,14 +401,14 @@  discard block
 block discarded – undo
396 401
             if ( $width > 212 || $height > 40 ) {
397 402
                 $resizePctWidth  = ($width - 212)/212;
398 403
                 $resizePctHeight = ($height - 40)/40;
399
-                if ( $resizePctWidth > $resizePctHeight )
400
-                    $resizeAmount = $width / 212;
401
-                else
402
-                    $resizeAmount = $height / 40;
404
+                if ( $resizePctWidth > $resizePctHeight ) {
405
+                                    $resizeAmount = $width / 212;
406
+                } else {
407
+                                    $resizeAmount = $height / 40;
408
+                }
403 409
                 $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount)));
404 410
                 $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount)));
405
-            }
406
-            else {
411
+            } else {
407 412
                 $ss->assign("COMPANY_LOGO_WIDTH", $width);
408 413
                 $ss->assign("COMPANY_LOGO_HEIGHT", $height);
409 414
             }
@@ -446,11 +451,12 @@  discard block
 block discarded – undo
446 451
                 }
447 452
                 // and now the sublinks
448 453
                 if ( $linkattribute == 'submenu' && is_array($attributevalue) ) {
449
-                    foreach ($attributevalue as $submenulinkkey => $submenulinkinfo)
450
-                        $gcls[$key]['SUBMENU'][$submenulinkkey] = array(
454
+                    foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) {
455
+                                            $gcls[$key]['SUBMENU'][$submenulinkkey] = array(
451 456
                             "LABEL" => key($submenulinkinfo),
452 457
                             "URL"   => current($submenulinkinfo),
453 458
                         );
459
+                    }
454 460
                        if(substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"], 0, 11) == "javascript:") {
455 461
                            $gcls[$key]['SUBMENU'][$submenulinkkey]["ONCLICK"] = substr($gcls[$key]['SUBMENU'][$submenulinkkey]["URL"],11);
456 462
                            $gcls[$key]['SUBMENU'][$submenulinkkey]["URL"] = "javascript:void(0)";
@@ -462,8 +468,9 @@  discard block
 block discarded – undo
462 468
 
463 469
         $ss->assign("SEARCH", isset($_REQUEST['query_string']) ? $_REQUEST['query_string'] : '');
464 470
 
465
-        if ($this->action == "EditView" || $this->action == "Login")
466
-            $ss->assign("ONLOAD", 'onload="set_focus()"');
471
+        if ($this->action == "EditView" || $this->action == "Login") {
472
+                    $ss->assign("ONLOAD", 'onload="set_focus()"');
473
+        }
467 474
 
468 475
         $ss->assign("AUTHENTICATED",isset($_SESSION["authenticated_user_id"]));
469 476
 
@@ -523,8 +530,7 @@  discard block
 block discarded – undo
523 530
                 foreach($frames as $key => $values){
524 531
                         $fullModuleList[$key] = $values;
525 532
                 }
526
-            }
527
-            elseif (isset($fullModuleList['iFrames'])) {
533
+            } elseif (isset($fullModuleList['iFrames'])) {
528 534
                 unset($fullModuleList['iFrames']);
529 535
             }
530 536
 
@@ -541,8 +547,7 @@  discard block
 block discarded – undo
541 547
                     // We have a default value. Use it
542 548
                     if(isset($GLOBALS['sugar_config']['default_max_tabs'])){
543 549
                         $max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
544
-                    }
545
-                    else{
550
+                    } else{
546 551
                         $max_tabs = 8;
547 552
                     }
548 553
                 }
@@ -650,7 +655,9 @@  discard block
 block discarded – undo
650 655
                         );
651 656
                 }
652 657
             }
653
-            if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $ss->assign('lock_homepage', true);
658
+            if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) {
659
+                $ss->assign('lock_homepage', true);
660
+            }
654 661
             $ss->assign("groupTabs",$groupTabs);
655 662
             $ss->assign("shortcutTopMenu",$shortcutTopMenu);
656 663
             $ss->assign('USE_GROUP_TABS',$usingGroupTabs);
@@ -693,8 +700,9 @@  discard block
 block discarded – undo
693 700
         global $mod_strings;
694 701
         $mod_strings = $bakModStrings;
695 702
         $headerTpl = $themeObject->getTemplate('header.tpl');
696
-        if (inDeveloperMode() )
697
-            $ss->clear_compiled_tpl($headerTpl);
703
+        if (inDeveloperMode() ) {
704
+                    $ss->clear_compiled_tpl($headerTpl);
705
+        }
698 706
 
699 707
         if ($retModTabs)
700 708
         {
@@ -733,8 +741,9 @@  discard block
 block discarded – undo
733 741
         global $gridline, $request_string, $modListHeader, $dashletData, $authController, $locale, $currentModule, $import_bean_map, $image_path, $license;
734 742
         global $user_unique_key, $server_unique_key, $barChartColors, $modules_exempt_from_availability_check, $dictionary, $current_language, $beanList, $beanFiles, $sugar_build, $sugar_codename;
735 743
         global $timedate, $login_error; // cn: bug 13855 - timedate not available to classic views.
736
-        if (!empty($this->module))
737
-            $currentModule = $this->module;
744
+        if (!empty($this->module)) {
745
+                    $currentModule = $this->module;
746
+        }
738 747
         include_once ($file);
739 748
     }
740 749
 
@@ -867,8 +876,9 @@  discard block
 block discarded – undo
867 876
 
868 877
 			echo $this->_getModLanguageJS();
869 878
 
870
-            if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client'])
871
-                echo getVersionedScript('modules/Sync/headersync.js');
879
+            if(isset( $sugar_config['disc_client']) && $sugar_config['disc_client']) {
880
+                            echo getVersionedScript('modules/Sync/headersync.js');
881
+            }
872 882
 
873 883
 
874 884
             //echo out the $js_vars variables as javascript variables
@@ -935,8 +945,9 @@  discard block
 block discarded – undo
935 945
 			}
936 946
 		}
937 947
 		$ss->assign("BOTTOMLINKS",$bottomLinksStr);
938
-        if (SugarConfig::getInstance()->get('calculate_response_time', false))
939
-            $ss->assign('STATISTICS',$this->_getStatistics());
948
+        if (SugarConfig::getInstance()->get('calculate_response_time', false)) {
949
+                    $ss->assign('STATISTICS',$this->_getStatistics());
950
+        }
940 951
 
941 952
         // Under the License referenced above, you are required to leave in all copyright statements in both
942 953
         // the code and end-user application.
@@ -974,8 +985,7 @@  discard block
 block discarded – undo
974 985
             $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
975 986
             $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
976 987
             $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
977
-        }
978
-        else {
988
+        } else {
979 989
             // Always need to md5 the file
980 990
             $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
981 991
 
@@ -983,14 +993,14 @@  discard block
 block discarded – undo
983 993
             if ( $width > 212 || $height > 40 ) {
984 994
                 $resizePctWidth  = ($width - 212)/212;
985 995
                 $resizePctHeight = ($height - 40)/40;
986
-                if ( $resizePctWidth > $resizePctHeight )
987
-                    $resizeAmount = $width / 212;
988
-                else
989
-                    $resizeAmount = $height / 40;
996
+                if ( $resizePctWidth > $resizePctHeight ) {
997
+                                    $resizeAmount = $width / 212;
998
+                } else {
999
+                                    $resizeAmount = $height / 40;
1000
+                }
990 1001
                 $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1/$resizeAmount)));
991 1002
                 $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1/$resizeAmount)));
992
-            }
993
-            else {
1003
+            } else {
994 1004
                 $ss->assign("COMPANY_LOGO_WIDTH", $width);
995 1005
                 $ss->assign("COMPANY_LOGO_HEIGHT", $height);
996 1006
             }
@@ -1048,8 +1058,9 @@  discard block
 block discarded – undo
1048 1058
 
1049 1059
     protected function _buildModuleList()
1050 1060
     {
1051
-        if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader']))
1052
-            $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
1061
+        if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
1062
+                    $GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
1063
+        }
1053 1064
     }
1054 1065
 
1055 1066
     /**
@@ -1069,7 +1080,9 @@  discard block
 block discarded – undo
1069 1080
             return $this->options['show_all'];
1070 1081
         } elseif (!empty($this->options) && isset($this->options[$option])) {
1071 1082
             return $this->options[$option];
1072
-        } else return $default;
1083
+        } else {
1084
+            return $default;
1085
+        }
1073 1086
     }
1074 1087
 
1075 1088
     /**
@@ -1106,10 +1119,11 @@  discard block
 block discarded – undo
1106 1119
 
1107 1120
     public function renderJavascript()
1108 1121
     {
1109
-        if ($this->action !== 'Login')
1110
-            $this->_displayJavascript();
1111
-        else
1112
-            $this->_displayLoginJS();
1122
+        if ($this->action !== 'Login') {
1123
+                    $this->_displayJavascript();
1124
+        } else {
1125
+                    $this->_displayLoginJS();
1126
+        }
1113 1127
     }
1114 1128
 
1115 1129
     private function _calculateFooterMetrics()
@@ -1216,8 +1230,9 @@  discard block
 block discarded – undo
1216 1230
     {
1217 1231
         global $current_language, $current_user, $mod_strings, $app_strings, $module_menu;
1218 1232
 
1219
-        if ( empty($module) )
1220
-            $module = $this->module;
1233
+        if ( empty($module) ) {
1234
+                    $module = $this->module;
1235
+        }
1221 1236
 
1222 1237
         //Need to make sure the mod_strings match the requested module or Menus may fail
1223 1238
         $curr_mod_strings = $mod_strings;
@@ -1238,13 +1253,14 @@  discard block
 block discarded – undo
1238 1253
                 $GLOBALS['mod_strings']['LNK_NEW_RECORD'],"{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}$module" ,$module );
1239 1254
             $module_menu[] = array("index.php?module=$module&action=index", $GLOBALS['mod_strings']['LNK_LIST'],
1240 1255
                 $module, $module);
1241
-            if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) )
1242
-                if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) )
1256
+            if ( ($this->bean instanceOf SugarBean) && !empty($this->bean->importable) ) {
1257
+                            if ( !empty($mod_strings['LNK_IMPORT_'.strtoupper($module)]) )
1243 1258
                     $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index",
1244 1259
                         $mod_strings['LNK_IMPORT_'.strtoupper($module)], "Import", $module);
1245
-                else
1246
-                    $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index",
1260
+            } else {
1261
+                                    $module_menu[] = array("index.php?module=Import&action=Step1&import_module=$module&return_module=$module&return_action=index",
1247 1262
                         $app_strings['LBL_IMPORT'], "Import", $module);
1263
+                }
1248 1264
         }
1249 1265
         if (file_exists('custom/application/Ext/Menus/menu.ext.php')) {
1250 1266
             require('custom/application/Ext/Menus/menu.ext.php');
@@ -1269,22 +1285,25 @@  discard block
 block discarded – undo
1269 1285
 		$defaultTab = (in_array("Home",$userTabs)) ? "Home" : key($userTabs);
1270 1286
 
1271 1287
         // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
1272
-        if ( !empty($_REQUEST['module_tab']) )
1273
-            return $_REQUEST['module_tab'];
1274
-        elseif ( isset($moduleTabMap[$this->module]) )
1275
-            return $moduleTabMap[$this->module];
1288
+        if ( !empty($_REQUEST['module_tab']) ) {
1289
+                    return $_REQUEST['module_tab'];
1290
+        } elseif ( isset($moduleTabMap[$this->module]) ) {
1291
+                    return $moduleTabMap[$this->module];
1292
+        }
1276 1293
         // Special cases
1277
-        elseif ( $this->module == 'MergeRecords' )
1278
-            return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module'];
1279
-        elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' )
1280
-            return $defaultTab;
1294
+        elseif ( $this->module == 'MergeRecords' ) {
1295
+                    return !empty($_REQUEST['merge_module']) ? $_REQUEST['merge_module'] : $_REQUEST['return_module'];
1296
+        } elseif ( $this->module == 'Users' && $this->action == 'SetTimezone' ) {
1297
+                    return $defaultTab;
1298
+        }
1281 1299
         // Default anonymous pages to be under Home
1282
-        elseif ( !isset($app_list_strings['moduleList'][$this->module]) )
1283
-            return $defaultTab;
1284
-        elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" )
1285
-        	return $defaultTab;
1286
-        else
1287
-            return $this->module;
1300
+        elseif ( !isset($app_list_strings['moduleList'][$this->module]) ) {
1301
+                    return $defaultTab;
1302
+        } elseif ( isset($_REQUEST['action']) && $_REQUEST['action'] == "ajaxui" ) {
1303
+                	return $defaultTab;
1304
+        } else {
1305
+                    return $this->module;
1306
+        }
1288 1307
     }
1289 1308
 
1290 1309
    /**
@@ -1335,7 +1354,10 @@  discard block
 block discarded – undo
1335 1354
         if($show_help || $this->type == 'list') {
1336 1355
             $theTitle .= "<span class='utils'>";
1337 1356
             $createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif');
1338
-            if($this->type == 'list') $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';$url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView");
1357
+            if($this->type == 'list') {
1358
+                $theTitle .= '<a href="#" class="btn btn-success showsearch"><span class=" glyphicon glyphicon-search" aria-hidden="true"></span></a>';
1359
+            }
1360
+            $url = ajaxLink("index.php?module=$module&action=EditView&return_module=$module&return_action=DetailView");
1339 1361
             if($show_help) {
1340 1362
                 $theTitle .= <<<EOHTML
1341 1363
 &nbsp;
@@ -1367,14 +1389,14 @@  discard block
 block discarded – undo
1367 1389
         if(file_exists('custom/' .$coreMetaPath )){
1368 1390
             $metadataFile = 'custom/' . $coreMetaPath;
1369 1391
             $foundViewDefs = true;
1370
-        }else{
1392
+        } else{
1371 1393
             if(file_exists('custom/modules/'.$this->module.'/metadata/metafiles.php')){
1372 1394
                 require_once('custom/modules/'.$this->module.'/metadata/metafiles.php');
1373 1395
                 if(!empty($metafiles[$this->module][$viewDef])){
1374 1396
                     $metadataFile = $metafiles[$this->module][$viewDef];
1375 1397
                     $foundViewDefs = true;
1376 1398
                 }
1377
-            }elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
1399
+            } elseif(file_exists('modules/'.$this->module.'/metadata/metafiles.php')){
1378 1400
                 require_once('modules/'.$this->module.'/metadata/metafiles.php');
1379 1401
                 if(!empty($metafiles[$this->module][$viewDef])){
1380 1402
                     $metadataFile = $metafiles[$this->module][$viewDef];
@@ -1409,9 +1431,9 @@  discard block
 block discarded – undo
1409 1431
                 if(!empty($this->bean->id) && (empty($_REQUEST['isDuplicate']) || $_REQUEST['isDuplicate'] === 'false')) {
1410 1432
                     $params[] = "<a href='index.php?module={$this->module}&action=DetailView&record={$this->bean->id}'>".$this->bean->get_summary_text()."</a>";
1411 1433
                     $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
1434
+                } else {
1435
+                                    $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
1412 1436
                 }
1413
-                else
1414
-                    $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
1415 1437
                 break;
1416 1438
             case 'DetailView':
1417 1439
                 $beanName = $this->bean->get_summary_text();
@@ -1435,10 +1457,11 @@  discard block
 block discarded – undo
1435 1457
     	global $current_user;
1436 1458
     	global $app_strings;
1437 1459
 
1438
-    	if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module]))
1439
-    		$firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module];
1440
-    	else
1441
-    		$firstParam = $this->module;
1460
+    	if(!empty($GLOBALS['app_list_strings']['moduleList'][$this->module])) {
1461
+    	    		$firstParam = $GLOBALS['app_list_strings']['moduleList'][$this->module];
1462
+    	} else {
1463
+    	    		$firstParam = $this->module;
1464
+    	}
1442 1465
 
1443 1466
     	$iconPath = $this->getModuleTitleIconPath($this->module);
1444 1467
     	if($this->action == "ListView" || $this->action == "index") {
@@ -1454,8 +1477,7 @@  discard block
 block discarded – undo
1454 1477
 			} else {
1455 1478
 				return $firstParam;
1456 1479
 			}
1457
-    	}
1458
-    	else {
1480
+    	} else {
1459 1481
 		    if (!empty($iconPath) && !$browserTitle) {
1460 1482
 				//return "<a href='index.php?module={$this->module}&action=index'>$this->module</a>";
1461 1483
 			} else {
@@ -1469,8 +1491,7 @@  discard block
 block discarded – undo
1469 1491
     	$iconPath = "";
1470 1492
     	if(is_file(SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png',false))) {
1471 1493
     		$iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.$module.'_32.png');
1472
-    	}
1473
-    	else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) {
1494
+    	} else if (is_file(SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png',false))) {
1474 1495
     		$iconPath = SugarThemeRegistry::current()->getImageURL('icon_'.ucfirst($module).'_32.png');
1475 1496
     	}
1476 1497
     	return $iconPath;
@@ -1487,11 +1508,13 @@  discard block
 block discarded – undo
1487 1508
         global $app_strings;
1488 1509
 
1489 1510
         $browserTitle = $app_strings['LBL_BROWSER_TITLE'];
1490
-        if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') )
1491
-            return $browserTitle;
1511
+        if ( $this->module == 'Users' && ($this->action == 'SetTimezone' || $this->action == 'Login') ) {
1512
+                    return $browserTitle;
1513
+        }
1492 1514
         $params = $this->_getModuleTitleParams(true);
1493
-        foreach ($params as $value )
1494
-            $browserTitle = strip_tags($value) . ' &raquo; ' . $browserTitle;
1515
+        foreach ($params as $value ) {
1516
+                    $browserTitle = strip_tags($value) . ' &raquo; ' . $browserTitle;
1517
+        }
1495 1518
 
1496 1519
         return $browserTitle;
1497 1520
     }
@@ -1505,8 +1528,7 @@  discard block
 block discarded – undo
1505 1528
     {
1506 1529
     	if(SugarThemeRegistry::current()->directionality == "ltr") {
1507 1530
         	return "<span class='pointer'>&raquo;</span>";
1508
-        }
1509
-        else {
1531
+        } else {
1510 1532
         	return "<span class='pointer'>&laquo;</span>";
1511 1533
         }
1512 1534
     }
@@ -1528,8 +1550,7 @@  discard block
 block discarded – undo
1528 1550
         }
1529 1551
         if ( empty($sugar_config['disableAjaxUI']) ) {
1530 1552
             $config_js[] = "SUGAR.config.disableAjaxUI = false;";
1531
-        }
1532
-        else{
1553
+        } else{
1533 1554
             $config_js[] = "SUGAR.config.disableAjaxUI = true;";
1534 1555
         }
1535 1556
         if ( !empty($sugar_config['addAjaxBannedModules']) ){
@@ -1599,18 +1620,21 @@  discard block
 block discarded – undo
1599 1620
     protected function getFavicon()
1600 1621
     {
1601 1622
         // get favicon
1602
-        if(isset($GLOBALS['sugar_config']['default_module_favicon']))
1603
-            $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
1604
-        else
1605
-            $module_favicon = false;
1623
+        if(isset($GLOBALS['sugar_config']['default_module_favicon'])) {
1624
+                    $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
1625
+        } else {
1626
+                    $module_favicon = false;
1627
+        }
1606 1628
 
1607 1629
         $themeObject = SugarThemeRegistry::current();
1608 1630
 
1609 1631
         $favicon = '';
1610
-        if ( $module_favicon )
1611
-            $favicon = $themeObject->getImageURL($this->module.'.gif',false);
1612
-        if ( !sugar_is_file($favicon) || !$module_favicon )
1613
-            $favicon = $themeObject->getImageURL('sugar_icon.ico',false);
1632
+        if ( $module_favicon ) {
1633
+                    $favicon = $themeObject->getImageURL($this->module.'.gif',false);
1634
+        }
1635
+        if ( !sugar_is_file($favicon) || !$module_favicon ) {
1636
+                    $favicon = $themeObject->getImageURL('sugar_icon.ico',false);
1637
+        }
1614 1638
 
1615 1639
         $extension = pathinfo($favicon, PATHINFO_EXTENSION);
1616 1640
         switch ($extension)
Please login to merge, or discard this patch.
include/MVC/Controller/ControllerFactory.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,43 +44,43 @@
 block discarded – undo
44 44
  */
45 45
 class ControllerFactory
46 46
 {
47
-	/**
48
-	 * Obtain an instance of the correct controller.
49
-	 *
50
-	 * @return an instance of SugarController
51
-	 */
52
-	static function getController($module){
53
-		$class = ucfirst($module).'Controller';
54
-		$customClass = 'Custom' . $class;
55
-		if(file_exists('custom/modules/'.$module.'/controller.php')){
56
-			$customClass = 'Custom' . $class;
57
-			require_once('custom/modules/'.$module.'/controller.php');
58
-			if(class_exists($customClass)){
59
-				$controller = new $customClass();
60
-			}else if(class_exists($class)){
61
-				$controller = new $class();
62
-			}
63
-		}elseif(file_exists('modules/'.$module.'/controller.php')){
64
-			require_once('modules/'.$module.'/controller.php');
65
-			if(class_exists($customClass)){
66
-				$controller = new $customClass();
67
-			}else if(class_exists($class)){
68
-				$controller = new $class();
69
-			}
70
-		}else{
71
-			if(file_exists('custom/include/MVC/Controller/SugarController.php')){
72
-				require_once('custom/include/MVC/Controller/SugarController.php');
73
-			}
74
-			if(class_exists('CustomSugarController')){
75
-				$controller = new CustomSugarController();
76
-			}else{
77
-			$controller = new SugarController();
78
-			}
79
-		}
80
-		//setup the controller
81
-		$controller->setup($module);
82
-		return $controller;
83
-	}
47
+    /**
48
+     * Obtain an instance of the correct controller.
49
+     *
50
+     * @return an instance of SugarController
51
+     */
52
+    static function getController($module){
53
+        $class = ucfirst($module).'Controller';
54
+        $customClass = 'Custom' . $class;
55
+        if(file_exists('custom/modules/'.$module.'/controller.php')){
56
+            $customClass = 'Custom' . $class;
57
+            require_once('custom/modules/'.$module.'/controller.php');
58
+            if(class_exists($customClass)){
59
+                $controller = new $customClass();
60
+            }else if(class_exists($class)){
61
+                $controller = new $class();
62
+            }
63
+        }elseif(file_exists('modules/'.$module.'/controller.php')){
64
+            require_once('modules/'.$module.'/controller.php');
65
+            if(class_exists($customClass)){
66
+                $controller = new $customClass();
67
+            }else if(class_exists($class)){
68
+                $controller = new $class();
69
+            }
70
+        }else{
71
+            if(file_exists('custom/include/MVC/Controller/SugarController.php')){
72
+                require_once('custom/include/MVC/Controller/SugarController.php');
73
+            }
74
+            if(class_exists('CustomSugarController')){
75
+                $controller = new CustomSugarController();
76
+            }else{
77
+            $controller = new SugarController();
78
+            }
79
+        }
80
+        //setup the controller
81
+        $controller->setup($module);
82
+        return $controller;
83
+    }
84 84
 
85 85
 }
86 86
 ?>
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,31 +49,31 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @return an instance of SugarController
51 51
 	 */
52
-	static function getController($module){
52
+	static function getController($module) {
53 53
 		$class = ucfirst($module).'Controller';
54
-		$customClass = 'Custom' . $class;
55
-		if(file_exists('custom/modules/'.$module.'/controller.php')){
56
-			$customClass = 'Custom' . $class;
54
+		$customClass = 'Custom'.$class;
55
+		if (file_exists('custom/modules/'.$module.'/controller.php')) {
56
+			$customClass = 'Custom'.$class;
57 57
 			require_once('custom/modules/'.$module.'/controller.php');
58
-			if(class_exists($customClass)){
58
+			if (class_exists($customClass)) {
59 59
 				$controller = new $customClass();
60
-			}else if(class_exists($class)){
60
+			} else if (class_exists($class)) {
61 61
 				$controller = new $class();
62 62
 			}
63
-		}elseif(file_exists('modules/'.$module.'/controller.php')){
63
+		}elseif (file_exists('modules/'.$module.'/controller.php')) {
64 64
 			require_once('modules/'.$module.'/controller.php');
65
-			if(class_exists($customClass)){
65
+			if (class_exists($customClass)) {
66 66
 				$controller = new $customClass();
67
-			}else if(class_exists($class)){
67
+			} else if (class_exists($class)) {
68 68
 				$controller = new $class();
69 69
 			}
70
-		}else{
71
-			if(file_exists('custom/include/MVC/Controller/SugarController.php')){
70
+		} else {
71
+			if (file_exists('custom/include/MVC/Controller/SugarController.php')) {
72 72
 				require_once('custom/include/MVC/Controller/SugarController.php');
73 73
 			}
74
-			if(class_exists('CustomSugarController')){
74
+			if (class_exists('CustomSugarController')) {
75 75
 				$controller = new CustomSugarController();
76
-			}else{
76
+			} else {
77 77
 			$controller = new SugarController();
78 78
 			}
79 79
 		}
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,23 +57,23 @@
 block discarded – undo
57 57
 			require_once('custom/modules/'.$module.'/controller.php');
58 58
 			if(class_exists($customClass)){
59 59
 				$controller = new $customClass();
60
-			}else if(class_exists($class)){
60
+			} else if(class_exists($class)){
61 61
 				$controller = new $class();
62 62
 			}
63
-		}elseif(file_exists('modules/'.$module.'/controller.php')){
63
+		} elseif(file_exists('modules/'.$module.'/controller.php')){
64 64
 			require_once('modules/'.$module.'/controller.php');
65 65
 			if(class_exists($customClass)){
66 66
 				$controller = new $customClass();
67
-			}else if(class_exists($class)){
67
+			} else if(class_exists($class)){
68 68
 				$controller = new $class();
69 69
 			}
70
-		}else{
70
+		} else{
71 71
 			if(file_exists('custom/include/MVC/Controller/SugarController.php')){
72 72
 				require_once('custom/include/MVC/Controller/SugarController.php');
73 73
 			}
74 74
 			if(class_exists('CustomSugarController')){
75 75
 				$controller = new CustomSugarController();
76
-			}else{
76
+			} else{
77 77
 			$controller = new SugarController();
78 78
 			}
79 79
 		}
Please login to merge, or discard this patch.
include/MVC/Controller/action_view_map.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
  * To change the template for this generated file go to
44 44
  * Window - Preferences - PHPeclipse - PHP - Code Templates
45 45
  */
46
- //format '<action_name>' => '<view_name>'
46
+    //format '<action_name>' => '<view_name>'
47 47
 $action_view_map['multieditview']= 'multiedit';
48 48
 $action_view_map['detailview']= 'detail';
49 49
 $action_view_map['editview']= 'edit';
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,21 +44,21 @@
 block discarded – undo
44 44
  * Window - Preferences - PHPeclipse - PHP - Code Templates
45 45
  */
46 46
  //format '<action_name>' => '<view_name>'
47
-$action_view_map['multieditview']= 'multiedit';
48
-$action_view_map['detailview']= 'detail';
49
-$action_view_map['editview']= 'edit';
50
-$action_view_map['listview']= 'list';
51
-$action_view_map['popup']= 'popup';
52
-$action_view_map['vcard']= 'vcard';
53
-$action_view_map['importvcard']= 'importvcard';
54
-$action_view_map['importvcardsave']= 'importvcardsave';
55
-$action_view_map['modulelistmenu']= 'modulelistmenu';
56
-$action_view_map['favorites']= 'favorites';
57
-$action_view_map['ajaxui']= 'ajaxui';
58
-$action_view_map['noaccess']= 'noaccess';
47
+$action_view_map['multieditview'] = 'multiedit';
48
+$action_view_map['detailview'] = 'detail';
49
+$action_view_map['editview'] = 'edit';
50
+$action_view_map['listview'] = 'list';
51
+$action_view_map['popup'] = 'popup';
52
+$action_view_map['vcard'] = 'vcard';
53
+$action_view_map['importvcard'] = 'importvcard';
54
+$action_view_map['importvcardsave'] = 'importvcardsave';
55
+$action_view_map['modulelistmenu'] = 'modulelistmenu';
56
+$action_view_map['favorites'] = 'favorites';
57
+$action_view_map['ajaxui'] = 'ajaxui';
58
+$action_view_map['noaccess'] = 'noaccess';
59 59
 
60 60
 // SugarPDF
61
-$action_view_map['sugarpdf']= 'sugarpdf';
61
+$action_view_map['sugarpdf'] = 'sugarpdf';
62 62
 $action_view_map['dc'] = 'dc';
63 63
 $action_view_map['dcajax'] = 'dcajax';
64 64
 $action_view_map['quick'] = 'quick';
Please login to merge, or discard this patch.
include/MVC/Controller/file_access_control_map.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -46,29 +46,29 @@
 block discarded – undo
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48 48
 $file_access_control_map = array(
49
-	'modules' => array(
50
-		'administration' => array(
51
-			'actions' => array(
52
-				'backups',
53
-				'updater',
54
-			),
55
-			'links'	=> array(
56
-				'update',
57
-				'backup_management',
58
-				'upgrade_wizard',
59
-				'moduleBuilder',
60
-			),
61
-		),
62
-		'upgradewizard' => array(
63
-				'actions' => array(
64
-					'index',
65
-				),
66
-		),
67
-		'modulebuilder' => array(
68
-				'actions' => array(
69
-					'index' => array('params' => array('type' => array('mb'))),
70
-				),
71
-		),
72
-	)
49
+    'modules' => array(
50
+        'administration' => array(
51
+            'actions' => array(
52
+                'backups',
53
+                'updater',
54
+            ),
55
+            'links'	=> array(
56
+                'update',
57
+                'backup_management',
58
+                'upgrade_wizard',
59
+                'moduleBuilder',
60
+            ),
61
+        ),
62
+        'upgradewizard' => array(
63
+                'actions' => array(
64
+                    'index',
65
+                ),
66
+        ),
67
+        'modulebuilder' => array(
68
+                'actions' => array(
69
+                    'index' => array('params' => array('type' => array('mb'))),
70
+                ),
71
+        ),
72
+    )
73 73
 );
74 74
 ?>
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
include/javascript/getYUIComboFile.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 
43 43
 $yui_path = array(
44 44
     "2.9.0" => "include/javascript/yui",
45
-	"2_9_0" => "include/javascript/yui",
46
-	"3.3.0" => "include/javascript/yui3",
47
-	"3_3_0" => "include/javascript/yui3"
45
+    "2_9_0" => "include/javascript/yui",
46
+    "3.3.0" => "include/javascript/yui3",
47
+    "3_3_0" => "include/javascript/yui3"
48 48
 );
49 49
 $types = array(
50 50
     "js" => "application/javascript",
51
-	"css" => "text/css",
51
+    "css" => "text/css",
52 52
 );
53 53
 $out = "";
54 54
 
@@ -57,36 +57,36 @@  discard block
 block discarded – undo
57 57
 
58 58
 foreach ($_REQUEST as $param => $val)
59 59
 {
60
-	//No backtracking in the path
61
-	if (strpos($param, "..") !== false)
60
+    //No backtracking in the path
61
+    if (strpos($param, "..") !== false)
62 62
         continue;
63 63
 
64
-	$version = explode("/", $param);
65
-	$version = $version[0];
64
+    $version = explode("/", $param);
65
+    $version = $version[0];
66 66
     if (empty($yui_path[$version])) continue;
67 67
 
68 68
     $path = $yui_path[$version] . substr($param, strlen($version));
69 69
 
70
-	$extension = substr($path, strrpos($path, "_") + 1);
70
+    $extension = substr($path, strrpos($path, "_") + 1);
71 71
 
72
-	//Only allowed file extensions
73
-	if (empty($types[$extension]))
74
-	   continue;
72
+    //Only allowed file extensions
73
+    if (empty($types[$extension]))
74
+        continue;
75 75
 
76
-	if (empty($contentType))
76
+    if (empty($contentType))
77 77
     {
78 78
         $contentType = $types[$extension];
79 79
     }
80
-	//Put together the final filepath
81
-	$path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
82
-	$contents = '';
83
-	if (is_file($path)) {
84
-	   $out .= "/*" . $path . "*/\n";
85
-	   $contents =  file_get_contents($path);
86
-	   $out .= $contents . "\n";
87
-	}
88
-	$path = empty($contents) ? $path : $contents;
89
-	$allpath .= md5($path);
80
+    //Put together the final filepath
81
+    $path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
82
+    $contents = '';
83
+    if (is_file($path)) {
84
+        $out .= "/*" . $path . "*/\n";
85
+        $contents =  file_get_contents($path);
86
+        $out .= $contents . "\n";
87
+    }
88
+    $path = empty($contents) ? $path : $contents;
89
+    $allpath .= md5($path);
90 90
 }
91 91
 
92 92
 $etag = '"'.md5($allpath).'"';
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	$version = $version[0];
66 66
     if (empty($yui_path[$version])) continue;
67 67
 
68
-    $path = $yui_path[$version] . substr($param, strlen($version));
68
+    $path = $yui_path[$version].substr($param, strlen($version));
69 69
 
70 70
 	$extension = substr($path, strrpos($path, "_") + 1);
71 71
 
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
         $contentType = $types[$extension];
79 79
     }
80 80
 	//Put together the final filepath
81
-	$path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
81
+	$path = substr($path, 0, strrpos($path, "_")).".".$extension;
82 82
 	$contents = '';
83 83
 	if (is_file($path)) {
84
-	   $out .= "/*" . $path . "*/\n";
85
-	   $contents =  file_get_contents($path);
86
-	   $out .= $contents . "\n";
84
+	   $out .= "/*".$path."*/\n";
85
+	   $contents = file_get_contents($path);
86
+	   $out .= $contents."\n";
87 87
 	}
88 88
 	$path = empty($contents) ? $path : $contents;
89 89
 	$allpath .= md5($path);
@@ -95,6 +95,6 @@  discard block
 block discarded – undo
95 95
 header("Cache-Control: private");
96 96
 header("Pragma: dummy=bogus");
97 97
 header("Etag: $etag");
98
-header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000));
98
+header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000));
99 99
 header("Content-Type: $contentType");
100 100
 echo ($out);
101 101
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 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.
@@ -38,7 +40,9 @@  discard block
 block discarded – undo
38 40
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 41
  ********************************************************************************/
40 42
 
41
-if (empty($_REQUEST)) die();
43
+if (empty($_REQUEST)) {
44
+    die();
45
+}
42 46
 
43 47
 $yui_path = array(
44 48
     "2.9.0" => "include/javascript/yui",
@@ -58,20 +62,24 @@  discard block
 block discarded – undo
58 62
 foreach ($_REQUEST as $param => $val)
59 63
 {
60 64
 	//No backtracking in the path
61
-	if (strpos($param, "..") !== false)
62
-        continue;
65
+	if (strpos($param, "..") !== false) {
66
+	        continue;
67
+	}
63 68
 
64 69
 	$version = explode("/", $param);
65 70
 	$version = $version[0];
66
-    if (empty($yui_path[$version])) continue;
71
+    if (empty($yui_path[$version])) {
72
+        continue;
73
+    }
67 74
 
68 75
     $path = $yui_path[$version] . substr($param, strlen($version));
69 76
 
70 77
 	$extension = substr($path, strrpos($path, "_") + 1);
71 78
 
72 79
 	//Only allowed file extensions
73
-	if (empty($types[$extension]))
74
-	   continue;
80
+	if (empty($types[$extension])) {
81
+		   continue;
82
+	}
75 83
 
76 84
 	if (empty($contentType))
77 85
     {
Please login to merge, or discard this patch.
include/Dashlets/DashletGenericChart.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function setRefreshIcon()
141 141
     {
142
-    	$additionalTitle = '';
142
+        $additionalTitle = '';
143 143
         if($this->isRefreshable)
144 144
 
145 145
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     public function displayScript()
166 166
     {
167 167
 
168
-		require_once('include/SugarCharts/SugarChartFactory.php');
169
-		$sugarChart = SugarChartFactory::getInstance();
170
-		return $sugarChart->getDashletScript($this->id);
168
+        require_once('include/SugarCharts/SugarChartFactory.php');
169
+        $sugarChart = SugarChartFactory::getInstance();
170
+        return $sugarChart->getDashletScript($this->id);
171 171
 
172 172
     }
173 173
 
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
         $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown);
273 273
         
274 274
         if($this->isAutoRefreshable()) {
275
-       		$this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276
-			$this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277
-			$this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278
-			$this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279
-		}
275
+                $this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276
+            $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277
+            $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278
+            $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279
+        }
280 280
 
281 281
         return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
282 282
     }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             $dashletOffset = 0;
340 340
             $module = $_REQUEST['module'];
341 341
             if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
342
-            	$dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
342
+                $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
343 343
             }
344 344
         }
345 345
 
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @see Dashlet::$isRefreshable
61 61
      */
62
-    public $isRefreshable  = true;
62
+    public $isRefreshable = true;
63 63
 
64 64
     /**
65 65
      * location of smarty template file for configuring
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
     {
106 106
         parent::Dashlet($id);
107 107
 
108
-        if ( isset($options) ) {
109
-            foreach ( $options as $key => $value ) {
108
+        if (isset($options)) {
109
+            foreach ($options as $key => $value) {
110 110
                 $this->$key = $value;
111 111
             }
112 112
         }
113 113
 
114 114
         // load searchfields
115 115
         $classname = get_class($this);
116
-        if ( is_file("modules/Charts/Dashlets/$classname/$classname.data.php") ) {
116
+        if (is_file("modules/Charts/Dashlets/$classname/$classname.data.php")) {
117 117
             require("modules/Charts/Dashlets/$classname/$classname.data.php");
118 118
             $this->_searchFields = $dashletData[$classname]['searchFields'];
119 119
         }
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
         // load language files
122 122
         $this->loadLanguage($classname, 'modules/Charts/Dashlets/');
123 123
 
124
-        if ( empty($options['title']) )
124
+        if (empty($options['title']))
125 125
             $this->title = $this->dashletStrings['LBL_TITLE'];
126
-        if ( isset($options['autoRefresh']) )
126
+        if (isset($options['autoRefresh']))
127 127
             $this->autoRefresh = $options['autoRefresh'];
128 128
 
129 129
         $this->layoutManager = new LayoutManager();
130 130
         $this->layoutManager->setAttribute('context', 'Report');
131 131
         // fake a reporter object here just to pass along the db type used in many widgets.
132 132
         // this should be taken out when sugarwidgets change
133
-        $temp = (object) array('db' => &$GLOBALS['db'], 'report_def_str' => '');
133
+        $temp = (object)array('db' => &$GLOBALS['db'], 'report_def_str' => '');
134 134
         $this->layoutManager->setAttributePtr('reporter', $temp);
135 135
     }
136 136
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
     public function setRefreshIcon()
141 141
     {
142 142
     	$additionalTitle = '';
143
-        if($this->isRefreshable)
143
+        if ($this->isRefreshable)
144 144
 
145 145
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
146 146
                 . $this->id
147 147
                 . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->'
148 148
                 . SugarThemeRegistry::current()->getImage(
149 149
                     'dashlet-header-refresh',
150
-                    'border="0" align="absmiddle" title="'. translate('LBL_DASHLET_REFRESH', 'Home') . '"',
150
+                    'border="0" align="absmiddle" title="'.translate('LBL_DASHLET_REFRESH', 'Home').'"',
151 151
                     null,
152 152
                     null,
153 153
                     '.gif',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function getConfigureSmartyInstance()
179 179
     {
180
-        if ( !($this->_configureSS instanceof Sugar_Smarty) ) {
180
+        if (!($this->_configureSS instanceof Sugar_Smarty)) {
181 181
 
182 182
             $this->_configureSS = new Sugar_Smarty();
183 183
         }
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 
201 201
         $options = array();
202 202
 
203
-        foreach($req as $name => $value)
204
-            if(!is_array($value)) $req[$name] = trim($value);
203
+        foreach ($req as $name => $value)
204
+            if (!is_array($value)) $req[$name] = trim($value);
205 205
 
206
-        foreach($this->_searchFields as $name => $params) {
206
+        foreach ($this->_searchFields as $name => $params) {
207 207
             $widgetDef = $params;
208
-            if ( isset($this->getSeedBean()->field_defs[$name]) )
208
+            if (isset($this->getSeedBean()->field_defs[$name]))
209 209
                 $widgetDef = $this->getSeedBean()->field_defs[$name];
210
-            if ( $widgetDef['type'] == 'date')           // special case date types
210
+            if ($widgetDef['type'] == 'date')           // special case date types
211 211
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
212
-            elseif ( $widgetDef['type'] == 'time')       // special case time types
212
+            elseif ($widgetDef['type'] == 'time')       // special case time types
213 213
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
214
-            elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
214
+            elseif ($widgetDef['type'] == 'datepicker') // special case datepicker types
215 215
                 $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
216 216
             elseif (!empty($req[$widgetDef['name']]))
217 217
                 $options[$widgetDef['name']] = $req[$widgetDef['name']];
@@ -234,36 +234,36 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $currentSearchFields = array();
236 236
 
237
-        if ( is_array($this->_searchFields) ) {
238
-            foreach($this->_searchFields as $name=>$params) {
239
-                if(!empty($name)) {
237
+        if (is_array($this->_searchFields)) {
238
+            foreach ($this->_searchFields as $name=>$params) {
239
+                if (!empty($name)) {
240 240
                     $name = strtolower($name);
241 241
                     $currentSearchFields[$name] = array();
242 242
 
243 243
                     $widgetDef = $params;
244
-                    if ( isset($this->getSeedBean()->field_defs[$name]) )
244
+                    if (isset($this->getSeedBean()->field_defs[$name]))
245 245
                         $widgetDef = $this->getSeedBean()->field_defs[$name];
246 246
 
247
-                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
247
+                    if ($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
248 248
 
249
-                    if ( empty($widgetDef['input_name0']) )
249
+                    if (empty($widgetDef['input_name0']))
250 250
                         $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
251 251
                     $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
252
-                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
252
+                    if ($currentSearchFields[$name]['label'] == $widgetDef['vname'])
253 253
                         $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
254 254
                     $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
255 255
                 }
256 256
                 else { // ability to create spacers in input fields
257
-                    $currentSearchFields['blank' + $count]['label'] = '';
258
-                    $currentSearchFields['blank' + $count]['input'] = '';
257
+                    $currentSearchFields['blank' +$count]['label'] = '';
258
+                    $currentSearchFields['blank' +$count]['input'] = '';
259 259
                     $count++;
260 260
                 }
261 261
             }
262 262
         }
263 263
         $this->currentSearchFields = $currentSearchFields;
264
-        $this->getConfigureSmartyInstance()->assign('title',translate('LBL_TITLE','Charts'));
265
-        $this->getConfigureSmartyInstance()->assign('save',$GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
266
-        $this->getConfigureSmartyInstance()->assign('clear',$GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']);
264
+        $this->getConfigureSmartyInstance()->assign('title', translate('LBL_TITLE', 'Charts'));
265
+        $this->getConfigureSmartyInstance()->assign('save', $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
266
+        $this->getConfigureSmartyInstance()->assign('clear', $GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']);
267 267
         $this->getConfigureSmartyInstance()->assign('id', $this->id);
268 268
         $this->getConfigureSmartyInstance()->assign('searchFields', $this->currentSearchFields);
269 269
         $this->getConfigureSmartyInstance()->assign('dashletTitle', $this->title);
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
         $this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']);
272 272
         $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown);
273 273
         
274
-        if($this->isAutoRefreshable()) {
274
+        if ($this->isAutoRefreshable()) {
275 275
        		$this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276 276
 			$this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277 277
 			$this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278 278
 			$this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279 279
 		}
280 280
 
281
-        return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
281
+        return parent::displayOptions().$this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
282 282
     }
283 283
 
284 284
     /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     protected function getSeedBean()
291 291
     {
292
-        if ( !($this->_seedBean instanceof SugarBean) )
292
+        if (!($this->_seedBean instanceof SugarBean))
293 293
             $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
294 294
 
295 295
         return $this->_seedBean;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function display()
324 324
     {
325
-        return parent::display() . $this->processAutoRefresh();
325
+        return parent::display().$this->processAutoRefresh();
326 326
     }
327 327
 
328 328
     /**
@@ -335,28 +335,28 @@  discard block
 block discarded – undo
335 335
     {
336 336
         global $sugar_config;
337 337
 
338
-        if ( empty($dashletOffset) ) {
338
+        if (empty($dashletOffset)) {
339 339
             $dashletOffset = 0;
340 340
             $module = $_REQUEST['module'];
341
-            if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
341
+            if (isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
342 342
             	$dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
343 343
             }
344 344
         }
345 345
 
346
-        if ( !$this->isRefreshable ) {
346
+        if (!$this->isRefreshable) {
347 347
             return '';
348 348
         }
349
-        if ( !empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1 ) {
349
+        if (!empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1) {
350 350
             return '';
351 351
         }
352 352
         $autoRefreshSS = new Sugar_Smarty();
353 353
         $autoRefreshSS->assign('dashletOffset', $dashletOffset);
354 354
         $autoRefreshSS->assign('dashletId', $this->id);
355
-        $autoRefreshSS->assign('strippedDashletId', str_replace("-","",$this->id)); //javascript doesn't like "-" in function names
355
+        $autoRefreshSS->assign('strippedDashletId', str_replace("-", "", $this->id)); //javascript doesn't like "-" in function names
356 356
         $autoRefreshSS->assign('dashletRefreshInterval', $this->getAutoRefresh());
357 357
         $autoRefreshSS->assign('url', "predefined_chart");
358 358
         $tpl = 'include/Dashlets/DashletGenericAutoRefresh.tpl';
359
-        if ( $_REQUEST['action'] == "DynamicAction" ) {
359
+        if ($_REQUEST['action'] == "DynamicAction") {
360 360
             $tpl = 'include/Dashlets/DashletGenericAutoRefreshDynamic.tpl';
361 361
         }
362 362
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
         $row = $db->fetchByAssoc($result);
374 374
 
375
-        while ($row != null){
375
+        while ($row != null) {
376 376
             $dataSet[] = $row;
377 377
             $row = $db->fetchByAssoc($result);
378 378
         }
@@ -392,19 +392,19 @@  discard block
 block discarded – undo
392 392
     bool $ifsort2                 Whether to sort by the second column or just translate the second column.
393 393
      * @return        The sorted and translated data.
394 394
      */
395
-    function sortData($data_set, $keycolname1=null, $translate1=false, $keycolname2=null, $translate2=false, $ifsort2=false) {
395
+    function sortData($data_set, $keycolname1 = null, $translate1 = false, $keycolname2 = null, $translate2 = false, $ifsort2 = false) {
396 396
         //You can set whether the columns need to be translated or sorted. It the column needn't to be translated, the sorting must be done in SQL, this function will not do the sorting.
397 397
         global $app_list_strings;
398 398
         $sortby1[] = array();
399 399
         foreach ($data_set as $row) {
400
-            $sortby1[]  = $row[$keycolname1];
400
+            $sortby1[] = $row[$keycolname1];
401 401
         }
402 402
         $sortby1 = array_unique($sortby1);
403 403
         //The data is from the database, the sorting should be done in the sql. So I will not do the sort here.
404
-        if($translate1) {
404
+        if ($translate1) {
405 405
             $temp_sortby1 = array();
406
-            foreach(array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) {
407
-                if(in_array($sortby1_value, $sortby1)) {
406
+            foreach (array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) {
407
+                if (in_array($sortby1_value, $sortby1)) {
408 408
                     $temp_sortby1[] = $sortby1_value;
409 409
                 }
410 410
             }
@@ -412,21 +412,21 @@  discard block
 block discarded – undo
412 412
         }
413 413
 
414 414
         //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank.
415
-        if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank.
415
+        if (isset($sortby1[0]) && $sortby1[0] == array()) unset($sortby1[0]); //the beginning of month after search is blank.
416 416
 
417
-        if($ifsort2==false) $sortby2=array(0);
417
+        if ($ifsort2 == false) $sortby2 = array(0);
418 418
 
419
-        if($keycolname2!=null) {
419
+        if ($keycolname2 != null) {
420 420
             $sortby2 = array();
421 421
             foreach ($data_set as $row) {
422
-                $sortby2[]  = $row[$keycolname2];
422
+                $sortby2[] = $row[$keycolname2];
423 423
             }
424 424
             //The data is from the database, the sorting should be done in the sql. So I will not do the sort here.
425 425
             $sortby2 = array_unique($sortby2);
426
-            if($translate2) {
426
+            if ($translate2) {
427 427
                 $temp_sortby2 = array();
428
-                foreach(array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) {
429
-                    if(in_array($sortby2_value, $sortby2)) {
428
+                foreach (array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) {
429
+                    if (in_array($sortby2_value, $sortby2)) {
430 430
                         $temp_sortby2[] = $sortby2_value;
431 431
                     }
432 432
                 }
@@ -434,42 +434,42 @@  discard block
 block discarded – undo
434 434
             }
435 435
         }
436 436
 
437
-        $data=array();
437
+        $data = array();
438 438
 
439
-        foreach($sortby1 as $sort1) {
440
-            foreach($sortby2 as $sort2) {
441
-                if($ifsort2) $a=0;
442
-                foreach($data_set as $key => $value){
443
-                    if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) {
444
-                        if($translate1) {
439
+        foreach ($sortby1 as $sort1) {
440
+            foreach ($sortby2 as $sort2) {
441
+                if ($ifsort2) $a = 0;
442
+                foreach ($data_set as $key => $value) {
443
+                    if ($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2] == $sort2)) {
444
+                        if ($translate1) {
445 445
                             $value[$keycolname1.'_dom_option'] = $value[$keycolname1];
446 446
                             $value[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$value[$keycolname1]];
447 447
                         }
448
-                        if($translate2) {
448
+                        if ($translate2) {
449 449
                             $value[$keycolname2.'_dom_option'] = $value[$keycolname2];
450 450
                             $value[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$value[$keycolname2]];
451 451
                         }
452 452
                         array_push($data, $value);
453 453
                         unset($data_set[$key]);
454
-                        $a=1;
454
+                        $a = 1;
455 455
                     }
456 456
                 }
457
-                if($ifsort2 && $a==0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0.
458
-                    $val=array();
457
+                if ($ifsort2 && $a == 0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0.
458
+                    $val = array();
459 459
                     $val['total'] = 0;
460 460
                     $val['count'] = 0;
461
-                    if($translate1) {
461
+                    if ($translate1) {
462 462
                         $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1];
463 463
                         $val[$keycolname1.'_dom_option'] = $sort1;
464 464
                     }
465 465
                     else {
466 466
                         $val[$keycolname1] = $sort1;
467 467
                     }
468
-                    if($translate2) {
468
+                    if ($translate2) {
469 469
                         $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2];
470 470
                         $val[$keycolname2.'_dom_option'] = $sort2;
471 471
                     }
472
-                    elseif($keycolname2!=null) {
472
+                    elseif ($keycolname2 != null) {
473 473
                         $val[$keycolname2] = $sort2;
474 474
                     }
475 475
                     array_push($data, $val);
Please login to merge, or discard this patch.
Braces   +59 added lines, -36 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.
@@ -121,10 +123,12 @@  discard block
 block discarded – undo
121 123
         // load language files
122 124
         $this->loadLanguage($classname, 'modules/Charts/Dashlets/');
123 125
 
124
-        if ( empty($options['title']) )
125
-            $this->title = $this->dashletStrings['LBL_TITLE'];
126
-        if ( isset($options['autoRefresh']) )
127
-            $this->autoRefresh = $options['autoRefresh'];
126
+        if ( empty($options['title']) ) {
127
+                    $this->title = $this->dashletStrings['LBL_TITLE'];
128
+        }
129
+        if ( isset($options['autoRefresh']) ) {
130
+                    $this->autoRefresh = $options['autoRefresh'];
131
+        }
128 132
 
129 133
         $this->layoutManager = new LayoutManager();
130 134
         $this->layoutManager->setAttribute('context', 'Report');
@@ -140,8 +144,8 @@  discard block
 block discarded – undo
140 144
     public function setRefreshIcon()
141 145
     {
142 146
     	$additionalTitle = '';
143
-        if($this->isRefreshable)
144
-
147
+        if($this->isRefreshable) {
148
+        
145 149
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
146 150
                 . $this->id
147 151
                 . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->'
@@ -154,6 +158,7 @@  discard block
 block discarded – undo
154 158
                     translate('LBL_DASHLET_REFRESH', 'Home')
155 159
                 )
156 160
                 . '</a>';
161
+        }
157 162
         return $additionalTitle;
158 163
     }
159 164
 
@@ -200,25 +205,32 @@  discard block
 block discarded – undo
200 205
 
201 206
         $options = array();
202 207
 
203
-        foreach($req as $name => $value)
204
-            if(!is_array($value)) $req[$name] = trim($value);
208
+        foreach($req as $name => $value) {
209
+                    if(!is_array($value)) $req[$name] = trim($value);
210
+        }
205 211
 
206 212
         foreach($this->_searchFields as $name => $params) {
207 213
             $widgetDef = $params;
208
-            if ( isset($this->getSeedBean()->field_defs[$name]) )
209
-                $widgetDef = $this->getSeedBean()->field_defs[$name];
210
-            if ( $widgetDef['type'] == 'date')           // special case date types
214
+            if ( isset($this->getSeedBean()->field_defs[$name]) ) {
215
+                            $widgetDef = $this->getSeedBean()->field_defs[$name];
216
+            }
217
+            if ( $widgetDef['type'] == 'date') {
218
+                // special case date types
211 219
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
212
-            elseif ( $widgetDef['type'] == 'time')       // special case time types
220
+            } elseif ( $widgetDef['type'] == 'time') {
221
+                // special case time types
213 222
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
214
-            elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
223
+            } elseif ( $widgetDef['type'] == 'datepicker') {
224
+                // special case datepicker types
215 225
                 $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
216
-            elseif (!empty($req[$widgetDef['name']]))
217
-                $options[$widgetDef['name']] = $req[$widgetDef['name']];
226
+            } elseif (!empty($req[$widgetDef['name']])) {
227
+                            $options[$widgetDef['name']] = $req[$widgetDef['name']];
228
+            }
218 229
         }
219 230
 
220
-        if (!empty($req['dashletTitle']))
221
-            $options['title'] = $req['dashletTitle'];
231
+        if (!empty($req['dashletTitle'])) {
232
+                    $options['title'] = $req['dashletTitle'];
233
+        }
222 234
 
223 235
         $options['autoRefresh'] = empty($req['autoRefresh']) ? '0' : $req['autoRefresh'];
224 236
 
@@ -241,19 +253,24 @@  discard block
 block discarded – undo
241 253
                     $currentSearchFields[$name] = array();
242 254
 
243 255
                     $widgetDef = $params;
244
-                    if ( isset($this->getSeedBean()->field_defs[$name]) )
245
-                        $widgetDef = $this->getSeedBean()->field_defs[$name];
256
+                    if ( isset($this->getSeedBean()->field_defs[$name]) ) {
257
+                                            $widgetDef = $this->getSeedBean()->field_defs[$name];
258
+                    }
246 259
 
247
-                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
260
+                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') {
261
+                        $widgetDef['remove_blank'] = true;
262
+                    }
263
+                    // remove the blank option for the dropdown
248 264
 
249
-                    if ( empty($widgetDef['input_name0']) )
250
-                        $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
265
+                    if ( empty($widgetDef['input_name0']) ) {
266
+                                            $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
267
+                    }
251 268
                     $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
252
-                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
253
-                        $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
269
+                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) {
270
+                                            $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
271
+                    }
254 272
                     $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
255
-                }
256
-                else { // ability to create spacers in input fields
273
+                } else { // ability to create spacers in input fields
257 274
                     $currentSearchFields['blank' + $count]['label'] = '';
258 275
                     $currentSearchFields['blank' + $count]['input'] = '';
259 276
                     $count++;
@@ -289,8 +306,9 @@  discard block
 block discarded – undo
289 306
      */
290 307
     protected function getSeedBean()
291 308
     {
292
-        if ( !($this->_seedBean instanceof SugarBean) )
293
-            $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
309
+        if ( !($this->_seedBean instanceof SugarBean) ) {
310
+                    $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
311
+        }
294 312
 
295 313
         return $this->_seedBean;
296 314
     }
@@ -412,9 +430,14 @@  discard block
 block discarded – undo
412 430
         }
413 431
 
414 432
         //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank.
415
-        if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank.
433
+        if(isset($sortby1[0]) && $sortby1[0]==array()) {
434
+            unset($sortby1[0]);
435
+        }
436
+        //the beginning of month after search is blank.
416 437
 
417
-        if($ifsort2==false) $sortby2=array(0);
438
+        if($ifsort2==false) {
439
+            $sortby2=array(0);
440
+        }
418 441
 
419 442
         if($keycolname2!=null) {
420 443
             $sortby2 = array();
@@ -438,7 +461,9 @@  discard block
 block discarded – undo
438 461
 
439 462
         foreach($sortby1 as $sort1) {
440 463
             foreach($sortby2 as $sort2) {
441
-                if($ifsort2) $a=0;
464
+                if($ifsort2) {
465
+                    $a=0;
466
+                }
442 467
                 foreach($data_set as $key => $value){
443 468
                     if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) {
444 469
                         if($translate1) {
@@ -461,15 +486,13 @@  discard block
 block discarded – undo
461 486
                     if($translate1) {
462 487
                         $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1];
463 488
                         $val[$keycolname1.'_dom_option'] = $sort1;
464
-                    }
465
-                    else {
489
+                    } else {
466 490
                         $val[$keycolname1] = $sort1;
467 491
                     }
468 492
                     if($translate2) {
469 493
                         $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2];
470 494
                         $val[$keycolname2.'_dom_option'] = $sort2;
471
-                    }
472
-                    elseif($keycolname2!=null) {
495
+                    } elseif($keycolname2!=null) {
473 496
                         $val[$keycolname2] = $sort2;
474 497
                     }
475 498
                     array_push($data, $val);
Please login to merge, or discard this patch.
include/Dashlets/DashletCacheBuilder.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
         $cacheDir = create_cache_directory('dashlets/');
65 65
         $allDashlets = array_merge($dashletFiles, $dashletFilesCustom);
66 66
         $dashletFiles = array();
67
-        foreach($allDashlets as $num => $file) {
68
-            if(substr_count($file, '.meta') == 0) { // ignore meta data files
67
+        foreach ($allDashlets as $num => $file) {
68
+            if (substr_count($file, '.meta') == 0) { // ignore meta data files
69 69
                 $class = substr($file, strrpos($file, '/') + 1, -4);
70 70
                 $dashletFiles[$class] = array();
71 71
                 $dashletFiles[$class]['file'] = $file;
72 72
                 $dashletFiles[$class]['class'] = $class;
73
-                if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
73
+                if (is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
74 74
                     $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
75 75
                     require($dashletFiles[$class]['meta']);
76
-                    if ( isset($dashletMeta[$class]['module']) )
76
+                    if (isset($dashletMeta[$class]['module']))
77 77
                         $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
78 78
                 }
79 79
                 
80 80
                 $filesInDirectory = array();
81 81
                 getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\/Dashlets\/[^\.]*\.icon\.(jpg|jpeg|gif|png)$/i');
82
-                if(!empty($filesInDirectory)) {
82
+                if (!empty($filesInDirectory)) {
83 83
                     $dashletFiles[$class]['icon'] = $filesInDirectory[0]; // take the first icon we see
84 84
                 }
85 85
             }
86 86
         }
87 87
         
88
-        write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php');
88
+        write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir.'dashlets.php');
89 89
     }
90 90
 }
91 91
 ?>
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 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.
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
                 if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
74 76
                     $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
75 77
                     require($dashletFiles[$class]['meta']);
76
-                    if ( isset($dashletMeta[$class]['module']) )
77
-                        $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
78
+                    if ( isset($dashletMeta[$class]['module']) ) {
79
+                                            $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
80
+                    }
78 81
                 }
79 82
                 
80 83
                 $filesInDirectory = array();
Please login to merge, or discard this patch.
include/Dashlets/DashletRssFeedTitle.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -43,79 +43,79 @@
 block discarded – undo
43 43
  * Created: Sep 12, 2011
44 44
  */
45 45
 class DashletRssFeedTitle {
46
-	public $defaultEncoding = "UTF-8";
47
-	public $readBytes = 8192;
48
-	public $url;
49
-	public $cut = 70;
50
-	public $contents = "";
51
-	public $title = "";
52
-	public $endWith = "...";
53
-	public $xmlEncoding = false;
54
-	public $fileOpen = false;
46
+    public $defaultEncoding = "UTF-8";
47
+    public $readBytes = 8192;
48
+    public $url;
49
+    public $cut = 70;
50
+    public $contents = "";
51
+    public $title = "";
52
+    public $endWith = "...";
53
+    public $xmlEncoding = false;
54
+    public $fileOpen = false;
55 55
 
56
-	public function __construct($url) {
57
-		$this->url = $url;
58
-	}
56
+    public function __construct($url) {
57
+        $this->url = $url;
58
+    }
59 59
 
60
-	public function generateTitle() {
61
-		if ($this->readFeed()) {
62
-			$this->getTitle();
63
-			if (!empty($this->title)) {
64
-				$this->convertEncoding();
65
-				$this->cutLength();
66
-			}
67
-		}
68
-		return $this->title;
69
-	}
60
+    public function generateTitle() {
61
+        if ($this->readFeed()) {
62
+            $this->getTitle();
63
+            if (!empty($this->title)) {
64
+                $this->convertEncoding();
65
+                $this->cutLength();
66
+            }
67
+        }
68
+        return $this->title;
69
+    }
70 70
 
71
-	/**
72
-	 * @todo use curl with waiting timeout instead of fopen
73
-	 */
74
-	public function readFeed() {
75
-		if ($this->url) {
71
+    /**
72
+     * @todo use curl with waiting timeout instead of fopen
73
+     */
74
+    public function readFeed() {
75
+        if ($this->url) {
76 76
                     if (!in_array(strtolower(parse_url($this->url, PHP_URL_SCHEME)), array("http", "https"), true)) {
77 77
                         return false;
78 78
                     }
79
-			$fileOpen = @fopen($this->url, 'r');
80
-			if ($fileOpen) {
81
-				$this->fileOpen = true;
82
-				$this->contents = fread($fileOpen, $this->readBytes);
83
-				fclose($fileOpen);
84
-				return true;
85
-			}
86
-		}
87
-		return false;
88
-	}
79
+            $fileOpen = @fopen($this->url, 'r');
80
+            if ($fileOpen) {
81
+                $this->fileOpen = true;
82
+                $this->contents = fread($fileOpen, $this->readBytes);
83
+                fclose($fileOpen);
84
+                return true;
85
+            }
86
+        }
87
+        return false;
88
+    }
89 89
 
90
-	/**
91
-	 *
92
-	 */
93
-	public function getTitle() {
94
-		$matches = array ();
95
-		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96
-		if (isset($matches[0])) {
97
-			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
98
-		}
99
-	}
90
+    /**
91
+     *
92
+     */
93
+    public function getTitle() {
94
+        $matches = array ();
95
+        preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96
+        if (isset($matches[0])) {
97
+            $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
98
+        }
99
+    }
100 100
 
101
-	public function cutLength() {
102
-		if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
-			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
104
-		}
105
-	}
101
+    public function cutLength() {
102
+        if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
+            $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
104
+        }
105
+    }
106 106
 
107
-	private function _identifyXmlEncoding() {
108
-		$matches = array ();
109
-		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110
-		if (isset($matches[0])) {
111
-			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
112
-		}
113
-	}
107
+    private function _identifyXmlEncoding() {
108
+        $matches = array ();
109
+        preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110
+        if (isset($matches[0])) {
111
+            $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
112
+        }
113
+    }
114 114
 
115
-	public function convertEncoding() {
116
-		$this->_identifyXmlEncoding();
117
-		if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) {
118
-			$this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title);
119
-		}
120
-	}
115
+    public function convertEncoding() {
116
+        $this->_identifyXmlEncoding();
117
+        if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) {
118
+            $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title);
119
+        }
120
+    }
121 121
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 */
93 93
 	public function getTitle() {
94
-		$matches = array ();
94
+		$matches = array();
95 95
 		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96 96
 		if (isset($matches[0])) {
97 97
 			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public function cutLength() {
102 102
 		if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
-			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
103
+			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding).$this->endWith;
104 104
 		}
105 105
 	}
106 106
 
107 107
 	private function _identifyXmlEncoding() {
108
-		$matches = array ();
108
+		$matches = array();
109 109
 		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110 110
 		if (isset($matches[0])) {
111 111
 			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
Please login to merge, or discard this patch.