2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2009 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 require_once('./global.php');
23 require_once('./includes/api_userhelp.php');
24 require_once('./includes/functions_datastore.php');
26 if (!can_perform('canadmintools'))
31 // ###################################################################
33 if (empty($_REQUEST['do']))
35 $_REQUEST['do'] = 'modify';
38 // ###################################################################
40 if ($_REQUEST['do'] == 'kill')
42 $help = new UserHelpAPI();
43 $help->set('keystring', $input->in
['keystring']);
48 admin_flash_redirect('userhelp.php?do=modify');
51 // ###################################################################
53 if ($_REQUEST['do'] == 'delete')
55 $admin->page_confirm(T('Are you sure you want to delete help text?'), 'userhelp.php', 'kill', array('keystring' => $input->in
['keystring']));
58 // ###################################################################
60 if ($_POST['do'] == 'insert')
62 $help = new UserHelpAPI();
63 $help->set('keystring', $input->in
['keystring']);
64 $help->set('title', $input->in
['title']);
65 $help->set('body', $input->in
['body']);
68 admin_flash_redirect('userhelp.php?do=modify');
71 // ###################################################################
73 if ($_REQUEST['do'] == 'add')
75 BSTemplate
::fetch('userhelp_add')->evaluate()->flush();
78 // ###################################################################
80 if ($_POST['do'] == 'update')
82 foreach ($input->in
['help'] as $keystring => $fields)
84 $help = new UserHelpAPI();
85 $help->set('keystring', $keystring);
86 $help->set('title', $fields['title']);
87 $help->set('body', $fields['body']);
88 $help->update(true
, false
);
93 admin_flash_redirect('userhelp.php?do=modify');
96 // ###################################################################
98 if ($_REQUEST['do'] == 'modify')
100 $admin = new BSTemplate('userhelp');
101 $admin->vars
['topics'] = $db->query("SELECT * FROM " . TABLE_PREFIX
. "fieldhelp ORDER BY keystring ASC");
102 $admin->evaluate()->flush();