@@ -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 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | * @param int $record_id Record id |
1066 | 1066 | * @param string $language Language |
1067 | 1067 | * |
1068 | - * @return int |
|
1068 | + * @return boolean |
|
1069 | 1069 | */ |
1070 | 1070 | public function addCategoryRelations(Array $categories, $record_id, $language) |
1071 | 1071 | { |
@@ -1493,7 +1493,7 @@ discard block |
||
1493 | 1493 | * @param int $record_id Record id |
1494 | 1494 | * @param string $record_lang Record language |
1495 | 1495 | * |
1496 | - * @return array |
|
1496 | + * @return boolean |
|
1497 | 1497 | */ |
1498 | 1498 | public function addNewRevision($record_id, $record_lang) |
1499 | 1499 | { |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | * Sets the visibilty of a question. |
1763 | 1763 | * |
1764 | 1764 | * @param int $questionId |
1765 | - * @param string $is_visible |
|
1765 | + * @param string $isVisible |
|
1766 | 1766 | * |
1767 | 1767 | * @return bool |
1768 | 1768 | */ |
@@ -2494,7 +2494,7 @@ discard block |
||
2494 | 2494 | * Build a logic sequence, for a WHERE statement, of those category IDs |
2495 | 2495 | * children of the provided category ID, if any. |
2496 | 2496 | * |
2497 | - * @param $nCatid |
|
2497 | + * @param integer $nCatid |
|
2498 | 2498 | * @param $logicOp |
2499 | 2499 | * @param $oCat |
2500 | 2500 | * |
@@ -2524,14 +2524,14 @@ discard block |
||
2524 | 2524 | /** |
2525 | 2525 | * Build the SQL query for retrieving faq records according to the constraints provided. |
2526 | 2526 | * |
2527 | - * @param $QueryType |
|
2528 | - * @param $nCatid |
|
2529 | - * @param $bDownwards |
|
2530 | - * @param $lang |
|
2531 | - * @param $date |
|
2527 | + * @param string $QueryType |
|
2528 | + * @param integer $nCatid |
|
2529 | + * @param boolean $bDownwards |
|
2530 | + * @param string $lang |
|
2531 | + * @param string $date |
|
2532 | 2532 | * @param $faqid |
2533 | 2533 | * |
2534 | - * @return array |
|
2534 | + * @return string |
|
2535 | 2535 | * |
2536 | 2536 | * @since 2005-11-02 |
2537 | 2537 | * |
@@ -1766,16 +1766,16 @@ discard block |
||
1766 | 1766 | return true; |
1767 | 1767 | } |
1768 | 1768 | |
1769 | - /** |
|
1770 | - * Returns the visibility of a question. |
|
1771 | - * |
|
1772 | - * @param int $questionId |
|
1773 | - * |
|
1774 | - * @return string |
|
1775 | - */ |
|
1776 | - public function getVisibilityOfQuestion($questionId) |
|
1777 | - { |
|
1778 | - $query = sprintf(" |
|
1769 | + /** |
|
1770 | + * Returns the visibility of a question. |
|
1771 | + * |
|
1772 | + * @param int $questionId |
|
1773 | + * |
|
1774 | + * @return string |
|
1775 | + */ |
|
1776 | + public function getVisibilityOfQuestion($questionId) |
|
1777 | + { |
|
1778 | + $query = sprintf(" |
|
1779 | 1779 | SELECT |
1780 | 1780 | is_visible |
1781 | 1781 | FROM |
@@ -1789,15 +1789,15 @@ discard block |
||
1789 | 1789 | $this->_config->getLanguage()->getLanguage() |
1790 | 1790 | ); |
1791 | 1791 | |
1792 | - $result = $this->_config->getDb()->query($query); |
|
1793 | - if ($this->_config->getDb()->numRows($result) > 0) { |
|
1794 | - $row = $this->_config->getDb()->fetchObject($result); |
|
1792 | + $result = $this->_config->getDb()->query($query); |
|
1793 | + if ($this->_config->getDb()->numRows($result) > 0) { |
|
1794 | + $row = $this->_config->getDb()->fetchObject($result); |
|
1795 | 1795 | |
1796 | - return $row->is_visible; |
|
1797 | - } |
|
1796 | + return $row->is_visible; |
|
1797 | + } |
|
1798 | 1798 | |
1799 | - return; |
|
1800 | - } |
|
1799 | + return; |
|
1800 | + } |
|
1801 | 1801 | |
1802 | 1802 | /** |
1803 | 1803 | * Sets the visibilty of a question. |
@@ -2318,18 +2318,18 @@ discard block |
||
2318 | 2318 | return $question; |
2319 | 2319 | } |
2320 | 2320 | |
2321 | - /** |
|
2322 | - * Returns all open questions. |
|
2323 | - * |
|
2324 | - * @param $all boolean If true, then return visible and unvisble questions; otherwise only visible ones |
|
2325 | - * |
|
2326 | - * @return array |
|
2327 | - */ |
|
2328 | - public function getAllOpenQuestions($all = true) |
|
2329 | - { |
|
2330 | - $questions = []; |
|
2331 | - |
|
2332 | - $query = sprintf(" |
|
2321 | + /** |
|
2322 | + * Returns all open questions. |
|
2323 | + * |
|
2324 | + * @param $all boolean If true, then return visible and unvisble questions; otherwise only visible ones |
|
2325 | + * |
|
2326 | + * @return array |
|
2327 | + */ |
|
2328 | + public function getAllOpenQuestions($all = true) |
|
2329 | + { |
|
2330 | + $questions = []; |
|
2331 | + |
|
2332 | + $query = sprintf(" |
|
2333 | 2333 | SELECT |
2334 | 2334 | id, lang, username, email, category_id, question, created, answer_id, is_visible |
2335 | 2335 | FROM |
@@ -2344,9 +2344,9 @@ discard block |
||
2344 | 2344 | ($all == false ? " AND is_visible = 'Y'" : '') |
2345 | 2345 | ); |
2346 | 2346 | |
2347 | - if ($result = $this->_config->getDb()->query($query)) { |
|
2348 | - while ($row = $this->_config->getDb()->fetchObject($result)) { |
|
2349 | - $questions[] = array( |
|
2347 | + if ($result = $this->_config->getDb()->query($query)) { |
|
2348 | + while ($row = $this->_config->getDb()->fetchObject($result)) { |
|
2349 | + $questions[] = array( |
|
2350 | 2350 | 'id' => $row->id, |
2351 | 2351 | 'lang' => $row->lang, |
2352 | 2352 | 'username' => $row->username, |
@@ -2357,11 +2357,11 @@ discard block |
||
2357 | 2357 | 'answer_id' => $row->answer_id, |
2358 | 2358 | 'is_visible' => $row->is_visible, |
2359 | 2359 | ); |
2360 | - } |
|
2361 | - } |
|
2360 | + } |
|
2361 | + } |
|
2362 | 2362 | |
2363 | - return $questions; |
|
2364 | - } |
|
2363 | + return $questions; |
|
2364 | + } |
|
2365 | 2365 | |
2366 | 2366 | /** |
2367 | 2367 | * Updates an existing voting record. |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | * SQL constants definitions |
29 | 29 | */ |
30 | 30 | define('FAQ_SQL_ACTIVE_YES', 'yes'); |
31 | -define('FAQ_SQL_ACTIVE_NO', 'no'); |
|
31 | +define('FAQ_SQL_ACTIVE_NO', 'no'); |
|
32 | 32 | |
33 | 33 | /* |
34 | 34 | * Query type definitions |
35 | 35 | */ |
36 | -define('FAQ_QUERY_TYPE_DEFAULT', 'faq_default'); |
|
37 | -define('FAQ_QUERY_TYPE_APPROVAL', 'faq_approval'); |
|
38 | -define('FAQ_QUERY_TYPE_EXPORT_PDF', 'faq_export_pdf'); |
|
36 | +define('FAQ_QUERY_TYPE_DEFAULT', 'faq_default'); |
|
37 | +define('FAQ_QUERY_TYPE_APPROVAL', 'faq_approval'); |
|
38 | +define('FAQ_QUERY_TYPE_EXPORT_PDF', 'faq_export_pdf'); |
|
39 | 39 | define('FAQ_QUERY_TYPE_EXPORT_XHTML', 'faq_export_xhtml'); |
40 | -define('FAQ_QUERY_TYPE_EXPORT_XML', 'faq_export_xml'); |
|
41 | -define('FAQ_QUERY_TYPE_RSS_LATEST', 'faq_rss_latest'); |
|
40 | +define('FAQ_QUERY_TYPE_EXPORT_XML', 'faq_export_xml'); |
|
41 | +define('FAQ_QUERY_TYPE_RSS_LATEST', 'faq_rss_latest'); |
|
42 | 42 | |
43 | 43 | /* |
44 | 44 | * Sorting type definitions |
@@ -384,12 +384,12 @@ discard block |
||
384 | 384 | |
385 | 385 | $result = $this->_config->getDb()->query($query); |
386 | 386 | $num = $this->_config->getDb()->numRows($result); |
387 | - $pages = (int) ceil($num / $numPerPage); |
|
387 | + $pages = (int)ceil($num/$numPerPage); |
|
388 | 388 | |
389 | 389 | if ($page == 1) { |
390 | 390 | $first = 0; |
391 | 391 | } else { |
392 | - $first = $page * $numPerPage - $numPerPage; |
|
392 | + $first = $page*$numPerPage - $numPerPage; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | if ($num > 0) { |
@@ -570,12 +570,12 @@ discard block |
||
570 | 570 | $result = $this->_config->getDb()->query($query); |
571 | 571 | |
572 | 572 | $num = $this->_config->getDb()->numRows($result); |
573 | - $pages = ceil($num / $this->_config->get('records.numberOfRecordsPerPage')); |
|
573 | + $pages = ceil($num/$this->_config->get('records.numberOfRecordsPerPage')); |
|
574 | 574 | |
575 | 575 | if ($page == 1) { |
576 | 576 | $first = 0; |
577 | 577 | } else { |
578 | - $first = ($page * $this->_config->get('records.numberOfRecordsPerPage')) - $this->_config->get('records.numberOfRecordsPerPage'); |
|
578 | + $first = ($page*$this->_config->get('records.numberOfRecordsPerPage')) - $this->_config->get('records.numberOfRecordsPerPage'); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | if ($num > 0) { |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | AND |
1259 | 1259 | lang = '%s'", |
1260 | 1260 | PMF_Db::getTablePrefix(), |
1261 | - (int) $faqId, |
|
1261 | + (int)$faqId, |
|
1262 | 1262 | $this->_config->getDb()->escape($faqLang) |
1263 | 1263 | ); |
1264 | 1264 | |
@@ -2311,7 +2311,7 @@ discard block |
||
2311 | 2311 | 'category_id' => $row->category_id, |
2312 | 2312 | 'question' => $row->question, |
2313 | 2313 | 'created' => $row->created, |
2314 | - 'is_visible' => $row->is_visible, ); |
|
2314 | + 'is_visible' => $row->is_visible,); |
|
2315 | 2315 | } |
2316 | 2316 | } |
2317 | 2317 | |
@@ -2479,7 +2479,7 @@ discard block |
||
2479 | 2479 | 'revision_id' => $row->revision_id, |
2480 | 2480 | 'user' => $row->usr, |
2481 | 2481 | 'date' => $row->datum, |
2482 | - 'changelog' => $row->what, ); |
|
2482 | + 'changelog' => $row->what,); |
|
2483 | 2483 | } |
2484 | 2484 | } |
2485 | 2485 | |
@@ -2790,13 +2790,13 @@ discard block |
||
2790 | 2790 | $mode, |
2791 | 2791 | PMF_Db::getTablePrefix(), |
2792 | 2792 | $mode, |
2793 | - (int) $recordId); |
|
2793 | + (int)$recordId); |
|
2794 | 2794 | |
2795 | 2795 | $result = $this->_config->getDb()->query($query); |
2796 | 2796 | |
2797 | 2797 | if ($this->_config->getDb()->numRows($result) > 0) { |
2798 | 2798 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
2799 | - $permissions[] = (int) $row->permission; |
|
2799 | + $permissions[] = (int)$row->permission; |
|
2800 | 2800 | } |
2801 | 2801 | } |
2802 | 2802 | |
@@ -3043,7 +3043,7 @@ discard block |
||
3043 | 3043 | $lang |
3044 | 3044 | ); |
3045 | 3045 | |
3046 | - $retval = (bool) $this->_config->getDb()->query($update); |
|
3046 | + $retval = (bool)$this->_config->getDb()->query($update); |
|
3047 | 3047 | } |
3048 | 3048 | |
3049 | 3049 | return $retval; |
@@ -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 | { |
@@ -262,7 +262,7 @@ |
||
262 | 262 | * Adds a configuration item for the database. |
263 | 263 | * |
264 | 264 | * @param string $name |
265 | - * @param mixed $value |
|
265 | + * @param string $value |
|
266 | 266 | * |
267 | 267 | * @return bool |
268 | 268 | */ |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function setId($id) |
107 | 107 | { |
108 | - $this->id = (int) $id; |
|
108 | + $this->id = (int)$id; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $select = sprintf( |
148 | 148 | 'SELECT * FROM %sfaqinstances WHERE id = %d', |
149 | 149 | PMF_Db::getTablePrefix(), |
150 | - (int) $id |
|
150 | + (int)$id |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | $result = $this->config->getDb()->query($select); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | PMF_Db::getTablePrefix(), |
221 | 221 | $data['instance'], |
222 | 222 | $data['comment'], |
223 | - (int) $id |
|
223 | + (int)$id |
|
224 | 224 | ); |
225 | 225 | |
226 | 226 | return $this->config->getDb()->query($update); |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | sprintf( |
240 | 240 | 'DELETE FROM %sfaqinstances WHERE id = %d', |
241 | 241 | PMF_Db::getTablePrefix(), |
242 | - (int) $id |
|
242 | + (int)$id |
|
243 | 243 | ), |
244 | 244 | sprintf( |
245 | 245 | 'DELETE FROM %sfaqinstances_config WHERE instance_id = %d', |
246 | 246 | PMF_Db::getTablePrefix(), |
247 | - (int) $id |
|
247 | + (int)$id |
|
248 | 248 | ), |
249 | 249 | ); |
250 | 250 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | /** |
41 | 41 | * Send the message using SMTP with authorisation. |
42 | 42 | * |
43 | - * @return bool True if successful, false otherwise. |
|
43 | + * @return integer True if successful, false otherwise. |
|
44 | 44 | */ |
45 | 45 | public function send($recipients, Array $headers, $body) |
46 | 46 | { |