@@ -124,7 +124,7 @@ |
||
124 | 124 | /** |
125 | 125 | * Add the matching columns into the columns for the resultset |
126 | 126 | * |
127 | - * @return PMF_Search_Database |
|
127 | + * @return string |
|
128 | 128 | */ |
129 | 129 | public function getMatchingColumnsAsResult() |
130 | 130 | { |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | } else { |
61 | 61 | $enableRelevance = $this->_config->get('search.enableRelevance'); |
62 | 62 | |
63 | - $columns = $this->getResultColumns(); |
|
63 | + $columns = $this->getResultColumns(); |
|
64 | 64 | $columns .= ($enableRelevance) ? $this->getMatchingColumnsAsResult($searchTerm) : ''; |
65 | - $orderBy = ($enableRelevance) ? 'ORDER BY ' . $this->getMatchingOrder() : ''; |
|
65 | + $orderBy = ($enableRelevance) ? 'ORDER BY '.$this->getMatchingOrder() : ''; |
|
66 | 66 | |
67 | 67 | $query = sprintf(" |
68 | 68 | SELECT |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->getJoinedTable(), |
79 | 79 | $this->getJoinedColumns(), |
80 | 80 | ($enableRelevance) |
81 | - ? ", plainto_tsquery('" . $this->_config->getDb()->escape($searchTerm) . "') query " |
|
81 | + ? ", plainto_tsquery('".$this->_config->getDb()->escape($searchTerm)."') query " |
|
82 | 82 | : '', |
83 | 83 | $this->getMatchingColumns(), |
84 | 84 | $this->_config->getDb()->escape($searchTerm), |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | foreach ($this->matchingColumns as $matchColumn) { |
107 | 107 | $match = sprintf("to_tsvector(coalesce(%s,''))", $matchColumn); |
108 | 108 | if (empty($machColumns)) { |
109 | - $machColumns .= '(' . $match; |
|
109 | + $machColumns .= '('.$match; |
|
110 | 110 | } else { |
111 | - $machColumns .= ' || ' . $match; |
|
111 | + $machColumns .= ' || '.$match; |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Add the ILIKE since the FULLTEXT looks for the exact phrase only |
116 | - $machColumns .= ') @@ query) OR (' . implode(" || ' ' || ", $this->matchingColumns); |
|
116 | + $machColumns .= ') @@ query) OR ('.implode(" || ' ' || ", $this->matchingColumns); |
|
117 | 117 | } else { |
118 | 118 | $machColumns = implode(" || ' ' || ", $this->matchingColumns); |
119 | 119 | } |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | $columnName = substr(strstr($matchColumn, '.'), 1); |
144 | 144 | |
145 | 145 | if (isset($weight[$columnName])) { |
146 | - $column = sprintf("ts_rank_cd(setweight(to_tsvector(coalesce(%s,'')), '" . $weight[$columnName] |
|
146 | + $column = sprintf("ts_rank_cd(setweight(to_tsvector(coalesce(%s,'')), '".$weight[$columnName] |
|
147 | 147 | . "'), query) AS rel_%s", |
148 | 148 | $matchColumn, |
149 | 149 | $columnName); |
150 | 150 | |
151 | - $resultColumns .= ', ' . $column; |
|
151 | + $resultColumns .= ', '.$column; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | $order = ''; |
169 | 169 | |
170 | 170 | foreach ($list as $field) { |
171 | - $string = 'rel_' . $field . ' DESC'; |
|
171 | + $string = 'rel_'.$field.' DESC'; |
|
172 | 172 | if (empty($order)) { |
173 | 173 | $order .= $string; |
174 | 174 | } else { |
175 | - $order .= ', ' . $string; |
|
175 | + $order .= ', '.$string; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * Returns all available first letters |
104 | 104 | * |
105 | - * @return array |
|
105 | + * @return string |
|
106 | 106 | * @since 2007-03-30 |
107 | 107 | * @author Thorsten Rinne <[email protected]> |
108 | 108 | */ |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * Returns all records from the current first letter |
209 | 209 | * |
210 | 210 | * @param string $letter Letter |
211 | - * @return array |
|
211 | + * @return string |
|
212 | 212 | * @since 2007-03-30 |
213 | 213 | * @author Thorsten Rinne <[email protected]> |
214 | 214 | */ |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $this->_config->getLanguage()->getLanguage()); |
197 | 197 | $oLink = new PMF_Link($url, $this->_config); |
198 | 198 | $oLink->text = (string)$letters; |
199 | - $writeLetters .= '<li>' . $oLink->toHtmlAnchor().'</li>'; |
|
199 | + $writeLetters .= '<li>'.$oLink->toHtmlAnchor().'</li>'; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | $writeLetters .= '</ul>'; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | $writeMap = ''; |
234 | 234 | |
235 | - switch($this->type) { |
|
235 | + switch ($this->type) { |
|
236 | 236 | case 'db2': |
237 | 237 | case 'sqlite': |
238 | 238 | $query = sprintf(" |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | $oLink->tooltip = $title; |
332 | 332 | |
333 | 333 | $writeMap .= '<li>'.$oLink->toHtmlAnchor().'<br />'."\n"; |
334 | - $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25). " ...</li>\n"; |
|
334 | + $writeMap .= PMF_Utils::chopString(strip_tags($row->snap), 25)." ...</li>\n"; |
|
335 | 335 | } |
336 | 336 | $oldId = $row->id; |
337 | 337 | } |
338 | 338 | |
339 | - $writeMap = empty($writeMap) ? '' : '<ul>' . $writeMap . '</ul>'; |
|
339 | + $writeMap = empty($writeMap) ? '' : '<ul>'.$writeMap.'</ul>'; |
|
340 | 340 | |
341 | 341 | return $writeMap; |
342 | 342 | } |
@@ -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 | { |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return array|string |
239 | 239 | */ |
240 | - public function preg_replace_callback($pattern, $callback, $subject, $limit= -1, &$count = 0) |
|
240 | + public function preg_replace_callback($pattern, $callback, $subject, $limit = -1, &$count = 0) |
|
241 | 241 | { |
242 | - if(is_array($pattern)) { |
|
243 | - foreach($pattern as &$p) { |
|
242 | + if (is_array($pattern)) { |
|
243 | + foreach ($pattern as &$p) { |
|
244 | 244 | $p = self::appendU($p); |
245 | 245 | } |
246 | 246 | } else { |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return array|string|null |
263 | 263 | */ |
264 | - public function preg_replace($pattern, $replacement, $subject, $limit= -1, &$count = 0) |
|
264 | + public function preg_replace($pattern, $replacement, $subject, $limit = -1, &$count = 0) |
|
265 | 265 | { |
266 | - if(is_array($pattern)) { |
|
267 | - foreach($pattern as &$p) { |
|
266 | + if (is_array($pattern)) { |
|
267 | + foreach ($pattern as &$p) { |
|
268 | 268 | $p = self::appendU($p); |
269 | 269 | } |
270 | 270 | } else { |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | */ |
286 | 286 | private static function appendU($str) |
287 | 287 | { |
288 | - $str = (string) $str; |
|
288 | + $str = (string)$str; |
|
289 | 289 | |
290 | - return parent::isUTF8($str) ? $str . 'u' : $str; |
|
290 | + return parent::isUTF8($str) ? $str.'u' : $str; |
|
291 | 291 | } |
292 | 292 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param string $language |
67 | 67 | * |
68 | - * @return PMF_String_Basic |
|
68 | + * @return PMF_String_UTF8ToLatinConvertable |
|
69 | 69 | */ |
70 | 70 | public static function getInstance($language = 'en') |
71 | 71 | { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param string $needle Needle |
187 | 187 | * @param boolean $part Part |
188 | 188 | * |
189 | - * @return string|false |
|
189 | + * @return string |
|
190 | 190 | */ |
191 | 191 | public function strstr($haystack, $needle, $part = false) |
192 | 192 | { |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return array|string |
300 | 300 | */ |
301 | - public function preg_replace_callback($pattern, $callback, $subject, $limit= -1, &$count = 0) |
|
301 | + public function preg_replace_callback($pattern, $callback, $subject, $limit = -1, &$count = 0) |
|
302 | 302 | { |
303 | 303 | if (is_array($pattern)) { |
304 | - foreach($pattern as &$p) { |
|
304 | + foreach ($pattern as &$p) { |
|
305 | 305 | $p = self::appendU($p); |
306 | 306 | } |
307 | 307 | } else { |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return array|string|null |
324 | 324 | */ |
325 | - public function preg_replace($pattern, $replacement, $subject, $limit= -1, &$count = 0) |
|
325 | + public function preg_replace($pattern, $replacement, $subject, $limit = -1, &$count = 0) |
|
326 | 326 | { |
327 | 327 | if (is_array($pattern)) { |
328 | - foreach($pattern as &$p) { |
|
328 | + foreach ($pattern as &$p) { |
|
329 | 329 | $p = self::appendU($p); |
330 | 330 | } |
331 | 331 | } else { |
@@ -346,6 +346,6 @@ discard block |
||
346 | 346 | */ |
347 | 347 | private static function appendU($str) |
348 | 348 | { |
349 | - return ((string) $str) . 'u'; |
|
349 | + return ((string)$str).'u'; |
|
350 | 350 | } |
351 | 351 | } |
@@ -14,7 +14,6 @@ |
||
14 | 14 | * @author Matteo Scaramuccia <[email protected]> |
15 | 15 | * @copyright 2009-2016 phpMyFAQ Team |
16 | 16 | * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
17 | - |
|
18 | 17 | * @link http://www.phpmyfaq.de |
19 | 18 | * @since 2009-09-24 |
20 | 19 | */ |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * This function multiplies blocks |
267 | 267 | * |
268 | 268 | * @param string $block Blockname |
269 | - * @param array $blockContent Content of block |
|
269 | + * @param string $blockContent Content of block |
|
270 | 270 | * |
271 | 271 | * @return string implode('', $tmpBlock) |
272 | 272 | */ |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param string $content Content to check |
360 | 360 | * |
361 | - * @return array |
|
361 | + * @return string |
|
362 | 362 | */ |
363 | 363 | private function _checkContent($content) |
364 | 364 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | foreach ($myTemplate as $templateName => $filename) { |
90 | 90 | $this->templates[$templateName] = $this->_include( |
91 | - 'assets/template/' . $tplSetName . '/' . $filename, |
|
91 | + 'assets/template/'.$tplSetName.'/'.$filename, |
|
92 | 92 | $templateName |
93 | 93 | ); |
94 | 94 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function merge($from, $into) |
106 | 106 | { |
107 | - $this->outputs[$into] = str_replace('{' . $from . '}', $this->outputs[$from], $this->outputs[$into]); |
|
107 | + $this->outputs[$into] = str_replace('{'.$from.'}', $this->outputs[$from], $this->outputs[$into]); |
|
108 | 108 | $this->outputs[$from] = null; |
109 | 109 | } |
110 | 110 | |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | foreach ($rawBlocks as $key => $rawBlock) { |
127 | 127 | if (in_array($key, $this->blocksTouched) && $key != 'unblocked') { |
128 | 128 | $tmp = str_replace($rawBlock, $this->blocks[$templateName][$key], $tmp); |
129 | - $tmp = str_replace('[' . $key . ']', '', $tmp); |
|
130 | - $tmp = str_replace('[/' . $key . ']', '', $tmp); |
|
129 | + $tmp = str_replace('['.$key.']', '', $tmp); |
|
130 | + $tmp = str_replace('[/'.$key.']', '', $tmp); |
|
131 | 131 | } elseif ($key != 'unblocked') { |
132 | 132 | $tmp = str_replace($rawBlock, '', $tmp); |
133 | - $tmp = str_replace('[' . $key . ']', '', $tmp); |
|
134 | - $tmp = str_replace('[/' . $key . ']', '', $tmp); |
|
133 | + $tmp = str_replace('['.$key.']', '', $tmp); |
|
134 | + $tmp = str_replace('[/'.$key.']', '', $tmp); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | } else { |
290 | 290 | die('Wrong parameter length!'); |
291 | 291 | } |
292 | - } else{ |
|
292 | + } else { |
|
293 | 293 | //multiply strings to $multiplyTimes |
294 | - for ($i=0; $i<$multiplyTimes; $i++){ |
|
294 | + for ($i = 0; $i < $multiplyTimes; $i++) { |
|
295 | 295 | $replace[$var][] = $val; |
296 | 296 | } |
297 | 297 | } |
@@ -326,20 +326,20 @@ discard block |
||
326 | 326 | $unblocked = $tpl; |
327 | 327 | if (isset($tmpBlocks)) { |
328 | 328 | $blockCount = count($tmpBlocks[0]); |
329 | - for ($i = 0 ; $i < $blockCount; $i++) { |
|
329 | + for ($i = 0; $i < $blockCount; $i++) { |
|
330 | 330 | $name = ''; |
331 | 331 | //find block name |
332 | 332 | PMF_String::preg_match('/\[.+\]/', $tmpBlocks[0][$i], $name); |
333 | 333 | $name = PMF_String::preg_replace('/[\[\[\/\]]/', '', $name); |
334 | 334 | //remove block tags from block |
335 | - $res = str_replace('[' . $name[0] . ']','',$tmpBlocks[0][$i]); |
|
336 | - $res = str_replace('[/' . $name[0] . ']','',$res); |
|
335 | + $res = str_replace('['.$name[0].']', '', $tmpBlocks[0][$i]); |
|
336 | + $res = str_replace('[/'.$name[0].']', '', $res); |
|
337 | 337 | $tplBlocks[$name[0]] = $res; |
338 | 338 | |
339 | 339 | //unblocked content |
340 | 340 | $unblocked = str_replace($tplBlocks[$name[0]], '', $unblocked); |
341 | - $unblocked = str_replace('[' . $name[0] . ']','',$unblocked); |
|
342 | - $unblocked = str_replace('[/' . $name[0] . ']','',$unblocked); |
|
341 | + $unblocked = str_replace('['.$name[0].']', '', $unblocked); |
|
342 | + $unblocked = str_replace('[/'.$name[0].']', '', $unblocked); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | $hits = array(); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $search = array('#<\?php#i', '#\{$\{#', '#<\?#', '#<\%#', '#`#', '#<script[^>]+php#mi'); |
367 | 367 | $phppattern1 = "<?php"; |
368 | 368 | $phppattern2 = "<?"; |
369 | - $replace = array($phppattern1, '', $phppattern2, '', '' ); |
|
369 | + $replace = array($phppattern1, '', $phppattern2, '', ''); |
|
370 | 370 | |
371 | 371 | // Hack: Backtick Fix |
372 | 372 | $content = str_replace('`', '´', $content); |
@@ -184,7 +184,7 @@ |
||
184 | 184 | * |
185 | 185 | * @param string $val Value |
186 | 186 | * |
187 | - * @return boolean |
|
187 | + * @return integer |
|
188 | 188 | */ |
189 | 189 | public function isValIgnorable($val) |
190 | 190 | { |
@@ -125,7 +125,7 @@ |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - $retval = floor(100 * $countTranslated / $countAll); |
|
128 | + $retval = floor(100*$countTranslated/$countAll); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | unset($exemplary, $toCheck); |
@@ -480,7 +480,7 @@ |
||
480 | 480 | * @param string $login Login name |
481 | 481 | * @param string $pass Password |
482 | 482 | * @param integer $userId User ID |
483 | - * @return mixed |
|
483 | + * @return boolean |
|
484 | 484 | */ |
485 | 485 | public function createUser($login, $pass = '', $userId = 0) |
486 | 486 | { |
@@ -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); |
@@ -266,8 +266,8 @@ |
||
266 | 266 | %sfaquser |
267 | 267 | WHERE |
268 | 268 | user_id = %d", |
269 | - PMF_Db::getTablePrefix(), |
|
270 | - (int) $userId); |
|
269 | + PMF_Db::getTablePrefix(), |
|
270 | + (int) $userId); |
|
271 | 271 | |
272 | 272 | $res = $this->config->getDb()->query($select); |
273 | 273 | if ($this->config->getDb()->numRows($res) != 1) { |
@@ -267,15 +267,15 @@ discard block |
||
267 | 267 | WHERE |
268 | 268 | user_id = %d", |
269 | 269 | PMF_Db::getTablePrefix(), |
270 | - (int) $userId); |
|
270 | + (int)$userId); |
|
271 | 271 | |
272 | 272 | $res = $this->config->getDb()->query($select); |
273 | 273 | if ($this->config->getDb()->numRows($res) != 1) { |
274 | - $this->errors[] = self::ERROR_USER_NO_USERID . 'error(): ' . $this->config->getDb()->error(); |
|
274 | + $this->errors[] = self::ERROR_USER_NO_USERID.'error(): '.$this->config->getDb()->error(); |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | $user = $this->config->getDb()->fetchArray($res); |
278 | - $this->userId = (int) $user['user_id']; |
|
278 | + $this->userId = (int)$user['user_id']; |
|
279 | 279 | $this->login = (string)$user['login']; |
280 | 280 | $this->status = (string)$user['account_status']; |
281 | 281 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $res = $this->config->getDb()->query($select); |
297 | 297 | if ($this->config->getDb()->numRows($res) != 1) { |
298 | - $this->errors[] = self::ERROR_USER_NO_USERLOGINDATA . 'error(): ' . $this->config->getDb()->error(); |
|
298 | + $this->errors[] = self::ERROR_USER_NO_USERLOGINDATA.'error(): '.$this->config->getDb()->error(); |
|
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | } |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | return false; |
340 | 340 | } |
341 | 341 | $user = $this->config->getDb()->fetchArray($res); |
342 | - $this->userId = (int) $user['user_id']; |
|
343 | - $this->login = (string) $user['login']; |
|
344 | - $this->status = (string) $user['account_status']; |
|
342 | + $this->userId = (int)$user['user_id']; |
|
343 | + $this->login = (string)$user['login']; |
|
344 | + $this->status = (string)$user['account_status']; |
|
345 | 345 | |
346 | 346 | // get user-data |
347 | 347 | if (!$this->userdata instanceof PMF_User_UserData) { |
@@ -386,9 +386,9 @@ discard block |
||
386 | 386 | return false; |
387 | 387 | } |
388 | 388 | |
389 | - $this->userId = (int) $user['user_id']; |
|
390 | - $this->login = (string) $user['login']; |
|
391 | - $this->status = (string) $user['account_status']; |
|
389 | + $this->userId = (int)$user['user_id']; |
|
390 | + $this->login = (string)$user['login']; |
|
391 | + $this->status = (string)$user['account_status']; |
|
392 | 392 | |
393 | 393 | // get user-data |
394 | 394 | if (!$this->userdata instanceof PMF_User_UserData) { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | |
464 | 464 | // set user-ID |
465 | 465 | if (0 == $userId) { |
466 | - $this->userId = (int) $this->config->getDb()->nextId(PMF_Db::getTablePrefix() . 'faquser', 'user_id'); |
|
466 | + $this->userId = (int)$this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faquser', 'user_id'); |
|
467 | 467 | } else { |
468 | 468 | $this->userId = $userId; |
469 | 469 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | continue; |
504 | 504 | } |
505 | 505 | if (!$auth->add($login, $pass)) { |
506 | - $this->errors[] = self::ERROR_USER_CANNOT_CREATE_USER . 'in Auth ' . $name; |
|
506 | + $this->errors[] = self::ERROR_USER_CANNOT_CREATE_USER.'in Auth '.$name; |
|
507 | 507 | } else { |
508 | 508 | $success = true; |
509 | 509 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | } |
535 | 535 | |
536 | 536 | if (isset($this->allowedStatus[$this->status]) && $this->allowedStatus[$this->status] == self::STATUS_USER_PROTECTED) { |
537 | - $this->errors[] = self::ERROR_USER_CANNOT_DELETE_USER . self::STATUS_USER_PROTECTED; |
|
537 | + $this->errors[] = self::ERROR_USER_CANNOT_DELETE_USER.self::STATUS_USER_PROTECTED; |
|
538 | 538 | return false; |
539 | 539 | } |
540 | 540 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | |
552 | 552 | $res = $this->config->getDb()->query($delete); |
553 | 553 | if (!$res) { |
554 | - $this->errors[] = self::ERROR_USER_CANNOT_DELETE_USER . 'error(): ' . $this->config->getDb()->error(); |
|
554 | + $this->errors[] = self::ERROR_USER_CANNOT_DELETE_USER.'error(): '.$this->config->getDb()->error(); |
|
555 | 555 | return false; |
556 | 556 | } |
557 | 557 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | $readOnly = 0; |
568 | 568 | $authCount = 0; |
569 | - $delete = []; |
|
569 | + $delete = []; |
|
570 | 570 | foreach ($this->authContainer as $auth) { |
571 | 571 | $authCount++; |
572 | 572 | if ($auth->setReadOnly()) { |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | { |
685 | 685 | $message = ''; |
686 | 686 | foreach ($this->errors as $error) { |
687 | - $message .= $error . "<br>\n"; |
|
687 | + $message .= $error."<br>\n"; |
|
688 | 688 | } |
689 | 689 | $this->errors = []; |
690 | - return $message . '<br>' . implode('<br>', debug_backtrace()); |
|
690 | + return $message.'<br>'.implode('<br>', debug_backtrace()); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | /** |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | */ |
705 | 705 | public function isValidLogin($login) |
706 | 706 | { |
707 | - $login = (string) $login; |
|
707 | + $login = (string)$login; |
|
708 | 708 | |
709 | 709 | if (strlen($login) < $this->loginMinLength || !preg_match($this->validUsername, $login)) { |
710 | 710 | $this->errors[] = self::ERROR_USER_LOGIN_INVALID; |
@@ -822,8 +822,8 @@ discard block |
||
822 | 822 | */ |
823 | 823 | private function createPassword() |
824 | 824 | { |
825 | - srand((double)microtime() * 1000000); |
|
826 | - return (string) uniqid(rand()); |
|
825 | + srand((double)microtime()*1000000); |
|
826 | + return (string)uniqid(rand()); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | /** |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * Returns the field $field of the user data. If $field is an |
70 | 70 | * array, an associative array will be returned. |
71 | 71 | * |
72 | - * @param mixed $field Field(s) |
|
72 | + * @param string $field Field(s) |
|
73 | 73 | * @return mixed |
74 | 74 | */ |
75 | 75 | public function get($field) |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | $this->userId = $userId; |
183 | - $select = sprintf(" |
|
183 | + $select = sprintf(" |
|
184 | 184 | SELECT |
185 | 185 | last_modified, |
186 | 186 | display_name, |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function add($userId) |
242 | 242 | { |
243 | - $userId = (int) $userId; |
|
243 | + $userId = (int)$userId; |
|
244 | 244 | if (($userId <= 0) && ($userId != -1)) { |
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | |
248 | 248 | $this->userId = $userId; |
249 | - $insert = sprintf(" |
|
249 | + $insert = sprintf(" |
|
250 | 250 | INSERT INTO |
251 | 251 | %sfaquserdata |
252 | 252 | (user_id, last_modified) |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function delete($userId) |
276 | 276 | { |
277 | - $userId = (int) $userId; |
|
277 | + $userId = (int)$userId; |
|
278 | 278 | if (($userId <= 0) && ($userId != -1)) { |
279 | 279 | return false; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $this->userId = $userId; |
283 | - $delete = sprintf(" |
|
283 | + $delete = sprintf(" |
|
284 | 284 | DELETE FROM |
285 | 285 | %sfaquserdata |
286 | 286 | WHERE |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param string $lang Language |
124 | 124 | * |
125 | - * @return boolean |
|
125 | + * @return integer |
|
126 | 126 | */ |
127 | 127 | public static function isLanguage($lang) |
128 | 128 | { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @param integer $date Date |
136 | 136 | * |
137 | - * @return integer |
|
137 | + * @return boolean |
|
138 | 138 | */ |
139 | 139 | public static function isLikeOnPMFDate($date) |
140 | 140 | { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | /** |
316 | 316 | * debug_backtrace() wrapper function |
317 | 317 | * |
318 | - * @param $string |
|
318 | + * @param string $string |
|
319 | 319 | * |
320 | 320 | * @return string |
321 | 321 | */ |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | // Create the HTTP options for the HTTP stream context, see below |
67 | 67 | // Set phpMyFAQ agent related data |
68 | - $agent = 'phpMyFAQ/' . PMF_System::getVersion() . ' on PHP/' . PHP_VERSION; |
|
68 | + $agent = 'phpMyFAQ/'.PMF_System::getVersion().' on PHP/'.PHP_VERSION; |
|
69 | 69 | $opts = array( |
70 | 70 | 'header' => 'User-Agent: '.$agent."\r\n", |
71 | 71 | 'method' => 'GET' |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // HTTP 1.1 Virtual Host |
74 | 74 | $urlParts = @parse_url($url); |
75 | 75 | if (isset($urlParts['host'])) { |
76 | - $opts['header'] = $opts['header'] . 'Host: ' . $urlParts['host'] . "\r\n"; |
|
76 | + $opts['header'] = $opts['header'].'Host: '.$urlParts['host']."\r\n"; |
|
77 | 77 | } |
78 | 78 | // Socket timeout |
79 | 79 | $opts['timeout'] = 5; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | // Unix: 13 Dec 1901 20:45:54 -> 19 Jan 2038 03:14:07, signed 32 bit |
99 | 99 | // Windows: 1 Jan 1970 -> 19 Jan 2038. |
100 | 100 | // So we will use: 1 Jan 2038 -> 2038-01-01, 00:00:01 |
101 | - return PMF_Utils::getPMFDate(mktime(0, 0 , 1, 1, 1, 2038)); |
|
101 | + return PMF_Utils::getPMFDate(mktime(0, 0, 1, 1, 1, 2038)); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | // Suppress last occurence of '%' |
148 | 148 | if (substr($testdate, -1, 1) == '%') { |
149 | - $testdate = substr($testdate, 0, strlen($testdate)-1); |
|
149 | + $testdate = substr($testdate, 0, strlen($testdate) - 1); |
|
150 | 150 | } |
151 | 151 | // PMF date consists of numbers only: YYYYMMDDhhmmss |
152 | 152 | return is_int($testdate); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | if (count($data) > 1) { |
221 | 221 | $randomized_keys = array_rand($data, count($data)); |
222 | 222 | |
223 | - foreach($randomized_keys as $current_key) { |
|
223 | + foreach ($randomized_keys as $current_key) { |
|
224 | 224 | $shuffled_data[$current_key] = $data[$current_key]; |
225 | 225 | } |
226 | 226 | } else { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return string |
241 | 241 | */ |
242 | - public static function chopString ($string, $words) |
|
242 | + public static function chopString($string, $words) |
|
243 | 243 | { |
244 | 244 | $str = ''; |
245 | 245 | $pieces = explode(' ', $string); |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | if ($words > $num) { |
248 | 248 | $words = $num; |
249 | 249 | } |
250 | - for ($i = 0; $i < $words; $i ++) { |
|
251 | - $str .= $pieces[$i] . ' '; |
|
250 | + for ($i = 0; $i < $words; $i++) { |
|
251 | + $str .= $pieces[$i].' '; |
|
252 | 252 | } |
253 | 253 | return $str; |
254 | 254 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | ); |
285 | 285 | |
286 | 286 | return PMF_String::preg_replace_callback( |
287 | - '/(' . $highlight . '="[^"]*")|' . |
|
288 | - '((' . implode('|', $attributes) . ')="[^"]*' . $highlight . '[^"]*")|' . |
|
289 | - '(' . $highlight . ')/mis', |
|
287 | + '/('.$highlight.'="[^"]*")|'. |
|
288 | + '(('.implode('|', $attributes).')="[^"]*'.$highlight.'[^"]*")|'. |
|
289 | + '('.$highlight.')/mis', |
|
290 | 290 | array('PMF_Utils', 'highlightNoLinks'), |
291 | 291 | $string); |
292 | 292 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $postfix = isset($matches[5]) ? $matches[5] : ''; |
306 | 306 | |
307 | 307 | if (!empty($item)) { |
308 | - return '<mark>' . $prefix . $item . $postfix . '</mark>'; |
|
308 | + return '<mark>'.$prefix.$item.$postfix.'</mark>'; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // Fallback: the original matched string |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | { |
324 | 324 | // sometimes Zend Optimizer causes segfaults with debug_backtrace() |
325 | 325 | if (extension_loaded('Zend Optimizer')) { |
326 | - $ret = "<pre>" . $string . "</pre><br>\n"; |
|
326 | + $ret = "<pre>".$string."</pre><br>\n"; |
|
327 | 327 | } else { |
328 | 328 | $debug = debug_backtrace(); |
329 | 329 | $ret = ''; |
330 | 330 | if (isset($debug[2]['class'])) { |
331 | - $ret = $debug[2]['file'] . ":<br>"; |
|
331 | + $ret = $debug[2]['file'].":<br>"; |
|
332 | 332 | $ret .= $debug[2]['class'].$debug[1]['type']; |
333 | - $ret .= $debug[2]['function'] . '() in line ' . $debug[2]['line']; |
|
334 | - $ret .= ": <pre>" . $string . "</pre><br>\n"; |
|
333 | + $ret .= $debug[2]['function'].'() in line '.$debug[2]['line']; |
|
334 | + $ret .= ": <pre>".$string."</pre><br>\n"; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | return $ret; |