tablerender(NWSLAN_12, NWSLAN_11); require_once(FOOTERF); exit; } $author_name = $tp->toDB($_POST['author_name']); $author_email = $tp->toDB(check_email($_POST['author_email'])); if (isset($_POST['submit'])) { $user = (USER ? USERNAME : $author_name); $email = (USER ? USEREMAIL : $author_email); if ($user && $email) { $ip = $e107->getip(); $fp = new floodprotect; if ($fp->flood("submitnews", "submitnews_datestamp") == false) { header("location:" . e_BASE . "index.php"); exit; } $itemtitle = $tp->toDB($_POST['itemtitle']); $item = $tp->toDB($_POST['item']); $item = str_replace("src="e107_images", "src="" . SITEURL . "e107_images", $item); // Process File Upload ================================================= if ($_FILES['file_userfile'] && $pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS) { require_once(e_HANDLER . "upload_handler.php"); $uploaded = file_upload(e_IMAGE . "newspost_images/"); $file = $uploaded[0]['name']; $filetype = $uploaded[0]['type']; $filesize = $uploaded[0]['size']; $fileext = substr(strrchr($file, "."), 1); if (!$pref['upload_maxfilesize']) { $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576; } if ($uploaded && $fileext != "jpg" && $fileext != "gif" && $fileext != "png") { $message = SUBNEWSLAN_3; $error = true; } if ($filesize > $pref['upload_maxfilesize']) { $message = SUBNEWSLAN_4; $error = true; } if (!$error) { // $numberoffiles = count($uploaded); $today = getdate(); $newname = USERID . "_" . $today[0] . "_" . str_replace(" ", "_", substr($itemtitle, 0, 6)) . "." . $fileext; if ($file && $pref['subnews_resize']) { require_once(e_HANDLER . "resize_handler.php"); $rezwidth = $pref['subnews_resize']; if (!resize_image(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname, $rezwidth)) { rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname); } } elseif ($file) { rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname); } } } if ($error == false) { if (!file_exists(e_IMAGE . "newspost_images/" . $newname)) { $newname = ""; } $sql->db_Insert("submitnews", "0, '$user', '$email', '$itemtitle', '".intval($_POST['cat_id'])."','$item', '" . time() . "', '$ip', '0', '$newname' "); $edata_sn = array("user" => $user, "email" => $email, "itemtitle" => $itemtitle, "catid" => intval($_POST['cat_id']), "item" => $item, "ip" => $ip, "newname" => $newname); $e_event->trigger("subnews", $edata_sn); $ns->tablerender(LAN_133, "