forked from rapid7/hackazon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Faq.php
44 lines (36 loc) · 1.34 KB
/
Faq.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace App\Controller;
use VulnModule\Config\Annotations as Vuln;
use App\Page;
/**
* Class Faq
* @property \App\Model\Faq $model
* @package App\Controller
*/
class Faq extends Page
{
/**
* @throws \App\Exception\HttpException
* @Vuln\Description("View: pages/faq. Or AJAX action.")
*/
public function action_index() {
$this->view->pageTitle = "Frequently Asked Questions";
if ($this->request->is_ajax()) {
$this->checkCsrfToken('faq', null, !$this->request->is_ajax());
$post = $this->request->postWrap();
$item = $this->pixie->orm->get('Faq')->create($post);
$this->pixie->session->flash('success', 'Thank you for your question. We will contact you as soon.');
$this->response->body = json_encode(array($item->as_array()));
$this->execute = false;
return;
}
$service = $this->pixie->vulnService;
$this->view->subview = 'pages/faq';
$entries = $this->model->getEntries()->as_array();
foreach ($entries as $key => $entry) {
$entry->question = $service->wrapValueByPath($entry->question, 'default->faq->index|userQuestion:any|0', true);
$entries[$key] = $entry;
}
$this->view->entries = $entries;
}
}