Пример #1
0
 function actionViewForum()
 {
     // Retrieve one forum with all subjects
     $forumLogic = new ForumsLogic();
     $forum = $forumLogic->retrieveForumById($_GET['id']);
     if (isset($_GET['from']) && is_numeric($_GET['from'])) {
         $forum->loadSubjects($_GET['from']);
     } else {
         $forum->loadSubjects();
     }
     // Assign variables to the template
     $this->actionTpl->assign('user', $this->user);
     $this->actionTpl->assign('forum', $forum);
     $this->actionTpl->assign('posts', $forum->subjects);
     $content = $this->actionTpl->fetch('templates/forums.list.subjects.tpl');
     $menus = ' » ' . '' . $forum->name . '';
     // Display the action template into the master template
     $this->display(new Page($content, $forum->name, $menus));
 }
Пример #2
0
 function actionDelPost()
 {
     if (isset($_GET['idPost'])) {
         $postlogic = new PostsLogic();
         $post = $postlogic->retrievePostById($_GET['idPost']);
         if ($post != null) {
             $forumLogic = new ForumsLogic();
             $forum = $forumLogic->retrieveForumById($post->idForum);
             if ($this->user->rightslevel >= LEVEL_MODERATOR) {
                 if ($post->idPostParent != null) {
                     $postParent = $postlogic->retrievePostById($post->idPostParent);
                     $postParent->nbAnswers--;
                 }
                 $forum->nbPosts -= 1;
                 $post->delete();
                 $menus = ' » ' . '<a class="fff_link1" href="forums.php?do=viewForum&amp;id=' . $forum->id . '">' . $forum->name . '</a>' . ' » ' . t('posts.delmessage');
                 // affiche l'opération a été effectuée
                 $this->actionTpl->assign('post', $post);
                 $content = new page($this->actionTpl->fetch('templates/posts.del.tpl'), t('posts.messagedeleted'), $menus);
                 $this->display($content);
                 return;
             } else {
                 $this->errorActionNotAllowed();
                 return;
             }
         } else {
             $this->errorRequete();
             return;
         }
     } else {
         $this->errorRequete();
         return;
     }
 }
Пример #3
0
 function actionDelForum()
 {
     $forumLogic = new ForumsLogic();
     $forum = $forumLogic->retrieveForumById($_GET['idforum']);
     $forum->delete();
     $this->forward('manageForums');
     return;
 }