@@ -335,6 +335,6 @@ |
||
335 | 335 | */ |
336 | 336 | private static function appendU($str) |
337 | 337 | { |
338 | - return ((string) $str).'u'; |
|
338 | + return ((string)$str).'u'; |
|
339 | 339 | } |
340 | 340 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | * |
64 | 64 | * @param string $language |
65 | 65 | * |
66 | - * @return PMF_String_Basic |
|
66 | + * @return PMF_String_UTF8ToLatinConvertable |
|
67 | 67 | */ |
68 | 68 | public static function getInstance($language = 'en') |
69 | 69 | { |
@@ -38,7 +38,6 @@ |
||
38 | 38 | * @author Anatoliy Belsky <[email protected]> |
39 | 39 | * @copyright 2009-2017 phpMyFAQ Team |
40 | 40 | * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
41 | - |
|
42 | 41 | * @link http://www.phpmyfaq.de |
43 | 42 | * @since 2009-04-06 |
44 | 43 | */ |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | public function getUserId() |
243 | 243 | { |
244 | 244 | if (isset($this->userId) && is_int($this->userId)) { |
245 | - return (int) $this->userId; |
|
245 | + return (int)$this->userId; |
|
246 | 246 | } |
247 | 247 | $this->userId = -1; |
248 | 248 | $this->errors[] = self::ERROR_USER_NO_USERID; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | WHERE |
272 | 272 | user_id = %d '.($allowBlockedUsers ? '' : "AND account_status != 'blocked'"), |
273 | 273 | PMF_Db::getTablePrefix(), |
274 | - (int) $userId |
|
274 | + (int)$userId |
|
275 | 275 | ); |
276 | 276 | |
277 | 277 | $res = $this->config->getDb()->query($select); |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | $user = $this->config->getDb()->fetchArray($res); |
284 | - $this->userId = (int) $user['user_id']; |
|
285 | - $this->login = (string) $user['login']; |
|
286 | - $this->status = (string) $user['account_status']; |
|
284 | + $this->userId = (int)$user['user_id']; |
|
285 | + $this->login = (string)$user['login']; |
|
286 | + $this->status = (string)$user['account_status']; |
|
287 | 287 | |
288 | 288 | // get encrypted password |
289 | 289 | // @todo: Add a getEncPassword method to the Auth* classes for the (local and remote) Auth Sources. |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | return false; |
349 | 349 | } |
350 | 350 | $user = $this->config->getDb()->fetchArray($res); |
351 | - $this->userId = (int) $user['user_id']; |
|
352 | - $this->login = (string) $user['login']; |
|
353 | - $this->status = (string) $user['account_status']; |
|
351 | + $this->userId = (int)$user['user_id']; |
|
352 | + $this->login = (string)$user['login']; |
|
353 | + $this->status = (string)$user['account_status']; |
|
354 | 354 | |
355 | 355 | // get user-data |
356 | 356 | if (!$this->userdata instanceof PMF_User_UserData) { |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | return false; |
398 | 398 | } |
399 | 399 | |
400 | - $this->userId = (int) $user['user_id']; |
|
401 | - $this->login = (string) $user['login']; |
|
402 | - $this->status = (string) $user['account_status']; |
|
400 | + $this->userId = (int)$user['user_id']; |
|
401 | + $this->login = (string)$user['login']; |
|
402 | + $this->status = (string)$user['account_status']; |
|
403 | 403 | |
404 | 404 | // get user-data |
405 | 405 | if (!$this->userdata instanceof PMF_User_UserData) { |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | } |
504 | 504 | |
505 | 505 | // is $login valid? |
506 | - $login = (string) $login; |
|
506 | + $login = (string)$login; |
|
507 | 507 | if (!$this->isValidLogin($login)) { |
508 | 508 | $this->errors[] = self::ERROR_USER_LOGINNAME_TOO_SHORT; |
509 | 509 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | // set user-ID |
521 | 521 | if (0 == $userId) { |
522 | - $this->userId = (int) $this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faquser', 'user_id'); |
|
522 | + $this->userId = (int)$this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faquser', 'user_id'); |
|
523 | 523 | } else { |
524 | 524 | $this->userId = $userId; |
525 | 525 | } |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | */ |
776 | 776 | public function isValidLogin($login) |
777 | 777 | { |
778 | - $login = (string) $login; |
|
778 | + $login = (string)$login; |
|
779 | 779 | |
780 | 780 | if (strlen($login) < $this->loginMinLength || !preg_match($this->validUsername, $login)) { |
781 | 781 | $this->errors[] = self::ERROR_USER_LOGIN_INVALID; |
@@ -1059,12 +1059,12 @@ discard block |
||
1059 | 1059 | // To make passwords harder to get wrong, a few letters & numbers have been omitted. |
1060 | 1060 | // This will ensure safety with browsers using fonts with confusable letters. |
1061 | 1061 | // Removed: o,O,0,1,l,L |
1062 | - $consonants = ['b','c','d','f','g','h','j','k','m','n','p','r','s','t','v','w','x','y','z']; |
|
1063 | - $vowels = ['a','e','i','u']; |
|
1062 | + $consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']; |
|
1063 | + $vowels = ['a', 'e', 'i', 'u']; |
|
1064 | 1064 | $newPassword = ''; |
1065 | 1065 | $skipped = false; |
1066 | 1066 | |
1067 | - srand((double) microtime() * 1000000); |
|
1067 | + srand((double)microtime()*1000000); |
|
1068 | 1068 | |
1069 | 1069 | while (strlen($newPassword) < $minimumLength) { |
1070 | 1070 | if (rand(0, 1)) { |
@@ -1074,9 +1074,7 @@ discard block |
||
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | switch (rand(0, $skipped ? 3 : ($allowUnderscore ? 5 : 4))) { |
1077 | - case 0: |
|
1078 | - case 1: |
|
1079 | - $nextChar = $caseFunc($consonants[rand(0, 18)]); |
|
1077 | + case 0 : case 1 : $nextChar = $caseFunc($consonants[rand(0, 18)]); |
|
1080 | 1078 | break; |
1081 | 1079 | case 2: |
1082 | 1080 | case 3: |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | return 0; |
291 | 291 | } |
292 | 292 | |
293 | - return ($_SERVER['REQUEST_TIME'] - $_SESSION[PMF_SESSION_ID_TIMESTAMP]) / 60; |
|
293 | + return ($_SERVER['REQUEST_TIME'] - $_SESSION[PMF_SESSION_ID_TIMESTAMP])/60; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | PMF_Db::getTablePrefix(), |
366 | 366 | session_id(), |
367 | 367 | $_SERVER['REQUEST_TIME'], |
368 | - $updateLastlogin ? "last_login = '".date('YmdHis', $_SERVER['REQUEST_TIME'])."'," : '', |
|
368 | + $updateLastlogin ? "last_login = '".date('YmdHis', $_SERVER['REQUEST_TIME'])."'," : '', |
|
369 | 369 | $_SERVER['REMOTE_ADDR'], |
370 | 370 | $this->getUserId() |
371 | 371 | ); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | */ |
602 | 602 | protected function setSuccess($success) |
603 | 603 | { |
604 | - $this->loginState = (int) $success; |
|
604 | + $this->loginState = (int)$success; |
|
605 | 605 | |
606 | 606 | $update = sprintf(' |
607 | 607 | UPDATE |
@@ -312,8 +312,8 @@ |
||
312 | 312 | %sfaquser |
313 | 313 | WHERE |
314 | 314 | user_id = %d', |
315 | - PMF_Db::getTablePrefix(), |
|
316 | - $this->getUserId() |
|
315 | + PMF_Db::getTablePrefix(), |
|
316 | + $this->getUserId() |
|
317 | 317 | ); |
318 | 318 | |
319 | 319 | $res = $this->config->getDb()->query($select); |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | $users = $faqsession->getUsersOnline(); |
428 | 428 | $totUsers = $users[0] + $users[1]; |
429 | 429 | $usersOnline = $plr->getMsg('plmsgUserOnline', $totUsers).' | '. |
430 | - $plr->getMsg('plmsgGuestOnline', $users[0]). |
|
431 | - $plr->getMsg('plmsgRegisteredOnline', $users[1]); |
|
430 | + $plr->getMsg('plmsgGuestOnline', $users[0]). |
|
431 | + $plr->getMsg('plmsgRegisteredOnline', $users[1]); |
|
432 | 432 | } else { |
433 | 433 | $usersOnline = ''; |
434 | 434 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | 'switchLanguages' => PMF_Language::selectLanguages($LANGCODE, true), |
485 | 485 | 'userOnline' => $usersOnline, |
486 | 486 | 'copyright' => 'powered by <a href="http://www.phpmyfaq.de" target="_blank">phpMyFAQ</a> '. |
487 | - $faqConfig->get('main.currentVersion'), |
|
487 | + $faqConfig->get('main.currentVersion'), |
|
488 | 488 | 'registerUser' => $faqConfig->get('security.enableRegistration') ? '<a href="?action=register">'.$PMF_LANG['msgRegistration'].'</a>' : '', |
489 | 489 | 'sendPassword' => '<a href="?action=password">'.$PMF_LANG['lostPassword'].'</a>', |
490 | 490 | 'msgFullName' => $PMF_LANG['ad_user_loggedin'].$user->getLogin(), |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | 'dir' => $PMF_LANG['dir'], |
501 | 501 | 'writeSendAdress' => '?'.$sids.'action=search', |
502 | 502 | 'searchBox' => $PMF_LANG['msgSearch'], |
503 | - 'categoryId' => ($cat === 0) ? '%' : (int) $cat, |
|
503 | + 'categoryId' => ($cat === 0) ? '%' : (int)$cat, |
|
504 | 504 | 'showInstantResponse' => '', // @deprecated |
505 | 505 | 'headerCategories' => $PMF_LANG['msgFullCategories'], |
506 | 506 | 'msgCategory' => $PMF_LANG['msgCategory'], |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | array( |
548 | 548 | 'writeSendAdress' => '?'.$sids.'action=search', |
549 | 549 | 'searchBox' => $PMF_LANG['msgSearch'], |
550 | - 'categoryId' => ($cat === 0) ? '%' : (int) $cat, |
|
550 | + 'categoryId' => ($cat === 0) ? '%' : (int)$cat, |
|
551 | 551 | 'msgSearch' => sprintf( |
552 | 552 | '<a class="help" href="%sindex.php?action=search">%s</a>', |
553 | 553 | $faqSystem->getSystemUri($faqConfig), |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | 'allCategories' => '<a href="'.$faqSystem->getSystemUri($faqConfig).'showcat.html">'.$PMF_LANG['msgShowAllCategories'].'</a>', |
583 | 583 | 'faqOverview' => '<a href="'.$faqSystem->getSystemUri($faqConfig).'overview.html">'.$PMF_LANG['faqOverview'].'</a>', |
584 | 584 | 'showSitemap' => '<a href="'.$faqSystem->getSystemUri($faqConfig).'sitemap/A/'.$LANGCODE.'.html">'.$PMF_LANG['msgSitemap'].'</a>', |
585 | - 'opensearch' => $faqSystem->getSystemUri($faqConfig).'opensearch.html', ); |
|
585 | + 'opensearch' => $faqSystem->getSystemUri($faqConfig).'opensearch.html',); |
|
586 | 586 | } else { |
587 | 587 | $tplNavigation = array( |
588 | 588 | 'msgSearch' => '<a href="index.php?'.$sids.'action=search">'.$PMF_LANG['msgAdvancedSearch'].'</a>', |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | 'faqOverview' => '<a href="index.php?'.$sids.'action=overview">'.$PMF_LANG['faqOverview'].'</a>', |
597 | 597 | 'backToHome' => '<a href="index.php?'.$sids.'">'.$PMF_LANG['msgHome'].'</a>', |
598 | 598 | 'showSitemap' => '<a href="index.php?'.$sids.'action=sitemap&lang='.$LANGCODE.'">'.$PMF_LANG['msgSitemap'].'</a>', |
599 | - 'opensearch' => $faqSystem->getSystemUri($faqConfig).'opensearch.php', ); |
|
599 | + 'opensearch' => $faqSystem->getSystemUri($faqConfig).'opensearch.php',); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | $tplNavigation['faqHome'] = $faqConfig->getDefaultUrl(); |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | ); |
696 | 696 | } else { |
697 | 697 | $tpl->parseBlock('rightBox', 'latestEntriesListError', array( |
698 | - 'errorMsgLatest' => $latestEntriesParams['error'], ) |
|
698 | + 'errorMsgLatest' => $latestEntriesParams['error'],) |
|
699 | 699 | ); |
700 | 700 | } |
701 | 701 |
@@ -111,7 +111,7 @@ |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - uasort($relatedTags, function ($a, $b) { |
|
114 | + uasort($relatedTags, function($a, $b) { |
|
115 | 115 | return ($b - $a); |
116 | 116 | } |
117 | 117 | ); |
@@ -47,8 +47,8 @@ |
||
47 | 47 | |
48 | 48 | $send2friendLink = sprintf('%sindex.php?action=artikel&cat=%d&id=%d&artlang=%s', |
49 | 49 | $faqConfig->getDefaultUrl(), |
50 | - (int) $cat, |
|
51 | - (int) $id, |
|
50 | + (int)$cat, |
|
51 | + (int)$id, |
|
52 | 52 | urlencode($artlang)); |
53 | 53 | |
54 | 54 | $captchaHelper = new PMF_Helper_Captcha($faqConfig); |
@@ -118,7 +118,7 @@ |
||
118 | 118 | foreach ($items as $item) { |
119 | 119 | $priority = PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT; |
120 | 120 | if (($visitsMax - $visitMin) > 0) { |
121 | - $priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT * (1 + (($item['visits'] - $visitMin) / ($visitsMax - $visitMin)))); |
|
121 | + $priority = sprintf('%.1f', PMF_SITEMAP_GOOGLE_PRIORITY_DEFAULT*(1 + (($item['visits'] - $visitMin)/($visitsMax - $visitMin)))); |
|
122 | 122 | } |
123 | 123 | // a. We use plain PMF urls w/o any SEO schema |
124 | 124 | $link = str_replace($_SERVER['SCRIPT_NAME'], '/index.php', $item['url']); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $changeFreq = PMF_SITEMAP_GOOGLE_CHANGEFREQ_DAILY; |
69 | 69 | } |
70 | 70 | $node = |
71 | - '<url>' |
|
71 | + '<url>' |
|
72 | 72 | .'<loc>'.PMF_String::htmlspecialchars($location).'</loc>' |
73 | 73 | .'<lastmod>'.$lastmod.'</lastmod>' |
74 | 74 | .'<changefreq>'.$changeFreq.'</changefreq>' |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | // Sitemap header |
101 | 101 | $sitemap = |
102 | - '<?xml version="1.0" encoding="UTF-8"?>' |
|
102 | + '<?xml version="1.0" encoding="UTF-8"?>' |
|
103 | 103 | .'<urlset xmlns="http://www.google.com/schemas/sitemap/0.9"' |
104 | 104 | .' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' |
105 | 105 | .' xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.9' |
@@ -395,12 +395,12 @@ |
||
395 | 395 | public function update(Array $newConfigs) |
396 | 396 | { |
397 | 397 | $runtimeConfigs = [ |
398 | - 'core.database', // PMF_DB_Driver |
|
399 | - 'core.instance', // PMF_Instance |
|
400 | - 'core.language', // Language |
|
401 | - 'core.ldap', // PMF_Ldap |
|
402 | - 'core.ldapConfig', // $PMF_LDAP |
|
403 | - 'core.elasticsearch', // Elasticsearch\Client |
|
398 | + 'core.database', // PMF_DB_Driver |
|
399 | + 'core.instance', // PMF_Instance |
|
400 | + 'core.language', // Language |
|
401 | + 'core.ldap', // PMF_Ldap |
|
402 | + 'core.ldapConfig', // $PMF_LDAP |
|
403 | + 'core.elasticsearch', // Elasticsearch\Client |
|
404 | 404 | 'core.elasticsearchConfig' // $PMF_ES |
405 | 405 | ]; |
406 | 406 |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | |
322 | 322 | if ($cat['lang'] == $lang) { |
323 | 323 | // add sub category (if current language) |
324 | - printf(' |
|
324 | + printf(' |
|
325 | 325 | <a class="btn btn-info btn-sm" href="?action=addcategory&cat=%s&lang=%s"><span title="%s" class="fa fa-plus fa-fw"></span></a> ', |
326 | - $cat['id'], |
|
327 | - $cat['lang'], |
|
328 | - $PMF_LANG['ad_quick_category'] |
|
329 | - ); |
|
326 | + $cat['id'], |
|
327 | + $cat['lang'], |
|
328 | + $PMF_LANG['ad_quick_category'] |
|
329 | + ); |
|
330 | 330 | |
331 | - // rename (sub) category (if current language) |
|
332 | - printf(' |
|
331 | + // rename (sub) category (if current language) |
|
332 | + printf(' |
|
333 | 333 | <a class="btn btn-info btn-sm" href="?action=editcategory&cat=%s"><span title="%s" class="fa fa-edit fa-fw"></a> ', |
334 | - $cat['id'], |
|
335 | - $PMF_LANG['ad_kateg_rename'] |
|
336 | - ); |
|
334 | + $cat['id'], |
|
335 | + $PMF_LANG['ad_kateg_rename'] |
|
336 | + ); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | // translate category (always) |
@@ -357,20 +357,20 @@ discard block |
||
357 | 357 | |
358 | 358 | if ($cat['lang'] == $lang) { |
359 | 359 | // cut category (if current language) |
360 | - printf( |
|
361 | - '<a class="btn btn-warning btn-sm" href="?action=cutcategory&cat=%s"><span title="%s" class="fa fa-cut fa-fw"></a> ', |
|
362 | - $cat['id'], |
|
363 | - $PMF_LANG['ad_categ_cut'] |
|
364 | - ); |
|
360 | + printf( |
|
361 | + '<a class="btn btn-warning btn-sm" href="?action=cutcategory&cat=%s"><span title="%s" class="fa fa-cut fa-fw"></a> ', |
|
362 | + $cat['id'], |
|
363 | + $PMF_LANG['ad_categ_cut'] |
|
364 | + ); |
|
365 | 365 | |
366 | 366 | if ($category->numParent($cat['parent_id']) > 1) { |
367 | 367 | // move category (if current language) AND more than 1 category at the same level) |
368 | - printf( |
|
369 | - '<a class="btn btn-warning btn-sm" href="?action=movecategory&cat=%s&parent_id=%s"><span title="%s" class="fa fa-sort fa-fw"></a> ', |
|
370 | - $cat['id'], |
|
371 | - $cat['parent_id'], |
|
372 | - $PMF_LANG['ad_categ_move'] |
|
373 | - ); |
|
368 | + printf( |
|
369 | + '<a class="btn btn-warning btn-sm" href="?action=movecategory&cat=%s&parent_id=%s"><span title="%s" class="fa fa-sort fa-fw"></a> ', |
|
370 | + $cat['id'], |
|
371 | + $cat['parent_id'], |
|
372 | + $PMF_LANG['ad_categ_move'] |
|
373 | + ); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | <i aria-hidden="true" class="fa fa-plus fa-fw"></i> <?php echo $PMF_LANG['ad_kateg_add']; ?> |
37 | 37 | </a> |
38 | 38 | <a class="btn btn-info" href="?action=showcategory"> |
39 | - <i aria-hidden="true" class="fa fa-th fa-fw"></i> <?php echo $PMF_LANG['ad_categ_show'];?> |
|
39 | + <i aria-hidden="true" class="fa fa-th fa-fw"></i> <?php echo $PMF_LANG['ad_categ_show']; ?> |
|
40 | 40 | </a> |
41 | 41 | </div> |
42 | 42 | </h2> |