Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
modules/Administration/RepairJSFile.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     echo'<div id="msgDiv"></div>';        
48 48
 
49 49
     //echo out script that will make an ajax call to process the files via callJSRepair.php
50
-     echo "<script>
50
+        echo "<script>
51 51
         var ajxProgress;
52 52
         var showMSG = 'true';
53 53
         //when called, this function will make ajax call to rebuild/repair js files
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
-if(is_admin($current_user)){
41
+if (is_admin($current_user)) {
42 42
     global $mod_strings; 
43 43
 
44 44
     
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/RebuildSprites.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 global $current_user;
43
-if(is_admin($current_user))
43
+if (is_admin($current_user))
44 44
 {
45
-    if(!isset($_REQUEST['process']))
45
+    if (!isset($_REQUEST['process']))
46 46
     {
47 47
         global $mod_strings;
48 48
         echo '<br>'.$mod_strings['LBL_REPAIR_JS_FILES_PROCESSING'];
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/RepairFieldCasing.php 3 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -52,50 +52,50 @@  discard block
 block discarded – undo
52 52
     $query = "SELECT * FROM fields_meta_data";
53 53
     $result = $GLOBALS['db']->query($query);
54 54
     while($row = $GLOBALS['db']->fetchByAssoc($result)) {
55
-    	  $name = $row['name'];
56
-    	  $id = $row['id'];
57
-    	  $module_entries[$row['custom_module']] = true;
58
-
59
-    	  //Only run database SQL where the name or id casing does is not lowercased
60
-    	  if($name != strtolower($row['name'])) {
61
-    	  	 $database_entries[$row['custom_module']][$name] = $row;
62
-    	  }
55
+            $name = $row['name'];
56
+            $id = $row['id'];
57
+            $module_entries[$row['custom_module']] = true;
58
+
59
+            //Only run database SQL where the name or id casing does is not lowercased
60
+            if($name != strtolower($row['name'])) {
61
+                $database_entries[$row['custom_module']][$name] = $row;
62
+            }
63 63
     }
64 64
 
65 65
     //If we have database entries to process
66 66
     if(!empty($database_entries)) {
67 67
 
68
-       foreach($database_entries as $module=>$entries) {
69
-       	   $table_name = strtolower($module) . '_cstm';
68
+        foreach($database_entries as $module=>$entries) {
69
+                $table_name = strtolower($module) . '_cstm';
70 70
 
71
-           foreach($entries as $original_col_name=>$entry) {
72
-               echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_FIELD_META_DATA'], array($entry['name']));
73
-           	   $update_sql = "UPDATE fields_meta_data SET id = '" . $entry['custom_module'] . strtolower($entry['name']) . "', name = '" . strtolower($entry['name']) . "' WHERE id = '" . $entry['id'] . "'";
74
-           	   $GLOBALS['db']->query($update_sql);
71
+            foreach($entries as $original_col_name=>$entry) {
72
+                echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_FIELD_META_DATA'], array($entry['name']));
73
+                    $update_sql = "UPDATE fields_meta_data SET id = '" . $entry['custom_module'] . strtolower($entry['name']) . "', name = '" . strtolower($entry['name']) . "' WHERE id = '" . $entry['id'] . "'";
74
+                    $GLOBALS['db']->query($update_sql);
75 75
 
76
-           	   echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_CUSTOM_TABLE'], array($entry['name'], $table_name));
76
+                    echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_CUSTOM_TABLE'], array($entry['name'], $table_name));
77 77
 
78
-      		   $GLOBALS['db']->query($GLOBALS['db']->renameColumnSQL($table_name, $entry['name'], strtolower($entry['name'])));
79
-           }
80
-       }
78
+                    $GLOBALS['db']->query($GLOBALS['db']->renameColumnSQL($table_name, $entry['name'], strtolower($entry['name'])));
79
+            }
80
+        }
81 81
     }
82 82
 
83 83
     //If we have metadata files to alter
84 84
     if(!empty($module_entries)) {
85
-	    $modules = array_keys($module_entries);
86
-	    $views = array('basic_search', 'advanced_search', 'detailview', 'editview', 'quickcreate');
87
-	    $class_names = array();
85
+        $modules = array_keys($module_entries);
86
+        $views = array('basic_search', 'advanced_search', 'detailview', 'editview', 'quickcreate');
87
+        $class_names = array();
88 88
 
89 89
         require_once ('include/TemplateHandler/TemplateHandler.php') ;
90
-	    require_once('modules/ModuleBuilder/parsers/ParserFactory.php');
90
+        require_once('modules/ModuleBuilder/parsers/ParserFactory.php');
91 91
 
92
-	    foreach($modules as $module) {
93
-	       if(isset($GLOBALS['beanList'][$module])) {
94
-	       	  $class_names[] = $GLOBALS['beanList'][$module];
95
-	       }
92
+        foreach($modules as $module) {
93
+            if(isset($GLOBALS['beanList'][$module])) {
94
+                    $class_names[] = $GLOBALS['beanList'][$module];
95
+            }
96 96
 
97
-	       $repairClass->module_list[] = $module;
98
-	       foreach($views as $view) {
97
+            $repairClass->module_list[] = $module;
98
+            foreach($views as $view) {
99 99
                 try{
100 100
                     $parser = ParserFactory::getParser($view, $module);
101 101
                 }
@@ -103,37 +103,37 @@  discard block
 block discarded – undo
103 103
                     $GLOBALS['log']->fatal("Caught exception in RepairFieldCasing script: ".$e->getMessage());
104 104
                     continue;
105 105
                 }
106
-	       		if(isset($parser->_viewdefs['panels'])) {
107
-	       		   foreach($parser->_viewdefs['panels'] as $panel_id=>$panel) {
108
-	       		   	  foreach($panel as $row_id=>$row) {
109
-	       		   	  	 foreach($row as $entry_id=>$entry) {
110
-	       		   	  	 	if(is_array($entry) && isset($entry['name'])) {
111
-	       		   	  	 	   $parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
112
-	       		   	  	 	}
113
-	       		   	  	 }
114
-	       		   	  }
115
-	       		   }
116
-	       		} else {
117
-	       		  //For basic_search and advanced_search views, just process the fields
118
-       		   	  foreach($parser->_viewdefs as $entry_id=>$entry) {
119
-       		   	  	 if(is_array($entry) && isset($entry['name'])) {
120
-       		   	  	 	$parser->_viewdefs[$entry_id]['name'] = strtolower($entry['name']);
121
-       		   	  	 }
122
-       		   	  }
123
-	       		}
124
-
125
-	       		//Save the changes
126
-	       		$parser->handleSave(false);
127
-	       } //foreach
128
-
129
-	       //Now clear the cache of the .tpl files
130
-	       TemplateHandler::clearCache($module);
131
-
132
-
133
-	    } //foreach
134
-
135
-	    echo '<br>'.$mod_strings['LBL_CLEAR_VARDEFS_DATA_CACHE_TITLE'];
136
-	    require_once('modules/Administration/QuickRepairAndRebuild.php');
106
+                    if(isset($parser->_viewdefs['panels'])) {
107
+                        foreach($parser->_viewdefs['panels'] as $panel_id=>$panel) {
108
+                            foreach($panel as $row_id=>$row) {
109
+                                    foreach($row as $entry_id=>$entry) {
110
+                                        if(is_array($entry) && isset($entry['name'])) {
111
+                                        $parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
112
+                                        }
113
+                                    }
114
+                            }
115
+                        }
116
+                    } else {
117
+                        //For basic_search and advanced_search views, just process the fields
118
+                        foreach($parser->_viewdefs as $entry_id=>$entry) {
119
+                                if(is_array($entry) && isset($entry['name'])) {
120
+                                    $parser->_viewdefs[$entry_id]['name'] = strtolower($entry['name']);
121
+                                }
122
+                        }
123
+                    }
124
+
125
+                    //Save the changes
126
+                    $parser->handleSave(false);
127
+            } //foreach
128
+
129
+            //Now clear the cache of the .tpl files
130
+            TemplateHandler::clearCache($module);
131
+
132
+
133
+        } //foreach
134
+
135
+        echo '<br>'.$mod_strings['LBL_CLEAR_VARDEFS_DATA_CACHE_TITLE'];
136
+        require_once('modules/Administration/QuickRepairAndRebuild.php');
137 137
         $repair = new RepairAndClear();
138 138
         $repair->show_output = false;
139 139
         $repair->module_list = array($class_names);
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  ********************************************************************************/
40 40
 
41 41
 //Check if current user has admin access
42
-if(is_admin($current_user)) {
42
+if (is_admin($current_user)) {
43 43
     global $mod_strings;
44 44
 
45 45
     //echo out processing message
@@ -51,29 +51,29 @@  discard block
 block discarded – undo
51 51
 
52 52
     $query = "SELECT * FROM fields_meta_data";
53 53
     $result = $GLOBALS['db']->query($query);
54
-    while($row = $GLOBALS['db']->fetchByAssoc($result)) {
54
+    while ($row = $GLOBALS['db']->fetchByAssoc($result)) {
55 55
     	  $name = $row['name'];
56 56
     	  $id = $row['id'];
57 57
     	  $module_entries[$row['custom_module']] = true;
58 58
 
59 59
     	  //Only run database SQL where the name or id casing does is not lowercased
60
-    	  if($name != strtolower($row['name'])) {
60
+    	  if ($name != strtolower($row['name'])) {
61 61
     	  	 $database_entries[$row['custom_module']][$name] = $row;
62 62
     	  }
63 63
     }
64 64
 
65 65
     //If we have database entries to process
66
-    if(!empty($database_entries)) {
66
+    if (!empty($database_entries)) {
67 67
 
68
-       foreach($database_entries as $module=>$entries) {
69
-       	   $table_name = strtolower($module) . '_cstm';
68
+       foreach ($database_entries as $module=>$entries) {
69
+       	   $table_name = strtolower($module).'_cstm';
70 70
 
71
-           foreach($entries as $original_col_name=>$entry) {
72
-               echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_FIELD_META_DATA'], array($entry['name']));
73
-           	   $update_sql = "UPDATE fields_meta_data SET id = '" . $entry['custom_module'] . strtolower($entry['name']) . "', name = '" . strtolower($entry['name']) . "' WHERE id = '" . $entry['id'] . "'";
71
+           foreach ($entries as $original_col_name=>$entry) {
72
+               echo '<br>'.string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_FIELD_META_DATA'], array($entry['name']));
73
+           	   $update_sql = "UPDATE fields_meta_data SET id = '".$entry['custom_module'].strtolower($entry['name'])."', name = '".strtolower($entry['name'])."' WHERE id = '".$entry['id']."'";
74 74
            	   $GLOBALS['db']->query($update_sql);
75 75
 
76
-           	   echo '<br>'. string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_CUSTOM_TABLE'], array($entry['name'], $table_name));
76
+           	   echo '<br>'.string_format($mod_strings['LBL_REPAIR_FIELD_CASING_SQL_CUSTOM_TABLE'], array($entry['name'], $table_name));
77 77
 
78 78
       		   $GLOBALS['db']->query($GLOBALS['db']->renameColumnSQL($table_name, $entry['name'], strtolower($entry['name'])));
79 79
            }
@@ -81,33 +81,33 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
     //If we have metadata files to alter
84
-    if(!empty($module_entries)) {
84
+    if (!empty($module_entries)) {
85 85
 	    $modules = array_keys($module_entries);
86 86
 	    $views = array('basic_search', 'advanced_search', 'detailview', 'editview', 'quickcreate');
87 87
 	    $class_names = array();
88 88
 
89
-        require_once ('include/TemplateHandler/TemplateHandler.php') ;
89
+        require_once ('include/TemplateHandler/TemplateHandler.php');
90 90
 	    require_once('modules/ModuleBuilder/parsers/ParserFactory.php');
91 91
 
92
-	    foreach($modules as $module) {
93
-	       if(isset($GLOBALS['beanList'][$module])) {
92
+	    foreach ($modules as $module) {
93
+	       if (isset($GLOBALS['beanList'][$module])) {
94 94
 	       	  $class_names[] = $GLOBALS['beanList'][$module];
95 95
 	       }
96 96
 
97 97
 	       $repairClass->module_list[] = $module;
98
-	       foreach($views as $view) {
99
-                try{
98
+	       foreach ($views as $view) {
99
+                try {
100 100
                     $parser = ParserFactory::getParser($view, $module);
101 101
                 }
102
-                catch(Exception $e){
102
+                catch (Exception $e) {
103 103
                     $GLOBALS['log']->fatal("Caught exception in RepairFieldCasing script: ".$e->getMessage());
104 104
                     continue;
105 105
                 }
106
-	       		if(isset($parser->_viewdefs['panels'])) {
107
-	       		   foreach($parser->_viewdefs['panels'] as $panel_id=>$panel) {
108
-	       		   	  foreach($panel as $row_id=>$row) {
109
-	       		   	  	 foreach($row as $entry_id=>$entry) {
110
-	       		   	  	 	if(is_array($entry) && isset($entry['name'])) {
106
+	       		if (isset($parser->_viewdefs['panels'])) {
107
+	       		   foreach ($parser->_viewdefs['panels'] as $panel_id=>$panel) {
108
+	       		   	  foreach ($panel as $row_id=>$row) {
109
+	       		   	  	 foreach ($row as $entry_id=>$entry) {
110
+	       		   	  	 	if (is_array($entry) && isset($entry['name'])) {
111 111
 	       		   	  	 	   $parser->_viewdefs['panels'][$panel_id][$row_id][$entry_id]['name'] = strtolower($entry['name']);
112 112
 	       		   	  	 	}
113 113
 	       		   	  	 }
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	       		   }
116 116
 	       		} else {
117 117
 	       		  //For basic_search and advanced_search views, just process the fields
118
-       		   	  foreach($parser->_viewdefs as $entry_id=>$entry) {
119
-       		   	  	 if(is_array($entry) && isset($entry['name'])) {
118
+       		   	  foreach ($parser->_viewdefs as $entry_id=>$entry) {
119
+       		   	  	 if (is_array($entry) && isset($entry['name'])) {
120 120
        		   	  	 	$parser->_viewdefs[$entry_id]['name'] = strtolower($entry['name']);
121 121
        		   	  	 }
122 122
        		   	  }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 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.
@@ -98,8 +100,7 @@  discard block
 block discarded – undo
98 100
 	       foreach($views as $view) {
99 101
                 try{
100 102
                     $parser = ParserFactory::getParser($view, $module);
101
-                }
102
-                catch(Exception $e){
103
+                } catch(Exception $e){
103 104
                     $GLOBALS['log']->fatal("Caught exception in RepairFieldCasing script: ".$e->getMessage());
104 105
                     continue;
105 106
                 }
Please login to merge, or discard this patch.
modules/Administration/UpgradeAccess.php 3 patches
Spacing   +23 added lines, -23 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.
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 global $mod_strings;
45 45
 global $sugar_config;
46 46
 
47
-$ignoreCase = (substr_count(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache/2') > 0)?'(?i)':'';
48
-$htaccess_file   = getcwd() . "/.htaccess";
47
+$ignoreCase = (substr_count(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache/2') > 0) ? '(?i)' : '';
48
+$htaccess_file = getcwd()."/.htaccess";
49 49
 $contents = '';
50 50
 $basePath = parse_url($sugar_config['site_url'], PHP_URL_PATH);
51
-if(empty($basePath)) $basePath = '/';
51
+if (empty($basePath)) $basePath = '/';
52 52
 
53 53
 $restrict_str = <<<EOQ
54 54
 # BEGIN SUGARCRM RESTRICTIONS
@@ -69,52 +69,52 @@  discard block
 block discarded – undo
69 69
 # END SUGARCRM RESTRICTIONS
70 70
 EOQ;
71 71
 
72
-if(file_exists($htaccess_file)){
72
+if (file_exists($htaccess_file)) {
73 73
     $fp = fopen($htaccess_file, 'r');
74 74
     $skip = false;
75
-    while($line = fgets($fp)){
75
+    while ($line = fgets($fp)) {
76 76
 
77
-    	if(preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = true;
78
-        if(!$skip)$contents .= $line;
79
-        if(preg_match('/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = false;
77
+    	if (preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = true;
78
+        if (!$skip)$contents .= $line;
79
+        if (preg_match('/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = false;
80 80
     }
81 81
 }
82
-if(substr($contents, -1) != "\n") {
82
+if (substr($contents, -1) != "\n") {
83 83
     $restrict_str = "\n".$restrict_str;
84 84
 }
85
-$status =  file_put_contents($htaccess_file, $contents . $restrict_str);
86
-if( !$status ){
87
-    echo '<p>' . $mod_strings['LBL_HT_NO_WRITE'] . "<span class=stop>{$htaccess_file}</span></p>\n";
88
-    echo '<p>' . $mod_strings['LBL_HT_NO_WRITE_2'] . "</p>\n";
85
+$status = file_put_contents($htaccess_file, $contents.$restrict_str);
86
+if (!$status) {
87
+    echo '<p>'.$mod_strings['LBL_HT_NO_WRITE']."<span class=stop>{$htaccess_file}</span></p>\n";
88
+    echo '<p>'.$mod_strings['LBL_HT_NO_WRITE_2']."</p>\n";
89 89
     echo "{$redirect_str}\n";
90 90
 }
91 91
 
92 92
 
93 93
 // cn: bug 9365 - security for filesystem
94
-$uploadDir='';
95
-$uploadHta='';
94
+$uploadDir = '';
95
+$uploadHta = '';
96 96
 
97 97
 if (empty($GLOBALS['sugar_config']['upload_dir'])) {
98
-    $GLOBALS['sugar_config']['upload_dir']='upload/';
98
+    $GLOBALS['sugar_config']['upload_dir'] = 'upload/';
99 99
 }
100 100
 
101 101
 $uploadHta = "upload://.htaccess";
102 102
 
103
-$denyAll =<<<eoq
103
+$denyAll = <<<eoq
104 104
 	Order Deny,Allow
105 105
 	Deny from all
106 106
 eoq;
107 107
 
108
-if(file_exists($uploadHta) && filesize($uploadHta)) {
108
+if (file_exists($uploadHta) && filesize($uploadHta)) {
109 109
 	// file exists, parse to make sure it is current
110
-	if(is_writable($uploadHta)) {
110
+	if (is_writable($uploadHta)) {
111 111
 		$oldHtaccess = file_get_contents($uploadHta);
112 112
 		// use a different regex boundary b/c .htaccess uses the typicals
113
-		if(strstr($oldHtaccess, $denyAll) === false) {
113
+		if (strstr($oldHtaccess, $denyAll) === false) {
114 114
 		    $oldHtaccess .= "\n";
115 115
 			$oldHtaccess .= $denyAll;
116 116
 		}
117
-		if(!file_put_contents($uploadHta, $oldHtaccess)) {
117
+		if (!file_put_contents($uploadHta, $oldHtaccess)) {
118 118
 		    $htaccess_failed = true;
119 119
 		}
120 120
 	} else {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	}
123 123
 } else {
124 124
 	// no .htaccess yet, create a fill
125
-	if(!file_put_contents($uploadHta, $denyAll)) {
125
+	if (!file_put_contents($uploadHta, $denyAll)) {
126 126
 		$htaccess_failed = true;
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 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.
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 $htaccess_file   = getcwd() . "/.htaccess";
49 51
 $contents = '';
50 52
 $basePath = parse_url($sugar_config['site_url'], PHP_URL_PATH);
51
-if(empty($basePath)) $basePath = '/';
53
+if(empty($basePath)) {
54
+    $basePath = '/';
55
+}
52 56
 
53 57
 $restrict_str = <<<EOQ
54 58
 # BEGIN SUGARCRM RESTRICTIONS
@@ -74,9 +78,15 @@  discard block
 block discarded – undo
74 78
     $skip = false;
75 79
     while($line = fgets($fp)){
76 80
 
77
-    	if(preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = true;
78
-        if(!$skip)$contents .= $line;
79
-        if(preg_match('/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = false;
81
+    	if(preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line)) {
82
+    	    $skip = true;
83
+    	}
84
+        if(!$skip) {
85
+            $contents .= $line;
86
+        }
87
+        if(preg_match('/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i', $line)) {
88
+            $skip = false;
89
+        }
80 90
     }
81 91
 }
82 92
 if(substr($contents, -1) != "\n") {
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     $skip = false;
75 75
     while($line = fgets($fp)){
76 76
 
77
-    	if(preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = true;
77
+        if(preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = true;
78 78
         if(!$skip)$contents .= $line;
79 79
         if(preg_match('/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i', $line))$skip = false;
80 80
     }
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
106 106
 eoq;
107 107
 
108 108
 if(file_exists($uploadHta) && filesize($uploadHta)) {
109
-	// file exists, parse to make sure it is current
110
-	if(is_writable($uploadHta)) {
111
-		$oldHtaccess = file_get_contents($uploadHta);
112
-		// use a different regex boundary b/c .htaccess uses the typicals
113
-		if(strstr($oldHtaccess, $denyAll) === false) {
114
-		    $oldHtaccess .= "\n";
115
-			$oldHtaccess .= $denyAll;
116
-		}
117
-		if(!file_put_contents($uploadHta, $oldHtaccess)) {
118
-		    $htaccess_failed = true;
119
-		}
120
-	} else {
121
-		$htaccess_failed = true;
122
-	}
109
+    // file exists, parse to make sure it is current
110
+    if(is_writable($uploadHta)) {
111
+        $oldHtaccess = file_get_contents($uploadHta);
112
+        // use a different regex boundary b/c .htaccess uses the typicals
113
+        if(strstr($oldHtaccess, $denyAll) === false) {
114
+            $oldHtaccess .= "\n";
115
+            $oldHtaccess .= $denyAll;
116
+        }
117
+        if(!file_put_contents($uploadHta, $oldHtaccess)) {
118
+            $htaccess_failed = true;
119
+        }
120
+    } else {
121
+        $htaccess_failed = true;
122
+    }
123 123
 } else {
124
-	// no .htaccess yet, create a fill
125
-	if(!file_put_contents($uploadHta, $denyAll)) {
126
-		$htaccess_failed = true;
127
-	}
124
+    // no .htaccess yet, create a fill
125
+    if(!file_put_contents($uploadHta, $denyAll)) {
126
+        $htaccess_failed = true;
127
+    }
128 128
 }
129 129
 
130 130
 /* Commenting out as this shows on upgrade screen
Please login to merge, or discard this patch.
modules/Administration/UpgradeWizard_commit.php 4 patches
Switch Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -305,50 +305,50 @@  discard block
 block discarded – undo
305 305
 }
306 306
 
307 307
 switch( $install_type ){
308
-    case "langpack":
309
-        if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){
310
-            die($mod_strings['ERR_UW_NO_LANG']);
311
-        }
312
-        if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){
313
-            die($mod_strings['ERR_UW_NO_LANG_DESC']);
314
-        }
308
+        case "langpack":
309
+            if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){
310
+                die($mod_strings['ERR_UW_NO_LANG']);
311
+            }
312
+            if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){
313
+                die($mod_strings['ERR_UW_NO_LANG_DESC']);
314
+            }
315 315
 
316
-        if( $mode == "Install" || $mode=="Enable" ){
317
-            $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] );
318
-        }
319
-        else if( $mode == "Uninstall" || $mode=="Disable" ){
320
-            $new_langs = array();
321
-            $old_langs = $sugar_config['languages'];
322
-            foreach( $old_langs as $key => $value ){
323
-                if( $key != $_REQUEST['new_lang_name'] ){
324
-                    $new_langs += array( $key => $value );
316
+            if( $mode == "Install" || $mode=="Enable" ){
317
+                $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] );
318
+            }
319
+            else if( $mode == "Uninstall" || $mode=="Disable" ){
320
+                $new_langs = array();
321
+                $old_langs = $sugar_config['languages'];
322
+                foreach( $old_langs as $key => $value ){
323
+                    if( $key != $_REQUEST['new_lang_name'] ){
324
+                        $new_langs += array( $key => $value );
325
+                    }
325 326
                 }
327
+			    $sugar_config['languages'] = $new_langs;
328
+
329
+	            $default_sugar_instance_lang = 'en_us';
330
+	            if($current_language == $_REQUEST['new_lang_name']){
331
+	        	    $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang;
332
+	        	    $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
333
+	            }
334
+
335
+	            if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){
336
+	        	    $cfg = new Configurator();
337
+             	    $cfg->config['languages'] = $new_langs;
338
+				    $cfg->config['default_language'] = $default_sugar_instance_lang;
339
+				    $cfg->handleOverride();
340
+	        	    $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
341
+	            }
326 342
             }
327
-			$sugar_config['languages'] = $new_langs;
328
-
329
-	        $default_sugar_instance_lang = 'en_us';
330
-	        if($current_language == $_REQUEST['new_lang_name']){
331
-	        	$_SESSION['authenticated_user_language'] =$default_sugar_instance_lang;
332
-	        	$lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
333
-	        }
334
-
335
-	        if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){
336
-	        	$cfg = new Configurator();
337
-             	$cfg->config['languages'] = $new_langs;
338
-				$cfg->config['default_language'] = $default_sugar_instance_lang;
339
-				$cfg->handleOverride();
340
-	        	$lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
341
-	        }
342
-        }
343
-        ksort( $sugar_config );
344
-        if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
345
-            die($mod_strings['ERR_UW_CONFIG_FAILED']);
346
-        }
347
-        break;
348
-    case "module":
349
-        require_once( "ModuleInstall/ModuleInstaller.php" );
350
-        $mi = new ModuleInstaller();
351
-        switch( $mode ){
343
+            ksort( $sugar_config );
344
+            if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
345
+                die($mod_strings['ERR_UW_CONFIG_FAILED']);
346
+            }
347
+            break;
348
+        case "module":
349
+            require_once( "ModuleInstall/ModuleInstaller.php" );
350
+            $mi = new ModuleInstaller();
351
+            switch( $mode ){
352 352
             case "Install":
353 353
             //here we can determine if this is an upgrade or a new version
354 354
             	if(!empty($previous_version)){
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
                 break;
389 389
             default:
390 390
                 break;
391
-        }
391
+            }
392 392
         $current_user->incrementETag("mainMenuETag");
393 393
         break;
394
-    case "full":
395
-        // purposely flow into "case: patch"
396
-    case "patch":
397
- 		switch($mode)
398
- 		{
394
+        case "full":
395
+            // purposely flow into "case: patch"
396
+        case "patch":
397
+ 		    switch($mode)
398
+ 		    {
399 399
  			case 'Install':
400 400
  				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
401 401
 				if(is_file($file))
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
  				break;
425 425
  			default:
426 426
  				break;
427
- 		}
427
+ 		    }
428 428
 
429 429
 		require( "sugar_version.php" );
430 430
 		$sugar_config['sugar_version'] = $sugar_version;
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 			die($mod_strings['ERR_UW_UPDATE_CONFIG']);
436 436
 		}
437 437
         break;
438
-    default:
439
-        break;
438
+        default:
439
+            break;
440 440
 }
441 441
 
442 442
 switch( $mode ){
Please login to merge, or discard this patch.
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 require_once('modules/Administration/UpgradeWizardCommon.php');
44 44
 require_once('modules/Configurator/Configurator.php');
45 45
 function UWrebuild() {
46
-	global $log;
47
-	global $db;
48
-	$log->info('Deleting Relationship Cache. Relationships will automatically refresh.');
46
+    global $log;
47
+    global $db;
48
+    $log->info('Deleting Relationship Cache. Relationships will automatically refresh.');
49 49
 
50
-	echo "
50
+    echo "
51 51
 	<div id='rrresult'></div>
52 52
 	<script>
53 53
 		var xmlhttp=false;
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 		xmlhttp.send(null);
89 89
 		</script>";
90 90
 
91
-	$log->info('Rebuilding everything.');
92
-	require_once('ModuleInstall/ModuleInstaller.php');
93
-	$mi = new ModuleInstaller();
94
-	$mi->rebuild_all();
91
+    $log->info('Rebuilding everything.');
92
+    require_once('ModuleInstall/ModuleInstaller.php');
93
+    $mi = new ModuleInstaller();
94
+    $mi->rebuild_all();
95 95
 }
96 96
 
97 97
 unset($_SESSION['rebuild_relationships']);
@@ -140,19 +140,19 @@  discard block
 block discarded – undo
140 140
 
141 141
 $id_name = '';
142 142
 if(isset($_REQUEST['id_name'])){
143
- $id_name = $_REQUEST['id_name'];
143
+    $id_name = $_REQUEST['id_name'];
144 144
 }
145 145
 $s_manifest = '';
146 146
 if(isset($_REQUEST['s_manifest'])){
147
- $s_manifest = $_REQUEST['s_manifest'];
147
+    $s_manifest = $_REQUEST['s_manifest'];
148 148
 }
149 149
 $previous_version = '';
150 150
 if(isset($_REQUEST['previous_version'])){
151
-	$previous_version = $_REQUEST['previous_version'];
151
+    $previous_version = $_REQUEST['previous_version'];
152 152
 }
153 153
 $previous_id = '';
154 154
 if(isset($_REQUEST['previous_id'])){
155
-	$previous_id = $_REQUEST['previous_id'];
155
+    $previous_id = $_REQUEST['previous_id'];
156 156
 }
157 157
 if( $install_type != "module" ){
158 158
     if( !isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "") ){
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 }
171 171
 $remove_tables = 'true';
172 172
 if(isset($_REQUEST['remove_tables'])){
173
-	$remove_tables = $_REQUEST['remove_tables'];
173
+    $remove_tables = $_REQUEST['remove_tables'];
174 174
 }
175 175
 $overwrite_files = true;
176 176
 if(isset($_REQUEST['radio_overwrite'])){
177
- $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true);
177
+    $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true);
178 178
 }
179 179
 
180 180
 //rrs
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 
201 201
 if (((defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN)
202 202
     || !empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) && $install_type != 'patch') {
203
-	require_once('ModuleInstall/ModuleScanner.php');
204
-	$ms = new ModuleScanner();
205
-	$ms->scanPackage($unzip_dir);
206
-	if($ms->hasIssues()){
207
-		$ms->displayIssues();
208
-		sugar_cleanup(true);
209
-	}
203
+    require_once('ModuleInstall/ModuleScanner.php');
204
+    $ms = new ModuleScanner();
205
+    $ms->scanPackage($unzip_dir);
206
+    if($ms->hasIssues()){
207
+        $ms->displayIssues();
208
+        sugar_cleanup(true);
209
+    }
210 210
 }
211 211
 
212 212
 //
@@ -214,29 +214,29 @@  discard block
 block discarded – undo
214 214
 //
215 215
 if($install_type == 'patch' || $install_type == 'module')
216 216
 {
217
-	switch($mode)
218
- 	{
219
- 		case 'Install':
220
- 			$file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE');
221
-			if(is_file($file))
222
-			{
223
-				print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
224
-				include($file);
225
-				pre_install();
226
-   		}
227
- 			break;
228
- 		case 'Uninstall':
229
- 			$file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE');
230
-			if(is_file($file))
231
-			{
232
-				print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
233
-				include($file);
234
-				pre_uninstall();
235
-   		}
236
- 			break;
237
- 		default:
238
- 			break;
239
- 		}
217
+    switch($mode)
218
+        {
219
+            case 'Install':
220
+             $file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE');
221
+            if(is_file($file))
222
+            {
223
+                print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
224
+                include($file);
225
+                pre_install();
226
+            }
227
+                break;
228
+            case 'Uninstall':
229
+             $file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE');
230
+            if(is_file($file))
231
+            {
232
+                print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
233
+                include($file);
234
+                pre_uninstall();
235
+            }
236
+                break;
237
+            default:
238
+             break;
239
+            }
240 240
 }
241 241
 
242 242
 //
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
         $sugar_home_dir = getCwd();
252 252
         $dest_file  = clean_path( "$sugar_home_dir/$zip_to_dir/$file_to_copy" );
253 253
         if($zip_to_dir != '.')
254
-        	$rest_file  = clean_path("$rest_dir/$zip_to_dir/$file_to_copy");
254
+            $rest_file  = clean_path("$rest_dir/$zip_to_dir/$file_to_copy");
255 255
         else
256
-        	$rest_file  = clean_path("$rest_dir/$file_to_copy");
256
+            $rest_file  = clean_path("$rest_dir/$file_to_copy");
257 257
 
258 258
         switch( $mode ){
259 259
             case "Install":
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 
262 262
                 if($install_type=="patch" && is_file($dest_file))
263 263
                 {
264
-	                if(!is_dir(dirname( $rest_file )))
265
-                		mkdir_recursive( dirname( $rest_file ) );
264
+                    if(!is_dir(dirname( $rest_file )))
265
+                        mkdir_recursive( dirname( $rest_file ) );
266 266
 
267
-	                copy( $dest_file, $rest_file);
268
-	                sugar_touch( $rest_file, filemtime($dest_file) );
267
+                    copy( $dest_file, $rest_file);
268
+                    sugar_touch( $rest_file, filemtime($dest_file) );
269 269
                 }
270 270
 
271 271
                 if( !copy( $src_file, $dest_file ) ){
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
             case "Uninstall":
277 277
                 if($install_type=="patch" && is_file($rest_file))
278 278
                 {
279
-	                copy( $rest_file, $dest_file);
280
-	                sugar_touch( $dest_file, filemtime($rest_file) );
279
+                    copy( $rest_file, $dest_file);
280
+                    sugar_touch( $dest_file, filemtime($rest_file) );
281 281
                 }
282 282
                 elseif(file_exists($dest_file) && !unlink($dest_file))
283 283
                 {
@@ -312,21 +312,21 @@  discard block
 block discarded – undo
312 312
                     $new_langs += array( $key => $value );
313 313
                 }
314 314
             }
315
-			$sugar_config['languages'] = $new_langs;
316
-
317
-	        $default_sugar_instance_lang = 'en_us';
318
-	        if($current_language == $_REQUEST['new_lang_name']){
319
-	        	$_SESSION['authenticated_user_language'] =$default_sugar_instance_lang;
320
-	        	$lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
321
-	        }
322
-
323
-	        if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){
324
-	        	$cfg = new Configurator();
325
-             	$cfg->config['languages'] = $new_langs;
326
-				$cfg->config['default_language'] = $default_sugar_instance_lang;
327
-				$cfg->handleOverride();
328
-	        	$lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
329
-	        }
315
+            $sugar_config['languages'] = $new_langs;
316
+
317
+            $default_sugar_instance_lang = 'en_us';
318
+            if($current_language == $_REQUEST['new_lang_name']){
319
+                $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang;
320
+                $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
321
+            }
322
+
323
+            if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){
324
+                $cfg = new Configurator();
325
+                    $cfg->config['languages'] = $new_langs;
326
+                $cfg->config['default_language'] = $default_sugar_instance_lang;
327
+                $cfg->handleOverride();
328
+                $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
329
+            }
330 330
         }
331 331
         ksort( $sugar_config );
332 332
         if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
@@ -339,39 +339,39 @@  discard block
 block discarded – undo
339 339
         switch( $mode ){
340 340
             case "Install":
341 341
             //here we can determine if this is an upgrade or a new version
342
-            	if(!empty($previous_version)){
343
-            		$mi->install( "$unzip_dir", true, $previous_version);
344
-            	}else{
345
-                	$mi->install( "$unzip_dir" );
346
-            	}
347
-
348
-				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
349
-				if(is_file($file))
350
-				{
351
-					print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
352
-					include($file);
353
-					post_install();
354
-				}
355
-            	break;
342
+                if(!empty($previous_version)){
343
+                    $mi->install( "$unzip_dir", true, $previous_version);
344
+                }else{
345
+                    $mi->install( "$unzip_dir" );
346
+                }
347
+
348
+                $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
349
+                if(is_file($file))
350
+                {
351
+                    print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
352
+                    include($file);
353
+                    post_install();
354
+                }
355
+                break;
356 356
             case "Uninstall":
357 357
                 if($remove_tables == 'false')
358
-                	$GLOBALS['mi_remove_tables'] = false;
358
+                    $GLOBALS['mi_remove_tables'] = false;
359 359
                 else
360
-                	$GLOBALS['mi_remove_tables'] = true;
360
+                    $GLOBALS['mi_remove_tables'] = true;
361 361
                 $mi->uninstall( "$unzip_dir" );
362 362
                 break;
363
-             case "Disable":
363
+                case "Disable":
364 364
                 if(!$overwrite_files)
365
-                	$GLOBALS['mi_overwrite_files'] = false;
365
+                    $GLOBALS['mi_overwrite_files'] = false;
366 366
                 else
367
-                	$GLOBALS['mi_overwrite_files'] = true;
367
+                    $GLOBALS['mi_overwrite_files'] = true;
368 368
                 $mi->disable( "$unzip_dir" );
369 369
                 break;
370
-             case "Enable":
370
+                case "Enable":
371 371
                 if(!$overwrite_files)
372
-                	$GLOBALS['mi_overwrite_files'] = false;
372
+                    $GLOBALS['mi_overwrite_files'] = false;
373 373
                 else
374
-                	$GLOBALS['mi_overwrite_files'] = true;
374
+                    $GLOBALS['mi_overwrite_files'] = true;
375 375
                 $mi->enable( "$unzip_dir" );
376 376
                 break;
377 377
             default:
@@ -382,46 +382,46 @@  discard block
 block discarded – undo
382 382
     case "full":
383 383
         // purposely flow into "case: patch"
384 384
     case "patch":
385
- 		switch($mode)
386
- 		{
387
- 			case 'Install':
388
- 				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
389
-				if(is_file($file))
390
-				{
391
-					print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
392
-					include($file);
393
-					post_install();
394
-				}
395
-
396
-				UWrebuild();
397
- 				break;
398
- 			case 'Uninstall':
399
- 				$file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE');
400
- 				if(is_file($file)) {
401
-					print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
402
-					include($file);
403
-					post_uninstall();
404
-				}
405
-
406
-				if(is_dir($rest_dir))
407
-				{
408
-					rmdir_recursive($rest_dir);
409
-				}
410
-
411
-				UWrebuild();
412
- 				break;
413
- 			default:
414
- 				break;
415
- 		}
416
-
417
-		require( "sugar_version.php" );
418
-		$sugar_config['sugar_version'] = $sugar_version;
419
-		ksort( $sugar_config );
420
-
421
-		if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) )
422
-		{
423
-			die($mod_strings['ERR_UW_UPDATE_CONFIG']);
424
-		}
385
+         switch($mode)
386
+            {
387
+                case 'Install':
388
+                 $file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
389
+                if(is_file($file))
390
+                {
391
+                    print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
392
+                    include($file);
393
+                    post_install();
394
+                }
395
+
396
+                UWrebuild();
397
+                    break;
398
+                case 'Uninstall':
399
+                 $file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE');
400
+                    if(is_file($file)) {
401
+                    print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
402
+                    include($file);
403
+                    post_uninstall();
404
+                }
405
+
406
+                if(is_dir($rest_dir))
407
+                {
408
+                    rmdir_recursive($rest_dir);
409
+                }
410
+
411
+                UWrebuild();
412
+                    break;
413
+                default:
414
+                 break;
415
+            }
416
+
417
+        require( "sugar_version.php" );
418
+        $sugar_config['sugar_version'] = $sugar_version;
419
+        ksort( $sugar_config );
420
+
421
+        if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) )
422
+        {
423
+            die($mod_strings['ERR_UW_UPDATE_CONFIG']);
424
+        }
425 425
         break;
426 426
     default:
427 427
         break;
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
         $new_upgrade = new UpgradeHistory();
435 435
         //determine if this module has already been installed given the unique_key to
436 436
         //identify the module
437
-       // $new_upgrade->checkForExisting($unique_key);
438
-       	if(!empty($previous_id)){
439
-       		$new_upgrade->id = $previous_id;
440
-       		$uh = new UpgradeHistory();
441
-       		$uh->retrieve($previous_id);
442
-       		if(is_file($uh->filename)) {
443
-       		unlink($uh->filename);
444
-       		}
445
-       	}
437
+        // $new_upgrade->checkForExisting($unique_key);
438
+            if(!empty($previous_id)){
439
+                $new_upgrade->id = $previous_id;
440
+                $uh = new UpgradeHistory();
441
+                $uh->retrieve($previous_id);
442
+                if(is_file($uh->filename)) {
443
+                unlink($uh->filename);
444
+                }
445
+            }
446 446
         $new_upgrade->filename      = $install_file;
447 447
         $new_upgrade->md5sum        = md5_file( $install_file );
448 448
         $new_upgrade->type          = $install_type;
@@ -457,25 +457,25 @@  discard block
 block discarded – undo
457 457
         //Check if we need to show a page for the user to finalize their install with.
458 458
         if (is_file("$unzip_dir/manifest.php"))
459 459
         {
460
-        	include("$unzip_dir/manifest.php");
461
-        	if (!empty($manifest['post_install_url']))
462
-        	{
463
-        		$url_conf = $manifest['post_install_url'];
464
-        		if (is_string($url_conf))
465
-        			$url_conf = array('url' => $url_conf);
466
-        		if (isset($url_conf['type']) && $url_conf['type'] == 'popup')
467
-        		{
468
-        			echo '<script type="text/javascript">window.open("' . $url_conf['url']
469
-        			   . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","'
470
-        			   . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ','
471
-        			   . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>';
472
-        		} else
473
-        		{
474
-        			echo '<iframe src="' . $url_conf['url'] . '" '
475
-        			   . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" '
476
-        			   . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>';
477
-        		}
478
-        	}
460
+            include("$unzip_dir/manifest.php");
461
+            if (!empty($manifest['post_install_url']))
462
+            {
463
+                $url_conf = $manifest['post_install_url'];
464
+                if (is_string($url_conf))
465
+                    $url_conf = array('url' => $url_conf);
466
+                if (isset($url_conf['type']) && $url_conf['type'] == 'popup')
467
+                {
468
+                    echo '<script type="text/javascript">window.open("' . $url_conf['url']
469
+                        . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","'
470
+                        . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ','
471
+                        . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>';
472
+                } else
473
+                {
474
+                    echo '<iframe src="' . $url_conf['url'] . '" '
475
+                        . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" '
476
+                        . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>';
477
+                }
478
+            }
479 479
         }
480 480
     break;
481 481
     case "Uninstall":
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
500 500
         }
501 501
         foreach( $md5_matches as $md5_match ){
502
-             $md5_match->enabled = 0;
502
+                $md5_match->enabled = 0;
503 503
             $md5_match->save();
504 504
         }
505 505
         break;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 echo "</div>";
533 533
 echo "<br>";
534 534
 if(isset($lang_changed_string))
535
-	print($lang_changed_string);
535
+    print($lang_changed_string);
536 536
 if ($install_type != "module" && $install_type != "langpack"){
537 537
     if( sizeof( $files_to_handle ) > 0 ){
538 538
         echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">' . SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']) . ' '.$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
Please login to merge, or discard this patch.
Spacing   +135 added lines, -135 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.
@@ -100,80 +100,80 @@  discard block
 block discarded – undo
100 100
 global $log, $db;
101 101
 
102 102
 // process commands
103
-if( !isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "") ){
103
+if (!isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "")) {
104 104
     die($mod_strings['ERR_UW_NO_MODE']);
105 105
 }
106 106
 $mode = $_REQUEST['mode'];
107 107
 
108 108
 
109
-if( !isset($_REQUEST['version']) ){
109
+if (!isset($_REQUEST['version'])) {
110 110
     die($mod_strings['ERR_UW_NO_MODE']);
111 111
 }
112 112
 $version = $_REQUEST['version'];
113 113
 
114
-if( !isset($_REQUEST['copy_count']) || ($_REQUEST['copy_count'] == "") ){
114
+if (!isset($_REQUEST['copy_count']) || ($_REQUEST['copy_count'] == "")) {
115 115
     die($mod_strings['ERR_UW_NO_FILES']);
116 116
 }
117 117
 
118
-if( empty($_REQUEST['unzip_dir']) || $_REQUEST['unzip_dir'] == "." || $_REQUEST['unzip_dir'] == ".."){
118
+if (empty($_REQUEST['unzip_dir']) || $_REQUEST['unzip_dir'] == "." || $_REQUEST['unzip_dir'] == "..") {
119 119
     die($mod_strings['ERR_UW_NO_TEMP_DIR']);
120 120
 }
121
-$unzip_dir = $base_tmp_upgrade_dir. "/". basename($_REQUEST['unzip_dir']);
121
+$unzip_dir = $base_tmp_upgrade_dir."/".basename($_REQUEST['unzip_dir']);
122 122
 
123
-if(empty($_REQUEST['install_file'])){
123
+if (empty($_REQUEST['install_file'])) {
124 124
     die($mod_strings['ERR_UW_NO_INSTALL_FILE']);
125 125
 }
126 126
 
127
-$install_file   = hashToFile($_REQUEST['install_file'] );
128
-$install_type   = getInstallType( $install_file );
127
+$install_file   = hashToFile($_REQUEST['install_file']);
128
+$install_type   = getInstallType($install_file);
129 129
 
130 130
 //from here on out, the install_file is used as the file path to copy or rename the physical file, so let's remove the stream wrapper if it's set
131 131
 //and replace it with the proper upload location
132
-if(strpos($install_file,'upload://') === 0){
132
+if (strpos($install_file, 'upload://') === 0) {
133 133
     //get the upload location if it's set, or default to 'upload'
134 134
     $upload_dir = empty($GLOBALS['sugar_config']['upload_dir']) ? 'upload' : rtrim($GLOBALS['sugar_config']['upload_dir'], '/\\');
135 135
 
136 136
     //replace the wrapper in the file name with the directory
137
-    $install_file = str_replace('upload:/',$upload_dir,$install_file);
137
+    $install_file = str_replace('upload:/', $upload_dir, $install_file);
138 138
     $_REQUEST['install_file'] = $install_file;
139 139
 }
140 140
 
141 141
 $id_name = '';
142
-if(isset($_REQUEST['id_name'])){
142
+if (isset($_REQUEST['id_name'])) {
143 143
  $id_name = $_REQUEST['id_name'];
144 144
 }
145 145
 $s_manifest = '';
146
-if(isset($_REQUEST['s_manifest'])){
146
+if (isset($_REQUEST['s_manifest'])) {
147 147
  $s_manifest = $_REQUEST['s_manifest'];
148 148
 }
149 149
 $previous_version = '';
150
-if(isset($_REQUEST['previous_version'])){
150
+if (isset($_REQUEST['previous_version'])) {
151 151
 	$previous_version = $_REQUEST['previous_version'];
152 152
 }
153 153
 $previous_id = '';
154
-if(isset($_REQUEST['previous_id'])){
154
+if (isset($_REQUEST['previous_id'])) {
155 155
 	$previous_id = $_REQUEST['previous_id'];
156 156
 }
157
-if( $install_type != "module" ){
158
-    if( !isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "") ){
159
-        $zip_from_dir     = ".";
157
+if ($install_type != "module") {
158
+    if (!isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "")) {
159
+        $zip_from_dir = ".";
160 160
     }
161
-    else{
161
+    else {
162 162
         $zip_from_dir   = $_REQUEST['zip_from_dir'];
163 163
     }
164
-    if( !isset($_REQUEST['zip_to_dir']) || ($_REQUEST['zip_to_dir'] == "") ){
164
+    if (!isset($_REQUEST['zip_to_dir']) || ($_REQUEST['zip_to_dir'] == "")) {
165 165
         $zip_to_dir     = ".";
166 166
     }
167
-    else{
167
+    else {
168 168
         $zip_to_dir     = $_REQUEST['zip_to_dir'];
169 169
     }
170 170
 }
171 171
 $remove_tables = 'true';
172
-if(isset($_REQUEST['remove_tables'])){
172
+if (isset($_REQUEST['remove_tables'])) {
173 173
 	$remove_tables = $_REQUEST['remove_tables'];
174 174
 }
175 175
 $overwrite_files = true;
176
-if(isset($_REQUEST['radio_overwrite'])){
176
+if (isset($_REQUEST['radio_overwrite'])) {
177 177
  $overwrite_files = (($_REQUEST['radio_overwrite'] == 'do_not_overwrite') ? false : true);
178 178
 }
179 179
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 $name = '';
184 184
 $description = '';
185 185
 
186
-if($install_type == 'module'){
186
+if ($install_type == 'module') {
187 187
     $is_uninstallable = $_REQUEST['is_uninstallable'];
188 188
     $name = $_REQUEST['name'];
189 189
     $description = $_REQUEST['description'];
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
 $rest_dir = remove_file_extension($install_file)."-restore";
197 197
 
198
-$files_to_handle  = array();
198
+$files_to_handle = array();
199 199
 register_shutdown_function("rmdir_recursive", $unzip_dir);
200 200
 
201 201
 if (((defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN)
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	require_once('ModuleInstall/ModuleScanner.php');
204 204
 	$ms = new ModuleScanner();
205 205
 	$ms->scanPackage($unzip_dir);
206
-	if($ms->hasIssues()){
206
+	if ($ms->hasIssues()) {
207 207
 		$ms->displayIssues();
208 208
 		sugar_cleanup(true);
209 209
 	}
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 //
213 213
 // execute the PRE scripts
214 214
 //
215
-if($install_type == 'patch' || $install_type == 'module')
215
+if ($install_type == 'patch' || $install_type == 'module')
216 216
 {
217
-	switch($mode)
217
+	switch ($mode)
218 218
  	{
219 219
  		case 'Install':
220
- 			$file = "$unzip_dir/" . constant('SUGARCRM_PRE_INSTALL_FILE');
221
-			if(is_file($file))
220
+ 			$file = "$unzip_dir/".constant('SUGARCRM_PRE_INSTALL_FILE');
221
+			if (is_file($file))
222 222
 			{
223 223
 				print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
224 224
 				include($file);
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
    		}
227 227
  			break;
228 228
  		case 'Uninstall':
229
- 			$file = "$unzip_dir/" . constant('SUGARCRM_PRE_UNINSTALL_FILE');
230
-			if(is_file($file))
229
+ 			$file = "$unzip_dir/".constant('SUGARCRM_PRE_UNINSTALL_FILE');
230
+			if (is_file($file))
231 231
 			{
232 232
 				print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
233 233
 				include($file);
@@ -243,84 +243,84 @@  discard block
 block discarded – undo
243 243
 // perform the action
244 244
 //
245 245
 
246
-for( $iii = 0; $iii < $_REQUEST['copy_count']; $iii++ ){
247
-    if( isset($_REQUEST["copy_" . $iii]) && ($_REQUEST["copy_" . $iii] != "") ){
248
-        $file_to_copy = $_REQUEST["copy_" . $iii];
249
-        $src_file   = clean_path( "$unzip_dir/$zip_from_dir/$file_to_copy" );
246
+for ($iii = 0; $iii < $_REQUEST['copy_count']; $iii++) {
247
+    if (isset($_REQUEST["copy_".$iii]) && ($_REQUEST["copy_".$iii] != "")) {
248
+        $file_to_copy = $_REQUEST["copy_".$iii];
249
+        $src_file   = clean_path("$unzip_dir/$zip_from_dir/$file_to_copy");
250 250
 
251 251
         $sugar_home_dir = getCwd();
252
-        $dest_file  = clean_path( "$sugar_home_dir/$zip_to_dir/$file_to_copy" );
253
-        if($zip_to_dir != '.')
252
+        $dest_file  = clean_path("$sugar_home_dir/$zip_to_dir/$file_to_copy");
253
+        if ($zip_to_dir != '.')
254 254
         	$rest_file  = clean_path("$rest_dir/$zip_to_dir/$file_to_copy");
255 255
         else
256 256
         	$rest_file  = clean_path("$rest_dir/$file_to_copy");
257 257
 
258
-        switch( $mode ){
258
+        switch ($mode) {
259 259
             case "Install":
260
-                mkdir_recursive( dirname( $dest_file ) );
260
+                mkdir_recursive(dirname($dest_file));
261 261
 
262
-                if($install_type=="patch" && is_file($dest_file))
262
+                if ($install_type == "patch" && is_file($dest_file))
263 263
                 {
264
-	                if(!is_dir(dirname( $rest_file )))
265
-                		mkdir_recursive( dirname( $rest_file ) );
264
+	                if (!is_dir(dirname($rest_file)))
265
+                		mkdir_recursive(dirname($rest_file));
266 266
 
267
-	                copy( $dest_file, $rest_file);
268
-	                sugar_touch( $rest_file, filemtime($dest_file) );
267
+	                copy($dest_file, $rest_file);
268
+	                sugar_touch($rest_file, filemtime($dest_file));
269 269
                 }
270 270
 
271
-                if( !copy( $src_file, $dest_file ) ){
272
-                    die( $mod_strings['ERR_UW_COPY_FAILED'].$src_file.$mod_strings['LBL_TO'].$dest_file);
271
+                if (!copy($src_file, $dest_file)) {
272
+                    die($mod_strings['ERR_UW_COPY_FAILED'].$src_file.$mod_strings['LBL_TO'].$dest_file);
273 273
                 }
274 274
                 $uh_status = "installed";
275 275
                 break;
276 276
             case "Uninstall":
277
-                if($install_type=="patch" && is_file($rest_file))
277
+                if ($install_type == "patch" && is_file($rest_file))
278 278
                 {
279
-	                copy( $rest_file, $dest_file);
280
-	                sugar_touch( $dest_file, filemtime($rest_file) );
279
+	                copy($rest_file, $dest_file);
280
+	                sugar_touch($dest_file, filemtime($rest_file));
281 281
                 }
282
-                elseif(file_exists($dest_file) && !unlink($dest_file))
282
+                elseif (file_exists($dest_file) && !unlink($dest_file))
283 283
                 {
284 284
                     die($mod_strings['ERR_UW_REMOVE_FAILED'].$dest_file);
285 285
                 }
286 286
                 $uh_status = "uninstalled";
287 287
                 break;
288 288
             default:
289
-                die("{$mod_strings['LBL_UW_OP_MODE']} '$mode' {$mod_strings['ERR_UW_NOT_RECOGNIZED']}." );
289
+                die("{$mod_strings['LBL_UW_OP_MODE']} '$mode' {$mod_strings['ERR_UW_NOT_RECOGNIZED']}.");
290 290
         }
291
-        $files_to_handle[] = clean_path( "$zip_to_dir/$file_to_copy" );
291
+        $files_to_handle[] = clean_path("$zip_to_dir/$file_to_copy");
292 292
     }
293 293
 }
294 294
 
295
-switch( $install_type ){
295
+switch ($install_type) {
296 296
     case "langpack":
297
-        if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){
297
+        if (!isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "")) {
298 298
             die($mod_strings['ERR_UW_NO_LANG']);
299 299
         }
300
-        if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){
300
+        if (!isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "")) {
301 301
             die($mod_strings['ERR_UW_NO_LANG_DESC']);
302 302
         }
303 303
 
304
-        if( $mode == "Install" || $mode=="Enable" ){
305
-            $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] );
304
+        if ($mode == "Install" || $mode == "Enable") {
305
+            $sugar_config['languages'] = $sugar_config['languages'] + array($_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc']);
306 306
         }
307
-        else if( $mode == "Uninstall" || $mode=="Disable" ){
307
+        else if ($mode == "Uninstall" || $mode == "Disable") {
308 308
             $new_langs = array();
309 309
             $old_langs = $sugar_config['languages'];
310
-            foreach( $old_langs as $key => $value ){
311
-                if( $key != $_REQUEST['new_lang_name'] ){
312
-                    $new_langs += array( $key => $value );
310
+            foreach ($old_langs as $key => $value) {
311
+                if ($key != $_REQUEST['new_lang_name']) {
312
+                    $new_langs += array($key => $value);
313 313
                 }
314 314
             }
315 315
 			$sugar_config['languages'] = $new_langs;
316 316
 
317 317
 	        $default_sugar_instance_lang = 'en_us';
318
-	        if($current_language == $_REQUEST['new_lang_name']){
319
-	        	$_SESSION['authenticated_user_language'] =$default_sugar_instance_lang;
318
+	        if ($current_language == $_REQUEST['new_lang_name']) {
319
+	        	$_SESSION['authenticated_user_language'] = $default_sugar_instance_lang;
320 320
 	        	$lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
321 321
 	        }
322 322
 
323
-	        if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){
323
+	        if ($sugar_config['default_language'] == $_REQUEST['new_lang_name']) {
324 324
 	        	$cfg = new Configurator();
325 325
              	$cfg->config['languages'] = $new_langs;
326 326
 				$cfg->config['default_language'] = $default_sugar_instance_lang;
@@ -328,25 +328,25 @@  discard block
 block discarded – undo
328 328
 	        	$lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>';
329 329
 	        }
330 330
         }
331
-        ksort( $sugar_config );
332
-        if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){
331
+        ksort($sugar_config);
332
+        if (!write_array_to_file("sugar_config", $sugar_config, "config.php")) {
333 333
             die($mod_strings['ERR_UW_CONFIG_FAILED']);
334 334
         }
335 335
         break;
336 336
     case "module":
337
-        require_once( "ModuleInstall/ModuleInstaller.php" );
337
+        require_once("ModuleInstall/ModuleInstaller.php");
338 338
         $mi = new ModuleInstaller();
339
-        switch( $mode ){
339
+        switch ($mode) {
340 340
             case "Install":
341 341
             //here we can determine if this is an upgrade or a new version
342
-            	if(!empty($previous_version)){
343
-            		$mi->install( "$unzip_dir", true, $previous_version);
344
-            	}else{
345
-                	$mi->install( "$unzip_dir" );
342
+            	if (!empty($previous_version)) {
343
+            		$mi->install("$unzip_dir", true, $previous_version);
344
+            	} else {
345
+                	$mi->install("$unzip_dir");
346 346
             	}
347 347
 
348
-				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
349
-				if(is_file($file))
348
+				$file = "$unzip_dir/".constant('SUGARCRM_POST_INSTALL_FILE');
349
+				if (is_file($file))
350 350
 				{
351 351
 					print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
352 352
 					include($file);
@@ -354,25 +354,25 @@  discard block
 block discarded – undo
354 354
 				}
355 355
             	break;
356 356
             case "Uninstall":
357
-                if($remove_tables == 'false')
357
+                if ($remove_tables == 'false')
358 358
                 	$GLOBALS['mi_remove_tables'] = false;
359 359
                 else
360 360
                 	$GLOBALS['mi_remove_tables'] = true;
361
-                $mi->uninstall( "$unzip_dir" );
361
+                $mi->uninstall("$unzip_dir");
362 362
                 break;
363 363
              case "Disable":
364
-                if(!$overwrite_files)
364
+                if (!$overwrite_files)
365 365
                 	$GLOBALS['mi_overwrite_files'] = false;
366 366
                 else
367 367
                 	$GLOBALS['mi_overwrite_files'] = true;
368
-                $mi->disable( "$unzip_dir" );
368
+                $mi->disable("$unzip_dir");
369 369
                 break;
370 370
              case "Enable":
371
-                if(!$overwrite_files)
371
+                if (!$overwrite_files)
372 372
                 	$GLOBALS['mi_overwrite_files'] = false;
373 373
                 else
374 374
                 	$GLOBALS['mi_overwrite_files'] = true;
375
-                $mi->enable( "$unzip_dir" );
375
+                $mi->enable("$unzip_dir");
376 376
                 break;
377 377
             default:
378 378
                 break;
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
     case "full":
383 383
         // purposely flow into "case: patch"
384 384
     case "patch":
385
- 		switch($mode)
385
+ 		switch ($mode)
386 386
  		{
387 387
  			case 'Install':
388
- 				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE');
389
-				if(is_file($file))
388
+ 				$file = "$unzip_dir/".constant('SUGARCRM_POST_INSTALL_FILE');
389
+				if (is_file($file))
390 390
 				{
391 391
 					print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
392 392
 					include($file);
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
 				UWrebuild();
397 397
  				break;
398 398
  			case 'Uninstall':
399
- 				$file = "$unzip_dir/" . constant('SUGARCRM_POST_UNINSTALL_FILE');
400
- 				if(is_file($file)) {
399
+ 				$file = "$unzip_dir/".constant('SUGARCRM_POST_UNINSTALL_FILE');
400
+ 				if (is_file($file)) {
401 401
 					print("{$mod_strings['LBL_UW_INCLUDING']}: $file <br>\n");
402 402
 					include($file);
403 403
 					post_uninstall();
404 404
 				}
405 405
 
406
-				if(is_dir($rest_dir))
406
+				if (is_dir($rest_dir))
407 407
 				{
408 408
 					rmdir_recursive($rest_dir);
409 409
 				}
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
  				break;
415 415
  		}
416 416
 
417
-		require( "sugar_version.php" );
417
+		require("sugar_version.php");
418 418
 		$sugar_config['sugar_version'] = $sugar_version;
419
-		ksort( $sugar_config );
419
+		ksort($sugar_config);
420 420
 
421
-		if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) )
421
+		if (!write_array_to_file("sugar_config", $sugar_config, "config.php"))
422 422
 		{
423 423
 			die($mod_strings['ERR_UW_UPDATE_CONFIG']);
424 424
 		}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
         break;
428 428
 }
429 429
 
430
-switch( $mode ){
430
+switch ($mode) {
431 431
     case "Install":
432 432
         $file_action = "copied";
433 433
         // if error was encountered, script should have died before now
@@ -435,23 +435,23 @@  discard block
 block discarded – undo
435 435
         //determine if this module has already been installed given the unique_key to
436 436
         //identify the module
437 437
        // $new_upgrade->checkForExisting($unique_key);
438
-       	if(!empty($previous_id)){
438
+       	if (!empty($previous_id)) {
439 439
        		$new_upgrade->id = $previous_id;
440 440
        		$uh = new UpgradeHistory();
441 441
        		$uh->retrieve($previous_id);
442
-       		if(is_file($uh->filename)) {
442
+       		if (is_file($uh->filename)) {
443 443
        		unlink($uh->filename);
444 444
        		}
445 445
        	}
446 446
         $new_upgrade->filename      = $install_file;
447
-        $new_upgrade->md5sum        = md5_file( $install_file );
447
+        $new_upgrade->md5sum        = md5_file($install_file);
448 448
         $new_upgrade->type          = $install_type;
449 449
         $new_upgrade->version       = $version;
450 450
         $new_upgrade->status        = "installed";
451 451
         $new_upgrade->name          = $name;
452 452
         $new_upgrade->description   = $description;
453
-        $new_upgrade->id_name		= $id_name;
454
-        $new_upgrade->manifest		= $s_manifest;
453
+        $new_upgrade->id_name = $id_name;
454
+        $new_upgrade->manifest = $s_manifest;
455 455
         $new_upgrade->save();
456 456
 
457 457
         //Check if we need to show a page for the user to finalize their install with.
@@ -465,15 +465,15 @@  discard block
 block discarded – undo
465 465
         			$url_conf = array('url' => $url_conf);
466 466
         		if (isset($url_conf['type']) && $url_conf['type'] == 'popup')
467 467
         		{
468
-        			echo '<script type="text/javascript">window.open("' . $url_conf['url']
469
-        			   . '","' . (empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']) . '","'
470
-        			   . 'height=' . (empty($url_conf['height']) ? '500' : $url_conf['height']) . ','
471
-        			   . 'width=' . (empty($url_conf['width']) ? '800' : $url_conf['width']) . '");</script>';
468
+        			echo '<script type="text/javascript">window.open("'.$url_conf['url']
469
+        			   . '","'.(empty($url_conf['name']) ? 'sugar_popup' : $url_conf['name']).'","'
470
+        			   . 'height='.(empty($url_conf['height']) ? '500' : $url_conf['height']).','
471
+        			   . 'width='.(empty($url_conf['width']) ? '800' : $url_conf['width']).'");</script>';
472 472
         		} else
473 473
         		{
474
-        			echo '<iframe src="' . $url_conf['url'] . '" '
475
-        			   . 'width="' . (empty($url_conf['width']) ? '100%' : $url_conf['width']) . '" '
476
-        			   . 'height="' . (empty($url_conf['height']) ? '500px' : $url_conf['height']) . '"></iframe>';
474
+        			echo '<iframe src="'.$url_conf['url'].'" '
475
+        			   . 'width="'.(empty($url_conf['width']) ? '100%' : $url_conf['width']).'" '
476
+        			   . 'height="'.(empty($url_conf['height']) ? '500px' : $url_conf['height']).'"></iframe>';
477 477
         		}
478 478
         	}
479 479
         }
@@ -481,24 +481,24 @@  discard block
 block discarded – undo
481 481
     case "Uninstall":
482 482
         $file_action = "removed";
483 483
         $uh = new UpgradeHistory();
484
-        $the_md5 = md5_file( $install_file );
485
-        $md5_matches = $uh->findByMd5( $the_md5 );
486
-        if( sizeof( $md5_matches ) == 0 ){
487
-            die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
484
+        $the_md5 = md5_file($install_file);
485
+        $md5_matches = $uh->findByMd5($the_md5);
486
+        if (sizeof($md5_matches) == 0) {
487
+            die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file.");
488 488
         }
489
-        foreach( $md5_matches as $md5_match ){
489
+        foreach ($md5_matches as $md5_match) {
490 490
             $md5_match->delete();
491 491
         }
492 492
         break;
493 493
     case "Disable":
494 494
         $file_action = "disabled";
495 495
         $uh = new UpgradeHistory();
496
-        $the_md5 = md5_file( $install_file );
497
-        $md5_matches = $uh->findByMd5( $the_md5 );
498
-        if( sizeof( $md5_matches ) == 0 ){
499
-            die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
496
+        $the_md5 = md5_file($install_file);
497
+        $md5_matches = $uh->findByMd5($the_md5);
498
+        if (sizeof($md5_matches) == 0) {
499
+            die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file.");
500 500
         }
501
-        foreach( $md5_matches as $md5_match ){
501
+        foreach ($md5_matches as $md5_match) {
502 502
              $md5_match->enabled = 0;
503 503
             $md5_match->save();
504 504
         }
@@ -506,12 +506,12 @@  discard block
 block discarded – undo
506 506
     case "Enable":
507 507
         $file_action = "enabled";
508 508
         $uh = new UpgradeHistory();
509
-        $the_md5 = md5_file( $install_file );
510
-        $md5_matches = $uh->findByMd5( $the_md5 );
511
-        if( sizeof( $md5_matches ) == 0 ){
512
-            die( "{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file." );
509
+        $the_md5 = md5_file($install_file);
510
+        $md5_matches = $uh->findByMd5($the_md5);
511
+        if (sizeof($md5_matches) == 0) {
512
+            die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} $install_file.");
513 513
         }
514
-        foreach( $md5_matches as $md5_match ){
514
+        foreach ($md5_matches as $md5_match) {
515 515
             $md5_match->enabled = 1;
516 516
             $md5_match->save();
517 517
         }
@@ -520,41 +520,41 @@  discard block
 block discarded – undo
520 520
 
521 521
 // present list to user
522 522
 ?>
523
-<form action="<?php print( $form_action ); ?>" method="post">
523
+<form action="<?php print($form_action); ?>" method="post">
524 524
 
525 525
 
526 526
 <?php
527 527
 echo "<div>";
528
-print( getUITextForType($install_type) . " ". getUITextForMode($mode) . " ". $mod_strings['LBL_UW_SUCCESSFULLY']);
528
+print(getUITextForType($install_type)." ".getUITextForMode($mode)." ".$mod_strings['LBL_UW_SUCCESSFULLY']);
529 529
 echo "<br>";
530 530
 echo "<br>";
531
-print( "<input type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_MOD_LOADER']}\" /><br>" );
531
+print("<input type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_MOD_LOADER']}\" /><br>");
532 532
 echo "</div>";
533 533
 echo "<br>";
534
-if(isset($lang_changed_string))
534
+if (isset($lang_changed_string))
535 535
 	print($lang_changed_string);
536
-if ($install_type != "module" && $install_type != "langpack"){
537
-    if( sizeof( $files_to_handle ) > 0 ){
538
-        echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">' . SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']) . ' '.$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
539
-            <div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>' . SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']) .' '.$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>';
540
-        print( "{$mod_strings['LBL_UW_FOLLOWING_FILES']} $file_action:<br>\n" );
541
-        print( "<ul id=\"subMenu\">\n" );
542
-        foreach( $files_to_handle as $file_to_copy ){
543
-            print( "<li>$file_to_copy<br>\n" );
536
+if ($install_type != "module" && $install_type != "langpack") {
537
+    if (sizeof($files_to_handle) > 0) {
538
+        echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">'.SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']).' '.$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
539
+            <div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>' . SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']).' '.$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>';
540
+        print("{$mod_strings['LBL_UW_FOLLOWING_FILES']} $file_action:<br>\n");
541
+        print("<ul id=\"subMenu\">\n");
542
+        foreach ($files_to_handle as $file_to_copy) {
543
+            print("<li>$file_to_copy<br>\n");
544 544
         }
545
-        print( "</ul>\n" );
545
+        print("</ul>\n");
546 546
         echo '</div>';
547 547
     }
548
-    else if( $mode != 'Disable' && $mode !='Enable' ){
549
-        print( "{$mod_strings['LBL_UW_NO_FILES_SELECTED']} $file_action.<br>\n" );
548
+    else if ($mode != 'Disable' && $mode != 'Enable') {
549
+        print("{$mod_strings['LBL_UW_NO_FILES_SELECTED']} $file_action.<br>\n");
550 550
     }
551 551
 
552 552
         print($mod_strings['LBL_UW_UPGRADE_SUCCESSFUL']);
553
-        print( "<input class='button' type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_UW']}\" />\n" );
553
+        print("<input class='button' type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_UW']}\" />\n");
554 554
 }
555 555
 ?>
556 556
 </form>
557 557
 
558 558
 <?php
559
-    $GLOBALS['log']->info( "Upgrade Wizard patches" );
559
+    $GLOBALS['log']->info("Upgrade Wizard patches");
560 560
 ?>
Please login to merge, or discard this patch.
Braces   +37 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -157,14 +159,12 @@  discard block
 block discarded – undo
157 159
 if( $install_type != "module" ){
158 160
     if( !isset($_REQUEST['zip_from_dir']) || ($_REQUEST['zip_from_dir'] == "") ){
159 161
         $zip_from_dir     = ".";
160
-    }
161
-    else{
162
+    } else{
162 163
         $zip_from_dir   = $_REQUEST['zip_from_dir'];
163 164
     }
164 165
     if( !isset($_REQUEST['zip_to_dir']) || ($_REQUEST['zip_to_dir'] == "") ){
165 166
         $zip_to_dir     = ".";
166
-    }
167
-    else{
167
+    } else{
168 168
         $zip_to_dir     = $_REQUEST['zip_to_dir'];
169 169
     }
170 170
 }
@@ -250,10 +250,11 @@  discard block
 block discarded – undo
250 250
 
251 251
         $sugar_home_dir = getCwd();
252 252
         $dest_file  = clean_path( "$sugar_home_dir/$zip_to_dir/$file_to_copy" );
253
-        if($zip_to_dir != '.')
254
-        	$rest_file  = clean_path("$rest_dir/$zip_to_dir/$file_to_copy");
255
-        else
256
-        	$rest_file  = clean_path("$rest_dir/$file_to_copy");
253
+        if($zip_to_dir != '.') {
254
+                	$rest_file  = clean_path("$rest_dir/$zip_to_dir/$file_to_copy");
255
+        } else {
256
+                	$rest_file  = clean_path("$rest_dir/$file_to_copy");
257
+        }
257 258
 
258 259
         switch( $mode ){
259 260
             case "Install":
@@ -261,8 +262,9 @@  discard block
 block discarded – undo
261 262
 
262 263
                 if($install_type=="patch" && is_file($dest_file))
263 264
                 {
264
-	                if(!is_dir(dirname( $rest_file )))
265
-                		mkdir_recursive( dirname( $rest_file ) );
265
+	                if(!is_dir(dirname( $rest_file ))) {
266
+	                                		mkdir_recursive( dirname( $rest_file ) );
267
+	                }
266 268
 
267 269
 	                copy( $dest_file, $rest_file);
268 270
 	                sugar_touch( $rest_file, filemtime($dest_file) );
@@ -278,8 +280,7 @@  discard block
 block discarded – undo
278 280
                 {
279 281
 	                copy( $rest_file, $dest_file);
280 282
 	                sugar_touch( $dest_file, filemtime($rest_file) );
281
-                }
282
-                elseif(file_exists($dest_file) && !unlink($dest_file))
283
+                } elseif(file_exists($dest_file) && !unlink($dest_file))
283 284
                 {
284 285
                     die($mod_strings['ERR_UW_REMOVE_FAILED'].$dest_file);
285 286
                 }
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 
304 305
         if( $mode == "Install" || $mode=="Enable" ){
305 306
             $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] );
306
-        }
307
-        else if( $mode == "Uninstall" || $mode=="Disable" ){
307
+        } else if( $mode == "Uninstall" || $mode=="Disable" ){
308 308
             $new_langs = array();
309 309
             $old_langs = $sugar_config['languages'];
310 310
             foreach( $old_langs as $key => $value ){
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
             //here we can determine if this is an upgrade or a new version
342 342
             	if(!empty($previous_version)){
343 343
             		$mi->install( "$unzip_dir", true, $previous_version);
344
-            	}else{
344
+            	} else{
345 345
                 	$mi->install( "$unzip_dir" );
346 346
             	}
347 347
 
@@ -354,24 +354,27 @@  discard block
 block discarded – undo
354 354
 				}
355 355
             	break;
356 356
             case "Uninstall":
357
-                if($remove_tables == 'false')
358
-                	$GLOBALS['mi_remove_tables'] = false;
359
-                else
360
-                	$GLOBALS['mi_remove_tables'] = true;
357
+                if($remove_tables == 'false') {
358
+                                	$GLOBALS['mi_remove_tables'] = false;
359
+                } else {
360
+                                	$GLOBALS['mi_remove_tables'] = true;
361
+                }
361 362
                 $mi->uninstall( "$unzip_dir" );
362 363
                 break;
363 364
              case "Disable":
364
-                if(!$overwrite_files)
365
-                	$GLOBALS['mi_overwrite_files'] = false;
366
-                else
367
-                	$GLOBALS['mi_overwrite_files'] = true;
365
+                if(!$overwrite_files) {
366
+                                	$GLOBALS['mi_overwrite_files'] = false;
367
+                } else {
368
+                                	$GLOBALS['mi_overwrite_files'] = true;
369
+                }
368 370
                 $mi->disable( "$unzip_dir" );
369 371
                 break;
370 372
              case "Enable":
371
-                if(!$overwrite_files)
372
-                	$GLOBALS['mi_overwrite_files'] = false;
373
-                else
374
-                	$GLOBALS['mi_overwrite_files'] = true;
373
+                if(!$overwrite_files) {
374
+                                	$GLOBALS['mi_overwrite_files'] = false;
375
+                } else {
376
+                                	$GLOBALS['mi_overwrite_files'] = true;
377
+                }
375 378
                 $mi->enable( "$unzip_dir" );
376 379
                 break;
377 380
             default:
@@ -461,8 +464,9 @@  discard block
 block discarded – undo
461 464
         	if (!empty($manifest['post_install_url']))
462 465
         	{
463 466
         		$url_conf = $manifest['post_install_url'];
464
-        		if (is_string($url_conf))
465
-        			$url_conf = array('url' => $url_conf);
467
+        		if (is_string($url_conf)) {
468
+        		        			$url_conf = array('url' => $url_conf);
469
+        		}
466 470
         		if (isset($url_conf['type']) && $url_conf['type'] == 'popup')
467 471
         		{
468 472
         			echo '<script type="text/javascript">window.open("' . $url_conf['url']
@@ -531,8 +535,9 @@  discard block
 block discarded – undo
531 535
 print( "<input type=submit value=\"{$mod_strings['LBL_UW_BTN_BACK_TO_MOD_LOADER']}\" /><br>" );
532 536
 echo "</div>";
533 537
 echo "<br>";
534
-if(isset($lang_changed_string))
538
+if(isset($lang_changed_string)) {
535 539
 	print($lang_changed_string);
540
+}
536 541
 if ($install_type != "module" && $install_type != "langpack"){
537 542
     if( sizeof( $files_to_handle ) > 0 ){
538 543
         echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'this.style.display="none"; toggleDisplay("more");\' id="all_text">' . SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']) . ' '.$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
@@ -544,8 +549,7 @@  discard block
 block discarded – undo
544 549
         }
545 550
         print( "</ul>\n" );
546 551
         echo '</div>';
547
-    }
548
-    else if( $mode != 'Disable' && $mode !='Enable' ){
552
+    } else if( $mode != 'Disable' && $mode !='Enable' ){
549 553
         print( "{$mod_strings['LBL_UW_NO_FILES_SELECTED']} $file_action.<br>\n" );
550 554
     }
551 555
 
Please login to merge, or discard this patch.
modules/Administration/UpgradeWizard_prepare.php 4 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -92,22 +92,22 @@  discard block
 block discarded – undo
92 92
 
93 93
 unzip( $install_file, $unzip_dir );
94 94
 if($install_type == 'module' && $mode != 'Uninstall'){
95
-   if(file_exists($license_file)){
95
+    if(file_exists($license_file)){
96 96
         $require_license = true;
97
-   }
97
+    }
98 98
 }
99 99
 
100 100
 //Scan the unzip dir for unsafe files
101 101
 if (((defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN)
102 102
     || !empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) && $install_type != 'patch') {
103
-	require_once('ModuleInstall/ModuleScanner.php');
104
-	$ms = new ModuleScanner();
105
-	$ms->scanPackage($unzip_dir);
106
-	if($ms->hasIssues()){
107
-	    rmdir_recursive($unzip_dir);
108
-		$ms->displayIssues();
109
-		sugar_cleanup(true);
110
-	}
103
+    require_once('ModuleInstall/ModuleScanner.php');
104
+    $ms = new ModuleScanner();
105
+    $ms->scanPackage($unzip_dir);
106
+    if($ms->hasIssues()){
107
+        rmdir_recursive($unzip_dir);
108
+        $ms->displayIssues();
109
+        sugar_cleanup(true);
110
+    }
111 111
 }
112 112
 
113 113
 // assumption -- already validated manifest.php at time of upload
@@ -150,72 +150,72 @@  discard block
 block discarded – undo
150 150
 }
151 151
 
152 152
 if($remove_tables != 'prompt'){
153
-	$hidden_fields .= "<input type=hidden name=\"remove_tables\" value='".$remove_tables."'>";
153
+    $hidden_fields .= "<input type=hidden name=\"remove_tables\" value='".$remove_tables."'>";
154 154
 }
155 155
 if(file_exists($readme_file) || !empty($manifest['readme'])){
156 156
         $found_readme = true;
157
-   }
157
+    }
158 158
 $uh = new UpgradeHistory();
159 159
 //check dependencies first
160 160
 if(!empty($dependencies)){
161
-	$not_found = $uh->checkDependencies($dependencies);
162
-	if(!empty($not_found) && count($not_found) > 0){
163
-			die( $mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]");
164
-	}//fi
161
+    $not_found = $uh->checkDependencies($dependencies);
162
+    if(!empty($not_found) && count($not_found) > 0){
163
+            die( $mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]");
164
+    }//fi
165 165
 }
166 166
 switch( $install_type ){
167
-	case "full":
168
-	case "patch":
169
-		if( !is_writable( "config.php" ) ){
170
-			die( $mod_strings['ERR_UW_CONFIG'] );
171
-		}
172
-		break;
173
-	case "theme":
174
-		break;
175
-	case "langpack":
176
-		// find name of language pack: find single file in include/language/xx_xx.lang.php
177
-		$d = dir( "$unzip_dir/$zip_from_dir/include/language" );
178
-		while( $f = $d->read() ){
179
-			if( $f == "." || $f == ".." ){
180
-				continue;
181
-			}
182
-			else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
183
-				$new_lang_name = $match[1];
184
-			}
185
-		}
186
-		if( $new_lang_name == "" ){
187
-			die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file );
188
-		}
189
-		$hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>";
190
-
191
-		$new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" );
192
-		if( $new_lang_desc == "" ){
193
-			die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." );
194
-		}
195
-		$hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>";
196
-
197
-		if( !is_writable( "config.php" ) ){
198
-			die( $mod_strings['ERR_UW_CONFIG'] );
199
-		}
200
-		break;
201
-	case "module":
202
-		$previous_install = array();
203
-		if(!empty($id_name) & !empty($version))
204
-		$previous_install = $uh->determineIfUpgrade($id_name, $version);
205
-		$previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
206
-		$previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
207
-		$show_files = false;
208
-		//rrs pull out unique_key
209
-		$hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>";
210
-		$hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>";
211
-		$hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>";
212
-		$hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>";
213
-		$hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>";
214
-		$hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>";
215
-		$hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>";
216
-		break;
217
-	default:
218
-		die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type );
167
+    case "full":
168
+    case "patch":
169
+        if( !is_writable( "config.php" ) ){
170
+            die( $mod_strings['ERR_UW_CONFIG'] );
171
+        }
172
+        break;
173
+    case "theme":
174
+        break;
175
+    case "langpack":
176
+        // find name of language pack: find single file in include/language/xx_xx.lang.php
177
+        $d = dir( "$unzip_dir/$zip_from_dir/include/language" );
178
+        while( $f = $d->read() ){
179
+            if( $f == "." || $f == ".." ){
180
+                continue;
181
+            }
182
+            else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
183
+                $new_lang_name = $match[1];
184
+            }
185
+        }
186
+        if( $new_lang_name == "" ){
187
+            die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file );
188
+        }
189
+        $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>";
190
+
191
+        $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" );
192
+        if( $new_lang_desc == "" ){
193
+            die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." );
194
+        }
195
+        $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>";
196
+
197
+        if( !is_writable( "config.php" ) ){
198
+            die( $mod_strings['ERR_UW_CONFIG'] );
199
+        }
200
+        break;
201
+    case "module":
202
+        $previous_install = array();
203
+        if(!empty($id_name) & !empty($version))
204
+        $previous_install = $uh->determineIfUpgrade($id_name, $version);
205
+        $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
206
+        $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
207
+        $show_files = false;
208
+        //rrs pull out unique_key
209
+        $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>";
210
+        $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>";
211
+        $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>";
212
+        $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>";
213
+        $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>";
214
+        $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>";
215
+        $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>";
216
+        break;
217
+    default:
218
+        die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type );
219 219
 }
220 220
 
221 221
 
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 <form action="<?php print( $form_action . "_commit" ); ?>" name="files" method="post"  onSubmit="return validateForm(<?php print($require_license); ?>);">
232 232
 <?php
233 233
 if(empty($new_studio_mod_files)) {
234
-	if(!empty($mode) && $mode == 'Uninstall')
235
-	echo $mod_strings['LBL_UW_UNINSTALL_READY'];
236
-	else if($mode == 'Disable')
237
-	echo $mod_strings['LBL_UW_DISABLE_READY'];
238
-	else if($mode == 'Enable')
239
-	echo $mod_strings['LBL_UW_ENABLE_READY'];
240
-	else
241
-	echo $mod_strings['LBL_UW_PATCH_READY'];
234
+    if(!empty($mode) && $mode == 'Uninstall')
235
+    echo $mod_strings['LBL_UW_UNINSTALL_READY'];
236
+    else if($mode == 'Disable')
237
+    echo $mod_strings['LBL_UW_DISABLE_READY'];
238
+    else if($mode == 'Enable')
239
+    echo $mod_strings['LBL_UW_ENABLE_READY'];
240
+    else
241
+    echo $mod_strings['LBL_UW_PATCH_READY'];
242 242
 } else {
243
-	echo $mod_strings['LBL_UW_PATCH_READY2'];
244
-	echo '<input type="checkbox" onclick="toggle_these(0, ' . count($new_studio_mod_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
245
-	foreach($new_studio_mod_files as $the_file) {
246
-		$new_file   = clean_path( "$zip_to_dir/$the_file" );
247
-		print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\"> " . $new_file . "</li>");
248
-		$count++;
249
-	}
243
+    echo $mod_strings['LBL_UW_PATCH_READY2'];
244
+    echo '<input type="checkbox" onclick="toggle_these(0, ' . count($new_studio_mod_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
245
+    foreach($new_studio_mod_files as $the_file) {
246
+        $new_file   = clean_path( "$zip_to_dir/$the_file" );
247
+        print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\"> " . $new_file . "</li>");
248
+        $count++;
249
+    }
250 250
 }
251 251
 echo '<br>';
252 252
 if($require_license){
253 253
     $contents = sugar_file_get_contents($license_file);
254
-	$readme_contents = '';
255
-	if($found_readme){
256
-		if(file_exists($readme_file) && filesize($readme_file) > 0){
257
-			$readme_contents = file_get_contents($readme_file);
258
-		}elseif(!empty($manifest['readme'])){
259
-			$readme_contents = $manifest['readme'];
260
-		}
261
-	}
262
-	$license_final =<<<eoq2
254
+    $readme_contents = '';
255
+    if($found_readme){
256
+        if(file_exists($readme_file) && filesize($readme_file) > 0){
257
+            $readme_contents = file_get_contents($readme_file);
258
+        }elseif(!empty($manifest['readme'])){
259
+            $readme_contents = $manifest['readme'];
260
+        }
261
+    }
262
+    $license_final =<<<eoq2
263 263
 	<table width='100%'>
264 264
 	<tr>
265 265
 	<td colspan="3"><ul class="tablist">
@@ -312,38 +312,38 @@  discard block
 block discarded – undo
312 312
 </div>
313 313
 
314 314
 eoq2;
315
-	echo $license_final;
316
-	echo "<br>";
315
+    echo $license_final;
316
+    echo "<br>";
317 317
 }
318 318
 
319 319
 switch( $mode ){
320
-	case "Install":
321
-		if( $install_type == "langpack") {
322
-			print( $mod_strings['LBL_UW_LANGPACK_READY'] );
323
-			echo '<br><br>';
324
-		}
325
-		break;
326
-	case "Uninstall":
327
-		if( $install_type == "langpack" ){
328
-			print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
329
-			echo '<br><br>';
330
-		}
331
-		else if($install_type != "module"){
332
-			print( $mod_strings['LBL_UW_FILES_REMOVED'] );
333
-		}
334
-		break;
335
-	case "Disable":
336
-		if( $install_type == "langpack" ){
337
-			print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] );
338
-			echo '<br><br>';
339
-		}
340
-		break;
341
-	case "Enable":
342
-		if( $install_type == "langpack" ){
343
-			print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] );
344
-			echo '<br><br>';
345
-		}
346
-		break;
320
+    case "Install":
321
+        if( $install_type == "langpack") {
322
+            print( $mod_strings['LBL_UW_LANGPACK_READY'] );
323
+            echo '<br><br>';
324
+        }
325
+        break;
326
+    case "Uninstall":
327
+        if( $install_type == "langpack" ){
328
+            print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
329
+            echo '<br><br>';
330
+        }
331
+        else if($install_type != "module"){
332
+            print( $mod_strings['LBL_UW_FILES_REMOVED'] );
333
+        }
334
+        break;
335
+    case "Disable":
336
+        if( $install_type == "langpack" ){
337
+            print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] );
338
+            echo '<br><br>';
339
+        }
340
+        break;
341
+    case "Enable":
342
+        if( $install_type == "langpack" ){
343
+            print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] );
344
+            echo '<br><br>';
345
+        }
346
+        break;
347 347
 }
348 348
 
349 349
 
@@ -355,27 +355,27 @@  discard block
 block discarded – undo
355 355
 
356 356
 if($remove_tables == 'prompt' && $mode == 'Uninstall'){
357 357
     print ("<br/><br/>");
358
-	print ("<input type='radio' id='remove_tables_true' name='remove_tables' value='true' checked>".$mod_strings['ML_LBL_REMOVE_TABLES']."&nbsp;");
358
+    print ("<input type='radio' id='remove_tables_true' name='remove_tables' value='true' checked>".$mod_strings['ML_LBL_REMOVE_TABLES']."&nbsp;");
359 359
     print ("<input type='radio' id='remove_tables_false' name='remove_tables' value='false'>".$mod_strings['ML_LBL_DO_NOT_REMOVE_TABLES']."<br>");
360 360
 }
361 361
 $count = 0;
362 362
 
363 363
 if( $show_files == true ){
364
-	$count = 0;
364
+    $count = 0;
365 365
 
366
-	$new_studio_mod_files = array();
367
-	$new_sugar_mod_files = array();
366
+    $new_studio_mod_files = array();
367
+    $new_sugar_mod_files = array();
368 368
 
369
-	$cache_html_files = findAllFilesRelative( sugar_cached("layout"), array());
369
+    $cache_html_files = findAllFilesRelative( sugar_cached("layout"), array());
370 370
 
371
-	foreach($new_files as $the_file) {
372
-		if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files))
373
-		array_push($new_studio_mod_files, $the_file);
374
-		else
375
-		array_push($new_sugar_mod_files, $the_file);
376
-	}
371
+    foreach($new_files as $the_file) {
372
+        if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files))
373
+        array_push($new_studio_mod_files, $the_file);
374
+        else
375
+        array_push($new_sugar_mod_files, $the_file);
376
+    }
377 377
 
378
-	echo '<script>
378
+    echo '<script>
379 379
             function toggle_these(start, end, ca) {
380 380
               while(start < end) {
381 381
                 elem = eval("document.forms.files.copy_" + start);
@@ -388,106 +388,106 @@  discard block
 block discarded – undo
388 388
 
389 389
 
390 390
 
391
-	global $theme;
391
+    global $theme;
392 392
 
393
-	echo '<br/><br/>';
393
+    echo '<br/><br/>';
394 394
 
395 395
     echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;'.(($mode == 'Enable' || $mode == 'Disable')?'display:none;':'').'" onclick=\'this.style.display="none"; toggleDisplay("more");\'id="all_text">
396 396
         '.SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']).$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
397 397
               <div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>'
398
-         .SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']).$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>';
398
+            .SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']).$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>';
399 399
     echo '<input type="checkbox" checked onclick="toggle_these(' . count($new_studio_mod_files) . ',' . count($new_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
400
-	echo '<ul>';
401
-	foreach( $new_sugar_mod_files as $the_file ){
402
-		$highlight_start    = "";
403
-		$highlight_end      = "";
404
-		$checked            = "";
405
-		$disabled           = "";
406
-		$unzip_file = "$unzip_dir/$zip_from_dir/$the_file";
407
-		$new_file   = clean_path( "$zip_to_dir/$the_file" );
408
-		$forced_copy    = false;
409
-
410
-		if( $mode == "Install" ){
411
-			$checked = "checked";
412
-			foreach( $zip_force_copy as $pattern ){
413
-				if( preg_match("#" . $pattern . "#", $unzip_file) ){
414
-					$disabled = "disabled=\"true\"";
415
-					$forced_copy = true;
416
-				}
417
-			}
418
-			if( !$forced_copy && is_file( $new_file ) && (md5_file( $unzip_file ) == md5_file( $new_file )) ){
419
-				$disabled = "disabled=\"true\"";
420
-				//$checked = "";
421
-			}
422
-			if( $checked != "" && $disabled != "" ){    // need to put a hidden field
423
-				print( "<input name=\"copy_$count\" type=\"hidden\" value=\"" . $the_file . "\">\n" );
424
-			}
425
-			print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end );
426
-			if( $checked == "" && $disabled != "" ){    // need to explain this file hasn't changed
427
-				print( " (no changes)" );
428
-			}
429
-			print( "<br>\n" );
430
-		}
431
-		else if( $mode == "Uninstall" && file_exists( $new_file ) ){
432
-			if( md5_file( $unzip_file ) == md5_file( $new_file ) ){
433
-				$checked = "checked=\"true\"";
434
-			}
435
-			else{
436
-				$highlight_start    = "<font color=red>";
437
-				$highlight_end      = "</font>";
438
-			}
439
-			print( "<li><input name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end . "<br>\n" );
440
-		}
441
-		$count++;
442
-	}
400
+    echo '<ul>';
401
+    foreach( $new_sugar_mod_files as $the_file ){
402
+        $highlight_start    = "";
403
+        $highlight_end      = "";
404
+        $checked            = "";
405
+        $disabled           = "";
406
+        $unzip_file = "$unzip_dir/$zip_from_dir/$the_file";
407
+        $new_file   = clean_path( "$zip_to_dir/$the_file" );
408
+        $forced_copy    = false;
409
+
410
+        if( $mode == "Install" ){
411
+            $checked = "checked";
412
+            foreach( $zip_force_copy as $pattern ){
413
+                if( preg_match("#" . $pattern . "#", $unzip_file) ){
414
+                    $disabled = "disabled=\"true\"";
415
+                    $forced_copy = true;
416
+                }
417
+            }
418
+            if( !$forced_copy && is_file( $new_file ) && (md5_file( $unzip_file ) == md5_file( $new_file )) ){
419
+                $disabled = "disabled=\"true\"";
420
+                //$checked = "";
421
+            }
422
+            if( $checked != "" && $disabled != "" ){    // need to put a hidden field
423
+                print( "<input name=\"copy_$count\" type=\"hidden\" value=\"" . $the_file . "\">\n" );
424
+            }
425
+            print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end );
426
+            if( $checked == "" && $disabled != "" ){    // need to explain this file hasn't changed
427
+                print( " (no changes)" );
428
+            }
429
+            print( "<br>\n" );
430
+        }
431
+        else if( $mode == "Uninstall" && file_exists( $new_file ) ){
432
+            if( md5_file( $unzip_file ) == md5_file( $new_file ) ){
433
+                $checked = "checked=\"true\"";
434
+            }
435
+            else{
436
+                $highlight_start    = "<font color=red>";
437
+                $highlight_end      = "</font>";
438
+            }
439
+            print( "<li><input name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end . "<br>\n" );
440
+        }
441
+        $count++;
442
+    }
443 443
         print( "</ul>\n" );
444 444
 }
445 445
 //    echo '</div>';
446 446
 if($mode == "Disable" || $mode == "Enable"){
447
-	//check to see if any files have been modified
448
-	$modified_files = getDiffFiles($unzip_dir, $install_file, ($mode == 'Enable'), $previous_version);
449
-	if(count($modified_files) > 0){
450
-		//we need to tell the user that some files have been modified since they last did an install
451
-		echo '<script>' .
447
+    //check to see if any files have been modified
448
+    $modified_files = getDiffFiles($unzip_dir, $install_file, ($mode == 'Enable'), $previous_version);
449
+    if(count($modified_files) > 0){
450
+        //we need to tell the user that some files have been modified since they last did an install
451
+        echo '<script>' .
452 452
                 'function handleFileChange(){';
453
-		if(count($modified_files) > 0){
454
-			echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){
453
+        if(count($modified_files) > 0){
454
+            echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){
455 455
                 			var overwrite = false;
456 456
                 			if(document.getElementById("radio_overwrite_files").checked){
457 457
                    			 overwrite = true
458 458
                 			}
459 459
             			}
460 460
         				return true;';
461
-		}else{
462
-			echo 'return true;';
463
-		}
464
-		echo '}</script>';
465
-		print('<b>'.$mod_strings['ML_LBL_OVERWRITE_FILES'].'</b>');
466
-		print('<table><td align="left" valign="top" colspan=2>');
467
-		print("<input type='radio' id='radio_overwrite_files' name='radio_overwrite' value='overwrite'>{$mod_strings['LBL_OVERWRITE_FILES']}&nbsp;");
468
-		print("<input type='radio' id='radio_do_not_overwrite_files' name='radio_overwrite' value='do_not_overwrite' checked>{$mod_strings['LBL_DO_OVERWRITE_FILES']}");
469
-		print("</td></tr></table>");
470
-		print('<ul>');
471
-		foreach($modified_files as $modified_file){
472
-			print('<li>'.$modified_file.'</li>');
473
-		}
474
-		print('</ul>');
475
-	}else{
476
-		echo '<script>' .
477
-	        'function handleFileChange(){';
478
-		echo 'return true;';
479
-		echo '}</script>';
480
-	}
461
+        }else{
462
+            echo 'return true;';
463
+        }
464
+        echo '}</script>';
465
+        print('<b>'.$mod_strings['ML_LBL_OVERWRITE_FILES'].'</b>');
466
+        print('<table><td align="left" valign="top" colspan=2>');
467
+        print("<input type='radio' id='radio_overwrite_files' name='radio_overwrite' value='overwrite'>{$mod_strings['LBL_OVERWRITE_FILES']}&nbsp;");
468
+        print("<input type='radio' id='radio_do_not_overwrite_files' name='radio_overwrite' value='do_not_overwrite' checked>{$mod_strings['LBL_DO_OVERWRITE_FILES']}");
469
+        print("</td></tr></table>");
470
+        print('<ul>');
471
+        foreach($modified_files as $modified_file){
472
+            print('<li>'.$modified_file.'</li>');
473
+        }
474
+        print('</ul>');
475
+    }else{
476
+        echo '<script>' .
477
+            'function handleFileChange(){';
478
+        echo 'return true;';
479
+        echo '}</script>';
480
+    }
481 481
 }else{
482
-	echo '<script>' .
482
+    echo '<script>' .
483 483
         'function handleFileChange(){';
484
-	echo 'return true;';
485
-	echo '}</script>';
484
+    echo 'return true;';
485
+    echo '}</script>';
486 486
 }
487 487
 echo '<script>' .
488
-         		'function validateForm(process){'.
489
-         			'return (handleCommit(process) && handleFileChange());'.
490
-         		'}'.
488
+                    'function validateForm(process){'.
489
+                        'return (handleCommit(process) && handleFileChange());'.
490
+                    '}'.
491 491
                 'function handleCommit(process){
492 492
         if(process == 1) {
493 493
             if(document.getElementById("radio_license_agreement_reject") != null && document.getElementById("radio_license_agreement_accept") != null){
Please login to merge, or discard this patch.
Switch Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -164,58 +164,58 @@  discard block
 block discarded – undo
164 164
 	}//fi
165 165
 }
166 166
 switch( $install_type ){
167
-	case "full":
168
-	case "patch":
169
-		if( !is_writable( "config.php" ) ){
170
-			die( $mod_strings['ERR_UW_CONFIG'] );
171
-		}
172
-		break;
173
-	case "theme":
174
-		break;
175
-	case "langpack":
176
-		// find name of language pack: find single file in include/language/xx_xx.lang.php
177
-		$d = dir( "$unzip_dir/$zip_from_dir/include/language" );
178
-		while( $f = $d->read() ){
179
-			if( $f == "." || $f == ".." ){
180
-				continue;
181
-			}
182
-			else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
183
-				$new_lang_name = $match[1];
184
-			}
185
-		}
186
-		if( $new_lang_name == "" ){
187
-			die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file );
188
-		}
189
-		$hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>";
190
-
191
-		$new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" );
192
-		if( $new_lang_desc == "" ){
193
-			die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." );
194
-		}
195
-		$hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>";
196
-
197
-		if( !is_writable( "config.php" ) ){
198
-			die( $mod_strings['ERR_UW_CONFIG'] );
199
-		}
200
-		break;
201
-	case "module":
202
-		$previous_install = array();
203
-		if(!empty($id_name) & !empty($version))
204
-		$previous_install = $uh->determineIfUpgrade($id_name, $version);
205
-		$previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
206
-		$previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
207
-		$show_files = false;
208
-		//rrs pull out unique_key
209
-		$hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>";
210
-		$hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>";
211
-		$hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>";
212
-		$hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>";
213
-		$hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>";
214
-		$hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>";
215
-		$hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>";
216
-		break;
217
-	default:
218
-		die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type );
167
+	    case "full":
168
+	    case "patch":
169
+		    if( !is_writable( "config.php" ) ){
170
+			    die( $mod_strings['ERR_UW_CONFIG'] );
171
+		    }
172
+		    break;
173
+	    case "theme":
174
+		    break;
175
+	    case "langpack":
176
+		    // find name of language pack: find single file in include/language/xx_xx.lang.php
177
+		    $d = dir( "$unzip_dir/$zip_from_dir/include/language" );
178
+		    while( $f = $d->read() ){
179
+			    if( $f == "." || $f == ".." ){
180
+				    continue;
181
+			    }
182
+			    else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
183
+				    $new_lang_name = $match[1];
184
+			    }
185
+		    }
186
+		    if( $new_lang_name == "" ){
187
+			    die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file );
188
+		    }
189
+		    $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>";
190
+
191
+		    $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" );
192
+		    if( $new_lang_desc == "" ){
193
+			    die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." );
194
+		    }
195
+		    $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>";
196
+
197
+		    if( !is_writable( "config.php" ) ){
198
+			    die( $mod_strings['ERR_UW_CONFIG'] );
199
+		    }
200
+		    break;
201
+	    case "module":
202
+		    $previous_install = array();
203
+		    if(!empty($id_name) & !empty($version))
204
+		    $previous_install = $uh->determineIfUpgrade($id_name, $version);
205
+		    $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
206
+		    $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
207
+		    $show_files = false;
208
+		    //rrs pull out unique_key
209
+		    $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>";
210
+		    $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>";
211
+		    $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>";
212
+		    $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>";
213
+		    $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>";
214
+		    $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>";
215
+		    $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>";
216
+		    break;
217
+	    default:
218
+		    die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type );
219 219
 }
220 220
 
221 221
 
@@ -317,33 +317,33 @@  discard block
 block discarded – undo
317 317
 }
318 318
 
319 319
 switch( $mode ){
320
-	case "Install":
321
-		if( $install_type == "langpack") {
322
-			print( $mod_strings['LBL_UW_LANGPACK_READY'] );
323
-			echo '<br><br>';
324
-		}
325
-		break;
326
-	case "Uninstall":
327
-		if( $install_type == "langpack" ){
328
-			print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
329
-			echo '<br><br>';
330
-		}
331
-		else if($install_type != "module"){
332
-			print( $mod_strings['LBL_UW_FILES_REMOVED'] );
333
-		}
334
-		break;
335
-	case "Disable":
336
-		if( $install_type == "langpack" ){
337
-			print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] );
338
-			echo '<br><br>';
339
-		}
340
-		break;
341
-	case "Enable":
342
-		if( $install_type == "langpack" ){
343
-			print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] );
344
-			echo '<br><br>';
345
-		}
346
-		break;
320
+	    case "Install":
321
+		    if( $install_type == "langpack") {
322
+			    print( $mod_strings['LBL_UW_LANGPACK_READY'] );
323
+			    echo '<br><br>';
324
+		    }
325
+		    break;
326
+	    case "Uninstall":
327
+		    if( $install_type == "langpack" ){
328
+			    print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
329
+			    echo '<br><br>';
330
+		    }
331
+		    else if($install_type != "module"){
332
+			    print( $mod_strings['LBL_UW_FILES_REMOVED'] );
333
+		    }
334
+		    break;
335
+	    case "Disable":
336
+		    if( $install_type == "langpack" ){
337
+			    print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] );
338
+			    echo '<br><br>';
339
+		    }
340
+		    break;
341
+	    case "Enable":
342
+		    if( $install_type == "langpack" ){
343
+			    print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] );
344
+			    echo '<br><br>';
345
+		    }
346
+		    break;
347 347
 }
348 348
 
349 349
 
Please login to merge, or discard this patch.
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 unset($_SESSION['rebuild_relationships']);
49 49
 unset($_SESSION['rebuild_extensions']);
50 50
 // process commands
51
-if(empty($_REQUEST['install_file'])){
52
-    die( "File to install not specified." );
51
+if (empty($_REQUEST['install_file'])) {
52
+    die("File to install not specified.");
53 53
 }
54
-if( !isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "") ){
55
-    die( "No mode specified." );
54
+if (!isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "")) {
55
+    die("No mode specified.");
56 56
 }
57 57
 
58
-if(!file_exists($base_tmp_upgrade_dir)) {
58
+if (!file_exists($base_tmp_upgrade_dir)) {
59 59
     mkdir($base_tmp_upgrade_dir, 0755, true);
60 60
 }
61 61
 
62
-$unzip_dir      = mk_temp_dir( $base_tmp_upgrade_dir );
62
+$unzip_dir      = mk_temp_dir($base_tmp_upgrade_dir);
63 63
 $install_file   = hashToFile($_REQUEST['install_file']);
64 64
 $hidden_fields = "";
65 65
 $new_lang_name = "";
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 $hidden_fields .= "<input type=hidden name=\"mode\" value=\"$mode\"/>";
70 70
 
71 71
 
72
-$install_type   = getInstallType( $install_file );
72
+$install_type   = getInstallType($install_file);
73 73
 
74 74
 $version        = "";
75 75
 $previous_version = "";
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 $dependencies = array();
91 91
 $remove_tables = 'true';
92 92
 
93
-unzip( $install_file, $unzip_dir );
94
-if($install_type == 'module' && $mode != 'Uninstall'){
95
-   if(file_exists($license_file)){
93
+unzip($install_file, $unzip_dir);
94
+if ($install_type == 'module' && $mode != 'Uninstall') {
95
+   if (file_exists($license_file)) {
96 96
         $require_license = true;
97 97
    }
98 98
 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	require_once('ModuleInstall/ModuleScanner.php');
104 104
 	$ms = new ModuleScanner();
105 105
 	$ms->scanPackage($unzip_dir);
106
-	if($ms->hasIssues()){
106
+	if ($ms->hasIssues()) {
107 107
 	    rmdir_recursive($unzip_dir);
108 108
 		$ms->displayIssues();
109 109
 		sugar_cleanup(true);
@@ -111,96 +111,96 @@  discard block
 block discarded – undo
111 111
 }
112 112
 
113 113
 // assumption -- already validated manifest.php at time of upload
114
-require( "$unzip_dir/manifest.php" );
114
+require("$unzip_dir/manifest.php");
115 115
 
116 116
 
117 117
 
118
-if( isset( $manifest['copy_files']['from_dir'] ) && $manifest['copy_files']['from_dir'] != "" ){
118
+if (isset($manifest['copy_files']['from_dir']) && $manifest['copy_files']['from_dir'] != "") {
119 119
     $zip_from_dir   = $manifest['copy_files']['from_dir'];
120 120
 }
121
-if( isset( $manifest['copy_files']['to_dir'] ) && $manifest['copy_files']['to_dir'] != "" ){
121
+if (isset($manifest['copy_files']['to_dir']) && $manifest['copy_files']['to_dir'] != "") {
122 122
     $zip_to_dir     = $manifest['copy_files']['to_dir'];
123 123
 }
124
-if( isset( $manifest['copy_files']['force_copy'] ) && $manifest['copy_files']['force_copy'] != "" ){
125
-    $zip_force_copy     = $manifest['copy_files']['force_copy'];
124
+if (isset($manifest['copy_files']['force_copy']) && $manifest['copy_files']['force_copy'] != "") {
125
+    $zip_force_copy = $manifest['copy_files']['force_copy'];
126 126
 }
127
-if( isset( $manifest['version'] ) ){
128
-    $version    = $manifest['version'];
127
+if (isset($manifest['version'])) {
128
+    $version = $manifest['version'];
129 129
 }
130
-if( isset( $manifest['author'] ) ){
131
-    $author    = $manifest['author'];
130
+if (isset($manifest['author'])) {
131
+    $author = $manifest['author'];
132 132
 }
133
-if( isset( $manifest['name'] ) ){
134
-    $name    = $manifest['name'];
133
+if (isset($manifest['name'])) {
134
+    $name = $manifest['name'];
135 135
 }
136
-if( isset( $manifest['description'] ) ){
137
-    $description    = $manifest['description'];
136
+if (isset($manifest['description'])) {
137
+    $description = $manifest['description'];
138 138
 }
139
-if( isset( $manifest['is_uninstallable'] ) ){
140
-    $is_uninstallable    = $manifest['is_uninstallable'];
139
+if (isset($manifest['is_uninstallable'])) {
140
+    $is_uninstallable = $manifest['is_uninstallable'];
141 141
 }
142
-if(isset($installdefs) && isset( $installdefs['id'] ) ){
143
-    $id_name    = $installdefs['id'];
142
+if (isset($installdefs) && isset($installdefs['id'])) {
143
+    $id_name = $installdefs['id'];
144 144
 }
145
-if( isset( $manifest['dependencies']) ){
146
-    $dependencies    = $manifest['dependencies'];
145
+if (isset($manifest['dependencies'])) {
146
+    $dependencies = $manifest['dependencies'];
147 147
 }
148
-if( isset( $manifest['remove_tables']) ){
148
+if (isset($manifest['remove_tables'])) {
149 149
     $remove_tables = $manifest['remove_tables'];
150 150
 }
151 151
 
152
-if($remove_tables != 'prompt'){
152
+if ($remove_tables != 'prompt') {
153 153
 	$hidden_fields .= "<input type=hidden name=\"remove_tables\" value='".$remove_tables."'>";
154 154
 }
155
-if(file_exists($readme_file) || !empty($manifest['readme'])){
155
+if (file_exists($readme_file) || !empty($manifest['readme'])) {
156 156
         $found_readme = true;
157 157
    }
158 158
 $uh = new UpgradeHistory();
159 159
 //check dependencies first
160
-if(!empty($dependencies)){
160
+if (!empty($dependencies)) {
161 161
 	$not_found = $uh->checkDependencies($dependencies);
162
-	if(!empty($not_found) && count($not_found) > 0){
163
-			die( $mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]");
162
+	if (!empty($not_found) && count($not_found) > 0) {
163
+			die($mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]");
164 164
 	}//fi
165 165
 }
166
-switch( $install_type ){
166
+switch ($install_type) {
167 167
 	case "full":
168 168
 	case "patch":
169
-		if( !is_writable( "config.php" ) ){
170
-			die( $mod_strings['ERR_UW_CONFIG'] );
169
+		if (!is_writable("config.php")) {
170
+			die($mod_strings['ERR_UW_CONFIG']);
171 171
 		}
172 172
 		break;
173 173
 	case "theme":
174 174
 		break;
175 175
 	case "langpack":
176 176
 		// find name of language pack: find single file in include/language/xx_xx.lang.php
177
-		$d = dir( "$unzip_dir/$zip_from_dir/include/language" );
178
-		while( $f = $d->read() ){
179
-			if( $f == "." || $f == ".." ){
177
+		$d = dir("$unzip_dir/$zip_from_dir/include/language");
178
+		while ($f = $d->read()) {
179
+			if ($f == "." || $f == "..") {
180 180
 				continue;
181 181
 			}
182
-			else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
182
+			else if (preg_match("/(.*)\.lang\.php\$/", $f, $match)) {
183 183
 				$new_lang_name = $match[1];
184 184
 			}
185 185
 		}
186
-		if( $new_lang_name == "" ){
187
-			die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file );
186
+		if ($new_lang_name == "") {
187
+			die($mod_strings['ERR_UW_NO_LANGPACK'].$install_file);
188 188
 		}
189 189
 		$hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>";
190 190
 
191
-		$new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" );
192
-		if( $new_lang_desc == "" ){
193
-			die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." );
191
+		$new_lang_desc = getLanguagePackName("$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php");
192
+		if ($new_lang_desc == "") {
193
+			die($mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file.");
194 194
 		}
195 195
 		$hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>";
196 196
 
197
-		if( !is_writable( "config.php" ) ){
198
-			die( $mod_strings['ERR_UW_CONFIG'] );
197
+		if (!is_writable("config.php")) {
198
+			die($mod_strings['ERR_UW_CONFIG']);
199 199
 		}
200 200
 		break;
201 201
 	case "module":
202 202
 		$previous_install = array();
203
-		if(!empty($id_name) & !empty($version))
203
+		if (!empty($id_name) & !empty($version))
204 204
 		$previous_install = $uh->determineIfUpgrade($id_name, $version);
205 205
 		$previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
206 206
 		$previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 		$hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>";
216 216
 		break;
217 217
 	default:
218
-		die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type );
218
+		die($mod_strings['ERR_UW_WRONG_TYPE'].$install_type);
219 219
 }
220 220
 
221 221
 
222
-$new_files      = findAllFilesRelative( "$unzip_dir/$zip_from_dir", array() );
222
+$new_files      = findAllFilesRelative("$unzip_dir/$zip_from_dir", array());
223 223
 $hidden_fields .= "<input type=hidden name=\"version\" value=\"$version\"/>";
224 224
 $serial_manifest = array();
225 225
 $serial_manifest['manifest'] = (isset($manifest) ? $manifest : '');
@@ -228,38 +228,38 @@  discard block
 block discarded – undo
228 228
 $hidden_fields .= "<input type=hidden name=\"s_manifest\" value='".base64_encode(serialize($serial_manifest))."'>";
229 229
 // present list to user
230 230
 ?>
231
-<form action="<?php print( $form_action . "_commit" ); ?>" name="files" method="post"  onSubmit="return validateForm(<?php print($require_license); ?>);">
231
+<form action="<?php print($form_action."_commit"); ?>" name="files" method="post"  onSubmit="return validateForm(<?php print($require_license); ?>);">
232 232
 <?php
233
-if(empty($new_studio_mod_files)) {
234
-	if(!empty($mode) && $mode == 'Uninstall')
233
+if (empty($new_studio_mod_files)) {
234
+	if (!empty($mode) && $mode == 'Uninstall')
235 235
 	echo $mod_strings['LBL_UW_UNINSTALL_READY'];
236
-	else if($mode == 'Disable')
236
+	else if ($mode == 'Disable')
237 237
 	echo $mod_strings['LBL_UW_DISABLE_READY'];
238
-	else if($mode == 'Enable')
238
+	else if ($mode == 'Enable')
239 239
 	echo $mod_strings['LBL_UW_ENABLE_READY'];
240 240
 	else
241 241
 	echo $mod_strings['LBL_UW_PATCH_READY'];
242 242
 } else {
243 243
 	echo $mod_strings['LBL_UW_PATCH_READY2'];
244
-	echo '<input type="checkbox" onclick="toggle_these(0, ' . count($new_studio_mod_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
245
-	foreach($new_studio_mod_files as $the_file) {
246
-		$new_file   = clean_path( "$zip_to_dir/$the_file" );
247
-		print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\"> " . $new_file . "</li>");
244
+	echo '<input type="checkbox" onclick="toggle_these(0, '.count($new_studio_mod_files).', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
245
+	foreach ($new_studio_mod_files as $the_file) {
246
+		$new_file = clean_path("$zip_to_dir/$the_file");
247
+		print("<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"".$the_file."\"> ".$new_file."</li>");
248 248
 		$count++;
249 249
 	}
250 250
 }
251 251
 echo '<br>';
252
-if($require_license){
252
+if ($require_license) {
253 253
     $contents = sugar_file_get_contents($license_file);
254 254
 	$readme_contents = '';
255
-	if($found_readme){
256
-		if(file_exists($readme_file) && filesize($readme_file) > 0){
255
+	if ($found_readme) {
256
+		if (file_exists($readme_file) && filesize($readme_file) > 0) {
257 257
 			$readme_contents = file_get_contents($readme_file);
258
-		}elseif(!empty($manifest['readme'])){
258
+		}elseif (!empty($manifest['readme'])) {
259 259
 			$readme_contents = $manifest['readme'];
260 260
 		}
261 261
 	}
262
-	$license_final =<<<eoq2
262
+	$license_final = <<<eoq2
263 263
 	<table width='100%'>
264 264
 	<tr>
265 265
 	<td colspan="3"><ul class="tablist">
@@ -316,31 +316,31 @@  discard block
 block discarded – undo
316 316
 	echo "<br>";
317 317
 }
318 318
 
319
-switch( $mode ){
319
+switch ($mode) {
320 320
 	case "Install":
321
-		if( $install_type == "langpack") {
322
-			print( $mod_strings['LBL_UW_LANGPACK_READY'] );
321
+		if ($install_type == "langpack") {
322
+			print($mod_strings['LBL_UW_LANGPACK_READY']);
323 323
 			echo '<br><br>';
324 324
 		}
325 325
 		break;
326 326
 	case "Uninstall":
327
-		if( $install_type == "langpack" ){
328
-			print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
327
+		if ($install_type == "langpack") {
328
+			print($mod_strings['LBL_UW_LANGPACK_READY_UNISTALL']);
329 329
 			echo '<br><br>';
330 330
 		}
331
-		else if($install_type != "module"){
332
-			print( $mod_strings['LBL_UW_FILES_REMOVED'] );
331
+		else if ($install_type != "module") {
332
+			print($mod_strings['LBL_UW_FILES_REMOVED']);
333 333
 		}
334 334
 		break;
335 335
 	case "Disable":
336
-		if( $install_type == "langpack" ){
337
-			print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] );
336
+		if ($install_type == "langpack") {
337
+			print($mod_strings['LBL_UW_LANGPACK_READY_DISABLE']);
338 338
 			echo '<br><br>';
339 339
 		}
340 340
 		break;
341 341
 	case "Enable":
342
-		if( $install_type == "langpack" ){
343
-			print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] );
342
+		if ($install_type == "langpack") {
343
+			print($mod_strings['LBL_UW_LANGPACK_READY_ENABLE']);
344 344
 			echo '<br><br>';
345 345
 		}
346 346
 		break;
@@ -348,28 +348,28 @@  discard block
 block discarded – undo
348 348
 
349 349
 
350 350
 ?>
351
-<input type=submit value="<?php echo $mod_strings['LBL_ML_COMMIT'];?>" class="button" id="submit_button" />
352
-<input type=button value="<?php echo $mod_strings['LBL_ML_CANCEL'];?>" class="button" onClick="location.href='index.php?module=Administration&action=UpgradeWizard&view=module';"/>
351
+<input type=submit value="<?php echo $mod_strings['LBL_ML_COMMIT']; ?>" class="button" id="submit_button" />
352
+<input type=button value="<?php echo $mod_strings['LBL_ML_CANCEL']; ?>" class="button" onClick="location.href='index.php?module=Administration&action=UpgradeWizard&view=module';"/>
353 353
 
354 354
 <?php
355 355
 
356
-if($remove_tables == 'prompt' && $mode == 'Uninstall'){
356
+if ($remove_tables == 'prompt' && $mode == 'Uninstall') {
357 357
     print ("<br/><br/>");
358 358
 	print ("<input type='radio' id='remove_tables_true' name='remove_tables' value='true' checked>".$mod_strings['ML_LBL_REMOVE_TABLES']."&nbsp;");
359 359
     print ("<input type='radio' id='remove_tables_false' name='remove_tables' value='false'>".$mod_strings['ML_LBL_DO_NOT_REMOVE_TABLES']."<br>");
360 360
 }
361 361
 $count = 0;
362 362
 
363
-if( $show_files == true ){
363
+if ($show_files == true) {
364 364
 	$count = 0;
365 365
 
366 366
 	$new_studio_mod_files = array();
367 367
 	$new_sugar_mod_files = array();
368 368
 
369
-	$cache_html_files = findAllFilesRelative( sugar_cached("layout"), array());
369
+	$cache_html_files = findAllFilesRelative(sugar_cached("layout"), array());
370 370
 
371
-	foreach($new_files as $the_file) {
372
-		if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files))
371
+	foreach ($new_files as $the_file) {
372
+		if (substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files))
373 373
 		array_push($new_studio_mod_files, $the_file);
374 374
 		else
375 375
 		array_push($new_sugar_mod_files, $the_file);
@@ -392,65 +392,65 @@  discard block
 block discarded – undo
392 392
 
393 393
 	echo '<br/><br/>';
394 394
 
395
-    echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;'.(($mode == 'Enable' || $mode == 'Disable')?'display:none;':'').'" onclick=\'this.style.display="none"; toggleDisplay("more");\'id="all_text">
395
+    echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;'.(($mode == 'Enable' || $mode == 'Disable') ? 'display:none;' : '').'" onclick=\'this.style.display="none"; toggleDisplay("more");\'id="all_text">
396 396
         '.SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']).$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'>
397 397
               <div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>'
398 398
          .SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']).$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>';
399
-    echo '<input type="checkbox" checked onclick="toggle_these(' . count($new_studio_mod_files) . ',' . count($new_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
399
+    echo '<input type="checkbox" checked onclick="toggle_these('.count($new_studio_mod_files).','.count($new_files).', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
400 400
 	echo '<ul>';
401
-	foreach( $new_sugar_mod_files as $the_file ){
401
+	foreach ($new_sugar_mod_files as $the_file) {
402 402
 		$highlight_start    = "";
403 403
 		$highlight_end      = "";
404 404
 		$checked            = "";
405 405
 		$disabled           = "";
406 406
 		$unzip_file = "$unzip_dir/$zip_from_dir/$the_file";
407
-		$new_file   = clean_path( "$zip_to_dir/$the_file" );
408
-		$forced_copy    = false;
407
+		$new_file   = clean_path("$zip_to_dir/$the_file");
408
+		$forced_copy = false;
409 409
 
410
-		if( $mode == "Install" ){
410
+		if ($mode == "Install") {
411 411
 			$checked = "checked";
412
-			foreach( $zip_force_copy as $pattern ){
413
-				if( preg_match("#" . $pattern . "#", $unzip_file) ){
412
+			foreach ($zip_force_copy as $pattern) {
413
+				if (preg_match("#".$pattern."#", $unzip_file)) {
414 414
 					$disabled = "disabled=\"true\"";
415 415
 					$forced_copy = true;
416 416
 				}
417 417
 			}
418
-			if( !$forced_copy && is_file( $new_file ) && (md5_file( $unzip_file ) == md5_file( $new_file )) ){
418
+			if (!$forced_copy && is_file($new_file) && (md5_file($unzip_file) == md5_file($new_file))) {
419 419
 				$disabled = "disabled=\"true\"";
420 420
 				//$checked = "";
421 421
 			}
422
-			if( $checked != "" && $disabled != "" ){    // need to put a hidden field
423
-				print( "<input name=\"copy_$count\" type=\"hidden\" value=\"" . $the_file . "\">\n" );
422
+			if ($checked != "" && $disabled != "") {    // need to put a hidden field
423
+				print("<input name=\"copy_$count\" type=\"hidden\" value=\"".$the_file."\">\n");
424 424
 			}
425
-			print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end );
426
-			if( $checked == "" && $disabled != "" ){    // need to explain this file hasn't changed
427
-				print( " (no changes)" );
425
+			print("<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"".$the_file."\" $checked $disabled > ".$highlight_start.$new_file.$highlight_end);
426
+			if ($checked == "" && $disabled != "") {    // need to explain this file hasn't changed
427
+				print(" (no changes)");
428 428
 			}
429
-			print( "<br>\n" );
429
+			print("<br>\n");
430 430
 		}
431
-		else if( $mode == "Uninstall" && file_exists( $new_file ) ){
432
-			if( md5_file( $unzip_file ) == md5_file( $new_file ) ){
431
+		else if ($mode == "Uninstall" && file_exists($new_file)) {
432
+			if (md5_file($unzip_file) == md5_file($new_file)) {
433 433
 				$checked = "checked=\"true\"";
434 434
 			}
435
-			else{
435
+			else {
436 436
 				$highlight_start    = "<font color=red>";
437 437
 				$highlight_end      = "</font>";
438 438
 			}
439
-			print( "<li><input name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end . "<br>\n" );
439
+			print("<li><input name=\"copy_$count\" type=\"checkbox\" value=\"".$the_file."\" $checked $disabled > ".$highlight_start.$new_file.$highlight_end."<br>\n");
440 440
 		}
441 441
 		$count++;
442 442
 	}
443
-        print( "</ul>\n" );
443
+        print("</ul>\n");
444 444
 }
445 445
 //    echo '</div>';
446
-if($mode == "Disable" || $mode == "Enable"){
446
+if ($mode == "Disable" || $mode == "Enable") {
447 447
 	//check to see if any files have been modified
448 448
 	$modified_files = getDiffFiles($unzip_dir, $install_file, ($mode == 'Enable'), $previous_version);
449
-	if(count($modified_files) > 0){
449
+	if (count($modified_files) > 0) {
450 450
 		//we need to tell the user that some files have been modified since they last did an install
451
-		echo '<script>' .
451
+		echo '<script>'.
452 452
                 'function handleFileChange(){';
453
-		if(count($modified_files) > 0){
453
+		if (count($modified_files) > 0) {
454 454
 			echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){
455 455
                 			var overwrite = false;
456 456
                 			if(document.getElementById("radio_overwrite_files").checked){
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                 			}
459 459
             			}
460 460
         				return true;';
461
-		}else{
461
+		} else {
462 462
 			echo 'return true;';
463 463
 		}
464 464
 		echo '}</script>';
@@ -468,23 +468,23 @@  discard block
 block discarded – undo
468 468
 		print("<input type='radio' id='radio_do_not_overwrite_files' name='radio_overwrite' value='do_not_overwrite' checked>{$mod_strings['LBL_DO_OVERWRITE_FILES']}");
469 469
 		print("</td></tr></table>");
470 470
 		print('<ul>');
471
-		foreach($modified_files as $modified_file){
471
+		foreach ($modified_files as $modified_file) {
472 472
 			print('<li>'.$modified_file.'</li>');
473 473
 		}
474 474
 		print('</ul>');
475
-	}else{
476
-		echo '<script>' .
475
+	} else {
476
+		echo '<script>'.
477 477
 	        'function handleFileChange(){';
478 478
 		echo 'return true;';
479 479
 		echo '}</script>';
480 480
 	}
481
-}else{
482
-	echo '<script>' .
481
+} else {
482
+	echo '<script>'.
483 483
         'function handleFileChange(){';
484 484
 	echo 'return true;';
485 485
 	echo '}</script>';
486 486
 }
487
-echo '<script>' .
487
+echo '<script>'.
488 488
          		'function validateForm(process){'.
489 489
          			'return (handleCommit(process) && handleFileChange());'.
490 490
          		'}'.
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
             }
528 528
       </script>';
529 529
 
530
-    $fileHash = fileToHash($install_file );
530
+    $fileHash = fileToHash($install_file);
531 531
 ?>
532
-    <?php print( $hidden_fields ); ?>
533
-    <input type="hidden" name="copy_count" value="<?php print( $count );?>"/>
532
+    <?php print($hidden_fields); ?>
533
+    <input type="hidden" name="copy_count" value="<?php print($count); ?>"/>
534 534
     <input type="hidden" name="run" value="commit" />
535 535
     <input type="hidden" name="install_file"  value="<?php echo $fileHash; ?>" />
536 536
     <input type="hidden" name="unzip_dir"     value="<?php echo basename($unzip_dir); ?>" />
@@ -539,5 +539,5 @@  discard block
 block discarded – undo
539 539
 </form>
540 540
 
541 541
 <?php
542
-    $GLOBALS['log']->info( "Upgrade Wizard patches" );
542
+    $GLOBALS['log']->info("Upgrade Wizard patches");
543 543
 ?>
Please login to merge, or discard this patch.
Braces   +29 added lines, -28 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.
@@ -178,8 +180,7 @@  discard block
 block discarded – undo
178 180
 		while( $f = $d->read() ){
179 181
 			if( $f == "." || $f == ".." ){
180 182
 				continue;
181
-			}
182
-			else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
183
+			} else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){
183 184
 				$new_lang_name = $match[1];
184 185
 			}
185 186
 		}
@@ -200,8 +201,9 @@  discard block
 block discarded – undo
200 201
 		break;
201 202
 	case "module":
202 203
 		$previous_install = array();
203
-		if(!empty($id_name) & !empty($version))
204
-		$previous_install = $uh->determineIfUpgrade($id_name, $version);
204
+		if(!empty($id_name) & !empty($version)) {
205
+				$previous_install = $uh->determineIfUpgrade($id_name, $version);
206
+		}
205 207
 		$previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version'];
206 208
 		$previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id'];
207 209
 		$show_files = false;
@@ -231,15 +233,16 @@  discard block
 block discarded – undo
231 233
 <form action="<?php print( $form_action . "_commit" ); ?>" name="files" method="post"  onSubmit="return validateForm(<?php print($require_license); ?>);">
232 234
 <?php
233 235
 if(empty($new_studio_mod_files)) {
234
-	if(!empty($mode) && $mode == 'Uninstall')
235
-	echo $mod_strings['LBL_UW_UNINSTALL_READY'];
236
-	else if($mode == 'Disable')
237
-	echo $mod_strings['LBL_UW_DISABLE_READY'];
238
-	else if($mode == 'Enable')
239
-	echo $mod_strings['LBL_UW_ENABLE_READY'];
240
-	else
241
-	echo $mod_strings['LBL_UW_PATCH_READY'];
242
-} else {
236
+	if(!empty($mode) && $mode == 'Uninstall') {
237
+		echo $mod_strings['LBL_UW_UNINSTALL_READY'];
238
+	} else if($mode == 'Disable') {
239
+		echo $mod_strings['LBL_UW_DISABLE_READY'];
240
+	} else if($mode == 'Enable') {
241
+		echo $mod_strings['LBL_UW_ENABLE_READY'];
242
+	} else {
243
+		echo $mod_strings['LBL_UW_PATCH_READY'];
244
+	}
245
+	} else {
243 246
 	echo $mod_strings['LBL_UW_PATCH_READY2'];
244 247
 	echo '<input type="checkbox" onclick="toggle_these(0, ' . count($new_studio_mod_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL'];
245 248
 	foreach($new_studio_mod_files as $the_file) {
@@ -255,7 +258,7 @@  discard block
 block discarded – undo
255 258
 	if($found_readme){
256 259
 		if(file_exists($readme_file) && filesize($readme_file) > 0){
257 260
 			$readme_contents = file_get_contents($readme_file);
258
-		}elseif(!empty($manifest['readme'])){
261
+		} elseif(!empty($manifest['readme'])){
259 262
 			$readme_contents = $manifest['readme'];
260 263
 		}
261 264
 	}
@@ -327,8 +330,7 @@  discard block
 block discarded – undo
327 330
 		if( $install_type == "langpack" ){
328 331
 			print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] );
329 332
 			echo '<br><br>';
330
-		}
331
-		else if($install_type != "module"){
333
+		} else if($install_type != "module"){
332 334
 			print( $mod_strings['LBL_UW_FILES_REMOVED'] );
333 335
 		}
334 336
 		break;
@@ -369,10 +371,11 @@  discard block
 block discarded – undo
369 371
 	$cache_html_files = findAllFilesRelative( sugar_cached("layout"), array());
370 372
 
371 373
 	foreach($new_files as $the_file) {
372
-		if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files))
373
-		array_push($new_studio_mod_files, $the_file);
374
-		else
375
-		array_push($new_sugar_mod_files, $the_file);
374
+		if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files)) {
375
+				array_push($new_studio_mod_files, $the_file);
376
+		} else {
377
+				array_push($new_sugar_mod_files, $the_file);
378
+		}
376 379
 	}
377 380
 
378 381
 	echo '<script>
@@ -427,12 +430,10 @@  discard block
 block discarded – undo
427 430
 				print( " (no changes)" );
428 431
 			}
429 432
 			print( "<br>\n" );
430
-		}
431
-		else if( $mode == "Uninstall" && file_exists( $new_file ) ){
433
+		} else if( $mode == "Uninstall" && file_exists( $new_file ) ){
432 434
 			if( md5_file( $unzip_file ) == md5_file( $new_file ) ){
433 435
 				$checked = "checked=\"true\"";
434
-			}
435
-			else{
436
+			} else{
436 437
 				$highlight_start    = "<font color=red>";
437 438
 				$highlight_end      = "</font>";
438 439
 			}
@@ -458,7 +459,7 @@  discard block
 block discarded – undo
458 459
                 			}
459 460
             			}
460 461
         				return true;';
461
-		}else{
462
+		} else{
462 463
 			echo 'return true;';
463 464
 		}
464 465
 		echo '}</script>';
@@ -472,13 +473,13 @@  discard block
 block discarded – undo
472 473
 			print('<li>'.$modified_file.'</li>');
473 474
 		}
474 475
 		print('</ul>');
475
-	}else{
476
+	} else{
476 477
 		echo '<script>' .
477 478
 	        'function handleFileChange(){';
478 479
 		echo 'return true;';
479 480
 		echo '}</script>';
480 481
 	}
481
-}else{
482
+} else{
482 483
 	echo '<script>' .
483 484
         'function handleFileChange(){';
484 485
 	echo 'return true;';
Please login to merge, or discard this patch.
modules/Administration/RebuildJSLang.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,6 +50,6 @@
 block discarded – undo
50 50
     LanguageManager::clearLanguageCache();
51 51
 }
52 52
 else{
53
-	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
53
+    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
54 54
 }
55 55
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 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.
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
-if(is_admin($current_user)){
41
+if (is_admin($current_user)) {
42 42
 
43 43
     global $mod_strings, $sugar_config;
44 44
     echo $mod_strings['LBL_REBUILD_JAVASCRIPT_LANG_DESC'];
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     //remove language cache files
50 50
     LanguageManager::clearLanguageCache();
51 51
 }
52
-else{
52
+else {
53 53
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
54 54
 }
55 55
 ?>
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 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.
@@ -48,8 +50,7 @@  discard block
 block discarded – undo
48 50
 
49 51
     //remove language cache files
50 52
     LanguageManager::clearLanguageCache();
51
-}
52
-else{
53
+} else{
53 54
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
54 55
 }
55 56
 ?>
Please login to merge, or discard this patch.
modules/Administration/RepairActivities.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 while ($row != null) {
51 51
     $date_end = $timedate->fromDb($row['date_start'])->modify("+{$row['duration_hours']} hours {$row['duration_minutes']} mins")->asDb();
52 52
     $updateQuery = "UPDATE calls set calls.date_end='{$date_end}' where calls.id='{$row['id']}'";
53
-	$call = new Call();
53
+    $call = new Call();
54 54
     $call->db->query($updateQuery);
55 55
     $row = $callBean->db->fetchByAssoc($result);
56 56
 }
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 $row = $meetingBean->db->fetchByAssoc($result);
63 63
 while ($row != null) {
64 64
     $date_end = $timedate->fromDb($row['date_start'])->modify("+{$row['duration_hours']} hours {$row['duration_minutes']} mins")->asDb();
65
-	$updateQuery = "UPDATE meetings set meetings.date_end='{$date_end}' where meetings.id='{$row['id']}'";
66
-	$call = new Call();
65
+    $updateQuery = "UPDATE meetings set meetings.date_end='{$date_end}' where meetings.id='{$row['id']}'";
66
+    $call = new Call();
67 67
     $call->db->query($updateQuery);
68 68
     $row = $callBean->db->fetchByAssoc($result);
69 69
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
-if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
41
+if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
42 42
 
43 43
 global $timedate;
44 44
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -38,7 +40,9 @@  discard block
 block discarded – undo
38 40
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 41
  ********************************************************************************/
40 42
 
41
-if(!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
43
+if(!is_admin($current_user)) {
44
+    sugar_die("Unauthorized access to administration.");
45
+}
42 46
 
43 47
 global $timedate;
44 48
 
Please login to merge, or discard this patch.
modules/Administration/ExportCustomFieldStructure.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,10 +44,10 @@
 block discarded – undo
44 44
 $fields = array();
45 45
 $str = '';
46 46
 while($row = $db->fetchByAssoc($result)){
47
-	foreach($row as $name=>$value){
48
-		$str.= "$name:::$value\n";
49
-	}
50
-	$str .= "DONE\n";
47
+    foreach($row as $name=>$value){
48
+        $str.= "$name:::$value\n";
49
+    }
50
+    $str .= "DONE\n";
51 51
 }
52 52
 ob_get_clean();
53 53
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 $result = $db->query('SELECT * FROM fields_meta_data WHERE deleted = 0');
44 44
 $fields = array();
45 45
 $str = '';
46
-while($row = $db->fetchByAssoc($result)){
47
-	foreach($row as $name=>$value){
48
-		$str.= "$name:::$value\n";
46
+while ($row = $db->fetchByAssoc($result)) {
47
+	foreach ($row as $name=>$value) {
48
+		$str .= "$name:::$value\n";
49 49
 	}
50 50
 	$str .= "DONE\n";
51 51
 }
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 header("Content-Disposition: attachment; filename=CustomFieldStruct.sugar");
55 55
 header("Content-Type: text/txt; charset={$app_strings['LBL_CHARSET']}");
56
-header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
57
-header( "Last-Modified: " . TimeDate::httpTime() );
58
-header( "Cache-Control: post-check=0, pre-check=0", false );
56
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
57
+header("Last-Modified: ".TimeDate::httpTime());
58
+header("Cache-Control: post-check=0, pre-check=0", false);
59 59
 header("Content-Length: ".strlen($str));
60 60
 echo $str;
61 61
 ?>
62 62
\ 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.