<?php
/**
* XS2:
*
* This file is developed by Solutecs, LLC for the purpose of the company
* and is provided together with XS2 Framework as and inherent part of the
* system. This file can be used on the terms of License Agreement.
*
* +7 (495) 585-0833 / 13 Rusakovskaya street, Moscow 107140 Russia
*
* @link http://www.solutecs.com
* @copyright ©1998-2007 Solutecs, LLC
* @package XS2-MODCOM
* @subpackage proc-forum
* @version 1.XX
*/
if ($_POST['action']) {
$node = $_POST;
xs2Fetch(array('mod'=>'forum', 'obj'=>'config', 'met'=>'date'));
xs2Fetch(array('mod'=>'forum', 'obj'=>'user', 'met'=>'lib'));
$GLOBALS['forumCurrentUser'] = $_HTML->get_template_vars('forumCurrentUser');
if (!$GLOBALS['forumCurrentUser']['NodId']) exit();
switch($node['action']) {
case 'addMessage':
$node['Author'] = array('NodId'=>$GLOBALS['forumCurrentUser']['NodId']);
$met = ('thread'==$node['NType'] ? 'show' : 'insert');
$id = xs2InsertNode($node);
header('location: '.xs2Href(array('mod'=>'forum',
'obj'=>'thread',
'met'=>$met, 'atr'=>$id)));
exit(); break;
case 'editMessage':
$old = xs2GetNode(array('NodId'=>$node['NodId'], 'mod'=>'forum'));
if ($old['Author'][0]['NodId'] != $GLOBALS['forumCurrentUser']['NodId']) break;
xs2UpdateNode($node);
header('location: '.xs2Href(array('mod'=>'forum',
'obj'=>'config',
'met'=>'blank')));
exit(); break;
case 'deleteMessage':
$old = xs2GetNode(array('NodId'=>$node['NodId'], 'mod'=>'forum'));
if ($old['Author'][0]['NodId'] != $GLOBALS['forumCurrentUser']['NodId']) break;
xs2UpdateNode(array('NodId'=>$node['NodId'],
'Deleted'=>1));
header('location: '.xs2Href(array('mod'=>'forum',
'obj'=>'config',
'met'=>'blank')));
exit(); break;
}
}
header('location: '.xs2Href(array('mod'=>'forum', 'obj'=>'config', 'met'=>'blank')));
?>
|
|