Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
modules/Administration/DiagnosticRun.php 3 patches
Indentation   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 global $db;
70 70
 if(empty($db)) {
71 71
 
72
-	$db = DBManagerFactory::getInstance();
72
+    $db = DBManagerFactory::getInstance();
73 73
 }
74 74
 
75 75
 global $current_user;
76 76
 if(!is_admin($current_user)){
77
-	die($mod_strings['LBL_DIAGNOSTIC_ACCESS']);
77
+    die($mod_strings['LBL_DIAGNOSTIC_ACCESS']);
78 78
 }
79 79
 global $sugar_config;
80 80
 global $beanFiles;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 
133 133
     $currentitems++;
134 134
     if($currentitems == $totalitems)
135
-      update_progress_bar("diagnostic", 100, 100);
135
+        update_progress_bar("diagnostic", 100, 100);
136 136
     else
137 137
     {
138
-      $progress_bar_percent += ($itemweight / $GLOBALS['totalweight'] * 100);
139
-      update_progress_bar("diagnostic", $progress_bar_percent, 100);
138
+        $progress_bar_percent += ($itemweight / $GLOBALS['totalweight'] * 100);
139
+        update_progress_bar("diagnostic", $progress_bar_percent, 100);
140 140
     }
141 141
 }
142 142
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
     $contents .= "<tr colspan=\"$cols\">$header</tr><tr>";
160 160
     foreach($keys as $key) {
161
-       $contents .= "<th class=\"tabDetailViewDL\"><b>$key</b></th>";
161
+        $contents .= "<th class=\"tabDetailViewDL\"><b>$key</b></th>";
162 162
     }
163 163
     $contents .= "</tr>";
164 164
     foreach($values as $field) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 // returns a string containing (in html) the dump of all rows
181 181
 function getFullTableDump($tableName){
182 182
 
183
-	global $db;
183
+    global $db;
184 184
 
185 185
     $cols = $db->get_columns($tableName);
186 186
     $indexes = $db->get_indices($tableName);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
     $def_count = count($cols);
194 194
 
195
-	$td_result = $db->query("select * from ".$tableName);
195
+    $td_result = $db->query("select * from ".$tableName);
196 196
     if(!$td_result) {
197 197
         return $db->lastError();
198 198
     }
@@ -204,124 +204,124 @@  discard block
 block discarded – undo
204 204
     }
205 205
     $returnString .= "</tr>";
206 206
     $row_counter = 1;
207
-	while($row = $db->fetchByAssoc($td_result))
208
-	{
209
-		$row = array_values($row);
210
-		$returnString .= "<tr>";
211
-		$returnString .= "<td class=\"tabDetailViewDL\">".$row_counter."</td>";
212
-		for($counter = 0; $counter < $def_count; $counter++) {
207
+    while($row = $db->fetchByAssoc($td_result))
208
+    {
209
+        $row = array_values($row);
210
+        $returnString .= "<tr>";
211
+        $returnString .= "<td class=\"tabDetailViewDL\">".$row_counter."</td>";
212
+        for($counter = 0; $counter < $def_count; $counter++) {
213 213
             $replace_val = false;
214
-			//perform this check when counter is set to two, which means it is on the 'value' column
215
-			if($counter == 2) {
216
-				//if the previous "name" column value was set to smtppass, set replace_val to true
217
-				if(strcmp($row[$counter - 1], "smtppass") == 0  )
218
-					$replace_val = true;
219
-
220
-				//if the previous "name" column value was set to smtppass,
221
-				//and the "category" value set to ldap, set replace_val to true
222
-				if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0)
223
-					$replace_val = true;
224
-
225
-				//if the previous "name" column value was set to password,
226
-				//and the "category" value set to proxy, set replace_val to true
227
-				if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 )
228
-					$replace_val = true;
229
-			}
230
-
231
-			if($replace_val) {
232
-					$returnString .= "<td class=\"tabDetailViewDF\">********</td>";
214
+            //perform this check when counter is set to two, which means it is on the 'value' column
215
+            if($counter == 2) {
216
+                //if the previous "name" column value was set to smtppass, set replace_val to true
217
+                if(strcmp($row[$counter - 1], "smtppass") == 0  )
218
+                    $replace_val = true;
219
+
220
+                //if the previous "name" column value was set to smtppass,
221
+                //and the "category" value set to ldap, set replace_val to true
222
+                if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0)
223
+                    $replace_val = true;
224
+
225
+                //if the previous "name" column value was set to password,
226
+                //and the "category" value set to proxy, set replace_val to true
227
+                if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 )
228
+                    $replace_val = true;
229
+            }
230
+
231
+            if($replace_val) {
232
+                    $returnString .= "<td class=\"tabDetailViewDF\">********</td>";
233 233
             } else {
234
-					$returnString .= "<td class=\"tabDetailViewDF\">".($row[$counter] == "" ? "&nbsp;" : $row[$counter])."</td>";
235
-			}
236
-	    }
234
+                    $returnString .= "<td class=\"tabDetailViewDF\">".($row[$counter] == "" ? "&nbsp;" : $row[$counter])."</td>";
235
+            }
236
+        }
237 237
         $row_counter++;
238 238
         $returnString .= "</tr>";
239 239
     }
240
-	$returnString .= "</table>";
240
+    $returnString .= "</table>";
241 241
 
242
-	return $returnString;
242
+    return $returnString;
243 243
 }
244 244
 
245 245
 // Deletes the directory recursively
246 246
 function deleteDir($dir)
247 247
 {
248
-   if (substr($dir, strlen($dir)-1, 1) != '/')
249
-       $dir .= '/';
250
-
251
-   if ($handle = opendir($dir))
252
-   {
253
-       while ($obj = readdir($handle))
254
-       {
255
-           if ($obj != '.' && $obj != '..')
256
-           {
257
-               if (is_dir($dir.$obj))
258
-               {
259
-                   if (!deleteDir($dir.$obj))
260
-                       return false;
261
-               }
262
-               elseif (is_file($dir.$obj))
263
-               {
264
-                   if (!unlink($dir.$obj))
265
-                       return false;
266
-               }
267
-           }
268
-       }
269
-
270
-       closedir($handle);
271
-
272
-       if (!@rmdir($dir))
273
-           return false;
274
-       return true;
275
-   }
276
-   return false;
248
+    if (substr($dir, strlen($dir)-1, 1) != '/')
249
+        $dir .= '/';
250
+
251
+    if ($handle = opendir($dir))
252
+    {
253
+        while ($obj = readdir($handle))
254
+        {
255
+            if ($obj != '.' && $obj != '..')
256
+            {
257
+                if (is_dir($dir.$obj))
258
+                {
259
+                    if (!deleteDir($dir.$obj))
260
+                        return false;
261
+                }
262
+                elseif (is_file($dir.$obj))
263
+                {
264
+                    if (!unlink($dir.$obj))
265
+                        return false;
266
+                }
267
+            }
268
+        }
269
+
270
+        closedir($handle);
271
+
272
+        if (!@rmdir($dir))
273
+            return false;
274
+        return true;
275
+    }
276
+    return false;
277 277
 }
278 278
 
279 279
 
280 280
 function prepareDiag()
281 281
 {
282
-	global $getDumpsFrom;
283
-	global $cacheDir;
284
-	global $curdatetime;
285
-	global $progress_bar_percent;
286
-	global $skip_md5_diff;
287
-	global $sod_guid;
288
-	global $mod_strings;
289
-
290
-	echo getClassicModuleTitle(
282
+    global $getDumpsFrom;
283
+    global $cacheDir;
284
+    global $curdatetime;
285
+    global $progress_bar_percent;
286
+    global $skip_md5_diff;
287
+    global $sod_guid;
288
+    global $mod_strings;
289
+
290
+    echo getClassicModuleTitle(
291 291
         "Administration",
292 292
         array(
293 293
             "<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
294
-           translate('LBL_DIAGNOSTIC_TITLE')
295
-           ),
294
+            translate('LBL_DIAGNOSTIC_TITLE')
295
+            ),
296 296
         false
297 297
         );
298
-	echo "<BR>";
299
-	echo $mod_strings['LBL_DIAGNOSTIC_EXECUTING'];
300
-	echo "<BR>";
298
+    echo "<BR>";
299
+    echo $mod_strings['LBL_DIAGNOSTIC_EXECUTING'];
300
+    echo "<BR>";
301 301
 
302 302
 
303
-	//determine if files.md5 exists or not
304
-	if(file_exists('files.md5'))
305
-		$skip_md5_diff = false;
306
-	else
307
-		$skip_md5_diff = true;
303
+    //determine if files.md5 exists or not
304
+    if(file_exists('files.md5'))
305
+        $skip_md5_diff = false;
306
+    else
307
+        $skip_md5_diff = true;
308 308
 
309
-	// array of all tables that we need to pull rows from below
310
-	$getDumpsFrom = array('config' => 'config',
311
-	                      'fields_meta_data' => 'fields_meta_data',
312
-	                      'upgrade_history' => 'upgrade_history',
313
-	                      'versions' => 'versions',
314
-	                      );
309
+    // array of all tables that we need to pull rows from below
310
+    $getDumpsFrom = array('config' => 'config',
311
+                            'fields_meta_data' => 'fields_meta_data',
312
+                            'upgrade_history' => 'upgrade_history',
313
+                            'versions' => 'versions',
314
+                            );
315 315
 
316 316
 
317
-	//Creates the diagnostic directory in the cache directory
317
+    //Creates the diagnostic directory in the cache directory
318 318
     $cacheDir = create_cache_directory("diagnostic/");
319 319
     $cacheDir = create_cache_directory("diagnostic/".$sod_guid);
320 320
     $cacheDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/");
321 321
 
322
-	display_progress_bar("diagnostic", $progress_bar_percent, 100);
322
+    display_progress_bar("diagnostic", $progress_bar_percent, 100);
323 323
 
324
-	ob_flush();
324
+    ob_flush();
325 325
 }
326 326
 
327 327
 function executesugarlog()
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
     //BEGIN COPY SUGARCRM.LOG
330 330
     //Copies the Sugarcrm log to our diagnostic directory
331 331
     global $cacheDir;
332
-	require_once('include/SugarLogger/SugarLogger.php');
333
-	$logger = new SugarLogger();
332
+    require_once('include/SugarLogger/SugarLogger.php');
333
+    $logger = new SugarLogger();
334 334
     if(!copy($logger->getLogFileNameWithPath(), $cacheDir.'/'.$logger->getLogFileName())) {
335
-      echo "Couldn't copy suitecrm.log to cacheDir.<br>";
335
+        echo "Couldn't copy suitecrm.log to cacheDir.<br>";
336 336
     }
337 337
     //END COPY SUGARCRM.LOG
338 338
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
     $handle = sugar_fopen($cacheDir."phpinfo.html", "w");
355 355
     if(fwrite($handle, $phpinfo) === FALSE){
356
-      echo "Cannot write to file ".$cacheDir."phpinfo.html<br>";
356
+        echo "Cannot write to file ".$cacheDir."phpinfo.html<br>";
357 357
     }
358 358
     fclose($handle);
359 359
     //END GETPHPINFO
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
     //create directory for table definitions
395 395
     if($getschema)
396
-      $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/");
396
+        $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/");
397 397
 
398 398
     //make sure they checked the box to get basic info
399 399
     if($getinfo)
@@ -483,36 +483,36 @@  discard block
 block discarded – undo
483 483
         foreach($all_tables as $tablename){
484 484
             $cols = $db->get_columns($tablename);
485 485
             $indexes = $db->get_indices($tablename);
486
-			//setting up table header for each file
486
+            //setting up table header for each file
487 487
             $contents .= array_as_table("{$db->dbName} $tablename Definitions:", $cols);
488 488
             $contents .= array_as_table("{$db->dbName} $tablename Keys:", $indexes);
489
-			$contents .= "<BR><BR>";
490
-		}
489
+            $contents .= "<BR><BR>";
490
+        }
491 491
 
492 492
         file_put_contents($tablesSchemaDir."{$db->dbName}TablesSchema.html", $contents);
493
-		//END GET ALL TABLES SCHEMAS
494
-		//BEGIN UPDATING PROGRESS BAR
495
-		sodUpdateProgressBar(SQL_SCHEMA_WEIGHT);
496
-		//END UPDATING PROGRESS BAR
493
+        //END GET ALL TABLES SCHEMAS
494
+        //BEGIN UPDATING PROGRESS BAR
495
+        sodUpdateProgressBar(SQL_SCHEMA_WEIGHT);
496
+        //END UPDATING PROGRESS BAR
497 497
     }
498 498
 
499 499
     if($getdumps)
500 500
     {
501
-		//BEGIN GET TABLEDUMPS
502
-		$tableDumpsDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableDumps/");
501
+        //BEGIN GET TABLEDUMPS
502
+        $tableDumpsDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableDumps/");
503 503
 
504 504
 
505
-		foreach ($getDumpsFrom as $table)
506
-		{
507
-			//calling function defined above to get the string for dump
508
-			$contents = $style .getFullTableDump($table);
505
+        foreach ($getDumpsFrom as $table)
506
+        {
507
+            //calling function defined above to get the string for dump
508
+            $contents = $style .getFullTableDump($table);
509 509
             file_put_contents($tableDumpsDir.$table.".html", $contents);
510
-		}
511
-		//END GET TABLEDUMPS
512
-		//BEGIN UPDATING PROGRESS BAR
513
-		sodUpdateProgressBar(SQL_DUMPS_WEIGHT);
514
-		//END UPDATING PROGRESS BAR
515
-	}
510
+        }
511
+        //END GET TABLEDUMPS
512
+        //BEGIN UPDATING PROGRESS BAR
513
+        sodUpdateProgressBar(SQL_DUMPS_WEIGHT);
514
+        //END UPDATING PROGRESS BAR
515
+    }
516 516
     //END GET DB INFO
517 517
 }
518 518
 
@@ -542,27 +542,27 @@  discard block
 block discarded – undo
542 542
     echo "</font>";
543 543
     echo "<BR><BR>";
544 544
 
545
-	foreach ($beanList as $beanz)
546
-	{
547
-		if(!isset($beanFiles[$beanz]))
548
-		{
549
-			echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>";
550
-		}
551
-		else
552
-		{
553
-			if(file_exists($beanFiles[$beanz]))
554
-				echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>";
555
-			else
556
-				echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>";
557
-		}
558
-	}
559
-
560
-	$content = ob_get_contents();
561
-	ob_clean();
562
-
563
-	$handle = sugar_fopen($cacheDir."beanFiles.html", "w");
564
-	if(fwrite($handle, $content) === FALSE){
565
-    	echo "Cannot write to file ".$cacheDir."beanFiles.html<br>";
545
+    foreach ($beanList as $beanz)
546
+    {
547
+        if(!isset($beanFiles[$beanz]))
548
+        {
549
+            echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>";
550
+        }
551
+        else
552
+        {
553
+            if(file_exists($beanFiles[$beanz]))
554
+                echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>";
555
+            else
556
+                echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>";
557
+        }
558
+    }
559
+
560
+    $content = ob_get_contents();
561
+    ob_clean();
562
+
563
+    $handle = sugar_fopen($cacheDir."beanFiles.html", "w");
564
+    if(fwrite($handle, $content) === FALSE){
565
+        echo "Cannot write to file ".$cacheDir."beanFiles.html<br>";
566 566
     }
567 567
     fclose($handle);
568 568
     //END CHECK BEANLIST FILES ARE AVAILABLE
@@ -585,38 +585,38 @@  discard block
 block discarded – undo
585 585
 
586 586
 function executemd5($filesmd5, $md5calculated)
587 587
 {
588
-	//BEGIN ALL MD5 CHECKS
589
-	global $curdatetime;
590
-	global $skip_md5_diff;
591
-	global $sod_guid;
592
-	if(file_exists('files.md5'))
588
+    //BEGIN ALL MD5 CHECKS
589
+    global $curdatetime;
590
+    global $skip_md5_diff;
591
+    global $sod_guid;
592
+    if(file_exists('files.md5'))
593 593
         include( 'files.md5');
594
-	//create dir for md5s
595
-	$md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/");
594
+    //create dir for md5s
595
+    $md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/");
596 596
 
597
-	//skip this if the files.md5 didn't exist
598
-	if(!$skip_md5_diff)
599
-	{
600
-		//make sure the files.md5
601
-		if($filesmd5)
602
-			if(!copy('files.md5', $md5_directory."files.md5"))
603
-				echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>";
604
-	}
597
+    //skip this if the files.md5 didn't exist
598
+    if(!$skip_md5_diff)
599
+    {
600
+        //make sure the files.md5
601
+        if($filesmd5)
602
+            if(!copy('files.md5', $md5_directory."files.md5"))
603
+                echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>";
604
+    }
605 605
 
606
-	$md5_string_calculated = generateMD5array('./');
606
+    $md5_string_calculated = generateMD5array('./');
607 607
 
608
-	if($md5calculated)
609
-		write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php");
608
+    if($md5calculated)
609
+        write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php");
610 610
 
611 611
 
612
-	//if the files.md5 didn't exist, we can't do this
613
-	if(!$skip_md5_diff)
614
-	{
615
-		$md5_string_diff = array_diff($md5_string_calculated, $md5_string);
612
+    //if the files.md5 didn't exist, we can't do this
613
+    if(!$skip_md5_diff)
614
+    {
615
+        $md5_string_diff = array_diff($md5_string_calculated, $md5_string);
616 616
 
617
-		write_array_to_file('md5_string_diff', $md5_string_diff, $md5_directory."md5_array_diff.php");
618
-	}
619
-	//END ALL MD5 CHECKS
617
+        write_array_to_file('md5_string_diff', $md5_string_diff, $md5_directory."md5_array_diff.php");
618
+    }
619
+    //END ALL MD5 CHECKS
620 620
     //BEGIN UPDATING PROGRESS BAR
621 621
     sodUpdateProgressBar(MD5_WEIGHT);
622 622
     //END UPDATING PROGRESS BAR
@@ -639,14 +639,14 @@  discard block
 block discarded – undo
639 639
 
640 640
     ob_start();
641 641
     foreach ( $beanList as $beanz ) {
642
-      // echo "Module: ".$beanz."<br>";
643
-
644
-	$path_parts = pathinfo( $beanFiles[ $beanz ] );
645
-	$vardefFileName = $path_parts[ 'dirname' ]."/vardefs.php";
646
-	  if( file_exists( $vardefFileName )) {
647
-	    // echo "<br>".$vardefFileName."<br>";
648
-      }
649
-      include_once( $vardefFileName );
642
+        // echo "Module: ".$beanz."<br>";
643
+
644
+    $path_parts = pathinfo( $beanFiles[ $beanz ] );
645
+    $vardefFileName = $path_parts[ 'dirname' ]."/vardefs.php";
646
+        if( file_exists( $vardefFileName )) {
647
+        // echo "<br>".$vardefFileName."<br>";
648
+        }
649
+        include_once( $vardefFileName );
650 650
     }
651 651
 
652 652
     echo "<html lang='en'>";
@@ -659,22 +659,22 @@  discard block
 block discarded – undo
659 659
 
660 660
     $tables = array();
661 661
     foreach($dictionary as $vardef) {
662
-	$tables[] = $vardef['table'];
663
-	$fields[$vardef['table']] = $vardef['fields'];
664
-	$comments[$vardef['table']] = $vardef['comment'];
662
+    $tables[] = $vardef['table'];
663
+    $fields[$vardef['table']] = $vardef['fields'];
664
+    $comments[$vardef['table']] = $vardef['comment'];
665 665
     }
666 666
 
667 667
     asort($tables);
668 668
 
669 669
     foreach($tables as $t) {
670
-	$name = $t;
671
-	if ( $name == "does_not_exist" )
672
-	  continue;
673
-	$comment = $comments[$t];
674
-	echo "<h2>Table: $t</h2>
670
+    $name = $t;
671
+    if ( $name == "does_not_exist" )
672
+        continue;
673
+    $comment = $comments[$t];
674
+    echo "<h2>Table: $t</h2>
675 675
 		<p><i>{$comment}</i></p>";
676
-	echo "<table border=\"0\" cellpadding=\"3\" class=\"tabDetailView\">";
677
-	echo '<TR BGCOLOR="#DFDFDF">
676
+    echo "<table border=\"0\" cellpadding=\"3\" class=\"tabDetailView\">";
677
+    echo '<TR BGCOLOR="#DFDFDF">
678 678
 		<TD NOWRAP ALIGN=left class=\"tabDetailViewDL\">Column</TD>
679 679
 		<TD NOWRAP class=\"tabDetailViewDL\">Type</TD>
680 680
 		<TD NOWRAP class=\"tabDetailViewDL\">Length</TD>
@@ -682,36 +682,36 @@  discard block
 block discarded – undo
682 682
 		<TD NOWRAP class=\"tabDetailViewDL\">Comment</TD>
683 683
 	</TR>';
684 684
 
685
-	ksort( $fields[ $t ] );
686
-
687
-	foreach($fields[$t] as $k => $v) {
688
-	  // we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' )
689
-	  if ( isset( $v[ 'source' ] ))
690
-	    continue;
691
-	  $columnname = $v[ 'name' ];
692
-	  $columntype = $v[ 'type' ];
693
-	  $columndbtype = $v[ 'dbType' ];
694
-	  $columnlen = $v[ 'len' ];
695
-	  $columncomment = $v[ 'comment' ];
696
-	  $columnrequired = $v[ 'required' ];
697
-
698
-	  if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>';
699
-	  if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>';
700
-	  if ( !empty( $columndbtype ) ) $columntype = $columndbtype;
701
-	  if ( empty( $columnrequired ) || ( $columnrequired == false ))
702
-	    $columndisplayrequired = 'no';
703
-	  else
704
-	    $columndisplayrequired = 'yes';
705
-
706
-	  echo '<TR BGCOLOR="#FFFFFF" ALIGN=left>
685
+    ksort( $fields[ $t ] );
686
+
687
+    foreach($fields[$t] as $k => $v) {
688
+        // we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' )
689
+        if ( isset( $v[ 'source' ] ))
690
+        continue;
691
+        $columnname = $v[ 'name' ];
692
+        $columntype = $v[ 'type' ];
693
+        $columndbtype = $v[ 'dbType' ];
694
+        $columnlen = $v[ 'len' ];
695
+        $columncomment = $v[ 'comment' ];
696
+        $columnrequired = $v[ 'required' ];
697
+
698
+        if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>';
699
+        if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>';
700
+        if ( !empty( $columndbtype ) ) $columntype = $columndbtype;
701
+        if ( empty( $columnrequired ) || ( $columnrequired == false ))
702
+        $columndisplayrequired = 'no';
703
+        else
704
+        $columndisplayrequired = 'yes';
705
+
706
+        echo '<TR BGCOLOR="#FFFFFF" ALIGN=left>
707 707
 			<TD ALIGN=left class=\"tabDetailViewDF\">'.$columnname.'</TD>
708 708
 	  		<TD NOWRAP class=\"tabDetailViewDF\">'.$columntype.'</TD>
709 709
 			<TD NOWRAP class=\"tabDetailViewDF\">'.$columnlen.'</TD>
710 710
 			<TD NOWRAP class=\"tabDetailViewDF"\">'.$columndisplayrequired.'</TD>
711 711
 			<TD WRAP class=\"tabDetailViewDF\">'.$columncomment.'</TD></TR>';
712
-	}
712
+    }
713 713
 
714
-	echo "</table></p>";
714
+    echo "</table></p>";
715 715
     }
716 716
 
717 717
     echo "</body></html>";
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 
722 722
     $handle = sugar_fopen($cacheDir."vardefschema.html", "w");
723 723
     if(fwrite($handle, $vardefFormattedOutput) === FALSE){
724
-      echo "Cannot write to file ".$cacheDir."vardefschema.html<br>";
724
+        echo "Cannot write to file ".$cacheDir."vardefschema.html<br>";
725 725
     }
726 726
     fclose($handle);
727 727
     sodUpdateProgressBar(VARDEFS_WEIGHT);
@@ -729,23 +729,23 @@  discard block
 block discarded – undo
729 729
 }
730 730
 
731 731
 function finishDiag(){
732
-	//BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT
733
-	global $cacheDir;
734
-	global $curdatetime;
735
-	global $sod_guid;
736
-	global $mod_strings;
737
-
738
-	chdir($cacheDir);
739
-	zip_dir(".", "../diagnostic".$curdatetime.".zip");
740
-	//END ZIP ALL FILES AND EXTRACT IN CACHE ROOT
741
-	chdir(RETURN_FROM_DIAG_DIR);
742
-
743
-	deleteDir($cacheDir);
732
+    //BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT
733
+    global $cacheDir;
734
+    global $curdatetime;
735
+    global $sod_guid;
736
+    global $mod_strings;
737
+
738
+    chdir($cacheDir);
739
+    zip_dir(".", "../diagnostic".$curdatetime.".zip");
740
+    //END ZIP ALL FILES AND EXTRACT IN CACHE ROOT
741
+    chdir(RETURN_FROM_DIAG_DIR);
742
+
743
+    deleteDir($cacheDir);
744 744
 	
745 745
 	
746
-	print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid=$sod_guid&time=$curdatetime&to_pdf=1\">".$mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK']."</a><BR>";
746
+    print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid=$sod_guid&time=$curdatetime&to_pdf=1\">".$mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK']."</a><BR>";
747 747
 
748
-	print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic".$curdatetime."&guid=".$sod_guid."\">".$mod_strings['LBL_DIAGNOSTIC_DELETELINK']."</a><br>";
748
+    print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic".$curdatetime."&guid=".$sod_guid."\">".$mod_strings['LBL_DIAGNOSTIC_DELETELINK']."</a><br>";
749 749
 
750 750
 }
751 751
 
@@ -786,55 +786,55 @@  discard block
 block discarded – undo
786 786
 
787 787
 if($doconfigphp)
788 788
 {
789
-  echo $mod_strings['LBL_DIAGNOSTIC_GETCONFPHP']."<BR>";
790
-  executeconfigphp();
791
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
789
+    echo $mod_strings['LBL_DIAGNOSTIC_GETCONFPHP']."<BR>";
790
+    executeconfigphp();
791
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
792 792
 }
793 793
 if($docustom_dir)
794 794
 {
795
-  echo $mod_strings['LBL_DIAGNOSTIC_GETCUSTDIR']."<BR>";
796
-  executecustom_dir();
797
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
795
+    echo $mod_strings['LBL_DIAGNOSTIC_GETCUSTDIR']."<BR>";
796
+    executecustom_dir();
797
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
798 798
 }
799 799
 if($dophpinfo)
800 800
 {
801
-  echo $mod_strings['LBL_DIAGNOSTIC_GETPHPINFO']."<BR>";
802
-  executephpinfo();
803
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
801
+    echo $mod_strings['LBL_DIAGNOSTIC_GETPHPINFO']."<BR>";
802
+    executephpinfo();
803
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
804 804
 }
805 805
 if($domysql_info || $domysql_dumps || $domysql_schema)
806 806
 {
807
-  echo $mod_strings['LBL_DIAGNOSTIC_GETTING'].
808
-                 ($domysql_info ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLINFO'] : " ").
809
-                 ($domysql_dumps ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTD'] : " ").
810
-                 ($domysql_schema ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTS'] : "...").
811
-                 "<BR>";
812
-  execute_sql($domysql_info, $domysql_dumps, $domysql_schema);
813
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
807
+    echo $mod_strings['LBL_DIAGNOSTIC_GETTING'].
808
+                    ($domysql_info ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLINFO'] : " ").
809
+                    ($domysql_dumps ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTD'] : " ").
810
+                    ($domysql_schema ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTS'] : "...").
811
+                    "<BR>";
812
+    execute_sql($domysql_info, $domysql_dumps, $domysql_schema);
813
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
814 814
 }
815 815
 if($domd5)
816 816
 {
817
-  echo $mod_strings['LBL_DIAGNOSTIC_GETMD5INFO']."<BR>";
818
-  executemd5($domd5filesmd5, $domd5calculated);
819
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
817
+    echo $mod_strings['LBL_DIAGNOSTIC_GETMD5INFO']."<BR>";
818
+    executemd5($domd5filesmd5, $domd5calculated);
819
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
820 820
 }
821 821
 if($dobeanlistbeanfiles)
822 822
 {
823
-  echo $mod_strings['LBL_DIAGNOSTIC_GETBEANFILES']."<BR>";
824
-  executebeanlistbeanfiles();
825
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
823
+    echo $mod_strings['LBL_DIAGNOSTIC_GETBEANFILES']."<BR>";
824
+    executebeanlistbeanfiles();
825
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
826 826
 }
827 827
 if($dosugarlog)
828 828
 {
829
-  echo $mod_strings['LBL_DIAGNOSTIC_GETSUGARLOG']."<BR>";
830
-  executesugarlog();
831
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
829
+    echo $mod_strings['LBL_DIAGNOSTIC_GETSUGARLOG']."<BR>";
830
+    executesugarlog();
831
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
832 832
 }
833 833
 if($dovardefs)
834 834
 {
835
-  echo $mod_strings['LBL_DIAGNOSTIC_VARDEFS']."<BR>";
836
-  executevardefs();
837
-  echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
835
+    echo $mod_strings['LBL_DIAGNOSTIC_VARDEFS']."<BR>";
836
+    executevardefs();
837
+    echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
838 838
 }
839 839
 
840 840
 //finish up the last steps
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 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,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 
44
-require_once( 'include/utils/progress_bar_utils.php' );
45
-require_once( 'include/utils/zip_utils.php' );
44
+require_once('include/utils/progress_bar_utils.php');
45
+require_once('include/utils/zip_utils.php');
46 46
 
47 47
 global $current_user;
48 48
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 
68 68
 
69 69
 global $db;
70
-if(empty($db)) {
70
+if (empty($db)) {
71 71
 
72 72
 	$db = DBManagerFactory::getInstance();
73 73
 }
74 74
 
75 75
 global $current_user;
76
-if(!is_admin($current_user)){
76
+if (!is_admin($current_user)) {
77 77
 	die($mod_strings['LBL_DIAGNOSTIC_ACCESS']);
78 78
 }
79 79
 global $sugar_config;
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
 global $cacheDir;
125 125
 $cacheDir = "";
126 126
 
127
-function sodUpdateProgressBar($itemweight){
127
+function sodUpdateProgressBar($itemweight) {
128 128
     global $progress_bar_percent;
129 129
     global $totalweight;
130 130
     global $totalitems;
131 131
     global $currentitems;
132 132
 
133 133
     $currentitems++;
134
-    if($currentitems == $totalitems)
134
+    if ($currentitems == $totalitems)
135 135
       update_progress_bar("diagnostic", 100, 100);
136 136
     else
137 137
     {
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 {
152 152
     $contents = "<table border=\"0\" cellpadding=\"0\" class=\"tabDetailView\">";
153 153
     $keys = array();
154
-    foreach($values as $field) {
154
+    foreach ($values as $field) {
155 155
         $keys = array_unique($keys + array_keys($field));
156 156
     }
157 157
     $cols = count($keys);
158 158
 
159 159
     $contents .= "<tr colspan=\"$cols\">$header</tr><tr>";
160
-    foreach($keys as $key) {
160
+    foreach ($keys as $key) {
161 161
        $contents .= "<th class=\"tabDetailViewDL\"><b>$key</b></th>";
162 162
     }
163 163
     $contents .= "</tr>";
164
-    foreach($values as $field) {
164
+    foreach ($values as $field) {
165 165
         $contents .= "<tr>";
166
-        foreach($field as $item) {
167
-            if(is_array($item)) {
166
+        foreach ($field as $item) {
167
+            if (is_array($item)) {
168 168
                 $item = join(",", $item);
169 169
             }
170 170
             $contents .= "<td class=\"tabDetailViewDF\">$item</td>";
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 // expects a string containing the name of the table you would like to get the dump of
179 179
 // expects there to already be a connection to the db and the 'use database_name' to be done
180 180
 // returns a string containing (in html) the dump of all rows
181
-function getFullTableDump($tableName){
181
+function getFullTableDump($tableName) {
182 182
 
183 183
 	global $db;
184 184
 
@@ -193,28 +193,28 @@  discard block
 block discarded – undo
193 193
     $def_count = count($cols);
194 194
 
195 195
 	$td_result = $db->query("select * from ".$tableName);
196
-    if(!$td_result) {
196
+    if (!$td_result) {
197 197
         return $db->lastError();
198 198
     }
199 199
     $returnString .= "<table border=\"0\" cellpadding=\"0\" class=\"tabDetailView\"><tr><th class=\"tabDetailViewDL\">#</th>";
200 200
     $fields = $db->getFieldsArray($td_result);
201
-    foreach($fields as $field) {
201
+    foreach ($fields as $field) {
202 202
         $returnString .= "<th class=\"tabDetailViewDL\">$field</th>";
203 203
 
204 204
     }
205 205
     $returnString .= "</tr>";
206 206
     $row_counter = 1;
207
-	while($row = $db->fetchByAssoc($td_result))
207
+	while ($row = $db->fetchByAssoc($td_result))
208 208
 	{
209 209
 		$row = array_values($row);
210 210
 		$returnString .= "<tr>";
211 211
 		$returnString .= "<td class=\"tabDetailViewDL\">".$row_counter."</td>";
212
-		for($counter = 0; $counter < $def_count; $counter++) {
212
+		for ($counter = 0; $counter < $def_count; $counter++) {
213 213
             $replace_val = false;
214 214
 			//perform this check when counter is set to two, which means it is on the 'value' column
215
-			if($counter == 2) {
215
+			if ($counter == 2) {
216 216
 				//if the previous "name" column value was set to smtppass, set replace_val to true
217
-				if(strcmp($row[$counter - 1], "smtppass") == 0  )
217
+				if (strcmp($row[$counter - 1], "smtppass") == 0)
218 218
 					$replace_val = true;
219 219
 
220 220
 				//if the previous "name" column value was set to smtppass,
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 
225 225
 				//if the previous "name" column value was set to password,
226 226
 				//and the "category" value set to proxy, set replace_val to true
227
-				if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 )
227
+				if (strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0)
228 228
 					$replace_val = true;
229 229
 			}
230 230
 
231
-			if($replace_val) {
231
+			if ($replace_val) {
232 232
 					$returnString .= "<td class=\"tabDetailViewDF\">********</td>";
233 233
             } else {
234 234
 					$returnString .= "<td class=\"tabDetailViewDF\">".($row[$counter] == "" ? "&nbsp;" : $row[$counter])."</td>";
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 // Deletes the directory recursively
246 246
 function deleteDir($dir)
247 247
 {
248
-   if (substr($dir, strlen($dir)-1, 1) != '/')
248
+   if (substr($dir, strlen($dir) - 1, 1) != '/')
249 249
        $dir .= '/';
250 250
 
251 251
    if ($handle = opendir($dir))
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 
303 303
 	//determine if files.md5 exists or not
304
-	if(file_exists('files.md5'))
304
+	if (file_exists('files.md5'))
305 305
 		$skip_md5_diff = false;
306 306
 	else
307 307
 		$skip_md5_diff = true;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
     global $cacheDir;
332 332
 	require_once('include/SugarLogger/SugarLogger.php');
333 333
 	$logger = new SugarLogger();
334
-    if(!copy($logger->getLogFileNameWithPath(), $cacheDir.'/'.$logger->getLogFileName())) {
334
+    if (!copy($logger->getLogFileNameWithPath(), $cacheDir.'/'.$logger->getLogFileName())) {
335 335
       echo "Couldn't copy suitecrm.log to cacheDir.<br>";
336 336
     }
337 337
     //END COPY SUGARCRM.LOG
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     ob_clean();
353 353
 
354 354
     $handle = sugar_fopen($cacheDir."phpinfo.html", "w");
355
-    if(fwrite($handle, $phpinfo) === FALSE){
355
+    if (fwrite($handle, $phpinfo) === FALSE) {
356 356
       echo "Cannot write to file ".$cacheDir."phpinfo.html<br>";
357 357
     }
358 358
     fclose($handle);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 {
367 367
     //BEGIN COPY CONFIG.PHP
368 368
     //store db_password in temp var so we can get config.php w/o making anyone angry
369
-    global $cacheDir;    global $sugar_config;
369
+    global $cacheDir; global $sugar_config;
370 370
 
371 371
     $tempPass = $sugar_config['dbconfig']['db_password'];
372 372
     $sugar_config['dbconfig']['db_password'] = '********';
@@ -392,20 +392,20 @@  discard block
 block discarded – undo
392 392
 
393 393
 
394 394
     //create directory for table definitions
395
-    if($getschema)
395
+    if ($getschema)
396 396
       $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/");
397 397
 
398 398
     //make sure they checked the box to get basic info
399
-    if($getinfo)
399
+    if ($getinfo)
400 400
     {
401 401
         $info = $db->getDbInfo();
402 402
         $content = '';
403
-        if(!empty($info)) {
404
-            foreach($info as $name => $value) {
403
+        if (!empty($info)) {
404
+            foreach ($info as $name => $value) {
405 405
                 $content .= "$name: $value<BR>";
406 406
             }
407 407
         }
408
-        if(!empty($content)) {
408
+        if (!empty($content)) {
409 409
             file_put_contents($sqlInfoDir."{$db->dbName}-General-info.html", $content);
410 410
             sodUpdateProgressBar(SQL_INFO_WEIGHT);
411 411
         }
@@ -473,14 +473,14 @@  discard block
 block discarded – undo
473 473
     text-align:left;
474 474
 }
475 475
     </style>';
476
-    if($getschema)
476
+    if ($getschema)
477 477
     {
478 478
         //BEGIN GET ALL TABLES SCHEMAS
479 479
         $all_tables = $db->getTablesArray();
480 480
 
481 481
         $contents = $style;
482 482
 
483
-        foreach($all_tables as $tablename){
483
+        foreach ($all_tables as $tablename) {
484 484
             $cols = $db->get_columns($tablename);
485 485
             $indexes = $db->get_indices($tablename);
486 486
 			//setting up table header for each file
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		//END UPDATING PROGRESS BAR
497 497
     }
498 498
 
499
-    if($getdumps)
499
+    if ($getdumps)
500 500
     {
501 501
 		//BEGIN GET TABLEDUMPS
502 502
 		$tableDumpsDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableDumps/");
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 		foreach ($getDumpsFrom as $table)
506 506
 		{
507 507
 			//calling function defined above to get the string for dump
508
-			$contents = $style .getFullTableDump($table);
508
+			$contents = $style.getFullTableDump($table);
509 509
             file_put_contents($tableDumpsDir.$table.".html", $contents);
510 510
 		}
511 511
 		//END GET TABLEDUMPS
@@ -544,13 +544,13 @@  discard block
 block discarded – undo
544 544
 
545 545
 	foreach ($beanList as $beanz)
546 546
 	{
547
-		if(!isset($beanFiles[$beanz]))
547
+		if (!isset($beanFiles[$beanz]))
548 548
 		{
549 549
 			echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>";
550 550
 		}
551 551
 		else
552 552
 		{
553
-			if(file_exists($beanFiles[$beanz]))
553
+			if (file_exists($beanFiles[$beanz]))
554 554
 				echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>";
555 555
 			else
556 556
 				echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>";
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	ob_clean();
562 562
 
563 563
 	$handle = sugar_fopen($cacheDir."beanFiles.html", "w");
564
-	if(fwrite($handle, $content) === FALSE){
564
+	if (fwrite($handle, $content) === FALSE) {
565 565
     	echo "Cannot write to file ".$cacheDir."beanFiles.html<br>";
566 566
     }
567 567
     fclose($handle);
@@ -589,28 +589,28 @@  discard block
 block discarded – undo
589 589
 	global $curdatetime;
590 590
 	global $skip_md5_diff;
591 591
 	global $sod_guid;
592
-	if(file_exists('files.md5'))
593
-        include( 'files.md5');
592
+	if (file_exists('files.md5'))
593
+        include('files.md5');
594 594
 	//create dir for md5s
595 595
 	$md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/");
596 596
 
597 597
 	//skip this if the files.md5 didn't exist
598
-	if(!$skip_md5_diff)
598
+	if (!$skip_md5_diff)
599 599
 	{
600 600
 		//make sure the files.md5
601
-		if($filesmd5)
602
-			if(!copy('files.md5', $md5_directory."files.md5"))
601
+		if ($filesmd5)
602
+			if (!copy('files.md5', $md5_directory."files.md5"))
603 603
 				echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>";
604 604
 	}
605 605
 
606 606
 	$md5_string_calculated = generateMD5array('./');
607 607
 
608
-	if($md5calculated)
608
+	if ($md5calculated)
609 609
 		write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php");
610 610
 
611 611
 
612 612
 	//if the files.md5 didn't exist, we can't do this
613
-	if(!$skip_md5_diff)
613
+	if (!$skip_md5_diff)
614 614
 	{
615 615
 		$md5_string_diff = array_diff($md5_string_calculated, $md5_string);
616 616
 
@@ -638,15 +638,15 @@  discard block
 block discarded – undo
638 638
     global $sugar_flavor;
639 639
 
640 640
     ob_start();
641
-    foreach ( $beanList as $beanz ) {
641
+    foreach ($beanList as $beanz) {
642 642
       // echo "Module: ".$beanz."<br>";
643 643
 
644
-	$path_parts = pathinfo( $beanFiles[ $beanz ] );
645
-	$vardefFileName = $path_parts[ 'dirname' ]."/vardefs.php";
646
-	  if( file_exists( $vardefFileName )) {
644
+	$path_parts = pathinfo($beanFiles[$beanz]);
645
+	$vardefFileName = $path_parts['dirname']."/vardefs.php";
646
+	  if (file_exists($vardefFileName)) {
647 647
 	    // echo "<br>".$vardefFileName."<br>";
648 648
       }
649
-      include_once( $vardefFileName );
649
+      include_once($vardefFileName);
650 650
     }
651 651
 
652 652
     echo "<html lang='en'>";
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
     echo "<style> th { text-align: left; } </style>";
659 659
 
660 660
     $tables = array();
661
-    foreach($dictionary as $vardef) {
661
+    foreach ($dictionary as $vardef) {
662 662
 	$tables[] = $vardef['table'];
663 663
 	$fields[$vardef['table']] = $vardef['fields'];
664 664
 	$comments[$vardef['table']] = $vardef['comment'];
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
 
667 667
     asort($tables);
668 668
 
669
-    foreach($tables as $t) {
669
+    foreach ($tables as $t) {
670 670
 	$name = $t;
671
-	if ( $name == "does_not_exist" )
671
+	if ($name == "does_not_exist")
672 672
 	  continue;
673 673
 	$comment = $comments[$t];
674 674
 	echo "<h2>Table: $t</h2>
@@ -682,23 +682,23 @@  discard block
 block discarded – undo
682 682
 		<TD NOWRAP class=\"tabDetailViewDL\">Comment</TD>
683 683
 	</TR>';
684 684
 
685
-	ksort( $fields[ $t ] );
685
+	ksort($fields[$t]);
686 686
 
687
-	foreach($fields[$t] as $k => $v) {
687
+	foreach ($fields[$t] as $k => $v) {
688 688
 	  // we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' )
689
-	  if ( isset( $v[ 'source' ] ))
689
+	  if (isset($v['source']))
690 690
 	    continue;
691
-	  $columnname = $v[ 'name' ];
692
-	  $columntype = $v[ 'type' ];
693
-	  $columndbtype = $v[ 'dbType' ];
694
-	  $columnlen = $v[ 'len' ];
695
-	  $columncomment = $v[ 'comment' ];
696
-	  $columnrequired = $v[ 'required' ];
697
-
698
-	  if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>';
699
-	  if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>';
700
-	  if ( !empty( $columndbtype ) ) $columntype = $columndbtype;
701
-	  if ( empty( $columnrequired ) || ( $columnrequired == false ))
691
+	  $columnname = $v['name'];
692
+	  $columntype = $v['type'];
693
+	  $columndbtype = $v['dbType'];
694
+	  $columnlen = $v['len'];
695
+	  $columncomment = $v['comment'];
696
+	  $columnrequired = $v['required'];
697
+
698
+	  if (empty($columnlen)) $columnlen = '<i>n/a</i>';
699
+	  if (empty($columncomment)) $columncomment = '<i>(none)</i>';
700
+	  if (!empty($columndbtype)) $columntype = $columndbtype;
701
+	  if (empty($columnrequired) || ($columnrequired == false))
702 702
 	    $columndisplayrequired = 'no';
703 703
 	  else
704 704
 	    $columndisplayrequired = 'yes';
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
     ob_clean();
721 721
 
722 722
     $handle = sugar_fopen($cacheDir."vardefschema.html", "w");
723
-    if(fwrite($handle, $vardefFormattedOutput) === FALSE){
723
+    if (fwrite($handle, $vardefFormattedOutput) === FALSE) {
724 724
       echo "Cannot write to file ".$cacheDir."vardefschema.html<br>";
725 725
     }
726 726
     fclose($handle);
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
     //END UPDATING PROGRESS BAR
729 729
 }
730 730
 
731
-function finishDiag(){
731
+function finishDiag() {
732 732
 	//BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT
733 733
 	global $cacheDir;
734 734
 	global $curdatetime;
@@ -768,41 +768,41 @@  discard block
 block discarded – undo
768 768
 //BEGIN items to calculate progress bar
769 769
 $totalitems = 0;
770 770
 $totalweight = 0;
771
-if($doconfigphp) {$totalweight += CONFIG_WEIGHT; $totalitems++;}
772
-if($docustom_dir) {$totalweight += CUSTOM_DIR_WEIGHT; $totalitems++;}
773
-if($dophpinfo) {$totalweight += PHPINFO_WEIGHT; $totalitems++;}
774
-if($domysql_dumps) {$totalweight += SQL_DUMPS_WEIGHT; $totalitems++;}
775
-if($domysql_schema) {$totalweight += SQL_SCHEMA_WEIGHT; $totalitems++;}
776
-if($domysql_info) {$totalweight += SQL_INFO_WEIGHT; $totalitems++;}
777
-if($domd5) {$totalweight += MD5_WEIGHT; $totalitems++;}
778
-if($dobeanlistbeanfiles) {$totalweight += BEANLISTBEANFILES_WEIGHT; $totalitems++;}
779
-if($dosugarlog) {$totalweight += SUGARLOG_WEIGHT; $totalitems++;}
780
-if($dovardefs) {$totalweight += VARDEFS_WEIGHT; $totalitems++;}
771
+if ($doconfigphp) {$totalweight += CONFIG_WEIGHT; $totalitems++; }
772
+if ($docustom_dir) {$totalweight += CUSTOM_DIR_WEIGHT; $totalitems++; }
773
+if ($dophpinfo) {$totalweight += PHPINFO_WEIGHT; $totalitems++; }
774
+if ($domysql_dumps) {$totalweight += SQL_DUMPS_WEIGHT; $totalitems++; }
775
+if ($domysql_schema) {$totalweight += SQL_SCHEMA_WEIGHT; $totalitems++; }
776
+if ($domysql_info) {$totalweight += SQL_INFO_WEIGHT; $totalitems++; }
777
+if ($domd5) {$totalweight += MD5_WEIGHT; $totalitems++; }
778
+if ($dobeanlistbeanfiles) {$totalweight += BEANLISTBEANFILES_WEIGHT; $totalitems++; }
779
+if ($dosugarlog) {$totalweight += SUGARLOG_WEIGHT; $totalitems++; }
780
+if ($dovardefs) {$totalweight += VARDEFS_WEIGHT; $totalitems++; }
781 781
 //END items to calculate progress bar
782 782
 
783 783
 //prepare initial steps
784 784
 prepareDiag();
785 785
 
786 786
 
787
-if($doconfigphp)
787
+if ($doconfigphp)
788 788
 {
789 789
   echo $mod_strings['LBL_DIAGNOSTIC_GETCONFPHP']."<BR>";
790 790
   executeconfigphp();
791 791
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
792 792
 }
793
-if($docustom_dir)
793
+if ($docustom_dir)
794 794
 {
795 795
   echo $mod_strings['LBL_DIAGNOSTIC_GETCUSTDIR']."<BR>";
796 796
   executecustom_dir();
797 797
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
798 798
 }
799
-if($dophpinfo)
799
+if ($dophpinfo)
800 800
 {
801 801
   echo $mod_strings['LBL_DIAGNOSTIC_GETPHPINFO']."<BR>";
802 802
   executephpinfo();
803 803
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
804 804
 }
805
-if($domysql_info || $domysql_dumps || $domysql_schema)
805
+if ($domysql_info || $domysql_dumps || $domysql_schema)
806 806
 {
807 807
   echo $mod_strings['LBL_DIAGNOSTIC_GETTING'].
808 808
                  ($domysql_info ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLINFO'] : " ").
@@ -812,25 +812,25 @@  discard block
 block discarded – undo
812 812
   execute_sql($domysql_info, $domysql_dumps, $domysql_schema);
813 813
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
814 814
 }
815
-if($domd5)
815
+if ($domd5)
816 816
 {
817 817
   echo $mod_strings['LBL_DIAGNOSTIC_GETMD5INFO']."<BR>";
818 818
   executemd5($domd5filesmd5, $domd5calculated);
819 819
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
820 820
 }
821
-if($dobeanlistbeanfiles)
821
+if ($dobeanlistbeanfiles)
822 822
 {
823 823
   echo $mod_strings['LBL_DIAGNOSTIC_GETBEANFILES']."<BR>";
824 824
   executebeanlistbeanfiles();
825 825
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
826 826
 }
827
-if($dosugarlog)
827
+if ($dosugarlog)
828 828
 {
829 829
   echo $mod_strings['LBL_DIAGNOSTIC_GETSUGARLOG']."<BR>";
830 830
   executesugarlog();
831 831
   echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>";
832 832
 }
833
-if($dovardefs)
833
+if ($dovardefs)
834 834
 {
835 835
   echo $mod_strings['LBL_DIAGNOSTIC_VARDEFS']."<BR>";
836 836
   executevardefs();
Please login to merge, or discard this patch.
Braces   +74 added lines, -50 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -47,7 +49,9 @@  discard block
 block discarded – undo
47 49
 global $current_user;
48 50
 
49 51
 
50
-if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
52
+if (!is_admin($current_user)) {
53
+    sugar_die("Unauthorized access to administration.");
54
+}
51 55
 if (isset($GLOBALS['sugar_config']['hide_admin_diagnostics']) && $GLOBALS['sugar_config']['hide_admin_diagnostics'])
52 56
 {
53 57
     sugar_die("Unauthorized access to diagnostic tool.");
@@ -131,9 +135,9 @@  discard block
 block discarded – undo
131 135
     global $currentitems;
132 136
 
133 137
     $currentitems++;
134
-    if($currentitems == $totalitems)
135
-      update_progress_bar("diagnostic", 100, 100);
136
-    else
138
+    if($currentitems == $totalitems) {
139
+          update_progress_bar("diagnostic", 100, 100);
140
+    } else
137 141
     {
138 142
       $progress_bar_percent += ($itemweight / $GLOBALS['totalweight'] * 100);
139 143
       update_progress_bar("diagnostic", $progress_bar_percent, 100);
@@ -214,18 +218,21 @@  discard block
 block discarded – undo
214 218
 			//perform this check when counter is set to two, which means it is on the 'value' column
215 219
 			if($counter == 2) {
216 220
 				//if the previous "name" column value was set to smtppass, set replace_val to true
217
-				if(strcmp($row[$counter - 1], "smtppass") == 0  )
218
-					$replace_val = true;
221
+				if(strcmp($row[$counter - 1], "smtppass") == 0  ) {
222
+									$replace_val = true;
223
+				}
219 224
 
220 225
 				//if the previous "name" column value was set to smtppass,
221 226
 				//and the "category" value set to ldap, set replace_val to true
222
-				if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0)
223
-					$replace_val = true;
227
+				if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0) {
228
+									$replace_val = true;
229
+				}
224 230
 
225 231
 				//if the previous "name" column value was set to password,
226 232
 				//and the "category" value set to proxy, set replace_val to true
227
-				if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 )
228
-					$replace_val = true;
233
+				if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 ) {
234
+									$replace_val = true;
235
+				}
229 236
 			}
230 237
 
231 238
 			if($replace_val) {
@@ -245,8 +252,9 @@  discard block
 block discarded – undo
245 252
 // Deletes the directory recursively
246 253
 function deleteDir($dir)
247 254
 {
248
-   if (substr($dir, strlen($dir)-1, 1) != '/')
249
-       $dir .= '/';
255
+   if (substr($dir, strlen($dir)-1, 1) != '/') {
256
+          $dir .= '/';
257
+   }
250 258
 
251 259
    if ($handle = opendir($dir))
252 260
    {
@@ -256,21 +264,23 @@  discard block
 block discarded – undo
256 264
            {
257 265
                if (is_dir($dir.$obj))
258 266
                {
259
-                   if (!deleteDir($dir.$obj))
260
-                       return false;
261
-               }
262
-               elseif (is_file($dir.$obj))
267
+                   if (!deleteDir($dir.$obj)) {
268
+                                          return false;
269
+                   }
270
+               } elseif (is_file($dir.$obj))
263 271
                {
264
-                   if (!unlink($dir.$obj))
265
-                       return false;
272
+                   if (!unlink($dir.$obj)) {
273
+                                          return false;
274
+                   }
266 275
                }
267 276
            }
268 277
        }
269 278
 
270 279
        closedir($handle);
271 280
 
272
-       if (!@rmdir($dir))
273
-           return false;
281
+       if (!@rmdir($dir)) {
282
+                  return false;
283
+       }
274 284
        return true;
275 285
    }
276 286
    return false;
@@ -301,10 +311,11 @@  discard block
 block discarded – undo
301 311
 
302 312
 
303 313
 	//determine if files.md5 exists or not
304
-	if(file_exists('files.md5'))
305
-		$skip_md5_diff = false;
306
-	else
307
-		$skip_md5_diff = true;
314
+	if(file_exists('files.md5')) {
315
+			$skip_md5_diff = false;
316
+	} else {
317
+			$skip_md5_diff = true;
318
+	}
308 319
 
309 320
 	// array of all tables that we need to pull rows from below
310 321
 	$getDumpsFrom = array('config' => 'config',
@@ -392,8 +403,9 @@  discard block
 block discarded – undo
392 403
 
393 404
 
394 405
     //create directory for table definitions
395
-    if($getschema)
396
-      $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/");
406
+    if($getschema) {
407
+          $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/");
408
+    }
397 409
 
398 410
     //make sure they checked the box to get basic info
399 411
     if($getinfo)
@@ -547,13 +559,13 @@  discard block
 block discarded – undo
547 559
 		if(!isset($beanFiles[$beanz]))
548 560
 		{
549 561
 			echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>";
550
-		}
551
-		else
562
+		} else
552 563
 		{
553
-			if(file_exists($beanFiles[$beanz]))
554
-				echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>";
555
-			else
556
-				echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>";
564
+			if(file_exists($beanFiles[$beanz])) {
565
+							echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>";
566
+			} else {
567
+							echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>";
568
+			}
557 569
 		}
558 570
 	}
559 571
 
@@ -589,8 +601,9 @@  discard block
 block discarded – undo
589 601
 	global $curdatetime;
590 602
 	global $skip_md5_diff;
591 603
 	global $sod_guid;
592
-	if(file_exists('files.md5'))
593
-        include( 'files.md5');
604
+	if(file_exists('files.md5')) {
605
+	        include( 'files.md5');
606
+	}
594 607
 	//create dir for md5s
595 608
 	$md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/");
596 609
 
@@ -598,15 +611,17 @@  discard block
 block discarded – undo
598 611
 	if(!$skip_md5_diff)
599 612
 	{
600 613
 		//make sure the files.md5
601
-		if($filesmd5)
602
-			if(!copy('files.md5', $md5_directory."files.md5"))
614
+		if($filesmd5) {
615
+					if(!copy('files.md5', $md5_directory."files.md5"))
603 616
 				echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>";
617
+		}
604 618
 	}
605 619
 
606 620
 	$md5_string_calculated = generateMD5array('./');
607 621
 
608
-	if($md5calculated)
609
-		write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php");
622
+	if($md5calculated) {
623
+			write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php");
624
+	}
610 625
 
611 626
 
612 627
 	//if the files.md5 didn't exist, we can't do this
@@ -668,8 +683,9 @@  discard block
 block discarded – undo
668 683
 
669 684
     foreach($tables as $t) {
670 685
 	$name = $t;
671
-	if ( $name == "does_not_exist" )
672
-	  continue;
686
+	if ( $name == "does_not_exist" ) {
687
+		  continue;
688
+	}
673 689
 	$comment = $comments[$t];
674 690
 	echo "<h2>Table: $t</h2>
675 691
 		<p><i>{$comment}</i></p>";
@@ -686,8 +702,9 @@  discard block
 block discarded – undo
686 702
 
687 703
 	foreach($fields[$t] as $k => $v) {
688 704
 	  // we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' )
689
-	  if ( isset( $v[ 'source' ] ))
690
-	    continue;
705
+	  if ( isset( $v[ 'source' ] )) {
706
+	  	    continue;
707
+	  }
691 708
 	  $columnname = $v[ 'name' ];
692 709
 	  $columntype = $v[ 'type' ];
693 710
 	  $columndbtype = $v[ 'dbType' ];
@@ -695,13 +712,20 @@  discard block
 block discarded – undo
695 712
 	  $columncomment = $v[ 'comment' ];
696 713
 	  $columnrequired = $v[ 'required' ];
697 714
 
698
-	  if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>';
699
-	  if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>';
700
-	  if ( !empty( $columndbtype ) ) $columntype = $columndbtype;
701
-	  if ( empty( $columnrequired ) || ( $columnrequired == false ))
702
-	    $columndisplayrequired = 'no';
703
-	  else
704
-	    $columndisplayrequired = 'yes';
715
+	  if ( empty( $columnlen ) ) {
716
+	      $columnlen = '<i>n/a</i>';
717
+	  }
718
+	  if ( empty( $columncomment ) ) {
719
+	      $columncomment = '<i>(none)</i>';
720
+	  }
721
+	  if ( !empty( $columndbtype ) ) {
722
+	      $columntype = $columndbtype;
723
+	  }
724
+	  if ( empty( $columnrequired ) || ( $columnrequired == false )) {
725
+	  	    $columndisplayrequired = 'no';
726
+	  } else {
727
+	  	    $columndisplayrequired = 'yes';
728
+	  }
705 729
 
706 730
 	  echo '<TR BGCOLOR="#FFFFFF" ALIGN=left>
707 731
 			<TD ALIGN=left class=\"tabDetailViewDF\">'.$columnname.'</TD>
Please login to merge, or discard this patch.
modules/Administration/RepairSeedUsers.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,27 +42,27 @@  discard block
 block discarded – undo
42 42
 
43 43
 if(is_admin($current_user)){
44 44
     if(count($_POST)){
45
-    	if(!empty($_POST['activate'])){
45
+        if(!empty($_POST['activate'])){
46 46
 
47
-    		$status = '';
48
-    		if($_POST['activate'] == 'false'){
49
-    			$status = 'Inactive';
50
-    		}else{
51
-    			$status = 'Active';
52
-    		}
53
-    	}
54
-    	$query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'";
55
-   		$GLOBALS['db']->query($query);
47
+            $status = '';
48
+            if($_POST['activate'] == 'false'){
49
+                $status = 'Inactive';
50
+            }else{
51
+                $status = 'Active';
52
+            }
53
+        }
54
+        $query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'";
55
+            $GLOBALS['db']->query($query);
56 56
     }
57
-    	$query = "SELECT status FROM users WHERE id LIKE 'seed%'";
58
-    	$result = $GLOBALS['db']->query($query);
59
-		$row = $GLOBALS['db']->fetchByAssoc($result);
60
-		if(!empty($row['status'])){
61
-			$activate = 'false';
62
-			if($row['status'] == 'Inactive'){
63
-				$activate = 'true';
64
-			}
65
-			?>
57
+        $query = "SELECT status FROM users WHERE id LIKE 'seed%'";
58
+        $result = $GLOBALS['db']->query($query);
59
+        $row = $GLOBALS['db']->fetchByAssoc($result);
60
+        if(!empty($row['status'])){
61
+            $activate = 'false';
62
+            if($row['status'] == 'Inactive'){
63
+                $activate = 'true';
64
+            }
65
+            ?>
66 66
 				<p>
67 67
 				<form name="RepairSeedUsers" method="post" action="index.php">
68 68
 				<input type="hidden" name="module" value="Administration">
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 				</p>
81 81
 			<?php
82 82
 
83
-		}else{
84
-			echo 'No seed Users';
85
-		}
83
+        }else{
84
+            echo 'No seed Users';
85
+        }
86 86
 }
87 87
 else{
88
-	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
88
+    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
89 89
 }
90 90
 ?>
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 
41 41
 global $current_user;
42 42
 
43
-if(is_admin($current_user)){
44
-    if(count($_POST)){
45
-    	if(!empty($_POST['activate'])){
43
+if (is_admin($current_user)) {
44
+    if (count($_POST)) {
45
+    	if (!empty($_POST['activate'])) {
46 46
 
47 47
     		$status = '';
48
-    		if($_POST['activate'] == 'false'){
48
+    		if ($_POST['activate'] == 'false') {
49 49
     			$status = 'Inactive';
50
-    		}else{
50
+    		} else {
51 51
     			$status = 'Active';
52 52
     		}
53 53
     	}
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     	$query = "SELECT status FROM users WHERE id LIKE 'seed%'";
58 58
     	$result = $GLOBALS['db']->query($query);
59 59
 		$row = $GLOBALS['db']->fetchByAssoc($result);
60
-		if(!empty($row['status'])){
60
+		if (!empty($row['status'])) {
61 61
 			$activate = 'false';
62
-			if($row['status'] == 'Inactive'){
62
+			if ($row['status'] == 'Inactive') {
63 63
 				$activate = 'true';
64 64
 			}
65 65
 			?>
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
 				<table cellspacing="{CELLSPACING}" class="otherview">
74 74
 					<tr>
75 75
 					    <td scope="row" width="30%"><?php echo $mod_strings['LBL_REPAIR_SEED_USERS_TITLE']; ?></td>
76
-					    <td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];}else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
76
+					    <td><input type="submit" name="button" value="<?php if ($row['status'] == 'Inactive') {echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE']; } else {echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE']; } ?>"></td>
77 77
 					</tr>
78 78
 				</table>
79 79
 				</form>
80 80
 				</p>
81 81
 			<?php
82 82
 
83
-		}else{
83
+		} else {
84 84
 			echo 'No seed Users';
85 85
 		}
86 86
 }
87
-else{
87
+else {
88 88
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
89 89
 }
90 90
 ?>
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -47,7 +49,7 @@  discard block
 block discarded – undo
47 49
     		$status = '';
48 50
     		if($_POST['activate'] == 'false'){
49 51
     			$status = 'Inactive';
50
-    		}else{
52
+    		} else{
51 53
     			$status = 'Active';
52 54
     		}
53 55
     	}
@@ -73,18 +75,17 @@  discard block
 block discarded – undo
73 75
 				<table cellspacing="{CELLSPACING}" class="otherview">
74 76
 					<tr>
75 77
 					    <td scope="row" width="30%"><?php echo $mod_strings['LBL_REPAIR_SEED_USERS_TITLE']; ?></td>
76
-					    <td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];}else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
78
+					    <td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];} else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
77 79
 					</tr>
78 80
 				</table>
79 81
 				</form>
80 82
 				</p>
81 83
 			<?php
82 84
 
83
-		}else{
85
+		} else{
84 86
 			echo 'No seed Users';
85 87
 		}
86
-}
87
-else{
88
+} else{
88 89
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
89 90
 }
90 91
 ?>
91 92
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Administration/RebuildSchedulers.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@
 block discarded – undo
42 42
 
43 43
 if(isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
44 44
 	
45
-	require_once('install/install_utils.php');
46
-	$focus = new Scheduler();
47
-	$focus->rebuildDefaultSchedulers();
45
+    require_once('install/install_utils.php');
46
+    $focus = new Scheduler();
47
+    $focus->rebuildDefaultSchedulers();
48 48
 	
49 49
 $admin_mod_strings = return_module_language($current_language, 'Administration');	
50 50
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 echo getClassicModuleTitle('Administration', array($mod_strings['LBL_REBUILD_SCHEDULERS_TITLE']), false);
42 42
 
43
-if(isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
43
+if (isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
44 44
 	
45 45
 	require_once('install/install_utils.php');
46 46
 	$focus = new Scheduler();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Administration/updater_utils.php 3 patches
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 require_once('include/utils/encryption_utils.php');
45 45
 
46 46
 function getSystemInfo($send_usage_info=true){
47
-	global $sugar_config;
48
-	global $db, $administration, $timedate;
49
-	$info=array();
50
-	$info = getBaseSystemInfo($send_usage_info);
47
+    global $sugar_config;
48
+    global $db, $administration, $timedate;
49
+    $info=array();
50
+    $info = getBaseSystemInfo($send_usage_info);
51 51
     if($send_usage_info){
52
-		$info['application_key']=$sugar_config['unique_key'];
53
-		$info['php_version']=phpversion();
54
-		if(isset($_SERVER['SERVER_SOFTWARE'])) {
55
-			$info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
56
-		} // if
52
+        $info['application_key']=$sugar_config['unique_key'];
53
+        $info['php_version']=phpversion();
54
+        if(isset($_SERVER['SERVER_SOFTWARE'])) {
55
+            $info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
56
+        } // if
57 57
 
58
-		//get user count.
58
+        //get user count.
59 59
 
60 60
                 $query = "SELECT count(*) as total from users WHERE " . User::getLicensedUsersWhere();
61 61
                 $result = $db->getOne($query, false, 'fetching active users count');
@@ -63,58 +63,58 @@  discard block
 block discarded – undo
63 63
                     $info['users'] = $result;
64 64
                 }
65 65
 
66
-		if(empty($administration)){
66
+        if(empty($administration)){
67 67
 
68
-			$administration = new Administration();
69
-		}
70
-		$administration->retrieveSettings('system');
71
-		$info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
68
+            $administration = new Administration();
69
+        }
70
+        $administration->retrieveSettings('system');
71
+        $info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
72 72
 
73 73
 
74
-		$result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
-		if($result !== false) {
76
-			$info['admin_users'] = $result;
77
-		}
74
+        $result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
+        if($result !== false) {
76
+            $info['admin_users'] = $result;
77
+        }
78 78
 
79 79
 
80
-		$result=$db->getOne("select count(*) count from users", false, 'fetching all users count');
81
-		if($result !== false) {
82
-			$info['registered_users'] = $result;
83
-		}
80
+        $result=$db->getOne("select count(*) count from users", false, 'fetching all users count');
81
+        if($result !== false) {
82
+            $info['registered_users'] = $result;
83
+        }
84 84
 
85
-		$lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime');
86
-		if( !$send_usage_info) {
87
-			$info['users_active_30_days'] = -1;
88
-		} else {
89
-			$info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND  tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count');
90
-		}
85
+        $lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime');
86
+        if( !$send_usage_info) {
87
+            $info['users_active_30_days'] = -1;
88
+        } else {
89
+            $info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND  tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count');
90
+        }
91 91
 
92 92
 
93 93
 
94 94
 
95
-		if(!$send_usage_info){
96
-			$info['latest_tracker_id'] = -1;
97
-		}else{
98
-			$id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
-			if ( $id !== false )
100
-			    $info['latest_tracker_id'] = $id;
101
-		}
95
+        if(!$send_usage_info){
96
+            $info['latest_tracker_id'] = -1;
97
+        }else{
98
+            $id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
+            if ( $id !== false )
100
+                $info['latest_tracker_id'] = $id;
101
+        }
102 102
 
103
-		$info['db_type']=$sugar_config['dbconfig']['db_type'];
104
-		$info['db_version']=$db->version();
105
-	}
106
-	if(file_exists('distro.php')){
107
-		include('distro.php');
108
-		if(!empty($distro_name))$info['distro_name'] = $distro_name;
109
-	}
110
-	$info['os'] = php_uname('s');
111
-	$info['os_version'] = php_uname('r');
112
-	$info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
113
-	$info['timezone'] = date('e');
114
-	if($info['timezone'] == 'e'){
115
-		$info['timezone'] = date('T');
116
-	}
117
-	return $info;
103
+        $info['db_type']=$sugar_config['dbconfig']['db_type'];
104
+        $info['db_version']=$db->version();
105
+    }
106
+    if(file_exists('distro.php')){
107
+        include('distro.php');
108
+        if(!empty($distro_name))$info['distro_name'] = $distro_name;
109
+    }
110
+    $info['os'] = php_uname('s');
111
+    $info['os_version'] = php_uname('r');
112
+    $info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
113
+    $info['timezone'] = date('e');
114
+    if($info['timezone'] == 'e'){
115
+        $info['timezone'] = date('T');
116
+    }
117
+    return $info;
118 118
 
119 119
 }
120 120
 
@@ -137,28 +137,28 @@  discard block
 block discarded – undo
137 137
 }
138 138
 
139 139
 function check_now($send_usage_info=true, $get_request_data=false, $response_data = false, $from_install=false ) {
140
-	global $sugar_config, $timedate;
141
-	global $db, $license;
140
+    global $sugar_config, $timedate;
141
+    global $db, $license;
142 142
     include('sugar_version.php');
143 143
 
144 144
 
145
-	$return_array=array();
145
+    $return_array=array();
146 146
     if(!$from_install && empty($license))loadLicense(true);
147 147
 
148
-	if(!$response_data){
148
+    if(!$response_data){
149 149
 
150 150
         if($from_install){
151
-    		$info = getBaseSystemInfo(false);
151
+            $info = getBaseSystemInfo(false);
152 152
 
153 153
         }else{
154 154
             $info = getSystemInfo($send_usage_info);
155 155
         }
156 156
 
157
-		require_once('include/nusoap/nusoap.php');
157
+        require_once('include/nusoap/nusoap.php');
158 158
 
159
-		$GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
160
-		$sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
161
-		$ping = $sclient->call('sugarPing', array());
159
+        $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
160
+        $sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
161
+        $ping = $sclient->call('sugarPing', array());
162 162
         if (empty($ping) || $sclient->getError()) {
163 163
             if (!$get_request_data) {
164 164
                 return array(
@@ -171,92 +171,92 @@  discard block
 block discarded – undo
171 171
         }
172 172
 
173 173
 
174
-			$key = '4829482749329';
175
-
176
-
177
-
178
-		$encoded = sugarEncode($key, serialize($info));
179
-
180
-		if($get_request_data){
181
-			$request_data = array('key'=>$key, 'data'=>$encoded);
182
-			return serialize($request_data);
183
-		}
184
-		$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185
-
186
-	}else{
187
-		$encodedResult = 	$response_data['data'];
188
-		$key = $response_data['key'];
189
-
190
-	}
191
-
192
-	if($response_data || !$sclient->getError()){
193
-		$serializedResultData = sugarDecode($key,$encodedResult);
194
-		$resultData = unserialize($serializedResultData);
195
-		if($response_data && empty($resultData))
196
-		{
197
-			$resultData = array();
198
-			$resultData['validation'] = 'invalid validation key';
199
-		}
200
-	}else
201
-	{
202
-		$resultData = array();
203
-		$resultData['versions'] = array();
204
-
205
-	}
206
-
207
-	if($response_data || !$sclient->getError() )
208
-	{
209
-		if(!empty($resultData['msg'])){
210
-			if(!empty($resultData['msg']['admin'])){
211
-				$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
-			}else{
213
-				$license->saveSetting('license', 'msg_admin','');
214
-			}
215
-			if(!empty($resultData['msg']['all'])){
216
-				$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
-			}else{
218
-				$license->saveSetting('license', 'msg_all','');
219
-			}
220
-		}else{
221
-			$license->saveSetting('license', 'msg_admin','');
222
-			$license->saveSetting('license', 'msg_all','');
223
-		}
224
-		$license->saveSetting('license', 'last_validation', 'success');
225
-		unset($_SESSION['COULD_NOT_CONNECT']);
226
-	}
227
-	else
228
-	{
229
-		$resultData = array();
230
-		$resultData['versions'] = array();
231
-
232
-		$license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
233
-		$license->saveSetting('license', 'last_validation', 'no_connection');
234
-
235
-		if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
236
-			$license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
237
-
238
-			$license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
239
-		}
240
-		$_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb();
241
-
242
-	}
243
-	if(!empty($resultData['versions'])){
244
-
245
-		$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
-	}else{
247
-		$resultData['versions'] = array();
248
-		$license->saveSetting('license', 'latest_versions','')	;
249
-	}
250
-
251
-	if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
174
+            $key = '4829482749329';
175
+
176
+
177
+
178
+        $encoded = sugarEncode($key, serialize($info));
179
+
180
+        if($get_request_data){
181
+            $request_data = array('key'=>$key, 'data'=>$encoded);
182
+            return serialize($request_data);
183
+        }
184
+        $encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185
+
186
+    }else{
187
+        $encodedResult = 	$response_data['data'];
188
+        $key = $response_data['key'];
189
+
190
+    }
191
+
192
+    if($response_data || !$sclient->getError()){
193
+        $serializedResultData = sugarDecode($key,$encodedResult);
194
+        $resultData = unserialize($serializedResultData);
195
+        if($response_data && empty($resultData))
196
+        {
197
+            $resultData = array();
198
+            $resultData['validation'] = 'invalid validation key';
199
+        }
200
+    }else
201
+    {
202
+        $resultData = array();
203
+        $resultData['versions'] = array();
204
+
205
+    }
206
+
207
+    if($response_data || !$sclient->getError() )
208
+    {
209
+        if(!empty($resultData['msg'])){
210
+            if(!empty($resultData['msg']['admin'])){
211
+                $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
+            }else{
213
+                $license->saveSetting('license', 'msg_admin','');
214
+            }
215
+            if(!empty($resultData['msg']['all'])){
216
+                $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
+            }else{
218
+                $license->saveSetting('license', 'msg_all','');
219
+            }
220
+        }else{
221
+            $license->saveSetting('license', 'msg_admin','');
222
+            $license->saveSetting('license', 'msg_all','');
223
+        }
224
+        $license->saveSetting('license', 'last_validation', 'success');
225
+        unset($_SESSION['COULD_NOT_CONNECT']);
226
+    }
227
+    else
228
+    {
229
+        $resultData = array();
230
+        $resultData['versions'] = array();
231
+
232
+        $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
233
+        $license->saveSetting('license', 'last_validation', 'no_connection');
234
+
235
+        if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
236
+            $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
237
+
238
+            $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
239
+        }
240
+        $_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb();
241
+
242
+    }
243
+    if(!empty($resultData['versions'])){
244
+
245
+        $license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
+    }else{
247
+        $resultData['versions'] = array();
248
+        $license->saveSetting('license', 'latest_versions','')	;
249
+    }
250
+
251
+    if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
252 252
         && compareVersions($sugar_version, $resultData['versions'][0]['version']))
253
-	{
254
-		$resultData['versions'][0]['version'] = $sugar_version;
255
-		$resultData['versions'][0]['description'] = "You have the latest version.";
256
-	}
253
+    {
254
+        $resultData['versions'][0]['version'] = $sugar_version;
255
+        $resultData['versions'][0]['description'] = "You have the latest version.";
256
+    }
257 257
 
258 258
 
259
-	return $resultData['versions'];
259
+    return $resultData['versions'];
260 260
 }
261 261
 /*
262 262
  * returns true if $ver1 > $ver2
@@ -268,126 +268,126 @@  discard block
 block discarded – undo
268 268
 function set_CheckUpdates_config_setting($value) {
269 269
 
270 270
 
271
-	$admin=new Administration();
272
-	$admin->saveSetting('Update','CheckUpdates',$value);
271
+    $admin=new Administration();
272
+    $admin->saveSetting('Update','CheckUpdates',$value);
273 273
 }
274 274
 /* return's value for the 'CheckUpdates' config setting
275 275
 * if the setting does not exist one gets created with a default value of automatic.
276 276
 */
277 277
 function get_CheckUpdates_config_setting() {
278 278
 
279
-	$checkupdates='automatic';
279
+    $checkupdates='automatic';
280 280
 
281 281
 
282
-	$admin=new Administration();
283
-	$admin=$admin->retrieveSettings('Update',true);
284
-	if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
285
-		$admin->saveSetting('Update','CheckUpdates','automatic');
286
-	} else {
287
-		$checkupdates=$admin->settings['Update_CheckUpdates'];
288
-	}
289
-	return $checkupdates;
282
+    $admin=new Administration();
283
+    $admin=$admin->retrieveSettings('Update',true);
284
+    if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
285
+        $admin->saveSetting('Update','CheckUpdates','automatic');
286
+    } else {
287
+        $checkupdates=$admin->settings['Update_CheckUpdates'];
288
+    }
289
+    return $checkupdates;
290 290
 }
291 291
 
292 292
 function set_last_check_version_config_setting($value) {
293 293
 
294 294
 
295
-	$admin=new Administration();
296
-	$admin->saveSetting('Update','last_check_version',$value);
295
+    $admin=new Administration();
296
+    $admin->saveSetting('Update','last_check_version',$value);
297 297
 }
298 298
 function get_last_check_version_config_setting() {
299 299
 
300 300
 
301 301
 
302
-	$admin=new Administration();
303
-	$admin=$admin->retrieveSettings('Update');
304
-	if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
305
-		return null;
306
-	} else {
307
-		return $admin->settings['Update_last_check_version'];
308
-	}
302
+    $admin=new Administration();
303
+    $admin=$admin->retrieveSettings('Update');
304
+    if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
305
+        return null;
306
+    } else {
307
+        return $admin->settings['Update_last_check_version'];
308
+    }
309 309
 }
310 310
 
311 311
 
312 312
 function set_last_check_date_config_setting($value) {
313 313
 
314 314
 
315
-	$admin=new Administration();
316
-	$admin->saveSetting('Update','last_check_date',$value);
315
+    $admin=new Administration();
316
+    $admin->saveSetting('Update','last_check_date',$value);
317 317
 }
318 318
 function get_last_check_date_config_setting() {
319 319
 
320 320
 
321 321
 
322
-	$admin=new Administration();
323
-	$admin=$admin->retrieveSettings('Update');
324
-	if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
325
-		return 0;
326
-	} else {
327
-		return $admin->settings['Update_last_check_date'];
328
-	}
322
+    $admin=new Administration();
323
+    $admin=$admin->retrieveSettings('Update');
324
+    if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
325
+        return 0;
326
+    } else {
327
+        return $admin->settings['Update_last_check_date'];
328
+    }
329 329
 }
330 330
 
331 331
 function set_sugarbeat($value) {
332
-	global $sugar_config;
333
-	$_SUGARBEAT="sugarbeet";
334
-	$sugar_config[$_SUGARBEAT] = $value;
335
-	write_array_to_file( "sugar_config", $sugar_config, "config.php" );
332
+    global $sugar_config;
333
+    $_SUGARBEAT="sugarbeet";
334
+    $sugar_config[$_SUGARBEAT] = $value;
335
+    write_array_to_file( "sugar_config", $sugar_config, "config.php" );
336 336
 }
337 337
 function get_sugarbeat() {
338 338
 
339 339
 
340
-	global $sugar_config;
341
-	$_SUGARBEAT="sugarbeet";
340
+    global $sugar_config;
341
+    $_SUGARBEAT="sugarbeet";
342 342
 
343
-	if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
344
-	return false;
345
-	}
346
-	return true;
343
+    if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
344
+    return false;
345
+    }
346
+    return true;
347 347
 
348 348
 }
349 349
 
350 350
 
351 351
 
352 352
 function shouldCheckSugar(){
353
-	global $license, $timedate;
354
-	if(
353
+    global $license, $timedate;
354
+    if(
355 355
 
356
-	get_CheckUpdates_config_setting() == 'automatic' ){
357
-		return true;
358
-	}
356
+    get_CheckUpdates_config_setting() == 'automatic' ){
357
+        return true;
358
+    }
359 359
 
360
-	return false;
360
+    return false;
361 361
 }
362 362
 
363 363
 
364 364
 
365 365
 function loadLicense($firstLogin=false){
366 366
 
367
-	$GLOBALS['license']=new Administration();
368
-	$GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
367
+    $GLOBALS['license']=new Administration();
368
+    $GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
369 369
 
370 370
 }
371 371
 
372 372
 function loginLicense(){
373
-	global $current_user, $license;
374
-	loadLicense(true);
373
+    global $current_user, $license;
374
+    loadLicense(true);
375 375
 
376 376
 
377
-	if (shouldCheckSugar()) {
377
+    if (shouldCheckSugar()) {
378 378
 
379 379
 
380
-		$last_check_date=get_last_check_date_config_setting();
381
-		$current_date_time=time();
382
-		$time_period=3*23*3600 ;
383
-		if (($current_date_time - $last_check_date) > $time_period
384
-		) {
385
-			$version = check_now(get_sugarbeat());
380
+        $last_check_date=get_last_check_date_config_setting();
381
+        $current_date_time=time();
382
+        $time_period=3*23*3600 ;
383
+        if (($current_date_time - $last_check_date) > $time_period
384
+        ) {
385
+            $version = check_now(get_sugarbeat());
386 386
 
387
-			unset($_SESSION['license_seats_needed']);
388
-			loadLicense();
389
-			set_last_check_date_config_setting("$current_date_time");
390
-			include('sugar_version.php');
387
+            unset($_SESSION['license_seats_needed']);
388
+            loadLicense();
389
+            set_last_check_date_config_setting("$current_date_time");
390
+            include('sugar_version.php');
391 391
 
392 392
             $newVersion = '';
393 393
             if (!empty($version) && count($version) == 1)
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
             }
397 397
 
398 398
             if (version_compare($newVersion, $sugar_version, '>') && is_admin($current_user))
399
-			{
400
-				//set session variables.
401
-				$_SESSION['available_version']=$version[0]['version'];
402
-				$_SESSION['available_version_description']=$version[0]['description'];
403
-				set_last_check_version_config_setting($version[0]['version']);
404
-			}
405
-		}
406
-	}
399
+            {
400
+                //set session variables.
401
+                $_SESSION['available_version']=$version[0]['version'];
402
+                $_SESSION['available_version_description']=$version[0]['description'];
403
+                set_last_check_version_config_setting($version[0]['version']);
404
+            }
405
+        }
406
+    }
407 407
 
408 408
 
409 409
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,10 +96,11 @@  discard block
 block discarded – undo
94 96
 
95 97
 		if(!$send_usage_info){
96 98
 			$info['latest_tracker_id'] = -1;
97
-		}else{
99
+		} else{
98 100
 			$id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
-			if ( $id !== false )
100
-			    $info['latest_tracker_id'] = $id;
101
+			if ( $id !== false ) {
102
+						    $info['latest_tracker_id'] = $id;
103
+			}
101 104
 		}
102 105
 
103 106
 		$info['db_type']=$sugar_config['dbconfig']['db_type'];
@@ -105,7 +108,9 @@  discard block
 block discarded – undo
105 108
 	}
106 109
 	if(file_exists('distro.php')){
107 110
 		include('distro.php');
108
-		if(!empty($distro_name))$info['distro_name'] = $distro_name;
111
+		if(!empty($distro_name)) {
112
+		    $info['distro_name'] = $distro_name;
113
+		}
109 114
 	}
110 115
 	$info['os'] = php_uname('s');
111 116
 	$info['os_version'] = php_uname('r');
@@ -143,14 +148,16 @@  discard block
 block discarded – undo
143 148
 
144 149
 
145 150
 	$return_array=array();
146
-    if(!$from_install && empty($license))loadLicense(true);
151
+    if(!$from_install && empty($license)) {
152
+        loadLicense(true);
153
+    }
147 154
 
148 155
 	if(!$response_data){
149 156
 
150 157
         if($from_install){
151 158
     		$info = getBaseSystemInfo(false);
152 159
 
153
-        }else{
160
+        } else{
154 161
             $info = getSystemInfo($send_usage_info);
155 162
         }
156 163
 
@@ -183,7 +190,7 @@  discard block
 block discarded – undo
183 190
 		}
184 191
 		$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185 192
 
186
-	}else{
193
+	} else{
187 194
 		$encodedResult = 	$response_data['data'];
188 195
 		$key = $response_data['key'];
189 196
 
@@ -197,7 +204,7 @@  discard block
 block discarded – undo
197 204
 			$resultData = array();
198 205
 			$resultData['validation'] = 'invalid validation key';
199 206
 		}
200
-	}else
207
+	} else
201 208
 	{
202 209
 		$resultData = array();
203 210
 		$resultData['versions'] = array();
@@ -209,22 +216,21 @@  discard block
 block discarded – undo
209 216
 		if(!empty($resultData['msg'])){
210 217
 			if(!empty($resultData['msg']['admin'])){
211 218
 				$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
-			}else{
219
+			} else{
213 220
 				$license->saveSetting('license', 'msg_admin','');
214 221
 			}
215 222
 			if(!empty($resultData['msg']['all'])){
216 223
 				$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
-			}else{
224
+			} else{
218 225
 				$license->saveSetting('license', 'msg_all','');
219 226
 			}
220
-		}else{
227
+		} else{
221 228
 			$license->saveSetting('license', 'msg_admin','');
222 229
 			$license->saveSetting('license', 'msg_all','');
223 230
 		}
224 231
 		$license->saveSetting('license', 'last_validation', 'success');
225 232
 		unset($_SESSION['COULD_NOT_CONNECT']);
226
-	}
227
-	else
233
+	} else
228 234
 	{
229 235
 		$resultData = array();
230 236
 		$resultData['versions'] = array();
@@ -243,7 +249,7 @@  discard block
 block discarded – undo
243 249
 	if(!empty($resultData['versions'])){
244 250
 
245 251
 		$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
-	}else{
252
+	} else{
247 253
 		$resultData['versions'] = array();
248 254
 		$license->saveSetting('license', 'latest_versions','')	;
249 255
 	}
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 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.
@@ -43,47 +43,47 @@  discard block
 block discarded – undo
43 43
 ********************************************************************************/
44 44
 require_once('include/utils/encryption_utils.php');
45 45
 
46
-function getSystemInfo($send_usage_info=true){
46
+function getSystemInfo($send_usage_info = true) {
47 47
 	global $sugar_config;
48 48
 	global $db, $administration, $timedate;
49
-	$info=array();
49
+	$info = array();
50 50
 	$info = getBaseSystemInfo($send_usage_info);
51
-    if($send_usage_info){
52
-		$info['application_key']=$sugar_config['unique_key'];
53
-		$info['php_version']=phpversion();
54
-		if(isset($_SERVER['SERVER_SOFTWARE'])) {
51
+    if ($send_usage_info) {
52
+		$info['application_key'] = $sugar_config['unique_key'];
53
+		$info['php_version'] = phpversion();
54
+		if (isset($_SERVER['SERVER_SOFTWARE'])) {
55 55
 			$info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
56 56
 		} // if
57 57
 
58 58
 		//get user count.
59 59
 
60
-                $query = "SELECT count(*) as total from users WHERE " . User::getLicensedUsersWhere();
60
+                $query = "SELECT count(*) as total from users WHERE ".User::getLicensedUsersWhere();
61 61
                 $result = $db->getOne($query, false, 'fetching active users count');
62 62
                 if ($result !== false) {
63 63
                     $info['users'] = $result;
64 64
                 }
65 65
 
66
-		if(empty($administration)){
66
+		if (empty($administration)) {
67 67
 
68 68
 			$administration = new Administration();
69 69
 		}
70 70
 		$administration->retrieveSettings('system');
71
-		$info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
71
+		$info['system_name'] = (!empty($administration->settings['system_name'])) ?substr($administration->settings['system_name'], 0, 255) : '';
72 72
 
73 73
 
74
-		$result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
-		if($result !== false) {
74
+		$result = $db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
+		if ($result !== false) {
76 76
 			$info['admin_users'] = $result;
77 77
 		}
78 78
 
79 79
 
80
-		$result=$db->getOne("select count(*) count from users", false, 'fetching all users count');
81
-		if($result !== false) {
80
+		$result = $db->getOne("select count(*) count from users", false, 'fetching all users count');
81
+		if ($result !== false) {
82 82
 			$info['registered_users'] = $result;
83 83
 		}
84 84
 
85
-		$lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime');
86
-		if( !$send_usage_info) {
85
+		$lastMonth = $db->convert("'".$timedate->getNow()->modify("-30 days")->asDb(false)."'", 'datetime');
86
+		if (!$send_usage_info) {
87 87
 			$info['users_active_30_days'] = -1;
88 88
 		} else {
89 89
 			$info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND  tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count');
@@ -92,41 +92,41 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 
95
-		if(!$send_usage_info){
95
+		if (!$send_usage_info) {
96 96
 			$info['latest_tracker_id'] = -1;
97
-		}else{
98
-			$id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
-			if ( $id !== false )
97
+		} else {
98
+			$id = $db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
+			if ($id !== false)
100 100
 			    $info['latest_tracker_id'] = $id;
101 101
 		}
102 102
 
103
-		$info['db_type']=$sugar_config['dbconfig']['db_type'];
104
-		$info['db_version']=$db->version();
103
+		$info['db_type'] = $sugar_config['dbconfig']['db_type'];
104
+		$info['db_version'] = $db->version();
105 105
 	}
106
-	if(file_exists('distro.php')){
106
+	if (file_exists('distro.php')) {
107 107
 		include('distro.php');
108
-		if(!empty($distro_name))$info['distro_name'] = $distro_name;
108
+		if (!empty($distro_name))$info['distro_name'] = $distro_name;
109 109
 	}
110 110
 	$info['os'] = php_uname('s');
111 111
 	$info['os_version'] = php_uname('r');
112 112
 	$info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
113 113
 	$info['timezone'] = date('e');
114
-	if($info['timezone'] == 'e'){
114
+	if ($info['timezone'] == 'e') {
115 115
 		$info['timezone'] = date('T');
116 116
 	}
117 117
 	return $info;
118 118
 
119 119
 }
120 120
 
121
-function getBaseSystemInfo($send_usage_info=true){
121
+function getBaseSystemInfo($send_usage_info = true) {
122 122
     include('sugar_version.php');
123
-    $info=array();
123
+    $info = array();
124 124
 
125
-    if($send_usage_info){
126
-        $info['sugar_db_version']=$sugar_db_version;
125
+    if ($send_usage_info) {
126
+        $info['sugar_db_version'] = $sugar_db_version;
127 127
     }
128
-    $info['sugar_version']=$sugar_version;
129
-    $info['sugar_flavor']=$sugar_flavor;
128
+    $info['sugar_version'] = $sugar_version;
129
+    $info['sugar_flavor'] = $sugar_flavor;
130 130
     $info['auth_level'] = 0;
131 131
 
132 132
 
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 
137 137
 }
138 138
 
139
-function check_now($send_usage_info=true, $get_request_data=false, $response_data = false, $from_install=false ) {
139
+function check_now($send_usage_info = true, $get_request_data = false, $response_data = false, $from_install = false) {
140 140
 	global $sugar_config, $timedate;
141 141
 	global $db, $license;
142 142
     include('sugar_version.php');
143 143
 
144 144
 
145
-	$return_array=array();
146
-    if(!$from_install && empty($license))loadLicense(true);
145
+	$return_array = array();
146
+    if (!$from_install && empty($license))loadLicense(true);
147 147
 
148
-	if(!$response_data){
148
+	if (!$response_data) {
149 149
 
150
-        if($from_install){
150
+        if ($from_install) {
151 151
     		$info = getBaseSystemInfo(false);
152 152
 
153
-        }else{
153
+        } else {
154 154
             $info = getSystemInfo($send_usage_info);
155 155
         }
156 156
 
@@ -177,49 +177,49 @@  discard block
 block discarded – undo
177 177
 
178 178
 		$encoded = sugarEncode($key, serialize($info));
179 179
 
180
-		if($get_request_data){
180
+		if ($get_request_data) {
181 181
 			$request_data = array('key'=>$key, 'data'=>$encoded);
182 182
 			return serialize($request_data);
183 183
 		}
184 184
 		$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185 185
 
186
-	}else{
187
-		$encodedResult = 	$response_data['data'];
186
+	} else {
187
+		$encodedResult = $response_data['data'];
188 188
 		$key = $response_data['key'];
189 189
 
190 190
 	}
191 191
 
192
-	if($response_data || !$sclient->getError()){
193
-		$serializedResultData = sugarDecode($key,$encodedResult);
192
+	if ($response_data || !$sclient->getError()) {
193
+		$serializedResultData = sugarDecode($key, $encodedResult);
194 194
 		$resultData = unserialize($serializedResultData);
195
-		if($response_data && empty($resultData))
195
+		if ($response_data && empty($resultData))
196 196
 		{
197 197
 			$resultData = array();
198 198
 			$resultData['validation'] = 'invalid validation key';
199 199
 		}
200
-	}else
200
+	} else
201 201
 	{
202 202
 		$resultData = array();
203 203
 		$resultData['versions'] = array();
204 204
 
205 205
 	}
206 206
 
207
-	if($response_data || !$sclient->getError() )
207
+	if ($response_data || !$sclient->getError())
208 208
 	{
209
-		if(!empty($resultData['msg'])){
210
-			if(!empty($resultData['msg']['admin'])){
209
+		if (!empty($resultData['msg'])) {
210
+			if (!empty($resultData['msg']['admin'])) {
211 211
 				$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
-			}else{
213
-				$license->saveSetting('license', 'msg_admin','');
212
+			} else {
213
+				$license->saveSetting('license', 'msg_admin', '');
214 214
 			}
215
-			if(!empty($resultData['msg']['all'])){
215
+			if (!empty($resultData['msg']['all'])) {
216 216
 				$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
-			}else{
218
-				$license->saveSetting('license', 'msg_all','');
217
+			} else {
218
+				$license->saveSetting('license', 'msg_all', '');
219 219
 			}
220
-		}else{
221
-			$license->saveSetting('license', 'msg_admin','');
222
-			$license->saveSetting('license', 'msg_all','');
220
+		} else {
221
+			$license->saveSetting('license', 'msg_admin', '');
222
+			$license->saveSetting('license', 'msg_all', '');
223 223
 		}
224 224
 		$license->saveSetting('license', 'last_validation', 'success');
225 225
 		unset($_SESSION['COULD_NOT_CONNECT']);
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
 		$license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
233 233
 		$license->saveSetting('license', 'last_validation', 'no_connection');
234 234
 
235
-		if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
235
+		if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) {
236 236
 			$license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
237 237
 
238 238
 			$license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
239 239
 		}
240
-		$_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb();
240
+		$_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb();
241 241
 
242 242
 	}
243
-	if(!empty($resultData['versions'])){
243
+	if (!empty($resultData['versions'])) {
244 244
 
245
-		$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
-	}else{
245
+		$license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions'])));
246
+	} else {
247 247
 		$resultData['versions'] = array();
248
-		$license->saveSetting('license', 'latest_versions','')	;
248
+		$license->saveSetting('license', 'latest_versions', '');
249 249
 	}
250 250
 
251
-	if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
251
+	if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
252 252
         && compareVersions($sugar_version, $resultData['versions'][0]['version']))
253 253
 	{
254 254
 		$resultData['versions'][0]['version'] = $sugar_version;
@@ -268,23 +268,23 @@  discard block
 block discarded – undo
268 268
 function set_CheckUpdates_config_setting($value) {
269 269
 
270 270
 
271
-	$admin=new Administration();
272
-	$admin->saveSetting('Update','CheckUpdates',$value);
271
+	$admin = new Administration();
272
+	$admin->saveSetting('Update', 'CheckUpdates', $value);
273 273
 }
274 274
 /* return's value for the 'CheckUpdates' config setting
275 275
 * if the setting does not exist one gets created with a default value of automatic.
276 276
 */
277 277
 function get_CheckUpdates_config_setting() {
278 278
 
279
-	$checkupdates='automatic';
279
+	$checkupdates = 'automatic';
280 280
 
281 281
 
282
-	$admin=new Administration();
283
-	$admin=$admin->retrieveSettings('Update',true);
282
+	$admin = new Administration();
283
+	$admin = $admin->retrieveSettings('Update', true);
284 284
 	if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
285
-		$admin->saveSetting('Update','CheckUpdates','automatic');
285
+		$admin->saveSetting('Update', 'CheckUpdates', 'automatic');
286 286
 	} else {
287
-		$checkupdates=$admin->settings['Update_CheckUpdates'];
287
+		$checkupdates = $admin->settings['Update_CheckUpdates'];
288 288
 	}
289 289
 	return $checkupdates;
290 290
 }
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 function set_last_check_version_config_setting($value) {
293 293
 
294 294
 
295
-	$admin=new Administration();
296
-	$admin->saveSetting('Update','last_check_version',$value);
295
+	$admin = new Administration();
296
+	$admin->saveSetting('Update', 'last_check_version', $value);
297 297
 }
298 298
 function get_last_check_version_config_setting() {
299 299
 
300 300
 
301 301
 
302
-	$admin=new Administration();
303
-	$admin=$admin->retrieveSettings('Update');
302
+	$admin = new Administration();
303
+	$admin = $admin->retrieveSettings('Update');
304 304
 	if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
305 305
 		return null;
306 306
 	} else {
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 function set_last_check_date_config_setting($value) {
313 313
 
314 314
 
315
-	$admin=new Administration();
316
-	$admin->saveSetting('Update','last_check_date',$value);
315
+	$admin = new Administration();
316
+	$admin->saveSetting('Update', 'last_check_date', $value);
317 317
 }
318 318
 function get_last_check_date_config_setting() {
319 319
 
320 320
 
321 321
 
322
-	$admin=new Administration();
323
-	$admin=$admin->retrieveSettings('Update');
322
+	$admin = new Administration();
323
+	$admin = $admin->retrieveSettings('Update');
324 324
 	if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
325 325
 		return 0;
326 326
 	} else {
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 
331 331
 function set_sugarbeat($value) {
332 332
 	global $sugar_config;
333
-	$_SUGARBEAT="sugarbeet";
333
+	$_SUGARBEAT = "sugarbeet";
334 334
 	$sugar_config[$_SUGARBEAT] = $value;
335
-	write_array_to_file( "sugar_config", $sugar_config, "config.php" );
335
+	write_array_to_file("sugar_config", $sugar_config, "config.php");
336 336
 }
337 337
 function get_sugarbeat() {
338 338
 
339 339
 
340 340
 	global $sugar_config;
341
-	$_SUGARBEAT="sugarbeet";
341
+	$_SUGARBEAT = "sugarbeet";
342 342
 
343 343
 	if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
344 344
 	return false;
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
 
350 350
 
351 351
 
352
-function shouldCheckSugar(){
352
+function shouldCheckSugar() {
353 353
 	global $license, $timedate;
354
-	if(
354
+	if (
355 355
 
356
-	get_CheckUpdates_config_setting() == 'automatic' ){
356
+	get_CheckUpdates_config_setting() == 'automatic' ) {
357 357
 		return true;
358 358
 	}
359 359
 
@@ -362,14 +362,14 @@  discard block
 block discarded – undo
362 362
 
363 363
 
364 364
 
365
-function loadLicense($firstLogin=false){
365
+function loadLicense($firstLogin = false) {
366 366
 
367
-	$GLOBALS['license']=new Administration();
368
-	$GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
367
+	$GLOBALS['license'] = new Administration();
368
+	$GLOBALS['license'] = $GLOBALS['license']->retrieveSettings('license', $firstLogin);
369 369
 
370 370
 }
371 371
 
372
-function loginLicense(){
372
+function loginLicense() {
373 373
 	global $current_user, $license;
374 374
 	loadLicense(true);
375 375
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 	if (shouldCheckSugar()) {
378 378
 
379 379
 
380
-		$last_check_date=get_last_check_date_config_setting();
381
-		$current_date_time=time();
382
-		$time_period=3*23*3600 ;
380
+		$last_check_date = get_last_check_date_config_setting();
381
+		$current_date_time = time();
382
+		$time_period = 3 * 23 * 3600;
383 383
 		if (($current_date_time - $last_check_date) > $time_period
384 384
 		) {
385 385
 			$version = check_now(get_sugarbeat());
@@ -398,8 +398,8 @@  discard block
 block discarded – undo
398 398
             if (version_compare($newVersion, $sugar_version, '>') && is_admin($current_user))
399 399
 			{
400 400
 				//set session variables.
401
-				$_SESSION['available_version']=$version[0]['version'];
402
-				$_SESSION['available_version_description']=$version[0]['description'];
401
+				$_SESSION['available_version'] = $version[0]['version'];
402
+				$_SESSION['available_version_description'] = $version[0]['description'];
403 403
 				set_last_check_version_config_setting($version[0]['version']);
404 404
 			}
405 405
 		}
Please login to merge, or discard this patch.
modules/Administration/DiagnosticDownload.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 
51 51
 if(!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
52 52
 {
53
-	die('Did not receive a filename to download');
53
+    die('Did not receive a filename to download');
54 54
 }
55 55
 $time = str_replace(array('.', '/', '\\'), '', $_REQUEST['time']);
56 56
 $guid = str_replace(array('.', '/', '\\'), '', $_REQUEST['guid']);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     sugar_die("Unauthorized access to diagnostic tool.");
49 49
 }
50 50
 
51
-if(!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
51
+if (!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
52 52
 {
53 53
 	die('Did not receive a filename to download');
54 54
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,7 +44,9 @@  discard block
 block discarded – undo
42 44
 global $current_user;
43 45
 
44 46
 
45
-if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
47
+if (!is_admin($current_user)) {
48
+    sugar_die("Unauthorized access to administration.");
49
+}
46 50
 if (isset($GLOBALS['sugar_config']['hide_admin_diagnostics']) && $GLOBALS['sugar_config']['hide_admin_diagnostics'])
47 51
 {
48 52
     sugar_die("Unauthorized access to diagnostic tool.");
Please login to merge, or discard this patch.
modules/Administration/expandDatabase.php 3 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -40,38 +40,38 @@  discard block
 block discarded – undo
40 40
 
41 41
 $db = DBManagerFactory::getInstance();
42 42
 if(!$db->supports('fix:expandDatabase')) {
43
-	echo "<BR>";
44
-	echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>";
45
-	echo "<BR>";
46
-	sugar_die('');
43
+    echo "<BR>";
44
+    echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>";
45
+    echo "<BR>";
46
+    sugar_die('');
47 47
 }
48 48
 global $current_user,$beanFiles;
49 49
 
50 50
 set_time_limit(3600);
51 51
 if(is_admin($current_user) || isset($from_sync_client)){
52 52
 
53
-	$execute = false;
54
-	$export = false;
55
-
56
-
57
-	if(isset($_REQUEST['do_action'])){
58
-		switch($_REQUEST['do_action']){
59
-			case 'display':
60
-				break;
61
-			case 'execute':
62
-				$execute = true;
63
-				break;
64
-			case 'export':
65
-				header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true');
66
-				die();
67
-			case 'do_export':
68
-				$export = true;
69
-				break;
70
-		}
71
-
72
-		if(!$export && empty($_REQUEST['repair_silent'])){
73
-			echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true);
74
-		}
53
+    $execute = false;
54
+    $export = false;
55
+
56
+
57
+    if(isset($_REQUEST['do_action'])){
58
+        switch($_REQUEST['do_action']){
59
+            case 'display':
60
+                break;
61
+            case 'execute':
62
+                $execute = true;
63
+                break;
64
+            case 'export':
65
+                header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true');
66
+                die();
67
+            case 'do_export':
68
+                $export = true;
69
+                break;
70
+        }
71
+
72
+        if(!$export && empty($_REQUEST['repair_silent'])){
73
+            echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true);
74
+        }
75 75
 
76 76
         $alter_queries = array();
77 77
         $restore_quries = array();
@@ -88,60 +88,60 @@  discard block
 block discarded – undo
88 88
         $theRestoreQueries = '';
89 89
         $alter_queries = array();
90 90
         while ($row = $db->fetchByAssoc($result)) {
91
-   	      $length = (int)$row['length'];
92
-   	      if($length < 255) {
93
-   	         $newLength = ($length * 3 < 255) ? $length * 3 : 255;
94
-   	         $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
95
-             $theAlterQueries .= $sql . "\n";
96
-             $alter_queries[] = $sql;
97
-
98
-             $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
99
-             $theRestoreQueries .= $sql2 . "\n";
100
-          }
91
+                $length = (int)$row['length'];
92
+                if($length < 255) {
93
+                $newLength = ($length * 3 < 255) ? $length * 3 : 255;
94
+                $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
95
+                $theAlterQueries .= $sql . "\n";
96
+                $alter_queries[] = $sql;
97
+
98
+                $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
99
+                $theRestoreQueries .= $sql2 . "\n";
100
+            }
101 101
         } //while
102 102
 
103 103
         //If there are no ALTER queries to run, echo message
104 104
         if(count($alter_queries) == 0) {
105
-           echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
105
+            echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
106 106
         } else {
107 107
 
108
-	        // Create a backup file to restore columns to original length
109
-	        if($execute) {
110
-	           $fh = sugar_fopen('restoreExpand.sql', 'w');
111
-	           if(-1 == fwrite($fh, $theRestoreQueries)) {
112
-	           	  $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
113
-	           	  echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
114
-	           } else {
115
-	           	  $GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']);
116
-	           	  echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
117
-	           }
118
-
119
-	           foreach($alter_queries as $key=>$value) {
120
-	           	       $db->query($value);
121
-	           }
122
-	        }
123
-
124
-			if($export) {
125
-		   		header("Content-Disposition: attachment; filename=expandSugarDB.sql");
126
-				header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
127
-				header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
128
-				header( "Last-Modified: " . TimeDate::httpTime() );
129
-				header( "Cache-Control: post-check=0, pre-check=0", false );
130
-				header("Content-Length: ".strlen($theAlterQueries));
131
-		   		echo $theAlterQueries;
132
-		   		die();
133
-			} else {
134
-				if(empty($_REQUEST['repair_silent'])) {
135
-					echo nl2br($theAlterQueries);
136
-				}
137
-			}
108
+            // Create a backup file to restore columns to original length
109
+            if($execute) {
110
+                $fh = sugar_fopen('restoreExpand.sql', 'w');
111
+                if(-1 == fwrite($fh, $theRestoreQueries)) {
112
+                        $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
113
+                        echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
114
+                } else {
115
+                        $GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']);
116
+                        echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
117
+                }
118
+
119
+                foreach($alter_queries as $key=>$value) {
120
+                            $db->query($value);
121
+                }
122
+            }
123
+
124
+            if($export) {
125
+                    header("Content-Disposition: attachment; filename=expandSugarDB.sql");
126
+                header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
127
+                header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
128
+                header( "Last-Modified: " . TimeDate::httpTime() );
129
+                header( "Cache-Control: post-check=0, pre-check=0", false );
130
+                header("Content-Length: ".strlen($theAlterQueries));
131
+                    echo $theAlterQueries;
132
+                    die();
133
+            } else {
134
+                if(empty($_REQUEST['repair_silent'])) {
135
+                    echo nl2br($theAlterQueries);
136
+                }
137
+            }
138 138
 
139 139
         } //if-else
140
-	} // end do_action
140
+    } // end do_action
141 141
 
142
-	if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
-		if(!file_exists('restoreExpand.sql')) {
144
-		        echo "	<b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
142
+    if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
+        if(!file_exists('restoreExpand.sql')) {
144
+                echo "	<b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
145 145
 				<form name='repairdb'>
146 146
 					<input type='hidden' name='action' value='expandDatabase'>
147 147
 					<input type='hidden' name='module' value='Administration'>
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 					</select><input type='submit' class='button' value='".$mod_strings['LBL_GO']."'>
154 154
 				</form><br><br>
155 155
 				".$mod_strings['LBL_EXPAND_DATABASE_TEXT'];
156
-		} else {
157
-			    echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158
-		} //if-else
159
-	} //if
156
+        } else {
157
+                echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158
+        } //if-else
159
+    } //if
160 160
 }else{
161
-	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
161
+    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
162 162
 }
163 163
 
164 164
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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.
@@ -39,23 +39,23 @@  discard block
 block discarded – undo
39 39
  ********************************************************************************/
40 40
 
41 41
 $db = DBManagerFactory::getInstance();
42
-if(!$db->supports('fix:expandDatabase')) {
42
+if (!$db->supports('fix:expandDatabase')) {
43 43
 	echo "<BR>";
44 44
 	echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>";
45 45
 	echo "<BR>";
46 46
 	sugar_die('');
47 47
 }
48
-global $current_user,$beanFiles;
48
+global $current_user, $beanFiles;
49 49
 
50 50
 set_time_limit(3600);
51
-if(is_admin($current_user) || isset($from_sync_client)){
51
+if (is_admin($current_user) || isset($from_sync_client)) {
52 52
 
53 53
 	$execute = false;
54 54
 	$export = false;
55 55
 
56 56
 
57
-	if(isset($_REQUEST['do_action'])){
58
-		switch($_REQUEST['do_action']){
57
+	if (isset($_REQUEST['do_action'])) {
58
+		switch ($_REQUEST['do_action']) {
59 59
 			case 'display':
60 60
 				break;
61 61
 			case 'execute':
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 				break;
70 70
 		}
71 71
 
72
-		if(!$export && empty($_REQUEST['repair_silent'])){
73
-			echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true);
72
+		if (!$export && empty($_REQUEST['repair_silent'])) {
73
+			echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], $_REQUEST['do_action']), true);
74 74
 		}
75 75
 
76 76
         $alter_queries = array();
@@ -89,26 +89,26 @@  discard block
 block discarded – undo
89 89
         $alter_queries = array();
90 90
         while ($row = $db->fetchByAssoc($result)) {
91 91
    	      $length = (int)$row['length'];
92
-   	      if($length < 255) {
92
+   	      if ($length < 255) {
93 93
    	         $newLength = ($length * 3 < 255) ? $length * 3 : 255;
94
-   	         $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
95
-             $theAlterQueries .= $sql . "\n";
94
+   	         $sql = 'ALTER TABLE '.$row['table_name'].' ALTER COLUMN '.$row['column_name'].' '.$row['type'].' ('.$newLength.')';
95
+             $theAlterQueries .= $sql."\n";
96 96
              $alter_queries[] = $sql;
97 97
 
98
-             $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
99
-             $theRestoreQueries .= $sql2 . "\n";
98
+             $sql2 = 'ALTER TABLE '.$row['table_name'].' ALTER COLUMN '.$row['column_name'].' '.$row['type'].' ('.$length.')';
99
+             $theRestoreQueries .= $sql2."\n";
100 100
           }
101 101
         } //while
102 102
 
103 103
         //If there are no ALTER queries to run, echo message
104
-        if(count($alter_queries) == 0) {
104
+        if (count($alter_queries) == 0) {
105 105
            echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
106 106
         } else {
107 107
 
108 108
 	        // Create a backup file to restore columns to original length
109
-	        if($execute) {
109
+	        if ($execute) {
110 110
 	           $fh = sugar_fopen('restoreExpand.sql', 'w');
111
-	           if(-1 == fwrite($fh, $theRestoreQueries)) {
111
+	           if (-1 == fwrite($fh, $theRestoreQueries)) {
112 112
 	           	  $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
113 113
 	           	  echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
114 114
 	           } else {
@@ -116,22 +116,22 @@  discard block
 block discarded – undo
116 116
 	           	  echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
117 117
 	           }
118 118
 
119
-	           foreach($alter_queries as $key=>$value) {
119
+	           foreach ($alter_queries as $key=>$value) {
120 120
 	           	       $db->query($value);
121 121
 	           }
122 122
 	        }
123 123
 
124
-			if($export) {
124
+			if ($export) {
125 125
 		   		header("Content-Disposition: attachment; filename=expandSugarDB.sql");
126 126
 				header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
127
-				header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
128
-				header( "Last-Modified: " . TimeDate::httpTime() );
129
-				header( "Cache-Control: post-check=0, pre-check=0", false );
127
+				header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
128
+				header("Last-Modified: ".TimeDate::httpTime());
129
+				header("Cache-Control: post-check=0, pre-check=0", false);
130 130
 				header("Content-Length: ".strlen($theAlterQueries));
131 131
 		   		echo $theAlterQueries;
132 132
 		   		die();
133 133
 			} else {
134
-				if(empty($_REQUEST['repair_silent'])) {
134
+				if (empty($_REQUEST['repair_silent'])) {
135 135
 					echo nl2br($theAlterQueries);
136 136
 				}
137 137
 			}
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
         } //if-else
140 140
 	} // end do_action
141 141
 
142
-	if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
-		if(!file_exists('restoreExpand.sql')) {
142
+	if (empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
+		if (!file_exists('restoreExpand.sql')) {
144 144
 		        echo "	<b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
145 145
 				<form name='repairdb'>
146 146
 					<input type='hidden' name='action' value='expandDatabase'>
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			    echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158 158
 		} //if-else
159 159
 	} //if
160
-}else{
160
+} else {
161 161
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
162 162
 }
163 163
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -157,7 +159,7 @@  discard block
 block discarded – undo
157 159
 			    echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158 160
 		} //if-else
159 161
 	} //if
160
-}else{
162
+} else{
161 163
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
162 164
 }
163 165
 
Please login to merge, or discard this patch.
modules/Administration/RebuildAudit.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,18 +44,18 @@
 block discarded – undo
44 44
 echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'] . ' <BR>';
45 45
 foreach ($beanFiles as $bean => $file)
46 46
 {
47
-	if(strlen($file) > 0 && file_exists($file)) {
48
-		require_once($file);
49
-	    $focus = new $bean();
50
-		if ($focus->is_AuditEnabled()) {
51
-			if (!$focus->db->tableExists($focus->get_audit_table_name())) {
52
-				printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
53
-				$focus->create_audit_table();
54
-			} else {
55
-				printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);	
56
-			}
57
-		}
58
-	}
47
+    if(strlen($file) > 0 && file_exists($file)) {
48
+        require_once($file);
49
+        $focus = new $bean();
50
+        if ($focus->is_AuditEnabled()) {
51
+            if (!$focus->db->tableExists($focus->get_audit_table_name())) {
52
+                printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
53
+                $focus->create_audit_table();
54
+            } else {
55
+                printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);	
56
+            }
57
+        }
58
+    }
59 59
 }
60 60
 echo $mod_strings['LBL_DONE'];
61 61
 ?>
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 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,18 +41,18 @@  discard block
 block discarded – undo
41 41
 include('include/modules.php');
42 42
 
43 43
 global $beanFiles, $mod_strings;
44
-echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'] . ' <BR>';
44
+echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'].' <BR>';
45 45
 foreach ($beanFiles as $bean => $file)
46 46
 {
47
-	if(strlen($file) > 0 && file_exists($file)) {
47
+	if (strlen($file) > 0 && file_exists($file)) {
48 48
 		require_once($file);
49 49
 	    $focus = new $bean();
50 50
 		if ($focus->is_AuditEnabled()) {
51 51
 			if (!$focus->db->tableExists($focus->get_audit_table_name())) {
52
-				printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
52
+				printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'], $focus->get_audit_table_name(), $focus->object_name);
53 53
 				$focus->create_audit_table();
54 54
 			} else {
55
-				printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);	
55
+				printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'], $focus->object_name);	
56 56
 			}
57 57
 		}
58 58
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Administration/upgrade_custom_relationships.php 3 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -44,82 +44,82 @@
 block discarded – undo
44 44
  */
45 45
 function upgrade_custom_relationships($modules = array())
46 46
 {
47
-	global $current_user, $moduleList;
48
-	if (!is_admin($current_user)) sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
47
+    global $current_user, $moduleList;
48
+    if (!is_admin($current_user)) sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
49 49
 	
50
-	require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
51
-	require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
50
+    require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
51
+    require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
52 52
 	
53
-	if (empty($modules))
54
-		$modules = $moduleList;
53
+    if (empty($modules))
54
+        $modules = $moduleList;
55 55
 	
56
-	foreach($modules as $module)
57
-	{
58
-		$depRels = new DeployedRelationships($module);
59
-		$relList = $depRels->getRelationshipList();
60
-		foreach($relList as $relName)
61
-		{
62
-			$relObject = $depRels->get($relName);
63
-			$def = $relObject->getDefinition();
64
-			//We only need to fix self referencing one to many relationships
65
-			if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
66
-			{
67
-				$layout_defs = array();
68
-				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69
-					continue;
70
-				//Find the extension file containing the vardefs for this relationship
71
-				foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72
-				{
73
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
74
-					{
75
-						$dictionary = array($module => array("fields" => array()));
76
-						$filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
77
-						include($filePath);
78
-						if(isset($dictionary[$module]["fields"][$relName]))
79
-						{
80
-							$rhsDef = $dictionary[$module]["fields"][$relName];
81
-							//Update the vardef for the left side link field
82
-							if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left')
83
-							{
84
-								$rhsDef['side'] = 'left';
85
-								$fileContents = file_get_contents($filePath);
86
-								$out = preg_replace(
87
-									'/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
-									'$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
89
-									$fileContents
90
-								);
91
-								file_put_contents($filePath, $out);
92
-							}
93
-						}
94
-					}
95
-				}
96
-				//Find the extension file containing the subpanel definition for this relationship
97
-				foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
98
-				{
99
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
100
-					{
101
-						$layout_defs = array($module => array("subpanel_setup" => array()));
102
-						$filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
103
-						include($filePath);
104
-						foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
105
-						{
106
-							if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
107
-							{
108
-								$fileContents = file_get_contents($filePath);
109
-								$out = preg_replace(
110
-									'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
111
-									"'get_subpanel_data' => '{$def["join_key_lhs"]}',",
112
-									$fileContents
113
-								);
114
-								file_put_contents($filePath, $out);
115
-							}
116
-						}
117
-					}
118
-				}
119
-			}
120
-		}
121
-	}
56
+    foreach($modules as $module)
57
+    {
58
+        $depRels = new DeployedRelationships($module);
59
+        $relList = $depRels->getRelationshipList();
60
+        foreach($relList as $relName)
61
+        {
62
+            $relObject = $depRels->get($relName);
63
+            $def = $relObject->getDefinition();
64
+            //We only need to fix self referencing one to many relationships
65
+            if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
66
+            {
67
+                $layout_defs = array();
68
+                if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69
+                    continue;
70
+                //Find the extension file containing the vardefs for this relationship
71
+                foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72
+                {
73
+                    if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
74
+                    {
75
+                        $dictionary = array($module => array("fields" => array()));
76
+                        $filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
77
+                        include($filePath);
78
+                        if(isset($dictionary[$module]["fields"][$relName]))
79
+                        {
80
+                            $rhsDef = $dictionary[$module]["fields"][$relName];
81
+                            //Update the vardef for the left side link field
82
+                            if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left')
83
+                            {
84
+                                $rhsDef['side'] = 'left';
85
+                                $fileContents = file_get_contents($filePath);
86
+                                $out = preg_replace(
87
+                                    '/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
+                                    '$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
89
+                                    $fileContents
90
+                                );
91
+                                file_put_contents($filePath, $out);
92
+                            }
93
+                        }
94
+                    }
95
+                }
96
+                //Find the extension file containing the subpanel definition for this relationship
97
+                foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
98
+                {
99
+                    if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
100
+                    {
101
+                        $layout_defs = array($module => array("subpanel_setup" => array()));
102
+                        $filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
103
+                        include($filePath);
104
+                        foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
105
+                        {
106
+                            if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
107
+                            {
108
+                                $fileContents = file_get_contents($filePath);
109
+                                $out = preg_replace(
110
+                                    '/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
111
+                                    "'get_subpanel_data' => '{$def["join_key_lhs"]}',",
112
+                                    $fileContents
113
+                                );
114
+                                file_put_contents($filePath, $out);
115
+                            }
116
+                        }
117
+                    }
118
+                }
119
+            }
120
+        }
121
+    }
122 122
 }
123 123
 
124 124
 if (isset($_REQUEST['execute']) && $_REQUEST['execute'])
125
-	upgrade_custom_relationships();
126 125
\ No newline at end of file
126
+    upgrade_custom_relationships();
127 127
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	if (empty($modules))
54 54
 		$modules = $moduleList;
55 55
 	
56
-	foreach($modules as $module)
56
+	foreach ($modules as $module)
57 57
 	{
58 58
 		$depRels = new DeployedRelationships($module);
59 59
 		$relList = $depRels->getRelationshipList();
60
-		foreach($relList as $relName)
60
+		foreach ($relList as $relName)
61 61
 		{
62 62
 			$relObject = $depRels->get($relName);
63 63
 			$def = $relObject->getDefinition();
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69 69
 					continue;
70 70
 				//Find the extension file containing the vardefs for this relationship
71
-				foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
71
+				foreach (scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72 72
 				{
73
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
73
+					if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php")
74 74
 					{
75 75
 						$dictionary = array($module => array("fields" => array()));
76 76
 						$filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
77 77
 						include($filePath);
78
-						if(isset($dictionary[$module]["fields"][$relName]))
78
+						if (isset($dictionary[$module]["fields"][$relName]))
79 79
 						{
80 80
 							$rhsDef = $dictionary[$module]["fields"][$relName];
81 81
 							//Update the vardef for the left side link field
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 								$rhsDef['side'] = 'left';
85 85
 								$fileContents = file_get_contents($filePath);
86 86
 								$out = preg_replace(
87
-									'/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
-									'$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
87
+									'/\$dictionary[\w"\'\[\]]*?'.$relName.'["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
+									'$dictionary["'.$module.'"]["fields"]["'.$relName.'"]='.var_export_helper($rhsDef).";",
89 89
 									$fileContents
90 90
 								);
91 91
 								file_put_contents($filePath, $out);
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
 					}
95 95
 				}
96 96
 				//Find the extension file containing the subpanel definition for this relationship
97
-				foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
97
+				foreach (scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
98 98
 				{
99
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
99
+					if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php")
100 100
 					{
101 101
 						$layout_defs = array($module => array("subpanel_setup" => array()));
102 102
 						$filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
103 103
 						include($filePath);
104
-						foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
104
+						foreach ($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
105 105
 						{
106 106
 							if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
107 107
 							{
108 108
 								$fileContents = file_get_contents($filePath);
109 109
 								$out = preg_replace(
110
-									'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
110
+									'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]'.$relName.'[\'"],/s',
111 111
 									"'get_subpanel_data' => '{$def["join_key_lhs"]}',",
112 112
 									$fileContents
113 113
 								);
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,13 +45,16 @@  discard block
 block discarded – undo
45 45
 function upgrade_custom_relationships($modules = array())
46 46
 {
47 47
 	global $current_user, $moduleList;
48
-	if (!is_admin($current_user)) sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
48
+	if (!is_admin($current_user)) {
49
+	    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
50
+	}
49 51
 	
50 52
 	require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
51 53
 	require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
52 54
 	
53
-	if (empty($modules))
54
-		$modules = $moduleList;
55
+	if (empty($modules)) {
56
+			$modules = $moduleList;
57
+	}
55 58
 	
56 59
 	foreach($modules as $module)
57 60
 	{
@@ -65,8 +68,9 @@  discard block
 block discarded – undo
65 68
 			if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
66 69
 			{
67 70
 				$layout_defs = array();
68
-				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69
-					continue;
71
+				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs")) {
72
+									continue;
73
+				}
70 74
 				//Find the extension file containing the vardefs for this relationship
71 75
 				foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72 76
 				{
@@ -121,5 +125,6 @@  discard block
 block discarded – undo
121 125
 	}
122 126
 }
123 127
 
124
-if (isset($_REQUEST['execute']) && $_REQUEST['execute'])
125
-	upgrade_custom_relationships();
126 128
\ No newline at end of file
129
+if (isset($_REQUEST['execute']) && $_REQUEST['execute']) {
130
+	upgrade_custom_relationships();
131
+}
Please login to merge, or discard this patch.
modules/Administration/DiagnosticDelete.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
         "Administration",
52 52
         array(
53 53
             "<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
54
-           translate('LBL_DIAGNOSTIC_TITLE')
55
-           ),
54
+            translate('LBL_DIAGNOSTIC_TITLE')
55
+            ),
56 56
         true
57 57
         );
58 58
 
59 59
 
60 60
 if(empty($_REQUEST['file']) || empty($_REQUEST['guid']))
61 61
 {
62
-	echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
62
+    echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
63 63
 }
64 64
 else
65 65
 {
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
     clean_string($_REQUEST['guid'], "ALPHANUM");
68 68
     clean_string($_REQUEST['file'], "FILE");
69 69
 
70
-	//Making sure someone doesn't pass a variable name as a false reference
71
-	//  to delete a file
72
-	if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
73
-	{
74
-		die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
75
-	}
70
+    //Making sure someone doesn't pass a variable name as a false reference
71
+    //  to delete a file
72
+    if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
73
+    {
74
+        die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
75
+    }
76 76
 
77
-	if(file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
78
-	{
79
-  	  unlink($cachedfile);
80
-  	  rmdir(dirname($cachedfile));
81
-	  echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
82
-	}
83
-	else
84
-	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
77
+    if(file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
78
+    {
79
+        unlink($cachedfile);
80
+        rmdir(dirname($cachedfile));
81
+        echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
82
+    }
83
+    else
84
+        echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85 85
 }
86 86
 
87 87
 print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         );
58 58
 
59 59
 
60
-if(empty($_REQUEST['file']) || empty($_REQUEST['guid']))
60
+if (empty($_REQUEST['file']) || empty($_REQUEST['guid']))
61 61
 {
62 62
 	echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
63 63
 }
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
 
70 70
 	//Making sure someone doesn't pass a variable name as a false reference
71 71
 	//  to delete a file
72
-	if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
72
+	if (strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
73 73
 	{
74 74
 		die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
75 75
 	}
76 76
 
77
-	if(file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
77
+	if (file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
78 78
 	{
79 79
   	  unlink($cachedfile);
80 80
   	  rmdir(dirname($cachedfile));
81 81
 	  echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
82 82
 	}
83 83
 	else
84
-	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
84
+	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'].$_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85 85
 }
86 86
 
87
-print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
87
+print "<a href=\"index.php?module=Administration&action=index\">".$mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN']."</a><br>";
88 88
 
89 89
 ?>
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -60,8 +62,7 @@  discard block
 block discarded – undo
60 62
 if(empty($_REQUEST['file']) || empty($_REQUEST['guid']))
61 63
 {
62 64
 	echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
63
-}
64
-else
65
+} else
65 66
 {
66 67
     // Make sure the guid and file are valid file names for security purposes
67 68
     clean_string($_REQUEST['guid'], "ALPHANUM");
@@ -79,10 +80,10 @@  discard block
 block discarded – undo
79 80
   	  unlink($cachedfile);
80 81
   	  rmdir(dirname($cachedfile));
81 82
 	  echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
83
+	} else {
84
+		  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85
+	}
82 86
 	}
83
-	else
84
-	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85
-}
86 87
 
87 88
 print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
88 89
 
Please login to merge, or discard this patch.