@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public static function filterInput ($type, $variableName, $filter, $default = null) |
|
47 | + public static function filterInput($type, $variableName, $filter, $default = null) |
|
48 | 48 | { |
49 | 49 | $return = filter_input($type, $variableName, $filter); |
50 | 50 | return (is_null($return) || $return === false) ? $default : $return; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return mixed |
60 | 60 | */ |
61 | - public static function filterInputArray ($type, Array $definition) |
|
61 | + public static function filterInputArray($type, Array $definition) |
|
62 | 62 | { |
63 | 63 | return filter_input_array($type, $definition); |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return mixed |
74 | 74 | */ |
75 | - public static function filterVar ($variable, $filter, $default = null) |
|
75 | + public static function filterVar($variable, $filter, $default = null) |
|
76 | 76 | { |
77 | 77 | $return = filter_var($variable, $filter); |
78 | 78 | return ($return === false) ? $default : $return; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $urlData = []; |
89 | 89 | $cleanUrlData = []; |
90 | 90 | |
91 | - if (! isset($_SERVER['QUERY_STRING'])) { |
|
91 | + if (!isset($_SERVER['QUERY_STRING'])) { |
|
92 | 92 | return ''; |
93 | 93 | } |
94 | 94 |
@@ -175,8 +175,8 @@ |
||
175 | 175 | $result = $this->_config->getDb()->query($query); |
176 | 176 | |
177 | 177 | if ($result) { |
178 | - $res = $this->_config->getDb()->fetchObject($result); |
|
179 | - $timestamp = $res->time; |
|
178 | + $res = $this->_config->getDb()->fetchObject($result); |
|
179 | + $timestamp = $res->time; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return $timestamp; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | if (0 == $bots && false == $banned) { |
113 | 113 | if (!isset($sid)) { |
114 | - $sid = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix() . 'faqsessions', 'sid'); |
|
114 | + $sid = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix().'faqsessions', 'sid'); |
|
115 | 115 | // Sanity check: force the session cookie to contains the current $sid |
116 | 116 | if (!is_null($sidc) && (!$sidc != $sid)) { |
117 | 117 | self::setCookie(self::PMF_COOKIE_NAME_SESSIONID, $sid); |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | $this->_config->getDb()->query($query); |
133 | 133 | } |
134 | 134 | |
135 | - $data = $sid.';' . |
|
136 | - str_replace(';', ',', $action) . ';' . |
|
137 | - $id . ';' . |
|
138 | - $remoteAddr . ';' . |
|
139 | - str_replace(';', ',', isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '') . ';' . |
|
140 | - str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . ';' . |
|
141 | - str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])) . ';' . |
|
142 | - $_SERVER['REQUEST_TIME'] . ";\n"; |
|
143 | - $file = './data/tracking' . date('dmY'); |
|
135 | + $data = $sid.';'. |
|
136 | + str_replace(';', ',', $action).';'. |
|
137 | + $id.';'. |
|
138 | + $remoteAddr.';'. |
|
139 | + str_replace(';', ',', isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '').';'. |
|
140 | + str_replace(';', ',', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '').';'. |
|
141 | + str_replace(';', ',', urldecode($_SERVER['HTTP_USER_AGENT'])).';'. |
|
142 | + $_SERVER['REQUEST_TIME'].";\n"; |
|
143 | + $file = './data/tracking'.date('dmY'); |
|
144 | 144 | |
145 | 145 | if (is_writeable($file)) { |
146 | 146 | file_put_contents($file, $data, FILE_APPEND); |
147 | 147 | } else { |
148 | - throw new PMF_Exception('Cannot write to ' . $file); |
|
148 | + throw new PMF_Exception('Cannot write to '.$file); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | // Set the correct HTTP headers: |
209 | 209 | // 1. Prevent proxies&browsers caching |
210 | - $this->response->headers->set("Last-Modified", gmdate("D, d M Y H:i:s") . " GMT"); |
|
210 | + $this->response->headers->set("Last-Modified", gmdate("D, d M Y H:i:s")." GMT"); |
|
211 | 211 | $this->response->headers->set("Expires", "0"); |
212 | 212 | $this->response->headers->set("Cache-Control", "private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); |
213 | 213 | $this->response->headers->set("Pragma", "no-cache"); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $this->response->headers->set("Content-Type", $mimeType); |
221 | 221 | } |
222 | 222 | // RFC2616, �19.5.1: $filename must be a quoted-string |
223 | - $this->response->headers->set("Content-Disposition", $this->disposition."; filename=\"" . PMF_Export::getExportTimestamp() . "_" . $filename."\""); |
|
223 | + $this->response->headers->set("Content-Disposition", $this->disposition."; filename=\"".PMF_Export::getExportTimestamp()."_".$filename."\""); |
|
224 | 224 | if (!empty($description)) { |
225 | 225 | $this->response->headers->set("Content-Description", $description); |
226 | 226 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | { |
155 | 155 | $templates = []; |
156 | 156 | |
157 | - foreach (new DirectoryIterator(PMF_ROOT_DIR . '/assets/template') as $item) { |
|
157 | + foreach (new DirectoryIterator(PMF_ROOT_DIR.'/assets/template') as $item) { |
|
158 | 158 | $basename = $item->getBasename(); |
159 | - if (! $item->isDot() && $item->isDir()) { |
|
159 | + if (!$item->isDot() && $item->isDir()) { |
|
160 | 160 | $templates[$basename] = (PMF_Template::getTplSetName() === $basename ? true : false); |
161 | 161 | } |
162 | 162 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function checkphpMyFAQInstallation() |
309 | 309 | { |
310 | - if (is_file(PMF_ROOT_DIR . '/config/database.php')) { |
|
310 | + if (is_file(PMF_ROOT_DIR.'/config/database.php')) { |
|
311 | 311 | return false; |
312 | 312 | } else { |
313 | 313 | return true; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | foreach ($files as $file) { |
368 | 368 | |
369 | 369 | if ('php' === pathinfo($file->getFilename(), PATHINFO_EXTENSION) && |
370 | - ! preg_match('#/tests/#', $file->getPath()) |
|
370 | + !preg_match('#/tests/#', $file->getPath()) |
|
371 | 371 | ) { |
372 | 372 | $current = str_replace($path, '', $file->getPathname()); |
373 | 373 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | } |
380 | 380 | |
381 | 381 | } catch (UnexpectedValueException $e) { |
382 | - $hashes[$current . ' failed'] = $e->getMessage(); |
|
382 | + $hashes[$current.' failed'] = $e->getMessage(); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | return json_encode($hashes); |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | public function cleanInstallation() |
410 | 410 | { |
411 | 411 | // Remove './config/database.php' file: no need of prompt anything to the user |
412 | - if (file_exists(PMF_ROOT_DIR . '/config/database.php')) { |
|
413 | - @unlink(PMF_ROOT_DIR . '/config/database.php'); |
|
412 | + if (file_exists(PMF_ROOT_DIR.'/config/database.php')) { |
|
413 | + @unlink(PMF_ROOT_DIR.'/config/database.php'); |
|
414 | 414 | } |
415 | 415 | // Remove './config/ldap.php' file: no need of prompt anything to the user |
416 | - if (file_exists(PMF_ROOT_DIR . '/config/ldap.php')) { |
|
417 | - @unlink(PMF_ROOT_DIR . '/config/ldap.php'); |
|
416 | + if (file_exists(PMF_ROOT_DIR.'/config/ldap.php')) { |
|
417 | + @unlink(PMF_ROOT_DIR.'/config/ldap.php'); |
|
418 | 418 | } |
419 | 419 | } |
420 | 420 |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->base = $ldapBase; |
107 | 107 | $this->ds = ldap_connect($ldapServer, $ldapPort); |
108 | 108 | |
109 | - if (! $this->ds) { |
|
109 | + if (!$this->ds) { |
|
110 | 110 | $this->error = sprintf( |
111 | 111 | 'Unable to connect to LDAP server (Error: %s)', |
112 | 112 | ldap_error($this->ds) |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | // optionally set Bind version |
119 | 119 | if (isset($this->_ldapConfig['ldap_options'])) { |
120 | 120 | foreach ($this->_ldapConfig['ldap_options'] as $key => $value) { |
121 | - if (! ldap_set_option($this->ds, constant($key), $value)) { |
|
121 | + if (!ldap_set_option($this->ds, constant($key), $value)) { |
|
122 | 122 | $this->errno = ldap_errno($this->ds); |
123 | 123 | $this->error = sprintf( |
124 | 124 | 'Unable to set LDAP option "%s" to "%s" (Error: %s).', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $ldapBind = ldap_bind($this->ds, $ldapUser, $ldapPassword); |
138 | 138 | } |
139 | 139 | |
140 | - if (! $ldapBind) { |
|
140 | + if (!$ldapBind) { |
|
141 | 141 | $this->errno = ldap_errno($this->ds); |
142 | 142 | $this->error = sprintf( |
143 | 143 | 'Unable to bind to LDAP server (Error: %s).', |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @return string |
211 | 211 | */ |
212 | - private function getLdapData ($username, $data) |
|
212 | + private function getLdapData($username, $data) |
|
213 | 213 | { |
214 | 214 | if (!array_key_exists($data, $this->_ldapConfig['ldap_mapping'])) { |
215 | 215 | $this->error = sprintf( |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | ); |
275 | 275 | $sr = ldap_search($this->ds, $this->base, $filter); |
276 | 276 | |
277 | - if (! $sr) { |
|
277 | + if (!$sr) { |
|
278 | 278 | $this->errno = ldap_errno($this->ds); |
279 | 279 | $this->error = sprintf( |
280 | 280 | 'Unable to search for "%s" (Error: %s)', |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | $entryId = ldap_first_entry($this->ds, $sr); |
287 | 287 | |
288 | - if (! $entryId) { |
|
288 | + if (!$entryId) { |
|
289 | 289 | $this->errno = ldap_errno($this->ds); |
290 | 290 | $this->error = sprintf( |
291 | 291 | 'Cannot get the value(s). Error: %s', |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | public function quote($string) |
307 | 307 | { |
308 | 308 | return str_replace( |
309 | - array( '\\', ' ', '*', '(', ')' ), |
|
310 | - array( '\\5c', '\\20', '\\2a', '\\28', '\\29' ), |
|
309 | + array('\\', ' ', '*', '(', ')'), |
|
310 | + array('\\5c', '\\20', '\\2a', '\\28', '\\29'), |
|
311 | 311 | $string |
312 | 312 | ); |
313 | 313 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | if (PMF_Language::isASupportedLanguage($ajaxLanguage)) { |
43 | 43 | $languageCode = trim($ajaxLanguage); |
44 | - require_once 'lang/language_' . $languageCode . '.php'; |
|
44 | + require_once 'lang/language_'.$languageCode.'.php'; |
|
45 | 45 | } else { |
46 | 46 | $languageCode = 'en'; |
47 | 47 | require_once 'lang/language_en.php'; |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | |
20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
21 | 21 | $protocol = 'http'; |
22 | - if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
22 | + if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
23 | 23 | $protocol = 'https'; |
24 | 24 | } |
25 | - header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])); |
|
25 | + header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
|
26 | 26 | exit(); |
27 | 27 | } |
28 | 28 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | $showAllNews = sprintf('<a href="?%s">%s</a>', $sids, $PMF_LANG['newsShowCurrent']); |
38 | 38 | $archived = true; |
39 | 39 | } else { |
40 | - $writeNewsHeader .= ' ' . $PMF_LANG['msgNews']; |
|
40 | + $writeNewsHeader .= ' '.$PMF_LANG['msgNews']; |
|
41 | 41 | if ($faqConfig->get('main.enableRssFeeds')) { |
42 | - $writeNewsRSS = ' <a href="feed/news/rss.php" target="_blank">' . |
|
42 | + $writeNewsRSS = ' <a href="feed/news/rss.php" target="_blank">'. |
|
43 | 43 | '<i class="fa fa-rss"></i></a>'; |
44 | 44 | } |
45 | 45 | $showAllNews = sprintf('<a href="?%snewsid=0">%s</a>', $sids, $PMF_LANG['newsShowArchive']); |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | if (version_compare($version, '2.8.0-alpha2', '>=')) { |
105 | 105 | if (! $faqConfig->get('main.maintenanceMode')) { |
106 | 106 | echo '<p class="alert alert-warning"><strong>Warning!</strong> Your phpMyFAQ installation is ' . |
107 | - 'not in maintenance mode, you should enable the maintenance mode in your administration ' . |
|
108 | - 'backend before running the update!</p>'; |
|
107 | + 'not in maintenance mode, you should enable the maintenance mode in your administration ' . |
|
108 | + 'backend before running the update!</p>'; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | ?> |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (file_exists(PMF_ROOT_DIR . '/config/database.php')) { |
214 | 214 | if (!copy(PMF_ROOT_DIR . '/config/database.php', PMF_ROOT_DIR . '/config/database.bak.php')) { |
215 | 215 | echo "<p class=\"alert alert-danger\"><strong>Error:</strong> The backup file ../config/database.bak.php " . |
216 | - "could not be written. Please correct this!</p>"; |
|
216 | + "could not be written. Please correct this!</p>"; |
|
217 | 217 | } else { |
218 | 218 | $checkDatabaseSetupFile = true; |
219 | 219 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | if (file_exists(PMF_ROOT_DIR . '/config/ldap.php')) { |
224 | 224 | if (!copy(PMF_ROOT_DIR . '/config/ldap.php', PMF_ROOT_DIR . '/config/ldap.bak.php')) { |
225 | 225 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> The backup file ../config/ldap.bak.php " . |
226 | - "could not be written. Please correct this!</p>"; |
|
226 | + "could not be written. Please correct this!</p>"; |
|
227 | 227 | } else { |
228 | 228 | $checkLdapSetupFile = true; |
229 | 229 | } |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | if (!$result) { |
666 | 666 | echo "</div>"; |
667 | 667 | echo '<p class="alert alert-danger"><strong>Error:</strong> Please update your version of phpMyFAQ ' . |
668 | - 'once again or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.' . |
|
669 | - '</p>'; |
|
668 | + 'once again or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.' . |
|
669 | + '</p>'; |
|
670 | 670 | printf( |
671 | 671 | '<p class="alert alert-danger"><strong>DB error:</strong> %s</p>', |
672 | 672 | $faqConfig->getDb()->error() |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | printf('<span title="%s">.</span>', $executeQuery); |
834 | 834 | if (!$result) { |
835 | 835 | echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again ' . |
836 | - 'or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.</p>'; |
|
836 | + 'or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.</p>'; |
|
837 | 837 | printf('<p class="error"><strong>DB error:</strong> %s</p>', $faqConfig->getDb()->error()); |
838 | 838 | printf('<code>%s</code>', htmlentities($executeQuery)); |
839 | 839 | PMF_System::renderFooter(); |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | die("Sorry, but you need PHP 5.4.4 or later!"); // Die hard because of "use" |
32 | 32 | } |
33 | 33 | |
34 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
34 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
35 | 35 | |
36 | 36 | $step = PMF_Filter::filterInput(INPUT_GET, 'step', FILTER_VALIDATE_INT, 1); |
37 | 37 | $version = PMF_Filter::filterInput(INPUT_POST, 'version', FILTER_SANITIZE_STRING); |
38 | 38 | $query = []; |
39 | 39 | |
40 | 40 | if (file_exists(PMF_ROOT_DIR.'/inc/data.php')) { |
41 | - require PMF_ROOT_DIR . '/inc/data.php'; // before 2.6.0-alpha |
|
41 | + require PMF_ROOT_DIR.'/inc/data.php'; // before 2.6.0-alpha |
|
42 | 42 | } else { |
43 | - if (!file_exists(PMF_ROOT_DIR . '/config/database.php')) { |
|
43 | + if (!file_exists(PMF_ROOT_DIR.'/config/database.php')) { |
|
44 | 44 | header("Location: setup.php"); |
45 | 45 | exit(); |
46 | 46 | } |
47 | - require PMF_ROOT_DIR . '/config/database.php'; // after 2.6.0-alpha |
|
47 | + require PMF_ROOT_DIR.'/config/database.php'; // after 2.6.0-alpha |
|
48 | 48 | } |
49 | 49 | ?> |
50 | 50 | <!doctype html> |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | <?php |
103 | 103 | $version = $faqConfig->get('main.currentVersion'); |
104 | 104 | if (version_compare($version, '2.8.0-alpha2', '>=')) { |
105 | - if (! $faqConfig->get('main.maintenanceMode')) { |
|
106 | - echo '<p class="alert alert-warning"><strong>Warning!</strong> Your phpMyFAQ installation is ' . |
|
107 | - 'not in maintenance mode, you should enable the maintenance mode in your administration ' . |
|
105 | + if (!$faqConfig->get('main.maintenanceMode')) { |
|
106 | + echo '<p class="alert alert-warning"><strong>Warning!</strong> Your phpMyFAQ installation is '. |
|
107 | + 'not in maintenance mode, you should enable the maintenance mode in your administration '. |
|
108 | 108 | 'backend before running the update!</p>'; |
109 | 109 | } |
110 | 110 | } |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | |
211 | 211 | // The backup an existing config/database.php |
212 | 212 | // 2.6+ updates |
213 | - if (file_exists(PMF_ROOT_DIR . '/config/database.php')) { |
|
214 | - if (!copy(PMF_ROOT_DIR . '/config/database.php', PMF_ROOT_DIR . '/config/database.bak.php')) { |
|
215 | - echo "<p class=\"alert alert-danger\"><strong>Error:</strong> The backup file ../config/database.bak.php " . |
|
213 | + if (file_exists(PMF_ROOT_DIR.'/config/database.php')) { |
|
214 | + if (!copy(PMF_ROOT_DIR.'/config/database.php', PMF_ROOT_DIR.'/config/database.bak.php')) { |
|
215 | + echo "<p class=\"alert alert-danger\"><strong>Error:</strong> The backup file ../config/database.bak.php ". |
|
216 | 216 | "could not be written. Please correct this!</p>"; |
217 | 217 | } else { |
218 | 218 | $checkDatabaseSetupFile = true; |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | // The backup an existing LDAP configuration file |
223 | - if (file_exists(PMF_ROOT_DIR . '/config/ldap.php')) { |
|
224 | - if (!copy(PMF_ROOT_DIR . '/config/ldap.php', PMF_ROOT_DIR . '/config/ldap.bak.php')) { |
|
225 | - echo "<p class=\"alert alert-error\"><strong>Error:</strong> The backup file ../config/ldap.bak.php " . |
|
223 | + if (file_exists(PMF_ROOT_DIR.'/config/ldap.php')) { |
|
224 | + if (!copy(PMF_ROOT_DIR.'/config/ldap.php', PMF_ROOT_DIR.'/config/ldap.bak.php')) { |
|
225 | + echo "<p class=\"alert alert-error\"><strong>Error:</strong> The backup file ../config/ldap.bak.php ". |
|
226 | 226 | "could not be written. Please correct this!</p>"; |
227 | 227 | } else { |
228 | 228 | $checkLdapSetupFile = true; |
@@ -328,32 +328,32 @@ discard block |
||
328 | 328 | $faqConfig->add('socialnetworks.enableFacebookSupport', 'false'); |
329 | 329 | |
330 | 330 | // Migrate faqquestion table to new structure |
331 | - switch($DB['type']) { |
|
331 | + switch ($DB['type']) { |
|
332 | 332 | case 'pgsql': |
333 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions RENAME COLUMN ask_username TO username"; |
|
334 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions RENAME COLUMN ask_usermail TO email"; |
|
335 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions RENAME COLUMN ask_rubrik TO category_id"; |
|
336 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions RENAME COLUMN ask_content TO question"; |
|
337 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions RENAME COLUMN ask_date TO created"; |
|
333 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions RENAME COLUMN ask_username TO username"; |
|
334 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions RENAME COLUMN ask_usermail TO email"; |
|
335 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions RENAME COLUMN ask_rubrik TO category_id"; |
|
336 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions RENAME COLUMN ask_content TO question"; |
|
337 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions RENAME COLUMN ask_date TO created"; |
|
338 | 338 | break; |
339 | 339 | case 'mssql': |
340 | 340 | case 'sqlsrv': |
341 | - $query[] = "EXEC sp_RENAME '" . PMF_Db::getTablePrefix() . "faqquestions.ask_username', 'username', 'COLUMN'"; |
|
342 | - $query[] = "EXEC sp_RENAME '" . PMF_Db::getTablePrefix() . "faqquestions.ask_usermail', 'email', 'COLUMN'"; |
|
343 | - $query[] = "EXEC sp_RENAME '" . PMF_Db::getTablePrefix() . "faqquestions.ask_rubrik', 'category_id', 'COLUMN'"; |
|
344 | - $query[] = "EXEC sp_RENAME '" . PMF_Db::getTablePrefix() . "faqquestions.ask_content', 'question', 'COLUMN'"; |
|
345 | - $query[] = "EXEC sp_RENAME '" . PMF_Db::getTablePrefix() . "faqquestions.ask_date', 'created', 'COLUMN'"; |
|
341 | + $query[] = "EXEC sp_RENAME '".PMF_Db::getTablePrefix()."faqquestions.ask_username', 'username', 'COLUMN'"; |
|
342 | + $query[] = "EXEC sp_RENAME '".PMF_Db::getTablePrefix()."faqquestions.ask_usermail', 'email', 'COLUMN'"; |
|
343 | + $query[] = "EXEC sp_RENAME '".PMF_Db::getTablePrefix()."faqquestions.ask_rubrik', 'category_id', 'COLUMN'"; |
|
344 | + $query[] = "EXEC sp_RENAME '".PMF_Db::getTablePrefix()."faqquestions.ask_content', 'question', 'COLUMN'"; |
|
345 | + $query[] = "EXEC sp_RENAME '".PMF_Db::getTablePrefix()."faqquestions.ask_date', 'created', 'COLUMN'"; |
|
346 | 346 | break; |
347 | 347 | case 'mysqli': |
348 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions CHANGE ask_username username VARCHAR(100) NOT NULL"; |
|
349 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions CHANGE ask_usermail email VARCHAR(100) NOT NULL"; |
|
350 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions CHANGE ask_rubrik category_id INT(11) NOT NULL"; |
|
351 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions CHANGE ask_content question TEXT NOT NULL"; |
|
352 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions CHANGE ask_date created VARCHAR(20) NOT NULL"; |
|
348 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions CHANGE ask_username username VARCHAR(100) NOT NULL"; |
|
349 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions CHANGE ask_usermail email VARCHAR(100) NOT NULL"; |
|
350 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions CHANGE ask_rubrik category_id INT(11) NOT NULL"; |
|
351 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions CHANGE ask_content question TEXT NOT NULL"; |
|
352 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions CHANGE ask_date created VARCHAR(20) NOT NULL"; |
|
353 | 353 | break; |
354 | 354 | case 'sqlite': |
355 | 355 | $query[] = "BEGIN TRANSACTION"; |
356 | - $query[] = "CREATE TEMPORARY TABLE " . PMF_Db::getTablePrefix() . "faqquestions_temp ( |
|
356 | + $query[] = "CREATE TEMPORARY TABLE ".PMF_Db::getTablePrefix()."faqquestions_temp ( |
|
357 | 357 | id int(11) NOT NULL, |
358 | 358 | username varchar(100) NOT NULL, |
359 | 359 | email varchar(100) NOT NULL, |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | created varchar(20) NOT NULL, |
363 | 363 | is_visible char(1) default 'Y', |
364 | 364 | PRIMARY KEY (id))"; |
365 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqquestions_temp SELECT * FROM " . PMF_Db::getTablePrefix() . "faqquestions"; |
|
366 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqquestions"; |
|
367 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqquestions ( |
|
365 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqquestions_temp SELECT * FROM ".PMF_Db::getTablePrefix()."faqquestions"; |
|
366 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faqquestions"; |
|
367 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqquestions ( |
|
368 | 368 | id int(11) NOT NULL, |
369 | 369 | username varchar(100) NOT NULL, |
370 | 370 | email varchar(100) NOT NULL, |
@@ -373,42 +373,42 @@ discard block |
||
373 | 373 | created varchar(20) NOT NULL, |
374 | 374 | is_visible char(1) default 'Y', |
375 | 375 | PRIMARY KEY (id))"; |
376 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqquestions SELECT * FROM " . PMF_Db::getTablePrefix() . "faqquestions_temp"; |
|
377 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqquestions_temp"; |
|
376 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqquestions SELECT * FROM ".PMF_Db::getTablePrefix()."faqquestions_temp"; |
|
377 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faqquestions_temp"; |
|
378 | 378 | $query[] = "COMMIT"; |
379 | 379 | break; |
380 | 380 | } |
381 | 381 | |
382 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
382 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
383 | 383 | (34, 'addattachment', 'Right to add attachments', 1, 1)"; |
384 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
384 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
385 | 385 | (35, 'editattachment', 'Right to edit attachments', 1, 1)"; |
386 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
386 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
387 | 387 | (36, 'delattachment', 'Right to delete attachments', 1, 1)"; |
388 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
388 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
389 | 389 | (37, 'dlattachment', 'Right to download attachments', 1, 1)"; |
390 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 34)"; |
|
391 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 35)"; |
|
392 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 36)"; |
|
393 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 37)"; |
|
390 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 34)"; |
|
391 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 35)"; |
|
392 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 36)"; |
|
393 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 37)"; |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | // |
397 | 397 | // UPDATES FROM 2.7.0-alpha2 |
398 | 398 | // |
399 | 399 | if (version_compare($version, '2.7.0-alpha2', '<')) { |
400 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
400 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
401 | 401 | (38, 'reports', 'Right to generate reports', 1, 1)"; |
402 | - $query[] = "INSERT INTO ". PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 38)"; |
|
402 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 38)"; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | // |
406 | 406 | // UPDATES FROM 2.7.0-beta |
407 | 407 | // |
408 | 408 | if (version_compare($version, '2.7.0-beta', '<')) { |
409 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'search.numberSearchTerms' |
|
409 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'search.numberSearchTerms' |
|
410 | 410 | WHERE config_name = 'main.numberSearchTerms'"; |
411 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'search.useAjaxSearchOnStartpage' |
|
411 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'search.useAjaxSearchOnStartpage' |
|
412 | 412 | WHERE config_name = 'main.useAjaxSearchOnStartpage'"; |
413 | 413 | } |
414 | 414 | |
@@ -426,39 +426,39 @@ discard block |
||
426 | 426 | // UPDATES FROM 2.7.0-RC |
427 | 427 | // |
428 | 428 | if (version_compare($version, '2.7.0-RC', '<')) { |
429 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.numberOfRecordsPerPage' |
|
429 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.numberOfRecordsPerPage' |
|
430 | 430 | WHERE config_name = 'main.numberOfRecordsPerPage'"; |
431 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.numberOfShownNewsEntries' |
|
431 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.numberOfShownNewsEntries' |
|
432 | 432 | WHERE config_name = 'main.numberOfShownNewsEntries'"; |
433 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.orderingPopularFaqs' |
|
433 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.orderingPopularFaqs' |
|
434 | 434 | WHERE config_name = 'main.orderingPopularFaqs'"; |
435 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.disableAttachments' |
|
435 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.disableAttachments' |
|
436 | 436 | WHERE config_name = 'main.disableAttachments'"; |
437 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.maxAttachmentSize' |
|
437 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.maxAttachmentSize' |
|
438 | 438 | WHERE config_name = 'main.maxAttachmentSize'"; |
439 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.attachmentsPath' |
|
439 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.attachmentsPath' |
|
440 | 440 | WHERE config_name = 'main.attachmentsPath'"; |
441 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.attachmentsStorageType' |
|
441 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.attachmentsStorageType' |
|
442 | 442 | WHERE config_name = 'main.attachmentsStorageType'"; |
443 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.enableAttachmentEncryption' |
|
443 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.enableAttachmentEncryption' |
|
444 | 444 | WHERE config_name = 'main.enableAttachmentEncryption'"; |
445 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'records.defaultAttachmentEncKey' |
|
445 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'records.defaultAttachmentEncKey' |
|
446 | 446 | WHERE config_name = 'main.defaultAttachmentEncKey'"; |
447 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.permLevel' |
|
447 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.permLevel' |
|
448 | 448 | WHERE config_name = 'main.permLevel'"; |
449 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.ipCheck' |
|
449 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.ipCheck' |
|
450 | 450 | WHERE config_name = 'main.ipCheck'"; |
451 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.enableLoginOnly' |
|
451 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.enableLoginOnly' |
|
452 | 452 | WHERE config_name = 'main.enableLoginOnly'"; |
453 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.ldapSupport' |
|
453 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.ldapSupport' |
|
454 | 454 | WHERE config_name = 'main.ldapSupport'"; |
455 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.bannedIPs' |
|
455 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.bannedIPs' |
|
456 | 456 | WHERE config_name = 'main.bannedIPs'"; |
457 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.ssoSupport' |
|
457 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.ssoSupport' |
|
458 | 458 | WHERE config_name = 'main.ssoSupport'"; |
459 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.ssoLogoutRedirect' |
|
459 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.ssoLogoutRedirect' |
|
460 | 460 | WHERE config_name = 'main.ssoLogoutRedirect'"; |
461 | - $query[] = "UPDATE ". PMF_Db::getTablePrefix() . "faqconfig SET config_name = 'security.useSslForLogins' |
|
461 | + $query[] = "UPDATE ".PMF_Db::getTablePrefix()."faqconfig SET config_name = 'security.useSslForLogins' |
|
462 | 462 | WHERE config_name = 'main.useSslForLogins'"; |
463 | 463 | } |
464 | 464 | |
@@ -483,15 +483,15 @@ discard block |
||
483 | 483 | // |
484 | 484 | if (version_compare($version, '2.8.0-alpha', '<')) { |
485 | 485 | |
486 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
486 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
487 | 487 | (39, 'addfaq', 'Right to add FAQs in frontend', 1, 1)"; |
488 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 39)"; |
|
489 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
488 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 39)"; |
|
489 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
490 | 490 | (40, 'addquestion', 'Right to add questions in frontend', 1, 1)"; |
491 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 40)"; |
|
492 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description, for_users, for_groups) VALUES |
|
491 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 40)"; |
|
492 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description, for_users, for_groups) VALUES |
|
493 | 493 | (41, 'addcomment', 'Right to add comments in frontend', 1, 1)"; |
494 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 41)"; |
|
494 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 41)"; |
|
495 | 495 | |
496 | 496 | $faqConfig->add('cache.varnishEnable', 'false'); |
497 | 497 | $faqConfig->add('cache.varnishHost', '127.0.0.1'); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | |
504 | 504 | if ('sqlite' === $DB['type']) { |
505 | 505 | $query[] = "BEGIN TRANSACTION"; |
506 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqquestions_temp ( |
|
506 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqquestions_temp ( |
|
507 | 507 | id int(11) NOT NULL, |
508 | 508 | username varchar(100) NOT NULL, |
509 | 509 | email varchar(100) NOT NULL, |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | created varchar(20) NOT NULL, |
513 | 513 | is_visible char(1) default 'Y', |
514 | 514 | PRIMARY KEY (id))"; |
515 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqquestions_temp SELECT * FROM " . PMF_Db::getTablePrefix() . "faqquestions"; |
|
516 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqquestions"; |
|
517 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqquestions ( |
|
515 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqquestions_temp SELECT * FROM ".PMF_Db::getTablePrefix()."faqquestions"; |
|
516 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faqquestions"; |
|
517 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqquestions ( |
|
518 | 518 | id int(11) NOT NULL, |
519 | 519 | username varchar(100) NOT NULL, |
520 | 520 | email varchar(100) NOT NULL, |
@@ -524,39 +524,39 @@ discard block |
||
524 | 524 | is_visible char(1) default 'Y', |
525 | 525 | answer_id INT NOT NULL DEFAULT 0, |
526 | 526 | PRIMARY KEY (id))"; |
527 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqquestions SELECT id, username, email, category_id, question, created, is_visible, 0 FROM " . PMF_Db::getTablePrefix() . "faqquestions_temp"; |
|
528 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqquestions_temp"; |
|
527 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqquestions SELECT id, username, email, category_id, question, created, is_visible, 0 FROM ".PMF_Db::getTablePrefix()."faqquestions_temp"; |
|
528 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faqquestions_temp"; |
|
529 | 529 | $query[] = "COMMIT"; |
530 | 530 | } elseif ('sqlite3' === $DB['type']) { |
531 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions ADD COLUMN answer_id INT NOT NULL DEFAULT 0"; |
|
531 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions ADD COLUMN answer_id INT NOT NULL DEFAULT 0"; |
|
532 | 532 | } else { |
533 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faqquestions ADD answer_id INT NOT NULL DEFAULT 0"; |
|
533 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faqquestions ADD answer_id INT NOT NULL DEFAULT 0"; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | $faqConfig->add('records.enableCloseQuestion', 'false'); |
537 | 537 | $faqConfig->add('records.enableDeleteQuestion', 'false'); |
538 | 538 | |
539 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faquserlogin_temp ( |
|
539 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faquserlogin_temp ( |
|
540 | 540 | login varchar(128) NOT NULL, |
541 | 541 | pass varchar(80) NOT NULL, |
542 | 542 | PRIMARY KEY (login))"; |
543 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquserlogin_temp SELECT * FROM " . PMF_Db::getTablePrefix() . "faquserlogin"; |
|
544 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faquserlogin"; |
|
545 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faquserlogin ( |
|
543 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquserlogin_temp SELECT * FROM ".PMF_Db::getTablePrefix()."faquserlogin"; |
|
544 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faquserlogin"; |
|
545 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faquserlogin ( |
|
546 | 546 | login varchar(128) NOT NULL, |
547 | 547 | pass varchar(80) NOT NULL, |
548 | 548 | PRIMARY KEY (login))"; |
549 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquserlogin SELECT * FROM " . PMF_Db::getTablePrefix() . "faquserlogin_temp"; |
|
550 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faquserlogin_temp"; |
|
549 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquserlogin SELECT * FROM ".PMF_Db::getTablePrefix()."faquserlogin_temp"; |
|
550 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faquserlogin_temp"; |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | // |
554 | 554 | // UPDATES FROM 2.8.0-alpha2 |
555 | 555 | // |
556 | 556 | if (version_compare($version, '2.8.0-alpha2', '<')) { |
557 | - switch($DB['type']) { |
|
557 | + switch ($DB['type']) { |
|
558 | 558 | case 'pgsql': |
559 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqinstances ( |
|
559 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqinstances ( |
|
560 | 560 | id int4 NOT NULL, |
561 | 561 | url VARCHAR(255) NOT NULL, |
562 | 562 | instance VARCHAR(255) NOT NULL, |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
565 | 565 | modified TIMESTAMP NOT NULL, |
566 | 566 | PRIMARY KEY (id))"; |
567 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqinstances_config ( |
|
567 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqinstances_config ( |
|
568 | 568 | instance_id int4 NOT NULL, |
569 | 569 | config_name VARCHAR(255) NOT NULL default '', |
570 | 570 | config_value VARCHAR(255) DEFAULT NULL, |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | case 'sqlsrv': |
575 | 575 | case 'sqlite': |
576 | 576 | case 'sqlite3': |
577 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqinstances ( |
|
577 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqinstances ( |
|
578 | 578 | id INT NOT NULL, |
579 | 579 | url VARCHAR(255) NOT NULL, |
580 | 580 | instance VARCHAR(255) NOT NULL, |
@@ -582,14 +582,14 @@ discard block |
||
582 | 582 | created DATETIME NOT NULL, |
583 | 583 | modified DATETIME NOT NULL, |
584 | 584 | PRIMARY KEY (id))"; |
585 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqinstances_config ( |
|
585 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqinstances_config ( |
|
586 | 586 | instance_id INT NOT NULL, |
587 | 587 | config_name VARCHAR(255) NOT NULL default '', |
588 | 588 | config_value VARCHAR(255) DEFAULT NULL, |
589 | 589 | PRIMARY KEY (instance_id, config_name))"; |
590 | 590 | break; |
591 | 591 | case 'mysqli': |
592 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqinstances ( |
|
592 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqinstances ( |
|
593 | 593 | id INT(11) NOT NULL, |
594 | 594 | url VARCHAR(255) NOT NULL, |
595 | 595 | instance VARCHAR(255) NOT NULL, |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | created TIMESTAMP DEFAULT 0, |
598 | 598 | modified TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
599 | 599 | PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"; |
600 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faqinstances_config ( |
|
600 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faqinstances_config ( |
|
601 | 601 | instance_id INT(11) NOT NULL, |
602 | 602 | config_name VARCHAR(255) NOT NULL default '', |
603 | 603 | config_value VARCHAR(255) DEFAULT NULL, |
@@ -605,19 +605,19 @@ discard block |
||
605 | 605 | break; |
606 | 606 | } |
607 | 607 | |
608 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description) VALUES |
|
608 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description) VALUES |
|
609 | 609 | (42, 'editinstances', 'Right to edit multi-site instances')"; |
610 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 42)"; |
|
611 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description) VALUES |
|
610 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 42)"; |
|
611 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description) VALUES |
|
612 | 612 | (43, 'addinstances', 'Right to add multi-site instances')"; |
613 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 43)"; |
|
614 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description) VALUES |
|
613 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 43)"; |
|
614 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description) VALUES |
|
615 | 615 | (44, 'delinstances', 'Right to delete multi-site instances')"; |
616 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 44)"; |
|
616 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 44)"; |
|
617 | 617 | |
618 | 618 | if ('sqlite' === $DB['type']) { |
619 | 619 | $query[] = "BEGIN TRANSACTION"; |
620 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faquser_temp ( |
|
620 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faquser_temp ( |
|
621 | 621 | user_id INT(11) NOT NULL, |
622 | 622 | login VARCHAR(25) NOT NULL, |
623 | 623 | session_id VARCHAR(150) NULL, |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | auth_source VARCHAR(100) NULL, |
629 | 629 | member_since TIMESTAMP(14) NULL, |
630 | 630 | PRIMARY KEY(user_id))"; |
631 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_temp SELECT * FROM " . PMF_Db::getTablePrefix() . "faquser"; |
|
632 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faquser"; |
|
633 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faquser ( |
|
631 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_temp SELECT * FROM ".PMF_Db::getTablePrefix()."faquser"; |
|
632 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faquser"; |
|
633 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faquser ( |
|
634 | 634 | user_id INT(11) NOT NULL, |
635 | 635 | login VARCHAR(25) NOT NULL, |
636 | 636 | session_id VARCHAR(150) NULL, |
@@ -642,13 +642,13 @@ discard block |
||
642 | 642 | member_since TIMESTAMP(14) NULL, |
643 | 643 | remember_me VARCHAR(150) NULL, |
644 | 644 | PRIMARY KEY(user_id))"; |
645 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser SELECT user_id, login, session_id, session_timestamp, ip, account_status, last_login, auth_source, member_since, '' FROM " . PMF_Db::getTablePrefix() . "faquser_temp"; |
|
646 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faquser_temp"; |
|
645 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser SELECT user_id, login, session_id, session_timestamp, ip, account_status, last_login, auth_source, member_since, '' FROM ".PMF_Db::getTablePrefix()."faquser_temp"; |
|
646 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faquser_temp"; |
|
647 | 647 | $query[] = "COMMIT"; |
648 | 648 | } elseif ('sqlite3' === $DB['type']) { |
649 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faquser ADD COLUMN remember_me VARCHAR(150) NULL"; |
|
649 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faquser ADD COLUMN remember_me VARCHAR(150) NULL"; |
|
650 | 650 | } else { |
651 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faquser ADD remember_me VARCHAR(150) NULL"; |
|
651 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faquser ADD remember_me VARCHAR(150) NULL"; |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
@@ -659,13 +659,13 @@ discard block |
||
659 | 659 | foreach ($query as $key => $executeQuery) { |
660 | 660 | $result = $faqConfig->getDb()->query($executeQuery); |
661 | 661 | echo '.'; |
662 | - if (!($key % 100)) { |
|
662 | + if (!($key%100)) { |
|
663 | 663 | echo '<br />'; |
664 | 664 | } |
665 | 665 | if (!$result) { |
666 | 666 | echo "</div>"; |
667 | - echo '<p class="alert alert-danger"><strong>Error:</strong> Please update your version of phpMyFAQ ' . |
|
668 | - 'once again or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.' . |
|
667 | + echo '<p class="alert alert-danger"><strong>Error:</strong> Please update your version of phpMyFAQ '. |
|
668 | + 'once again or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.'. |
|
669 | 669 | '</p>'; |
670 | 670 | printf( |
671 | 671 | '<p class="alert alert-danger"><strong>DB error:</strong> %s</p>', |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | } |
680 | 680 | usleep(10000); |
681 | 681 | $count++; |
682 | - if (!($count % 10)) { |
|
682 | + if (!($count%10)) { |
|
683 | 683 | ob_flush(); |
684 | 684 | } |
685 | 685 | } |
@@ -719,10 +719,10 @@ discard block |
||
719 | 719 | // |
720 | 720 | if (version_compare($version, '2.8.0-alpha3', '<')) { |
721 | 721 | |
722 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faqlinkverifyrules"; |
|
723 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faqright (right_id, name, description) VALUES |
|
722 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faqlinkverifyrules"; |
|
723 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faqright (right_id, name, description) VALUES |
|
724 | 724 | (45, 'export', 'Right to export the complete FAQ')"; |
725 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_right (user_id, right_id) VALUES (1, 45)"; |
|
725 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_right (user_id, right_id) VALUES (1, 45)"; |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | if ('sqlite' === $DB['type']) { |
772 | 772 | $query[] = "BEGIN TRANSACTION"; |
773 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faquser_temp ( |
|
773 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faquser_temp ( |
|
774 | 774 | user_id INT(11) NOT NULL, |
775 | 775 | login VARCHAR(25) NOT NULL, |
776 | 776 | session_id VARCHAR(150) NULL, |
@@ -781,9 +781,9 @@ discard block |
||
781 | 781 | auth_source VARCHAR(100) NULL, |
782 | 782 | member_since TIMESTAMP(14) NULL, |
783 | 783 | PRIMARY KEY(user_id))"; |
784 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser_temp SELECT * FROM " . PMF_Db::getTablePrefix() . "faquser"; |
|
785 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faquser"; |
|
786 | - $query[] = "CREATE TABLE " . PMF_Db::getTablePrefix() . "faquser ( |
|
784 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser_temp SELECT * FROM ".PMF_Db::getTablePrefix()."faquser"; |
|
785 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faquser"; |
|
786 | + $query[] = "CREATE TABLE ".PMF_Db::getTablePrefix()."faquser ( |
|
787 | 787 | user_id INT(11) NOT NULL, |
788 | 788 | login VARCHAR(25) NOT NULL, |
789 | 789 | session_id VARCHAR(150) NULL, |
@@ -796,13 +796,13 @@ discard block |
||
796 | 796 | remember_me VARCHAR(150) NULL, |
797 | 797 | success INT(1) NULL DEFAULT 1, |
798 | 798 | PRIMARY KEY(user_id))"; |
799 | - $query[] = "INSERT INTO " . PMF_Db::getTablePrefix() . "faquser SELECT user_id, login, session_id, session_timestamp, ip, account_status, last_login, auth_source, member_since, '' FROM " . PMF_Db::getTablePrefix() . "faquser_temp"; |
|
800 | - $query[] = "DROP TABLE " . PMF_Db::getTablePrefix() . "faquser_temp"; |
|
799 | + $query[] = "INSERT INTO ".PMF_Db::getTablePrefix()."faquser SELECT user_id, login, session_id, session_timestamp, ip, account_status, last_login, auth_source, member_since, '' FROM ".PMF_Db::getTablePrefix()."faquser_temp"; |
|
800 | + $query[] = "DROP TABLE ".PMF_Db::getTablePrefix()."faquser_temp"; |
|
801 | 801 | $query[] = "COMMIT"; |
802 | 802 | } elseif ('sqlite3' === $DB['type']) { |
803 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faquser ADD COLUMN success INT(1) NULL DEFAULT 1"; |
|
803 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faquser ADD COLUMN success INT(1) NULL DEFAULT 1"; |
|
804 | 804 | } else { |
805 | - $query[] = "ALTER TABLE " . PMF_Db::getTablePrefix() . "faquser ADD success INT(1) NULL DEFAULT 1"; |
|
805 | + $query[] = "ALTER TABLE ".PMF_Db::getTablePrefix()."faquser ADD success INT(1) NULL DEFAULT 1"; |
|
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $result = $faqConfig->getDb()->query($executeQuery); |
833 | 833 | printf('<span title="%s">.</span>', $executeQuery); |
834 | 834 | if (!$result) { |
835 | - echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again ' . |
|
835 | + echo '<p class="alert alert-danger"><strong>Error:</strong> Please install your version of phpMyFAQ once again '. |
|
836 | 836 | 'or send us a <a href="http://bugs.phpmyfaq.de" target="_blank">bug report</a>.</p>'; |
837 | 837 | printf('<p class="error"><strong>DB error:</strong> %s</p>', $faqConfig->getDb()->error()); |
838 | 838 | printf('<code>%s</code>', htmlentities($executeQuery)); |
@@ -854,13 +854,13 @@ discard block |
||
854 | 854 | } |
855 | 855 | } |
856 | 856 | // Remove 'setup.php' file |
857 | - if (is_writeable(__DIR__ . '/setup.php') && @unlink(__DIR__ . '/setup.php')) { |
|
857 | + if (is_writeable(__DIR__.'/setup.php') && @unlink(__DIR__.'/setup.php')) { |
|
858 | 858 | echo "<p class=\"alert alert-success\">The file <em>./setup/index.php</em> was deleted automatically.</p>\n"; |
859 | 859 | } else { |
860 | 860 | echo "<p class=\"alert alert-danger\">Please delete the file <em>./setup/index.php</em> manually.</p>\n"; |
861 | 861 | } |
862 | 862 | // Remove 'update.php' file |
863 | - if (is_writeable(__DIR__ . '/update.php') && @unlink(__DIR__ . '/update.php')) { |
|
863 | + if (is_writeable(__DIR__.'/update.php') && @unlink(__DIR__.'/update.php')) { |
|
864 | 864 | echo "<p class=\"alert alert-success\">The file <em>./setup/update.php</em> was deleted automatically.</p>\n"; |
865 | 865 | } else { |
866 | 866 | echo "<p class=\"alert alert-danger\">Please delete the file <em>./setup/update.php</em> manually.</p>\n"; |
@@ -66,8 +66,8 @@ |
||
66 | 66 | /* case PMF_Attachment_Migration::MIGRATION_TYPE3: |
67 | 67 | case PMF_Attachment_Migration::MIGRATION_TYPE4:*/ |
68 | 68 | $options['defaultKey'] = PMF_Filter::filterInput(INPUT_POST, |
69 | - 'defaultKey', |
|
70 | - FILTER_SANITIZE_STRING); |
|
69 | + 'defaultKey', |
|
70 | + FILTER_SANITIZE_STRING); |
|
71 | 71 | break; |
72 | 72 | |
73 | 73 | default: |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // |
26 | 26 | // Check if config/database.php exist -> if not, redirect to installer |
27 | 27 | // |
28 | -if (!file_exists(PMF_ROOT_DIR . '/config/database.php')) { |
|
28 | +if (!file_exists(PMF_ROOT_DIR.'/config/database.php')) { |
|
29 | 29 | header("Location: ".str_replace('admin/index.php', '', $_SERVER['SCRIPT_NAME']).'setup/index.php'); |
30 | 30 | exit(); |
31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // |
34 | 34 | // Bootstrapping |
35 | 35 | // |
36 | -require PMF_ROOT_DIR . '/inc/Bootstrap.php'; |
|
36 | +require PMF_ROOT_DIR.'/inc/Bootstrap.php'; |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 | <!DOCTYPE html> |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | if ($migration->doMigrate($migrationType, $options)) { |
82 | 82 | print '<br><h2 style="color: green;">Success</h2>'; |
83 | 83 | } else { |
84 | - print '<span style="color: red">Errors:</span><br>' . implode('<br>', $migration->getErrors()); |
|
84 | + print '<span style="color: red">Errors:</span><br>'.implode('<br>', $migration->getErrors()); |
|
85 | 85 | showForm(); |
86 | 86 | } |
87 | 87 | |
88 | 88 | $warnings = $migration->getWarnings(); |
89 | - if(!empty($warnings)) { |
|
90 | - echo '<span style="color: yellow">Warnings:</span><br>' . implode('<br>', $migration->getWarnings()); |
|
89 | + if (!empty($warnings)) { |
|
90 | + echo '<span style="color: yellow">Warnings:</span><br>'.implode('<br>', $migration->getWarnings()); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |