@@ -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 | { |
@@ -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 | * |
@@ -1224,8 +1224,8 @@ discard block |
||
1224 | 1224 | |
1225 | 1225 | if ($row = $this->_config->getDb()->fetchObject($result)) { |
1226 | 1226 | return array('id' => $row->id, |
1227 | - 'lang' => $row->lang, |
|
1228 | - 'content' => $row->content, ); |
|
1227 | + 'lang' => $row->lang, |
|
1228 | + 'content' => $row->content, ); |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | return; |
@@ -1725,16 +1725,16 @@ discard block |
||
1725 | 1725 | return true; |
1726 | 1726 | } |
1727 | 1727 | |
1728 | - /** |
|
1729 | - * Returns the visibility of a question. |
|
1730 | - * |
|
1731 | - * @param int $questionId |
|
1732 | - * |
|
1733 | - * @return string |
|
1734 | - */ |
|
1735 | - public function getVisibilityOfQuestion($questionId) |
|
1736 | - { |
|
1737 | - $query = sprintf(" |
|
1728 | + /** |
|
1729 | + * Returns the visibility of a question. |
|
1730 | + * |
|
1731 | + * @param int $questionId |
|
1732 | + * |
|
1733 | + * @return string |
|
1734 | + */ |
|
1735 | + public function getVisibilityOfQuestion($questionId) |
|
1736 | + { |
|
1737 | + $query = sprintf(" |
|
1738 | 1738 | SELECT |
1739 | 1739 | is_visible |
1740 | 1740 | FROM |
@@ -1748,15 +1748,15 @@ discard block |
||
1748 | 1748 | $this->_config->getLanguage()->getLanguage() |
1749 | 1749 | ); |
1750 | 1750 | |
1751 | - $result = $this->_config->getDb()->query($query); |
|
1752 | - if ($this->_config->getDb()->numRows($result) > 0) { |
|
1753 | - $row = $this->_config->getDb()->fetchObject($result); |
|
1751 | + $result = $this->_config->getDb()->query($query); |
|
1752 | + if ($this->_config->getDb()->numRows($result) > 0) { |
|
1753 | + $row = $this->_config->getDb()->fetchObject($result); |
|
1754 | 1754 | |
1755 | - return $row->is_visible; |
|
1756 | - } |
|
1755 | + return $row->is_visible; |
|
1756 | + } |
|
1757 | 1757 | |
1758 | - return; |
|
1759 | - } |
|
1758 | + return; |
|
1759 | + } |
|
1760 | 1760 | |
1761 | 1761 | /** |
1762 | 1762 | * Sets the visibilty of a question. |
@@ -2277,18 +2277,18 @@ discard block |
||
2277 | 2277 | return $question; |
2278 | 2278 | } |
2279 | 2279 | |
2280 | - /** |
|
2281 | - * Returns all open questions. |
|
2282 | - * |
|
2283 | - * @param $all boolean If true, then return visible and unvisble questions; otherwise only visible ones |
|
2284 | - * |
|
2285 | - * @return array |
|
2286 | - */ |
|
2287 | - public function getAllOpenQuestions($all = true) |
|
2288 | - { |
|
2289 | - $questions = []; |
|
2290 | - |
|
2291 | - $query = sprintf(" |
|
2280 | + /** |
|
2281 | + * Returns all open questions. |
|
2282 | + * |
|
2283 | + * @param $all boolean If true, then return visible and unvisble questions; otherwise only visible ones |
|
2284 | + * |
|
2285 | + * @return array |
|
2286 | + */ |
|
2287 | + public function getAllOpenQuestions($all = true) |
|
2288 | + { |
|
2289 | + $questions = []; |
|
2290 | + |
|
2291 | + $query = sprintf(" |
|
2292 | 2292 | SELECT |
2293 | 2293 | id, lang, username, email, category_id, question, created, answer_id, is_visible |
2294 | 2294 | FROM |
@@ -2303,9 +2303,9 @@ discard block |
||
2303 | 2303 | ($all == false ? " AND is_visible = 'Y'" : '') |
2304 | 2304 | ); |
2305 | 2305 | |
2306 | - if ($result = $this->_config->getDb()->query($query)) { |
|
2307 | - while ($row = $this->_config->getDb()->fetchObject($result)) { |
|
2308 | - $questions[] = array( |
|
2306 | + if ($result = $this->_config->getDb()->query($query)) { |
|
2307 | + while ($row = $this->_config->getDb()->fetchObject($result)) { |
|
2308 | + $questions[] = array( |
|
2309 | 2309 | 'id' => $row->id, |
2310 | 2310 | 'lang' => $row->lang, |
2311 | 2311 | 'username' => $row->username, |
@@ -2316,11 +2316,11 @@ discard block |
||
2316 | 2316 | 'answer_id' => $row->answer_id, |
2317 | 2317 | 'is_visible' => $row->is_visible, |
2318 | 2318 | ); |
2319 | - } |
|
2320 | - } |
|
2319 | + } |
|
2320 | + } |
|
2321 | 2321 | |
2322 | - return $questions; |
|
2323 | - } |
|
2322 | + return $questions; |
|
2323 | + } |
|
2324 | 2324 | |
2325 | 2325 | /** |
2326 | 2326 | * Updates an existing voting record. |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | /* |
30 | 30 | * SQL constants definitions |
31 | 31 | */ |
32 | -define('FAQ_SQL_YES', 'y'); |
|
33 | -define('FAQ_SQL_NO', 'n'); |
|
32 | +define('FAQ_SQL_YES', 'y'); |
|
33 | +define('FAQ_SQL_NO', 'n'); |
|
34 | 34 | define('FAQ_SQL_ACTIVE_YES', 'yes'); |
35 | -define('FAQ_SQL_ACTIVE_NO', 'no'); |
|
35 | +define('FAQ_SQL_ACTIVE_NO', 'no'); |
|
36 | 36 | |
37 | 37 | /* |
38 | 38 | * Query type definitions |
39 | 39 | */ |
40 | -define('FAQ_QUERY_TYPE_DEFAULT', 'faq_default'); |
|
41 | -define('FAQ_QUERY_TYPE_APPROVAL', 'faq_approval'); |
|
42 | -define('FAQ_QUERY_TYPE_EXPORT_PDF', 'faq_export_pdf'); |
|
40 | +define('FAQ_QUERY_TYPE_DEFAULT', 'faq_default'); |
|
41 | +define('FAQ_QUERY_TYPE_APPROVAL', 'faq_approval'); |
|
42 | +define('FAQ_QUERY_TYPE_EXPORT_PDF', 'faq_export_pdf'); |
|
43 | 43 | define('FAQ_QUERY_TYPE_EXPORT_XHTML', 'faq_export_xhtml'); |
44 | -define('FAQ_QUERY_TYPE_EXPORT_XML', 'faq_export_xml'); |
|
45 | -define('FAQ_QUERY_TYPE_RSS_LATEST', 'faq_rss_latest'); |
|
44 | +define('FAQ_QUERY_TYPE_EXPORT_XML', 'faq_export_xml'); |
|
45 | +define('FAQ_QUERY_TYPE_RSS_LATEST', 'faq_rss_latest'); |
|
46 | 46 | |
47 | 47 | /* |
48 | 48 | * Sorting type definitions |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | |
391 | 391 | $result = $this->_config->getDb()->query($query); |
392 | 392 | $num = $this->_config->getDb()->numRows($result); |
393 | - $pages = (int) ceil($num / $numPerPage); |
|
393 | + $pages = (int)ceil($num/$numPerPage); |
|
394 | 394 | |
395 | 395 | if ($page == 1) { |
396 | 396 | $first = 0; |
397 | 397 | } else { |
398 | - $first = $page * $numPerPage - $numPerPage; |
|
398 | + $first = $page*$numPerPage - $numPerPage; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | if ($num > 0) { |
@@ -576,12 +576,12 @@ discard block |
||
576 | 576 | $result = $this->_config->getDb()->query($query); |
577 | 577 | |
578 | 578 | $num = $this->_config->getDb()->numRows($result); |
579 | - $pages = ceil($num / $this->_config->get('records.numberOfRecordsPerPage')); |
|
579 | + $pages = ceil($num/$this->_config->get('records.numberOfRecordsPerPage')); |
|
580 | 580 | |
581 | 581 | if ($page == 1) { |
582 | 582 | $first = 0; |
583 | 583 | } else { |
584 | - $first = ($page * $this->_config->get('records.numberOfRecordsPerPage')) - $this->_config->get('records.numberOfRecordsPerPage'); |
|
584 | + $first = ($page*$this->_config->get('records.numberOfRecordsPerPage')) - $this->_config->get('records.numberOfRecordsPerPage'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | if ($num > 0) { |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | if ($row = $this->_config->getDb()->fetchObject($result)) { |
1226 | 1226 | return array('id' => $row->id, |
1227 | 1227 | 'lang' => $row->lang, |
1228 | - 'content' => $row->content, ); |
|
1228 | + 'content' => $row->content,); |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | return; |
@@ -2270,7 +2270,7 @@ discard block |
||
2270 | 2270 | 'category_id' => $row->category_id, |
2271 | 2271 | 'question' => $row->question, |
2272 | 2272 | 'created' => $row->created, |
2273 | - 'is_visible' => $row->is_visible, ); |
|
2273 | + 'is_visible' => $row->is_visible,); |
|
2274 | 2274 | } |
2275 | 2275 | } |
2276 | 2276 | |
@@ -2438,7 +2438,7 @@ discard block |
||
2438 | 2438 | 'revision_id' => $row->revision_id, |
2439 | 2439 | 'user' => $row->usr, |
2440 | 2440 | 'date' => $row->datum, |
2441 | - 'changelog' => $row->what, ); |
|
2441 | + 'changelog' => $row->what,); |
|
2442 | 2442 | } |
2443 | 2443 | } |
2444 | 2444 | |
@@ -2749,13 +2749,13 @@ discard block |
||
2749 | 2749 | $mode, |
2750 | 2750 | PMF_Db::getTablePrefix(), |
2751 | 2751 | $mode, |
2752 | - (int) $recordId); |
|
2752 | + (int)$recordId); |
|
2753 | 2753 | |
2754 | 2754 | $result = $this->_config->getDb()->query($query); |
2755 | 2755 | |
2756 | 2756 | if ($this->_config->getDb()->numRows($result) > 0) { |
2757 | 2757 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
2758 | - $permissions[] = (int) $row->permission; |
|
2758 | + $permissions[] = (int)$row->permission; |
|
2759 | 2759 | } |
2760 | 2760 | } |
2761 | 2761 | |
@@ -3002,7 +3002,7 @@ discard block |
||
3002 | 3002 | $lang |
3003 | 3003 | ); |
3004 | 3004 | |
3005 | - $retval = (bool) $this->_config->getDb()->query($update); |
|
3005 | + $retval = (bool)$this->_config->getDb()->query($update); |
|
3006 | 3006 | } |
3007 | 3007 | |
3008 | 3008 | 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 | { |