Passed
Push — scrutinizer-code-quality ( eedb15...27193c )
by Adam
54:15 queued 15s
created
include/database/DBManagerFactory.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                     }
81 81
                     break;
82 82
                 case "mssql":
83
-                  	if ( function_exists('sqlsrv_connect')
83
+                      if ( function_exists('sqlsrv_connect')
84 84
                                 && (empty($config['db_mssql_force_driver']) || $config['db_mssql_force_driver'] == 'sqlsrv' )) {
85 85
                         $my_db_manager = 'SqlsrvManager';
86 86
                     } elseif (self::isFreeTDS()
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
     }
123 123
 
124 124
     /**
125
-	 * Returns a reference to the DB object for instance $instanceName, or the default
125
+     * Returns a reference to the DB object for instance $instanceName, or the default
126 126
      * instance if one is not specified
127 127
      *
128 128
      * @param  string $instanceName optional, name of the instance
129 129
      * @return object DBManager instance
130 130
      */
131
-	public static function getInstance($instanceName = '')
131
+    public static function getInstance($instanceName = '')
132 132
     {
133 133
         global $sugar_config;
134 134
         static $count = 0, $old_count = 0;
135 135
 
136 136
         //fall back to the default instance name
137 137
         if(empty($sugar_config['db'][$instanceName])){
138
-        	$instanceName = '';
138
+            $instanceName = '';
139 139
         }
140 140
         if(!isset(self::$instances[$instanceName])){
141 141
             $config = $sugar_config['dbconfig'];
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     /**
249 249
      * Check if we have freeTDS driver installed
250 250
      * Invoked when connected to mssql. checks if we have freetds version of mssql library.
251
-	 * the response is put into a global variable.
251
+     * the response is put into a global variable.
252 252
      * @return bool
253 253
      */
254 254
     public static function isFreeTDS()
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
         static $is_freetds = null;
257 257
 
258 258
         if($is_freetds === null) {
259
-    		ob_start();
260
-    		phpinfo(INFO_MODULES);
261
-    		$info=ob_get_contents();
262
-    		ob_end_clean();
259
+            ob_start();
260
+            phpinfo(INFO_MODULES);
261
+            $info=ob_get_contents();
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;
268
-     }
268
+        }
269 269
 }
270 270
\ No newline at end of file
Please login to merge, or discard this patch.
include/utils/sugar_file_utils.php 1 patch
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -54,44 +54,44 @@  discard block
 block discarded – undo
54 54
  * @return boolean - Returns true on success false on failure
55 55
  */
56 56
 function sugar_mkdir($pathname, $mode=null, $recursive=false, $context='') {
57
-	$mode = get_mode('dir_mode', $mode);
58
-
59
-	if ( sugar_is_dir($pathname,$mode) )
60
-	    return true;
61
-
62
-	$result = false;
63
-	if(empty($mode))
64
-		$mode = 0777;
65
-	if(empty($context)) {
66
-		$result = @mkdir($pathname, $mode, $recursive);
67
-	} else {
68
-		$result = @mkdir($pathname, $mode, $recursive, $context);
69
-	}
70
-
71
-	if($result){
72
-		if(!sugar_chmod($pathname, $mode)){
73
-			return false;
74
-		}
75
-		if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){
76
-			if(!sugar_chown($pathname)){
77
-				return false;
78
-			}
79
-		}
80
-		if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){
81
-   			if(!sugar_chgrp($pathname)) {
82
-   				return false;
83
-   			}
84
-		}
85
-	}
86
-	else {
87
-		$errorMessage = "Cannot create directory $pathname cannot be touched";
88
-		if(is_null($GLOBALS['log'])) {
89
-			throw new Exception("Error occurred but the system doesn't have logger. Error message: \"$errorMessage\"");
90
-		}
91
-		$GLOBALS['log']->error($errorMessage);
92
-	}
93
-
94
-	return $result;
57
+    $mode = get_mode('dir_mode', $mode);
58
+
59
+    if ( sugar_is_dir($pathname,$mode) )
60
+        return true;
61
+
62
+    $result = false;
63
+    if(empty($mode))
64
+        $mode = 0777;
65
+    if(empty($context)) {
66
+        $result = @mkdir($pathname, $mode, $recursive);
67
+    } else {
68
+        $result = @mkdir($pathname, $mode, $recursive, $context);
69
+    }
70
+
71
+    if($result){
72
+        if(!sugar_chmod($pathname, $mode)){
73
+            return false;
74
+        }
75
+        if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){
76
+            if(!sugar_chown($pathname)){
77
+                return false;
78
+            }
79
+        }
80
+        if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){
81
+                if(!sugar_chgrp($pathname)) {
82
+                    return false;
83
+                }
84
+        }
85
+    }
86
+    else {
87
+        $errorMessage = "Cannot create directory $pathname cannot be touched";
88
+        if(is_null($GLOBALS['log'])) {
89
+            throw new Exception("Error occurred but the system doesn't have logger. Error message: \"$errorMessage\"");
90
+        }
91
+        $GLOBALS['log']->error($errorMessage);
92
+    }
93
+
94
+    return $result;
95 95
 }
96 96
 
97 97
 /**
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
  * @return boolean - Returns a file pointer on success, false otherwise
110 110
  */
111 111
 function sugar_fopen($filename, $mode, $use_include_path=false, $context=null){
112
-	//check to see if the file exists, if not then use touch to create it.
113
-	if(!file_exists($filename)){
114
-		sugar_touch($filename);
115
-	}
112
+    //check to see if the file exists, if not then use touch to create it.
113
+    if(!file_exists($filename)){
114
+        sugar_touch($filename);
115
+    }
116 116
 
117
-	if(empty($context)) {
117
+    if(empty($context)) {
118 118
 
119
-		return fopen($filename, $mode, $use_include_path);
120
-	} else {
121
-		return fopen($filename, $mode, $use_include_path, $context);
122
-	}
119
+        return fopen($filename, $mode, $use_include_path);
120
+    } else {
121
+        return fopen($filename, $mode, $use_include_path, $context);
122
+    }
123 123
 }
124 124
 
125 125
 /**
@@ -137,23 +137,23 @@  discard block
 block discarded – undo
137 137
  * @return int - Returns the number of bytes written to the file, false otherwise.
138 138
  */
139 139
 function sugar_file_put_contents($filename, $data, $flags=null, $context=null){
140
-	//check to see if the file exists, if not then use touch to create it.
141
-	if(!file_exists($filename)){
142
-		sugar_touch($filename);
143
-	}
144
-
145
-	if ( !is_writable($filename) ) {
146
-	    $GLOBALS['log']->error("File $filename cannot be written to");
147
-	    return false;
148
-	}
149
-
150
-	if(empty($flags)) {
151
-		return file_put_contents($filename, $data);
152
-	} elseif(empty($context)) {
153
-		return file_put_contents($filename, $data, $flags);
154
-	} else{
155
-		return file_put_contents($filename, $data, $flags, $context);
156
-	}
140
+    //check to see if the file exists, if not then use touch to create it.
141
+    if(!file_exists($filename)){
142
+        sugar_touch($filename);
143
+    }
144
+
145
+    if ( !is_writable($filename) ) {
146
+        $GLOBALS['log']->error("File $filename cannot be written to");
147
+        return false;
148
+    }
149
+
150
+    if(empty($flags)) {
151
+        return file_put_contents($filename, $data);
152
+    } elseif(empty($context)) {
153
+        return file_put_contents($filename, $data, $flags);
154
+    } else{
155
+        return file_put_contents($filename, $data, $flags, $context);
156
+    }
157 157
 }
158 158
 
159 159
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
     if(file_exists($filename))
200 200
     {
201
-       return sugar_chmod($filename, 0755);
201
+        return sugar_chmod($filename, 0755);
202 202
     }
203 203
 
204 204
     return false;
@@ -215,21 +215,21 @@  discard block
 block discarded – undo
215 215
  * @return string|boolean - Returns a file data on success, false otherwise
216 216
  */
217 217
 function sugar_file_get_contents($filename, $use_include_path=false, $context=null){
218
-	//check to see if the file exists, if not then use touch to create it.
219
-	if(!file_exists($filename)){
220
-		sugar_touch($filename);
221
-	}
222
-
223
-	if ( !is_readable($filename) ) {
224
-	    $GLOBALS['log']->error("File $filename cannot be read");
225
-	    return false;
226
-	}
227
-
228
-	if(empty($context)) {
229
-		return file_get_contents($filename, $use_include_path);
230
-	} else {
231
-		return file_get_contents($filename, $use_include_path, $context);
232
-	}
218
+    //check to see if the file exists, if not then use touch to create it.
219
+    if(!file_exists($filename)){
220
+        sugar_touch($filename);
221
+    }
222
+
223
+    if ( !is_readable($filename) ) {
224
+        $GLOBALS['log']->error("File $filename cannot be read");
225
+        return false;
226
+    }
227
+
228
+    if(empty($context)) {
229
+        return file_get_contents($filename, $use_include_path);
230
+    } else {
231
+        return file_get_contents($filename, $use_include_path, $context);
232
+    }
233 233
 }
234 234
 
235 235
 /**
@@ -248,31 +248,31 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function sugar_touch($filename, $time=null, $atime=null) {
250 250
 
251
-   $result = false;
252
-
253
-   if(!empty($atime) && !empty($time)) {
254
-   	  $result = @touch($filename, $time, $atime);
255
-   } else if(!empty($time)) {
256
-   	  $result = @touch($filename, $time);
257
-   } else {
258
-   	  $result = @touch($filename);
259
-   }
260
-
261
-   if(!$result) {
262
-       $GLOBALS['log']->error("File $filename cannot be touched");
263
-       return $result;
264
-   }
265
-	if(!empty($GLOBALS['sugar_config']['default_permissions']['file_mode'])){
266
-		sugar_chmod($filename, $GLOBALS['sugar_config']['default_permissions']['file_mode']);
267
-	}
268
-	if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){
269
-		sugar_chown($filename);
270
-	}
271
-	if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){
272
-		sugar_chgrp($filename);
273
-	}
274
-
275
-   return true;
251
+    $result = false;
252
+
253
+    if(!empty($atime) && !empty($time)) {
254
+            $result = @touch($filename, $time, $atime);
255
+    } else if(!empty($time)) {
256
+            $result = @touch($filename, $time);
257
+    } else {
258
+            $result = @touch($filename);
259
+    }
260
+
261
+    if(!$result) {
262
+        $GLOBALS['log']->error("File $filename cannot be touched");
263
+        return $result;
264
+    }
265
+    if(!empty($GLOBALS['sugar_config']['default_permissions']['file_mode'])){
266
+        sugar_chmod($filename, $GLOBALS['sugar_config']['default_permissions']['file_mode']);
267
+    }
268
+    if(!empty($GLOBALS['sugar_config']['default_permissions']['user'])){
269
+        sugar_chown($filename);
270
+    }
271
+    if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){
272
+        sugar_chgrp($filename);
273
+    }
274
+
275
+    return true;
276 276
 }
277 277
 
278 278
 /**
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
 function sugar_chmod($filename, $mode=null) {
288 288
     if ( !is_int($mode) )
289 289
         $mode = (int) $mode;
290
-	if(!is_windows()){
291
-		if(!isset($mode)){
292
-			$mode = get_mode('file_mode', $mode);
293
-		}
290
+    if(!is_windows()){
291
+        if(!isset($mode)){
292
+            $mode = get_mode('file_mode', $mode);
293
+        }
294 294
         if(isset($mode) && $mode > 0){
295
-		   return @chmod($filename, $mode);
296
-		}else{
297
-	    	return false;
298
-		}
299
-	}
300
-	return true;
295
+            return @chmod($filename, $mode);
296
+        }else{
297
+            return false;
298
+        }
299
+    }
300
+    return true;
301 301
 }
302 302
 
303 303
 /**
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
  * @return boolean - Returns TRUE on success or FALSE on failure.
311 311
  */
312 312
 function sugar_chown($filename, $user='') {
313
-	if(!is_windows()){
314
-		if(strlen($user)){
315
-			return chown($filename, $user);
316
-		}else{
317
-			if(strlen($GLOBALS['sugar_config']['default_permissions']['user'])){
318
-				$user = $GLOBALS['sugar_config']['default_permissions']['user'];
319
-				return chown($filename, $user);
320
-			}else{
321
-				return false;
322
-			}
323
-		}
324
-	}
325
-	return true;
313
+    if(!is_windows()){
314
+        if(strlen($user)){
315
+            return chown($filename, $user);
316
+        }else{
317
+            if(strlen($GLOBALS['sugar_config']['default_permissions']['user'])){
318
+                $user = $GLOBALS['sugar_config']['default_permissions']['user'];
319
+                return chown($filename, $user);
320
+            }else{
321
+                return false;
322
+            }
323
+        }
324
+    }
325
+    return true;
326 326
 }
327 327
 
328 328
 /**
@@ -335,19 +335,19 @@  discard block
 block discarded – undo
335 335
  * @return boolean - Returns TRUE on success or FALSE on failure.
336 336
  */
337 337
 function sugar_chgrp($filename, $group='') {
338
-	if(!is_windows()){
339
-		if(!empty($group)){
340
-			return chgrp($filename, $group);
341
-		}else{
342
-			if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){
343
-				$group = $GLOBALS['sugar_config']['default_permissions']['group'];
344
-				return chgrp($filename, $group);
345
-			}else{
346
-				return false;
347
-			}
348
-		}
349
-	}
350
-	return true;
338
+    if(!is_windows()){
339
+        if(!empty($group)){
340
+            return chgrp($filename, $group);
341
+        }else{
342
+            if(!empty($GLOBALS['sugar_config']['default_permissions']['group'])){
343
+                $group = $GLOBALS['sugar_config']['default_permissions']['group'];
344
+                return chgrp($filename, $group);
345
+            }else{
346
+                return false;
347
+            }
348
+        }
349
+    }
350
+    return true;
351 351
 }
352 352
 
353 353
 /**
@@ -361,26 +361,26 @@  discard block
 block discarded – undo
361 361
  * @return int - the mode either found in the config file or passed in via the input parameter
362 362
  */
363 363
 function get_mode($key = 'dir_mode', $mode=null) {
364
-	if ( !is_int($mode) )
364
+    if ( !is_int($mode) )
365 365
         $mode = (int) $mode;
366 366
     if(!class_exists('SugarConfig', true)) {
367
-		require 'include/SugarObjects/SugarConfig.php';
368
-	}
369
-	if(!is_windows()){
370
-		$conf_inst=SugarConfig::getInstance();
371
-		$mode = $conf_inst->get('default_permissions.'.$key, $mode);
372
-	}
373
-	return $mode;
367
+        require 'include/SugarObjects/SugarConfig.php';
368
+    }
369
+    if(!is_windows()){
370
+        $conf_inst=SugarConfig::getInstance();
371
+        $mode = $conf_inst->get('default_permissions.'.$key, $mode);
372
+    }
373
+    return $mode;
374 374
 }
375 375
 
376 376
 function sugar_is_dir($path, $mode='r'){
377
-		if(defined('TEMPLATE_URL'))return is_dir($path, $mode);
378
-		return is_dir($path);
377
+        if(defined('TEMPLATE_URL'))return is_dir($path, $mode);
378
+        return is_dir($path);
379 379
 }
380 380
 
381 381
 function sugar_is_file($path, $mode='r'){
382
-		if(defined('TEMPLATE_URL'))return is_file($path, $mode);
383
-		return is_file($path);
382
+        if(defined('TEMPLATE_URL'))return is_file($path, $mode);
383
+        return is_file($path);
384 384
 }
385 385
 
386 386
 /**
Please login to merge, or discard this patch.
include/TemplateHandler/TemplateHandler.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     var $templateDir = 'modules/';
51 51
     var $ss;
52 52
     function TemplateHandler() {
53
-      $this->cacheDir = sugar_cached('');
53
+        $this->cacheDir = sugar_cached('');
54 54
     }
55 55
 
56 56
     function loadSmarty(){
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
      *
67 67
      */
68 68
     static function clearAll() {
69
-    	global $beanList;
70
-		foreach($beanList as $module_dir =>$object_name){
69
+        global $beanList;
70
+        foreach($beanList as $module_dir =>$object_name){
71 71
                 TemplateHandler::clearCache($module_dir);
72
-		}
72
+        }
73 73
     }
74 74
 
75 75
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                     foreach($panel as $row) {
133 133
                             foreach($row as $entry) {
134 134
                                     if(empty($entry)) {
135
-                                       continue;
135
+                                        continue;
136 136
                                     }
137 137
 
138 138
                                     if(is_array($entry) &&
@@ -140,35 +140,35 @@  discard block
 block discarded – undo
140 140
                                        isset($entry['displayParams']) &&
141 141
                                        isset($entry['displayParams']['required']) &&
142 142
                                        $entry['displayParams']['required']) {
143
-                                       $panelFields[$entry['name']] = $entry;
143
+                                        $panelFields[$entry['name']] = $entry;
144 144
                                     }
145 145
 
146 146
                                     if(is_array($entry)) {
147
-                                      $defs2[$entry['name']] = $entry;
147
+                                        $defs2[$entry['name']] = $entry;
148 148
                                     } else {
149
-                                      $defs2[$entry] = array('name' => $entry);
149
+                                        $defs2[$entry] = array('name' => $entry);
150 150
                                     }
151 151
                             } //foreach
152 152
                     } //foreach
153 153
             } //foreach
154 154
 
155 155
             foreach($panelFields as $field=>$value) {
156
-                      $nameList = array();
157
-                      if(!is_array($value['displayParams']['required'])) {
158
-                         $nameList[] = $field;
159
-                      } else {
160
-                         foreach($value['displayParams']['required'] as $groupedField) {
161
-                                 $nameList[] = $groupedField;
162
-                         }
163
-                      }
164
-
165
-                      foreach($nameList as $x) {
166
-                         if(isset($defs[$x]) &&
156
+                        $nameList = array();
157
+                        if(!is_array($value['displayParams']['required'])) {
158
+                            $nameList[] = $field;
159
+                        } else {
160
+                            foreach($value['displayParams']['required'] as $groupedField) {
161
+                                    $nameList[] = $groupedField;
162
+                            }
163
+                        }
164
+
165
+                        foreach($nameList as $x) {
166
+                            if(isset($defs[$x]) &&
167 167
                             isset($defs[$x]['type']) &&
168 168
                             !isset($defs[$x]['required'])) {
169 169
                             $defs[$x]['required'] = true;
170
-                         }
171
-                      }
170
+                            }
171
+                        }
172 172
             } //foreach
173 173
 
174 174
             //Create a base class with field_name_map property
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
             //5) not already been added to Array
196 196
             foreach($sugarbean->field_name_map as $name=>$def) {
197 197
 
198
-               if($def['type']=='relate' &&
198
+                if($def['type']=='relate' &&
199 199
                   isset($defs2[$name]) &&
200 200
                   (!isset($defs2[$name]['validateDependency']) || $defs2[$name]['validateDependency'] === true) &&
201 201
                   isset($def['id_name']) &&
202 202
                   !in_array($name, $validatedFields)) {
203 203
 
204
-                  if(isset($mod_strings[$def['vname']])
204
+                    if(isset($mod_strings[$def['vname']])
205 205
                         || isset($app_strings[$def['vname']])
206 206
                         || translate($def['vname'],$sugarbean->module_dir) != $def['vname']) {
207
-                     $vname = $def['vname'];
208
-                  }
209
-                  else{
210
-                     $vname = "undefined";
211
-                  }
212
-                  $javascript->addToValidateBinaryDependency($name, 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD').': '.$javascript->buildStringToTranslateInSmarty($vname), (!empty($def['required']) ? 'true' : 'false'), '', $def['id_name']);
213
-                  $validatedFields[] = $name;
214
-               }
207
+                        $vname = $def['vname'];
208
+                    }
209
+                    else{
210
+                        $vname = "undefined";
211
+                    }
212
+                    $javascript->addToValidateBinaryDependency($name, 'alpha', $javascript->buildStringToTranslateInSmarty('ERR_SQS_NO_MATCH_FIELD').': '.$javascript->buildStringToTranslateInSmarty($vname), (!empty($def['required']) ? 'true' : 'false'), '', $def['id_name']);
213
+                    $validatedFields[] = $name;
214
+                }
215 215
             } //foreach
216 216
 
217 217
             $contents .= "{literal}\n";
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
         }
276 276
         $file = $this->cacheDir . $this->templateDir . $module . '/' . $view . '.tpl';
277 277
         if(file_exists($file)) {
278
-           return $this->ss->fetch($file);
278
+            return $this->ss->fetch($file);
279 279
         } else {
280
-           global $app_strings;
281
-           $GLOBALS['log']->fatal($app_strings['ERR_NO_SUCH_FILE'] .": $file");
282
-           return $app_strings['ERR_NO_SUCH_FILE'] .": $file";
280
+            global $app_strings;
281
+            $GLOBALS['log']->fatal($app_strings['ERR_NO_SUCH_FILE'] .": $file");
282
+            return $app_strings['ERR_NO_SUCH_FILE'] .": $file";
283 283
         }
284 284
     }
285 285
 
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
         }
330 330
         $qsd->setFormName($view);
331 331
         if(preg_match('/^SearchForm_.+/', $view)){
332
-        	if(strpos($view, 'popup_query_form')){
333
-        		$qsd->setFormName('popup_query_form');
334
-            	$parsedView = 'advanced';
335
-        	}else{
336
-        		$qsd->setFormName('search_form');
337
-            	$parsedView = preg_replace("/^SearchForm_/", "", $view);
338
-        	}
332
+            if(strpos($view, 'popup_query_form')){
333
+                $qsd->setFormName('popup_query_form');
334
+                $parsedView = 'advanced';
335
+            }else{
336
+                $qsd->setFormName('search_form');
337
+                $parsedView = preg_replace("/^SearchForm_/", "", $view);
338
+            }
339 339
             //Loop through the Meta-Data fields to see which ones need quick search support
340 340
             foreach($defs as $f) {
341 341
                 $field = $f;
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
                             $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSContact($field['name'], $field['id_name']);
374 374
                         }
375 375
                     } else {
376
-                         $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSParent($field['module']);
377
-                         if(!isset($field['field_list']) && !isset($field['populate_list'])) {
378
-                             $sqs_objects[$name.'_'.$parsedView]['populate_list'] = array($field['name'], $field['id_name']);
379
-                             $sqs_objects[$name.'_'.$parsedView]['field_list'] = array('name', 'id');
380
-                         } else {
381
-                             $sqs_objects[$name.'_'.$parsedView]['populate_list'] = $field['field_list'];
382
-                             $sqs_objects[$name.'_'.$parsedView]['field_list'] = $field['populate_list'];
383
-                         }
376
+                            $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSParent($field['module']);
377
+                            if(!isset($field['field_list']) && !isset($field['populate_list'])) {
378
+                                $sqs_objects[$name.'_'.$parsedView]['populate_list'] = array($field['name'], $field['id_name']);
379
+                                $sqs_objects[$name.'_'.$parsedView]['field_list'] = array('name', 'id');
380
+                            } else {
381
+                                $sqs_objects[$name.'_'.$parsedView]['populate_list'] = $field['field_list'];
382
+                                $sqs_objects[$name.'_'.$parsedView]['field_list'] = $field['populate_list'];
383
+                            }
384 384
                     }
385 385
                 } else if($field['type'] == 'parent') {
386 386
                     $sqs_objects[$name.'_'.$parsedView] = $qsd->getQSParent();
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
             } //foreach
389 389
 
390 390
             foreach ( $sqs_objects as $name => $field )
391
-               foreach ( $field['populate_list'] as $key => $fieldname )
391
+                foreach ( $field['populate_list'] as $key => $fieldname )
392 392
                     $sqs_objects[$name]['populate_list'][$key] = $sqs_objects[$name]['populate_list'][$key] . '_'.$parsedView;
393 393
         }else{
394 394
             //Loop through the Meta-Data fields to see which ones need quick search support
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                             $field['id_name'] = $module.$field['id_name'];
414 414
                     }
415 415
                 }
416
-				$name = $qsd->form_name . '_' . $field['name'];
416
+                $name = $qsd->form_name . '_' . $field['name'];
417 417
 
418 418
 
419 419
                 if($field['type'] == 'relate' && isset($field['module']) && (preg_match('/_name$|_c$/si',$name) || !empty($field['quicksearch']))) {
@@ -427,15 +427,15 @@  discard block
 block discarded – undo
427 427
                         } else if($matches[0] == 'Users'){
428 428
                             if($field['name'] == 'reports_to_name'){
429 429
                                 $sqs_objects[$name] = $qsd->getQSUser('reports_to_name','reports_to_id');
430
-                             // Bug #52994 : QuickSearch for a 1-M User relationship changes assigned to user
430
+                                // Bug #52994 : QuickSearch for a 1-M User relationship changes assigned to user
431 431
                             }elseif($field['name'] == 'assigned_user_name'){
432
-                                 $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name','assigned_user_id');
433
-                             }
434
-                             else
435
-                             {
436
-                                 $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']);
432
+                                    $sqs_objects[$name] = $qsd->getQSUser('assigned_user_name','assigned_user_id');
433
+                                }
434
+                                else
435
+                                {
436
+                                    $sqs_objects[$name] = $qsd->getQSUser($field['name'], $field['id_name']);
437 437
 
438
-							}
438
+                            }
439 439
                         } else if($matches[0] == 'Campaigns') {
440 440
                             $sqs_objects[$name] = $qsd->loadQSObject('Campaigns', 'Campaign', $field['name'], $field['id_name'], $field['id_name']);
441 441
                         } else if($matches[0] == 'Accounts') {
@@ -486,39 +486,39 @@  discard block
 block discarded – undo
486 486
                 //merge populate_list && field_list with vardef
487 487
                 if (!empty($field['field_list']) && !empty($field['populate_list'])) {
488 488
                     for ($j=0; $j<count($field['field_list']); $j++) {
489
-                		//search for the same couple (field_list_item,populate_field_item)
490
-               			$field_list_item = $field['field_list'][$j];
491
-               			$field_list_item_alternate = $qsd->form_name . '_' . $field['field_list'][$j];
492
-               			$populate_list_item = $field['populate_list'][$j];
493
-                		$found = false;
494
-                		for ($k=0; $k<count($sqs_objects[$name]['field_list']); $k++) {
495
-                			if (($field_list_item == $sqs_objects[$name]['populate_list'][$k] || $field_list_item_alternate == $sqs_objects[$name]['populate_list'][$k]) && //il faut inverser field_list et populate_list (cf lignes 465,466 ci-dessus)
496
-                				$populate_list_item == $sqs_objects[$name]['field_list'][$k]) {
497
-                				$found = true;
498
-                				break;
499
-                			}
500
-                		}
501
-                		if (!$found) {
502
-                			$sqs_objects[$name]['field_list'][] = $field['populate_list'][$j]; // as in lines 462 and 463
503
-                			$sqs_objects[$name]['populate_list'][] = $field['field_list'][$j];
504
-                		}
505
-                	}
489
+                        //search for the same couple (field_list_item,populate_field_item)
490
+                            $field_list_item = $field['field_list'][$j];
491
+                            $field_list_item_alternate = $qsd->form_name . '_' . $field['field_list'][$j];
492
+                            $populate_list_item = $field['populate_list'][$j];
493
+                        $found = false;
494
+                        for ($k=0; $k<count($sqs_objects[$name]['field_list']); $k++) {
495
+                            if (($field_list_item == $sqs_objects[$name]['populate_list'][$k] || $field_list_item_alternate == $sqs_objects[$name]['populate_list'][$k]) && //il faut inverser field_list et populate_list (cf lignes 465,466 ci-dessus)
496
+                                $populate_list_item == $sqs_objects[$name]['field_list'][$k]) {
497
+                                $found = true;
498
+                                break;
499
+                            }
500
+                        }
501
+                        if (!$found) {
502
+                            $sqs_objects[$name]['field_list'][] = $field['populate_list'][$j]; // as in lines 462 and 463
503
+                            $sqs_objects[$name]['populate_list'][] = $field['field_list'][$j];
504
+                        }
505
+                    }
506 506
                 }
507 507
 
508 508
             } //foreach
509 509
         }
510 510
 
511
-       //Implement QuickSearch for the field
512
-       if(!empty($sqs_objects) && count($sqs_objects) > 0) {
513
-           $quicksearch_js = '<script language="javascript">';
514
-           $quicksearch_js.= 'if(typeof sqs_objects == \'undefined\'){var sqs_objects = new Array;}';
515
-           $json = getJSONobj();
516
-           foreach($sqs_objects as $sqsfield=>$sqsfieldArray){
517
-               $quicksearch_js .= "sqs_objects['$sqsfield']={$json->encode($sqsfieldArray)};";
518
-           }
519
-           return $quicksearch_js . '</script>';
520
-       }
521
-       return '';
511
+        //Implement QuickSearch for the field
512
+        if(!empty($sqs_objects) && count($sqs_objects) > 0) {
513
+            $quicksearch_js = '<script language="javascript">';
514
+            $quicksearch_js.= 'if(typeof sqs_objects == \'undefined\'){var sqs_objects = new Array;}';
515
+            $json = getJSONobj();
516
+            foreach($sqs_objects as $sqsfield=>$sqsfieldArray){
517
+                $quicksearch_js .= "sqs_objects['$sqsfield']={$json->encode($sqsfieldArray)};";
518
+            }
519
+            return $quicksearch_js . '</script>';
520
+        }
521
+        return '';
522 522
     }
523 523
 
524 524
     
Please login to merge, or discard this patch.
include/connectors/ConnectorFactory.php 1 patch
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.
include/MVC/Controller/ControllerFactory.php 1 patch
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.
include/MVC/Controller/action_view_map.php 1 patch
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.
include/MVC/Controller/file_access_control_map.php 1 patch
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.
include/javascript/getYUIComboFile.php 1 patch
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.
include/Dashlets/DashletGenericChart.php 1 patch
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.