-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathstrings.php
40 lines (31 loc) · 1.15 KB
/
strings.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
<?php
class Strings_Controller extends Controller
{
public function viewAction($key)
{
$edited = null;
if ($this->router->method == Router::POST) {
$newvalue = $this->inputs->post('newvalue', null);
$key = $this->inputs->post('key', null);
if (!isset($newvalue) || trim($newvalue) == '' || !isset($key) || trim($key) == '') {
$edited = false;
} else {
$edited = $this->db->set($key, $newvalue);
}
}
$value = $this->db->get(urldecode($key));
Template::factory()->render('strings/view', array('edited' => $edited, 'key' => urldecode($key), 'value' => $value));
}
public function addAction()
{
$added = false;
if ($this->router->method == Router::POST) {
$value = $this->inputs->post('value', null);
$key = $this->inputs->post('key', null);
if (isset($value) && trim($value) != '' && isset($key) && trim($key) != '') {
$added = $this->db->set($key, $value);
}
}
Template::factory('json')->render($added);
}
}