-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPollController.php
More file actions
71 lines (60 loc) · 1.89 KB
/
PollController.php
File metadata and controls
71 lines (60 loc) · 1.89 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
* Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
* Copyright (C) 2011 Martijn van der Kleijn <martijn.niji@gmail.com>
*
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/* Security measure */
if (!defined('IN_CMS')) { exit(); }
/**
* The Poll plugin provides an Poll pagetype behaving similar to a blog or news poll.
*
* @package Plugins
* @subpackage poll
*
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @copyright Martijn van der Kleijn, 2011
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
/**
*
*/
class PollController extends PluginController {
public function __construct() {
$this->setLayout('backend');
$this->assignToLayout('sidebar', new View('../../plugins/poll/views/sidebar'));
}
public function index() {
$this->settings();
}
/*
public function documentation() {
$this->display('skeleton/views/documentation');
}
*
*/
function settings() {
$this->display('poll/views/settings', array('settings' => Plugin::getAllSettings('poll')));
}
function save() {
if (isset($_POST['settings'])) {
$settings = $_POST['settings'];
foreach ($settings as $key => $value) {
$settings[$key] = mysql_escape_string($value);
}
$ret = Plugin::setAllSettings($settings, 'poll');
if ($ret) {
Flash::set('success', __('The settings have been saved.'));
}
else {
Flash::set('error', 'An error occured trying to save the settings.');
}
}
else {
Flash::set('error', 'Could not save settings, no settings found.');
}
redirect(get_url('plugin/poll/settings'));
}
}