Completed
Pull Request — master (#628)
by Richard
19:02 queued 04:58
created
upgrade/upd-2.0.18-to-2.3.0/settings_db.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
  * @version     $Id$
25 25
  */
26 26
 
27
-if ( !defined( 'XOOPS_ROOT_PATH' ) ) {
28
-    die( 'Bad installation: please add this folder to the XOOPS install you want to upgrade');
27
+if (!defined('XOOPS_ROOT_PATH')) {
28
+    die('Bad installation: please add this folder to the XOOPS install you want to upgrade');
29 29
 }
30 30
 
31 31
 $vars = $_SESSION['settings'];
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
     $charsets["utf8"] = array();
40 40
     $ut8_available = false;
41
-    if ( $result = $db->queryF("SHOW CHARSET") ) {
42
-        while ( $row = $db->fetchArray($result) ) {
41
+    if ($result = $db->queryF("SHOW CHARSET")) {
42
+        while ($row = $db->fetchArray($result)) {
43 43
             $charsets[$row["Charset"]]["desc"] = $row["Description"];
44 44
             if ($row["Charset"] == "utf8") {
45 45
                 $ut8_available = true;
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
     $collations = array();
61 61
     $charsets = getDbCharsets();
62 62
 
63
-    if ( $result = $db->queryF("SHOW COLLATION") ) {
64
-        while ( $row = $db->fetchArray($result) ) {
63
+    if ($result = $db->queryF("SHOW COLLATION")) {
64
+        while ($row = $db->fetchArray($result)) {
65 65
             $charsets[$row["Charset"]]["collation"][] = $row["Collation"];
66 66
         }
67 67
     }
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
     return $charsets;
70 70
 }
71 71
 
72
-function xoFormFieldCollation( $name, $value, $label, $help = '' )
72
+function xoFormFieldCollation($name, $value, $label, $help = '')
73 73
 {
74 74
     $collations = getDbCollations();
75 75
 
76 76
     $myts = MyTextSanitizer::getInstance();
77
-    $label = $myts->htmlspecialchars( $label, ENT_QUOTES, _UPGRADE_CHARSET, false );
78
-    $name = $myts->htmlspecialchars( $name, ENT_QUOTES, _UPGRADE_CHARSET, false );
79
-    $value = $myts->htmlspecialchars( $value, ENT_QUOTES );
77
+    $label = $myts->htmlspecialchars($label, ENT_QUOTES, _UPGRADE_CHARSET, false);
78
+    $name = $myts->htmlspecialchars($name, ENT_QUOTES, _UPGRADE_CHARSET, false);
79
+    $value = $myts->htmlspecialchars($value, ENT_QUOTES);
80 80
 
81 81
     $field = "<label for='$name'>$label</label>\n";
82
-    if ( $help ) {
83
-        $field .= '<div class="xoform-help">' . $help . "</div>\n";
82
+    if ($help) {
83
+        $field .= '<div class="xoform-help">'.$help."</div>\n";
84 84
     }
85 85
     $field .= "<select name='$name' id='$name'\">";
86
-    $field .= "<option value=''>" . DB_COLLATION_NOCHANGE . "</option>";
86
+    $field .= "<option value=''>".DB_COLLATION_NOCHANGE."</option>";
87 87
 
88 88
     $collation_default = "";
89 89
     $options = "";
90 90
     foreach ($collations as $key => $charset) {
91 91
         $field .= "<optgroup label='{$key} - ({$charset['desc']})'>";
92 92
         foreach ($charset['collation'] as $collation) {
93
-            $field .= "<option value='{$collation}'" . ( ($value == $collation) ? " selected='selected'" : "" ) . ">{$collation}</option>";
93
+            $field .= "<option value='{$collation}'".(($value == $collation) ? " selected='selected'" : "").">{$collation}</option>";
94 94
         }
95 95
         $field .= "</optgroup>";
96 96
     }
@@ -99,26 +99,26 @@  discard block
 block discarded – undo
99 99
     return $field;
100 100
 }
101 101
 
102
-if ( $_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['task'] == 'db' ) {
103
-    $params = array( 'DB_COLLATION' );
104
-    foreach ( $params as $name ) {
102
+if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['task'] == 'db') {
103
+    $params = array('DB_COLLATION');
104
+    foreach ($params as $name) {
105 105
         $vars[$name] = isset($_POST[$name]) ? $_POST[$name] : "";
106 106
     }
107 107
     return $vars;
108 108
 }
109 109
 
110
-if ( !isset( $vars['DB_COLLATION'] ) ) {
110
+if (!isset($vars['DB_COLLATION'])) {
111 111
     $vars['DB_COLLATION'] = '';
112 112
 }
113 113
 
114 114
 
115 115
 ?>
116
-<?php if ( !empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>
116
+<?php if (!empty($error)) echo '<div class="x2-note error">'.$error."</div>\n"; ?>
117 117
 
118 118
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method='post'>
119 119
 <fieldset>
120 120
     <legend><?php echo LEGEND_DATABASE; ?></legend>
121
-    <?php echo xoFormFieldCollation( 'DB_COLLATION',    $vars['DB_COLLATION'],    DB_COLLATION_LABEL, DB_COLLATION_HELP ); ?>
121
+    <?php echo xoFormFieldCollation('DB_COLLATION', $vars['DB_COLLATION'], DB_COLLATION_LABEL, DB_COLLATION_HELP); ?>
122 122
 
123 123
 </fieldset>
124 124
 <input type="hidden" name="action" value="next" />
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,10 @@
 block discarded – undo
113 113
 
114 114
 
115 115
 ?>
116
-<?php if ( !empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>
116
+<?php if ( !empty( $error ) ) {
117
+    echo '<div class="x2-note error">' . $error . "</div>\n";
118
+}
119
+?>
117 120
 
118 121
 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method='post'>
119 122
 <fieldset>
Please login to merge, or discard this patch.
upgrade/upd-2.0.18-to-2.3.0/language/english.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@
 block discarded – undo
4 4
 // _CHARSET : UTF-8
5 5
 // Translator: XOOPS Translation Team
6 6
 
7
-define("LEGEND_XOOPS_PATHS","XOOPS Physical paths");
8
-define("LEGEND_DATABASE","Database Character Set");
7
+define("LEGEND_XOOPS_PATHS", "XOOPS Physical paths");
8
+define("LEGEND_DATABASE", "Database Character Set");
9 9
 
10
-define("XOOPS_LIB_PATH_LABEL","XOOPS library directory");
11
-define("XOOPS_LIB_PATH_HELP","Physical path to the XOOPS library directory WITHOUT trailing slash, for forward compatibility. Locate the folder out of " . XOOPS_ROOT_PATH . " to make it secure.");
12
-define("XOOPS_DATA_PATH_LABEL","XOOPS datafiles directory");
13
-define("XOOPS_DATA_PATH_HELP","Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash, for forward compatibility. Locate the folder out of " . XOOPS_ROOT_PATH . " to make it secure.");
10
+define("XOOPS_LIB_PATH_LABEL", "XOOPS library directory");
11
+define("XOOPS_LIB_PATH_HELP", "Physical path to the XOOPS library directory WITHOUT trailing slash, for forward compatibility. Locate the folder out of ".XOOPS_ROOT_PATH." to make it secure.");
12
+define("XOOPS_DATA_PATH_LABEL", "XOOPS datafiles directory");
13
+define("XOOPS_DATA_PATH_HELP", "Physical path to the XOOPS datafiles (writable) directory WITHOUT trailing slash, for forward compatibility. Locate the folder out of ".XOOPS_ROOT_PATH." to make it secure.");
14 14
 
15
-define("DB_COLLATION_LABEL","Database character set and collation");
16
-define("DB_COLLATION_HELP","As of 4.12 MySQL supports custom character set and collation. However it is more complex than expected, so DON'T make any change unless you are confident with your choice.");
17
-define("DB_COLLATION_NOCHANGE","Do not change");
15
+define("DB_COLLATION_LABEL", "Database character set and collation");
16
+define("DB_COLLATION_HELP", "As of 4.12 MySQL supports custom character set and collation. However it is more complex than expected, so DON'T make any change unless you are confident with your choice.");
17
+define("DB_COLLATION_NOCHANGE", "Do not change");
18 18
 
19
-define("XOOPS_PATH_FOUND","Path found.");
20
-define("ERR_COULD_NOT_ACCESS","Could not access the specified folder. Please verify that it exists and is readable by the server.");
21
-define("CHECKING_PERMISSIONS","Checking file and directory permissions...");
22
-define("ERR_NEED_WRITE_ACCESS","The server must be given write access to the following files and folder<br />(i.e. <em>chmod 777 directory_name</em> on a UNIX/LINUX server)");
23
-define("IS_NOT_WRITABLE","%s is NOT writable.");
24
-define("IS_WRITABLE","%s is writable.");
25
-define("ERR_COULD_NOT_WRITE_MAINFILE","Error writing content to mainfile.php, write the content into mainfile.php manually.");
19
+define("XOOPS_PATH_FOUND", "Path found.");
20
+define("ERR_COULD_NOT_ACCESS", "Could not access the specified folder. Please verify that it exists and is readable by the server.");
21
+define("CHECKING_PERMISSIONS", "Checking file and directory permissions...");
22
+define("ERR_NEED_WRITE_ACCESS", "The server must be given write access to the following files and folder<br />(i.e. <em>chmod 777 directory_name</em> on a UNIX/LINUX server)");
23
+define("IS_NOT_WRITABLE", "%s is NOT writable.");
24
+define("IS_WRITABLE", "%s is writable.");
25
+define("ERR_COULD_NOT_WRITE_MAINFILE", "Error writing content to mainfile.php, write the content into mainfile.php manually.");
26 26
 
27 27
 ?>
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
upgrade/upd-2.0.18-to-2.3.0/index.php 2 patches
Indentation   -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,6 @@  discard block
 block discarded – undo
37 37
 
38 38
     /**
39 39
      * Check if cpanel config already exists
40
-
41 40
      */
42 41
     function check_config()
43 42
     {
@@ -53,7 +52,6 @@  discard block
 block discarded – undo
53 52
 
54 53
     /**
55 54
      * Check if cache_model table already exists
56
-
57 55
      */
58 56
     function check_cache()
59 57
     {
@@ -79,7 +77,6 @@  discard block
 block discarded – undo
79 77
 
80 78
     /**
81 79
      * Check if primary key for `block_module_link` is already set
82
-
83 80
      */
84 81
     function check_bmlink()
85 82
     {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @version     $Id$
23 23
  */
24 24
 
25
-include_once dirname(__FILE__) . "/pathcontroller.php";
25
+include_once dirname(__FILE__)."/pathcontroller.php";
26 26
 
27 27
 class upgrade_230 extends xoopsUpgrade
28 28
 {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $xoops = Xoops::getInstance();
45 45
         $db = $xoops->db();
46
-        $sql = "SELECT COUNT(*) FROM `" . $db->prefix('config') . "` WHERE `conf_name` IN ('welcome_type', 'cpanel')";
46
+        $sql = "SELECT COUNT(*) FROM `".$db->prefix('config')."` WHERE `conf_name` IN ('welcome_type', 'cpanel')";
47 47
         if (!$result = $db->queryF($sql)) {
48 48
             return false;
49 49
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $xoops = Xoops::getInstance();
61 61
         $db = $xoops->db();
62
-        $sql = "SHOW TABLES LIKE '" . $db->prefix("cache_model") . "'";
62
+        $sql = "SHOW TABLES LIKE '".$db->prefix("cache_model")."'";
63 63
         $result = $db->queryF($sql);
64 64
         if (!$result) {
65 65
             return false;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $db = $xoops->db();
88 88
         // MySQL 5.0+
89 89
         //$sql = "SHOW KEYS FROM `" . $db->prefix('block_module_link') . "` WHERE `KEY_NAME` LIKE 'PRIMARY'";
90
-        $sql = "SHOW KEYS FROM `" . $db->prefix('block_module_link');
90
+        $sql = "SHOW KEYS FROM `".$db->prefix('block_module_link');
91 91
         if (!$result = $db->queryF($sql)) {
92 92
             return false;
93 93
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $xoops = Xoops::getInstance();
106 106
         $db = $xoops->db();
107
-        $sql = "SHOW KEYS FROM `" . $db->prefix('block_module_link');
107
+        $sql = "SHOW KEYS FROM `".$db->prefix('block_module_link');
108 108
         if (!$result = $db->queryF($sql)) {
109 109
             return false;
110 110
         }
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
             }
120 120
         }
121 121
         foreach ($keys_drop as $drop) {
122
-            $sql = "ALTER TABLE `" . $db->prefix('block_module_link') . "` DROP KEY `{$drop}`";
122
+            $sql = "ALTER TABLE `".$db->prefix('block_module_link')."` DROP KEY `{$drop}`";
123 123
             $db->queryF($sql);
124 124
         }
125 125
         if ($primary_add) {
126
-            $sql = "ALTER IGNORE TABLE `" . $db->prefix('block_module_link') . "` ADD PRIMARY KEY (`block_id`, `module_id`)";
126
+            $sql = "ALTER IGNORE TABLE `".$db->prefix('block_module_link')."` ADD PRIMARY KEY (`block_id`, `module_id`)";
127 127
             return $db->queryF($sql);
128 128
         }
129 129
         return true;
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
         $db = $xoops->db();
136 136
         $result = true;
137 137
         if (!$xoops->getConfig("cpanel")) {
138
-            $sql = "INSERT INTO " . $db->prefix('config') . " (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) " . " VALUES " . " (NULL, 0, 1, 'cpanel', '_MD_AM_CPANEL', 'default', '_MD_AM_CPANELDSC', 'cpanel', 'other', 11)";
138
+            $sql = "INSERT INTO ".$db->prefix('config')." (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) "." VALUES "." (NULL, 0, 1, 'cpanel', '_MD_AM_CPANEL', 'default', '_MD_AM_CPANELDSC', 'cpanel', 'other', 11)";
139 139
 
140 140
             $result *= $db->queryF($sql);
141 141
         }
142 142
 
143 143
         $welcometype_installed = false;
144
-        $sql = "SELECT COUNT(*) FROM `" . $db->prefix('config') . "` WHERE `conf_name` = 'welcome_type'";
144
+        $sql = "SELECT COUNT(*) FROM `".$db->prefix('config')."` WHERE `conf_name` = 'welcome_type'";
145 145
         if ($result = $db->queryF($sql)) {
146 146
             list($count) = $db->fetchRow($result);
147 147
             if ($count == 1) {
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
             }
150 150
         }
151 151
         if (!$welcometype_installed) {
152
-            $sql = "INSERT INTO " . $db->prefix('config') . " (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) " . " VALUES " . " (NULL, 0, 2, 'welcome_type', '_MD_AM_WELCOMETYPE', '1', '_MD_AM_WELCOMETYPE_DESC', 'select', 'int', 3)";
152
+            $sql = "INSERT INTO ".$db->prefix('config')." (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) "." VALUES "." (NULL, 0, 2, 'welcome_type', '_MD_AM_WELCOMETYPE', '1', '_MD_AM_WELCOMETYPE_DESC', 'select', 'int', 3)";
153 153
 
154 154
             if (!$db->queryF($sql)) {
155 155
                 return false;
156 156
             }
157 157
             $config_id = $db->getInsertId();
158 158
 
159
-            $sql = "INSERT INTO " . $db->prefix('configoption') . " (confop_id, confop_name, confop_value, conf_id)" . " VALUES" . " (NULL, '_NO', '0', {$config_id})," . " (NULL, '_MD_AM_WELCOMETYPE_EMAIL', '1', {$config_id})," . " (NULL, '_MD_AM_WELCOMETYPE_PM', '2', {$config_id})," . " (NULL, '_MD_AM_WELCOMETYPE_BOTH', '3', {$config_id})";
159
+            $sql = "INSERT INTO ".$db->prefix('configoption')." (confop_id, confop_name, confop_value, conf_id)"." VALUES"." (NULL, '_NO', '0', {$config_id}),"." (NULL, '_MD_AM_WELCOMETYPE_EMAIL', '1', {$config_id}),"." (NULL, '_MD_AM_WELCOMETYPE_PM', '2', {$config_id}),"." (NULL, '_MD_AM_WELCOMETYPE_BOTH', '3', {$config_id})";
160 160
             if (!$result = $db->queryF($sql)) {
161 161
                 return false;
162 162
             }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $db = $xoops->db();
172 172
         $allowWebChanges = $db->allowWebChanges;
173 173
         $db->allowWebChanges = true;
174
-        $result = $db->queryFromFile(dirname(__FILE__) . "/mysql.structure.sql");
174
+        $result = $db->queryFromFile(dirname(__FILE__)."/mysql.structure.sql");
175 175
         $db->allowWebChanges = $allowWebChanges;
176 176
         return $result;
177 177
     }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 
199 199
     function check_db()
200 200
     {
201
-        $lines = file(XOOPS_ROOT_PATH . '/mainfile.php');
201
+        $lines = file(XOOPS_ROOT_PATH.'/mainfile.php');
202 202
         foreach ($lines as $line) {
203 203
             if (preg_match("/(define\(\s*)([\"'])(XOOPS_DB_CHARSET)\\2,\s*([\"'])([^\"']*?)\\4\s*\);/", $line)) {
204 204
                 return true;
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
     {
232 232
         $xoops = Xoops::getInstance();
233 233
         $db = $xoops->db();
234
-        $sql = "ALTER DATABASE `" . XOOPS_DB_NAME . "` DEFAULT CHARACTER SET " . $db->quote($charset) . " COLLATE " . $db->quote($collation);
234
+        $sql = "ALTER DATABASE `".XOOPS_DB_NAME."` DEFAULT CHARACTER SET ".$db->quote($charset)." COLLATE ".$db->quote($collation);
235 235
         if (!$db->queryF($sql)) {
236 236
             return false;
237 237
         }
238
-        if (!$result = $db->queryF("SHOW TABLES LIKE '" . XOOPS_DB_PREFIX . "\_%'")) {
238
+        if (!$result = $db->queryF("SHOW TABLES LIKE '".XOOPS_DB_PREFIX."\_%'")) {
239 239
             return false;
240 240
         }
241 241
         $tables = array();
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
                 while (false !== ($result = $db->fetchArray($resource))) {
270 270
                     if (preg_match('/(char)|(text)|(enum)|(set)/', $result['Type'])) {
271 271
                         // String Type SQL Sentence.
272
-                        $string_querys[] = "ALTER TABLE `$table` MODIFY `" . $result['Field'] . '` ' . $result['Type'] . " CHARACTER SET $charset COLLATE $collation " . (((!empty($result['Default'])) || ($result['Default'] === '0') || ($result['Default'] === 0)) ? "DEFAULT '" . $result['Default'] . "' " : '') . ('YES' == $result['Null'] ? '' : 'NOT ') . 'NULL';
272
+                        $string_querys[] = "ALTER TABLE `$table` MODIFY `".$result['Field'].'` '.$result['Type']." CHARACTER SET $charset COLLATE $collation ".(((!empty($result['Default'])) || ($result['Default'] === '0') || ($result['Default'] === 0)) ? "DEFAULT '".$result['Default']."' " : '').('YES' == $result['Null'] ? '' : 'NOT ').'NULL';
273 273
 
274 274
                         // Binary String Type SQL Sentence.
275 275
                         if (preg_match('/(enum)|(set)/', $result['Type'])) {
276
-                            $binary_querys[] = "ALTER TABLE `$table` MODIFY `" . $result['Field'] . '` ' . $result['Type'] . ' CHARACTER SET binary ' . (((!empty($result['Default'])) || ($result['Default'] === '0') || ($result['Default'] === 0)) ? "DEFAULT '" . $result['Default'] . "' " : '') . ('YES' == $result['Null'] ? '' : 'NOT ') . 'NULL';
276
+                            $binary_querys[] = "ALTER TABLE `$table` MODIFY `".$result['Field'].'` '.$result['Type'].' CHARACTER SET binary '.(((!empty($result['Default'])) || ($result['Default'] === '0') || ($result['Default'] === 0)) ? "DEFAULT '".$result['Default']."' " : '').('YES' == $result['Null'] ? '' : 'NOT ').'NULL';
277 277
                         } else {
278 278
                             $result['Type'] = preg_replace('/char/', 'binary', $result['Type']);
279 279
                             $result['Type'] = preg_replace('/text/', 'blob', $result['Type']);
280
-                            $binary_querys[] = "ALTER TABLE `$table` MODIFY `" . $result['Field'] . '` ' . $result['Type'] . ' ' . (((!empty($result['Default'])) || ($result['Default'] === '0') || ($result['Default'] === 0)) ? "DEFAULT '" . $result['Default'] . "' " : '') . ('YES' == $result['Null'] ? '' : 'NOT ') . 'NULL';
280
+                            $binary_querys[] = "ALTER TABLE `$table` MODIFY `".$result['Field'].'` '.$result['Type'].' '.(((!empty($result['Default'])) || ($result['Default'] === '0') || ($result['Default'] === 0)) ? "DEFAULT '".$result['Default']."' " : '').('YES' == $result['Null'] ? '' : 'NOT ').'NULL';
281 281
                         }
282 282
                     }
283 283
                 }
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
                         $tmp_gen_index_query = "ALTER TABLE `$table` ADD FULLTEXT `$key_name`(";
299 299
                         $fields_names = array_keys($column);
300 300
                         for ($i = 1; $i <= count($column); $i++) {
301
-                            $tmp_gen_index_query .= $fields_names[$i - 1] . (($i == count($column)) ? '' : ', ');
301
+                            $tmp_gen_index_query .= $fields_names[$i - 1].(($i == count($column)) ? '' : ', ');
302 302
                         }
303
-                        $gen_index_querys[] = $tmp_gen_index_query . ')';
303
+                        $gen_index_querys[] = $tmp_gen_index_query.')';
304 304
                     }
305 305
                 }
306 306
 
@@ -330,23 +330,23 @@  discard block
 block discarded – undo
330 330
             return false;
331 331
         }
332 332
 
333
-        $file = dirname(__FILE__) . '/mainfile.dist.php';
333
+        $file = dirname(__FILE__).'/mainfile.dist.php';
334 334
 
335 335
         $lines = file($file);
336 336
         foreach (array_keys($lines) as $ln) {
337 337
             if (preg_match("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", $lines[$ln], $matches)) {
338 338
                 $val = isset($vars[$matches[3]]) ? strval(constant($matches[3])) : (defined($matches[3]) ? strval(constant($matches[3])) : "0");
339
-                $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", "define( '" . $matches[3] . "', " . $val . " )", $lines[$ln]);
339
+                $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", "define( '".$matches[3]."', ".$val." )", $lines[$ln]);
340 340
             } elseif (preg_match("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([\"'])([^\"']*?)\\4\s*\)/", $lines[$ln], $matches)) {
341 341
                 $val = isset($vars[$matches[3]]) ? strval($vars[$matches[3]]) : (defined($matches[3]) ? strval(constant($matches[3])) : "");
342
-                $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([\"'])(.*?)\\4\s*\)/", "define( '" . $matches[3] . "', '" . $val . "' )", $lines[$ln]);
342
+                $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([\"'])(.*?)\\4\s*\)/", "define( '".$matches[3]."', '".$val."' )", $lines[$ln]);
343 343
             }
344 344
         }
345 345
 
346
-        $fp = fopen(XOOPS_ROOT_PATH . '/mainfile.php', 'wt');
346
+        $fp = fopen(XOOPS_ROOT_PATH.'/mainfile.php', 'wt');
347 347
         if (!$fp) {
348 348
             echo ERR_COULD_NOT_WRITE_MAINFILE;
349
-            echo "<pre style='border: 1px solid black; width: 80%; overflow: auto;'><div style='color: #ff0000; font-weight: bold;'><div>" . implode("</div><div>", array_map("htmlspecialchars", $lines)) . "</div></div></pre>";
349
+            echo "<pre style='border: 1px solid black; width: 80%; overflow: auto;'><div style='color: #ff0000; font-weight: bold;'><div>".implode("</div><div>", array_map("htmlspecialchars", $lines))."</div></div></pre>";
350 350
             return false;
351 351
         } else {
352 352
             $newline = defined(PHP_EOL) ? PHP_EOL : (strpos(php_uname(), 'Windows') ? "\r\n" : "\n");
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     function set_configs($task)
362 362
     {
363 363
         $ret = array();
364
-        $configs = include dirname(__FILE__) . "/settings_{$task}.php";
364
+        $configs = include dirname(__FILE__)."/settings_{$task}.php";
365 365
         if (!$configs || !is_array($configs)) {
366 366
             return $ret;
367 367
         }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
         }
371 371
 
372 372
         foreach ($configs as $key => $val) {
373
-            $ret['XOOPS_' . $key] = $val;
373
+            $ret['XOOPS_'.$key] = $val;
374 374
         }
375 375
         return $ret;
376 376
     }
Please login to merge, or discard this patch.
upgrade/upd-2.0.18-to-2.3.0/mainfile.dist.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         if (function_exists("debug_backtrace")) {
50 50
             $xoopsScriptPath = debug_backtrace();
51 51
             if (!count($xoopsScriptPath)) {
52
-                 die("XOOPS path check: this file cannot be requested directly");
52
+                    die("XOOPS path check: this file cannot be requested directly");
53 53
             }
54 54
             $xoopsScriptPath = $xoopsScriptPath[0]["file"];
55 55
         } else {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             $xoopsScriptPath = str_replace(strpos($xoopsScriptPath, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $xoopsScriptPath);
61 61
         }
62 62
         if (strcasecmp(substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace(DIRECTORY_SEPARATOR, "/", XOOPS_ROOT_PATH))) {
63
-             exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
63
+                exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
64 64
         }
65 65
     }
66 66
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     // URL Association for SSL and Protocol Compatibility
34 34
     $http = 'http://';
35 35
     if (!empty($_SERVER['HTTPS'])) {
36
-        $http = ($_SERVER['HTTPS']=='on') ? 'https://' : 'http://';
36
+        $http = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
37 37
     }
38 38
     define('XOOPS_PROT', $http);
39 39
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             }
54 54
             $xoopsScriptPath = $xoopsScriptPath[0]["file"];
55 55
         } else {
56
-            $xoopsScriptPath = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] :  $_SERVER["SCRIPT_FILENAME"];
56
+            $xoopsScriptPath = isset($_SERVER["PATH_TRANSLATED"]) ? $_SERVER["PATH_TRANSLATED"] : $_SERVER["SCRIPT_FILENAME"];
57 57
         }
58 58
         if (DIRECTORY_SEPARATOR != "/") {
59 59
             // IIS6 may double the \ chars
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@
 block discarded – undo
69 69
     define("XOOPS_DB_TYPE", "mysql");
70 70
 
71 71
     // Set the database charset if applicable
72
-    if (defined("XOOPS_DB_CHARSET")) die('Restricted Access');
72
+    if (defined("XOOPS_DB_CHARSET")) {
73
+        die('Restricted Access');
74
+    }
73 75
     define("XOOPS_DB_CHARSET", "");
74 76
 
75 77
     // Table Prefix
Please login to merge, or discard this patch.
upgrade/upgrade_tpl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
     <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _UPGRADE_CHARSET ?>" />
9 9
     <link rel="stylesheet" type="text/css" media="all" href="style.css" />
10 10
     <?php
11
-        if (file_exists('language/' . $upgrade_language . '/style.css')) {
12
-            echo '<link rel="stylesheet" type="text/css" media="all" href="language/' . $upgrade_language . '/style.css" />';
11
+        if (file_exists('language/'.$upgrade_language.'/style.css')) {
12
+            echo '<link rel="stylesheet" type="text/css" media="all" href="language/'.$upgrade_language.'/style.css" />';
13 13
         }
14 14
     ?>
15 15
 </head>
Please login to merge, or discard this patch.
upgrade/language/english/upgrade.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,25 +4,25 @@
 block discarded – undo
4 4
 // _CHARSET : UTF-8
5 5
 // Translator: XOOPS Translation Team
6 6
 
7
-define("_XOOPS_UPGRADE","XOOPS system upgrade");
8
-define("_CHECKING_APPLIED","Checking applied upgrades:");
9
-define("_SET_FILES_WRITABLE","Make the following files writable before proceeding:");
10
-define("_NO_NEED_UPGRADE","No upgrade necessary. Please %s and remove this folder from your server");
11
-define("_NEED_UPGRADE","Upgrade needed");
12
-define("_PROCEED_UPGRADE","Proceed to upgrade");
13
-define("_PERFORMING_UPGRADE","Performing %s upgrade");
7
+define("_XOOPS_UPGRADE", "XOOPS system upgrade");
8
+define("_CHECKING_APPLIED", "Checking applied upgrades:");
9
+define("_SET_FILES_WRITABLE", "Make the following files writable before proceeding:");
10
+define("_NO_NEED_UPGRADE", "No upgrade necessary. Please %s and remove this folder from your server");
11
+define("_NEED_UPGRADE", "Upgrade needed");
12
+define("_PROCEED_UPGRADE", "Proceed to upgrade");
13
+define("_PERFORMING_UPGRADE", "Performing %s upgrade");
14 14
 
15
-define("_USER_LOGIN","User login");
15
+define("_USER_LOGIN", "User login");
16 16
 
17
-define("_MANUAL_INSTRUCTIONS","Manual installation instructions");
17
+define("_MANUAL_INSTRUCTIONS", "Manual installation instructions");
18 18
 
19 19
 // %s is filename
20
-define("_FAILED_PATCH","Failed to patch %s");
21
-define("_APPLY_NEXT","Apply next upgrade (%s)");
22
-define("_COPY_RED_LINES","Copy the following red lines to %s");
20
+define("_FAILED_PATCH", "Failed to patch %s");
21
+define("_APPLY_NEXT", "Apply next upgrade (%s)");
22
+define("_COPY_RED_LINES", "Copy the following red lines to %s");
23 23
 
24
-define("_FINISH","Finish");
25
-define("_RELOAD","Reload");
24
+define("_FINISH", "Finish");
25
+define("_RELOAD", "Reload");
26 26
 
27 27
 define('_UPGRADE_CHARSET', "UTF-8");
28 28
 define('_UPDATE_SYSTEM_MODULE', "update system module");
Please login to merge, or discard this patch.
upgrade/upd-2.0.17-to-2.0.18/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     {
17 17
         $xoops = Xoops::getInstance();
18 18
         $db = $xoops->db();
19
-        $sql = "SHOW COLUMNS FROM " . $db->prefix("config") . " LIKE 'conf_title'";
19
+        $sql = "SHOW COLUMNS FROM ".$db->prefix("config")." LIKE 'conf_title'";
20 20
         $result = $db->queryF($sql);
21 21
         while (false !== ($row = $db->fetchArray($result))) {
22 22
             if (strtolower(trim($row["Type"])) == "varchar(255)") {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         foreach ($this->fields as $table => $data) {
50 50
             foreach ($data as $field => $property) {
51
-                $sql = "ALTER TABLE " . $db->prefix($table) . " CHANGE `$field` `$field` $property";
51
+                $sql = "ALTER TABLE ".$db->prefix($table)." CHANGE `$field` `$field` $property";
52 52
                 $this->query($sql);
53 53
             }
54 54
         }
Please login to merge, or discard this patch.
upgrade/upd-2.4.0a-to-2.4.0/index.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $xoops = Xoops::getInstance();
37 37
         $db = $xoops->db();
38
-        $sql = "SELECT COUNT(*) FROM `" . $db->prefix('config') . "` WHERE `conf_name` IN ('systemkey', 'soap_xoops_username', 'soap_xoops_password', 'soap_soapclient', 'soap_wdsl', 'soap_keepclient', 'soap_filterperson', 'soap_proxyhost', 'soap_proxyport', 'soap_proxyusername', 'soap_proxypassword', 'soap_timeout', 'soap_responsetimeout', 'soap_fieldmapping', 'soap_provisionning', 'soap_provisionning_group')";
38
+        $sql = "SELECT COUNT(*) FROM `".$db->prefix('config')."` WHERE `conf_name` IN ('systemkey', 'soap_xoops_username', 'soap_xoops_password', 'soap_soapclient', 'soap_wdsl', 'soap_keepclient', 'soap_filterperson', 'soap_proxyhost', 'soap_proxyport', 'soap_proxyusername', 'soap_proxypassword', 'soap_timeout', 'soap_responsetimeout', 'soap_fieldmapping', 'soap_provisionning', 'soap_provisionning_group')";
39 39
         if (!$result = $db->queryF($sql)) {
40 40
             return false;
41 41
         }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $xoops = Xoops::getInstance();
49 49
         $db = $xoops->db();
50
-        $sql = "SELECT COUNT(*) FROM `" . $db->prefix('configoption') . "` WHERE `confop_name` IN ('_MD_AM_AUTH_CONFOPTION_SOAP')";
50
+        $sql = "SELECT COUNT(*) FROM `".$db->prefix('configoption')."` WHERE `confop_name` IN ('_MD_AM_AUTH_CONFOPTION_SOAP')";
51 51
         if (!$result = $db->queryF($sql)) {
52 52
             return false;
53 53
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         );
68 68
         foreach ($configs as $config) {
69 69
             $config_installed = false;
70
-            $sql = "SELECT COUNT(*) FROM " . $db->prefix('config') . " WHERE `conf_name` = '{$config}' AND `conf_modid` = 0";
70
+            $sql = "SELECT COUNT(*) FROM ".$db->prefix('config')." WHERE `conf_name` = '{$config}' AND `conf_modid` = 0";
71 71
             if ($result = $db->queryF($sql)) {
72 72
                 list($count) = $db->fetchRow($result);
73 73
                 if ($count == 1) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 }
76 76
             }
77 77
             if ($config_installed) {
78
-                $sql = "DELETE FROM " . $db->prefix('config') . " WHERE `conf_name` = '{$config}' AND `conf_modid` = 0";
78
+                $sql = "DELETE FROM ".$db->prefix('config')." WHERE `conf_name` = '{$config}' AND `conf_modid` = 0";
79 79
                 if (!$db->queryF($sql)) {
80 80
                     return false;
81 81
                 }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $xoops = Xoops::getInstance();
91 91
         $db = $xoops->db();
92 92
         $configoption_installed = false;
93
-        $sql = "SELECT COUNT(*) FROM `" . $db->prefix('configoption') . "`" . " WHERE `confop_name` = '_MD_AM_AUTH_CONFOPTION_SOAP' AND `confop_value` = 'soap'";
93
+        $sql = "SELECT COUNT(*) FROM `".$db->prefix('configoption')."`"." WHERE `confop_name` = '_MD_AM_AUTH_CONFOPTION_SOAP' AND `confop_value` = 'soap'";
94 94
         if ($result = $db->queryF($sql)) {
95 95
             list($count) = $db->fetchRow($result);
96 96
             if ($count == 1) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
 
101 101
         if ($configoption_installed) {
102
-            $sql = "DELETE FROM " . $db->prefix('configoption') . " WHERE `confop_name` = '_MD_AM_AUTH_CONFOPTION_SOAP' AND `confop_value` = 'soap'";
102
+            $sql = "DELETE FROM ".$db->prefix('configoption')." WHERE `confop_name` = '_MD_AM_AUTH_CONFOPTION_SOAP' AND `confop_value` = 'soap'";
103 103
             if (!$db->queryF($sql)) {
104 104
                 return false;
105 105
             }
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@
 block discarded – undo
24 24
 
25 25
     /**
26 26
      * Check if cpanel config already exists
27
-
28 27
      */
29 28
     function check_config()
30 29
     {
Please login to merge, or discard this patch.
upgrade/upd-2.0.13-to-2.0.14/index.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         }
44 44
     }
45 45
 ";
46
-        $manual = "<h2>" . _MANUAL_INSTRUCTIONS . "</h2>\n<p>" . sprintf(_COPY_RED_LINES, "mainfile.php") . "</p>
46
+        $manual = "<h2>"._MANUAL_INSTRUCTIONS."</h2>\n<p>".sprintf(_COPY_RED_LINES, "mainfile.php")."</p>
47 47
 <pre style='border:1px solid black;width:650px;overflow:auto'><span style='color:#ff0000;font-weight:bold'>$patchCode</span>
48 48
     if (!isset(\$xoopsOption['nocommon']) && XOOPS_ROOT_PATH != '') {
49 49
         include XOOPS_ROOT_PATH.\"/include/common.php\";
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             }
68 68
         }
69 69
         if ($insert == -1) {
70
-            printf(_FAILED_PATCH . "<br />", "mainfile.php");
70
+            printf(_FAILED_PATCH."<br />", "mainfile.php");
71 71
             echo $manual;
72 72
             return false;
73 73
         } elseif ($insert != -2) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                     $prepend = implode('', array_slice($lines, 0, $insert));
87 87
                     $append = implode('', array_slice($lines, $insert));
88 88
 
89
-                    $content = $prepend . $patchCode . $append;
89
+                    $content = $prepend.$patchCode.$append;
90 90
                     $content = str_replace(array("\r\n", "\n"), $newline, $content);
91 91
 
92 92
                     fwrite($fp, $content);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $xoops = Xoops::getInstance();
104 104
         $db = $xoops->db();
105
-        $value = getDbValue($db, 'config', 'conf_id', "`conf_name` = 'ldap_provisionning' AND `conf_catid` = " . XOOPS_CONF_AUTH);
105
+        $value = getDbValue($db, 'config', 'conf_id', "`conf_name` = 'ldap_provisionning' AND `conf_catid` = ".XOOPS_CONF_AUTH);
106 106
         return (bool)$value;
107 107
     }
108 108
 
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
         $cat = getDbValue($db, 'configcategory', 'confcat_id', "`confcat_name` ='_MD_AM_AUTHENTICATION'");
124 124
         if ($cat !== false && $cat != XOOPS_CONF_AUTH) {
125 125
             // 2.2 downgrade bug: LDAP cat is here but has a catid of 0
126
-            $db->queryF("DELETE FROM " . $db->prefix('configcategory') . " WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' ");
127
-            $db->queryF("DELETE FROM " . $db->prefix('config') . " WHERE `conf_modid`=0 AND `conf_catid` = $cat");
126
+            $db->queryF("DELETE FROM ".$db->prefix('configcategory')." WHERE `confcat_name` ='_MD_AM_AUTHENTICATION' ");
127
+            $db->queryF("DELETE FROM ".$db->prefix('config')." WHERE `conf_modid`=0 AND `conf_catid` = $cat");
128 128
             $cat = false;
129 129
         }
130 130
         if (empty($cat)) {
131 131
             // Insert config category ( always XOOPS_CONF_AUTH = 7 )
132
-            $db->queryF("INSERT INTO " . $db->prefix("configcategory") . " (confcat_id,confcat_name) VALUES (7,'_MD_AM_AUTHENTICATION')");
132
+            $db->queryF("INSERT INTO ".$db->prefix("configcategory")." (confcat_id,confcat_name) VALUES (7,'_MD_AM_AUTHENTICATION')");
133 133
         }
134 134
         // Insert config values
135 135
         $table = $db->prefix('config');
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             'ldap_manager_dn'          => "'_MD_AM_LDAP_MANAGER_DN', 'manager_dn', '_MD_AM_LDAP_MANAGER_DN_DESC', 'textbox', 'text', 5",
141 141
             'ldap_manager_pass'        => "'_MD_AM_LDAP_MANAGER_PASS', 'manager_pass', '_MD_AM_LDAP_MANAGER_PASS_DESC', 'textbox', 'text', 6",
142 142
             'ldap_version'             => "'_MD_AM_LDAP_VERSION', '3', '_MD_AM_LDAP_VERSION_DESC', 'textbox', 'text', 7",
143
-            'ldap_users_bypass'        => "'_MD_AM_LDAP_USERS_BYPASS', '" . serialize(array('admin')) . "', '_MD_AM_LDAP_USERS_BYPASS_DESC', 'textarea', 'array', 8",
143
+            'ldap_users_bypass'        => "'_MD_AM_LDAP_USERS_BYPASS', '".serialize(array('admin'))."', '_MD_AM_LDAP_USERS_BYPASS_DESC', 'textarea', 'array', 8",
144 144
             'ldap_loginname_asdn'      => "'_MD_AM_LDAP_LOGINNAME_ASDN', 'uid_asdn', '_MD_AM_LDAP_LOGINNAME_ASDN_D', 'yesno', 'int', 9",
145 145
             'ldap_loginldap_attr'      => "'_MD_AM_LDAP_LOGINLDAP_ATTR', 'uid', '_MD_AM_LDAP_LOGINLDAP_ATTR_D', 'textbox', 'text', 10",
146 146
             'ldap_filter_person'       => "'_MD_AM_LDAP_FILTER_PERSON', '', '_MD_AM_LDAP_FILTER_PERSON_DESC', 'textbox', 'text', 11",
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         );
154 154
         foreach ($data as $name => $values) {
155 155
             if (!getDbValue($db, 'config', 'conf_id', "`conf_modid`=0 AND `conf_catid`=7 AND `conf_name`='$name'")) {
156
-                $this->query("INSERT INTO `$table` (conf_modid,conf_catid,conf_name,conf_title,conf_value,conf_desc,conf_formtype,conf_valuetype,conf_order) " . "VALUES ( 0,7,'$name',$values)");
156
+                $this->query("INSERT INTO `$table` (conf_modid,conf_catid,conf_name,conf_title,conf_value,conf_desc,conf_formtype,conf_valuetype,conf_order) "."VALUES ( 0,7,'$name',$values)");
157 157
             }
158 158
         }
159 159
         // Insert auth_method config options
Please login to merge, or discard this patch.