Removed special case from about page length limit.
This commit is contained in:
parent
3c518c48e6
commit
0339bc3ec9
2 changed files with 4 additions and 14 deletions
|
@ -96,7 +96,7 @@ if($isEditing) {
|
|||
} else {
|
||||
$aboutText = (string)($_POST['about']['text'] ?? '');
|
||||
$aboutParse = (int)($_POST['about']['parser'] ?? Parser::PLAIN);
|
||||
$aboutValid = User::validateProfileAbout($aboutParse, $aboutText, strlen($profileUser->getProfileAboutText()) > User::PROFILE_ABOUT_MAX_LENGTH);
|
||||
$aboutValid = User::validateProfileAbout($aboutParse, $aboutText);
|
||||
|
||||
if($aboutValid === '')
|
||||
$currentUser->setProfileAboutText($aboutText)->setProfileAboutParser($aboutParse);
|
||||
|
|
|
@ -40,21 +40,11 @@ class User implements HasRankInterface, JsonSerializable {
|
|||
public const PASSWORD_ALGO = PASSWORD_ARGON2ID;
|
||||
|
||||
// Maximum length of profile about section
|
||||
public const PROFILE_ABOUT_MAX_LENGTH = 60000;
|
||||
public const PROFILE_ABOUT_MAX_LENGTH_OLD = 65535; // Used for malloc's essay
|
||||
public const PROFILE_ABOUT_MAX_LENGTH = 50000;
|
||||
|
||||
// Maximum length of forum signature
|
||||
public const FORUM_SIGNATURE_MAX_LENGTH = 2000;
|
||||
|
||||
// Order constants for ::all function
|
||||
public const ORDER_ID = 'id';
|
||||
public const ORDER_NAME = 'name';
|
||||
public const ORDER_COUNTRY = 'country';
|
||||
public const ORDER_CREATED = 'registered';
|
||||
public const ORDER_ACTIVE = 'last-online';
|
||||
public const ORDER_FORUM_TOPICS = 'forum-topics';
|
||||
public const ORDER_FORUM_POSTS = 'forum-posts';
|
||||
|
||||
// Database fields
|
||||
private $user_id = -1;
|
||||
private $username = '';
|
||||
|
@ -699,12 +689,12 @@ class User implements HasRankInterface, JsonSerializable {
|
|||
return '';
|
||||
}
|
||||
|
||||
public static function validateProfileAbout(int $parser, string $text, bool $useOld = false): string {
|
||||
public static function validateProfileAbout(int $parser, string $text): string {
|
||||
if(!Parser::isValid($parser))
|
||||
return 'parser';
|
||||
|
||||
$length = strlen($text);
|
||||
if($length > ($useOld ? self::PROFILE_ABOUT_MAX_LENGTH_OLD : self::PROFILE_ABOUT_MAX_LENGTH))
|
||||
if($length > self::PROFILE_ABOUT_MAX_LENGTH)
|
||||
return 'long';
|
||||
|
||||
return '';
|
||||
|
|
Loading…
Reference in a new issue