load_files(); return $js; } $e_sub_cat = 'news'; $e_wysiwyg = "data,news_extended"; // -------- Presets. ------------ // always load before auth.php require_once(e_HANDLER."preset_class.php"); $pst = new e_preset; $pst->form = "dataform"; // form id of the form that will have it's values saved. $pst->page = "newspost.php?create"; // display preset options on which page(s). $pst->id = "admin_newspost"; // ------------------------------ $newspost = new newspost; require_once("auth.php"); $pst->save_preset('news_datestamp'); // save and render result using unique name. Don't save item datestamp require_once(e_HANDLER."userclass_class.php"); require_once(e_HANDLER."news_class.php"); require_once(e_HANDLER."ren_help.php"); require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."file_class.php"); $fl = new e_file; $rs = new form; $ix = new news; if (e_QUERY) { $tmp = explode(".", e_QUERY); $action = $tmp[0]; $sub_action = varset($tmp[1],''); $id = intval(varset($tmp[2],0)); $sort_order = varset($tmp[2],'desc'); $from = intval(varset($tmp[3],0)); unset($tmp); } $from = ($from ? $from : 0); $amount = 10; // ##### Main loop ----------------------------------------------------------------------------------------------------------------------- if(isset($_POST['news_userclass'])) { $_POST['news_class'] = implode(",", array_keys($_POST['news_userclass'])); } if(isset($_POST['delete'])) { $tmp = array_keys($_POST['delete']); list($delete, $del_id) = explode("_", $tmp[0]); } if ($delete == "main" && $del_id) { if ($sql->db_Count('news','(*)',"WHERE news_id = '{$del_id}'")) { $e_event->trigger("newsdel", $del_id); if($sql->db_Delete("news", "news_id='$del_id' ")) { $newspost->show_message(NWSLAN_31." #".$del_id." ".NWSLAN_32); $e107cache->clear("news.php"); $e107cache->clear("othernews"); $e107cache->clear("othernews2"); admin_purge_related("news", $del_id); } } unset($delete, $del); } if ($delete == "category" && $del_id) { if ($sql->db_Delete("news_category", "category_id='$del_id' ")) { $newspost->show_message(NWSLAN_33." #".$del_id." ".NWSLAN_32); unset($delete, $del_id); } } if($delete == "sn" && $del_id) { if ($sql->db_Delete("submitnews", "submitnews_id='$del_id' ")) { $newspost->show_message(NWSLAN_34." #".$del_id." ".NWSLAN_32); $e107cache->clear("news.php"); $e107cache->clear("othernews"); $e107cache->clear("othernews2"); unset($delete, $del_id); } } if (isset($_POST['submitupload'])) { $pref['upload_storagetype'] = "1"; require_once(e_HANDLER."upload_handler.php"); $uploaded = file_upload(e_IMAGE."newspost_images/"); foreach($_POST['uploadtype'] as $key=>$uploadtype){ if($uploadtype == "thumb"){ rename(e_IMAGE."newspost_images/".$uploaded[$key]['name'],e_IMAGE."newspost_images/thumb_".$uploaded[$key]['name']); } if($uploadtype == "file"){ rename(e_IMAGE."newspost_images/".$uploaded[$key]['name'],e_FILE."downloads/".$uploaded[$key]['name']); } if ($uploadtype == "resize" && $_POST['resize_value']) { require_once(e_HANDLER."resize_handler.php"); resize_image(e_IMAGE."newspost_images/".$uploaded[$key]['name'], e_IMAGE."newspost_images/".$uploaded[$key]['name'], $_POST['resize_value'], "copy"); } } } // required. if (isset($_POST['preview'])) { $_POST['news_title'] = $tp->toDB($_POST['news_title']); $_POST['news_summary'] = $tp->toDB($_POST['news_summary']); $newspost->preview_item($id); } if (isset($_POST['submit_news'])) { $newspost->submit_item($sub_action, $id); $e107cache->clear("news.php"); $e107cache->clear("othernews"); $e107cache->clear("othernews2"); $action = "main"; unset($sub_action, $id); } if (isset($_POST['create_category'])) { if ($_POST['category_name']) { if (empty($_POST['category_button'])) { $handle = opendir(e_IMAGE."icons"); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && $file != "/" && $file != "null.txt" && $file != "CVS") { $iconlist[] = $file; } } closedir($handle); $_POST['category_button'] = $iconlist[0]; } $_POST['category_name'] = $tp->toDB($_POST['category_name']); $sql->db_Insert("news_category", "'0', '".$_POST['category_name']."', '".$_POST['category_button']."'"); $newspost->show_message(NWSLAN_35); } } if (isset($_POST['update_category'])) { if ($_POST['category_name']) { $category_button = ($_POST['category_button'] ? $_POST['category_button'] : ""); $_POST['category_name'] = $tp->toDB($_POST['category_name']); $sql->db_Update("news_category", "category_name='".$_POST['category_name']."', category_icon='".$category_button."' WHERE category_id='".$_POST['category_id']."'"); $newspost->show_message(NWSLAN_36); } $e107cache->clear("news.php"); $e107cache->clear("othernews"); $e107cache->clear("othernews2"); } if (isset($_POST['save_prefs'])) { $pref['newsposts'] = $_POST['newsposts']; // ##### ADDED FOR NEWS ARCHIVE -------------------------------------------------------------------- $pref['newsposts_archive'] = $_POST['newsposts_archive']; $pref['newsposts_archive_title'] = $tp->toDB($_POST['newsposts_archive_title']); // ##### END -------------------------------------------------------------------------------------- $pref['news_cats'] = $_POST['news_cats']; $pref['nbr_cols'] = $_POST['nbr_cols']; $pref['subnews_attach'] = $_POST['subnews_attach']; $pref['subnews_resize'] = $_POST['subnews_resize']; $pref['subnews_class'] = $_POST['subnews_class']; $pref['subnews_htmlarea'] = $_POST['subnews_htmlarea']; $pref['subnews_hide_news'] = $_POST['subnews_hide_news']; $pref['news_subheader'] = $tp->toDB($_POST['news_subheader']); /* changes by jalist 22/01/2005: added pref to render new date header */ $pref['news_newdateheader'] = $_POST['news_newdateheader']; $pref['news_unstemplate'] = $_POST['news_unstemplate']; save_prefs(); $e107cache->clear("news.php"); $e107cache->clear("othernews"); $e107cache->clear("othernews2"); $newspost->show_message(NWSLAN_119); } if (!e_QUERY || $action == "main") { $newspost->show_existing_items($action, $sub_action, $sort_order, $from, $amount); } if ($action == "create") { $preset = $pst->read_preset("admin_newspost"); //only works here because $_POST is used. if ($sub_action == "edit" && !$_POST['preview'] && !$_POST['submit_news']) { if ($sql->db_Select("news", "*", "news_id='$id' ")) { $row = $sql->db_Fetch(); extract($row); $_POST['news_title'] = $news_title; $_POST['data'] = $news_body; $_POST['news_extended'] = $news_extended; $_POST['news_allow_comments'] = $news_allow_comments; $_POST['news_class'] = $news_class; $_POST['news_summary'] = $news_summary; $_POST['news_sticky'] = $news_sticky; $_POST['news_datestamp'] = ($_POST['news_datestamp']) ? $_POST['news_datestamp'] : $news_datestamp; $_POST['cat_id'] = $news_category; $_POST['news_start'] = $news_start; $_POST['news_end'] = $news_end; $_POST['comment_total'] = $sql->db_Count("comments", "(*)", " WHERE comment_item_id='$news_id' AND comment_type='0' "); $_POST['news_rendertype'] = $news_render_type; $_POST['news_thumbnail'] = $news_thumbnail; } } $newspost->create_item($sub_action, $id); } if ($action == "cat") { $newspost->show_categories($sub_action, $id); } if ($action == "sn") { $newspost->submitted_news($sub_action, $id); } if ($action == "pref") { $newspost->show_news_prefs($sub_action, $id); } echo " \n"; require_once("footer.php"); exit; class newspost { function show_existing_items($action, $sub_action, $sort_order, $from, $amount) { // ##### Display scrolling list of existing news items global $sql, $ns, $tp; $text = "
".NWSLAN_52." | ".$rs->form_text("category_name", 30, $category_name, 200)." |
".NWSLAN_53." |
".$rs->form_text("category_button", 60, $category_icon, 100)."
|
"; if ($id) { $text .= " ".$rs->form_button("submit", "category_clear", NWSLAN_79). $rs->form_hidden("category_id", $id)." |
".NWSLAN_86." | |
".NWSLAN_87." | |
".NWSLAN_88." | |
".NWSLAN_108." ".NWSLAN_109." |
// // // | //
".NWSLAN_115." ".NWSLAN_116." |
|
".NWSLAN_117." | |
".NWSLAN_106." | ".r_userclass("subnews_class", $pref['subnews_class'],"off","nobody,public,guest,member,admin,classes"). " |
".NWSLAN_107." | |
".NWSLAN_100." | |
".NWSLAN_101." | ".NWSLAN_102." |
".NWSLAN_111." ".NWSLAN_112." |
|
".NWSLAN_113." ".NWSLAN_114." |
|
".NWSLAN_120." |
" . display_help('helpb', 2) . " |
"; $text .= " |
ID | ".NWSLAN_57." | ".LAN_OPTIONS." |
$submitnews_id | ";
$text .= ($submitnews_auth == 0)? "".$tp->toHTML($submitnews_title,FALSE,"emotes_off, no_make_clickable")."": $tp->toHTML($submitnews_title,FALSE,"emotes_off, no_make_clickable");
$text .= " [ ".NWSLAN_104." ".$submitnews_name." ".NWSLAN_108." ".date("D dS M y, g:ia", $submitnews_datestamp)."] ".$tp->toHTML($submitnews_item)." |
";
$buttext = ($submitnews_auth == 0)? NWSLAN_58 : NWSLAN_103;
$text .= $rs->form_open("post", e_SELF."?sn", "myform__{$submitnews_id}", "", "", " onsubmit=\"return jsconfirm('".$tp->toJS(NWSLAN_38." [ID: $submitnews_id ]")."')\" ")
." ".$rs->form_button("button", "category_edit_{$submitnews_id}", $buttext, "onclick=\"document.location='".e_SELF."?create.sn.$submitnews_id'\"")."
".$rs->form_button("submit", "delete[sn_{$submitnews_id}]", LAN_DELETE)."
".$rs->form_close()."
|