Example #1
0
	protected function get($year, $month, $day, $id, $language = null)
	{
		if ($language == null) $language = CoOrg::getLanguage();
		$this->_blog = Blog::getBlog($year, $month, $day, $id, $language);
		if (!$this->_blog)
		{
			$this->error(t('Blog item is not found'));
			$this->notFound();
			return false;
		}
		return true;
	}
	protected function get($date, $ID, $language)
	{
		list($year, $month, $day) = explode('-', $date);
		$this->_blog = Blog::getBlog($year, $month, $day, $ID, $language);
		return true;
	}
Example #3
0
	public function testEnableCommentsTestExpirationDate()
	{
		$blog = Blog::getBlog('2010', '04', '11', 'xyz', 'en');
		$this->assertFalse($blog->allowComments());
		$blog->text = 'Update';
		$blog->commentsOpenFor = 14;
		$blog->commentsAllowed = true;
		$blog->save();
		
		$blog = Blog::getBlog('2010', '04', '11', 'xyz', 'en');
		$this->assertFalse($blog->allowComments());
		$blog->commentsOpenFor = 356*30; // ~30 year
		$blog->save();
		
		$blog = Blog::getBlog('2010', '04', '11', 'xyz', 'en');
		$this->assertTrue($blog->allowComments());
	}
	public function testTranslateSaveOtherLanguage()
	{
		$this->login('nathan');
		$this->request('blog/translateSave', array('year'=>2010,
		                                       'month' => '04',
		                                        'day' => '10',
		                                        'id' => 'some-other-blog',
		                                        'fromLanguage' => 'en',
		                                        'title' => 'Vertaald',
		                                        'text' => 'Vertaalde tekst',
		                                        'language' => 'nl'));

		
		$this->assertFlashNotice('Your translation of the blog is saved');
		$this->assertRedirected('blog/show/2010/04/10/vertaald/nl');

		$this->assertNotNull(Blog::getBlog(2010, 4, 10, 'vertaald', 'nl'));
	}
	protected function findComment($ID)
	{
		$this->_comment = BlogComment::get($ID);
		if ($this->_comment)
		{
			$year = date('Y', $this->_comment->blogDatePosted);
			$month = date('m', $this->_comment->blogDatePosted);
			$day = date('d', $this->_comment->blogDatePosted);
			$this->_blog = Blog::getBlog($year, $month, $day,
			                             $this->_comment->blogID,
			                             $this->_comment->blogLanguage);
			return true;
		}
		else
		{
			return false;
		}
	}
	public function testUnmarkSpam()
	{
		$this->login('nathan');
		
		$this->request('blog/comment/notspam', array(
			'commentID' => 3));
		$this->assertFlashNotice('Comment unmarked as spam');
		$this->assertRedirected('blog/show/2010/4/11/xyz');
		$blog = Blog::getBlog('2010', '04', '11', 'xyz', 'en');
		$comment = $blog->comments[1];
		$this->assertEquals(3, $comment->ID);
		$this->assertEquals(PropertySpamStatus::OK, $comment->spamStatus);
	}
Example #7
0
<?php

$model = $_REQUEST['model'];
$action = $_REQUEST['action'];
include_once MODELS_ADMIN . "/" . $model . "_model.php";
switch (strtoupper($action)) {
    case 'ADD':
        if (isset($_REQUEST['btn_submit']) && $_REQUEST['btn_submit'] == 'Save') {
            $objBlog = new Blog();
            $objBlog->setBlog($_REQUEST);
            $objComm->redirect('index.php?model=' . $model);
        }
        break;
    case 'VIEW':
    case 'EDIT':
        if (isset($_REQUEST['btn_submit']) && $_REQUEST['btn_submit'] == 'Update') {
            $objBlog = new Blog();
            $objBlog->setBlog($_REQUEST);
            $objComm->redirect('index.php?model=' . $model . '&action=edit&id=' . $_REQUEST['pk_id']);
        } else {
            $objBlog = new Blog();
            $datum = $objBlog->getBlog($_REQUEST['id']);
        }
        break;
    default:
        $objBlog = new Blog();
        $data = $objBlog->getAllBlog();
        break;
}