@@ -79,8 +79,8 @@ |
||
| 79 | 79 | fa.record_id = fd.id |
| 80 | 80 | GROUP BY |
| 81 | 81 | fa.id", |
| 82 | - PMF_Db::getTablePrefix() . 'faqattachment', |
|
| 83 | - PMF_Db::getTablePrefix() . 'faqdata' |
|
| 82 | + PMF_Db::getTablePrefix().'faqattachment', |
|
| 83 | + PMF_Db::getTablePrefix().'faqdata' |
|
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | $result = $this->config->getDb()->query($query); |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Attachment collection class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Attachment |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2010-2016 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2010-12-13 |
|
| 18 | - */ |
|
| 3 | + * Attachment collection class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Attachment |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2010-2016 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2010-12-13 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->handle = @fopen($this->path, $this->mode); |
| 67 | 67 | |
| 68 | 68 | if (!is_resource($this->handle)) { |
| 69 | - throw new PMF_Attachment_Filesystem_File_Exception('Could not open file: ' . $this->path); |
|
| 69 | + throw new PMF_Attachment_Filesystem_File_Exception('Could not open file: '.$this->path); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $retval = false; |
| 153 | 153 | |
| 154 | - if(in_array($mode, array(self::MODE_WRITE, self::MODE_READ, self::MODE_APPEND))) { |
|
| 154 | + if (in_array($mode, array(self::MODE_WRITE, self::MODE_READ, self::MODE_APPEND))) { |
|
| 155 | 155 | fclose($this->handle); |
| 156 | 156 | $this->handle = fopen($this->path, $mode); |
| 157 | 157 | |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * File handler class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Attachment |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2009-2016 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2009-08-21 |
|
| 18 | - */ |
|
| 3 | + * File handler class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Attachment |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2009-2016 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2009-08-21 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | $subDirNameLength = 5; |
| 50 | 50 | |
| 51 | 51 | for ($i = 0; $i < $subDirCount; $i++) { |
| 52 | - $retval .= DIRECTORY_SEPARATOR . substr($fsHash, $i*$subDirNameLength, $subDirNameLength); |
|
| 52 | + $retval .= DIRECTORY_SEPARATOR.substr($fsHash, $i*$subDirNameLength, $subDirNameLength); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $retval .= DIRECTORY_SEPARATOR . substr($fsHash, $i*$subDirNameLength); |
|
| 55 | + $retval .= DIRECTORY_SEPARATOR.substr($fsHash, $i*$subDirNameLength); |
|
| 56 | 56 | |
| 57 | 57 | return $retval; |
| 58 | 58 | } |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | if ($headers) { |
| 195 | 195 | $disposition = 'attachment' == $disposition ? 'attachment' : 'inline'; |
| 196 | - header('Content-Type: ' . $this->mimeType, true); |
|
| 197 | - header('Content-Length: ' . $this->filesize, true); |
|
| 198 | - header("Content-Disposition: $disposition; filename=\"{$this->filename}\"" , true); |
|
| 196 | + header('Content-Type: '.$this->mimeType, true); |
|
| 197 | + header('Content-Length: '.$this->filesize, true); |
|
| 198 | + header("Content-Disposition: $disposition; filename=\"{$this->filename}\"", true); |
|
| 199 | 199 | header("Content-MD5: {$this->realHash}", true); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Attachment handler class for files stored in filesystem |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Attachment |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2009-2016 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2009-08-21 |
|
| 18 | - */ |
|
| 3 | + * Attachment handler class for files stored in filesystem |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Attachment |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2009-2016 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2009-08-21 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -132,33 +132,33 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | // Get language from: _POST, _GET, _COOKIE, phpMyFAQ configuration and the automatic language detection |
| 134 | 134 | $_lang['post'] = PMF_Filter::filterInput(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
| 135 | - if (!is_null($_lang['post']) && !self::isASupportedLanguage($_lang['post']) ) { |
|
| 135 | + if (!is_null($_lang['post']) && !self::isASupportedLanguage($_lang['post'])) { |
|
| 136 | 136 | $_lang['post'] = null; |
| 137 | 137 | } |
| 138 | 138 | // Get the user language |
| 139 | 139 | $_lang['get'] = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING); |
| 140 | - if (!is_null($_lang['get']) && !self::isASupportedLanguage($_lang['get']) ) { |
|
| 140 | + if (!is_null($_lang['get']) && !self::isASupportedLanguage($_lang['get'])) { |
|
| 141 | 141 | $_lang['get'] = null; |
| 142 | 142 | } |
| 143 | 143 | // Get the faq record language |
| 144 | 144 | $_lang['artget'] = PMF_Filter::filterInput(INPUT_GET, 'artlang', FILTER_SANITIZE_STRING); |
| 145 | - if (!is_null($_lang['artget']) && !self::isASupportedLanguage($_lang['artget']) ) { |
|
| 145 | + if (!is_null($_lang['artget']) && !self::isASupportedLanguage($_lang['artget'])) { |
|
| 146 | 146 | $_lang['artget'] = null; |
| 147 | 147 | } |
| 148 | 148 | // Get the language from the session |
| 149 | - if (isset($_SESSION['pmf_lang']) && self::isASupportedLanguage($_SESSION['pmf_lang']) ) { |
|
| 149 | + if (isset($_SESSION['pmf_lang']) && self::isASupportedLanguage($_SESSION['pmf_lang'])) { |
|
| 150 | 150 | $_lang['session'] = trim($_SESSION['pmf_lang']); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // Get the language from the config |
| 154 | 154 | if (isset($configLanguage)) { |
| 155 | 155 | $confLangCode = str_replace(array("language_", ".php"), "", $configLanguage); |
| 156 | - if (self::isASupportedLanguage($confLangCode) ) { |
|
| 156 | + if (self::isASupportedLanguage($confLangCode)) { |
|
| 157 | 157 | $_lang['config'] = $confLangCode; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | // Detect the browser's language |
| 161 | - if ((true === $configDetection) && self::isASupportedLanguage($this->acceptedLanguage) ) { |
|
| 161 | + if ((true === $configDetection) && self::isASupportedLanguage($this->acceptedLanguage)) { |
|
| 162 | 162 | $_lang['detection'] = strtolower($this->acceptedLanguage); |
| 163 | 163 | } |
| 164 | 164 | // Select the language |
@@ -208,12 +208,12 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | global $languageCodes; |
| 210 | 210 | |
| 211 | - $search = array("language_" , ".php"); |
|
| 211 | + $search = array("language_", ".php"); |
|
| 212 | 212 | $languages = $languageFiles = array(); |
| 213 | 213 | |
| 214 | 214 | $dir = new DirectoryIterator(PMF_LANGUAGE_DIR); |
| 215 | 215 | foreach ($dir as $fileinfo) { |
| 216 | - if (! $fileinfo->isDot()) { |
|
| 216 | + if (!$fileinfo->isDot()) { |
|
| 217 | 217 | $languageFiles[] = strtoupper( |
| 218 | 218 | str_replace($search, '', trim($fileinfo->getFilename())) |
| 219 | 219 | ); |
@@ -248,21 +248,21 @@ discard block |
||
| 248 | 248 | global $languageCodes; |
| 249 | 249 | |
| 250 | 250 | $onChange = ($submitOnChange ? ' onchange="this.form.submit();"' : ''); |
| 251 | - $output = '<select class="language" name="' . $id . '" id="' . $id . '" size="1"' . $onChange . ">\n"; |
|
| 251 | + $output = '<select class="language" name="'.$id.'" id="'.$id.'" size="1"'.$onChange.">\n"; |
|
| 252 | 252 | $languages = self::getAvailableLanguages(); |
| 253 | 253 | |
| 254 | 254 | if (count($languages) > 0) { |
| 255 | 255 | foreach ($languages as $lang => $value) { |
| 256 | - if (! in_array($lang, $excludedLanguages)) { |
|
| 257 | - $output .= "\t" . '<option value="' . $lang . '"'; |
|
| 256 | + if (!in_array($lang, $excludedLanguages)) { |
|
| 257 | + $output .= "\t".'<option value="'.$lang.'"'; |
|
| 258 | 258 | if ($lang == $default) { |
| 259 | 259 | $output .= ' selected="selected"'; |
| 260 | 260 | } |
| 261 | - $output .= '>' . $value . "</option>\n"; |
|
| 261 | + $output .= '>'.$value."</option>\n"; |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | } else { |
| 265 | - $output .= "\t<option value=\"en\">" . $languageCodes["EN"] . "</option>"; |
|
| 265 | + $output .= "\t<option value=\"en\">".$languageCodes["EN"]."</option>"; |
|
| 266 | 266 | } |
| 267 | 267 | $output .= "</select>\n"; |
| 268 | 268 | return $output; |
@@ -283,24 +283,24 @@ discard block |
||
| 283 | 283 | if ($onlyThisLang) { |
| 284 | 284 | if (strtolower($key) == $lang) { |
| 285 | 285 | if ($fileLanguageValue) { |
| 286 | - $output .= "\t<option value=\"language_" . strtolower($lang) . ".php\""; |
|
| 286 | + $output .= "\t<option value=\"language_".strtolower($lang).".php\""; |
|
| 287 | 287 | } else { |
| 288 | - $output .= "\t<option value=\"" . strtolower($lang) . "\""; |
|
| 288 | + $output .= "\t<option value=\"".strtolower($lang)."\""; |
|
| 289 | 289 | } |
| 290 | 290 | $output .= " selected=\"selected\""; |
| 291 | - $output .= ">" . $value . "</option>\n"; |
|
| 291 | + $output .= ">".$value."</option>\n"; |
|
| 292 | 292 | break; |
| 293 | 293 | } |
| 294 | 294 | } else { |
| 295 | 295 | if ($fileLanguageValue) { |
| 296 | - $output .= "\t<option value=\"language_" . strtolower($key) . ".php\""; |
|
| 296 | + $output .= "\t<option value=\"language_".strtolower($key).".php\""; |
|
| 297 | 297 | } else { |
| 298 | - $output .= "\t<option value=\"" . strtolower($key) . "\""; |
|
| 298 | + $output .= "\t<option value=\"".strtolower($key)."\""; |
|
| 299 | 299 | } |
| 300 | 300 | if (strtolower($key) == $lang) { |
| 301 | 301 | $output .= " selected=\"selected\""; |
| 302 | 302 | } |
| 303 | - $output .= ">" . $value . "</option>\n"; |
|
| 303 | + $output .= ">".$value."</option>\n"; |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | return $output; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | public static function isASupportedTinyMCELanguage($langcode) |
| 336 | 336 | { |
| 337 | 337 | return file_exists( |
| 338 | - PMF_ROOT_DIR . '/admin/editor/langs/' . $langcode . '.js' |
|
| 338 | + PMF_ROOT_DIR.'/admin/editor/langs/'.$langcode.'.js' |
|
| 339 | 339 | ); |
| 340 | 340 | } |
| 341 | 341 | |
@@ -364,7 +364,9 @@ |
||
| 364 | 364 | if (count($matches[1])) { |
| 365 | 365 | $languages = array_combine($matches[1], $matches[4]); |
| 366 | 366 | foreach ($languages as $lang => $val) { |
| 367 | - if ($val === '') $languages[$lang] = 1; |
|
| 367 | + if ($val === '') { |
|
| 368 | + $languages[$lang] = 1; |
|
| 369 | + } |
|
| 368 | 370 | } |
| 369 | 371 | arsort($languages, SORT_NUMERIC); |
| 370 | 372 | } |
@@ -1,23 +1,23 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Manages all language stuff |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Language |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @author Matteo scaramuccia <[email protected]> |
|
| 15 | - * @author Aurimas Fišeras <[email protected]> |
|
| 16 | - * @copyright 2009-2016 phpMyFAQ Team |
|
| 17 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 18 | - * @link http://www.phpmyfaq.de |
|
| 19 | - * @since 2009-05-14 |
|
| 20 | - */ |
|
| 3 | + * Manages all language stuff |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Language |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @author Matteo scaramuccia <[email protected]> |
|
| 15 | + * @author Aurimas Fišeras <[email protected]> |
|
| 16 | + * @copyright 2009-2016 phpMyFAQ Team |
|
| 17 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 18 | + * @link http://www.phpmyfaq.de |
|
| 19 | + * @since 2009-05-14 |
|
| 20 | + */ |
|
| 21 | 21 | |
| 22 | 22 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 23 | 23 | exit(); |
@@ -43,6 +43,6 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function encrypt($str) |
| 45 | 45 | { |
| 46 | - return hash('sha256', $str . $this->salt); |
|
| 46 | + return hash('sha256', $str.$this->salt); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Provides methods for password encryption using hash(). |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Enc |
|
| 13 | - * @author Thorsten Rinne <[email protected]> |
|
| 14 | - * @copyright 2012-2016 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2012-01-04 |
|
| 18 | - */ |
|
| 3 | + * Provides methods for password encryption using hash(). |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Enc |
|
| 13 | + * @author Thorsten Rinne <[email protected]> |
|
| 14 | + * @copyright 2012-2016 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2012-01-04 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | if (!empty($url)) { |
| 261 | 261 | $match = array(); |
| 262 | - if (PMF_String::preg_match('$&(amp;|)' . $this->pageParamName . '=(\d+)$', $url, $match)) { |
|
| 262 | + if (PMF_String::preg_match('$&(amp;|)'.$this->pageParamName.'=(\d+)$', $url, $match)) { |
|
| 263 | 263 | $page = isset($match[2]) ? $match[2] : $page; |
| 264 | 264 | } |
| 265 | 265 | } |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | public function render() |
| 276 | 276 | { |
| 277 | 277 | $content = array(); |
| 278 | - $pages = ceil($this->total / $this->perPage); |
|
| 279 | - $adjacents = floor($this->adjacents / 2) >= 1 ? floor($this->adjacents / 2) : 1; |
|
| 278 | + $pages = ceil($this->total/$this->perPage); |
|
| 279 | + $adjacents = floor($this->adjacents/2) >= 1 ? floor($this->adjacents/2) : 1; |
|
| 280 | 280 | |
| 281 | 281 | for ($page = 1; $page <= $pages; $page++) { |
| 282 | 282 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | } else { |
| 362 | 362 | |
| 363 | - $cleanedUrl = PMF_String::preg_replace(array('$&(amp;|)' . $this->pageParamName . '=(\d+)$'), '', $url); |
|
| 363 | + $cleanedUrl = PMF_String::preg_replace(array('$&(amp;|)'.$this->pageParamName.'=(\d+)$'), '', $url); |
|
| 364 | 364 | $url = sprintf('%s&%s=%d', $cleanedUrl, $this->pageParamName, $page); |
| 365 | 365 | |
| 366 | 366 | } |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Pagination handler class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package PMF_Pagination |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @author Thorsten Rinne <[email protected]> |
|
| 15 | - * @copyright 2009-2016 phpMyFAQ Team |
|
| 16 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | - * @link http://www.phpmyfaq.de |
|
| 18 | - * @since 2009-09-27 |
|
| 19 | - */ |
|
| 3 | + * Pagination handler class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package PMF_Pagination |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @author Thorsten Rinne <[email protected]> |
|
| 15 | + * @copyright 2009-2016 phpMyFAQ Team |
|
| 16 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 17 | + * @link http://www.phpmyfaq.de |
|
| 18 | + * @since 2009-09-27 |
|
| 19 | + */ |
|
| 20 | 20 | |
| 21 | 21 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 22 | 22 | exit(); |
@@ -218,23 +218,23 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if (isset($options['firstPageLinkTpl'])) { |
| 221 | - $this->firstPageLinkTpl = $options['firstPageLinkTpl']; |
|
| 221 | + $this->firstPageLinkTpl = $options['firstPageLinkTpl']; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if (isset($options['lastPageLinkTpl'])) { |
| 225 | - $this->lastPageLinkTpl = $options['lastPageLinkTpl']; |
|
| 225 | + $this->lastPageLinkTpl = $options['lastPageLinkTpl']; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if (isset($options['layoutTpl'])) { |
| 229 | - $this->layoutTpl = $options['layoutTpl']; |
|
| 229 | + $this->layoutTpl = $options['layoutTpl']; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if (isset($options['pageParamName'])) { |
| 233 | - $this->pageParamName = $options['pageParamName']; |
|
| 233 | + $this->pageParamName = $options['pageParamName']; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (isset($options['seoName'])) { |
| 237 | - $this->seoName = $options['seoName']; |
|
| 237 | + $this->seoName = $options['seoName']; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (isset($options['useRewrite']) && isset($options['rewriteUrl'])) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function strstr($haystack, $needle, $part = false) |
| 162 | 162 | { |
| 163 | - return strstr($haystack, $needle, (boolean) $part); |
|
| 163 | + return strstr($haystack, $needle, (boolean)$part); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * |
| 263 | 263 | * @return array|string |
| 264 | 264 | */ |
| 265 | - public function preg_replace_callback($pattern, $callback, $subject, $limit= -1, &$count = 0) |
|
| 265 | + public function preg_replace_callback($pattern, $callback, $subject, $limit = -1, &$count = 0) |
|
| 266 | 266 | { |
| 267 | 267 | return preg_replace_callback($pattern, $callback, $subject, $limit, $count); |
| 268 | 268 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @return array|string|null |
| 280 | 280 | */ |
| 281 | - public function preg_replace($pattern, $replacement, $subject, $limit= -1, &$count = 0) |
|
| 281 | + public function preg_replace($pattern, $replacement, $subject, $limit = -1, &$count = 0) |
|
| 282 | 282 | { |
| 283 | 283 | return preg_replace($pattern, $replacement, $subject, $limit, $count); |
| 284 | 284 | } |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | * @param string $needle Needle |
| 144 | 144 | * @param boolean $part Part |
| 145 | 145 | * |
| 146 | - * @return string|false |
|
| 146 | + * @return string |
|
| 147 | 147 | */ |
| 148 | 148 | public function strstr($haystack, $needle, $part = false) |
| 149 | 149 | { |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The string wrapper class using single byte string functions |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3.0 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package String |
|
| 13 | - * @author Anatoliy Belsky <[email protected]> |
|
| 14 | - * @copyright 2009-2016 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2009-04-06 |
|
| 18 | - */ |
|
| 3 | + * The string wrapper class using single byte string functions |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3.0 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package String |
|
| 13 | + * @author Anatoliy Belsky <[email protected]> |
|
| 14 | + * @copyright 2009-2016 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2009-04-06 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -389,13 +389,13 @@ discard block |
||
| 389 | 389 | PMF_System::renderFooter(); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - if (! function_exists('date_default_timezone_set')) { |
|
| 392 | + if (!function_exists('date_default_timezone_set')) { |
|
| 393 | 393 | echo '<p class="alert alert-error">Sorry, but setting a default timezone doesn\'t work in your environment!</p>'; |
| 394 | 394 | PMF_System::renderFooter(); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - if (! $this->_system->checkDatabase()) { |
|
| 398 | - echo '<p class="alert alert-error">No supported database detected! Please install one of the following' . |
|
| 397 | + if (!$this->_system->checkDatabase()) { |
|
| 398 | + echo '<p class="alert alert-error">No supported database detected! Please install one of the following'. |
|
| 399 | 399 | ' database systems and enable the corresponding PHP extension in php.ini:</p>'; |
| 400 | 400 | echo '<ul>'; |
| 401 | 401 | foreach ($this->_system->getSupportedDatabases() as $database) { |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | PMF_System::renderFooter(); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - if (! $this->_system->checkRequiredExtensions()) { |
|
| 409 | - echo '<p class="alert alert-error">The following extensions are missing! Please enable the PHP extension(s) in ' . |
|
| 408 | + if (!$this->_system->checkRequiredExtensions()) { |
|
| 409 | + echo '<p class="alert alert-error">The following extensions are missing! Please enable the PHP extension(s) in '. |
|
| 410 | 410 | 'php.ini.</p>'; |
| 411 | 411 | echo '<ul>'; |
| 412 | 412 | foreach ($this->_system->getMissingExtensions() as $extension) { |
@@ -416,18 +416,18 @@ discard block |
||
| 416 | 416 | PMF_System::renderFooter(); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if (! $this->_system->checkRegisterGlobals()) { |
|
| 419 | + if (!$this->_system->checkRegisterGlobals()) { |
|
| 420 | 420 | echo '<p class="alert alert-error">Please disable register_globals!</p>'; |
| 421 | 421 | PMF_System::renderFooter(); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if (! $this->_system->checkMagicQuotesGpc()) { |
|
| 424 | + if (!$this->_system->checkMagicQuotesGpc()) { |
|
| 425 | 425 | echo '<p class="alert alert-error">Please disable magic_quotes_gpc!</p>'; |
| 426 | 426 | PMF_System::renderFooter(); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if (! $this->_system->checkphpMyFAQInstallation()) { |
|
| 430 | - echo '<p class="alert alert-error">It seems you\'re already running a version of phpMyFAQ. Please use the ' . |
|
| 429 | + if (!$this->_system->checkphpMyFAQInstallation()) { |
|
| 430 | + echo '<p class="alert alert-error">It seems you\'re already running a version of phpMyFAQ. Please use the '. |
|
| 431 | 431 | '<a href="update.php">update script</a>.</p>'; |
| 432 | 432 | PMF_System::renderFooter(); |
| 433 | 433 | } |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | public function checkPreUpgrade() |
| 442 | 442 | { |
| 443 | - if (! $this->checkMinimumPhpVersion()) { |
|
| 443 | + if (!$this->checkMinimumPhpVersion()) { |
|
| 444 | 444 | printf( |
| 445 | 445 | '<p class="alert alert-error">Sorry, but you need PHP %s or later!</p>', |
| 446 | 446 | PMF_System::VERSION_MINIMUM_PHP |
@@ -448,18 +448,18 @@ discard block |
||
| 448 | 448 | PMF_System::renderFooter(); |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | - if (! is_readable(PMF_ROOT_DIR . '/inc/data.php') && ! is_readable(PMF_ROOT_DIR . '/config/database.php')) { |
|
| 452 | - echo '<p class="alert alert-error">It seems you never run a version of phpMyFAQ.<br />' . |
|
| 451 | + if (!is_readable(PMF_ROOT_DIR.'/inc/data.php') && !is_readable(PMF_ROOT_DIR.'/config/database.php')) { |
|
| 452 | + echo '<p class="alert alert-error">It seems you never run a version of phpMyFAQ.<br />'. |
|
| 453 | 453 | 'Please use the <a href="setup.php">install script</a>.</p>'; |
| 454 | 454 | PMF_System::renderFooter(); |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if (! $this->_system->checkRegisterGlobals()) { |
|
| 457 | + if (!$this->_system->checkRegisterGlobals()) { |
|
| 458 | 458 | echo '<p class="alert alert-error">Please disable register_globals!</p>'; |
| 459 | 459 | PMF_System::renderFooter(); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if (! $this->_system->checkMagicQuotesGpc()) { |
|
| 462 | + if (!$this->_system->checkMagicQuotesGpc()) { |
|
| 463 | 463 | echo '<p class="alert alert-error">Please disable magic_quotes_gpc!</p>'; |
| 464 | 464 | PMF_System::renderFooter(); |
| 465 | 465 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | echo "<li>$dir</li>\n"; |
| 503 | 503 | } |
| 504 | 504 | printf( |
| 505 | - '</ul><p class="alert alert-error">Please create %s manually and/or change access to chmod 775 (or ' . |
|
| 505 | + '</ul><p class="alert alert-error">Please create %s manually and/or change access to chmod 775 (or '. |
|
| 506 | 506 | 'greater if necessary).</p>', |
| 507 | 507 | (1 < $numDirs) ? 'them' : 'it' |
| 508 | 508 | ); |
@@ -519,26 +519,26 @@ discard block |
||
| 519 | 519 | public function checkNoncriticalSettings() |
| 520 | 520 | { |
| 521 | 521 | if ((@ini_get('safe_mode') == 'On' || @ini_get('safe_mode') === 1)) { |
| 522 | - echo '<p class="alert alert-error">The PHP safe mode is enabled. You may have problems when phpMyFAQ tries to write ' . |
|
| 522 | + echo '<p class="alert alert-error">The PHP safe mode is enabled. You may have problems when phpMyFAQ tries to write '. |
|
| 523 | 523 | ' in some directories.</p>'; |
| 524 | 524 | } |
| 525 | - if (! extension_loaded('gd')) { |
|
| 526 | - echo '<p class="alert alert-error">You don\'t have GD support enabled in your PHP installation. Please enable GD ' . |
|
| 525 | + if (!extension_loaded('gd')) { |
|
| 526 | + echo '<p class="alert alert-error">You don\'t have GD support enabled in your PHP installation. Please enable GD '. |
|
| 527 | 527 | 'support in your php.ini file otherwise you can\'t use Captchas for spam protection.</p>'; |
| 528 | 528 | } |
| 529 | - if (! function_exists('imagettftext')) { |
|
| 530 | - echo '<p class="alert alert-error">You don\'t have Freetype support enabled in the GD extension of your PHP ' . |
|
| 531 | - 'installation. Please enable Freetype support in GD extension otherwise the Captchas for spam ' . |
|
| 529 | + if (!function_exists('imagettftext')) { |
|
| 530 | + echo '<p class="alert alert-error">You don\'t have Freetype support enabled in the GD extension of your PHP '. |
|
| 531 | + 'installation. Please enable Freetype support in GD extension otherwise the Captchas for spam '. |
|
| 532 | 532 | 'protection will be quite easy to break.</p>'; |
| 533 | 533 | } |
| 534 | - if (! extension_loaded('curl') || ! extension_loaded('openssl')) { |
|
| 535 | - echo '<p class="alert alert-error">You don\'t have cURL and/or OpenSSL support enabled in your PHP installation. ' . |
|
| 536 | - 'Please enable cURL and/or OpenSSL support in your php.ini file otherwise you can\'t use the Twitter ' . |
|
| 534 | + if (!extension_loaded('curl') || !extension_loaded('openssl')) { |
|
| 535 | + echo '<p class="alert alert-error">You don\'t have cURL and/or OpenSSL support enabled in your PHP installation. '. |
|
| 536 | + 'Please enable cURL and/or OpenSSL support in your php.ini file otherwise you can\'t use the Twitter '. |
|
| 537 | 537 | ' support.</p>'; |
| 538 | 538 | } |
| 539 | - if (! extension_loaded('fileinfo')) { |
|
| 540 | - echo '<p class="alert alert-error">You don\'t have Fileinfo support enabled in your PHP installation. ' . |
|
| 541 | - 'Please enable Fileinfo support in your php.ini file otherwise you can\'t use our backup/restore ' . |
|
| 539 | + if (!extension_loaded('fileinfo')) { |
|
| 540 | + echo '<p class="alert alert-error">You don\'t have Fileinfo support enabled in your PHP installation. '. |
|
| 541 | + 'Please enable Fileinfo support in your php.ini file otherwise you can\'t use our backup/restore '. |
|
| 542 | 542 | 'functionality.</p>'; |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $dbSetup['dbType'] = PMF_Filter::filterInput(INPUT_POST, 'sql_type', FILTER_SANITIZE_STRING); |
| 574 | 574 | if (!is_null($dbSetup['dbType'])) { |
| 575 | 575 | $dbSetup['dbType'] = trim($dbSetup['dbType']); |
| 576 | - if (! file_exists(PMF_ROOT_DIR . '/install/' . $dbSetup['dbType'] . '.sql.php')) { |
|
| 576 | + if (!file_exists(PMF_ROOT_DIR.'/install/'.$dbSetup['dbType'].'.sql.php')) { |
|
| 577 | 577 | printf( |
| 578 | 578 | '<p class="alert alert-error"><strong>Error:</strong> Invalid server type: %s</p>', |
| 579 | 579 | $dbSetup['dbType'] |
@@ -586,25 +586,25 @@ discard block |
||
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | $dbSetup['dbServer'] = PMF_Filter::filterInput(INPUT_POST, 'sql_server', FILTER_SANITIZE_STRING); |
| 589 | - if (is_null($dbSetup['dbServer']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 589 | + if (is_null($dbSetup['dbServer']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 590 | 590 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> Please add a database server.</p>\n"; |
| 591 | 591 | PMF_System::renderFooter(true); |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | $dbSetup['dbUser'] = PMF_Filter::filterInput(INPUT_POST, 'sql_user', FILTER_SANITIZE_STRING); |
| 595 | - if (is_null($dbSetup['dbUser']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 595 | + if (is_null($dbSetup['dbUser']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 596 | 596 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> Please add a database username.</p>\n"; |
| 597 | 597 | PMF_System::renderFooter(true); |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | $dbSetup['dbPassword'] = PMF_Filter::filterInput(INPUT_POST, 'sql_passwort', FILTER_UNSAFE_RAW); |
| 601 | - if (is_null($dbSetup['dbPassword']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 601 | + if (is_null($dbSetup['dbPassword']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 602 | 602 | // Password can be empty... |
| 603 | 603 | $dbSetup['dbPassword'] = ''; |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | $dbSetup['dbDatabaseName'] = PMF_Filter::filterInput(INPUT_POST, 'sql_db', FILTER_SANITIZE_STRING); |
| 607 | - if (is_null($dbSetup['dbDatabaseName']) && ! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 607 | + if (is_null($dbSetup['dbDatabaseName']) && !PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 608 | 608 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> Please add a database name.</p>\n"; |
| 609 | 609 | PMF_System::renderFooter(true); |
| 610 | 610 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $ldapSetup['ldapPassword'] = PMF_Filter::filterInput(INPUT_POST, 'ldap_password', FILTER_SANITIZE_STRING, ''); |
| 659 | 659 | |
| 660 | 660 | // check LDAP connection |
| 661 | - require PMF_ROOT_DIR . "/inc/PMF/Ldap.php"; |
|
| 661 | + require PMF_ROOT_DIR."/inc/PMF/Ldap.php"; |
|
| 662 | 662 | $ldap = new PMF_Ldap($configuration); |
| 663 | 663 | $ldap->connect( |
| 664 | 664 | $ldapSetup['ldapServer'], |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $ldapSetup['ldapPassword'] |
| 669 | 669 | ); |
| 670 | 670 | if (!$ldap) { |
| 671 | - echo "<p class=\"alert alert-error\"><strong>LDAP Error:</strong> " . $ldap->error() . "</p>\n"; |
|
| 671 | + echo "<p class=\"alert alert-error\"><strong>LDAP Error:</strong> ".$ldap->error()."</p>\n"; |
|
| 672 | 672 | PMF_System::renderFooter(true); |
| 673 | 673 | } |
| 674 | 674 | } |
@@ -694,12 +694,12 @@ discard block |
||
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | if (strlen($password) <= 5 || strlen($password_retyped) <= 5) { |
| 697 | - echo '<p class="alert alert-error"><strong>Error:</strong> Your password and retyped password are too short.' . |
|
| 697 | + echo '<p class="alert alert-error"><strong>Error:</strong> Your password and retyped password are too short.'. |
|
| 698 | 698 | ' Please set your password and your retyped password with a minimum of 6 characters.</p>'; |
| 699 | 699 | PMF_System::renderFooter(true); |
| 700 | 700 | } |
| 701 | 701 | if ($password != $password_retyped) { |
| 702 | - echo '<p class="alert alert-error"><strong>Error:</strong> Your password and retyped password are not equal.' . |
|
| 702 | + echo '<p class="alert alert-error"><strong>Error:</strong> Your password and retyped password are not equal.'. |
|
| 703 | 703 | ' Please check your password and your retyped password.</p>'; |
| 704 | 704 | PMF_System::renderFooter(true); |
| 705 | 705 | } |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | $instanceSetup->setRootDir(PMF_ROOT_DIR); |
| 714 | 714 | |
| 715 | 715 | // Write the DB variables in database.php |
| 716 | - if (! $instanceSetup->createDatabaseFile($dbSetup)) { |
|
| 716 | + if (!$instanceSetup->createDatabaseFile($dbSetup)) { |
|
| 717 | 717 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> Setup cannot write to ./config/database.php.</p>"; |
| 718 | 718 | $this->_system->cleanInstallation(); |
| 719 | 719 | PMF_System::renderFooter(true); |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | |
| 722 | 722 | // check LDAP if available |
| 723 | 723 | if (extension_loaded('ldap') && !is_null($ldapEnabled)) { |
| 724 | - if (! $instanceSetup->createLdapFile($ldapSetup, '')) { |
|
| 724 | + if (!$instanceSetup->createLdapFile($ldapSetup, '')) { |
|
| 725 | 725 | echo "<p class=\"alert alert-error\"><strong>Error:</strong> Setup cannot write to ./config/ldap.php.</p>"; |
| 726 | 726 | $this->_system->cleanInstallation(); |
| 727 | 727 | PMF_System::renderFooter(true); |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | // connect to the database using config/database.php |
| 732 | - require PMF_ROOT_DIR . '/config/database.php'; |
|
| 732 | + require PMF_ROOT_DIR.'/config/database.php'; |
|
| 733 | 733 | $db = PMF_Db::factory($dbSetup['dbType']); |
| 734 | 734 | $db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']); |
| 735 | 735 | if (!$db) { |
@@ -738,15 +738,15 @@ discard block |
||
| 738 | 738 | PMF_System::renderFooter(true); |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - require PMF_ROOT_DIR . '/install/' . $dbSetup['dbType'] . '.sql.php'; // CREATE TABLES |
|
| 742 | - require PMF_ROOT_DIR . '/install/stopwords.sql.php'; // INSERTs for stopwords |
|
| 741 | + require PMF_ROOT_DIR.'/install/'.$dbSetup['dbType'].'.sql.php'; // CREATE TABLES |
|
| 742 | + require PMF_ROOT_DIR.'/install/stopwords.sql.php'; // INSERTs for stopwords |
|
| 743 | 743 | |
| 744 | 744 | $this->_system->setDatabase($db); |
| 745 | 745 | |
| 746 | 746 | echo '<p>'; |
| 747 | 747 | |
| 748 | 748 | // Erase any table before starting creating the required ones |
| 749 | - if (! PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 749 | + if (!PMF_System::isSqlite($dbSetup['dbType'])) { |
|
| 750 | 750 | $this->_system->dropTables($uninst); |
| 751 | 751 | } |
| 752 | 752 | |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | } |
| 766 | 766 | usleep(2500); |
| 767 | 767 | $count++; |
| 768 | - if (!($count % 10)) { |
|
| 768 | + if (!($count%10)) { |
|
| 769 | 769 | echo '| '; |
| 770 | 770 | } |
| 771 | 771 | } |
@@ -787,8 +787,8 @@ discard block |
||
| 787 | 787 | |
| 788 | 788 | // add admin account and rights |
| 789 | 789 | $admin = new PMF_User($configuration); |
| 790 | - if (! $admin->createUser($loginname, $password, 1)) { |
|
| 791 | - echo "<p class=\"alert alert-error\"><strong>Fatal installation error:</strong> " . |
|
| 790 | + if (!$admin->createUser($loginname, $password, 1)) { |
|
| 791 | + echo "<p class=\"alert alert-error\"><strong>Fatal installation error:</strong> ". |
|
| 792 | 792 | "Couldn't create the admin user.</p>\n"; |
| 793 | 793 | $this->_system->cleanInstallation(); |
| 794 | 794 | PMF_System::renderFooter(true); |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | $instanceData = array( |
| 813 | 813 | 'url' => $link->getSystemUri($_SERVER['SCRIPT_NAME']), |
| 814 | 814 | 'instance' => $link->getSystemRelativeUri('install/setup.php'), |
| 815 | - 'comment' => 'phpMyFAQ ' . PMF_System::getVersion() |
|
| 815 | + 'comment' => 'phpMyFAQ '.PMF_System::getVersion() |
|
| 816 | 816 | ); |
| 817 | 817 | $faqInstance = new PMF_Instance($configuration); |
| 818 | 818 | $faqInstance->addInstance($instanceData); |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | echo "<p class=\"alert alert-error\">Please delete the file <em>./install/setup.php</em> manually.</p>\n"; |
| 838 | 838 | } |
| 839 | 839 | // Remove 'update.php' file |
| 840 | - if (@unlink(dirname($_SERVER['PATH_TRANSLATED']) . '/update.php')) { |
|
| 840 | + if (@unlink(dirname($_SERVER['PATH_TRANSLATED']).'/update.php')) { |
|
| 841 | 841 | echo "<p class=\"alert alert-success\">The file <em>./install/update.php</em> was deleted automatically.</p>\n"; |
| 842 | 842 | } else { |
| 843 | 843 | echo "<p class=\"alert alert-error\">Please delete the file <em>./install/update.php</em> manually.</p>\n"; |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | { |
| 854 | 854 | $q = new PMF_Questionnaire_Data($this->_mainConfig); |
| 855 | 855 | $options = $q->get(); |
| 856 | - echo '<dl>' . PHP_EOL; |
|
| 856 | + echo '<dl>'.PHP_EOL; |
|
| 857 | 857 | array_walk($options, 'data_printer'); |
| 858 | 858 | printf( |
| 859 | 859 | '</dl><input type="hidden" name="systemdata" value="%s" />', |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The Installer class installs phpMyFAQ. Classy. |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package Installer |
|
| 13 | - * @author Florian Anderiasch <[email protected]> |
|
| 14 | - * @copyright 2002-2016 phpMyFAQ Team |
|
| 15 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | - * @link http://www.phpmyfaq.de |
|
| 17 | - * @since 2012-08-27 |
|
| 18 | - */ |
|
| 3 | + * The Installer class installs phpMyFAQ. Classy. |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package Installer |
|
| 13 | + * @author Florian Anderiasch <[email protected]> |
|
| 14 | + * @copyright 2002-2016 phpMyFAQ Team |
|
| 15 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 16 | + * @link http://www.phpmyfaq.de |
|
| 17 | + * @since 2012-08-27 |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 21 | 21 | exit(); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $captchaCode = str_replace("0", "O", $captchaCode); |
| 256 | 256 | } |
| 257 | 257 | // Sanity check |
| 258 | - for ($i = 0; $i < PMF_String::strlen( $captchaCode ); $i++) { |
|
| 258 | + for ($i = 0; $i < PMF_String::strlen($captchaCode); $i++) { |
|
| 259 | 259 | if (!in_array($captchaCode[$i], $this->letters)) { |
| 260 | 260 | return false; |
| 261 | 261 | } |
@@ -349,16 +349,16 @@ discard block |
||
| 349 | 349 | { |
| 350 | 350 | $len = PMF_String::strlen($this->code); |
| 351 | 351 | $w1 = 15; |
| 352 | - $w2 = $this->width / ($len + 1); |
|
| 352 | + $w2 = $this->width/($len + 1); |
|
| 353 | 353 | |
| 354 | 354 | for ($p = 0; $p < $len; $p++) { |
| 355 | 355 | $letter = $this->code[$p]; |
| 356 | 356 | if (count($this->fonts) > 0) { |
| 357 | 357 | $font = $this->fonts[rand(0, count($this->fonts) - 1)]; |
| 358 | 358 | } |
| 359 | - $size = rand(20, $this->height / 2.2); |
|
| 359 | + $size = rand(20, $this->height/2.2); |
|
| 360 | 360 | $rotation = rand(-23, 23); |
| 361 | - $y = rand($size + 3, $this->height-5); |
|
| 361 | + $y = rand($size + 3, $this->height - 5); |
|
| 362 | 362 | // $w1 += rand(- $this->width / 90, $this->width / 40 ); |
| 363 | 363 | $x = $w1 + $w2*$p; |
| 364 | 364 | $c1 = array(); // fore char color |
@@ -374,28 +374,28 @@ discard block |
||
| 374 | 374 | } while ($c1['b'] == $this->_backgroundColor['b']); |
| 375 | 375 | $c1 = imagecolorallocate($this->img, $c1['r'], $c1['g'], $c1['b']); |
| 376 | 376 | do { |
| 377 | - $c2['r'] = ($c1['r'] < 100 ? $c1['r'] * 2 : mt_rand(30, 199)); |
|
| 377 | + $c2['r'] = ($c1['r'] < 100 ? $c1['r']*2 : mt_rand(30, 199)); |
|
| 378 | 378 | } while (($c2['r'] == $this->_backgroundColor['r']) && ($c2['r'] == $c1['r'])); |
| 379 | 379 | do { |
| 380 | - $c2['g'] = ($c1['g'] < 100 ? $c1['g'] * 2 : mt_rand(30, 199)); |
|
| 380 | + $c2['g'] = ($c1['g'] < 100 ? $c1['g']*2 : mt_rand(30, 199)); |
|
| 381 | 381 | } while (($c2['g'] == $this->_backgroundColor['g']) && ($c2['g'] == $c1['g'])); |
| 382 | 382 | do { |
| 383 | - $c2['b'] = ($c1['b'] < 100 ? $c1['b'] * 2 : mt_rand(30, 199)); |
|
| 383 | + $c2['b'] = ($c1['b'] < 100 ? $c1['b']*2 : mt_rand(30, 199)); |
|
| 384 | 384 | } while (($c2['b'] == $this->_backgroundColor['b']) && ($c2['b'] == $c1['b'])); |
| 385 | 385 | $c2 = imagecolorallocate($this->img, $c2['r'], $c2['g'], $c2['b']); |
| 386 | 386 | // Add the letter |
| 387 | 387 | if (function_exists('imagettftext') && (count($this->fonts) > 0)) { |
| 388 | - imagettftext($this->img, $size, $rotation, $x + 2, $y, $c2, $font, $letter); |
|
| 388 | + imagettftext($this->img, $size, $rotation, $x + 2, $y, $c2, $font, $letter); |
|
| 389 | 389 | imagettftext($this->img, $size, $rotation, $x + 1, $y + 1, $c2, $font, $letter); |
| 390 | - imagettftext($this->img, $size, $rotation, $x, $y-2, $c1, $font, $letter); |
|
| 390 | + imagettftext($this->img, $size, $rotation, $x, $y - 2, $c1, $font, $letter); |
|
| 391 | 391 | } else { |
| 392 | 392 | $size = 5; |
| 393 | 393 | $c3 = imagecolorallocate($this->img, 0, 0, 255); |
| 394 | 394 | $x = 20; |
| 395 | 395 | $y = 12; |
| 396 | 396 | $s = 30; |
| 397 | - imagestring($this->img, $size, $x + 1 + ($s * $p), $y+1, $letter, $c3); |
|
| 398 | - imagestring($this->img, $size, $x + ($s * $p), $y, $letter, $c1); |
|
| 397 | + imagestring($this->img, $size, $x + 1 + ($s*$p), $y + 1, $letter, $c3); |
|
| 398 | + imagestring($this->img, $size, $x + ($s*$p), $y, $letter, $c1); |
|
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | // Create the captcha code |
| 457 | 457 | for ($i = 1; $i <= $caplength; $i++) { |
| 458 | - $j = floor(rand(0,34)); |
|
| 458 | + $j = floor(rand(0, 34)); |
|
| 459 | 459 | $this->code .= $this->letters[$j]; |
| 460 | 460 | } |
| 461 | 461 | if (!$this->saveCaptcha()) { |
@@ -573,6 +573,6 @@ discard block |
||
| 573 | 573 | */ |
| 574 | 574 | private function getFonts() |
| 575 | 575 | { |
| 576 | - return glob(PMF_INCLUDE_DIR . '/fonts/*.ttf'); |
|
| 576 | + return glob(PMF_INCLUDE_DIR.'/fonts/*.ttf'); |
|
| 577 | 577 | } |
| 578 | 578 | } |
@@ -329,8 +329,7 @@ |
||
| 329 | 329 | if ($nextline < 1) { |
| 330 | 330 | $nextline = 2; |
| 331 | 331 | } |
| 332 | - } |
|
| 333 | - else { |
|
| 332 | + } else { |
|
| 334 | 333 | $nextline += rand(1, 7); |
| 335 | 334 | } |
| 336 | 335 | $w1 += rand(-4, 4); |
@@ -1,23 +1,23 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The phpMyFAQ Captcha class |
|
| 4 | - * |
|
| 5 | - * PHP Version 5.3 |
|
| 6 | - * |
|
| 7 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | - * |
|
| 11 | - * @category phpMyFAQ |
|
| 12 | - * @package PMF_Captcha |
|
| 13 | - * @author Thomas Zeithaml <[email protected]> |
|
| 14 | - * @author Thorsten Rinne <[email protected]> |
|
| 15 | - * @author Matteo Scaramuccia <[email protected]> |
|
| 16 | - * @copyright 2006-2016 phpMyFAQ Team |
|
| 17 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 18 | - * @link http://www.phpmyfaq.de |
|
| 19 | - * @since 2006-02-04 |
|
| 20 | - */ |
|
| 3 | + * The phpMyFAQ Captcha class |
|
| 4 | + * |
|
| 5 | + * PHP Version 5.3 |
|
| 6 | + * |
|
| 7 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 8 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 9 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 10 | + * |
|
| 11 | + * @category phpMyFAQ |
|
| 12 | + * @package PMF_Captcha |
|
| 13 | + * @author Thomas Zeithaml <[email protected]> |
|
| 14 | + * @author Thorsten Rinne <[email protected]> |
|
| 15 | + * @author Matteo Scaramuccia <[email protected]> |
|
| 16 | + * @copyright 2006-2016 phpMyFAQ Team |
|
| 17 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 18 | + * @link http://www.phpmyfaq.de |
|
| 19 | + * @since 2006-02-04 |
|
| 20 | + */ |
|
| 21 | 21 | |
| 22 | 22 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 23 | 23 | exit(); |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
| 469 | - * Save the Captcha |
|
| 470 | - * |
|
| 471 | - * @return boolean |
|
| 472 | - */ |
|
| 469 | + * Save the Captcha |
|
| 470 | + * |
|
| 471 | + * @return boolean |
|
| 472 | + */ |
|
| 473 | 473 | private function saveCaptcha() |
| 474 | 474 | { |
| 475 | 475 | $select = sprintf(" |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | %sfaqcaptcha |
| 480 | 480 | WHERE |
| 481 | 481 | id = '%s'", |
| 482 | - PMF_Db::getTablePrefix(), |
|
| 483 | - $this->code |
|
| 482 | + PMF_Db::getTablePrefix(), |
|
| 483 | + $this->code |
|
| 484 | 484 | ); |
| 485 | 485 | |
| 486 | 486 | $result = $this->_config->getDb()->query($select); |