diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 5ef92956f..31118e885 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -9,25 +9,42 @@ * News Administration * * $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ - * $Revision: 1.19 $ - * $Date: 2008-12-29 20:50:41 $ - * $Author: lisa_ $ + * $Revision: 1.20 $ + * $Date: 2009-01-13 17:09:30 $ + * $Author: secretr $ */ require_once("../class2.php"); -if (!getperms("H")) +if (!getperms("H")) { header("location:".e_BASE."index.php"); exit; } -require_once(e_HANDLER."calendar/calendar_class.php"); -$cal = new DHTML_Calendar(true); + + +$newspost = new admin_newspost(e_QUERY); function headerjs() { - global $cal; - $js = $cal->load_files(); + global $newspost; - return $js; + require_once(e_HANDLER.'js_helper.php'); + $ret = " + + + "; + $ret .= $newspost->_cal->load_files(); + + return $ret; } $e_sub_cat = 'news'; $e_wysiwyg = "data,news_extended"; @@ -40,19 +57,22 @@ $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"); +require_once (e_HANDLER."message_handler.php"); $fl = new e_file; -$rs = new form; -$ix = new news; +$rs = new form(); +$frm = new e_form(true); //enable inner tabindex counter +$emessage = &eMessage::getInstance(); + if (e_QUERY) @@ -67,7 +87,7 @@ if (e_QUERY) } $from = ($from ? $from : 0); -$amount = 10; + // ##### Main loop ----------------------------------------------------------------------------------------------------------------------- @@ -84,88 +104,12 @@ if(isset($_POST['news_userclass'])) } -if(isset($_POST['delete'])) -{ - $tmp = array_keys($_POST['delete']); - list($delete, $del_id) = explode("_", $tmp[0]); - $del_id = intval($del_id); -} +/* + * Observe for delete action + */ +$newspost->observer(); -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}' ")) - { - $admin_log->log_event('NEWS_01',$del_id,E_LOG_INFORMATIVE,''); - $newspost->show_message(NWSLAN_31." #".$del_id." ".NWSLAN_32); - $e107cache->clear("news.php"); - $e107cache->clear("othernews"); - $e107cache->clear("othernews2"); - - $data = array('method'=>'delete', 'table'=>'news', 'id'=>$del_id, 'plugin'=>'news', 'function'=>'delete'); - $message = $e_event->triggerHook($data); - - admin_purge_related("news", $del_id); - } - } - unset($delete, $del); -} - - -if ($delete == "category" && $del_id) -{ - if ($sql->db_Delete("news_category", "category_id='{$del_id}' ")) - { - $admin_log->log_event('NEWS_02',$del_id,E_LOG_INFORMATIVE,''); - $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}' ")) - { - $admin_log->log_event('NEWS_03',$del_id,E_LOG_INFORMATIVE,''); - $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. @@ -177,96 +121,12 @@ if (isset($_POST['preview'])) } -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]; - } - else - { - $_POST['category_button'] = $tp->toDB($_POST['category_button']); - } - $_POST['category_name'] = $tp->toDB($_POST['category_name']); - $sql->db_Insert('news_category', "'0', '".$_POST['category_name']."', '".$_POST['category_button']."'"); - $admin_log->log_event('NEWS_04',$_POST['category_name'].', '.$_POST['category_button'],E_LOG_INFORMATIVE,''); - $newspost->show_message(NWSLAN_35); - } -} - - -if (isset($_POST['update_category'])) -{ - if ($_POST['category_name']) - { - $category_button = $tp->toDB(($_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='".intval($_POST['category_id'])."'"); - $admin_log->log_event('NEWS_05',intval($_POST['category_id']).':'.$_POST['category_name'].', '.$category_button,E_LOG_INFORMATIVE,''); - $newspost->show_message(NWSLAN_36); - } - $e107cache->clear("news.php"); - $e107cache->clear("othernews"); - $e107cache->clear("othernews2"); -} - - -if (isset($_POST['save_prefs'])) -{ - unset($temp); - $temp['newsposts'] = intval($_POST['newsposts']); - $temp['newsposts_archive'] = intval($_POST['newsposts_archive']); - $temp['newsposts_archive_title'] = $tp->toDB($_POST['newsposts_archive_title']); - $temp['news_cats'] = intval($_POST['news_cats']); - $temp['nbr_cols'] = intval($_POST['nbr_cols']); - $temp['subnews_attach'] = intval($_POST['subnews_attach']); - $temp['subnews_resize'] = intval($_POST['subnews_resize']); - $temp['subnews_class'] = intval($_POST['subnews_class']); - $temp['subnews_htmlarea'] = intval($_POST['subnews_htmlarea']); - $temp['news_subheader'] = $tp->toDB($_POST['news_subheader']); - $temp['news_newdateheader'] = intval($_POST['news_newdateheader']); - $temp['news_unstemplate'] = intval($_POST['news_unstemplate']); - $temp['news_editauthor'] = intval($_POST['news_editauthor']); - - if ($admin_log->logArrayDiffs($temp, $pref, 'NEWS_06')) - { - save_prefs(); // Only save if changes - $e107cache->clear("news.php"); - $e107cache->clear("othernews"); - $e107cache->clear("othernews2"); - $newspost->show_message(NWSLAN_119); - } - else - { - $newspost->show_message(LAN_NEWS_47); - } -} - if (!e_QUERY || $action == "main") { - $newspost->show_existing_items($action, $sub_action, $sort_order, $from, $amount); + $newspost->show_existing_items(); } @@ -298,6 +158,7 @@ if ($action == "create") $_POST['news_thumbnail'] = $news_thumbnail; } } + $newspost->create_item($sub_action, $id); } @@ -338,223 +199,554 @@ exit; -class newspost +class admin_newspost { + var $_request = array(); + var $_cal = array(); + var $_frm = array(); - function show_existing_items($action, $sub_action, $sort_order, $from, $amount) + function admin_newspost($qry) { - // ##### Display scrolling list of existing news items - global $sql, $ns, $tp, $imode; - $text = "
"; - if (!$sort_order) $sort_order = 'desc'; - if ($sort_order != 'asc') $sort_order = 'desc'; - $sort_link = $sort_order == 'asc' ? 'desc' : 'asc'; // Effectively toggle setting for headings + $this->parseRequest($qry); - if (isset($_POST['searchquery'])) - { - $query = "news_title REGEXP('".$_POST['searchquery']."') OR news_body REGEXP('".$_POST['searchquery']."') OR news_extended REGEXP('".$_POST['searchquery']."') ORDER BY news_datestamp DESC"; - } - else - { - $query = "ORDER BY ".($sub_action ? $sub_action : "news_datestamp")." ".strtoupper($sort_order)." LIMIT {$from}, {$amount}"; - } + require_once(e_HANDLER."calendar/calendar_class.php"); + $this->_cal = new DHTML_Calendar(true); - if ($sql->db_Select("news", "*", $query, ($_POST['searchquery'] ? 0 : "nowhere"))) - { - $newsarray = $sql -> db_getList(); - $text .= " -
- - - - - - - - - - "; - $ren_type = array("default","title","other-news","other-news 2"); - foreach($newsarray as $row) + } + + function parseRequest($qry) + { + $tmp = explode(".", $qry); + $action = varsettrue($tmp[0], 'main'); + $sub_action = varset($tmp[1],''); + $id = isset($tmp[2]) && is_numeric($tmp[2]) ? intval($tmp[2]) : 0; + $sort_order = isset($tmp[2]) && !is_numeric($tmp[2]) ? $tmp[2] : 'desc'; + $from = intval(varset($tmp[3],0)); + unset($tmp); + + $this->_request = array($action, $sub_action, $id, $sort_order, $from); + } + + function getAction() + { + return $this->_request[0]; + } + + function getSubAction() + { + return $this->_request[1]; + } + + function getId() + { + return $this->_request[2]; + } + + function getSortOrder() + { + return $this->_request[3]; + } + + function getFrom() + { + return $this->_request[4]; + } + + function clear_cache() + { + $e107 = &e107::getInstance(); + $e107->ecache->clear("news.php"); + $e107->ecache->clear("othernews"); + $e107->ecache->clear("othernews2"); + } + + function observer() + { + if(isset($_POST['delete']) && is_array($_POST['delete'])) { - extract($row); + $this->_observe_delete(); + } + elseif(isset($_POST['submit_news'])) + { + $this->_observe_submit_item($this->getSubAction(), $this->getId()); + } + elseif(isset($_POST['create_category'])) + { + $this->_observe_create_category(); + } + elseif(isset($_POST['update_category'])) + { + $this->_observe_update_category(); + } + elseif(isset($_POST['save_prefs'])) + { + $this->_observe_save_prefs(); + } + elseif(isset($_POST['submitupload'])) + { + $this->_observe_upload(); + } + } + + function _observe_delete() + { + global $admin_log; + + $tmp = array_keys($_POST['delete']); + list($delete, $del_id) = explode("_", $tmp[0]); + $del_id = intval($del_id); + + if(!$del_id) return false; + + $e107 = &e107::getInstance(); + + switch ($delete) { + case 'main': + if ($e107->sql->db_Count('news','(*)',"WHERE news_id={$del_id}")) + { + $e107->e_event->trigger("newsdel", $del_id); + if($e107->sql->db_Delete("news", "news_id={$del_id}")) + { + $admin_log->log_event('NEWS_01',$del_id,E_LOG_INFORMATIVE,''); + $this->show_message(NWSLAN_31." #".$del_id." ".NWSLAN_32, E_MESSAGE_SUCCESS); + $this->clear_cache(); + + $data = array('method'=>'delete', 'table'=>'news', 'id'=>$del_id, 'plugin'=>'news', 'function'=>'delete'); + $this->show_message($e107->e_event->triggerHook($data), E_MESSAGE_ERROR); + + admin_purge_related("news", $del_id); + } + } + break; + + case 'category': + if ($e107->sql->db_Delete("news_category", "category_id={$del_id}")) + { + $admin_log->log_event('NEWS_02',$del_id,E_LOG_INFORMATIVE,''); + $this->show_message(NWSLAN_33." #".$del_id." ".NWSLAN_32, E_MESSAGE_SUCCESS); + $this->clear_cache(); + } + break; + + case 'sn': + if ($e107->sql->db_Delete("submitnews", "submitnews_id={$del_id}")) + { + $admin_log->log_event('NEWS_03',$del_id,E_LOG_INFORMATIVE,''); + $this->show_message(NWSLAN_34." #".$del_id." ".NWSLAN_32); + $this->clear_cache(); + } + break; + + default: + return false; + } + + return true; + } + + function _observe_submit_item($sub_action, $id) + { + // ##### Format and submit item to DB + global $admin_log; + + $e107 = &e107::getInstance(); + + require_once(e_HANDLER."news_class.php"); + $ix = new news; + + if($_POST['news_start']) + { + $tmp = explode("/", $_POST['news_start']); + $_POST['news_start'] = mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); + } + else + { + $_POST['news_start'] = 0; + } + + if($_POST['news_end']) + { + $tmp = explode("/", $_POST['news_end']); + $_POST['news_end'] = mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); + } + else + { + $_POST['news_end'] = 0; + } + + $matches = array(); + if(preg_match('#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#', $_POST['news_datestamp'], $matches)) + { + $_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); + } + else + { + $_POST['news_datestamp'] = time(); + } + + if($_POST['update_datestamp']) + { + $_POST['news_datestamp'] = time(); + } + + if ($id && $sub_action != "sn" && $sub_action != "upload") + { + $_POST['news_id'] = $id; + } + else + { + $e107->sql->db_Update('submitnews', "submitnews_auth=1 WHERE submitnews_id ={$id}"); + $admin_log->log_event('NEWS_07',$id,E_LOG_INFORMATIVE,''); + } + if (!$_POST['cat_id']) + { + $_POST['cat_id'] = 1; + } + + list($_POST['news_author'], $empty) = explode(chr(35), $_POST['news_author']); + + $this->show_message($ix->submit_item($_POST)); + unset($_POST['news_title'], $_POST['cat_id'], $_POST['data'], $_POST['news_extended'], $_POST['news_allow_comments'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['news_id'], $_POST['news_class']); + $this->clear_cache(); + } + + function _observe_create_category() + { + global $admin_log; + if ($_POST['category_name']) + { + $e107 = &e107::getInstance(); + 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]; + } + else + { + $_POST['category_button'] = $tp->toDB($_POST['category_button']); + } + $_POST['category_name'] = $tp->toDB($_POST['category_name']); + $e107->sql->db_Insert('news_category', "'0', '{$_POST['category_name']}', '{$_POST['category_button']}'"); + $admin_log->log_event('NEWS_04',$_POST['category_name'].', '.$_POST['category_button'],E_LOG_INFORMATIVE,''); + $this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS); + $this->clear_cache(); + } + } + function _observe_update_category() + { + global $admin_log; + if ($_POST['category_name']) + { + $e107 = &e107::getInstance(); + $category_button = $e107->tp->toDB(($_POST['category_button'] ? $_POST['category_button'] : "")); + $_POST['category_name'] = $e107->tp->toDB($_POST['category_name']); + $e107->sql->db_Update("news_category", "category_name='".$_POST['category_name']."', category_icon='".$category_button."' WHERE category_id=".intval($_POST['category_id'])); + $admin_log->log_event('NEWS_05',intval($_POST['category_id']).':'.$_POST['category_name'].', '.$category_button,E_LOG_INFORMATIVE,''); + $this->show_message(NWSLAN_36, E_MESSAGE_SUCCESS); + $this->clear_cache(); + } + } + + function _observe_save_prefs() + { + global $pref, $admin_log; + $temp = array(); + $temp['newsposts'] = intval($_POST['newsposts']); + $temp['newsposts_archive'] = intval($_POST['newsposts_archive']); + $temp['newsposts_archive_title'] = $tp->toDB($_POST['newsposts_archive_title']); + $temp['news_cats'] = intval($_POST['news_cats']); + $temp['nbr_cols'] = intval($_POST['nbr_cols']); + $temp['subnews_attach'] = intval($_POST['subnews_attach']); + $temp['subnews_resize'] = intval($_POST['subnews_resize']); + $temp['subnews_class'] = intval($_POST['subnews_class']); + $temp['subnews_htmlarea'] = intval($_POST['subnews_htmlarea']); + $temp['news_subheader'] = $tp->toDB($_POST['news_subheader']); + $temp['news_newdateheader'] = intval($_POST['news_newdateheader']); + $temp['news_unstemplate'] = intval($_POST['news_unstemplate']); + $temp['news_editauthor'] = intval($_POST['news_editauthor']); + + if ($admin_log->logArrayDiffs($temp, $pref, 'NEWS_06')) + { + save_prefs(); // Only save if changes + $this->clear_cache(); + $this->show_message(NWSLAN_119, E_MESSAGE_SUCCESS); + } + else + { + $this->show_message(LAN_NEWS_47); + } + } + + function _observe_upload() + { + //$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"); + } + } + } + + function show_existing_items() + { + require_once(e_HANDLER."form_handler.php"); + $frm = new e_form(true); //enable inner tabindex counter + + $sort_order = $this->getSortOrder(); + if ($sort_order != 'asc') $sort_order = 'desc'; + $sort_link = $sort_order == 'asc' ? 'desc' : 'asc'; // Effectively toggle setting for headings + $amount = 10;//TODO - pref + + $e107 = &e107::getInstance(); + + if (isset($_POST['searchquery'])) + { + $query = "news_title REGEXP('".$_POST['searchquery']."') OR news_body REGEXP('".$_POST['searchquery']."') OR news_extended REGEXP('".$_POST['searchquery']."') ORDER BY news_datestamp DESC"; + } + else + { + $query = "ORDER BY ".($this->getSubAction() ? $this->getSubAction() : "news_datestamp")." ".strtoupper($sort_order)." LIMIT ".$this->getFrom().", {$amount}"; + } + + if ($e107->sql->db_Select('news', '*', $query, ($_POST['searchquery'] ? 0 : "nowhere"))) + { + $newsarray = $e107->sql->db_getList(); + $text = " + +
+ ".NWSLAN_4." +
".LAN_NEWS_45."".NWSLAN_40."".LAN_NEWS_49."".LAN_OPTIONS."
+ + + + + + + + + + + + + + + + "; + $ren_type = array("default","title","other-news","other-news 2"); + foreach($newsarray as $row) + { // Note: To fix the alignment bug. Put both buttons inside the Form. // But make EDIT a 'button' and DELETE 'submit' - $text .= " - - - + $text .= " + + + + + + + "; + } - - "; + $text .= " + +
".LAN_NEWS_45."".NWSLAN_40."".LAN_NEWS_49."".LAN_OPTIONS."
{$news_id}".($news_title ? $tp->toHTML($news_title,"","no_hook,emotes_off,no_make_clickable") : "[".NWSLAN_42."]").""; - $text .= $ren_type[$news_render_type]; - if($news_sticky) - { - $sicon = (file_exists(THEME."images/sticky.png") ? THEME."images/sticky.png" : e_IMAGE."packs/".$imode."/generic/sticky.png"); - $text .= " "; - } - $text .= " -
{$row['news_id']}".($row['news_title'] ? $e107->tp->toHTML($row['news_title'], false,"TITLE") : "[".NWSLAN_42."]")." + "; + $text .= $ren_type[$row['news_render_type']]; + if($row['news_sticky']) + { + $sicon = (file_exists(THEME_ABS."images/sticky.png") ? THEME_ABS."images/sticky.png" : e_IMAGE_ABS."generic/sticky.png"); + $text .= " "; + } + //TODO - remove onclick events + $text .= " + + ".ADMIN_EDIT_ICON." + ".$frm->submit_image("delete[main_{$row['news_id']}]", LAN_DELETE, 'delete', NWSLAN_39." [ID: {$row['news_id']}]")." +
- ".ADMIN_EDIT_ICON." - -
+ +
+ "; + } + else + { + $text .= "
".NWSLAN_43."
"; } - $text .= ""; - } - else - { - $text .= "
".NWSLAN_43."
"; - } - $newsposts = $sql->db_Count("news"); + $newsposts = $e107->sql->db_Count('news'); - if (!$_POST['searchquery']) - { - $parms = $newsposts.",".$amount.",".$from.",".e_SELF."?".(e_QUERY ? "$action.$sub_action.$sort_order." : "main.news_datestamp.desc.")."[FROM]"; - $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}"); + if (!varset($_POST['searchquery'])) + { + $parms = $newsposts.",".$amount.",".$this->getFrom().",".e_SELF."?".$this->getAction().'.'.$this->getSubAction().'.'.$sort_order."[FROM]"; + $nextprev = $e107->tp->parseTemplate("{NEXTPREV={$parms}}"); + if ($nextprev) $text .= "
".$nextprev."
"; - } - - $text .= "
\n

\n\n\n

\n
\n
"; + } - - $ns->tablerender(NWSLAN_4, $text); + $text .= " +
+
+ ".$frm->text('searchquery', '', 50).$frm->admin_button('searchsubmit', NWSLAN_63, 'search')." +
+
+ "; + $emessage = &eMessage::getInstance(); + $e107->ns->tablerender(NWSLAN_4, $emessage->render().$text); } - function show_options($action) - { - global $sql; - if ($action == "") { - $action = "main"; - } - $var['main']['text'] = NWSLAN_44; - $var['main']['link'] = e_SELF; - - $var['create']['text'] = NWSLAN_45; - $var['create']['link'] = e_SELF."?create"; - - $var['cat']['text'] = NWSLAN_46; - $var['cat']['link'] = e_SELF."?cat"; - $var['cat']['perm'] = "7"; - - $var['pref']['text'] = NWSLAN_90; - $var['pref']['link'] = e_SELF."?pref"; - $var['pref']['perm'] = "N"; - if ($sql->db_Select("submitnews", "*", "submitnews_auth ='0' ")) { - $var['sn']['text'] = NWSLAN_47; - $var['sn']['link'] = e_SELF."?sn"; - $var['sn']['perm'] = "N"; - } - - show_admin_menu(NWSLAN_48, $action, $var); - - } function create_item($sub_action, $id) { - global $cal; - // ##### Display creation form - global $sql, $rs, $ns, $pref, $tp, $pst, $e107, $e_event; + global $pref; + // ##### Display creation form + require_once(e_HANDLER."form_handler.php"); + $frm = new e_form(true); //enable inner tabindex counter - if ($sub_action == "sn" && !$_POST['preview']) - { - if ($sql->db_Select("submitnews", "*", "submitnews_id=$id", TRUE)) + $sub_action = $this->getSubAction(); + $id = $this->getId(); + + $e107 = &e107::getInstance(); + + if ($sub_action == "sn" && !varset($_POST['preview'])) { - list($id, $submitnews_name, $submitnews_email, $_POST['news_title'], $submitnews_category, $_POST['data'], $submitnews_datestamp, $submitnews_ip, $submitnews_auth, $submitnews_file) = $sql->db_Fetch(); + if ($sql->db_Select("submitnews", "*", "submitnews_id={$id}", TRUE)) + { + //list($id, $submitnews_name, $submitnews_email, $_POST['news_title'], $submitnews_category, $_POST['data'], $submitnews_datestamp, $submitnews_ip, $submitnews_auth, $submitnews_file) = $sql->db_Fetch(); + $row = $e107->sql->db_Fetch(); + $_POST['news_title'] = $row['submitnews_title']; + $_POST['data'] = $row['submitnews_item']; + $_POST['cat_id'] = $row['submitnews_category']; if (e_WYSIWYG) { if (substr($_POST['data'],-7,7) == '[/html]') $_POST['data'] = substr($_POST['data'],0,-7); if (substr($_POST['data'],0,6) == '[html]') $_POST['data'] = substr($_POST['data'],6); - $_POST['data'] .= "
".NWSLAN_49." ".$submitnews_name.""; - $_POST['data'] .= ($submitnews_file)? "

": ""; + $_POST['data'] .= "
".NWSLAN_49." {$row['submitnews_name']}"; + $_POST['data'] .= ($row['submitnews_file'])? "

": ''; } else { - $_POST['data'] .= "\n[[b]".NWSLAN_49." ".$submitnews_name."[/b]]"; - $_POST['data'] .= ($submitnews_file)?"\n\n[img]{e_IMAGE}newspost_images/".$submitnews_file."[/img]": ""; + $_POST['data'] .= "\n[[b]".NWSLAN_49." {$row['submitnews_name']}[/b]]"; + $_POST['data'] .= ($row['submitnews_file'])?"\n\n[img]{e_IMAGE}newspost_images/{$row['submitnews_file']}[/img]": ""; } - $_POST['cat_id'] = $submitnews_category; - } - } - if ($sub_action == "upload" && !$_POST['preview']) - { - if ($sql->db_Select("upload", "*", "upload_id=$id")) { + } + } + + if ($sub_action == "upload" && !varset($_POST['preview'])) + { + if ($e107->sql->db_Select('upload', '*', "upload_id={$id}")) { $row = $sql->db_Fetch(); - extract($row); - $post_author_id = substr($upload_poster, 0, strpos($upload_poster, ".")); - $post_author_name = substr($upload_poster, (strpos($upload_poster, ".")+1)); - $upload_file = "pub_" . (preg_match("#Binary\s(.*?)\/#", $upload_file, $match) ? $match[1] : $upload_file); - $_POST['news_title'] = LAN_UPLOAD.": ".$upload_name; - $_POST['data'] = $upload_description."\n[b]".NWSLAN_49." ".$post_author_name."[/b]\n\n[file=request.php?".$upload_file."]".$upload_name."[/file]\n"; + $post_author_id = substr($row['upload_poster'], 0, strpos($row['upload_poster'], ".")); + $post_author_name = substr($row['upload_poster'], (strpos($row['upload_poster'], ".")+1)); + $match = array(); + //XXX DB UPLOADS STILL SUPPORTED? + $upload_file = "pub_" . (preg_match('#Binary\s(.*?)\/#', $row['upload_file'], $match) ? $match[1] : $row['upload_file']); + $_POST['news_title'] = LAN_UPLOAD.": ".$row['upload_name']; + $_POST['data'] = $row['upload_description']."\n[b]".NWSLAN_49." ".$post_author_name."[/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n"; } - } + } - $text = "
-
- + $text = " + +
+ ".LAN_NEWS_52." +
+ + + + + + + + - - - - - - - + $text .= " + + + + + + - - - - "; + + + + + "; // -------- News Author --------------------- - $text .=" - - + + - + + + + + - - - - - - - - - - - + + + + + + + + - - - - - + + + + - + $text .= " + + + + +
".NWSLAN_6.": + "; -
".NWSLAN_6.": "; - - if (!$sql->db_Select("news_category")) + if (!$e107->sql->db_Select("news_category")) { $text .= NWSLAN_10; } else { - $text .= "\t"; + $text .= " + + "; } - $text .= "
".NWSLAN_12.": - -
".NWSLAN_12.": + ".$frm->text('news_title', $e107->tp->post_toForm($_POST['news_title']))." +
".LAN_NEWS_27.": - -
".LAN_NEWS_27.": + ".$frm->text('news_summary', $e107->tp->post_toForm($_POST['news_summary']), 250)." +
- ".LAN_NEWS_50.": - "; + $text .=" +
+ ".LAN_NEWS_50.": + + "; if(!getperms('0') && !check_class($pref['news_editauthor'])) { - $auth = ($_POST['news_author']) ? $_POST['news_author'] : USERID; - $sql -> db_Select("user", "user_name", "user_id = '".$auth."' LIMIT 1"); - $row = $sql -> db_Fetch(MYSQL_ASSOC); - $text .= ""; - $text .= "".$row['user_name'].""; + $auth = ($_POST['news_author']) ? intval($_POST['news_author']) : USERID; + $e107->sql->db_Select("user", "user_name", "user_id={$auth} LIMIT 1"); + $row = $e107->sql->db_Fetch(MYSQL_ASSOC); + $text .= ""; + $text .= "".$row['user_name'].""; } else // allow master admin to { - $text .= " - @@ -592,40 +783,38 @@ class newspost } $text .= " -
".NWSLAN_13.":
"; -
".NWSLAN_13.":
"; + $val = (strstr($e107->tp->post_toForm($_POST['data']), "[img]http") ? $_POST['data'] : str_replace("[img]../", "[img]", $e107->tp->post_toForm($_POST['data']))); + $text .= $frm->bbarea('data', $val, 'news', 'helpb'); - $insertjs = (!e_WYSIWYG) ? "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'": "rows='25' "; - $_POST['data'] = $tp->toForm($_POST['data']); - $text .= " - "; - $text .= display_help("helpb", 'news'); - - //Extended news form textarea - if(e_WYSIWYG){ $ff_expand = "tinyMCE.execCommand('mceResetDesignMode')"; } // Fixes Firefox issue with hidden wysiwyg textarea. + // Extended news form textarea + // Fixes Firefox issue with hidden wysiwyg textarea. + // XXX - WYSIWYG is already plugin, this should go + if(defsettrue('e_WYSIWYG')) $ff_expand = "tinyMCE.execCommand('mceResetDesignMode')"; + $val = (strstr($e107->tp->post_toForm($_POST['news_extended']), "[img]http") ? $e107->tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $e107->tp->post_toForm($_POST['news_extended']))); $text .= " -
".NWSLAN_14.": - ".NWSLAN_83." -
- - ". display_help("helpc", 'extended')." -
-
".NWSLAN_66.": - ".NWSLAN_69." -
"; +
".NWSLAN_14.": + ".NWSLAN_83." +
+ ".$frm->bbarea('news_extended', $val, 'extended', 'helpc')." +
+
".NWSLAN_66.": + ".NWSLAN_69." +
+ "; if (!FILE_UPLOADS) { @@ -642,38 +831,44 @@ class newspost $text .= LAN_UPLOAD_777."".str_replace("../","",e_IMAGE."newspost_images/")."

"; } - $up_name = array(LAN_NEWS_24,NWSLAN_67,LAN_NEWS_22,NWSLAN_68); - $up_value = array("resize","image","thumb","file"); + $up_name = array(LAN_NEWS_24, NWSLAN_67, LAN_NEWS_22, NWSLAN_68); + $up_value = array("resize", "image", "thumb", "file"); - $text .= "
- - -   - -
- - - - -
".LAN_NEWS_25."  px
"; + //FIXME - upload shortcode, flexible enough to be used everywhere + $text .= " + + +
+ + + + + + +
".$frm->admin_button('dupfield', LAN_NEWS_26, 'action', '', array('other' => 'onclick="duplicateHTML(\'upline\',\'up_container\');"'))."".LAN_NEWS_25." >".$frm->text('resize_value', ($_POST['resize_value'] ? $_POST['resize_value'] : '100'), 4, 'size=3&class=tbox')." px".$frm->admin_button('submitupload', NWSLAN_66, 'upload')."
+ "; } - $text .= " -
".NWSLAN_67.": - ".LAN_NEWS_23." -

"; + $text .= " +
+
".NWSLAN_67.": + ".LAN_NEWS_23." +
+ "; $parms = "name=news_thumbnail"; $parms .= "&path=".e_IMAGE."newspost_images/"; @@ -687,49 +882,68 @@ class newspost $parms .= "&click_postfix=[/img]"; - $text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}}"); + $text .= $e107->tp->parseTemplate("{IMAGESELECTOR={$parms}}"); - $text .= "
-
+ "; - $text .= " - ".NWSLAN_15.": - - ".NWSLAN_18." -
+ //Begin Options block + $text .= " +
+ ".LAN_OPTIONS." + + + + + + + + + + + + + - - - - - - - - - + + + + - "; - $text .=" - - + + + + "; + $text .= " + +
+ ".$frm->checkbox('update_datestamp', '1', $_POST['update_datestamp']).$frm->label(NWSLAN_105, 'update_datestamp', '1')." +
+ + + + "; // --------------------- News Userclass --------------------------- - $text .=" - - + + + + + + - - - - - + "; - if($_POST['news_sticky']) - { - $sel = " checked='checked' "; - } - else - { - $sel = ""; - } - $text .= " ".LAN_NEWS_30."\n\n\n\n"; if($pref['trackbackEnabled']){ - $text .= " - - - \n"; + $text .= " + + + + + "; } - //triggerHook $data = array('method'=>'form', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'create_item'); - $hooks = $e_event->triggerHook($data); + $hooks = $e107->e_event->triggerHook($data); if(!empty($hooks)) { - $text .= ""; + $text .= " + + + + "; foreach($hooks as $hook) { if(!empty($hook)) { $text .= " - - - - "; + + + + + "; } } } - $text .= " - +
".NWSLAN_15.": + ".NWSLAN_18." +
+ ". ($_POST['news_allow_comments'] ? "".LAN_ENABLED."  ".LAN_DISABLED : "".LAN_ENABLED."  ".LAN_DISABLED)." +
+
".NWSLAN_73.": + ".NWSLAN_74." +
- ". ($_POST['news_allow_comments'] ? "".LAN_ENABLED."  ".LAN_DISABLED : "".LAN_ENABLED."  ".LAN_DISABLED)." -
-
".NWSLAN_73.": - ".NWSLAN_74." -
"; + "; $ren_type = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2"); + $r_array = array(); foreach($ren_type as $key=>$value) { + $r_array[$key] = $value; + /* $checked = ($_POST['news_rendertype'] == $key) ? "checked='checked'" : ""; $text .= ""; $text .= $value."
"; + */ } - $text .="
-
".NWSLAN_19.": - - ".NWSLAN_72." -
- -
- ".NWSLAN_21.":
"; + $text .= " + ".$frm->radio_multi('news_rendertype', $r_array, $_POST['news_rendertype'], true)." +
+
".NWSLAN_19.": + ".NWSLAN_72." +
+
".NWSLAN_21.":
+
+ "; $_startdate = ($_POST['news_start'] > 0) ? date("d/m/Y", $_POST['news_start']) : ""; @@ -741,7 +955,7 @@ class newspost $cal_attrib['size'] = "10"; $cal_attrib['name'] = "news_start"; $cal_attrib['value'] = $_startdate; - $text .= $cal->make_input_field($cal_options, $cal_attrib); + $text .= $this->_cal->make_input_field($cal_options, $cal_attrib); $text .= " - "; @@ -757,20 +971,20 @@ class newspost $cal_attrib['size'] = "10"; $cal_attrib['name'] = "news_end"; $cal_attrib['value'] = $_enddate; - $text .= $cal->make_input_field($cal_options, $cal_attrib); + $text .= $this->_cal->make_input_field($cal_options, $cal_attrib); $text .= " -
-
- ".LAN_NEWS_32.": - - ".LAN_NEWS_33." -
"; - $update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : ""; +
+ +
".LAN_NEWS_32.": + ".LAN_NEWS_33." +
+
+ "; $_update_datestamp = ($_POST['news_datestamp'] > 0 && !strpos($_POST['news_datestamp'],"/")) ? date("d/m/Y H:i:s", $_POST['news_datestamp']) : trim($_POST['news_datestamp']); unset($cal_options); @@ -783,102 +997,106 @@ class newspost $cal_attrib['class'] = "tbox"; $cal_attrib['name'] = "news_datestamp"; $cal_attrib['value'] = $_update_datestamp; - $text .= $cal->make_input_field($cal_options, $cal_attrib); + $text .= $this->_cal->make_input_field($cal_options, $cal_attrib); - $text .= "
- ".NWSLAN_105." -
-
- ".NWSLAN_22.": - + $text .= " +
".NWSLAN_22.": + ".NWSLAN_84." +
+ ".r_userclass_check("news_userclass", $_POST['news_class'], "nobody,public,guest,member,admin,classes,language")." +
+
".LAN_NEWS_28.": + ".LAN_NEWS_29." +
+ ".$frm->checkbox('news_sticky', '1', $_POST['news_sticky']).$frm->label(LAN_NEWS_30, 'news_sticky', '1')." - ".NWSLAN_84." -
- ".r_userclass_check("news_userclass", $_POST['news_class'], "nobody,public,guest,member,admin,classes,language")." -
-
- ".LAN_NEWS_28.": - - - ".LAN_NEWS_29." -
+
+
".LAN_NEWS_34.":".LAN_NEWS_35." -
- "; - /* pingback */ - // ".LAN_NEWS_36."
- $text .= LAN_NEWS_37."

- -
-
".LAN_NEWS_34.": + ".LAN_NEWS_35." +
+
+ ".LAN_NEWS_37." +
+
+ +
+
+
".LAN_HOOKS."
".LAN_HOOKS."
".$hook['caption']."".$hook['text']."
".$hook['caption']."".$hook['text']."
". - - (isset($_POST['preview']) ? " " : " "). - ($id && $sub_action != "sn" && $sub_action != "upload" ? " " : " ")." + $text .= " +
+
+
+ ".$frm->admin_button('preview', isset($_POST['preview']) ? NWSLAN_24 : NWSLAN_27 , 'submit')." + ".$frm->admin_button('submit_news', ($id && $sub_action != "sn" && $sub_action != "upload") ? NWSLAN_25 : NWSLAN_26 , 'update')." + +
+ - \n - - - - -
"; - $ns->tablerender(NWSLAN_29, $text); + "; + $emessage = &eMessage::getInstance(); + $e107->ns->tablerender(NWSLAN_29, $emessage->render().$text); } - function preview_item($id) + function preview_item($id) { // ##### Display news preview --------------------------------------------------------------------------------------------------------- global $tp, $sql, $ix, $IMAGES_DIRECTORY; @@ -923,7 +1141,7 @@ class newspost list($_POST['category_id'], $_POST['category_name'], $_POST['category_icon']) = $sql->db_Fetch(); // $_POST['user_id'] = USERID; // $_POST['user_name'] = USERNAME."blabla"; - list($_POST['user_id'],$_POST['user_name']) = explode(chr(1),$_POST['news_author']); + list($_POST['user_id'],$_POST['user_name']) = explode(chr(35),$_POST['news_author']); $_POST['news_author'] = $_POST['user_id']; $_POST['comment_total'] = $comment_total; $_PR = $_POST; @@ -939,77 +1157,18 @@ class newspost echo $tp -> parseTemplate('{NEWSINFO}', FALSE, $news_shortcodes); } - - function submit_item($sub_action, $id) - { - // ##### Format and submit item to DB - global $tp, $ix, $sql, $admin_log; - if($_POST['news_start']) - { - $tmp = explode("/", $_POST['news_start']); - $_POST['news_start'] = mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); - } - else - { - $_POST['news_start'] = 0; - } - - if($_POST['news_end']) - { - $tmp = explode("/", $_POST['news_end']); - $_POST['news_end'] = mktime(0, 0, 0, $tmp[1], $tmp[0], $tmp[2]); - } - else - { - $_POST['news_end'] = 0; - } - - if(preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['news_datestamp'], $matches)) - { - $_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); - } - else - { - $_POST['news_datestamp'] = time(); - } - - if($_POST['update_datestamp']) - { - $_POST['news_datestamp'] = time(); - } - - if ($id && $sub_action != "sn" && $sub_action != "upload") - { - $_POST['news_id'] = $id; - } - else - { - $sql->db_Update("submitnews", "submitnews_auth='1' WHERE submitnews_id ='".$id."' "); - $admin_log->log_event('NEWS_07',$id,E_LOG_INFORMATIVE,''); - } - if (!$_POST['cat_id']) - { - $_POST['cat_id'] = 1; - } - - list($_POST['news_author'],$empty) = explode(chr(1),$_POST['news_author']); - - $this->show_message($ix->submit_item($_POST)); - unset($_POST['news_title'], $_POST['cat_id'], $_POST['data'], $_POST['news_extended'], $_POST['news_allow_comments'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['news_id'], $_POST['news_class']); - } - - - function show_message($message) + function show_message($message, $type = '') { // ##### Display comfort --------------------------------------------------------------------------------------------------------- - global $ns; - $ns->tablerender("", "
".$message."
"); + //global $ns; + //$ns->tablerender("", "
".$message."
"); + $emessage = &eMessage::getInstance(); + $emessage->add($message, $type OR E_MESSAGE_INFO); } - - function show_categories($sub_action, $id) + function show_categories($sub_action, $id) { - global $sql, $rs, $ns, $tp; + global $sql, $rs, $ns, $tp, $frm; $handle = opendir(e_IMAGE."icons"); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && $file != "/" && $file != "null.txt" && $file != "CVS") { @@ -1025,53 +1184,92 @@ class newspost } } - $text = "
- ".$rs->form_open("post", e_SELF."?cat", "dataform")." - - - - - - - - "; + $text .= " + ".$frm->admin_button('update_category', NWSLAN_55, 'update')." + ".$frm->admin_button('category_clear', NWSLAN_79)." + ".$frm->hidden("category_id", $id)." + "; } else { - $text .= ""; + $text .= " + ".$frm->admin_button('create_category', NWSLAN_56, 'create')." + "; } - $text .= "
".NWSLAN_52."".$rs->form_text("category_name", 30, $category_name, 200)."
".NWSLAN_53." - ".$rs->form_text("category_button", 60, $category_icon, 100)." -
- -
- ".$rs->form_close()." -
"; - $ns->tablerender(NWSLAN_56, $text); + $text .= " +
+ + + "; + + //$ns->tablerender(NWSLAN_56, $text); unset($category_name, $category_icon); - - $text = "
"; - if ($category_total = $sql->db_Select("news_category")) { - $text .= " + //XXX LAN - Icon + $text .= "
- - - - - - - "; +
+ ".NWSLAN_51." +
".LAN_NEWS_45." ".NWSLAN_6."".LAN_OPTIONS."
+ + + + + + + + + + + + + + + + "; + if ($category_total = $sql->db_Select("news_category")) { while ($row = $sql->db_Fetch()) { extract($row); @@ -1079,83 +1277,101 @@ class newspost $icon = (strstr($category_icon, "images/") ? THEME."$category_icon" : e_IMAGE."icons/$category_icon"); } - $text .= " - - - - - \n"; + $text .= " + + + + + + + "; } - $text .= "
".LAN_NEWS_45."Icon".NWSLAN_6."".LAN_OPTIONS."
{$category_id}$category_name - ".ADMIN_EDIT_ICON." - toJS(NWSLAN_37." [ID: $category_id ]")."') \"/> -
{$category_id}$category_name + ".ADMIN_EDIT_ICON." + toJS(NWSLAN_37." [ID: $category_id ]")."') \"/> +
"; + $text .= " + + + "; } else { - $text .= "
".NWSLAN_10."
"; + $text .= "
".NWSLAN_10."
"; } - $text .= "
"; - $ns->tablerender(NWSLAN_51, $text); + + $text .= " + + + + "; + + $ns->tablerender(NWSLAN_46, $text); } - function show_news_prefs() + function show_news_prefs() { - global $sql, $rs, $ns, $pref; + global $sql, $rs, $ns, $pref, $frm; - $text = "
- ".$rs->form_open("post", e_SELF."?pref", "dataform")." - - - - - - - - - - - - - - - - "; + $text = " + +
+ ".NWSLAN_90." +
".NWSLAN_86." - -
".NWSLAN_87." -
".NWSLAN_88." - -
+ + + + + + + + + + + + + + + + + + "; // ##### ADDED FOR NEWS ARCHIVE -------------------------------------------------------------------- // the possible archive values are from "0" to "< $pref['newsposts']" // this should really be made as an onchange event on the selectbox for $pref['newsposts'] ... $text .= " - - - + + - - - - - - + $text .= " + +
".NWSLAN_116."
+ + + + + + "; // ##### END -------------------------------------------------------------------------------------- @@ -1163,126 +1379,173 @@ class newspost require_once(e_HANDLER."userclass_class.php"); $text .= " - - - - - - - "; - - - $text .= " - - - - "; - - - $text .= " - - - - - - - - - - - - - - - - - - - - - - - - - - - - "; - - $text .= "
".NWSLAN_86." + ".$frm->checkbox('news_cats', '1', ($pref['news_cats'] == 1))." +
".NWSLAN_87." + +
".NWSLAN_88." + ".$frm->text('newsposts', $pref['newsposts'])." +
".NWSLAN_115."
- ".NWSLAN_116." -
-
".NWSLAN_115." +
".NWSLAN_117." - -
".NWSLAN_117." + ".$frm->text('newsposts_archive_title', $pref['newsposts_archive_title'])." +
".LAN_NEWS_51." - ".r_userclass("news_editauthor", $pref['news_editauthor'],"off","nobody,mainadmin,admin,classes"). "
".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 .= "
- ".$rs->form_close()." -
"; + + ".LAN_NEWS_51." + + ".r_userclass("news_editauthor", $pref['news_editauthor'],"off","nobody,mainadmin,admin,classes")." + + + + ".NWSLAN_106." + + ".r_userclass("subnews_class", $pref['subnews_class'],"off","nobody,public,guest,member,admin,classes")." + + + + ".NWSLAN_107." + + ".$frm->checkbox('subnews_htmlarea', '1', $pref['subnews_htmlarea'])." + + + + ".NWSLAN_100." + + ".$frm->checkbox('subnews_attach', '1', $pref['subnews_attach'])." + + + + ".NWSLAN_101." + + + ".NWSLAN_102." + + + + ".NWSLAN_111." + + ".$frm->checkbox('news_newdateheader', '1', ($pref['news_newdateheader'] == 1))." +
".NWSLAN_112."
+ + + + ".NWSLAN_113." + + ".$frm->checkbox('news_unstemplate', '1', ($pref['news_unstemplate'] == 1))." +
".NWSLAN_114."
+ + + + ".NWSLAN_120." + +
" . display_help('helpb', 2) . " + + + + +
+ ".$frm->admin_button('save_prefs', NWSLAN_89, 'update')." +
+ + + "; $ns->tablerender(NWSLAN_90, $text); } - + //XXX Lan - many many lans function submitted_news($sub_action, $id) { - global $rs, $ns, $tp; + global $rs, $ns, $tp, $frm, $e107; $sql2 = new db; - $text = "
"; if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC")) { - $text .= " - - - - - "; - while ($row = $sql2->db_Fetch()) - { + $text .= " + +
+ ".NWSLAN_47." +
ID".NWSLAN_57."".LAN_OPTIONS."
+ + + + + + + + + + + + + + "; + while ($row = $sql2->db_Fetch()) + { extract($row); - if (substr($submitnews_item,-7,7) == '[/html]') $submitnews_item = substr($submitnews_item,0,-7); - if (substr($submitnews_item,0,6) == '[html]') $submitnews_item = substr($submitnews_item,6); - $text .= " - - - - \n"; + + if (substr($submitnews_item,-7,7) == '[/html]') $submitnews_item = substr($submitnews_item,0,-7); + if (substr($submitnews_item,0,6) == '[html]') $submitnews_item = substr($submitnews_item,6); + + $text .= " + + + + + + "; } - $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()." -
{$submitnews_id} + ".$tp->toHTML($submitnews_title,FALSE,"emotes_off, no_make_clickable")."
".$tp->toHTML($submitnews_item)." +
+
Posted: ".(($submitnews_auth == 0) ? "No" : "Yes")."
+
Date: ".date("D dS M y, g:ia", $submitnews_datestamp)."
+
User: ".$submitnews_name."
+
Email: ".$submitnews_email."
+
IP: ".$e107->ipDecode($submitnews_ip)."
+
+
+ ".$frm->admin_button("category_edit_{$submitnews_id}", $buttext, 'action', '', array('id'=>false, 'other'=>"onclick=\"document.location='".e_SELF."?create.sn.$submitnews_id'\""))." + ".$frm->admin_button("delete[sn_{$submitnews_id}]", LAN_DELETE, 'delete', '', array('id'=>false, 'title'=>$tp->toJS(NWSLAN_38." [ID: {$submitnews_id} ]")))." +
+
"; + $text .= " + + + + + "; } else { $text .= "
".NWSLAN_59."
"; } - $text .= "
"; + $ns->tablerender(NWSLAN_47, $text); } + function show_options() + { + $e107 = &e107::getInstance(); + + $var['main']['text'] = NWSLAN_44; + $var['main']['link'] = e_SELF; + + $var['create']['text'] = NWSLAN_45; + $var['create']['link'] = e_SELF."?create"; + + $var['cat']['text'] = NWSLAN_46; + $var['cat']['link'] = e_SELF."?cat"; + $var['cat']['perm'] = "7"; + + $var['pref']['text'] = NWSLAN_90; + $var['pref']['link'] = e_SELF."?pref"; + $var['pref']['perm'] = "N"; + if ($e107->sql->db_Select('submitnews', '*', "submitnews_auth=0")) { + $var['sn']['text'] = NWSLAN_47; + $var['sn']['link'] = e_SELF."?sn"; + $var['sn']['perm'] = "N"; + } + + e_admin_menu(NWSLAN_48, $this->getAction(), $var); + } + } -function newspost_adminmenu() +function newspost_adminmenu() { global $newspost; - global $action; - $newspost->show_options($action); + $newspost->show_options(); } diff --git a/e107_images/generic/sticky.png b/e107_images/generic/sticky.png new file mode 100644 index 000000000..601ff976b Binary files /dev/null and b/e107_images/generic/sticky.png differ diff --git a/e107_languages/English/admin/lan_newspost.php b/e107_languages/English/admin/lan_newspost.php index e8cc6e71e..3f7bc27c5 100644 --- a/e107_languages/English/admin/lan_newspost.php +++ b/e107_languages/English/admin/lan_newspost.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_newspost.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-12-07 13:08:48 $ -| $Author: e107steved $ +| $Revision: 1.4 $ +| $Date: 2009-01-13 17:09:30 $ +| $Author: secretr $ +----------------------------------------------------------------------------+ */ define("NWSLAN_1", "News story deleted."); @@ -170,4 +170,5 @@ define("LAN_NEWS_49", "Render-type"); define("LAN_NEWS_50", "Author"); define("LAN_NEWS_51", "Modification of the news-item author can be done by:"); +define("LAN_NEWS_52", "General Information"); ?>