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 $fetchtemplates = array(
27 require_once('./global.php');
28 require_once('./includes/api_userhelp.php');
29 require_once('./includes/functions_datastore.php');
31 if (!can_perform('canadmintools'))
36 // ###################################################################
38 if (empty($_REQUEST['do']))
40 $_REQUEST['do'] = 'modify';
43 // ###################################################################
45 if ($_REQUEST['do'] == 'kill')
47 $help = new UserHelpAPI();
48 $help->set('keystring', $input->in
['keystring']);
53 admin_flash_redirect('userhelp.php?do=modify');
56 // ###################################################################
58 if ($_REQUEST['do'] == 'delete')
60 $admin->page_confirm(T('Are you sure you want to delete help text?'), 'userhelp.php', 'kill', array('keystring' => $input->in
['keystring']));
63 // ###################################################################
65 if ($_POST['do'] == 'insert')
67 $help = new UserHelpAPI();
68 $help->set('keystring', $input->in
['keystring']);
69 $help->set('title', $input->in
['title']);
70 $help->set('body', $input->in
['body']);
73 admin_flash_redirect('userhelp.php?do=modify');
76 // ###################################################################
78 if ($_REQUEST['do'] == 'add')
80 BSTemplate
::fetch('userhelp_add')->evaluate()->flush();
83 // ###################################################################
85 if ($_POST['do'] == 'update')
87 foreach ($input->in
['help'] as $keystring => $fields)
89 $help = new UserHelpAPI();
90 $help->set('keystring', $keystring);
91 $help->set('title', $fields['title']);
92 $help->set('body', $fields['body']);
93 $help->update(true
, false
);
98 admin_flash_redirect('userhelp.php?do=modify');
101 // ###################################################################
103 if ($_REQUEST['do'] == 'modify')
105 $admin = new BSTemplate('userhelp');
106 $admin->vars
['topics'] = $db->query("SELECT * FROM " . TABLE_PREFIX
. "fieldhelp ORDER BY keystring ASC");
107 $admin->evaluate()->flush();