@@ -62,9 +62,12 @@ |
||
| 62 | 62 | <input type="hidden" name="showcat" value="<?php echo $showcat ?>"> |
| 63 | 63 | <?php if ($faqConfig->get('security.permLevel') !== 'basic'): ?> |
| 64 | 64 | <input type="hidden" name="restricted_groups[]" value="<?php echo $group_permission[0] ?>"> |
| 65 | - <?php else: ?> |
|
| 65 | + <?php else { |
|
| 66 | + : ?> |
|
| 66 | 67 | <input type="hidden" name="restricted_groups[]" value="-1"> |
| 67 | - <?php endif; ?> |
|
| 68 | + <?php endif; |
|
| 69 | +} |
|
| 70 | +?> |
|
| 68 | 71 | <input type="hidden" name="restricted_users" value="<?php echo $user_permission[0] ?>"> |
| 69 | 72 | <input type="hidden" name="csrf" value="<?php echo $user->getCsrfTokenFromSession() ?>"> |
| 70 | 73 | <input type="hidden" name="active" value="<?php echo $category->categoryName[$id]['active'] ?>"> |
@@ -295,7 +295,7 @@ |
||
| 295 | 295 | $result = $this->config->getDb()->query($query); |
| 296 | 296 | if ($this->config->getDb()->numRows($result) > 0) { |
| 297 | 297 | while ($row = $this->config->getDb()->fetchObject($result)) { |
| 298 | - $num[$row->id] = (int) $row->num_comments; |
|
| 298 | + $num[$row->id] = (int)$row->num_comments; |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | $fdTable.'.active AS active', |
| 211 | 211 | $fdTable.'.thema AS thema', |
| 212 | 212 | $fdTable.'.content AS content', |
| 213 | - $fdTable.'.updated AS updated', )) |
|
| 213 | + $fdTable.'.updated AS updated',)) |
|
| 214 | 214 | ->setJoinedTable($fcrTable) |
| 215 | 215 | ->setJoinedColumns(array( |
| 216 | 216 | $fdTable.'.id = '.$fcrTable.'.record_id', |
| 217 | - $fdTable.'.lang = '.$fcrTable.'.record_lang', )); |
|
| 217 | + $fdTable.'.lang = '.$fcrTable.'.record_lang',)); |
|
| 218 | 218 | |
| 219 | 219 | if (is_numeric($searchTerm)) { |
| 220 | 220 | $search->setMatchingColumns(array($fdTable.'.solution_id')); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $faqsFound = []; |
| 231 | 231 | |
| 232 | 232 | while ($row = $faqConfig->getDb()->fetchObject($result)) { |
| 233 | - if ($searchCat != 0 && $searchCat != (int) $row->category_id) { |
|
| 233 | + if ($searchCat != 0 && $searchCat != (int)$row->category_id) { |
|
| 234 | 234 | continue; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | <input type="checkbox" lang="<?php echo $record['lang'] ?>" |
| 406 | 406 | onclick="saveStatus(<?php echo $cid.', ['.$record['id'].']' ?>, 'sticky', '<?php echo $user->getCsrfTokenFromSession() ?>');" |
| 407 | 407 | id="sticky_record_<?php echo $cid.'_'.$record['id'] ?>" |
| 408 | - <?php echo($record['sticky'] ? 'checked' : ' ') ?>> |
|
| 408 | + <?php echo($record['sticky'] ? 'checked' : ' ') ?>> |
|
| 409 | 409 | </label> |
| 410 | 410 | </td> |
| 411 | 411 | <td> |
@@ -36,47 +36,47 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | switch ($ajaxAction) { |
| 38 | 38 | |
| 39 | - case 'upload': |
|
| 39 | + case 'upload': |
|
| 40 | 40 | |
| 41 | - $uploadDir = PMF_ROOT_DIR . '/images/'; |
|
| 42 | - $uploadFile = basename($_FILES['upload']['name']); |
|
| 43 | - $isUploaded = false; |
|
| 44 | - $height = $width = 0; |
|
| 45 | - $validFileExtensions = [ 'gif', 'jpg', 'jpeg', 'png' ]; |
|
| 41 | + $uploadDir = PMF_ROOT_DIR . '/images/'; |
|
| 42 | + $uploadFile = basename($_FILES['upload']['name']); |
|
| 43 | + $isUploaded = false; |
|
| 44 | + $height = $width = 0; |
|
| 45 | + $validFileExtensions = [ 'gif', 'jpg', 'jpeg', 'png' ]; |
|
| 46 | 46 | |
| 47 | - if ($csrfOkay) { |
|
| 48 | - if (is_uploaded_file($uploadedFile['tmp_name']) && |
|
| 49 | - $uploadedFile['size'] < $faqConfig->get('records.maxAttachmentSize') |
|
| 50 | - ) { |
|
| 47 | + if ($csrfOkay) { |
|
| 48 | + if (is_uploaded_file($uploadedFile['tmp_name']) && |
|
| 49 | + $uploadedFile['size'] < $faqConfig->get('records.maxAttachmentSize') |
|
| 50 | + ) { |
|
| 51 | 51 | |
| 52 | - $fileInfo = getimagesize($uploadedFile['tmp_name']); |
|
| 53 | - $fileExtension = strtolower(pathinfo($uploadFile, PATHINFO_EXTENSION)); |
|
| 52 | + $fileInfo = getimagesize($uploadedFile['tmp_name']); |
|
| 53 | + $fileExtension = strtolower(pathinfo($uploadFile, PATHINFO_EXTENSION)); |
|
| 54 | 54 | |
| 55 | - if (false === $fileInfo) { |
|
| 56 | - $isUploaded = false; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - if (($fileInfo[2] !== IMAGETYPE_GIF) && |
|
| 60 | - ($fileInfo[2] !== IMAGETYPE_JPEG) && |
|
| 61 | - ($fileInfo[2] !== IMAGETYPE_PNG)) { |
|
| 62 | - $isUploaded = false; |
|
| 63 | - } else { |
|
| 64 | - $isUploaded = true; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if (!in_array($fileExtension, $validFileExtensions)) { |
|
| 68 | - $isUploaded = false; |
|
| 69 | - } |
|
| 55 | + if (false === $fileInfo) { |
|
| 56 | + $isUploaded = false; |
|
| 57 | + } |
|
| 70 | 58 | |
| 71 | - if ($fileInfo && $isUploaded) { |
|
| 72 | - list($width, $height) = $fileInfo; |
|
| 73 | - if (move_uploaded_file($uploadedFile['tmp_name'], $uploadDir . $uploadFile)) { |
|
| 74 | - $isUploaded = true; |
|
| 59 | + if (($fileInfo[2] !== IMAGETYPE_GIF) && |
|
| 60 | + ($fileInfo[2] !== IMAGETYPE_JPEG) && |
|
| 61 | + ($fileInfo[2] !== IMAGETYPE_PNG)) { |
|
| 62 | + $isUploaded = false; |
|
| 75 | 63 | } else { |
| 64 | + $isUploaded = true; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if (!in_array($fileExtension, $validFileExtensions)) { |
|
| 76 | 68 | $isUploaded = false; |
| 77 | 69 | } |
| 78 | - } |
|
| 79 | - ?> |
|
| 70 | + |
|
| 71 | + if ($fileInfo && $isUploaded) { |
|
| 72 | + list($width, $height) = $fileInfo; |
|
| 73 | + if (move_uploaded_file($uploadedFile['tmp_name'], $uploadDir . $uploadFile)) { |
|
| 74 | + $isUploaded = true; |
|
| 75 | + } else { |
|
| 76 | + $isUploaded = false; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + ?> |
|
| 80 | 80 | <script> |
| 81 | 81 | window.parent.window.pmfImageUpload.uploadFinished({ |
| 82 | 82 | filename: '<?php echo $faqConfig->getDefaultUrl() . 'images/' . $uploadFile ?>', |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | }); |
| 88 | 88 | </script> |
| 89 | 89 | <?php |
| 90 | - } else { |
|
| 91 | - ?> |
|
| 90 | + } else { |
|
| 91 | + ?> |
|
| 92 | 92 | <script> |
| 93 | 93 | window.parent.window.pmfImageUpload.uploadFinished({ |
| 94 | 94 | filename: '', |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | }); |
| 100 | 100 | </script> |
| 101 | 101 | <?php |
| 102 | - } |
|
| 103 | - } else { |
|
| 104 | - ?> |
|
| 102 | + } |
|
| 103 | + } else { |
|
| 104 | + ?> |
|
| 105 | 105 | <script> |
| 106 | 106 | window.parent.window.pmfImageUpload.uploadFinished({ |
| 107 | 107 | filename: '', |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | }); |
| 113 | 113 | </script> |
| 114 | 114 | <?php |
| 115 | - } |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - break; |
|
| 117 | + break; |
|
| 118 | 118 | } |
| 119 | 119 | \ No newline at end of file |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | case 'upload': |
| 40 | 40 | |
| 41 | - $uploadDir = PMF_ROOT_DIR . '/images/'; |
|
| 41 | + $uploadDir = PMF_ROOT_DIR.'/images/'; |
|
| 42 | 42 | $uploadFile = basename($_FILES['upload']['name']); |
| 43 | 43 | $isUploaded = false; |
| 44 | 44 | $height = $width = 0; |
| 45 | - $validFileExtensions = [ 'gif', 'jpg', 'jpeg', 'png' ]; |
|
| 45 | + $validFileExtensions = ['gif', 'jpg', 'jpeg', 'png']; |
|
| 46 | 46 | |
| 47 | 47 | if ($csrfOkay) { |
| 48 | 48 | if (is_uploaded_file($uploadedFile['tmp_name']) && |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if ($fileInfo && $isUploaded) { |
| 72 | 72 | list($width, $height) = $fileInfo; |
| 73 | - if (move_uploaded_file($uploadedFile['tmp_name'], $uploadDir . $uploadFile)) { |
|
| 73 | + if (move_uploaded_file($uploadedFile['tmp_name'], $uploadDir.$uploadFile)) { |
|
| 74 | 74 | $isUploaded = true; |
| 75 | 75 | } else { |
| 76 | 76 | $isUploaded = false; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ?> |
| 80 | 80 | <script> |
| 81 | 81 | window.parent.window.pmfImageUpload.uploadFinished({ |
| 82 | - filename: '<?php echo $faqConfig->getDefaultUrl() . 'images/' . $uploadFile ?>', |
|
| 82 | + filename: '<?php echo $faqConfig->getDefaultUrl().'images/'.$uploadFile ?>', |
|
| 83 | 83 | result: '<?php echo $isUploaded ? 'file_uploaded' : 'error' ?>', |
| 84 | 84 | resultCode: '<?php echo $isUploaded ? 'success' : 'failed' ?>', |
| 85 | 85 | height: <?php echo $height ?>, |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | if ('medium' === $this->_config->get('security.permLevel')) { |
| 125 | 125 | $groupPermissions = $this->faq->getPermission('group', $result->id); |
| 126 | 126 | if (is_array($groupPermissions)) { |
| 127 | - foreach($groupPermissions as $groupPermission) { |
|
| 127 | + foreach ($groupPermissions as $groupPermission) { |
|
| 128 | 128 | if (in_array($groupPermission, $currentGroupIds)) { |
| 129 | 129 | $permission = true; |
| 130 | 130 | } |
@@ -222,6 +222,6 @@ discard block |
||
| 222 | 222 | $score += $object->relevance_keywords; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - return round($score / 3 * 100); |
|
| 225 | + return round($score/3*100); |
|
| 226 | 226 | } |
| 227 | 227 | } |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $toBeRemoved = [ '=', '+', '-', 'HYPERLINK']; |
|
| 152 | + $toBeRemoved = ['=', '+', '-', 'HYPERLINK']; |
|
| 153 | 153 | $outputString = str_replace($toBeRemoved, '', $outputString); |
| 154 | 154 | |
| 155 | 155 | return $outputString; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @param string $lang Language |
| 127 | 127 | * |
| 128 | - * @return bool |
|
| 128 | + * @return integer |
|
| 129 | 129 | */ |
| 130 | 130 | public static function isLanguage($lang) |
| 131 | 131 | { |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @param int $date Date |
| 139 | 139 | * |
| 140 | - * @return int |
|
| 140 | + * @return boolean |
|
| 141 | 141 | */ |
| 142 | 142 | public static function isLikeOnPMFDate($date) |
| 143 | 143 | { |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | /** |
| 347 | 347 | * debug_backtrace() wrapper function. |
| 348 | 348 | * |
| 349 | - * @param $string |
|
| 349 | + * @param string $string |
|
| 350 | 350 | * |
| 351 | 351 | * @return string |
| 352 | 352 | */ |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | /** |
| 409 | 409 | * Creates a seed with microseconds. |
| 410 | - * @return float|int |
|
| 410 | + * @return integer|null |
|
| 411 | 411 | */ |
| 412 | 412 | private static function makeSeed() |
| 413 | 413 | { |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | 419 | * Returns a random number. |
| 420 | - * @param $min |
|
| 421 | - * @param $max |
|
| 420 | + * @param integer $min |
|
| 421 | + * @param integer $max |
|
| 422 | 422 | * @return int |
| 423 | 423 | */ |
| 424 | 424 | public static function createRandomNumber($min, $max) |
@@ -412,7 +412,7 @@ |
||
| 412 | 412 | private static function makeSeed() |
| 413 | 413 | { |
| 414 | 414 | list($usec, $sec) = explode(' ', microtime()); |
| 415 | - return $sec + $usec * 1000000; |
|
| 415 | + return $sec + $usec*1000000; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | public function getUserId() |
| 244 | 244 | { |
| 245 | 245 | if (isset($this->userId) && is_int($this->userId)) { |
| 246 | - return (int) $this->userId; |
|
| 246 | + return (int)$this->userId; |
|
| 247 | 247 | } |
| 248 | 248 | $this->userId = -1; |
| 249 | 249 | $this->errors[] = self::ERROR_USER_NO_USERID; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | WHERE |
| 273 | 273 | user_id = %d '.($allowBlockedUsers ? '' : "AND account_status != 'blocked'"), |
| 274 | 274 | PMF_Db::getTablePrefix(), |
| 275 | - (int) $userId |
|
| 275 | + (int)$userId |
|
| 276 | 276 | ); |
| 277 | 277 | |
| 278 | 278 | $res = $this->config->getDb()->query($select); |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | return false; |
| 283 | 283 | } |
| 284 | 284 | $user = $this->config->getDb()->fetchArray($res); |
| 285 | - $this->userId = (int) $user['user_id']; |
|
| 286 | - $this->login = (string) $user['login']; |
|
| 287 | - $this->status = (string) $user['account_status']; |
|
| 285 | + $this->userId = (int)$user['user_id']; |
|
| 286 | + $this->login = (string)$user['login']; |
|
| 287 | + $this->status = (string)$user['account_status']; |
|
| 288 | 288 | |
| 289 | 289 | // get encrypted password |
| 290 | 290 | // @todo: Add a getEncPassword method to the Auth* classes for the (local and remote) Auth Sources. |
@@ -349,9 +349,9 @@ discard block |
||
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | $user = $this->config->getDb()->fetchArray($res); |
| 352 | - $this->userId = (int) $user['user_id']; |
|
| 353 | - $this->login = (string) $user['login']; |
|
| 354 | - $this->status = (string) $user['account_status']; |
|
| 352 | + $this->userId = (int)$user['user_id']; |
|
| 353 | + $this->login = (string)$user['login']; |
|
| 354 | + $this->status = (string)$user['account_status']; |
|
| 355 | 355 | |
| 356 | 356 | // get user-data |
| 357 | 357 | if (!$this->userdata instanceof PMF_User_UserData) { |
@@ -398,9 +398,9 @@ discard block |
||
| 398 | 398 | return false; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - $this->userId = (int) $user['user_id']; |
|
| 402 | - $this->login = (string) $user['login']; |
|
| 403 | - $this->status = (string) $user['account_status']; |
|
| 401 | + $this->userId = (int)$user['user_id']; |
|
| 402 | + $this->login = (string)$user['login']; |
|
| 403 | + $this->status = (string)$user['account_status']; |
|
| 404 | 404 | |
| 405 | 405 | // get user-data |
| 406 | 406 | if (!$this->userdata instanceof PMF_User_UserData) { |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // is $login valid? |
| 507 | - $login = (string) $login; |
|
| 507 | + $login = (string)$login; |
|
| 508 | 508 | if (!$this->isValidLogin($login)) { |
| 509 | 509 | $this->errors[] = self::ERROR_USER_LOGINNAME_TOO_SHORT; |
| 510 | 510 | |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | // set user-ID |
| 522 | 522 | if (0 == $userId) { |
| 523 | - $this->userId = (int) $this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faquser', 'user_id'); |
|
| 523 | + $this->userId = (int)$this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faquser', 'user_id'); |
|
| 524 | 524 | } else { |
| 525 | 525 | $this->userId = $userId; |
| 526 | 526 | } |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | */ |
| 777 | 777 | public function isValidLogin($login) |
| 778 | 778 | { |
| 779 | - $login = (string) $login; |
|
| 779 | + $login = (string)$login; |
|
| 780 | 780 | |
| 781 | 781 | if (strlen($login) < $this->loginMinLength || !preg_match($this->validUsername, $login)) { |
| 782 | 782 | $this->errors[] = self::ERROR_USER_LOGIN_INVALID; |
@@ -1058,8 +1058,8 @@ discard block |
||
| 1058 | 1058 | // To make passwords harder to get wrong, a few letters & numbers have been omitted. |
| 1059 | 1059 | // This will ensure safety with browsers using fonts with confusable letters. |
| 1060 | 1060 | // Removed: o,O,0,1,l,L |
| 1061 | - $consonants = ['b','c','d','f','g','h','j','k','m','n','p','r','s','t','v','w','x','y','z']; |
|
| 1062 | - $vowels = ['a','e','i','u']; |
|
| 1061 | + $consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']; |
|
| 1062 | + $vowels = ['a', 'e', 'i', 'u']; |
|
| 1063 | 1063 | $newPassword = ''; |
| 1064 | 1064 | $skipped = false; |
| 1065 | 1065 | |
@@ -1071,9 +1071,7 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | switch (rand(0, $skipped ? 3 : ($allowUnderscore ? 5 : 4))) { |
| 1074 | - case 0: |
|
| 1075 | - case 1: |
|
| 1076 | - $nextChar = $caseFunc($consonants[rand(0, 18)]); |
|
| 1074 | + case 0 : case 1 : $nextChar = $caseFunc($consonants[rand(0, 18)]); |
|
| 1077 | 1075 | break; |
| 1078 | 1076 | case 2: |
| 1079 | 1077 | case 3: |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | * @author Matteo Scaramuccia <[email protected]> |
| 16 | 16 | * @copyright 2009-2019 phpMyFAQ Team |
| 17 | 17 | * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
| 18 | - |
|
| 19 | 18 | * @link https://www.phpmyfaq.de |
| 20 | 19 | * @since 2009-09-24 |
| 21 | 20 | */ |