Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
include/database/DBManagerFactory.php 1 patch
Spacing   +30 added lines, -30 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.
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
     {
70 70
         global $sugar_config;
71 71
 
72
-        if(empty($config['db_manager'])) {
72
+        if (empty($config['db_manager'])) {
73 73
             // standard types
74
-            switch($type) {
74
+            switch ($type) {
75 75
                 case "mysql":
76 76
                     if (empty($sugar_config['mysqli_disabled']) && function_exists('mysqli_connect')) {
77 77
                         $my_db_manager = 'MysqliManager';
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
                     }
81 81
                     break;
82 82
                 case "mssql":
83
-                  	if ( function_exists('sqlsrv_connect')
84
-                                && (empty($config['db_mssql_force_driver']) || $config['db_mssql_force_driver'] == 'sqlsrv' )) {
83
+                  	if (function_exists('sqlsrv_connect')
84
+                                && (empty($config['db_mssql_force_driver']) || $config['db_mssql_force_driver'] == 'sqlsrv')) {
85 85
                         $my_db_manager = 'SqlsrvManager';
86 86
                     } elseif (self::isFreeTDS()
87
-                                && (empty($config['db_mssql_force_driver']) || $config['db_mssql_force_driver'] == 'freetds' )) {
87
+                                && (empty($config['db_mssql_force_driver']) || $config['db_mssql_force_driver'] == 'freetds')) {
88 88
                         $my_db_manager = 'FreeTDSManager';
89 89
                     } else {
90 90
                         $my_db_manager = 'MssqlManager';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                     break;
93 93
                 default:
94 94
                     $my_db_manager = self::getManagerByType($type, false);
95
-                    if(empty($my_db_manager)) {
95
+                    if (empty($my_db_manager)) {
96 96
                         $GLOBALS['log']->fatal("unable to load DB manager for: $type");
97 97
                         sugar_die("Cannot load DB manager");
98 98
                     }
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
         // sanitize the name
105 105
         $my_db_manager = preg_replace("/[^A-Za-z0-9_-]/", "", $my_db_manager);
106 106
 
107
-        if(!empty($config['db_manager_class'])){
107
+        if (!empty($config['db_manager_class'])) {
108 108
             $my_db_manager = $config['db_manager_class'];
109 109
         } else {
110
-            if(file_exists("custom/include/database/{$my_db_manager}.php")) {
110
+            if (file_exists("custom/include/database/{$my_db_manager}.php")) {
111 111
                 require_once("custom/include/database/{$my_db_manager}.php");
112 112
             } else {
113 113
                 require_once("include/database/{$my_db_manager}.php");
114 114
             }
115 115
         }
116 116
 
117
-        if(class_exists($my_db_manager)) {
117
+        if (class_exists($my_db_manager)) {
118 118
             return new $my_db_manager();
119 119
         } else {
120 120
             return null;
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
         static $count = 0, $old_count = 0;
135 135
 
136 136
         //fall back to the default instance name
137
-        if(empty($sugar_config['db'][$instanceName])){
137
+        if (empty($sugar_config['db'][$instanceName])) {
138 138
         	$instanceName = '';
139 139
         }
140
-        if(!isset(self::$instances[$instanceName])){
140
+        if (!isset(self::$instances[$instanceName])) {
141 141
             $config = $sugar_config['dbconfig'];
142 142
             $count++;
143 143
                 self::$instances[$instanceName] = self::getTypeInstance($config['db_type'], $config);
144
-                if(!empty($sugar_config['dbconfigoption'])) {
144
+                if (!empty($sugar_config['dbconfigoption'])) {
145 145
                     self::$instances[$instanceName]->setOptions($sugar_config['dbconfigoption']);
146 146
                 }
147 147
                 self::$instances[$instanceName]->connect($config, true);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public static function disconnectAll()
161 161
     {
162
-        foreach(self::$instances as $instance) {
162
+        foreach (self::$instances as $instance) {
163 163
             $instance->disconnect();
164 164
         }
165 165
         self::$instances = array();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public static function getManagerByType($type, $validate = true)
178 178
     {
179 179
         $drivers = self::getDbDrivers($validate);
180
-        if(!empty($drivers[$type])) {
180
+        if (!empty($drivers[$type])) {
181 181
             return get_class($drivers[$type]);
182 182
         }
183 183
         return false;
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
      */
192 192
     protected static function scanDriverDir($dir, &$drivers, $validate = true)
193 193
     {
194
-        if(!is_dir($dir)) return;
194
+        if (!is_dir($dir)) return;
195 195
         $scandir = opendir($dir);
196
-        if($scandir === false) return;
197
-        while(($name = readdir($scandir)) !== false) {
198
-            if(substr($name, -11) != "Manager.php") continue;
199
-            if($name == "DBManager.php") continue;
196
+        if ($scandir === false) return;
197
+        while (($name = readdir($scandir)) !== false) {
198
+            if (substr($name, -11) != "Manager.php") continue;
199
+            if ($name == "DBManager.php") continue;
200 200
             require_once("$dir/$name");
201 201
             $classname = substr($name, 0, -4);
202
-            if(!class_exists($classname)) continue;
202
+            if (!class_exists($classname)) continue;
203 203
             $driver = new $classname;
204
-            if(!$validate || $driver->valid()) {
205
-                if(empty($drivers[$driver->dbType])) {
206
-                    $drivers[$driver->dbType]  = array();
204
+            if (!$validate || $driver->valid()) {
205
+                if (empty($drivers[$driver->dbType])) {
206
+                    $drivers[$driver->dbType] = array();
207 207
                 }
208 208
                 $drivers[$driver->dbType][] = $driver;
209 209
             }
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
         self::scanDriverDir("custom/include/database", $drivers, $validate);
236 236
 
237 237
         $result = array();
238
-        foreach($drivers as $type => $tdrivers) {
239
-            if(empty($tdrivers)) continue;
240
-            if(count($tdrivers) > 1) {
238
+        foreach ($drivers as $type => $tdrivers) {
239
+            if (empty($tdrivers)) continue;
240
+            if (count($tdrivers) > 1) {
241 241
                 usort($tdrivers, array(__CLASS__, "_compareDrivers"));
242 242
             }
243 243
             $result[$type] = $tdrivers[0];
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
     {
256 256
         static $is_freetds = null;
257 257
 
258
-        if($is_freetds === null) {
258
+        if ($is_freetds === null) {
259 259
     		ob_start();
260 260
     		phpinfo(INFO_MODULES);
261
-    		$info=ob_get_contents();
261
+    		$info = ob_get_contents();
262 262
     		ob_end_clean();
263 263
 
264
-    		$is_freetds = (strpos($info,'FreeTDS') !== false);
264
+    		$is_freetds = (strpos($info, 'FreeTDS') !== false);
265 265
         }
266 266
 
267 267
         return $is_freetds;
Please login to merge, or discard this patch.
include/connectors/ConnectorFactory.php 1 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.
include/MVC/Controller/ControllerFactory.php 1 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.
include/MVC/Controller/action_view_map.php 1 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/javascript/getYUIComboFile.php 1 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.
include/Dashlets/DashletCacheBuilder.php 1 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.
@@ -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.
include/Dashlets/DashletRssFeedTitle.php 1 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.
include/Smarty/plugins/function.sugar_number_format.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@
 block discarded – undo
37 37
 function smarty_function_sugar_number_format($params, &$smarty) {
38 38
     global $locale;
39 39
     
40
-	if(!isset($params['var']) || $params['var'] === '') {  
40
+	if (!isset($params['var']) || $params['var'] === '') {  
41 41
         return '';
42 42
     } 
43 43
 
44
-    if ( !isset($params['precision']) ) {
44
+    if (!isset($params['precision'])) {
45 45
         $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits');
46 46
     }
47 47
 
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.wordwrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
  * @param boolean
22 22
  * @return string
23 23
  */
24
-function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
24
+function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false)
25 25
 {
26
-    return wordwrap($string,$length,$break,$cut);
26
+    return wordwrap($string, $length, $break, $cut);
27 27
 }
28 28
 
29 29
 ?>
Please login to merge, or discard this patch.