mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
Shorten some forum code about length
This commit is contained in:
@@ -38,24 +38,18 @@ if(Forum::canPost($account_logged))
|
||||
$post_topic = stripslashes(trim($_REQUEST['topic']));
|
||||
$smile = isset($_REQUEST['smile']) ? (int)$_REQUEST['smile'] : 0;
|
||||
$html = isset($_REQUEST['html']) ? (int)$_REQUEST['html'] : 0;
|
||||
$lenght = 0;
|
||||
for($i = 0; $i < strlen($post_topic); $i++)
|
||||
{
|
||||
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
|
||||
$lenght++;
|
||||
}
|
||||
if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post'])
|
||||
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.';
|
||||
$lenght = 0;
|
||||
for($i = 0; $i < strlen($text); $i++)
|
||||
{
|
||||
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
|
||||
$lenght++;
|
||||
}
|
||||
if($lenght < 1 || strlen($text) > 15000)
|
||||
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
|
||||
|
||||
$length = strlen($post_topic);
|
||||
if(($length < 1 || $length > 60) && $thread['id'] == $thread['first_post'])
|
||||
$errors[] = "Too short or too long topic (Length: $length letters). Minimum 1 letter, maximum 60 letters.";
|
||||
|
||||
$length = strlen($text);
|
||||
if($length < 1 || $length > 15000)
|
||||
$errors[] = "Too short or too long post (Length: $length letters). Minimum 1 letter, maximum 15000 letters.";
|
||||
|
||||
if($char_id == 0)
|
||||
$errors[] = 'Please select a character.';
|
||||
|
||||
if(empty($post_topic) && $thread['id'] == $thread['first_post'])
|
||||
$errors[] = 'Thread topic can\'t be empty.';
|
||||
|
||||
|
Reference in New Issue
Block a user