Ejemplo n.º 1
0
	/**
	 * @Acl allow blog-admin
	*/
	public function configsave($enableComments, $enableCommentsFor,
	                           $moderationEmail, $moderationTime)
	{
		$config = BlogConfig::get();
		$config->enableComments = $enableComments;
		$config->enableCommentsFor = $enableCommentsFor;
		$config->moderationEmail = $moderationEmail;
		$config->moderationTime = $moderationTime;
		try
		{
			$config->save();
		
			$this->notice(t('Saved blog configuration'));
			$this->redirect('admin/blog/config');
		}
		catch (ValidationException $e)
		{
			$this->_adminTab = 'BlogConfigureAdminTab';
		
			$this->openForOptions = BlogConfig::openForOptions();
			$this->moderationTimeOptions = BlogConfig::moderationTimeOptions();
			$this->blogConfig = $config;
			$this->error('Blog configuration not saved');
			$this->render('admin/config');
		}
	}
Ejemplo n.º 2
0
	/**
	 * @before get $year $month $day $id $language
	 * @Acl owns $:_blog
	*/
	public function edit($year, $month, $day, $id, $language = null)
	{
		$this->openFor = BlogConfig::openForOptions();
		$this->blog = $this->_blog;
		if ($this->_blog->commentsCloseDate === null)
		{
			$this->currentOpenFor = 0;
		}
		else
		{
			$this->currentOpenFor = (int)(($this->_blog->commentsCloseDate - $this->_blog->timePosted)/(60*60*24));
		}
		$this->render('edit');
	}