* @package FlexCP
* @subpackage News
* @version $Id$
*/
$form = new HTML_QuickForm2('frmComment');
$frm=$form->addElement('fieldset')->setLabel('Write New Comment');
$frm->addElement('hidden','hidArticle',array('value'=>$this->Article->ID),array());
$frm->addElement('text','txtTitle',array(),array())->setLabel('Subject:')->addRule('required','This field is required.');
$frm->addElement('textarea','txtContent',array('class'=>'mceMinimalEditor'),array())->setLabel('Message:')->addRule('required','This field is required.');
Captcha::AddQF2Control($frm,'', array(),array('label'=>''));
$frm->addElement('submit',null,array(),array());
if(!$form->validate())
{
?>
#=$this->Article->ID?>: =$this->Article->Title?>
Posted by =User::Find(intval($this->Article->User))->GetName()?> at =date(DATE_RFC822,$this->Article->Posted)?>
=$this->Article->Content?>
if($this->Article->AllowComments)
{
$rs2=DB::Execute(sprintf('SELECT * FROM %sNewsComments WHERE aclID=%d',ADODB_PREFIX,$this->Article->ID));
foreach($rs2 as $row)
{
$cu=User::Find(intval($row['usrID']));
?>
}
Output::RenderQF2($form);
}
} else {
if(!User::CheckAuth(GRP_BASIC))
Output::HardError('This command is limited to registered users.');
if(!$this->Article->AllowComments)
Output::HardError('This article has disabled comments.');
$article=new Article(POST::GetInt('txtArticleID'));
$com=new NewsComment();
$com->Article=$this->Article;
$com->Title=POST::GetEString('txtTitle');
$com->Content=POST::GetEString('txtContent'); // Cleaned before update.
$com->User=User::$Data;
$com->Posted=time();
$com->Update();
Output::Redirect(THISURL.'news.php/article/'.$this->Article->ID);
}