diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php
index 8bd559674..6e9e273a4 100644
--- a/e107_admin/newspost.php
+++ b/e107_admin/newspost.php
@@ -9,8 +9,8 @@
* News Administration
*
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
- * $Revision: 1.25 $
- * $Date: 2009-01-18 00:27:10 $
+ * $Revision: 1.26 $
+ * $Date: 2009-01-18 19:02:07 $
* $Author: secretr $
*/
require_once("../class2.php");
@@ -687,13 +687,13 @@ class admin_newspost
$sub_action = $this->getSubAction();
- $id = $this->getId();
+ $id = $this->getSubAction() != 'sn' && $this->getSubAction() != 'upload' ? $this->getId() : 0;
$e107 = &e107::getInstance();
if ($sub_action == "sn" && !varset($_POST['preview']))
{
- if ($e107->sql->db_Select("submitnews", "*", "submitnews_id={$id}", TRUE))
+ if ($e107->sql->db_Select("submitnews", "*", "submitnews_id=".$this->getId(), 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();
@@ -719,15 +719,15 @@ class admin_newspost
if ($sub_action == "upload" && !varset($_POST['preview']))
{
- if ($e107->sql->db_Select('upload', '*', "upload_id={$id}")) {
- $row = $sql->db_Fetch();
+ if ($e107->sql->db_Select('upload', '*', "upload_id=".$this->getId())) {
+ $row = $e107->sql->db_Fetch();
$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";
+ $_POST['data'] = $row['upload_description']."\n[b]".NWSLAN_49." [link=".$e107->url->getUrl('core:user', 'main', 'id='.$post_author_id)."]".$post_author_name."[/link][/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n";
}
}
@@ -987,11 +987,6 @@ class admin_newspost
$r_array = array();
foreach($ren_type as $key=>$value) {
$r_array[$key] = $value;
- /*
- $checked = ($_POST['news_rendertype'] == $key) ? "checked='checked'" : "";
- $text .= "";
- $text .= $value."
";
- */
}
@@ -1218,7 +1213,7 @@ class admin_newspost
list($_POST['user_id'],$_POST['user_name']) = explode(chr(35), $_POST['news_author']);
$_POST['news_author'] = $_POST['user_id'];
- $_POST['comment_total'] = $this->getId() ? $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id=".$this->getId()." AND comment_type='0'") : 0;
+ $_POST['comment_total'] = $id ? $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id={$id} AND comment_type='0'") : 0;
$_PR = $_POST;
$_PR['news_body'] = $e107->tp->post_toHTML($_PR['data'],FALSE);
@@ -1272,8 +1267,9 @@ class admin_newspost
//category icon alias
$category['category-button'] = $category['category_icon'];
+
//Send the prefered response type
- echo $jshelper->sendXMLResponse('fill-form', $category);
+ $jshelper->sendResponse('fill-form', $category);
}
function show_categories()
@@ -1420,7 +1416,7 @@ class admin_newspost
function show_news_prefs()
{
- global $pref, $e_userclass;
+ global $pref;
require_once(e_HANDLER."form_handler.php");
$frm = new e_form(true); //enable inner tabindex counter
@@ -1547,20 +1543,15 @@ class admin_newspost
$e107->ns->tablerender(NWSLAN_90, $text);
}
-
-
- //XXX Lan - many many lans
function show_submitted_news()
{
- global $rs, $ns, $tp, $frm, $e107;
- $sql2 = new db;
- //FIXME - work in progress
+
$e107 = &e107::getInstance();
require_once(e_HANDLER."form_handler.php");
$frm = new e_form(true); //enable inner tabindex counter
- if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC"))
+ if ($e107->sql->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC"))
{
$text .= "