Test Failed
Push — CI ( 02428e...3e0292 )
by Adam
55:43
created
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/SugarController.php 1 patch
Spacing   +146 added lines, -151 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * Main SugarCRM controller
44 44
  * @api
45 45
  */
46
-class SugarController{
46
+class SugarController {
47 47
 	/**
48 48
 	 * remap actions in here
49 49
 	 * e.g. make all detail views go to edit views
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * Constructor. This ie meant tot load up the module, action, record as well
163 163
 	 * as the mapping arrays.
164 164
 	 */
165
-	function SugarController(){
165
+	function SugarController() {
166 166
 	}
167 167
 
168 168
 	/**
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 	 * on the controller.
171 171
 	 *
172 172
 	 */
173
-	public function setup($module = ''){
174
-		if(empty($module) && !empty($_REQUEST['module']))
173
+	public function setup($module = '') {
174
+		if (empty($module) && !empty($_REQUEST['module']))
175 175
 			$module = $_REQUEST['module'];
176 176
 		//set the module
177
-		if(!empty($module))
177
+		if (!empty($module))
178 178
 			$this->setModule($module);
179 179
 
180
-		if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') {
180
+		if (!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') {
181 181
 			$this->target_module = $_REQUEST['target_module'];
182 182
 		}
183 183
 		//set properties on the controller from the $_REQUEST
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @param object $module
192 192
 	 */
193
-	public function setModule($module){
193
+	public function setModule($module) {
194 194
 		$this->module = $module;
195 195
 	}
196 196
 
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
 	 * Set properties on the Controller from the $_REQUEST
199 199
 	 *
200 200
 	 */
201
-	private function loadPropertiesFromRequest(){
202
-		if(!empty($_REQUEST['action']))
201
+	private function loadPropertiesFromRequest() {
202
+		if (!empty($_REQUEST['action']))
203 203
 			$this->action = $_REQUEST['action'];
204
-		if(!empty($_REQUEST['record']))
204
+		if (!empty($_REQUEST['record']))
205 205
 			$this->record = $_REQUEST['record'];
206
-		if(!empty($_REQUEST['view']))
206
+		if (!empty($_REQUEST['view']))
207 207
 			$this->view = $_REQUEST['view'];
208
-		if(!empty($_REQUEST['return_module']))
208
+		if (!empty($_REQUEST['return_module']))
209 209
 			$this->return_module = $_REQUEST['return_module'];
210
-		if(!empty($_REQUEST['return_action']))
210
+		if (!empty($_REQUEST['return_action']))
211 211
 			$this->return_action = $_REQUEST['return_action'];
212
-		if(!empty($_REQUEST['return_id']))
212
+		if (!empty($_REQUEST['return_id']))
213 213
 			$this->return_id = $_REQUEST['return_id'];
214 214
 	}
215 215
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * Load map files for use within the Controller
218 218
 	 *
219 219
 	 */
220
-	private function loadMappings(){
220
+	private function loadMappings() {
221 221
 		$this->loadMapping('action_view_map');
222 222
 		$this->loadMapping('action_file_map');
223 223
 		$this->loadMapping('action_remap', true);
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function loadBean()
230 230
 	{
231
-		if(!empty($GLOBALS['beanList'][$this->module])){
231
+		if (!empty($GLOBALS['beanList'][$this->module])) {
232 232
 			$class = $GLOBALS['beanList'][$this->module];
233
-			if(!empty($GLOBALS['beanFiles'][$class])){
233
+			if (!empty($GLOBALS['beanFiles'][$class])) {
234 234
 				require_once($GLOBALS['beanFiles'][$class]);
235 235
 				$this->bean = new $class();
236
-				if(!empty($this->record)){
236
+				if (!empty($this->record)) {
237 237
 					$this->bean->retrieve($this->record);
238
-					if($this->bean)
238
+					if ($this->bean)
239 239
 						$GLOBALS['FOCUS'] = $this->bean;
240 240
 				}
241 241
 			}
@@ -245,38 +245,38 @@  discard block
 block discarded – undo
245 245
 	/**
246 246
 	 * Generic load method to load mapping arrays.
247 247
 	 */
248
-	private function loadMapping($var, $merge = false){
249
-		$$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module);
250
-		if(!$$var){
251
-			if($merge && !empty($this->$var)){
248
+	private function loadMapping($var, $merge = false) {
249
+		$$var = sugar_cache_retrieve("CONTROLLER_".$var."_".$this->module);
250
+		if (!$$var) {
251
+			if ($merge && !empty($this->$var)) {
252 252
 				$$var = $this->$var;
253
-			}else{
253
+			} else {
254 254
 				$$var = array();
255 255
 			}
256
-			if(file_exists('include/MVC/Controller/'. $var . '.php')){
257
-				require('include/MVC/Controller/'. $var . '.php');
256
+			if (file_exists('include/MVC/Controller/'.$var.'.php')) {
257
+				require('include/MVC/Controller/'.$var.'.php');
258 258
 			}
259
-			if(file_exists('modules/'.$this->module.'/'. $var . '.php')){
260
-				require('modules/'.$this->module.'/'. $var . '.php');
259
+			if (file_exists('modules/'.$this->module.'/'.$var.'.php')) {
260
+				require('modules/'.$this->module.'/'.$var.'.php');
261 261
 			}
262
-			if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){
263
-				require('custom/modules/'.$this->module.'/'. $var . '.php');
262
+			if (file_exists('custom/modules/'.$this->module.'/'.$var.'.php')) {
263
+				require('custom/modules/'.$this->module.'/'.$var.'.php');
264 264
 			}
265
-			if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){
266
-				require('custom/include/MVC/Controller/'. $var . '.php');
265
+			if (file_exists('custom/include/MVC/Controller/'.$var.'.php')) {
266
+				require('custom/include/MVC/Controller/'.$var.'.php');
267 267
 			}
268 268
 
269 269
             // entry_point_registry -> EntryPointRegistry
270 270
 
271
-			$varname = str_replace(" ","",ucwords(str_replace("_"," ", $var)));
272
-            if(file_exists("custom/application/Ext/$varname/$var.ext.php")){
271
+			$varname = str_replace(" ", "", ucwords(str_replace("_", " ", $var)));
272
+            if (file_exists("custom/application/Ext/$varname/$var.ext.php")) {
273 273
 				require("custom/application/Ext/$varname/$var.ext.php");
274 274
 	        }
275
-			if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){
275
+			if (file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")) {
276 276
 				require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php");
277 277
 			}
278 278
 
279
-			sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var);
279
+			sugar_cache_put("CONTROLLER_".$var."_".$this->module, $$var);
280 280
 		}
281 281
 		$this->$var = $$var;
282 282
 	}
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
         try
291 291
         {
292 292
             $this->process();
293
-            if(!empty($this->view))
293
+            if (!empty($this->view))
294 294
             {
295 295
                 $this->processView();
296 296
             }
297
-            elseif(!empty($this->redirect_url))
297
+            elseif (!empty($this->redirect_url))
298 298
             {
299 299
             			$this->redirect();
300 300
             }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
       */
315 315
     protected function handleException(Exception $e)
316 316
     {
317
-        $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage());
317
+        $GLOBALS['log']->fatal('Exception in Controller: '.$e->getMessage());
318 318
         $logicHook = new LogicHook();
319 319
 
320 320
         if (isset($this->bean))
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 	/**
332 332
 	 * Display the appropriate view.
333 333
 	 */
334
-	private function processView(){
335
-		if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)]))
334
+	private function processView() {
335
+		if (!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)]))
336 336
 		{
337 337
 		  $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)];
338 338
 		}
339 339
 		$view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module);
340 340
 		$GLOBALS['current_view'] = $view;
341
-		if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){
341
+		if (!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list') {
342 342
 			ACLController::displayNoAccess(true);
343 343
 			sugar_cleanup(true);
344 344
 		}
345
-		if(isset($this->errors)){
345
+		if (isset($this->errors)) {
346 346
 		  $view->errors = $this->errors;
347 347
 		}
348 348
 		$view->process();
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
 	 * 1) check for file
362 362
 	 * 2) check for action
363 363
 	 */
364
-	public function process(){
364
+	public function process() {
365 365
 		$GLOBALS['action'] = $this->action;
366 366
 		$GLOBALS['module'] = $this->module;
367 367
 
368 368
 		//check to ensure we have access to the module.
369
-		if($this->hasAccess){
369
+		if ($this->hasAccess) {
370 370
 			$this->do_action = $this->action;
371 371
 
372 372
 			$file = self::getActionFilename($this->do_action);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             }
385 385
 
386 386
 			$this->redirect();
387
-		}else{
387
+		} else {
388 388
 			$this->no_access();
389 389
 		}
390 390
 	}
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
 	 * false otherwise.  This is important b/c if none of these methods exists, then we will run the
399 399
 	 * action_default() method.
400 400
 	 */
401
-	protected function handle_action(){
401
+	protected function handle_action() {
402 402
 		$processed = false;
403
-		foreach($this->tasks as $task){
403
+		foreach ($this->tasks as $task) {
404 404
 			$processed = ($this->$task() || $processed);
405 405
 		}
406 406
 		$this->_processed = $processed;
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 	 * Perform an action prior to the specified action.
411 411
 	 * This can be overridde in a sub-class
412 412
 	 */
413
-	private function pre_action(){
414
-		$function = 'pre_' . $this->action;
415
-		if($this->hasFunction($function)){
413
+	private function pre_action() {
414
+		$function = 'pre_'.$this->action;
415
+		if ($this->hasFunction($function)) {
416 416
 			$GLOBALS['log']->debug('Performing pre_action');
417 417
 			$this->$function();
418 418
 			return true;
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 	 * Perform the specified action.
425 425
 	 * This can be overridde in a sub-class
426 426
 	 */
427
-	private function do_action(){
428
-		$function =  'action_'. strtolower($this->do_action);
429
-		if($this->hasFunction($function)){
427
+	private function do_action() {
428
+		$function = 'action_'.strtolower($this->do_action);
429
+		if ($this->hasFunction($function)) {
430 430
 			$GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module);
431 431
 			$this->$function();
432 432
 			return true;
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 	 * Perform an action after to the specified action has occurred.
439 439
 	 * This can be overridde in a sub-class
440 440
 	 */
441
-	private function post_action(){
442
-		$function = 'post_' . $this->action;
443
-		if($this->hasFunction($function)){
441
+	private function post_action() {
442
+		$function = 'post_'.$this->action;
443
+		if ($this->hasFunction($function)) {
444 444
 			$GLOBALS['log']->debug('Performing post_action');
445 445
 			$this->$function();
446 446
 			return true;
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 	/**
452 452
 	 * If there is no action found then display an error to the user.
453 453
 	 */
454
-	protected function no_action(){
454
+	protected function no_action() {
455 455
 		sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']);
456 456
 	}
457 457
 
458 458
 	/**
459 459
 	 * The default action handler for instances where we do not have access to process.
460 460
 	 */
461
-	protected function no_access(){
461
+	protected function no_access() {
462 462
 		$this->view = 'noaccess';
463 463
 	}
464 464
 
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 * @param function - the function to check
472 472
 	 * @return true if the method exists on the object, false otherwise
473 473
 	 */
474
-	protected function hasFunction($function){
474
+	protected function hasFunction($function) {
475 475
 		return method_exists($this, $function);
476 476
 	}
477 477
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 	 *
482 482
 	 * @param string url - the url to which we will want to redirect
483 483
 	 */
484
-	protected function set_redirect($url){
484
+	protected function set_redirect($url) {
485 485
 		$this->redirect_url = $url;
486 486
 	}
487 487
 
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 	 * Perform redirection based on the redirect_url
490 490
 	 *
491 491
 	 */
492
-	protected function redirect(){
492
+	protected function redirect() {
493 493
 
494
-		if(!empty($this->redirect_url))
494
+		if (!empty($this->redirect_url))
495 495
 			SugarApplication::redirect($this->redirect_url);
496 496
 	}
497 497
 
@@ -506,38 +506,38 @@  discard block
 block discarded – undo
506 506
 	/**
507 507
 	 * Do some processing before saving the bean to the database.
508 508
 	 */
509
-	public function pre_save(){
510
-		if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){
509
+	public function pre_save() {
510
+		if (!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])) {
511 511
 			$this->bean->notify_on_save = true;
512 512
 		}
513 513
 		$GLOBALS['log']->debug("SugarController:: performing pre_save.");
514 514
         require_once('include/SugarFields/SugarFieldHandler.php');
515 515
         $sfh = new SugarFieldHandler();
516
-		foreach($this->bean->field_defs as $field => $properties) {
516
+		foreach ($this->bean->field_defs as $field => $properties) {
517 517
 			$type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type'];
518 518
 		    $sf = $sfh->getSugarField(ucfirst($type), true);
519
-			if(isset($_POST[$field])) {
520
-				if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) {
521
-					if(empty($_POST[$field][0])) {
519
+			if (isset($_POST[$field])) {
520
+				if (is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) {
521
+					if (empty($_POST[$field][0])) {
522 522
 						unset($_POST[$field][0]);
523 523
 					}
524 524
 					$_POST[$field] = encodeMultienumValue($_POST[$field]);
525 525
 				}
526 526
 				$this->bean->$field = $_POST[$field];
527
-			} else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) {
527
+			} else if (!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field.'_multiselect'])) {
528 528
 				$this->bean->$field = '';
529 529
 			}
530
-            if($sf != null){
530
+            if ($sf != null) {
531 531
                 $sf->save($this->bean, $_POST, $field, $properties);
532 532
             }
533 533
 		}
534 534
 
535
-		foreach($this->bean->relationship_fields as $field=>$link){
536
-			if(!empty($_POST[$field])){
535
+		foreach ($this->bean->relationship_fields as $field=>$link) {
536
+			if (!empty($_POST[$field])) {
537 537
 				$this->bean->$field = $_POST[$field];
538 538
 			}
539 539
 		}
540
-		if(!$this->bean->ACLAccess('save')){
540
+		if (!$this->bean->ACLAccess('save')) {
541 541
 			ACLController::displayNoAccess(true);
542 542
 			sugar_cleanup(true);
543 543
 		}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	/**
548 548
 	 * Perform the actual save
549 549
 	 */
550
-	public function action_save(){
550
+	public function action_save() {
551 551
 		$this->bean->save(!empty($this->bean->notify_on_save));
552 552
 	}
553 553
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	/**
562 562
 	 * Specify what happens after the save has occurred.
563 563
 	 */
564
-	protected function post_save(){
564
+	protected function post_save() {
565 565
 		$module = (!empty($this->return_module) ? $this->return_module : $this->module);
566 566
 		$action = (!empty($this->return_action) ? $this->return_action : 'DetailView');
567 567
 		$id = (!empty($this->return_id) ? $this->return_id : $this->bean->id);
@@ -577,16 +577,16 @@  discard block
 block discarded – undo
577 577
 	/**
578 578
 	 * Perform the actual deletion.
579 579
 	 */
580
-	protected function action_delete(){
580
+	protected function action_delete() {
581 581
 		//do any pre delete processing
582 582
 		//if there is some custom logic for deletion.
583
-		if(!empty($_REQUEST['record'])){
584
-			if(!$this->bean->ACLAccess('Delete')){
583
+		if (!empty($_REQUEST['record'])) {
584
+			if (!$this->bean->ACLAccess('Delete')) {
585 585
 				ACLController::displayNoAccess(true);
586 586
 				sugar_cleanup(true);
587 587
 			}
588 588
 			$this->bean->mark_deleted($_REQUEST['record']);
589
-		}else{
589
+		} else {
590 590
 			sugar_die("A record number must be specified to delete");
591 591
 		}
592 592
 	}
@@ -594,24 +594,21 @@  discard block
 block discarded – undo
594 594
 	/**
595 595
 	 * Specify what happens after the deletion has occurred.
596 596
 	 */
597
-	protected function post_delete(){
597
+	protected function post_delete() {
598 598
         if (empty($_REQUEST['return_url'])) {
599 599
             $return_module = isset($_REQUEST['return_module']) ?
600
-                $_REQUEST['return_module'] :
601
-                $GLOBALS['sugar_config']['default_module'];
600
+                $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module'];
602 601
             $return_action = isset($_REQUEST['return_action']) ?
603
-                $_REQUEST['return_action'] :
604
-                $GLOBALS['sugar_config']['default_action'];
602
+                $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action'];
605 603
             $return_id = isset($_REQUEST['return_id']) ?
606
-                $_REQUEST['return_id'] :
607
-                '';
604
+                $_REQUEST['return_id'] : '';
608 605
             $url = "index.php?module=".$return_module."&action=".$return_action."&record=".$return_id;
609 606
         } else {
610 607
             $url = $_REQUEST['return_url'];
611 608
         }
612 609
 
613 610
 		//eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless.
614
-		if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) {
611
+		if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) {
615 612
 		    $url .= "&offset=".$_REQUEST['offset'];
616 613
 		}
617 614
 
@@ -620,15 +617,15 @@  discard block
 block discarded – undo
620 617
 	/**
621 618
 	 * Perform the actual massupdate.
622 619
 	 */
623
-	protected function action_massupdate(){
624
-		if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){
625
-			if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete')
626
-                || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){
620
+	protected function action_massupdate() {
621
+		if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) {
622
+			if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete')
623
+                || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) {
627 624
 				ACLController::displayNoAccess(true);
628 625
 				sugar_cleanup(true);
629 626
 			}
630 627
 
631
-            set_time_limit(0);//I'm wondering if we will set it never goes timeout here.
628
+            set_time_limit(0); //I'm wondering if we will set it never goes timeout here.
632 629
             // until we have more efficient way of handling MU, we have to disable the limit
633 630
             $GLOBALS['db']->setQueryLimit(0);
634 631
             require_once("include/MassUpdate.php");
@@ -636,40 +633,38 @@  discard block
 block discarded – undo
636 633
             $seed = loadBean($_REQUEST['module']);
637 634
             $mass = new MassUpdate();
638 635
             $mass->setSugarBean($seed);
639
-            if(isset($_REQUEST['entire']) && empty($_POST['mass'])) {
636
+            if (isset($_REQUEST['entire']) && empty($_POST['mass'])) {
640 637
                 $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']);
641 638
             }
642 639
             $mass->handleMassUpdate();
643
-            $storeQuery = new StoreQuery();//restore the current search. to solve bug 24722 for multi tabs massupdate.
640
+            $storeQuery = new StoreQuery(); //restore the current search. to solve bug 24722 for multi tabs massupdate.
644 641
             $temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']);
645
-            if($_REQUEST['return_module'] == 'Emails') {
646
-                if(!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) {
642
+            if ($_REQUEST['return_module'] == 'Emails') {
643
+                if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) {
647 644
                     $this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']); // Specifically for My Achieves
648 645
                 }
649 646
             }
650 647
             $_REQUEST = array();
651 648
             $_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page']));
652
-            unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page
649
+            unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']); //after massupdate, the page should redirect to no offset page
653 650
             $storeQuery->saveFromRequest($_REQUEST['module']);
654
-            $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page.
655
-		}else{
651
+            $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']); //for post_massupdate, to go back to original page.
652
+		} else {
656 653
 			sugar_die("You must massupdate at least one record");
657 654
 		}
658 655
 	}
659 656
 	/**
660 657
 	 * Specify what happens after the massupdate has occurred.
661 658
 	 */
662
-	protected function post_massupdate(){
659
+	protected function post_massupdate() {
663 660
 		$return_module = isset($_REQUEST['return_module']) ?
664
-			$_REQUEST['return_module'] :
665
-			$GLOBALS['sugar_config']['default_module'];
661
+			$_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module'];
666 662
 		$return_action = isset($_REQUEST['return_action']) ?
667
-			$_REQUEST['return_action'] :
668
-			$GLOBALS['sugar_config']['default_action'];
663
+			$_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action'];
669 664
 		$url = "index.php?module=".$return_module."&action=".$return_action;
670
-		if($return_module == 'Emails'){//specificly for My Achieves
671
-			if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) {
672
-				$url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id'];
665
+		if ($return_module == 'Emails') {//specificly for My Achieves
666
+			if (!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) {
667
+				$url = $url."&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id'];
673 668
 			}
674 669
 		}
675 670
 		$this->set_redirect($url);
@@ -677,7 +672,7 @@  discard block
 block discarded – undo
677 672
 	/**
678 673
 	 * Perform the listview action
679 674
 	 */
680
-	protected function action_listview(){
675
+	protected function action_listview() {
681 676
 		$this->view_object_map['bean'] = $this->bean;
682 677
 		$this->view = 'list';
683 678
 	}
@@ -692,24 +687,24 @@  discard block
 block discarded – undo
692 687
 	/**
693 688
 	 * Action to handle when using a file as was done in previous versions of Sugar.
694 689
 	 */
695
-	protected function action_default(){
690
+	protected function action_default() {
696 691
 		$this->view = 'classic';
697 692
 	}
698 693
 
699 694
 	/**
700 695
 	 * this method id used within a Dashlet when performing an ajax call
701 696
 	 */
702
-	protected function action_callmethoddashlet(){
703
-		if(!empty($_REQUEST['id'])) {
697
+	protected function action_callmethoddashlet() {
698
+		if (!empty($_REQUEST['id'])) {
704 699
 		    $id = $_REQUEST['id'];
705 700
 		    $requestedMethod = $_REQUEST['method'];
706 701
 		    $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config
707
-		    if(!empty($dashletDefs[$id])) {
702
+		    if (!empty($dashletDefs[$id])) {
708 703
 		        require_once($dashletDefs[$id]['fileLocation']);
709 704
 
710 705
 		        $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array()));
711 706
 
712
-		        if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) {
707
+		        if (method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) {
713 708
 		            echo $dashlet->$requestedMethod();
714 709
 		        }
715 710
 		        else {
@@ -722,22 +717,22 @@  discard block
 block discarded – undo
722 717
 	/**
723 718
 	 * this method is used within a Dashlet when the options configuration is posted
724 719
 	 */
725
-	protected function action_configuredashlet(){
720
+	protected function action_configuredashlet() {
726 721
 		global $current_user, $mod_strings;
727 722
 
728
-		if(!empty($_REQUEST['id'])) {
723
+		if (!empty($_REQUEST['id'])) {
729 724
 		    $id = $_REQUEST['id'];
730 725
 		    $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config
731 726
 		    require_once($dashletDefs[$id]['fileLocation']);
732 727
 
733 728
 		    $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array()));
734
-		    if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings
729
+		    if (!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings
735 730
 		        $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST);
736 731
 		        $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']);
737 732
 		    }
738 733
 		    else { // display options
739 734
 		        $json = getJSONobj();
740
-		        return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'],
735
+		        return 'result = '.$json->encode((array('header' => $dashlet->title.' : '.$mod_strings['LBL_OPTIONS'],
741 736
 		                                                 'body'  => $dashlet->displayOptions())));
742 737
 
743 738
 		    }
@@ -761,7 +756,7 @@  discard block
 block discarded – undo
761 756
         ob_clean();
762 757
         $retval = false;
763 758
 
764
-        if(method_exists($this->bean, 'deleteAttachment')) {
759
+        if (method_exists($this->bean, 'deleteAttachment')) {
765 760
             $duplicate = "false";
766 761
             if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == "true") {
767 762
                 $duplicate = "true";
@@ -779,7 +774,7 @@  discard block
 block discarded – undo
779 774
 	 * getActionFilename
780 775
 	 */
781 776
 	public static function getActionFilename($action) {
782
-	   if(isset(self::$action_case_file[$action])) {
777
+	   if (isset(self::$action_case_file[$action])) {
783 778
 	   	  return self::$action_case_file[$action];
784 779
 	   }
785 780
 	   return $action;
@@ -796,40 +791,40 @@  discard block
 block discarded – undo
796 791
 	 *
797 792
 	 * @return true if we want to stop processing, false if processing should continue
798 793
 	 */
799
-	private function blockFileAccess(){
794
+	private function blockFileAccess() {
800 795
 		//check if the we have enabled file_access_control and if so then check the mappings on the request;
801
-		if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){
796
+		if (!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']) {
802 797
 			$this->loadMapping('file_access_control_map');
803 798
 			//since we have this turned on, check the mapping file
804 799
 			$module = strtolower($this->module);
805 800
 			$action = strtolower($this->do_action);
806
-			if(!empty($this->file_access_control_map['modules'][$module]['links'])){
801
+			if (!empty($this->file_access_control_map['modules'][$module]['links'])) {
807 802
 				$GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links'];
808 803
 			}
809 804
 
810
-			if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){
805
+			if (!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))) {
811 806
 				//check params
812
-				if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){
807
+				if (!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])) {
813 808
 					$block = true;
814 809
 					$params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params'];
815
-					foreach($params as $param => $paramVals){
816
-						if(!empty($_REQUEST[$param])){
817
-							if(!in_array($_REQUEST[$param], $paramVals)){
810
+					foreach ($params as $param => $paramVals) {
811
+						if (!empty($_REQUEST[$param])) {
812
+							if (!in_array($_REQUEST[$param], $paramVals)) {
818 813
 								$block = false;
819 814
 								break;
820 815
 							}
821 816
 						}
822 817
 					}
823
-					if($block){
818
+					if ($block) {
824 819
 						$this->_processed = true;
825 820
 						$this->no_access();
826 821
 					}
827
-				}else{
822
+				} else {
828 823
 					$this->_processed = true;
829 824
 					$this->no_access();
830 825
 				}
831 826
 			}
832
-		}else
827
+		} else
833 828
 			$this->_processed = false;
834 829
 	}
835 830
 
@@ -841,12 +836,12 @@  discard block
 block discarded – undo
841 836
 	 * the download entry point is mapped in the following file: entry_point_registry.php
842 837
 	 *
843 838
 	 */
844
-	private function handleEntryPoint(){
845
-		if(!empty($_REQUEST['entryPoint'])){
839
+	private function handleEntryPoint() {
840
+		if (!empty($_REQUEST['entryPoint'])) {
846 841
 			$this->loadMapping('entry_point_registry');
847 842
 			$entryPoint = $_REQUEST['entryPoint'];
848 843
 
849
-			if(!empty($this->entry_point_registry[$entryPoint])){
844
+			if (!empty($this->entry_point_registry[$entryPoint])) {
850 845
 				require_once($this->entry_point_registry[$entryPoint]['file']);
851 846
 				$this->_processed = true;
852 847
 				$this->view = '';
@@ -864,8 +859,8 @@  discard block
 block discarded – undo
864 859
     {
865 860
         $this->loadMapping('entry_point_registry');
866 861
 
867
-        if ( isset($this->entry_point_registry[$entryPoint]['auth'])
868
-                && !$this->entry_point_registry[$entryPoint]['auth'] )
862
+        if (isset($this->entry_point_registry[$entryPoint]['auth'])
863
+                && !$this->entry_point_registry[$entryPoint]['auth'])
869 864
             return false;
870 865
         return true;
871 866
     }
@@ -877,26 +872,26 @@  discard block
 block discarded – undo
877 872
 	protected function callLegacyCode()
878 873
 	{
879 874
 		$file = self::getActionFilename($this->do_action);
880
-		if ( isset($this->action_view_map[strtolower($this->do_action)]) ) {
875
+		if (isset($this->action_view_map[strtolower($this->do_action)])) {
881 876
 	        $action = $this->action_view_map[strtolower($this->do_action)];
882 877
 	    }
883 878
 	    else {
884 879
 	        $action = $this->do_action;
885 880
 	    }
886 881
 	    // index actions actually maps to the view.list.php view
887
-	    if ( $action == 'index' ) {
882
+	    if ($action == 'index') {
888 883
 	        $action = 'list';
889 884
 	    }
890 885
 
891
-		if ((file_exists('modules/' . $this->module . '/'. $file . '.php')
892
-                && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php'))
893
-            || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php')
894
-                && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php'))
886
+		if ((file_exists('modules/'.$this->module.'/'.$file.'.php')
887
+                && !file_exists('modules/'.$this->module.'/views/view.'.$action.'.php'))
888
+            || (file_exists('custom/modules/'.$this->module.'/'.$file.'.php')
889
+                && !file_exists('custom/modules/'.$this->module.'/views/view.'.$action.'.php'))
895 890
             ) {
896 891
 			// A 'classic' module, using the old pre-MVC display files
897 892
 			// We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own
898 893
 			unset($GLOBALS['FOCUS']);
899
-			$GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file);
894
+			$GLOBALS['log']->debug('Module:'.$this->module.' using file: '.$file);
900 895
 			$this->action_default();
901 896
 			$this->_processed = true;
902 897
 		}
@@ -907,17 +902,17 @@  discard block
 block discarded – undo
907 902
 	 * action_file_map.php or action_view_map.php load those maps here.
908 903
 	 *
909 904
 	 */
910
-	private function handleActionMaps(){
911
-		if(!empty($this->action_file_map[strtolower($this->do_action)])){
905
+	private function handleActionMaps() {
906
+		if (!empty($this->action_file_map[strtolower($this->do_action)])) {
912 907
 			$this->view = '';
913
-			$GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]);
908
+			$GLOBALS['log']->debug('Using Action File Map:'.$this->action_file_map[strtolower($this->do_action)]);
914 909
 			require_once($this->action_file_map[strtolower($this->do_action)]);
915 910
 			$this->_processed = true;
916
-		}elseif(!empty($this->action_view_map[strtolower($this->do_action)])){
917
-			$GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]);
911
+		}elseif (!empty($this->action_view_map[strtolower($this->do_action)])) {
912
+			$GLOBALS['log']->debug('Using Action View Map:'.$this->action_view_map[strtolower($this->do_action)]);
918 913
 			$this->view = $this->action_view_map[strtolower($this->do_action)];
919 914
 			$this->_processed = true;
920
-		}else
915
+		} else
921 916
 			$this->no_action();
922 917
 	}
923 918
 
@@ -925,8 +920,8 @@  discard block
 block discarded – undo
925 920
 	 * Actually remap the action if required.
926 921
 	 *
927 922
 	 */
928
-	protected function remapAction(){
929
-		if(!empty($this->action_remap[$this->do_action])){
923
+	protected function remapAction() {
924
+		if (!empty($this->action_remap[$this->do_action])) {
930 925
 			$this->action = $this->action_remap[$this->do_action];
931 926
 			$this->do_action = $this->action;
932 927
 		}
Please login to merge, or discard this patch.
include/MVC/Controller/entry_point_registry.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.
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
     'jslang'=> array('file' => 'include/language/getJSLanguage.php', 'auth' => true),
71 71
 	'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false),
72 72
 	'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false),
73
-	'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true),
74
-	'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true),
75
-	'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true),
76
-	'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true),
77
-	'social' => array('file' => 'include/social/get_data.php' , 'auth' => true),
78
-	'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true),
79
-	'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true),
80
-	'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true),
81
-	'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true),
82
-	'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true)
73
+	'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true),
74
+	'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true),
75
+	'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php', 'auth' => true),
76
+	'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php', 'auth' => true),
77
+	'social' => array('file' => 'include/social/get_data.php', 'auth' => true),
78
+	'social_reader' => array('file' => 'include/social/get_feed_data.php', 'auth' => true),
79
+	'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php', 'auth' => true),
80
+	'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php', 'auth' => true),
81
+	'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php', 'auth' => true),
82
+	'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php', 'auth' => true)
83 83
 );
84 84
 
85 85
 ?>
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/jsAlerts.php 1 patch
Spacing   +20 added lines, -20 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.
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 
42 42
 require_once("include/utils/db_utils.php");
43 43
 
44
-class jsAlerts{
44
+class jsAlerts {
45 45
 	var $script;
46 46
 
47
-	function jsAlerts(){
47
+	function jsAlerts() {
48 48
 		global $app_strings;
49 49
 		$this->script .= <<<EOQ
50 50
 		if (!alertsTimeoutId) {
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 EOQ;
55 55
 		$this->addActivities();
56 56
 		Reminder::addNotifications($this);
57
-		if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){
58
-			$this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 );
59
-			$this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php');
57
+		if (!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])) {
58
+			$this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'], '', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60);
59
+			$this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'], '', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60, 'index.php');
60 60
 		}
61 61
 	}
62
-	function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='')
62
+	function addAlert($type, $name, $subtitle, $description, $countdown, $redirect = '')
63 63
     {
64
-		$script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n";
64
+		$script = 'addAlert('.json_encode($type).','.json_encode($name).','.json_encode($subtitle).','.json_encode(str_replace(array("\r", "\n"), array('', '<br>'), $description)).','.$countdown.','.json_encode($redirect).');'."\n";
65 65
         $this->script .= $script;
66 66
 	}
67 67
 
68 68
     function getScript()
69 69
     {
70
-        return "<script>secondsSinceLoad = 0; alertList = [];" . $this->script . "</script>";
70
+        return "<script>secondsSinceLoad = 0; alertList = [];".$this->script."</script>";
71 71
     }
72 72
 
73 73
     /*
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         return '';
87 87
     }
88 88
 
89
-    function addActivities(){
89
+    function addActivities() {
90 90
 		global $app_list_strings, $timedate, $current_user, $app_strings;
91 91
 		global $sugar_config;
92 92
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime');
106 106
 		$dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime');
107 107
 		$desc = $db->convert("description", "text2char");
108
-		if($desc != "description") {
108
+		if ($desc != "description") {
109 109
 		    $desc .= " description";
110 110
 		}
111 111
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 		///////////////////////////////////////////////////////////////////////
125 125
 		////	MEETING INTEGRATION
126 126
 		$meetingIntegration = null;
127
-		if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) {
128
-			if(!class_exists($sugar_config['meeting_integration'])) {
127
+		if (isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) {
128
+			if (!class_exists($sugar_config['meeting_integration'])) {
129 129
 				require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php");
130 130
 			}
131 131
 			$meetingIntegration = new $sugar_config['meeting_integration']();
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
 		////	END MEETING INTEGRATION
134 134
 		///////////////////////////////////////////////////////////////////////
135 135
 
136
-		while($row = $db->fetchByAssoc($result)) {
136
+		while ($row = $db->fetchByAssoc($result)) {
137 137
 			// need to concatenate since GMT times can bridge two local days
138 138
 			$timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime'));
139 139
 			$timeRemind = $row['reminder_time'];
140 140
 			$timeStart -= $timeRemind;
141 141
 
142
-			$url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id'];
142
+			$url = 'index.php?action=DetailView&module=Meetings&record='.$row['id'];
143 143
 			$instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG'];
144 144
 
145 145
 			///////////////////////////////////////////////////////////////////
146 146
 			////	MEETING INTEGRATION
147
-			if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) {
147
+			if (!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) {
148 148
 				$url = $meetingIntegration->miUrlGetJsAlert($row);
149 149
 				$instructions = $meetingIntegration->miGetJsAlertInstructions();
150 150
 			}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             $relatedToMeeting = $this->getRelatedName($row['parent_type'], $row['parent_id']);
159 159
 
160 160
 			$description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n";
161
-            $description = $description  ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToMeeting;
161
+            $description = $description."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].$row['status']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToMeeting;
162 162
 
163 163
 
164 164
 			// standard functionality
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
 		$result = $db->query($selectCalls);
188 188
 
189
-		while($row = $db->fetchByAssoc($result)){
189
+		while ($row = $db->fetchByAssoc($result)) {
190 190
 			// need to concatenate since GMT times can bridge two local days
191 191
 			$timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime'));
192 192
 			$timeRemind = $row['reminder_time'];
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 
196 196
             $relatedToCall = $this->getRelatedName($row['parent_type'], $row['parent_id']);
197 197
 
198
-            $callDescription = $row['description'] ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToCall;
198
+            $callDescription = $row['description']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].$row['status']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToCall;
199 199
 
200 200
 
201
-            $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')) , $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription , $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record=' . $row['id']);
201
+            $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription, $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record='.$row['id']);
202 202
 		}
203 203
 	}
204 204
 
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/DashletGenericChart.php 1 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.
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.