]>
src.bluestatic.org Git - bugdar.git/blob - settings.php
eb351781ad65d6034e4d6e48be34127c5f14a83c
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/rest_action.php';
28 require_once BUGDAR_ROOT
. '/includes/functions_datastore.php';
30 class SettingsAction
extends http\RestAction
implements TemplatePreCaching
32 public function TemplateSet()
34 return ['admin_settings'];
37 public function DoGet(http\Request
$request, http\Response
$response)
39 // TODO(port): global.
42 $response->data
['title'] = T('Settings');
43 $response->context
['template'] = 'admin_settings';
45 $response->data
['timezone_list'] = $bugsys->datef
->fetch_timezone_list();
48 public function DoPost(http\Request
$request, http\Response
$response)
50 $query_bits = array();
52 foreach ($request->data
['_POST']['settings'] AS $varname => $value) {
53 $query_bits[] = '(?,?)';
54 array_push($values, $varname, $value);
57 $query = bugdar
::$db->Prepare("
58 REPLACE into " . TABLE_PREFIX
. "setting
60 VALUES " . implode(', ', $query_bits));
61 $query->Execute($values);
65 $this->controller()->StopWithRedirect($this->controller()->MakeURL('/settings'));