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