Exemplo n.º 1
0
 public function tearDown()
 {
     if (!empty($this->testedAccountId)) {
         $testedAccount = model\Base::query('Accounts')->findPK($this->testedAccountId);
         $testedAccount and $testedAccount->delete();
     }
     $testedNews = model\Base::query('News')->findByTitle($this->title);
     $testedNews and $testedNews->delete();
 }
Exemplo n.º 2
0
 $parts = array('target' => 'news.php', 'field_size' => '40');
 // Route the request
 if (in('new') && self_char_id()) {
     // Display submit form
     $view = 'news-create.tpl';
 } elseif (in('news_submit')) {
     // Handle POST
     $news_title = in('news_title');
     $news_content = in('news_content');
     $tag = in('tag');
     // Create new post
     if (!empty($news_content)) {
         try {
             // News Model
             $news = new model\News();
             $me = model\Base::query('Players')->findPK(self_char_id());
             $news->createPost($news_title, $news_content, $me->getAccountss()->getFirst()->getAccountId(), $tag);
             $parts['new_successful_submit'] = true;
         } catch (InvalidArgumentException $e) {
             $parts['new_successful_submit'] = false;
         }
     }
 }
 // Fetch the news
 try {
     $news = new model\News();
     if (in('tag_query')) {
         // Search for specific tag
         $all_news = $news->findByTag(in('tag_query'));
         $parts['search_title'] = 'Result for #' . htmlentities(in('tag_query'));
     } else {