Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
modules/Administration/repairSelectModule.php 3 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (!defined('sugarEntry') || !sugarEntry)
3
-	die('Not A Valid Entry Point');
3
+    die('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,41 +40,41 @@  discard block
 block discarded – undo
40 40
  ********************************************************************************/
41 41
 
42 42
 		
43
-		global $mod_strings;
44
-		global $current_language;
45
-		$smarty = new Sugar_Smarty();
46
-			$temp_bean_list = $beanList;
47
-			asort($temp_bean_list);
48
-			$values= array_values($temp_bean_list);
49
-			$output= array_keys($temp_bean_list);  
50
-			$output_local = array();
51
-			if($current_language != 'en_us') {
52
-				foreach($output as $temp_out) {
53
-					$output_local[] = translate($temp_out);
54
-				}
55
-			} else {
56
-				$output_local = $output;
57
-			}
58
-			//sort($output);
59
-			//sort($values);
60
-			$values=array_merge(array($mod_strings['LBL_ALL_MODULES']), $values);
61
-			$output= array_merge(array($mod_strings['LBL_ALL_MODULES']),$output_local);
62
-			$checkbox_values=array(
63
-									 'clearTpls',
64
-									 'clearJsFiles',
65
-									 'clearVardefs', 
66
-									 'clearJsLangFiles',
67
-									 'clearDashlets',
68
-									 'clearSugarFeedCache',
69
-									 'clearThemeCache',
70
-									 'rebuildAuditTables',
71
-									 'rebuildExtensions',
72
-									 'clearLangFiles',
73
-                                     'clearSearchCache',
74
-			                         'clearPDFFontCache',
75
-			                         //'repairDatabase'
76
-									 );
77
-			$checkbox_output = array(   $mod_strings['LBL_QR_CBOX_CLEARTPL'], 
43
+        global $mod_strings;
44
+        global $current_language;
45
+        $smarty = new Sugar_Smarty();
46
+            $temp_bean_list = $beanList;
47
+            asort($temp_bean_list);
48
+            $values= array_values($temp_bean_list);
49
+            $output= array_keys($temp_bean_list);  
50
+            $output_local = array();
51
+            if($current_language != 'en_us') {
52
+                foreach($output as $temp_out) {
53
+                    $output_local[] = translate($temp_out);
54
+                }
55
+            } else {
56
+                $output_local = $output;
57
+            }
58
+            //sort($output);
59
+            //sort($values);
60
+            $values=array_merge(array($mod_strings['LBL_ALL_MODULES']), $values);
61
+            $output= array_merge(array($mod_strings['LBL_ALL_MODULES']),$output_local);
62
+            $checkbox_values=array(
63
+                                        'clearTpls',
64
+                                        'clearJsFiles',
65
+                                        'clearVardefs', 
66
+                                        'clearJsLangFiles',
67
+                                        'clearDashlets',
68
+                                        'clearSugarFeedCache',
69
+                                        'clearThemeCache',
70
+                                        'rebuildAuditTables',
71
+                                        'rebuildExtensions',
72
+                                        'clearLangFiles',
73
+                                        'clearSearchCache',
74
+                                        'clearPDFFontCache',
75
+                                        //'repairDatabase'
76
+                                        );
77
+            $checkbox_output = array(   $mod_strings['LBL_QR_CBOX_CLEARTPL'], 
78 78
                                         $mod_strings['LBL_QR_CBOX_CLEARJS'],
79 79
                                         $mod_strings['LBL_QR_CBOX_CLEARVARDEFS'],
80 80
                                         $mod_strings['LBL_QR_CBOX_CLEARJSLANG'],
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
                                         $mod_strings['LBL_QR_CBOX_CLEARSEARCH'],
88 88
                                         $mod_strings['LBL_QR_CBOX_CLEARPDFFONT'],
89 89
                                         //$mod_strings['LBL_QR_CBOX_DATAB'],
90
-									 );
91
-			$smarty->assign('checkbox_values', $checkbox_values);
92
-			$smarty->assign('values', $values);
93
-			$smarty->assign('output', $output);
94
-			$smarty->assign('MOD', $mod_strings);
95
-			$smarty->assign('checkbox_output', $checkbox_output);
96
-			$smarty->assign('checkbox_values', $checkbox_values);
97
-			$smarty->display("modules/Administration/templates/QuickRepairAndRebuild.tpl");			
90
+                                        );
91
+            $smarty->assign('checkbox_values', $checkbox_values);
92
+            $smarty->assign('values', $values);
93
+            $smarty->assign('output', $output);
94
+            $smarty->assign('MOD', $mod_strings);
95
+            $smarty->assign('checkbox_output', $checkbox_output);
96
+            $smarty->assign('checkbox_values', $checkbox_values);
97
+            $smarty->display("modules/Administration/templates/QuickRepairAndRebuild.tpl");			
98 98
 			
99 99
 			
100 100
 ?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		$smarty = new Sugar_Smarty();
46 46
 			$temp_bean_list = $beanList;
47 47
 			asort($temp_bean_list);
48
-			$values= array_values($temp_bean_list);
49
-			$output= array_keys($temp_bean_list);  
48
+			$values = array_values($temp_bean_list);
49
+			$output = array_keys($temp_bean_list);  
50 50
 			$output_local = array();
51
-			if($current_language != 'en_us') {
52
-				foreach($output as $temp_out) {
51
+			if ($current_language != 'en_us') {
52
+				foreach ($output as $temp_out) {
53 53
 					$output_local[] = translate($temp_out);
54 54
 				}
55 55
 			} else {
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 			}
58 58
 			//sort($output);
59 59
 			//sort($values);
60
-			$values=array_merge(array($mod_strings['LBL_ALL_MODULES']), $values);
61
-			$output= array_merge(array($mod_strings['LBL_ALL_MODULES']),$output_local);
62
-			$checkbox_values=array(
60
+			$values = array_merge(array($mod_strings['LBL_ALL_MODULES']), $values);
61
+			$output = array_merge(array($mod_strings['LBL_ALL_MODULES']), $output_local);
62
+			$checkbox_values = array(
63 63
 									 'clearTpls',
64 64
 									 'clearJsFiles',
65 65
 									 'clearVardefs', 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			                         'clearPDFFontCache',
75 75
 			                         //'repairDatabase'
76 76
 									 );
77
-			$checkbox_output = array(   $mod_strings['LBL_QR_CBOX_CLEARTPL'], 
77
+			$checkbox_output = array($mod_strings['LBL_QR_CBOX_CLEARTPL'], 
78 78
                                         $mod_strings['LBL_QR_CBOX_CLEARJS'],
79 79
                                         $mod_strings['LBL_QR_CBOX_CLEARVARDEFS'],
80 80
                                         $mod_strings['LBL_QR_CBOX_CLEARJSLANG'],
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('sugarEntry') || !sugarEntry)
2
+if (!defined('sugarEntry') || !sugarEntry) {
3 3
 	die('Not A Valid Entry Point');
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Administration/undoupdateclass.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@
 block discarded – undo
42 42
 require("include/modules.php");
43 43
 foreach ($beanFiles as $Classname => $filename){ 
44 44
     // Find the name of the file generated by the updateclass script
45
-	$pos=strrpos($filename,"/");
46
-	$Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0);
45
+    $pos=strrpos($filename,"/");
46
+    $Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0);
47 47
     //delete the new SugarBean that extends CoreBean and replace it by the old one undoing all the changes
48
-	if (file_exists($Newfilename)){
49
-		unlink($filename);
50
-		$handle = file_get_contents($Newfilename);
51
-		$data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle);
52
-		$data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data);
53
-		file_put_contents($Newfilename,$data1);
54
-		rename($Newfilename,$filename);
55
-	}
48
+    if (file_exists($Newfilename)){
49
+        unlink($filename);
50
+        $handle = file_get_contents($Newfilename);
51
+        $data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle);
52
+        $data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data);
53
+        file_put_contents($Newfilename,$data1);
54
+        rename($Newfilename,$filename);
55
+    }
56 56
 }
57 57
 ?>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 
2 2
 <?php
3
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
  ********************************************************************************/
41 41
 
42 42
 require("include/modules.php");
43
-foreach ($beanFiles as $Classname => $filename){ 
43
+foreach ($beanFiles as $Classname => $filename) { 
44 44
     // Find the name of the file generated by the updateclass script
45
-	$pos=strrpos($filename,"/");
46
-	$Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0);
45
+	$pos = strrpos($filename, "/");
46
+	$Newfilename = substr_replace($filename, 'SugarCore.', $pos + 1, 0);
47 47
     //delete the new SugarBean that extends CoreBean and replace it by the old one undoing all the changes
48
-	if (file_exists($Newfilename)){
48
+	if (file_exists($Newfilename)) {
49 49
 		unlink($filename);
50 50
 		$handle = file_get_contents($Newfilename);
51 51
 		$data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle);
52 52
 		$data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data);
53
-		file_put_contents($Newfilename,$data1);
54
-		rename($Newfilename,$filename);
53
+		file_put_contents($Newfilename, $data1);
54
+		rename($Newfilename, $filename);
55 55
 	}
56 56
 }
57 57
 ?>
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/repairUniSearch.php 2 patches
Spacing   +8 added lines, -8 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,14 +43,14 @@  discard block
 block discarded – undo
43 43
 
44 44
 global $sugar_config, $mod_strings;
45 45
 
46
-$search_dir=sugar_cached('');
46
+$search_dir = sugar_cached('');
47 47
 
48
-$src_file = $search_dir . 'modules/unified_search_modules.php';
49
-if(file_exists($src_file)) {
50
-    print( $mod_strings['LBL_CLEAR_UNIFIED_SEARCH_CACHE_DELETING1'] . "<br>" );
51
-    print( $mod_strings['LBL_CLEAR_UNIFIED_SEARCH_CACHE_DELETING2'] . " $src_file<BR>" ) ;
52
-    unlink( "$src_file" );
48
+$src_file = $search_dir.'modules/unified_search_modules.php';
49
+if (file_exists($src_file)) {
50
+    print($mod_strings['LBL_CLEAR_UNIFIED_SEARCH_CACHE_DELETING1']."<br>");
51
+    print($mod_strings['LBL_CLEAR_UNIFIED_SEARCH_CACHE_DELETING2']." $src_file<BR>");
52
+    unlink("$src_file");
53 53
 }
54 54
 
55
-echo "\n--- " . $mod_strings['LBL_DONE'] . "---<br />\n";
55
+echo "\n--- ".$mod_strings['LBL_DONE']."---<br />\n";
56 56
 ?>
57 57
\ No newline at end of file
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/Development.php 2 patches
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.
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 
53 53
 ?>
54 54
 <p>
55
-<table cellspacing="<?php echo $gridline;?>" class="other view">
55
+<table cellspacing="<?php echo $gridline; ?>" class="other view">
56 56
 <tr>
57
-	<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('ImportCustomFields','align="absmiddle" border="0"',null,null,'.gif',$mod_strings['LBL_IMPORT_CUSTOM_FIELDS_TITLE']); ?>&nbsp;<a href="./index.php?module=Administration&action=ImportCustomFieldStructure" class="tabDetailViewDL2Link"><?php echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS_TITLE']; ?></a></td>
58
-	<td> <?php echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS'] ; ?> </td>
57
+	<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('ImportCustomFields', 'align="absmiddle" border="0"', null, null, '.gif', $mod_strings['LBL_IMPORT_CUSTOM_FIELDS_TITLE']); ?>&nbsp;<a href="./index.php?module=Administration&action=ImportCustomFieldStructure" class="tabDetailViewDL2Link"><?php echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS_TITLE']; ?></a></td>
58
+	<td> <?php echo $mod_strings['LBL_IMPORT_CUSTOM_FIELDS']; ?> </td>
59 59
 </tr>
60 60
 <tr>
61
-	<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('ExportCustomFields','align="absmiddle" border="0"',null,null,'.gif',$mod_strings['LBL_EXPORT_CUSTOM_FIELDS_TITLE']); ?>&nbsp;<a href="./index.php?module=Administration&action=ExportCustomFieldStructure" class="tabDetailViewDL2Link"><?php echo $mod_strings['LBL_EXPORT_CUSTOM_FIELDS_TITLE']; ?></a></td>
62
-	<td> <?php echo $mod_strings['LBL_EXPORT_CUSTOM_FIELDS'] ; ?> </td>
61
+	<td scope="row"><?php echo SugarThemeRegistry::current()->getImage('ExportCustomFields', 'align="absmiddle" border="0"', null, null, '.gif', $mod_strings['LBL_EXPORT_CUSTOM_FIELDS_TITLE']); ?>&nbsp;<a href="./index.php?module=Administration&action=ExportCustomFieldStructure" class="tabDetailViewDL2Link"><?php echo $mod_strings['LBL_EXPORT_CUSTOM_FIELDS_TITLE']; ?></a></td>
62
+	<td> <?php echo $mod_strings['LBL_EXPORT_CUSTOM_FIELDS']; ?> </td>
63 63
 </tr>
64 64
 
65 65
 </table></p>
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/RebuildExpressionPlugins.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,5 +40,5 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 
42 42
 if(is_admin($current_user)){
43
-	require_once("include/Expressions/updatecache.php");
43
+    require_once("include/Expressions/updatecache.php");
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
1
+<?php if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2 2
 /*********************************************************************************
3 3
  * SugarCRM Community Edition is a customer relationship management program developed by
4 4
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,6 +39,6 @@  discard block
 block discarded – undo
39 39
 
40 40
 global $current_user;
41 41
 
42
-if(is_admin($current_user)){
42
+if (is_admin($current_user)) {
43 43
 	require_once("include/Expressions/updatecache.php");
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
1
+<?php if(!defined('sugarEntry') || !sugarEntry) {
2
+    die('Not A Valid Entry Point');
3
+}
2 4
 /*********************************************************************************
3 5
  * SugarCRM Community Edition is a customer relationship management program developed by
4 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Administration/RepairIndex.php 3 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -42,58 +42,58 @@  discard block
 block discarded – undo
42 42
 ///////////////////////////////////////////////////////////////////////////////
43 43
 ////	LOCAL UTILITY
44 44
 function compare($table_name, $db_indexes, $var_indexes) {
45
-	global $add_index, $drop_index, $change_index;
46
-	if(empty($change_index))$change_index = array();
47
-	foreach ($var_indexes as $var_i_name=>$var_i_def) {
48
-		//find corresponding db index with same name
49
-		//else by columns in the index.
50
-		$sel_db_index = null;
51
-		$var_fields_string ='';
52
-		if(count($var_i_def['fields'])>0)
53
-			$var_fields_string = implode('',$var_i_def['fields']);
54
-		$field_list_match = false;
55
-		if(isset($db_indexes[$var_i_name])) {
56
-			$sel_db_index = $db_indexes[$var_i_name];
57
-			$db_fields_string = implode('', $db_indexes[$var_i_name]['fields']);
58
-			if(strcasecmp($var_fields_string, $db_fields_string)==0) {
59
-				$field_list_match=true;
60
-			}
61
-		} else {
62
-			//search by column list.
63
-			foreach ($db_indexes as $db_i_name=>$db_i_def) {
64
-				$db_fields_string=implode('',$db_i_def['fields']);
65
-				if(strcasecmp($var_fields_string , $db_fields_string)==0) {
66
-					$sel_db_index=$db_indexes[$db_i_name];
67
-					$field_list_match=true;
68
-					break;
69
-				}
70
-			}
71
-		}
45
+    global $add_index, $drop_index, $change_index;
46
+    if(empty($change_index))$change_index = array();
47
+    foreach ($var_indexes as $var_i_name=>$var_i_def) {
48
+        //find corresponding db index with same name
49
+        //else by columns in the index.
50
+        $sel_db_index = null;
51
+        $var_fields_string ='';
52
+        if(count($var_i_def['fields'])>0)
53
+            $var_fields_string = implode('',$var_i_def['fields']);
54
+        $field_list_match = false;
55
+        if(isset($db_indexes[$var_i_name])) {
56
+            $sel_db_index = $db_indexes[$var_i_name];
57
+            $db_fields_string = implode('', $db_indexes[$var_i_name]['fields']);
58
+            if(strcasecmp($var_fields_string, $db_fields_string)==0) {
59
+                $field_list_match=true;
60
+            }
61
+        } else {
62
+            //search by column list.
63
+            foreach ($db_indexes as $db_i_name=>$db_i_def) {
64
+                $db_fields_string=implode('',$db_i_def['fields']);
65
+                if(strcasecmp($var_fields_string , $db_fields_string)==0) {
66
+                    $sel_db_index=$db_indexes[$db_i_name];
67
+                    $field_list_match=true;
68
+                    break;
69
+                }
70
+            }
71
+        }
72 72
 
73
-		//no matching index in database.
74
-		if(empty($sel_db_index)) {
75
-			$add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
76
-			continue;
77
-		}
78
-		if(!$field_list_match) {
79
-			//drop the db index and create new index based on vardef
80
-			$drop_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$sel_db_index,true);
81
-			$add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
82
-			continue;
83
-		}
84
-		//check for name match.
85
-		//it should not occur for indexes of type primary or unique.
86
-		if( $var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
87
-			//rename index.
88
-			$rename=$GLOBALS['db']->renameIndexDefs($sel_db_index,$var_i_def,$table_name);
89
-			if(is_array($rename)) {
90
-				$change_index=array_merge($change_index,$rename);
91
-			} else {
92
-				$change_index[]=$rename;
93
-			}
94
-			continue;
95
-		}
96
-	}
73
+        //no matching index in database.
74
+        if(empty($sel_db_index)) {
75
+            $add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
76
+            continue;
77
+        }
78
+        if(!$field_list_match) {
79
+            //drop the db index and create new index based on vardef
80
+            $drop_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$sel_db_index,true);
81
+            $add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
82
+            continue;
83
+        }
84
+        //check for name match.
85
+        //it should not occur for indexes of type primary or unique.
86
+        if( $var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
87
+            //rename index.
88
+            $rename=$GLOBALS['db']->renameIndexDefs($sel_db_index,$var_i_def,$table_name);
89
+            if(is_array($rename)) {
90
+                $change_index=array_merge($change_index,$rename);
91
+            } else {
92
+                $change_index[]=$rename;
93
+            }
94
+            continue;
95
+        }
96
+    }
97 97
 }
98 98
 ////	END LOCAL UTILITY
99 99
 ///////////////////////////////////////////////////////////////////////////////
@@ -124,38 +124,38 @@  discard block
 block discarded – undo
124 124
 (function_exists('logThis')) ? logThis("found ".count($dictionary)." Dictionary entries to process") : "";
125 125
 
126 126
 foreach ($beanFiles as $beanname=>$beanpath) {
127
-	require_once($beanpath);
128
-	$focus= new $beanname();
127
+    require_once($beanpath);
128
+    $focus= new $beanname();
129 129
 
130
-	//skips beans based on same tables. user, employee and group are an example.
131
-	if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
132
-		continue;
133
-	} else {
134
-		$processed_tables[$focus->table_name]=$focus->table_name;
135
-	}
130
+    //skips beans based on same tables. user, employee and group are an example.
131
+    if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
132
+        continue;
133
+    } else {
134
+        $processed_tables[$focus->table_name]=$focus->table_name;
135
+    }
136 136
 
137
-	if(!empty($dictionary[$focus->object_name]['indices'])) {
138
-		$indices=$dictionary[$focus->object_name]['indices'];
139
-	} else {
140
-		$indices=array();
141
-	}
137
+    if(!empty($dictionary[$focus->object_name]['indices'])) {
138
+        $indices=$dictionary[$focus->object_name]['indices'];
139
+    } else {
140
+        $indices=array();
141
+    }
142 142
 
143
-	//clean vardef defintions.. removed indexes not value for this dbtype.
144
-	//set index name as the key.
145
-	$var_indices=array();
146
-	foreach ($indices as $definition) {
147
-		//database helpers do not know how to handle full text indices
148
-		if ($definition['type']=='fulltext') {
149
-			continue;
150
-		}
143
+    //clean vardef defintions.. removed indexes not value for this dbtype.
144
+    //set index name as the key.
145
+    $var_indices=array();
146
+    foreach ($indices as $definition) {
147
+        //database helpers do not know how to handle full text indices
148
+        if ($definition['type']=='fulltext') {
149
+            continue;
150
+        }
151 151
 
152
-		if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
153
-			$var_indices[$definition['name']] = $definition;
154
-		}
155
-	}
152
+        if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
153
+            $var_indices[$definition['name']] = $definition;
154
+        }
155
+    }
156 156
 
157
-	$db_indices=$focus->db->get_indices($focus->table_name);
158
-	compare($focus->table_name,$db_indices,$var_indices);
157
+    $db_indices=$focus->db->get_indices($focus->table_name);
158
+    compare($focus->table_name,$db_indices,$var_indices);
159 159
 }
160 160
 ////	END PROCESS MODULE BEANS
161 161
 ///////////////////////////////////////////////////////////////////////////////
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 ////	PROCESS RELATIONSHIP METADATA - run thru many to many relationship files too...
166 166
 include('modules/TableDictionary.php');
167 167
 foreach ($dictionary as $rel=>$rel_def) {
168
-	if(!empty($rel_def['indices'])) {
169
-		$indices=$rel_def['indices'];
170
-	} else {
171
-		$indices=array();
172
-	}
168
+    if(!empty($rel_def['indices'])) {
169
+        $indices=$rel_def['indices'];
170
+    } else {
171
+        $indices=array();
172
+    }
173 173
 
174
-	//clean vardef defintions.. removed indexes not value for this dbtype.
175
-	//set index name as the key.
176
-	$var_indices=array();
177
-	foreach ($indices as $definition) {
178
-		if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
179
-			$var_indices[$definition['name']] = $definition;
180
-		}
181
-	}
174
+    //clean vardef defintions.. removed indexes not value for this dbtype.
175
+    //set index name as the key.
176
+    $var_indices=array();
177
+    foreach ($indices as $definition) {
178
+        if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
179
+            $var_indices[$definition['name']] = $definition;
180
+        }
181
+    }
182 182
 
183
-	$db_indices=$focus->db->get_indices($rel_def['table']);
183
+    $db_indices=$focus->db->get_indices($rel_def['table']);
184 184
 
185
-	compare($rel_def['table'],$db_indices,$var_indices);
185
+    compare($rel_def['table'],$db_indices,$var_indices);
186 186
 }
187 187
 ////	END PROCESS RELATIONSHIP METADATA
188 188
 ///////////////////////////////////////////////////////////////////////////////
@@ -193,64 +193,64 @@  discard block
 block discarded – undo
193 193
 (function_exists('logThis')) ? logThis("RepairIndex: we have ".count($change_index)." indices to CHANGE.") : "";
194 194
 
195 195
 if((count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0)) {
196
-	if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
197
-		echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
198
-		echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
199
-	}
196
+    if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
197
+        echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
198
+        echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
199
+    }
200 200
 
201
-	$focus = new Account();
202
-	if(count($drop_index) > 0) {
203
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
204
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
205
-			foreach ($drop_index as $statement) {
206
-				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
207
-				(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
208
-				$focus->db->query($statement);
209
-			}
210
-		} else {
211
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROP'];
212
-			foreach ($drop_index as $statement) {
213
-				echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
214
-			}
215
-		}
216
-	}
201
+    $focus = new Account();
202
+    if(count($drop_index) > 0) {
203
+        if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
204
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
205
+            foreach ($drop_index as $statement) {
206
+                echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
207
+                (function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
208
+                $focus->db->query($statement);
209
+            }
210
+        } else {
211
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROP'];
212
+            foreach ($drop_index as $statement) {
213
+                echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
214
+            }
215
+        }
216
+    }
217 217
 
218
-	if(count($add_index) > 0) {
219
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
220
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADDING'];
221
-			foreach ($add_index as $statement) {
222
-				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
223
-				(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
224
-				$focus->db->query($statement);
225
-			}
226
-		} else {
227
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADD'];
228
-			foreach ($add_index as $statement) {
229
-				echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
230
-			}
231
-		}
232
-	}
233
-	if(count($change_index) > 0) {
234
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
235
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTERING'];
236
-			foreach ($change_index as $statement) {
237
-				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
238
-				(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
239
-				$focus->db->query($statement);
240
-			}
241
-		} else {
242
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTER'];
243
-			foreach ($change_index as $statement) {
244
-				echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
245
-			}
246
-		}
247
-	}
218
+    if(count($add_index) > 0) {
219
+        if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
220
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADDING'];
221
+            foreach ($add_index as $statement) {
222
+                echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
223
+                (function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
224
+                $focus->db->query($statement);
225
+            }
226
+        } else {
227
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADD'];
228
+            foreach ($add_index as $statement) {
229
+                echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
230
+            }
231
+        }
232
+    }
233
+    if(count($change_index) > 0) {
234
+        if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
235
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTERING'];
236
+            foreach ($change_index as $statement) {
237
+                echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
238
+                (function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
239
+                $focus->db->query($statement);
240
+            }
241
+        } else {
242
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTER'];
243
+            foreach ($change_index as $statement) {
244
+                echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
245
+            }
246
+        }
247
+    }
248 248
 
249
-	if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
250
-		echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
251
-		echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
252
-	}
249
+    if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
250
+        echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
251
+        echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
252
+    }
253 253
 } else {
254
-	(function_exists('logThis')) ? logThis("RepairIndex: Index definitions are in sync.") : "";
255
-	echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_SYNC'];
254
+    (function_exists('logThis')) ? logThis("RepairIndex: Index definitions are in sync.") : "";
255
+    echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_SYNC'];
256 256
 }
257 257
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 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,53 +43,53 @@  discard block
 block discarded – undo
43 43
 ////	LOCAL UTILITY
44 44
 function compare($table_name, $db_indexes, $var_indexes) {
45 45
 	global $add_index, $drop_index, $change_index;
46
-	if(empty($change_index))$change_index = array();
46
+	if (empty($change_index))$change_index = array();
47 47
 	foreach ($var_indexes as $var_i_name=>$var_i_def) {
48 48
 		//find corresponding db index with same name
49 49
 		//else by columns in the index.
50 50
 		$sel_db_index = null;
51
-		$var_fields_string ='';
52
-		if(count($var_i_def['fields'])>0)
53
-			$var_fields_string = implode('',$var_i_def['fields']);
51
+		$var_fields_string = '';
52
+		if (count($var_i_def['fields']) > 0)
53
+			$var_fields_string = implode('', $var_i_def['fields']);
54 54
 		$field_list_match = false;
55
-		if(isset($db_indexes[$var_i_name])) {
55
+		if (isset($db_indexes[$var_i_name])) {
56 56
 			$sel_db_index = $db_indexes[$var_i_name];
57 57
 			$db_fields_string = implode('', $db_indexes[$var_i_name]['fields']);
58
-			if(strcasecmp($var_fields_string, $db_fields_string)==0) {
59
-				$field_list_match=true;
58
+			if (strcasecmp($var_fields_string, $db_fields_string) == 0) {
59
+				$field_list_match = true;
60 60
 			}
61 61
 		} else {
62 62
 			//search by column list.
63 63
 			foreach ($db_indexes as $db_i_name=>$db_i_def) {
64
-				$db_fields_string=implode('',$db_i_def['fields']);
65
-				if(strcasecmp($var_fields_string , $db_fields_string)==0) {
66
-					$sel_db_index=$db_indexes[$db_i_name];
67
-					$field_list_match=true;
64
+				$db_fields_string = implode('', $db_i_def['fields']);
65
+				if (strcasecmp($var_fields_string, $db_fields_string) == 0) {
66
+					$sel_db_index = $db_indexes[$db_i_name];
67
+					$field_list_match = true;
68 68
 					break;
69 69
 				}
70 70
 			}
71 71
 		}
72 72
 
73 73
 		//no matching index in database.
74
-		if(empty($sel_db_index)) {
75
-			$add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
74
+		if (empty($sel_db_index)) {
75
+			$add_index[] = $GLOBALS['db']->add_drop_constraint($table_name, $var_i_def);
76 76
 			continue;
77 77
 		}
78
-		if(!$field_list_match) {
78
+		if (!$field_list_match) {
79 79
 			//drop the db index and create new index based on vardef
80
-			$drop_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$sel_db_index,true);
81
-			$add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
80
+			$drop_index[] = $GLOBALS['db']->add_drop_constraint($table_name, $sel_db_index, true);
81
+			$add_index[] = $GLOBALS['db']->add_drop_constraint($table_name, $var_i_def);
82 82
 			continue;
83 83
 		}
84 84
 		//check for name match.
85 85
 		//it should not occur for indexes of type primary or unique.
86
-		if( $var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
86
+		if ($var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
87 87
 			//rename index.
88
-			$rename=$GLOBALS['db']->renameIndexDefs($sel_db_index,$var_i_def,$table_name);
89
-			if(is_array($rename)) {
90
-				$change_index=array_merge($change_index,$rename);
88
+			$rename = $GLOBALS['db']->renameIndexDefs($sel_db_index, $var_i_def, $table_name);
89
+			if (is_array($rename)) {
90
+				$change_index = array_merge($change_index, $rename);
91 91
 			} else {
92
-				$change_index[]=$rename;
92
+				$change_index[] = $rename;
93 93
 			}
94 94
 			continue;
95 95
 		}
@@ -101,22 +101,22 @@  discard block
 block discarded – undo
101 101
 
102 102
 ///////////////////////////////////////////////////////////////////////////////
103 103
 ////	PROCESS
104
-if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
104
+if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
105 105
 set_time_limit(3600);
106 106
 /**
107 107
  * Note: $_REQUEST['silent'] is set from ModuleInstaller::repair_indices();
108 108
  */
109
-if(!isset($_REQUEST['silent'])) $_REQUEST['silent'] = false;
109
+if (!isset($_REQUEST['silent'])) $_REQUEST['silent'] = false;
110 110
 
111
-$add_index=array();
112
-$drop_index=array();
113
-$change_index=array();
111
+$add_index = array();
112
+$drop_index = array();
113
+$change_index = array();
114 114
 
115
-global $current_user, $beanFiles, $dictionary, $sugar_config, $mod_strings;;
115
+global $current_user, $beanFiles, $dictionary, $sugar_config, $mod_strings; ;
116 116
 include_once ('include/database/DBManager.php');
117 117
 
118 118
 $db = &DBManagerFactory::getInstance();
119
-$processed_tables=array();
119
+$processed_tables = array();
120 120
 
121 121
 ///////////////////////////////////////////////////////////////////////////////
122 122
 ////	PROCESS MODULE BEANS
@@ -125,37 +125,37 @@  discard block
 block discarded – undo
125 125
 
126 126
 foreach ($beanFiles as $beanname=>$beanpath) {
127 127
 	require_once($beanpath);
128
-	$focus= new $beanname();
128
+	$focus = new $beanname();
129 129
 
130 130
 	//skips beans based on same tables. user, employee and group are an example.
131
-	if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
131
+	if (empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
132 132
 		continue;
133 133
 	} else {
134
-		$processed_tables[$focus->table_name]=$focus->table_name;
134
+		$processed_tables[$focus->table_name] = $focus->table_name;
135 135
 	}
136 136
 
137
-	if(!empty($dictionary[$focus->object_name]['indices'])) {
138
-		$indices=$dictionary[$focus->object_name]['indices'];
137
+	if (!empty($dictionary[$focus->object_name]['indices'])) {
138
+		$indices = $dictionary[$focus->object_name]['indices'];
139 139
 	} else {
140
-		$indices=array();
140
+		$indices = array();
141 141
 	}
142 142
 
143 143
 	//clean vardef defintions.. removed indexes not value for this dbtype.
144 144
 	//set index name as the key.
145
-	$var_indices=array();
145
+	$var_indices = array();
146 146
 	foreach ($indices as $definition) {
147 147
 		//database helpers do not know how to handle full text indices
148
-		if ($definition['type']=='fulltext') {
148
+		if ($definition['type'] == 'fulltext') {
149 149
 			continue;
150 150
 		}
151 151
 
152
-		if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
152
+		if (empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
153 153
 			$var_indices[$definition['name']] = $definition;
154 154
 		}
155 155
 	}
156 156
 
157
-	$db_indices=$focus->db->get_indices($focus->table_name);
158
-	compare($focus->table_name,$db_indices,$var_indices);
157
+	$db_indices = $focus->db->get_indices($focus->table_name);
158
+	compare($focus->table_name, $db_indices, $var_indices);
159 159
 }
160 160
 ////	END PROCESS MODULE BEANS
161 161
 ///////////////////////////////////////////////////////////////////////////////
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 ////	PROCESS RELATIONSHIP METADATA - run thru many to many relationship files too...
166 166
 include('modules/TableDictionary.php');
167 167
 foreach ($dictionary as $rel=>$rel_def) {
168
-	if(!empty($rel_def['indices'])) {
169
-		$indices=$rel_def['indices'];
168
+	if (!empty($rel_def['indices'])) {
169
+		$indices = $rel_def['indices'];
170 170
 	} else {
171
-		$indices=array();
171
+		$indices = array();
172 172
 	}
173 173
 
174 174
 	//clean vardef defintions.. removed indexes not value for this dbtype.
175 175
 	//set index name as the key.
176
-	$var_indices=array();
176
+	$var_indices = array();
177 177
 	foreach ($indices as $definition) {
178
-		if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
178
+		if (empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
179 179
 			$var_indices[$definition['name']] = $definition;
180 180
 		}
181 181
 	}
182 182
 
183
-	$db_indices=$focus->db->get_indices($rel_def['table']);
183
+	$db_indices = $focus->db->get_indices($rel_def['table']);
184 184
 
185
-	compare($rel_def['table'],$db_indices,$var_indices);
185
+	compare($rel_def['table'], $db_indices, $var_indices);
186 186
 }
187 187
 ////	END PROCESS RELATIONSHIP METADATA
188 188
 ///////////////////////////////////////////////////////////////////////////////
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 (function_exists('logThis')) ? logThis("RepairIndex: we have ".count($add_index)." indices to ADD.") : "";
193 193
 (function_exists('logThis')) ? logThis("RepairIndex: we have ".count($change_index)." indices to CHANGE.") : "";
194 194
 
195
-if((count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0)) {
196
-	if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
195
+if ((count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0)) {
196
+	if (!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
197 197
 		echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
198 198
 		echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
199 199
 	}
200 200
 
201 201
 	$focus = new Account();
202
-	if(count($drop_index) > 0) {
203
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
202
+	if (count($drop_index) > 0) {
203
+		if (isset($_REQUEST['mode']) and $_REQUEST['mode'] == 'execute') {
204 204
 			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
205 205
 			foreach ($drop_index as $statement) {
206 206
 				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 	}
217 217
 
218
-	if(count($add_index) > 0) {
219
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
218
+	if (count($add_index) > 0) {
219
+		if (isset($_REQUEST['mode']) and $_REQUEST['mode'] == 'execute') {
220 220
 			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADDING'];
221 221
 			foreach ($add_index as $statement) {
222 222
 				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 			}
231 231
 		}
232 232
 	}
233
-	if(count($change_index) > 0) {
234
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
233
+	if (count($change_index) > 0) {
234
+		if (isset($_REQUEST['mode']) and $_REQUEST['mode'] == 'execute') {
235 235
 			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTERING'];
236 236
 			foreach ($change_index as $statement) {
237 237
 				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		}
247 247
 	}
248 248
 
249
-	if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
249
+	if (!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
250 250
 		echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
251 251
 		echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
252 252
 	}
Please login to merge, or discard this patch.
Braces   +15 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.
@@ -43,14 +45,17 @@  discard block
 block discarded – undo
43 45
 ////	LOCAL UTILITY
44 46
 function compare($table_name, $db_indexes, $var_indexes) {
45 47
 	global $add_index, $drop_index, $change_index;
46
-	if(empty($change_index))$change_index = array();
48
+	if(empty($change_index)) {
49
+	    $change_index = array();
50
+	}
47 51
 	foreach ($var_indexes as $var_i_name=>$var_i_def) {
48 52
 		//find corresponding db index with same name
49 53
 		//else by columns in the index.
50 54
 		$sel_db_index = null;
51 55
 		$var_fields_string ='';
52
-		if(count($var_i_def['fields'])>0)
53
-			$var_fields_string = implode('',$var_i_def['fields']);
56
+		if(count($var_i_def['fields'])>0) {
57
+					$var_fields_string = implode('',$var_i_def['fields']);
58
+		}
54 59
 		$field_list_match = false;
55 60
 		if(isset($db_indexes[$var_i_name])) {
56 61
 			$sel_db_index = $db_indexes[$var_i_name];
@@ -101,12 +106,16 @@  discard block
 block discarded – undo
101 106
 
102 107
 ///////////////////////////////////////////////////////////////////////////////
103 108
 ////	PROCESS
104
-if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
109
+if(!is_admin($current_user)) {
110
+    sugar_die("Unauthorized access to administration.");
111
+}
105 112
 set_time_limit(3600);
106 113
 /**
107 114
  * Note: $_REQUEST['silent'] is set from ModuleInstaller::repair_indices();
108 115
  */
109
-if(!isset($_REQUEST['silent'])) $_REQUEST['silent'] = false;
116
+if(!isset($_REQUEST['silent'])) {
117
+    $_REQUEST['silent'] = false;
118
+}
110 119
 
111 120
 $add_index=array();
112 121
 $drop_index=array();
Please login to merge, or discard this patch.
modules/Administration/PasswordManager.php 3 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
     sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
52 52
 }
53 53
 function clearPasswordSettings() {
54
-	    $_POST['passwordsetting_SystemGeneratedPasswordON'] = '';
55
-	    $_POST['passwordsetting_generatepasswordtmpl'] = '';
56
-	    $_POST['passwordsetting_lostpasswordtmpl'] = '';
57
-	    $_POST['passwordsetting_forgotpasswordON'] = '0';
58
-	    $_POST['passwordsetting_linkexpiration'] = '1';
59
-	    $_POST['passwordsetting_linkexpirationtime'] = '30';
60
-	    $_POST['passwordsetting_linkexpirationtype'] = '1';
61
-	    $_POST['passwordsetting_systexpiration'] = '0';
62
-	    $_POST['passwordsetting_systexpirationtime'] = '';
63
-	    $_POST['passwordsetting_systexpirationtype'] = '0';
64
-	    $_POST['passwordsetting_systexpirationlogin'] = '';
54
+        $_POST['passwordsetting_SystemGeneratedPasswordON'] = '';
55
+        $_POST['passwordsetting_generatepasswordtmpl'] = '';
56
+        $_POST['passwordsetting_lostpasswordtmpl'] = '';
57
+        $_POST['passwordsetting_forgotpasswordON'] = '0';
58
+        $_POST['passwordsetting_linkexpiration'] = '1';
59
+        $_POST['passwordsetting_linkexpirationtime'] = '30';
60
+        $_POST['passwordsetting_linkexpirationtype'] = '1';
61
+        $_POST['passwordsetting_systexpiration'] = '0';
62
+        $_POST['passwordsetting_systexpirationtime'] = '';
63
+        $_POST['passwordsetting_systexpirationtype'] = '0';
64
+        $_POST['passwordsetting_systexpirationlogin'] = '';
65 65
 
66 66
 }
67 67
 require_once('modules/Administration/Forms.php');
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         "Administration", 
70 70
         array(
71 71
             "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
72
-           $mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
73
-           ), 
72
+            $mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
73
+            ), 
74 74
         false
75 75
         );
76 76
 require_once('modules/Configurator/Configurator.php');
@@ -81,30 +81,30 @@  discard block
 block discarded – undo
81 81
 $valid_public_key= true;
82 82
 if(!empty($_POST['saveConfig'])){
83 83
     if ($_POST['captcha_on'] == '1'){
84
-		$handle = @fopen("http://www.google.com/recaptcha/api/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
85
-		$buffer ='';
86
-		if ($handle) {
87
-		    while (!feof($handle)) {
88
-		        $buffer .= fgets($handle, 4096);
89
-		    }
90
-		    fclose($handle);
91
-		}
92
-		$valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
93
-	}
94
-	if ($valid_public_key){
95
-		if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
96
-			$_POST['system_ldap_enabled'] = 1;
97
-			clearPasswordSettings();
98
-		} 
99
-		else 
100
-			$_POST['system_ldap_enabled'] = 0;
84
+        $handle = @fopen("http://www.google.com/recaptcha/api/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
85
+        $buffer ='';
86
+        if ($handle) {
87
+            while (!feof($handle)) {
88
+                $buffer .= fgets($handle, 4096);
89
+            }
90
+            fclose($handle);
91
+        }
92
+        $valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
93
+    }
94
+    if ($valid_public_key){
95
+        if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
96
+            $_POST['system_ldap_enabled'] = 1;
97
+            clearPasswordSettings();
98
+        } 
99
+        else 
100
+            $_POST['system_ldap_enabled'] = 0;
101 101
 
102 102
 
103 103
         if(isset($_REQUEST['authenticationClass']))
104 104
         {
105
-	        $configurator->useAuthenticationClass = true;
105
+            $configurator->useAuthenticationClass = true;
106 106
         } else {
107
-	        $configurator->useAuthenticationClass = false;
107
+            $configurator->useAuthenticationClass = false;
108 108
             $_POST['authenticationClass'] = '';
109 109
         }
110 110
 
@@ -114,25 +114,25 @@  discard block
 block discarded – undo
114 114
             $_POST['ldap_group_attr_req_dn'] = 0;
115 115
         }
116 116
 
117
-		if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on') 
118
-			$_POST['ldap_group'] = 1;
119
-		else
120
-			$_POST['ldap_group'] = 0;
117
+        if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on') 
118
+            $_POST['ldap_group'] = 1;
119
+        else
120
+            $_POST['ldap_group'] = 0;
121 121
 			
122
-		if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on') 
123
-			$_POST['ldap_authentication'] = 1;
124
-		else
125
-		    $_POST['ldap_authentication'] = 0;
122
+        if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on') 
123
+            $_POST['ldap_authentication'] = 1;
124
+        else
125
+            $_POST['ldap_authentication'] = 0;
126 126
 		
127
-		if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  )
128
-		    $_POST['passwordsetting_lockoutexpiration'] = 2;
127
+        if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  )
128
+            $_POST['passwordsetting_lockoutexpiration'] = 2;
129 129
 
130
-		$configurator->saveConfig();
130
+        $configurator->saveConfig();
131 131
 		
132
-		$focus->saveConfig();
132
+        $focus->saveConfig();
133 133
 		
134
-		header('Location: index.php?module=Administration&action=index');
135
-	}
134
+        header('Location: index.php?module=Administration&action=index');
135
+    }
136 136
 }
137 137
 
138 138
 $focus->retrieveSettings();
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
 if(!function_exists('mcrypt_cbc')){
168
-	$sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
169
-	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
168
+    $sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
169
+    $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
170 170
 }else{
171
-	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
171
+    $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
172 172
 }
173 173
 $sugar_smarty->assign("settings", $focus->settings);
174 174
 
175 175
 if ($valid_public_key){
176
-	if(!empty($focus->settings['captcha_on'])){
177
-		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
178
-	}else{
179
-		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
180
-	}
176
+    if(!empty($focus->settings['captcha_on'])){
177
+        $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
178
+    }else{
179
+        $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
180
+    }
181 181
 }else{
182
-	$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
182
+    $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
183 183
 }
184 184
 
185 185
 $sugar_smarty->assign("VALID_PUBLIC_KEY", $valid_public_key);
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 $mail = new SugarPHPMailer();
194 194
 $mail->setMailerForSystem();
195 195
 if($mail->Mailer == 'smtp' && $mail->Host ==''){
196
-	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
197
-	}
196
+    $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
197
+    }
198 198
 else
199
-	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
199
+    $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
200 200
 	
201 201
 $focus = new InboundEmail();
202 202
 $focus->checkImap();
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 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.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  ********************************************************************************/
48 48
 
49 49
 
50
-if(!is_admin($current_user)){
50
+if (!is_admin($current_user)) {
51 51
     sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
52 52
 }
53 53
 function clearPasswordSettings() {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 echo getClassicModuleTitle(
69 69
         "Administration", 
70 70
         array(
71
-            "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
71
+            "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME', 'Administration')."</a>",
72 72
            $mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
73 73
            ), 
74 74
         false
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
 $sugarConfig = SugarConfig::getInstance();
79 79
 $focus = new Administration();
80 80
 $configurator->parseLoggerSettings();
81
-$valid_public_key= true;
82
-if(!empty($_POST['saveConfig'])){
83
-    if ($_POST['captcha_on'] == '1'){
81
+$valid_public_key = true;
82
+if (!empty($_POST['saveConfig'])) {
83
+    if ($_POST['captcha_on'] == '1') {
84 84
 		$handle = @fopen("http://www.google.com/recaptcha/api/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
85
-		$buffer ='';
85
+		$buffer = '';
86 86
 		if ($handle) {
87 87
 		    while (!feof($handle)) {
88 88
 		        $buffer .= fgets($handle, 4096);
89 89
 		    }
90 90
 		    fclose($handle);
91 91
 		}
92
-		$valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
92
+		$valid_public_key = substr($buffer, 1, 4) == 'var ' ? true : false;
93 93
 	}
94
-	if ($valid_public_key){
94
+	if ($valid_public_key) {
95 95
 		if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
96 96
 			$_POST['system_ldap_enabled'] = 1;
97 97
 			clearPasswordSettings();
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 			$_POST['system_ldap_enabled'] = 0;
101 101
 
102 102
 
103
-        if(isset($_REQUEST['authenticationClass']))
103
+        if (isset($_REQUEST['authenticationClass']))
104 104
         {
105 105
 	        $configurator->useAuthenticationClass = true;
106 106
         } else {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		else
125 125
 		    $_POST['ldap_authentication'] = 0;
126 126
 		
127
-		if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  )
127
+		if (isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime']))
128 128
 		    $_POST['passwordsetting_lockoutexpiration'] = 2;
129 129
 
130 130
 		$configurator->saveConfig();
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 $sugar_smarty = new Sugar_Smarty();
143 143
 
144 144
 // if no IMAP libraries available, disable Save/Test Settings
145
-if(!function_exists('imap_open')) $sugar_smarty->assign('IE_DISABLED', 'DISABLED');
145
+if (!function_exists('imap_open')) $sugar_smarty->assign('IE_DISABLED', 'DISABLED');
146 146
 
147
-$config_strings=return_module_language($GLOBALS['current_language'],'Configurator');
147
+$config_strings = return_module_language($GLOBALS['current_language'], 'Configurator');
148 148
 $sugar_smarty->assign('CONF', $config_strings);
149 149
 $sugar_smarty->assign('MOD', $mod_strings);
150 150
 $sugar_smarty->assign('APP', $app_strings);
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 //}
165 165
 
166 166
 
167
-if(!function_exists('mcrypt_cbc')){
167
+if (!function_exists('mcrypt_cbc')) {
168 168
 	$sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
169 169
 	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
170
-}else{
170
+} else {
171 171
 	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
172 172
 }
173 173
 $sugar_smarty->assign("settings", $focus->settings);
174 174
 
175
-if ($valid_public_key){
176
-	if(!empty($focus->settings['captcha_on'])){
175
+if ($valid_public_key) {
176
+	if (!empty($focus->settings['captcha_on'])) {
177 177
 		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
178
-	}else{
178
+	} else {
179 179
 		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
180 180
 	}
181
-}else{
181
+} else {
182 182
 	$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
183 183
 }
184 184
 
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
 
187 187
 	
188 188
 
189
-$res=$GLOBALS['sugar_config']['passwordsetting'];
189
+$res = $GLOBALS['sugar_config']['passwordsetting'];
190 190
 
191 191
 
192 192
 require_once('include/SugarPHPMailer.php');   
193 193
 $mail = new SugarPHPMailer();
194 194
 $mail->setMailerForSystem();
195
-if($mail->Mailer == 'smtp' && $mail->Host ==''){
195
+if ($mail->Mailer == 'smtp' && $mail->Host == '') {
196 196
 	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
197 197
 	}
198 198
 else
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 $focus = new InboundEmail();
202 202
 $focus->checkImap();
203 203
 $storedOptions = unserialize(base64_decode($focus->stored_options));	
204
-$email_templates_arr = get_bean_select_array(true, 'EmailTemplate','name', '','name',true);
204
+$email_templates_arr = get_bean_select_array(true, 'EmailTemplate', 'name', '', 'name', true);
205 205
 $create_case_email_template = (isset($storedOptions['create_case_email_template'])) ? $storedOptions['create_case_email_template'] : "";
206
-$TMPL_DRPDWN_LOST =get_select_options_with_id($email_templates_arr, $res['lostpasswordtmpl']); 
207
-$TMPL_DRPDWN_GENERATE =get_select_options_with_id($email_templates_arr, $res['generatepasswordtmpl']);
206
+$TMPL_DRPDWN_LOST = get_select_options_with_id($email_templates_arr, $res['lostpasswordtmpl']); 
207
+$TMPL_DRPDWN_GENERATE = get_select_options_with_id($email_templates_arr, $res['generatepasswordtmpl']);
208 208
 
209 209
 $sugar_smarty->assign("TMPL_DRPDWN_LOST", $TMPL_DRPDWN_LOST);
210 210
 $sugar_smarty->assign("TMPL_DRPDWN_GENERATE", $TMPL_DRPDWN_GENERATE);
Please login to merge, or discard this patch.
Braces   +27 added lines, -20 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.
@@ -95,9 +97,9 @@  discard block
 block discarded – undo
95 97
 		if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
96 98
 			$_POST['system_ldap_enabled'] = 1;
97 99
 			clearPasswordSettings();
98
-		} 
99
-		else 
100
-			$_POST['system_ldap_enabled'] = 0;
100
+		} else {
101
+					$_POST['system_ldap_enabled'] = 0;
102
+		}
101 103
 
102 104
 
103 105
         if(isset($_REQUEST['authenticationClass']))
@@ -114,18 +116,21 @@  discard block
 block discarded – undo
114 116
             $_POST['ldap_group_attr_req_dn'] = 0;
115 117
         }
116 118
 
117
-		if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on') 
118
-			$_POST['ldap_group'] = 1;
119
-		else
120
-			$_POST['ldap_group'] = 0;
119
+		if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on') {
120
+					$_POST['ldap_group'] = 1;
121
+		} else {
122
+					$_POST['ldap_group'] = 0;
123
+		}
121 124
 			
122
-		if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on') 
123
-			$_POST['ldap_authentication'] = 1;
124
-		else
125
-		    $_POST['ldap_authentication'] = 0;
125
+		if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on') {
126
+					$_POST['ldap_authentication'] = 1;
127
+		} else {
128
+				    $_POST['ldap_authentication'] = 0;
129
+		}
126 130
 		
127
-		if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  )
128
-		    $_POST['passwordsetting_lockoutexpiration'] = 2;
131
+		if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  ) {
132
+				    $_POST['passwordsetting_lockoutexpiration'] = 2;
133
+		}
129 134
 
130 135
 		$configurator->saveConfig();
131 136
 		
@@ -142,7 +147,9 @@  discard block
 block discarded – undo
142 147
 $sugar_smarty = new Sugar_Smarty();
143 148
 
144 149
 // if no IMAP libraries available, disable Save/Test Settings
145
-if(!function_exists('imap_open')) $sugar_smarty->assign('IE_DISABLED', 'DISABLED');
150
+if(!function_exists('imap_open')) {
151
+    $sugar_smarty->assign('IE_DISABLED', 'DISABLED');
152
+}
146 153
 
147 154
 $config_strings=return_module_language($GLOBALS['current_language'],'Configurator');
148 155
 $sugar_smarty->assign('CONF', $config_strings);
@@ -167,7 +174,7 @@  discard block
 block discarded – undo
167 174
 if(!function_exists('mcrypt_cbc')){
168 175
 	$sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
169 176
 	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
170
-}else{
177
+} else{
171 178
 	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
172 179
 }
173 180
 $sugar_smarty->assign("settings", $focus->settings);
@@ -175,10 +182,10 @@  discard block
 block discarded – undo
175 182
 if ($valid_public_key){
176 183
 	if(!empty($focus->settings['captcha_on'])){
177 184
 		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
178
-	}else{
185
+	} else{
179 186
 		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
180 187
 	}
181
-}else{
188
+} else{
182 189
 	$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
183 190
 }
184 191
 
@@ -194,9 +201,9 @@  discard block
 block discarded – undo
194 201
 $mail->setMailerForSystem();
195 202
 if($mail->Mailer == 'smtp' && $mail->Host ==''){
196 203
 	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
197
-	}
198
-else
204
+	} else {
199 205
 	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
206
+}
200 207
 	
201 208
 $focus = new InboundEmail();
202 209
 $focus->checkImap();
Please login to merge, or discard this patch.
modules/Administration/UpgradeHistory.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
     function determineIfUpgrade($id_name, $version){
128 128
         $query = "SELECT id, version FROM " . $this->table_name . " WHERE id_name = '$id_name' ORDER BY date_entered DESC";
129 129
         $result = $this->db->query($query);
130
-         if(empty($result)){
130
+            if(empty($result)){
131 131
             return null;
132
-         }else{
132
+            }else{
133 133
             $temp_version = 0;
134 134
             $id = '';
135 135
             while($row = $this->db->fetchByAssoc($result))
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 return array('id' => $id, 'version' => $temp_version);
144 144
             else
145 145
                 return null;
146
-         }
146
+            }
147 147
     }
148 148
 
149 149
     function getAll()
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             return $this->is_right_version_greater($left, $right, $equals_is_greater);
255 255
         }
256 256
         else if($left[0] < $right[0]){
257
-           return true;
257
+            return true;
258 258
         }
259 259
         else
260 260
             return false;
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
     var $tracker_visibility = false;
65 65
     var $table_name = "upgrade_history";
66 66
     var $object_name = "UpgradeHistory";
67
-    var $column_fields = Array( "id", "filename", "md5sum", "type", "version", "status", "date_entered" );
67
+    var $column_fields = Array("id", "filename", "md5sum", "type", "version", "status", "date_entered");
68 68
     var $disable_custom_fields = true;
69 69
 
70 70
     function delete()
71 71
     {
72
-        $this->db->query( "delete from " . $this->table_name . " where id = " . $this->db->quoted($this->id));
72
+        $this->db->query("delete from ".$this->table_name." where id = ".$this->db->quoted($this->id));
73 73
     }
74 74
 
75 75
     public function __construct()
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
83 83
      */
84
-    public function UpgradeHistory(){
84
+    public function UpgradeHistory() {
85 85
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
86
-        if(isset($GLOBALS['log'])) {
86
+        if (isset($GLOBALS['log'])) {
87 87
             $GLOBALS['log']->deprecated($deprecatedMessage);
88 88
         }
89 89
         else {
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     }
94 94
 
95 95
 
96
-    function getAllOrderBy($orderBy){
97
-        $query = "SELECT id FROM " . $this->table_name . " ORDER BY ".$orderBy;
96
+    function getAllOrderBy($orderBy) {
97
+        $query = "SELECT id FROM ".$this->table_name." ORDER BY ".$orderBy;
98 98
         return $this->getList($query);
99 99
     }
100 100
     /**
@@ -103,33 +103,33 @@  discard block
 block discarded – undo
103 103
      * @param id      the id of the item you are comparing to
104 104
      * @return upgrade_history object if found, null otherwise
105 105
      */
106
-    function checkForExisting($patch_to_check){
106
+    function checkForExisting($patch_to_check) {
107 107
         $uh = new UpgradeHistory();
108
-        if($patch_to_check != null){
108
+        if ($patch_to_check != null) {
109 109
 
110
-            if(empty($patch_to_check->id_name)){
110
+            if (empty($patch_to_check->id_name)) {
111 111
                 $where = " WHERE name = '$patch_to_check->name' ";
112
-            }else{
112
+            } else {
113 113
                 $where = " WHERE id_name = '$patch_to_check->id_name' ";
114 114
             }
115 115
 
116
-            if(!empty($patch_to_check->id)){
116
+            if (!empty($patch_to_check->id)) {
117 117
                 $where .= "  AND id != '$patch_to_check->id'  ";
118
-            }else{
118
+            } else {
119 119
                 $where .= "  AND id is not null  ";
120 120
             }
121 121
 
122
-            $query = "SELECT id FROM " . $this->table_name . " ". $where;
122
+            $query = "SELECT id FROM ".$this->table_name." ".$where;
123 123
 
124 124
             $result = $uh->db->query($query);
125
-            if(empty($result)){
125
+            if (empty($result)) {
126 126
                 return null;
127 127
             }
128 128
             $row = $uh->db->fetchByAssoc($result);
129
-            if(empty($row)){
129
+            if (empty($row)) {
130 130
                 return null;
131 131
             }
132
-            if(!empty($row['id'])){
132
+            if (!empty($row['id'])) {
133 133
                 return $uh->retrieve($row['id']);
134 134
             }
135 135
         }
@@ -139,22 +139,22 @@  discard block
 block discarded – undo
139 139
     /**
140 140
      * Check if this is an upgrade, if it is then return the latest version before this installation
141 141
      */
142
-    function determineIfUpgrade($id_name, $version){
143
-        $query = "SELECT id, version FROM " . $this->table_name . " WHERE id_name = '$id_name' ORDER BY date_entered DESC";
142
+    function determineIfUpgrade($id_name, $version) {
143
+        $query = "SELECT id, version FROM ".$this->table_name." WHERE id_name = '$id_name' ORDER BY date_entered DESC";
144 144
         $result = $this->db->query($query);
145
-         if(empty($result)){
145
+         if (empty($result)) {
146 146
             return null;
147
-         }else{
147
+         } else {
148 148
             $temp_version = 0;
149 149
             $id = '';
150
-            while($row = $this->db->fetchByAssoc($result))
150
+            while ($row = $this->db->fetchByAssoc($result))
151 151
             {
152
-                if(!$this->is_right_version_greater(explode('.', $row['version']), explode('.', $temp_version))){
152
+                if (!$this->is_right_version_greater(explode('.', $row['version']), explode('.', $temp_version))) {
153 153
                     $temp_version = $row['version'];
154 154
                     $id = $row['id'];
155 155
                 }
156 156
             }//end while
157
-            if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false))
157
+            if ($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false))
158 158
                 return array('id' => $id, 'version' => $temp_version);
159 159
             else
160 160
                 return null;
@@ -163,38 +163,38 @@  discard block
 block discarded – undo
163 163
 
164 164
     function getAll()
165 165
     {
166
-        $query = "SELECT id FROM " . $this->table_name . " ORDER BY date_entered desc";
166
+        $query = "SELECT id FROM ".$this->table_name." ORDER BY date_entered desc";
167 167
         return $this->getList($query);
168 168
     }
169 169
 
170
-    function getList($query){
171
-        return( parent::build_related_list( $query, $this ) );
170
+    function getList($query) {
171
+        return(parent::build_related_list($query, $this));
172 172
     }
173 173
 
174
-    function findByMd5( $var_md5 )
174
+    function findByMd5($var_md5)
175 175
     {
176
-        $query = "SELECT id FROM " . $this->table_name . " where md5sum = '$var_md5'";
177
-        return( parent::build_related_list( $query, $this ) );
176
+        $query = "SELECT id FROM ".$this->table_name." where md5sum = '$var_md5'";
177
+        return(parent::build_related_list($query, $this));
178 178
     }
179 179
 
180 180
     function UninstallAvailable($patch_list, $patch_to_check)
181 181
     {
182 182
         //before we even go through the list, let us try to see if we find a match.
183 183
         $history_object = $this->checkForExisting($patch_to_check);
184
-        if($history_object != null){
185
-            if((!empty($history_object->id_name) && !empty($patch_to_check->id_name) && strcmp($history_object->id_name,  $patch_to_check->id_name) == 0) || strcmp($history_object->name,  $patch_to_check->name) == 0){
184
+        if ($history_object != null) {
185
+            if ((!empty($history_object->id_name) && !empty($patch_to_check->id_name) && strcmp($history_object->id_name, $patch_to_check->id_name) == 0) || strcmp($history_object->name, $patch_to_check->name) == 0) {
186 186
                 //we have found a match
187 187
                 //if the patch_to_check version is greater than the found version
188 188
                 return ($this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version)));
189
-            }else{
189
+            } else {
190 190
                 return true;
191 191
             }
192 192
         }
193 193
         //we will only go through this loop if we have not found another UpgradeHistory object
194 194
         //with a matching unique_key in the database
195
-        foreach($patch_list as $more_recent_patch)
195
+        foreach ($patch_list as $more_recent_patch)
196 196
         {
197
-            if($more_recent_patch->id == $patch_to_check->id)
197
+            if ($more_recent_patch->id == $patch_to_check->id)
198 198
                 break;
199 199
 
200 200
             //we will only resort to checking the files if we cannot find the unique_keys
@@ -217,31 +217,31 @@  discard block
 block discarded – undo
217 217
 
218 218
     function foundConflict($check_path, $recent_path)
219 219
     {
220
-        if(is_file($check_path))
220
+        if (is_file($check_path))
221 221
         {
222
-            if(file_exists($recent_path))
222
+            if (file_exists($recent_path))
223 223
                 return true;
224 224
             else
225 225
                 return false;
226 226
         }
227
-        elseif(is_dir($check_path))
227
+        elseif (is_dir($check_path))
228 228
         {
229 229
             $status = false;
230 230
 
231
-            $d = dir( $check_path );
232
-            while( $f = $d->read() )
231
+            $d = dir($check_path);
232
+            while ($f = $d->read())
233 233
             {
234
-                if( $f == "." || $f == ".." )
234
+                if ($f == "." || $f == "..")
235 235
                     continue;
236 236
 
237 237
                 $status = $this->foundConflict("$check_path/$f", "$recent_path/$f");
238 238
 
239
-                if($status)
239
+                if ($status)
240 240
                     break;
241 241
             }
242 242
 
243 243
             $d->close();
244
-            return( $status );
244
+            return($status);
245 245
         }
246 246
 
247 247
         return false;
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
      * return               true if the right version is greater or they are equal
257 257
      *                      false if the left version is greater
258 258
      */
259
-    function is_right_version_greater($left, $right, $equals_is_greater = true){
260
-        if(count($left) == 0 && count($right) == 0){
259
+    function is_right_version_greater($left, $right, $equals_is_greater = true) {
260
+        if (count($left) == 0 && count($right) == 0) {
261 261
             return $equals_is_greater;
262 262
         }
263
-        else if(count($left) == 0 || count($right) == 0){
263
+        else if (count($left) == 0 || count($right) == 0) {
264 264
             return true;
265 265
         }
266
-        else if($left[0] == $right[0]){
266
+        else if ($left[0] == $right[0]) {
267 267
             array_shift($left);
268 268
             array_shift($right);
269 269
             return $this->is_right_version_greater($left, $right, $equals_is_greater);
270 270
         }
271
-        else if($left[0] < $right[0]){
271
+        else if ($left[0] < $right[0]) {
272 272
            return true;
273 273
         }
274 274
         else
@@ -283,28 +283,28 @@  discard block
 block discarded – undo
283 283
      *
284 284
      * @return not_found	an array of id_names that were not found to be installed on the system
285 285
      */
286
-    function checkDependencies($dependencies = array()){
286
+    function checkDependencies($dependencies = array()) {
287 287
         $not_found = array();
288
-        foreach($dependencies as $dependent){
288
+        foreach ($dependencies as $dependent) {
289 289
             $found = false;
290 290
             $query = "SELECT id FROM $this->table_name WHERE id_name = '".$dependent['id_name']."'";
291 291
             $matches = $this->getList($query);
292
-            if(0 != sizeof($matches)){
293
-                foreach($matches as $match){
294
-                    if($this->is_right_version_greater(explode('.', $match->version), explode('.', $dependent['version']))){
292
+            if (0 != sizeof($matches)) {
293
+                foreach ($matches as $match) {
294
+                    if ($this->is_right_version_greater(explode('.', $match->version), explode('.', $dependent['version']))) {
295 295
                         $found = true;
296 296
                         break;
297 297
                     }//fi
298 298
                 }//rof
299 299
             }//fi
300
-            if(!$found){
300
+            if (!$found) {
301 301
                 $not_found[] = $dependent['id_name'];
302 302
             }//fi
303 303
         }//rof
304 304
         return $not_found;
305 305
     }
306
-    function retrieve($id = -1, $encode=true,$deleted=true) {
307
-        return parent::retrieve($id,$encode,false);  //ignore the deleted filter. the table does not have the deleted column in it.
306
+    function retrieve($id = -1, $encode = true, $deleted = true) {
307
+        return parent::retrieve($id, $encode, false); //ignore the deleted filter. the table does not have the deleted column in it.
308 308
     }
309 309
 
310 310
 }
Please login to merge, or discard this patch.
Braces   +33 added lines, -31 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.
@@ -85,8 +87,7 @@  discard block
 block discarded – undo
85 87
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
86 88
         if(isset($GLOBALS['log'])) {
87 89
             $GLOBALS['log']->deprecated($deprecatedMessage);
88
-        }
89
-        else {
90
+        } else {
90 91
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
91 92
         }
92 93
         self::__construct();
@@ -109,13 +110,13 @@  discard block
 block discarded – undo
109 110
 
110 111
             if(empty($patch_to_check->id_name)){
111 112
                 $where = " WHERE name = '$patch_to_check->name' ";
112
-            }else{
113
+            } else{
113 114
                 $where = " WHERE id_name = '$patch_to_check->id_name' ";
114 115
             }
115 116
 
116 117
             if(!empty($patch_to_check->id)){
117 118
                 $where .= "  AND id != '$patch_to_check->id'  ";
118
-            }else{
119
+            } else{
119 120
                 $where .= "  AND id is not null  ";
120 121
             }
121 122
 
@@ -144,7 +145,7 @@  discard block
 block discarded – undo
144 145
         $result = $this->db->query($query);
145 146
          if(empty($result)){
146 147
             return null;
147
-         }else{
148
+         } else{
148 149
             $temp_version = 0;
149 150
             $id = '';
150 151
             while($row = $this->db->fetchByAssoc($result))
@@ -154,10 +155,11 @@  discard block
 block discarded – undo
154 155
                     $id = $row['id'];
155 156
                 }
156 157
             }//end while
157
-            if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false))
158
-                return array('id' => $id, 'version' => $temp_version);
159
-            else
160
-                return null;
158
+            if($this->is_right_version_greater(explode('.', $temp_version), explode('.', $version), false)) {
159
+                            return array('id' => $id, 'version' => $temp_version);
160
+            } else {
161
+                            return null;
162
+            }
161 163
          }
162 164
     }
163 165
 
@@ -186,7 +188,7 @@  discard block
 block discarded – undo
186 188
                 //we have found a match
187 189
                 //if the patch_to_check version is greater than the found version
188 190
                 return ($this->is_right_version_greater(explode('.', $history_object->version), explode('.', $patch_to_check->version)));
189
-            }else{
191
+            } else{
190 192
                 return true;
191 193
             }
192 194
         }
@@ -194,8 +196,9 @@  discard block
 block discarded – undo
194 196
         //with a matching unique_key in the database
195 197
         foreach($patch_list as $more_recent_patch)
196 198
         {
197
-            if($more_recent_patch->id == $patch_to_check->id)
198
-                break;
199
+            if($more_recent_patch->id == $patch_to_check->id) {
200
+                            break;
201
+            }
199 202
 
200 203
             //we will only resort to checking the files if we cannot find the unique_keys
201 204
             //or the unique_keys do not match
@@ -219,25 +222,27 @@  discard block
 block discarded – undo
219 222
     {
220 223
         if(is_file($check_path))
221 224
         {
222
-            if(file_exists($recent_path))
223
-                return true;
224
-            else
225
-                return false;
226
-        }
227
-        elseif(is_dir($check_path))
225
+            if(file_exists($recent_path)) {
226
+                            return true;
227
+            } else {
228
+                            return false;
229
+            }
230
+        } elseif(is_dir($check_path))
228 231
         {
229 232
             $status = false;
230 233
 
231 234
             $d = dir( $check_path );
232 235
             while( $f = $d->read() )
233 236
             {
234
-                if( $f == "." || $f == ".." )
235
-                    continue;
237
+                if( $f == "." || $f == ".." ) {
238
+                                    continue;
239
+                }
236 240
 
237 241
                 $status = $this->foundConflict("$check_path/$f", "$recent_path/$f");
238 242
 
239
-                if($status)
240
-                    break;
243
+                if($status) {
244
+                                    break;
245
+                }
241 246
             }
242 247
 
243 248
             $d->close();
@@ -259,20 +264,17 @@  discard block
 block discarded – undo
259 264
     function is_right_version_greater($left, $right, $equals_is_greater = true){
260 265
         if(count($left) == 0 && count($right) == 0){
261 266
             return $equals_is_greater;
262
-        }
263
-        else if(count($left) == 0 || count($right) == 0){
267
+        } else if(count($left) == 0 || count($right) == 0){
264 268
             return true;
265
-        }
266
-        else if($left[0] == $right[0]){
269
+        } else if($left[0] == $right[0]){
267 270
             array_shift($left);
268 271
             array_shift($right);
269 272
             return $this->is_right_version_greater($left, $right, $equals_is_greater);
270
-        }
271
-        else if($left[0] < $right[0]){
273
+        } else if($left[0] < $right[0]){
272 274
            return true;
275
+        } else {
276
+                    return false;
273 277
         }
274
-        else
275
-            return false;
276 278
     }
277 279
 
278 280
     /**
Please login to merge, or discard this patch.
modules/Administration/RepairUploadFolder.php 2 patches
Spacing   +9 added lines, -9 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.
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
     if (!is_guid($node->getFilename())) {
78 78
         continue;
79 79
     }
80
-    $stat['total'] ++;
80
+    $stat['total']++;
81 81
 
82 82
     $row = false;
83 83
     foreach ($validBeans as $bean) {
84 84
         $filter = array('deleted');
85 85
         $where = array();
86 86
         foreach ($bean->getFilesFields() as $fieldName) {
87
-            $where[] = $fieldName . '=' . $db->quoted($node->getFilename());
87
+            $where[] = $fieldName.'='.$db->quoted($node->getFilename());
88 88
             $filter[] = $fieldName;
89 89
         }
90
-        $where = '(' . implode(' OR ', $where) . ')';
90
+        $where = '('.implode(' OR ', $where).')';
91 91
 
92 92
         $row = $db->fetchOne($bean->create_new_list_query('', $where, $filter, array(), 0));
93 93
         if (!empty($row)) {
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
     }
101 101
 
102 102
     if ($row == false) {
103
-        if (unlink('upload://' . $node->getFilename())) {
104
-            $stat['removed'] ++;
103
+        if (unlink('upload://'.$node->getFilename())) {
104
+            $stat['removed']++;
105 105
         }
106 106
     } elseif ($row['deleted'] == 1) {
107 107
         $bean->populateFromRow($row);
108 108
         if ($bean->deleteFiles()) {
109
-            $stat['removed'] ++;
109
+            $stat['removed']++;
110 110
         }
111 111
     }
112 112
 
@@ -119,5 +119,5 @@  discard block
 block discarded – undo
119 119
 }
120 120
 echo '</pre>';
121 121
 
122
-echo $mod_strings['LBL_TOTAL_FILES'] . ': ' . $stat['total'] . '<br>';
123
-echo $mod_strings['LBL_REMOVED_FILES'] . ': ' . $stat['removed'] . '<br>';
122
+echo $mod_strings['LBL_TOTAL_FILES'].': '.$stat['total'].'<br>';
123
+echo $mod_strings['LBL_REMOVED_FILES'].': '.$stat['removed'].'<br>';
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.