public function reportCommentAction() { $request = $this->getRequest(); $comment_id = $request->getRequest('comment_id'); $comment_info = new Model_Pins_GetComment($comment_id); if (!$comment_info->count()) { $this->forward('error', 'error404'); } $comment_info = $comment_info->data; $reportcategories = new Model_Pins_CommentReportCategories(); $this->view->reportcategories = $reportcategories->toArray(); $this->view->url_form = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=reportComment&comment_id=' . $comment_id); $this->view->comment_id = $comment_id; $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $comment_info['pin_id']); if ($request->issetPost('report_category')) { $this->view->report_category = $request->getPost('report_category'); } else { if ($this->view->reportcategories) { list($firstKey) = array_keys($this->view->reportcategories); $this->view->report_category = $firstKey; } else { $this->view->report_category = 0; } } $this->view->comment_is = true; $this->view->pin_id = $comment_info['pin_id']; $this->setViewChange('report'); if ($request->isPost()) { $this->view->is_posted = true; if (Model_Pins::commentIsReported($comment_id)) { $this->view->error = $this->translate('You are already reported this comment!'); } else { $result = Model_Pins::reportComment($comment_id, $request->getPost('report_category'), $request->getPost('report_message')); if (!$result) { $this->view->error = $this->translate('Error reporting experience. Try again!'); } else { if (Helper_Config::get('not_rc')) { Model_Email::send(Helper_Config::get('report_mail'), Helper_Config::get('noreply_mail'), $this->translate('New reported comment'), $this->translate('Hello, there is new reported comment in ') . ' ' . Helper_Config::get('site_name')); } $terms = Model_Pages::getPage(Helper_Config::get('page_terms')); if ($terms) { $this->view->terms = $terms['title']; } $this->view->terms_href = WM_Router::create($request->getBaseUrl() . '?controller=about&action=terms'); $this->setViewChange('message_report'); } } } $this->noLayout(true); }
public function reportCommentAction() { $request = $this->getRequest(); $comment_id = $request->getRequest('comment_id'); $comment_info = Model_Pins::getComment($comment_id); if (!$comment_info) { $this->forward('error', 'error404'); } $this->view->reportcategories = Model_Pins::getPinReportCategories(); $this->view->url_form = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=reportComment&comment_id=' . $comment_id); $this->view->comment_id = $comment_id; $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $comment_info['pin_id']); if ($request->issetPost('report_category')) { $this->view->report_category = $request->getPost('report_category'); } else { if ($this->view->reportcategories) { list($firstKey) = array_keys($this->view->reportcategories); $this->view->report_category = $firstKey; } else { $this->view->report_category = 0; } } $this->view->comment_is = true; $this->view->pins_details = $this->view->render('report', 'pin'); if ($request->isPost()) { $this->view->is_posted = true; if (Model_Pins::commentIsReported($comment_id)) { $this->view->error = $this->translate('You are already reported this comment!'); $this->view->pins_details = $this->view->render('report', 'pin'); } else { $result = Model_Pins::reportComment($comment_id, $request->getPost('report_category'), $request->getPost('report_message')); if (!$result) { $this->view->error = $this->translate('Error reporting experience. Try again!'); $this->view->pins_details = $this->view->render('report', 'pin'); } else { if (JO_Registry::get('not_rc')) { Model_Email::send(JO_Registry::get('report_mail'), JO_Registry::get('noreply_mail'), $this->translate('New reported comment'), $this->translate('Hello, there is new reported comment in ') . ' ' . JO_Registry::get('site_name')); } $terms = Model_Pages::getPage(JO_Registry::get('page_terms')); if ($terms) { $this->view->terms = $terms['title']; } $this->view->pin_oppener = $request->getRequest('pin_oppener'); $this->view->terms_href = WM_Router::create($request->getBaseUrl() . '?controller=about&action=terms'); $this->view->pins_details = $this->view->render('message_report', 'pin'); } } } $this->setViewChange('index'); if ($request->isXmlHttpRequest()) { $this->view->popup = true; echo $this->view->pins_details; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'layout/left_part'); } }