tablerender(NWSLAN_12, NWSLAN_11); require_once(FOOTERF); exit; } if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['submitnews_item']) { $ip = $e107->getip(); $fp = new floodprotect; if ($fp->flood("submitnews", "submitnews_datestamp") == FALSE) { header("location:".e_BASE."index.php"); exit; } $submitnews_user = (USER ? USERNAME : trim($tp->toDB($_POST['submitnews_name']))); $submitnews_email = (USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email'])))); $submitnews_title = $tp->toDB($_POST['submitnews_title']); $submitnews_item = $tp->toDB($_POST['submitnews_item']); $submitnews_item = str_replace("src="e107_images", "src="".SITEURL."e107_images", $submitnews_item); $submitnews_file = ""; $submitnews_error = FALSE; if (!$submitnews_user || !$submitnews_email) { $message = SUBNEWSLAN_7; $submitnews_error = TRUE; } // ==== 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/"); $filename = $uploaded[0]['name']; $filetype = $uploaded[0]['type']; $filesize = $uploaded[0]['size']; $fileext = substr(strrchr($filename, "."), 1); if ($filename && $fileext != "jpg" && $fileext != "gif" && $fileext != "png") { $message = SUBNEWSLAN_3; $submitnews_error = TRUE; } if (!$pref['upload_maxfilesize']) { $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576; } if ($filesize > $pref['upload_maxfilesize']) { $message = SUBNEWSLAN_4; $submitnews_error = TRUE; } if ($filename && !$submitnews_error) { $today = getdate(); $submitnews_file = USERID."_".$today[0]."_".str_replace(" ", "_", substr($submitnews_title, 0, 6)).".".$fileext; if ($pref['subnews_resize']) { require_once(e_HANDLER."resize_handler.php"); if (!resize_image(e_IMAGE."newspost_images/".$filename, e_IMAGE."newspost_images/".$submitnews_file, $pref['subnews_resize'])) { rename(e_IMAGE."newspost_images/".$filename, e_IMAGE."newspost_images/".$submitnews_file); } } elseif ($filename) { rename(e_IMAGE."newspost_images/".$filename, e_IMAGE."newspost_images/".$submitnews_file); } } if ($filename && !file_exists(e_IMAGE."newspost_images/".$submitnews_file)) { $submitnews_file = ""; } } if ($submitnews_error == FALSE) { $sql->db_Insert("submitnews", "0, '$submitnews_user', '$submitnews_email', '$submitnews_title', '".intval($_POST['cat_id'])."', '$submitnews_item', '".time()."', '$ip', '0', '$submitnews_file' "); $edata_sn = array("user" => $submitnews_user, "email" => $submitnews_email, "itemtitle" => $submitnews_title, "catid" => intval($_POST['cat_id']), "item" => $submitnews_item, "ip" => $ip, "newname" => $submitnews_file); $e_event->trigger("subnews", $edata_sn); $ns->tablerender(LAN_133, "
".LAN_134."
"); require_once(FOOTERF); exit; } else { require_once(e_HANDLER."message_handler.php"); message_handler("P_ALERT", $message); } } if (!defined("USER_WIDTH")) { define("USER_WIDTH","width:95%"); } $text = "
"; if (!empty($pref['news_subheader'])) { $text .= " "; } if (!USER) { $text .= " "; } $text .= " "; if (e_WYSIWYG) { $insertjs = "rows='25'"; } else { require_once(e_HANDLER."ren_help.php"); $insertjs = "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'"; } $text .= " "; if ($pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS) { $text .= " "; } $text .= "
".$tp->toHTML($pref['news_subheader'], TRUE, "TITLE")."
".LAN_7."
".LAN_112."
".NWSLAN_6.": "; if (!$sql->db_Select("news_category")) { $text .= NWSLAN_10; } else { $text .= " "; } $text .= "
".LAN_62."
".LAN_135."
"; if (!e_WYSIWYG) { $text .= display_help("helpb","submitnews"); } $text .= "
".SUBNEWSLAN_5."
".SUBNEWSLAN_6."
"; $ns->tablerender(LAN_136, $text); require_once(FOOTERF); function headerjs() { $adder = ""; if (e_WYSIWYG) $adder = 'tinyMCE.triggerSave();'; $script = " "; return $script; } ?>