mirror of
https://github.com/e107inc/e107.git
synced 2025-08-10 00:27:45 +02:00
News administration - more improvements
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
* News Administration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||
* $Revision: 1.24 $
|
||||
* $Date: 2009-01-17 22:48:14 $
|
||||
* $Revision: 1.25 $
|
||||
* $Date: 2009-01-18 00:27:10 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
@@ -58,7 +58,7 @@ function headerjs()
|
||||
$('core-newspost-create-form').observe('submit', function(event) {
|
||||
var form = event.element();
|
||||
action = form.readAttribute('action') + document.location.hash;
|
||||
if($('create-edit-stay-1') && $('create-edit-stay-1').checked)
|
||||
//if($('create-edit-stay-1') && $('create-edit-stay-1').checked)
|
||||
form.writeAttribute('action', action);
|
||||
});
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class admin_newspost
|
||||
{
|
||||
$tmp = explode(".", $qry);
|
||||
$action = varsettrue($tmp[0], 'main');
|
||||
$sub_action = varset($tmp[1],'');
|
||||
$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));
|
||||
@@ -405,13 +405,22 @@ class admin_newspost
|
||||
$tmp = explode(chr(35), $_POST['news_author']);
|
||||
$_POST['news_author'] = $tmp[0];
|
||||
|
||||
$sess = !(isset($_POST['create_edit_stay']) && !empty($_POST['create_edit_stay']));
|
||||
$ix->submit_item($_POST, $sess);
|
||||
$this->clear_cache();
|
||||
|
||||
if($sess)
|
||||
$ret = $ix->submit_item($_POST, true);
|
||||
$this->clear_cache();
|
||||
|
||||
if(isset($_POST['create_edit_stay']) && !empty($_POST['create_edit_stay']))
|
||||
{
|
||||
session_write_close();
|
||||
if($this->getSubAction() != 'edit')
|
||||
{
|
||||
session_write_close();
|
||||
$rurl = e_SELF.(varsettrue($ret['id']) ? "?create.edit.".$ret['id'] : '');
|
||||
header('Location:'.($rurl ? $rurl : e_SELF));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
session_write_close();
|
||||
header('Location:'.e_SELF);
|
||||
exit;
|
||||
}
|
||||
@@ -611,7 +620,7 @@ class admin_newspost
|
||||
|
||||
if (!varset($_POST['searchquery']))
|
||||
{
|
||||
$parms = $newsposts.",".$amount.",".$this->getFrom().",".e_SELF."?".$this->getAction().'.'.$this->getSubAction().'.'.$sort_order."[FROM]";
|
||||
$parms = $newsposts.",".$amount.",".$this->getFrom().",".e_SELF."?".$this->getAction().'.'.($this->getSubAction() ? $this->getSubAction() : 0).'.'.$sort_order.".[FROM]";
|
||||
$nextprev = $e107->tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||
if ($nextprev) $text .= "<div class='nextprev-bar'>".$nextprev."</div>";
|
||||
|
||||
@@ -684,7 +693,7 @@ class admin_newspost
|
||||
|
||||
if ($sub_action == "sn" && !varset($_POST['preview']))
|
||||
{
|
||||
if ($sql->db_Select("submitnews", "*", "submitnews_id={$id}", TRUE))
|
||||
if ($e107->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();
|
||||
@@ -1333,7 +1342,6 @@ class admin_newspost
|
||||
</form>
|
||||
";
|
||||
|
||||
//XXX LAN - Icon
|
||||
$text .= "
|
||||
<form action='".e_SELF."?cat' id='core-newspost-cat-list-form' method='post'>
|
||||
<fieldset id='core-newspost-cat-list'>
|
||||
@@ -1546,8 +1554,11 @@ class admin_newspost
|
||||
{
|
||||
global $rs, $ns, $tp, $frm, $e107;
|
||||
$sql2 = new db;
|
||||
$sub_action = $this->getSubAction();
|
||||
$id = $this->getId();
|
||||
//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"))
|
||||
{
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* News handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
|
||||
* $Revision: 1.11 $
|
||||
* $Date: 2009-01-16 01:02:41 $
|
||||
* $Author: mcfly_e107 $
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 2009-01-18 00:27:10 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@@ -35,6 +35,7 @@ class news {
|
||||
$author_insert = ($news['news_author'] == 0) ? "news_author = '".USERID."'," : "news_author = '".intval($news['news_author'])."', ";
|
||||
$news['news_author'] = ($news['news_author']) ? $news['news_author'] : USERID;
|
||||
|
||||
$data = array();
|
||||
if ($news['news_id'])
|
||||
{ // Updating existing item
|
||||
$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' ";
|
||||
@@ -64,14 +65,17 @@ class news {
|
||||
{ // Adding item
|
||||
if ($news['news_id'] = $sql ->db_Insert('news', "0, '".$news['news_title']."', '".$news['news_body']."', '".$news['news_extended']."', ".intval($news['news_datestamp']).", ".intval($news['news_author']).", '".intval($news['cat_id'])."', '".intval($news['news_allow_comments'])."', '".intval($news['news_start'])."', '".intval($news['news_end'])."', '".$tp->toDB($news['news_class'])."', '".intval($news['news_rendertype'])."', '0' , '".$news['news_summary']."', '".$tp->toDB($news['news_thumbnail'])."', '".intval($news['news_sticky'])."' "))
|
||||
{
|
||||
$admin_log->logArrayAll('NEWS_08', $news);
|
||||
$e_event -> trigger('newspost', $news);
|
||||
|
||||
$message = LAN_NEWS_6;
|
||||
$emessage->add(LAN_NEWS_6, E_MESSAGE_SUCCESS, $smessages);
|
||||
$e107cache -> clear('news.php');
|
||||
$id = mysql_insert_id();
|
||||
$data = array('method'=>'create', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'submit_item');
|
||||
//$message .= $e_event->triggerHook($data);
|
||||
|
||||
//moved down - prevent wrong mysql_insert_id
|
||||
$admin_log->logArrayAll('NEWS_08', $news);
|
||||
$e_event -> trigger('newspost', $news);
|
||||
|
||||
$emessage->add($e_event->triggerHook($data), E_MESSAGE_INFO, $smessages);
|
||||
}
|
||||
else
|
||||
@@ -135,7 +139,9 @@ class news {
|
||||
|
||||
/* end trackback */
|
||||
|
||||
return $message;
|
||||
//return $message;
|
||||
$data['message'] = $message;
|
||||
return $data;
|
||||
}
|
||||
|
||||
function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param='')
|
||||
|
Reference in New Issue
Block a user