@@ -31,11 +31,11 @@ |
||
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $protocol = 'http'; |
| 34 | -if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){ |
|
| 34 | +if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
|
| 35 | 35 | $protocol = 'https'; |
| 36 | 36 | } |
| 37 | -$parsed = parse_url($protocol . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']); |
|
| 38 | -if (isset($parsed['host']) && strlen($parsed['host']) > 0 && is_dir(__DIR__ . '/' . $parsed['host'])) { |
|
| 39 | - define('PMF_MULTI_INSTANCE_CONFIG_DIR', __DIR__ . '/' . $parsed['host']); |
|
| 37 | +$parsed = parse_url($protocol.'://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']); |
|
| 38 | +if (isset($parsed['host']) && strlen($parsed['host']) > 0 && is_dir(__DIR__.'/'.$parsed['host'])) { |
|
| 39 | + define('PMF_MULTI_INSTANCE_CONFIG_DIR', __DIR__.'/'.$parsed['host']); |
|
| 40 | 40 | unset($parsed); |
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -1,30 +1,30 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Multisite support for phpMyFAQ. |
|
| 4 | - * |
|
| 5 | - * HowTo: |
|
| 6 | - * - Rename this file to <DOCROOT>/multisite/multisite.php |
|
| 7 | - * i.e. /srv/www/faq.example.org/multisite/multisite.php |
|
| 8 | - * - create a folder that's called like the SERVER_NAME inside <DOCROOT>/multi/ |
|
| 9 | - * i.e. /srv/www/faq.example.org/multisite/otherfaq.example.org |
|
| 10 | - * - that is your config folder with the usual contents like database.php |
|
| 11 | - * |
|
| 12 | - * If you don't plan to use multisite support, just delete the multisite directory. |
|
| 13 | - * |
|
| 14 | - * PHP Version 5.5 |
|
| 15 | - * |
|
| 16 | - * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 17 | - * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 18 | - * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 19 | - * |
|
| 20 | - * @category phpMyFAQ |
|
| 21 | - * @package Multisite |
|
| 22 | - * @author Florian Anderiasch <[email protected]> |
|
| 23 | - * @copyright 2012-2016 phpMyFAQ Team |
|
| 24 | - * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 25 | - * @link http://www.phpmyfaq.de |
|
| 26 | - * @since 2012-04-14 |
|
| 27 | - */ |
|
| 3 | + * Multisite support for phpMyFAQ. |
|
| 4 | + * |
|
| 5 | + * HowTo: |
|
| 6 | + * - Rename this file to <DOCROOT>/multisite/multisite.php |
|
| 7 | + * i.e. /srv/www/faq.example.org/multisite/multisite.php |
|
| 8 | + * - create a folder that's called like the SERVER_NAME inside <DOCROOT>/multi/ |
|
| 9 | + * i.e. /srv/www/faq.example.org/multisite/otherfaq.example.org |
|
| 10 | + * - that is your config folder with the usual contents like database.php |
|
| 11 | + * |
|
| 12 | + * If you don't plan to use multisite support, just delete the multisite directory. |
|
| 13 | + * |
|
| 14 | + * PHP Version 5.5 |
|
| 15 | + * |
|
| 16 | + * This Source Code Form is subject to the terms of the Mozilla Public License, |
|
| 17 | + * v. 2.0. If a copy of the MPL was not distributed with this file, You can |
|
| 18 | + * obtain one at http://mozilla.org/MPL/2.0/. |
|
| 19 | + * |
|
| 20 | + * @category phpMyFAQ |
|
| 21 | + * @package Multisite |
|
| 22 | + * @author Florian Anderiasch <[email protected]> |
|
| 23 | + * @copyright 2012-2016 phpMyFAQ Team |
|
| 24 | + * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
|
| 25 | + * @link http://www.phpmyfaq.de |
|
| 26 | + * @since 2012-04-14 |
|
| 27 | + */ |
|
| 28 | 28 | |
| 29 | 29 | if (!defined('IS_VALID_PHPMYFAQ')) { |
| 30 | 30 | exit(); |
@@ -422,7 +422,7 @@ |
||
| 422 | 422 | /** |
| 423 | 423 | * Validate attached file with the real hash. |
| 424 | 424 | * |
| 425 | - * @return bool |
|
| 425 | + * @return boolean|null |
|
| 426 | 426 | */ |
| 427 | 427 | public function validate() |
| 428 | 428 | { |
@@ -364,9 +364,9 @@ |
||
| 364 | 364 | null === $this->realHash || null === $this->filename || |
| 365 | 365 | null === $this->key) { |
| 366 | 366 | throw new PMF_Attachment_Exception('All of id, '. |
| 367 | - 'recordId, hash, filename, '. |
|
| 368 | - 'key is needed to generate '. |
|
| 369 | - 'fs hash for encrypted files'); |
|
| 367 | + 'recordId, hash, filename, '. |
|
| 368 | + 'key is needed to generate '. |
|
| 369 | + 'fs hash for encrypted files'); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $src = $this->id.$this->recordId.$this->realHash. |
@@ -242,7 +242,7 @@ |
||
| 242 | 242 | WHERE |
| 243 | 243 | id = %d', |
| 244 | 244 | PMF_Db::getTablePrefix(), |
| 245 | - (int) $this->id); |
|
| 245 | + (int)$this->id); |
|
| 246 | 246 | |
| 247 | 247 | $result = $this->db->query($sql); |
| 248 | 248 | |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * @param string $query |
| 62 | 62 | * @param string $table |
| 63 | 63 | * |
| 64 | - * @return array |
|
| 64 | + * @return string[] |
|
| 65 | 65 | */ |
| 66 | 66 | public function buildInsertQueries($query, $table) |
| 67 | 67 | { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param string $password |
| 71 | 71 | * @param string $database |
| 72 | 72 | * |
| 73 | - * @return bool TRUE, if connected, otherwise FALSE |
|
| 73 | + * @return null|boolean TRUE, if connected, otherwise FALSE |
|
| 74 | 74 | */ |
| 75 | 75 | public function connect($host, $user, $password, $database = '') |
| 76 | 76 | { |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | * @param string $prefix Table prefix |
| 292 | 292 | * |
| 293 | - * @return array |
|
| 293 | + * @return string[] |
|
| 294 | 294 | */ |
| 295 | 295 | public function getTableNames($prefix = '') |
| 296 | 296 | { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @throws PMF_Exception |
| 70 | 70 | * |
| 71 | - * @return bool true, if connected, otherwise false |
|
| 71 | + * @return null|boolean true, if connected, otherwise false |
|
| 72 | 72 | */ |
| 73 | 73 | public function connect($host, $user, $password, $database = '') |
| 74 | 74 | { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * This function fetches a result row as an object. |
| 146 | 146 | * |
| 147 | - * @param mixed $result |
|
| 147 | + * @param resource $result |
|
| 148 | 148 | * |
| 149 | 149 | * @return mixed |
| 150 | 150 | */ |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * This function fetches a result as an associative array. |
| 160 | 160 | * |
| 161 | - * @param mixed $result |
|
| 161 | + * @param mysqli_result $result |
|
| 162 | 162 | * |
| 163 | 163 | * @return array |
| 164 | 164 | */ |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * |
| 300 | 300 | * @param string $prefix Table prefix |
| 301 | 301 | * |
| 302 | - * @return array |
|
| 302 | + * @return string[] |
|
| 303 | 303 | */ |
| 304 | 304 | public function getTableNames($prefix = '') |
| 305 | 305 | { |
@@ -248,8 +248,8 @@ |
||
| 248 | 248 | MAX(%s) AS current_id |
| 249 | 249 | FROM |
| 250 | 250 | %s', |
| 251 | - $id, |
|
| 252 | - $table); |
|
| 251 | + $id, |
|
| 252 | + $table); |
|
| 253 | 253 | |
| 254 | 254 | $result = $this->query($select); |
| 255 | 255 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @param string $password Password |
| 67 | 67 | * @param string $database Database name |
| 68 | 68 | * |
| 69 | - * @return bool true, if connected, otherwise false |
|
| 69 | + * @return null|boolean true, if connected, otherwise false |
|
| 70 | 70 | */ |
| 71 | 71 | public function connect($host, $user, $password, $database = '') |
| 72 | 72 | { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** |
| 134 | 134 | * Fetch a result row as an object. |
| 135 | 135 | * |
| 136 | - * @param mixed $result |
|
| 136 | + * @param resource $result |
|
| 137 | 137 | * |
| 138 | 138 | * @return mixed |
| 139 | 139 | */ |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | /** |
| 193 | 193 | * Logs the queries. |
| 194 | 194 | * |
| 195 | - * @return int |
|
| 195 | + * @return string |
|
| 196 | 196 | */ |
| 197 | 197 | public function log() |
| 198 | 198 | { |
@@ -203,6 +203,7 @@ discard block |
||
| 203 | 203 | * Returns just one row. |
| 204 | 204 | * |
| 205 | 205 | * @param string |
| 206 | + * @param string $query |
|
| 206 | 207 | * |
| 207 | 208 | * @return string |
| 208 | 209 | */ |
@@ -294,7 +295,7 @@ discard block |
||
| 294 | 295 | * |
| 295 | 296 | * @param string $prefix Table prefix |
| 296 | 297 | * |
| 297 | - * @return array |
|
| 298 | + * @return string[] |
|
| 298 | 299 | */ |
| 299 | 300 | public function getTableNames($prefix = '') |
| 300 | 301 | { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param string |
| 69 | 69 | * @param string |
| 70 | 70 | * |
| 71 | - * @return bool |
|
| 71 | + * @return null|boolean |
|
| 72 | 72 | */ |
| 73 | 73 | public function connect($host, $user, $passwd, $db = '') |
| 74 | 74 | { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param int $offset |
| 89 | 89 | * @param int $rowcount |
| 90 | 90 | * |
| 91 | - * @return mixed $result |
|
| 91 | + * @return SQLite3Result $result |
|
| 92 | 92 | */ |
| 93 | 93 | public function query($query, $offset = 0, $rowcount = 0) |
| 94 | 94 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | /** |
| 125 | 125 | * Fetch a result row as an object. |
| 126 | 126 | * |
| 127 | - * @param mixed $result |
|
| 127 | + * @param SQLite3Result $result |
|
| 128 | 128 | * |
| 129 | 129 | * @return object or NULL if there are no more results |
| 130 | 130 | */ |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @param SQLite3Result $result |
| 159 | 159 | * |
| 160 | - * @return array |
|
| 160 | + * @return SQLite3Result |
|
| 161 | 161 | */ |
| 162 | 162 | public function fetchAssoc($result) |
| 163 | 163 | { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | /** |
| 213 | 213 | * Logs the queries. |
| 214 | 214 | * |
| 215 | - * @return int |
|
| 215 | + * @return string |
|
| 216 | 216 | */ |
| 217 | 217 | public function log() |
| 218 | 218 | { |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @param string $prefix Table prefix |
| 246 | 246 | * |
| 247 | - * @return array |
|
| 247 | + * @return string[] |
|
| 248 | 248 | */ |
| 249 | 249 | public function getTableNames($prefix = '') |
| 250 | 250 | { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $return = $result->fetchArray(SQLITE3_ASSOC); |
| 135 | 135 | |
| 136 | 136 | return $return |
| 137 | - ? (object) $return |
|
| 137 | + ? (object)$return |
|
| 138 | 138 | : null; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $result->fetchedByPMF = true; |
| 186 | 186 | while ($row = $result->fetchArray(SQLITE3_ASSOC)) { |
| 187 | - $ret[] = (object) $row; |
|
| 187 | + $ret[] = (object)$row; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | return $ret; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public function nextId($table, $id) |
| 299 | 299 | { |
| 300 | - $result = (int) $this->conn->querySingle( |
|
| 300 | + $result = (int)$this->conn->querySingle( |
|
| 301 | 301 | sprintf( |
| 302 | 302 | 'SELECT max(%s) AS current_id FROM %s', |
| 303 | 303 | $id, |
@@ -229,7 +229,7 @@ |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
| 232 | - * @return string |
|
| 232 | + * @return integer |
|
| 233 | 233 | */ |
| 234 | 234 | public function getUserId() |
| 235 | 235 | { |
@@ -185,7 +185,7 @@ |
||
| 185 | 185 | * @param PMF_Faq $faq |
| 186 | 186 | * @param string $language |
| 187 | 187 | * |
| 188 | - * @return array |
|
| 188 | + * @return string |
|
| 189 | 189 | */ |
| 190 | 190 | public function createOverview(PMF_Category $category, PMF_Faq $faq, $language = '') |
| 191 | 191 | { |