protected function beforeSuccess($commentOn, $comment)
	{
		if ($comment->spamStatus == PropertySpamStatus::UNKNOWN)
		{
			$this->notice('Your comment will be moderated, and will appear on a later time on the site');
			
			$config = CoOrg::config();
			$secondsSinceLastMail = time() - $config->get($this->_configName . '/last-moderation-mail');
			$minSecondsBetweenMails = 60*60*24*$config->get($this->_configName . '/moderation-time');
			if ($secondsSinceLastMail > $minSecondsBetweenMails)
			{
				$config->set($this->_configName . '/last-moderation-mail', time());
				$config->save();
				$receiver = $config->get($this->_configName . '/moderation-email');
				$mail = $this->mail();
				$mail->title = $comment->title;
				$mail->body = $comment->comment;
				$mail->date = $comment->timePosted;
				$mail->messageURL = $this->showURL($commentOn, $comment);
				$mail->moderationURL = CoOrg::createFullURL(array($this->_commentRequests->queue));
				$mail->totalModerationQueue = Comment::moderationQueueLength($this->_commentClass);
				$site = $config->get('site/title');
				$mail->site = $site;
				$mail->to($receiver)
				     ->subject(t('%site: New comment to moderate', array('site' => $site)))
				     ->send(Controller::getTemplatePath('mails/newcomment', 'comments'));
			}
		}
	}
Example #2
0
	public function render($tpl, $app = false, $base = 'base')
	{
		if ($base == 'base' && $app == false)
		{
			CoOrg::loadPluginInfo('admin');
			$this->_adminTabs = Admin::tabs($this->_adminModule, $this->_adminTab);

			parent::render($tpl, false, 'base.html.tpl|'.Controller::getTemplatePath('admin.html.tpl', 'admin'));
		}
		else
		{
			parent::render($tpl, $app, $base);
		}
	}
Example #3
0
function smarty_function_foreign($args, $smarty)
{
	$module = $args['module'];
	$file = $args['file'];
	unset($args['module']);
	unset($args['file']);
	
	$path = Controller::getTemplatePath($file, $module);
	
	$data = $smarty->createData($smarty);
	foreach ($args as $name=>$val)
	{
		$data->assign($name, $val);
	}
	
	$tpl = $smarty->createTemplate($path, $data);
	return $tpl->fetch();
}