@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | unset ($mainfileKeys['XOOPS_PROT']); |
59 | 59 | if (!defined('XOOPS_PROT')) { |
60 | 60 | $parts = parse_url(XOOPS_URL); |
61 | - $http = (empty($parts['scheme']) ? 'http' : $parts['scheme']) . '://'; |
|
61 | + $http = (empty($parts['scheme']) ? 'http' : $parts['scheme']).'://'; |
|
62 | 62 | define('XOOPS_PROT', $http); |
63 | 63 | unset($parts, $http); |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // we have what we need so continue |
67 | 67 | if ($loadCommon) { |
68 | 68 | unset($xoopsOption['nocommon']); |
69 | - include XOOPS_ROOT_PATH . '/include/common.php'; |
|
69 | + include XOOPS_ROOT_PATH.'/include/common.php'; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | unset($loadCommon); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | */ |
73 | 73 | public function apply() |
74 | 74 | { |
75 | - $patchStatus = $this->isApplied(); |
|
75 | + $patchStatus = $this->isApplied(); |
|
76 | 76 | $tasks = $patchStatus->tasks; |
77 | 77 | foreach ($tasks as $task) { |
78 | 78 | $res = $this->{"apply_{$task}"}(); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | foreach ($this->upgradeQueue as $directory => $patch) { |
185 | 185 | if (!$patch->applied) { |
186 | - $next = $directory; |
|
186 | + $next = $directory; |
|
187 | 187 | break; |
188 | 188 | } |
189 | 189 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function oneButtonContinueForm($action = 'index.php', $parameters = array('action' =>'next')) |
202 | 202 | { |
203 | - $form = '<form action="' . $action . '" method="post">'; |
|
204 | - $form .= '<button class="btn btn-lg btn-success" type="submit">' . _CONTINUE; |
|
203 | + $form = '<form action="'.$action.'" method="post">'; |
|
204 | + $form .= '<button class="btn btn-lg btn-success" type="submit">'._CONTINUE; |
|
205 | 205 | $form .= ' <span class="fa fa-caret-right"></span></button>'; |
206 | 206 | foreach ($parameters as $name => $value) { |
207 | - $form .= '<input type="hidden" name="' . $name . '" value="' . $value . '">'; |
|
207 | + $form .= '<input type="hidden" name="'.$name.'" value="'.$value.'">'; |
|
208 | 208 | } |
209 | 209 | $form .= '</form>'; |
210 | 210 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public function check_config_type() |
12 | 12 | { |
13 | 13 | $db = $GLOBALS['xoopsDB']; |
14 | - $sql = 'SHOW COLUMNS FROM ' . $db->prefix('config') . " LIKE 'conf_title'"; |
|
14 | + $sql = 'SHOW COLUMNS FROM '.$db->prefix('config')." LIKE 'conf_title'"; |
|
15 | 15 | $result = $db->queryF($sql); |
16 | 16 | while (false !== ($row = $db->fetchArray($result))) { |
17 | 17 | if (strtolower(trim($row['Type'])) === 'varchar(255)') { |
@@ -48,7 +48,7 @@ discard block |
||
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 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $row = $db->fetchRow($result); |
51 | 51 | if ($row) { |
52 | 52 | $count = $row[0]; |
53 | - return (0 === (int) $count) ? true : false; |
|
53 | + return (0 === (int)$count) ? true : false; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function check_protectordata() |
83 | 83 | { |
84 | - $destinationPath = XOOPS_VAR_PATH . '/protector/'; |
|
84 | + $destinationPath = XOOPS_VAR_PATH.'/protector/'; |
|
85 | 85 | return file_exists($destinationPath); |
86 | 86 | } |
87 | 87 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | public function apply_protectordata() |
94 | 94 | { |
95 | 95 | $returnResult = false; |
96 | - $sourcePath = XOOPS_PATH . '/modules/protector/configs/'; |
|
97 | - $destinationPath = XOOPS_VAR_PATH . '/protector/'; |
|
96 | + $sourcePath = XOOPS_PATH.'/modules/protector/configs/'; |
|
97 | + $destinationPath = XOOPS_VAR_PATH.'/protector/'; |
|
98 | 98 | |
99 | 99 | if (!file_exists($destinationPath)) { |
100 | 100 | mkdir($destinationPath); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | $returnResult = true; |
105 | 105 | while (false !== ($entry = $directory->read())) { |
106 | 106 | if ('.' !== $entry && '..' !== $entry) { |
107 | - $src = $sourcePath . $entry; |
|
108 | - $dest = $destinationPath . $entry; |
|
107 | + $src = $sourcePath.$entry; |
|
108 | + $dest = $destinationPath.$entry; |
|
109 | 109 | $result = copy($src, $dest); |
110 | 110 | if (false === $result) { |
111 | 111 | $returnResult = false; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | $msg = $myts->htmlspecialchars($msg, ENT_QUOTES, _UPGRADE_CHARSET, false); |
48 | 48 | |
49 | - return '<span class="result-y">y</span> ' . $msg; |
|
49 | + return '<span class="result-y">y</span> '.$msg; |
|
50 | 50 | } else { |
51 | 51 | switch ($path) { |
52 | 52 | case 'lib': |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | } |
58 | 58 | $msg = $myts->htmlspecialchars($msg, ENT_QUOTES, _UPGRADE_CHARSET, false); |
59 | 59 | |
60 | - return '<span class="result-x">x</span> ' . $msg; |
|
60 | + return '<span class="result-x">x</span> '.$msg; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -$vars =& $_SESSION['settings']; |
|
64 | +$vars = & $_SESSION['settings']; |
|
65 | 65 | $ctrl = new PathStuffController(); |
66 | 66 | if ($res = $ctrl->execute()) { |
67 | 67 | return $res; |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | <div><?php echo genPathCheckHtml('data', $ctrl->validPath['data']); ?></div> |
84 | 84 | <?php if ($ctrl->validPath['data'] && !empty($ctrl->permErrors['data'])) { ?> |
85 | 85 | <div id="dataperms" class="x2-note"> |
86 | - <?php echo CHECKING_PERMISSIONS . '<br><p>' . ERR_NEED_WRITE_ACCESS . '</p>'; ?> |
|
86 | + <?php echo CHECKING_PERMISSIONS.'<br><p>'.ERR_NEED_WRITE_ACCESS.'</p>'; ?> |
|
87 | 87 | <ul class="diags"> |
88 | 88 | <?php foreach ($ctrl->permErrors['data'] as $path => $result) { |
89 | 89 | if ($result) { |
90 | - echo '<li class="success">' . sprintf(IS_WRITABLE, $path) . '</li>'; |
|
90 | + echo '<li class="success">'.sprintf(IS_WRITABLE, $path).'</li>'; |
|
91 | 91 | } else { |
92 | - echo '<li class="failure">' . sprintf(IS_NOT_WRITABLE, $path) . '</li>'; |
|
92 | + echo '<li class="failure">'.sprintf(IS_NOT_WRITABLE, $path).'</li>'; |
|
93 | 93 | } |
94 | 94 | } ?> |
95 | 95 | </ul> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | die('Bad installation: please add this folder to the XOOPS install you want to upgrade'); |
28 | 28 | } |
29 | 29 | |
30 | -$vars =& $_SESSION['settings']; |
|
30 | +$vars = & $_SESSION['settings']; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @return array |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | |
90 | 90 | $field = "<label for='$name'>$label</label>\n"; |
91 | 91 | if ($help) { |
92 | - $field .= '<div class="xoform-help">' . $help . "</div>\n"; |
|
92 | + $field .= '<div class="xoform-help">'.$help."</div>\n"; |
|
93 | 93 | } |
94 | 94 | $field .= "<select name='$name' id='$name'\">"; |
95 | - $field .= "<option value=''>" . DB_COLLATION_NOCHANGE . '</option>'; |
|
95 | + $field .= "<option value=''>".DB_COLLATION_NOCHANGE.'</option>'; |
|
96 | 96 | |
97 | 97 | $collation_default = ''; |
98 | 98 | $options = ''; |
99 | 99 | foreach ($collations as $key => $charset) { |
100 | 100 | $field .= "<optgroup label='{$key} - ({$charset['desc']})'>"; |
101 | 101 | foreach ($charset['collation'] as $collation) { |
102 | - $field .= "<option value='{$collation}'" . (($value == $collation) ? " selected='selected'" : '') . ">{$collation}</option>"; |
|
102 | + $field .= "<option value='{$collation}'".(($value == $collation) ? " selected='selected'" : '').">{$collation}</option>"; |
|
103 | 103 | } |
104 | 104 | $field .= '</optgroup>'; |
105 | 105 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | ?> |
125 | 125 | <?php if (!empty($error)) { |
126 | - echo '<div class="x2-note error">' . $error . "</div>\n"; |
|
126 | + echo '<div class="x2-note error">'.$error."</div>\n"; |
|
127 | 127 | } ?> |
128 | 128 | |
129 | 129 | <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method='post'> |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | } elseif (defined('XOOPS_TRUST_PATH')) { |
51 | 51 | $this->xoopsPath['lib'] = XOOPS_TRUST_PATH; |
52 | 52 | } else { |
53 | - $this->xoopsPath['lib'] = dirname($path) . '/xoops_lib'; |
|
54 | - if (!is_dir($this->xoopsPath['lib'] . '/')) { |
|
55 | - $this->xoopsPath['lib'] = $path . '/xoops_lib'; |
|
53 | + $this->xoopsPath['lib'] = dirname($path).'/xoops_lib'; |
|
54 | + if (!is_dir($this->xoopsPath['lib'].'/')) { |
|
55 | + $this->xoopsPath['lib'] = $path.'/xoops_lib'; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | if (defined('XOOPS_VAR_PATH')) { |
59 | 59 | $this->xoopsPath['data'] = XOOPS_VAR_PATH; |
60 | 60 | } else { |
61 | - $this->xoopsPath['data'] = dirname($path) . '/xoops_data'; |
|
62 | - if (!is_dir($this->xoopsPath['data'] . '/')) { |
|
63 | - $this->xoopsPath['data'] = $path . '/xoops_data'; |
|
61 | + $this->xoopsPath['data'] = dirname($path).'/xoops_data'; |
|
62 | + if (!is_dir($this->xoopsPath['data'].'/')) { |
|
63 | + $this->xoopsPath['data'] = $path.'/xoops_data'; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | } |
@@ -166,19 +166,19 @@ discard block |
||
166 | 166 | if (is_array($path)) { |
167 | 167 | foreach (array_keys($path) as $item) { |
168 | 168 | if (is_string($item)) { |
169 | - $error[$parent . '/' . $item] = $this->makeWritable($parent . '/' . $item); |
|
169 | + $error[$parent.'/'.$item] = $this->makeWritable($parent.'/'.$item); |
|
170 | 170 | if (empty($path[$item])) { |
171 | 171 | continue; |
172 | 172 | } |
173 | 173 | foreach ($path[$item] as $child) { |
174 | - $this->setPermission($parent . '/' . $item, $child, $error); |
|
174 | + $this->setPermission($parent.'/'.$item, $child, $error); |
|
175 | 175 | } |
176 | 176 | } else { |
177 | - $error[$parent . '/' . $path[$item]] = $this->makeWritable($parent . '/' . $path[$item]); |
|
177 | + $error[$parent.'/'.$path[$item]] = $this->makeWritable($parent.'/'.$path[$item]); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | } else { |
181 | - $error[$parent . '/' . $path] = $this->makeWritable($parent . '/' . $path); |
|
181 | + $error[$parent.'/'.$path] = $this->makeWritable($parent.'/'.$path); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return null; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function checkPermissions($path = 'data') |
193 | 193 | { |
194 | - $paths = array( |
|
194 | + $paths = array( |
|
195 | 195 | 'data' => array( |
196 | 196 | 'caches' => array( |
197 | 197 | 'xoops_cache', |
@@ -233,23 +233,23 @@ discard block |
||
233 | 233 | return false; |
234 | 234 | } else { |
235 | 235 | $perm = 6; |
236 | - @mkdir($path, octdec('0' . $perm . '00')); |
|
236 | + @mkdir($path, octdec('0'.$perm.'00')); |
|
237 | 237 | } |
238 | 238 | } else { |
239 | 239 | $perm = is_dir($path) ? 6 : 7; |
240 | 240 | } |
241 | 241 | if (!is_writable($path)) { |
242 | 242 | // First try using owner bit |
243 | - @chmod($path, octdec('0' . $perm . '00')); |
|
243 | + @chmod($path, octdec('0'.$perm.'00')); |
|
244 | 244 | clearstatcache(); |
245 | 245 | if (!is_writable($path) && $group !== false) { |
246 | 246 | // If group has been specified, try using the group bit |
247 | 247 | @chgrp($path, $group); |
248 | - @chmod($path, octdec('0' . $perm . $perm . '0')); |
|
248 | + @chmod($path, octdec('0'.$perm.$perm.'0')); |
|
249 | 249 | } |
250 | 250 | clearstatcache(); |
251 | 251 | if (!is_writable($path)) { |
252 | - @chmod($path, octdec('0' . $perm . $perm . $perm)); |
|
252 | + @chmod($path, octdec('0'.$perm.$perm.$perm)); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | clearstatcache(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @author Taiwen Jiang <[email protected]> |
23 | 23 | */ |
24 | 24 | |
25 | -include_once __DIR__ . '/pathcontroller.php'; |
|
25 | +include_once __DIR__.'/pathcontroller.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class upgrade_230 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function check_config() |
47 | 47 | { |
48 | - $sql = 'SELECT COUNT(*) FROM `' . $GLOBALS['xoopsDB']->prefix('config') . "` WHERE `conf_name` IN ('welcome_type', 'cpanel')"; |
|
48 | + $sql = 'SELECT COUNT(*) FROM `'.$GLOBALS['xoopsDB']->prefix('config')."` WHERE `conf_name` IN ('welcome_type', 'cpanel')"; |
|
49 | 49 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
50 | 50 | return false; |
51 | 51 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function check_cache() |
62 | 62 | { |
63 | - $sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix('cache_model') . "'"; |
|
63 | + $sql = "SHOW TABLES LIKE '".$GLOBALS['xoopsDB']->prefix('cache_model')."'"; |
|
64 | 64 | $result = $GLOBALS['xoopsDB']->queryF($sql); |
65 | 65 | if (!$result) { |
66 | 66 | return false; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | // MySQL 5.0+ |
88 | 88 | //$sql = "SHOW KEYS FROM `" . $GLOBALS['xoopsDB']->prefix('block_module_link') . "` WHERE `KEY_NAME` LIKE 'PRIMARY'"; |
89 | - $sql = 'SHOW KEYS FROM `' . $GLOBALS['xoopsDB']->prefix('block_module_link') . '`'; |
|
89 | + $sql = 'SHOW KEYS FROM `'.$GLOBALS['xoopsDB']->prefix('block_module_link').'`'; |
|
90 | 90 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
91 | 91 | return false; |
92 | 92 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function apply_bmlink() |
106 | 106 | { |
107 | - $sql = 'SHOW KEYS FROM `' . $GLOBALS['xoopsDB']->prefix('block_module_link') . '`'; |
|
107 | + $sql = 'SHOW KEYS FROM `'.$GLOBALS['xoopsDB']->prefix('block_module_link').'`'; |
|
108 | 108 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
109 | 109 | return false; |
110 | 110 | } |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | foreach ($keys_drop as $drop) { |
122 | - $sql = 'ALTER TABLE `' . $GLOBALS['xoopsDB']->prefix('block_module_link') . "` DROP KEY `{$drop}`"; |
|
122 | + $sql = 'ALTER TABLE `'.$GLOBALS['xoopsDB']->prefix('block_module_link')."` DROP KEY `{$drop}`"; |
|
123 | 123 | $GLOBALS['xoopsDB']->queryF($sql); |
124 | 124 | } |
125 | 125 | if ($primary_add) { |
126 | - $sql = 'ALTER IGNORE TABLE `' . $GLOBALS['xoopsDB']->prefix('block_module_link') . '` ADD PRIMARY KEY (`block_id`, `module_id`)'; |
|
126 | + $sql = 'ALTER IGNORE TABLE `'.$GLOBALS['xoopsDB']->prefix('block_module_link').'` ADD PRIMARY KEY (`block_id`, `module_id`)'; |
|
127 | 127 | |
128 | 128 | return $GLOBALS['xoopsDB']->queryF($sql); |
129 | 129 | } |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | { |
139 | 139 | $result = true; |
140 | 140 | if (!isset($GLOBALS['xoopsConfig']['cpanel'])) { |
141 | - $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->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)"; |
|
141 | + $sql = 'INSERT INTO '.$GLOBALS['xoopsDB']->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)"; |
|
142 | 142 | |
143 | 143 | $result *= $GLOBALS['xoopsDB']->queryF($sql); |
144 | 144 | } |
145 | 145 | |
146 | 146 | $welcometype_installed = false; |
147 | - $sql = 'SELECT COUNT(*) FROM `' . $GLOBALS['xoopsDB']->prefix('config') . "` WHERE `conf_name` = 'welcome_type'"; |
|
147 | + $sql = 'SELECT COUNT(*) FROM `'.$GLOBALS['xoopsDB']->prefix('config')."` WHERE `conf_name` = 'welcome_type'"; |
|
148 | 148 | if ($result = $GLOBALS['xoopsDB']->queryF($sql)) { |
149 | 149 | list($count) = $GLOBALS['xoopsDB']->fetchRow($result); |
150 | 150 | if ($count == 1) { |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | if (!$welcometype_installed) { |
155 | - $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->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)"; |
|
155 | + $sql = 'INSERT INTO '.$GLOBALS['xoopsDB']->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)"; |
|
156 | 156 | |
157 | 157 | if (!$GLOBALS['xoopsDB']->queryF($sql)) { |
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | $config_id = $GLOBALS['xoopsDB']->getInsertId(); |
161 | 161 | |
162 | - $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->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})"; |
|
162 | + $sql = 'INSERT INTO '.$GLOBALS['xoopsDB']->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})"; |
|
163 | 163 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
164 | 164 | return false; |
165 | 165 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | { |
173 | 173 | $allowWebChanges = $GLOBALS['xoopsDB']->allowWebChanges; |
174 | 174 | $GLOBALS['xoopsDB']->allowWebChanges = true; |
175 | - $result = $GLOBALS['xoopsDB']->queryFromFile(__DIR__ . '/mysql.structure.sql'); |
|
175 | + $result = $GLOBALS['xoopsDB']->queryFromFile(__DIR__.'/mysql.structure.sql'); |
|
176 | 176 | $GLOBALS['xoopsDB']->allowWebChanges = $allowWebChanges; |
177 | 177 | |
178 | 178 | return $result; |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function convert_db($charset, $collation) |
263 | 263 | { |
264 | - $sql = 'ALTER DATABASE `' . XOOPS_DB_NAME . '` DEFAULT CHARACTER SET ' . $GLOBALS['xoopsDB']->quote($charset) . ' COLLATE ' . $GLOBALS['xoopsDB']->quote($collation); |
|
264 | + $sql = 'ALTER DATABASE `'.XOOPS_DB_NAME.'` DEFAULT CHARACTER SET '.$GLOBALS['xoopsDB']->quote($charset).' COLLATE '.$GLOBALS['xoopsDB']->quote($collation); |
|
265 | 265 | if (!$GLOBALS['xoopsDB']->queryF($sql)) { |
266 | 266 | return false; |
267 | 267 | } |
268 | - if (!$result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '" . XOOPS_DB_PREFIX . "\_%'")) { |
|
268 | + if (!$result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '".XOOPS_DB_PREFIX."\_%'")) { |
|
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | $tables = array(); |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | while (false !== ($result = $GLOBALS['xoopsDB']->fetchArray($resource))) { |
306 | 306 | if (preg_match('/(char)|(text)|(enum)|(set)/', $result['Type'])) { |
307 | 307 | // String Type SQL Sentence. |
308 | - $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'; |
|
308 | + $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'; |
|
309 | 309 | |
310 | 310 | // Binary String Type SQL Sentence. |
311 | 311 | if (preg_match('/(enum)|(set)/', $result['Type'])) { |
312 | - $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'; |
|
312 | + $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'; |
|
313 | 313 | } else { |
314 | 314 | $result['Type'] = str_replace('char', 'binary', $result['Type']); |
315 | 315 | $result['Type'] = str_replace('text', 'blob', $result['Type']); |
316 | - $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'; |
|
316 | + $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'; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | $tmp_gen_index_query = "ALTER TABLE `$table` ADD FULLTEXT `$key_name`("; |
335 | 335 | $fields_names = array_keys($column); |
336 | 336 | for ($i = 1; $i <= count($column); ++$i) { |
337 | - $tmp_gen_index_query .= $fields_names[$i - 1] . (($i == count($column)) ? '' : ', '); |
|
337 | + $tmp_gen_index_query .= $fields_names[$i - 1].(($i == count($column)) ? '' : ', '); |
|
338 | 338 | } |
339 | - $gen_index_querys[] = $tmp_gen_index_query . ')'; |
|
339 | + $gen_index_querys[] = $tmp_gen_index_query.')'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
@@ -371,23 +371,23 @@ discard block |
||
371 | 371 | return false; |
372 | 372 | } |
373 | 373 | |
374 | - $file = __DIR__ . '/mainfile.dist.php'; |
|
374 | + $file = __DIR__.'/mainfile.dist.php'; |
|
375 | 375 | |
376 | 376 | $lines = file($file); |
377 | 377 | foreach (array_keys($lines) as $ln) { |
378 | 378 | if (preg_match("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", $lines[$ln], $matches)) { |
379 | 379 | $val = isset($vars[$matches[3]]) ? (string)constant($matches[3]) : (defined($matches[3]) ? (string)constant($matches[3]) : '0'); |
380 | - $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", "define('" . $matches[3] . "', " . $val . ' )', $lines[$ln]); |
|
380 | + $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([0-9]+)\s*\)/", "define('".$matches[3]."', ".$val.' )', $lines[$ln]); |
|
381 | 381 | } elseif (preg_match("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([\"'])([^\"']*?)\\4\s*\)/", $lines[$ln], $matches)) { |
382 | 382 | $val = isset($vars[$matches[3]]) ? (string)$vars[$matches[3]] : (defined($matches[3]) ? (string)constant($matches[3]) : ''); |
383 | - $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([\"'])(.*?)\\4\s*\)/", "define('" . $matches[3] . "', '" . $val . "' )", $lines[$ln]); |
|
383 | + $lines[$ln] = preg_replace("/(define\()([\"'])(XOOPS_[^\"']+)\\2,\s*([\"'])(.*?)\\4\s*\)/", "define('".$matches[3]."', '".$val."' )", $lines[$ln]); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | |
387 | - $fp = fopen(XOOPS_ROOT_PATH . '/mainfile.php', 'wt'); |
|
387 | + $fp = fopen(XOOPS_ROOT_PATH.'/mainfile.php', 'wt'); |
|
388 | 388 | if (!$fp) { |
389 | 389 | echo ERR_COULD_NOT_WRITE_MAINFILE; |
390 | - 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>'; |
|
390 | + 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>'; |
|
391 | 391 | |
392 | 392 | return false; |
393 | 393 | } else { |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | public function set_configs($task) |
410 | 410 | { |
411 | 411 | $ret = array(); |
412 | - $configs = include __DIR__ . "/settings_{$task}.php"; |
|
412 | + $configs = include __DIR__."/settings_{$task}.php"; |
|
413 | 413 | if (!$configs || !is_array($configs)) { |
414 | 414 | return $ret; |
415 | 415 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | foreach ($configs as $key => $val) { |
421 | - $ret['XOOPS_' . $key] = $val; |
|
421 | + $ret['XOOPS_'.$key] = $val; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | return $ret; |