/** * The component to display a single forum (i.e. the threads in it) */ public function executeShowForum() { $this->category = CategoryPeer::retrieveByPK($this->forumID); if ($this->category == NULL) { $this->category = ForumPeer::retrieveByPK($this->forumID); } $c = ThreadPeer::getCriteriaForCategory($this->forumID); $pager = new sfPropelPager('Thread', 10); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $raykuPager = new RaykuPagerRenderer($pager); $raykuPager->setBaseUrl('@view_page?forum_id=' . $this->category->getId()); $this->raykuPager = $raykuPager; }
public function executeNewThread() { $this->User = $this->getUser()->getRaykuUser(); if (!empty($_COOKIE['redirection'])) { $this->getResponse()->setCookie("redirection", "", time() - 600, '/', sfConfig::get('app_cookies_domain')); } $c = new Criteria(); $c->add(ForumPeer::TYPE, 0); $this->publicforums = ForumPeer::doSelect($c); $this->category = CategoryPeer::retrieveByPK($this->getRequestParameter('forum_id')); if (!$this->category instanceof Category) { $this->category = ForumPeer::retrieveByPK($this->getRequestParameter('forum_id')); } $this->allcategories = CategoryPeer::doSelect($c = new Criteria()); $user = $this->getUser()->getRaykuUser(); if ($this->getRequestParameter('thread_title') != '') { $theard_title_len = strlen($this->getRequestParameter('thread_title')); $theard_body_len = strlen(strip_tags($this->getRequestParameter('post_body'))); if ($theard_title_len >= 10 and $theard_body_len >= 10) { $school_grade = $this->getRequestParameter('school_grade'); $tags = $this->getRequestParameter('tags'); $arrayoftags = explode(',', $tags); foreach ($arrayoftags as $tag) { if ($tag == 'I') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'a') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'about') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'an') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'are') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'as') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'at') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'be') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'by') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'com') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'de') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'en') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'for') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'from') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'how') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'in') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'is') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'it') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'la') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'of') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'on') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'or') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'that') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'the') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'this') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'to') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'was') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'what') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'when') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'where') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'who') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'will') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'with') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'und') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'the') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } if ($tag == 'www') { $this->msg = $tag . ' is a stop word, please add the proper tag'; return sfView::SUCCESS; } } $thread = $user->makeNewThread($this->getRequestParameter('forum_id'), $this->getRequestParameter('thread_title'), $this->getRequestParameter('post_body'), $this->getRequestParameter('forum_id'), $this->getRequestParameter('notify_email'), $this->getRequestParameter('notify_pm'), $this->getRequestParameter('tags'), $this->getRequestParameter('school_grade'), $this->getRequestParameter('stickie')); $l = new Criteria(); $l->addDescendingOrderByColumn(PostPeer::ID); $l->setLimit(1); $latest = PostPeer::doSelect($l); $stickie = 0; if ($this->getRequestParameter('stickie') == 1) { $stickie = 1; } ///////////////////updating the ip of the user $connection = RaykuCommon::getDatabaseConnection(); mysql_query("update thread set user_ip='" . $_SERVER['REMOTE_ADDR'] . "', stickie = " . $stickie . " where id=" . $latest[0]->getThreadId() . "", $connection); ///////////////////updating the ip of the user return $this->redirect('@view_thread?thread_id=' . $latest[0]->getThreadId()); } else { if ($theard_title_len < 10) { $this->title_error = "Title should be more than 10 characters"; } if ($theard_body_len < 10) { $this->desc_error = "Description should be more than 10 characters"; } } } }