d2a4cb764b67f7daef3caa109e93eb734128bc30
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2002-2013 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 namespace bugdar
\admin
;
27 require_once HOPLITE_ROOT
. '/http/action.php';
28 require_once BUGDAR_ROOT
. '/includes/functions_datastore.php';
30 class SettingsAction
extends http\Action
implements TemplatePreCaching
32 public function TemplateSet()
34 return array('admin_settings');
37 public function Invoke(http\Request
$request, http\Response
$response)
39 $response->data
['title'] = T('Settings');
40 $response->context
['template'] = 'admin_settings';
42 // Save settings on POST.
43 if ($request->http_method
== 'POST') {
44 $query_bits = array();
46 foreach ($request->data
['_POST']['settings'] AS $varname => $value) {
47 $query_bits[] = '(?,?)';
48 array_push($values, $varname, $value);
51 $query = bugdar
::$db->Prepare("
52 REPLACE into " . TABLE_PREFIX
. "setting
54 VALUES " . implode(', ', $query_bits));
55 $query->Execute($values);
59 $this->controller()->StopWithRedirect($this->controller()->MakeURL('/settings'));