Example #1
0
     checkMessageSize();
     checkFlood();
 }
 $post = newPost(setParent());
 $post['ip'] = $_SERVER['REMOTE_ADDR'];
 list($post['name'], $post['tripcode']) = nameAndTripcode($_POST['name']);
 $post['name'] = cleanString(substr($post['name'], 0, 75));
 $post['email'] = cleanString(str_replace('"', '"', substr($_POST['email'], 0, 75)));
 $post['subject'] = cleanString(substr($_POST['subject'], 0, 75));
 if ($rawpost) {
     $rawposttext = $isadmin ? ' <span style="color: red;">## Admin</span>' : ' <span style="color: purple;">## Mod</span>';
     $post['message'] = $_POST['message'];
     // Treat message as raw HTML
 } else {
     $rawposttext = '';
     $post['message'] = str_replace("\n", '<br>', makeLinksClickable(colorQuote(postLink(cleanString(rtrim($_POST['message']))))));
 }
 $post['password'] = $_POST['password'] != '' ? md5(md5($_POST['password'])) : '';
 $post['nameblock'] = nameBlock($post['name'], $post['tripcode'], $post['email'], time(), $rawposttext);
 if (isset($_POST['embed']) && trim($_POST['embed']) != '') {
     list($service, $embed) = getEmbed(trim($_POST['embed']));
     if (empty($embed) || !isset($embed['html']) || !isset($embed['title']) || !isset($embed['thumbnail_url'])) {
         fancyDie("Invalid embed URL. Only YouTube, Vimeo, and SoundCloud URLs are supported.");
     }
     $post['file_hex'] = $service;
     $temp_file = time() . substr(microtime(), 2, 3);
     $file_location = "thumb/" . $temp_file;
     file_put_contents($file_location, file_get_contents($embed['thumbnail_url']));
     $file_info = getimagesize($file_location);
     $file_mime = $file_info['mime'];
     $post['image_width'] = $file_info[0];
Example #2
0
         fancyDie("Please wait a moment before posting again.  You will be able to make another post in " . (30 - (time() - $lastpost['timestamp'])) . " seconds.");
     }
 }
 if (strlen($_POST["message"]) > 8000) {
     fancyDie("Please shorten your message, or post it in multiple parts. Your message is " . strlen($_POST["message"]) . " characters long, and the maximum allowed is 8000.");
 }
 $post = newPost();
 $post['parent'] = $parent;
 $post['ip'] = $_SERVER['REMOTE_ADDR'];
 $nt = nameAndTripcode($_POST["name"]);
 $post['name'] = $nt[0];
 $post['tripcode'] = $nt[1];
 $post['name'] = cleanString(substr($post['name'], 0, 75));
 $post['email'] = cleanString(str_replace('"', '&quot;', substr($_POST["email"], 0, 75)));
 $post['subject'] = cleanString(substr($_POST["subject"], 0, 75));
 $post['message'] = str_replace("\n", "<br>", colorQuote(cleanString(rtrim($_POST["message"]))));
 if ($_POST['password'] != '') {
     $post['password'] = md5(md5($_POST['password']));
 } else {
     $post['password'] = '';
 }
 $post['nameblock'] = nameBlock($post['name'], $post['tripcode'], $post['email'], time());
 if (isset($_FILES['file'])) {
     if ($_FILES['file']['name'] != "") {
         switch ($_FILES['file']['error']) {
             case UPLOAD_ERR_OK:
                 break;
             case UPLOAD_ERR_FORM_SIZE:
                 fancyDie("That file is larger than 2 MB.");
                 break;
             case UPLOAD_ERR_INI_SIZE: