91348ec4d450495655c47d612cc9e3515abd3238
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(
26 require_once('./global.php');
27 require_once('./includes/api_language.php');
29 if (!can_perform('canadmintools'))
34 // ###################################################################
36 if (empty($_REQUEST['do']))
38 $_REQUEST['do'] = 'modify';
41 // ###################################################################
43 if ($_REQUEST['do'] == 'kill')
45 $language = new LanguageAPI();
46 $language->set('languageid', $input->in
['languageid']);
47 $language->setCondition();
50 admin_flash_redirect('language.php?do=modify');
53 // ###################################################################
55 if ($_REQUEST['do'] == 'delete')
57 $admin->page_confirm(T('Are you sure you want to delete this language?'), 'language.php', 'kill', array('languageid' => $input->inputClean('languageid', TYPE_UINT
)));
60 // ###################################################################
62 if ($_POST['do'] == 'insert')
64 $language = new LanguageAPI();
65 $language->set('title', $input->in
['title']);
66 $language->set('charset', $input->in
['charset']);
67 $language->set('direction', $input->in
['direction']);
68 $language->set('userselect', $input->in
['userselect']);
69 $language->set('langcode', $input->in
['langcode']);
72 admin_flash_redirect('language.php?do=modify');
75 // ###################################################################
77 if ($_REQUEST['do'] == 'add')
79 BSTemplate
::fetch('language_edit')->evaluate()->flush();
82 // ###################################################################
84 if ($_POST['do'] == 'update')
86 $language = new LanguageAPI();
87 $language->set('languageid', $input->in
['languageid']);
88 $language->setCondition();
89 $language->set('title', $input->in
['title']);
90 $language->set('charset', $input->in
['charset']);
91 $language->set('direction', $input->in
['direction']);
92 $language->set('userselect', $input->in
['userselect']);
93 $language->set('langcode', $input->in
['langcode']);
96 admin_flash_redirect('language.php?do=modify');
99 // ###################################################################
101 if ($_REQUEST['do'] == 'edit')
103 $languageapi = new LanguageAPI();
104 $languageapi->set('languageid', $input->in
['languageid']);
105 $languageapi->setCondition();
106 $languageapi->fetch();
108 $admin = new BSTemplate('language_edit');
109 $admin->vars
['language'] = $language->record
;
110 $admin->evaluate()->flush();
113 // ###################################################################
115 if ($_REQUEST['do'] == 'modify')
117 $admin = new BSTemplate('language');
118 $admin->vars
['languages'] = $db->query("SELECT * FROM " . TABLE_PREFIX
. "language ORDER BY languageid ASC");
119 $admin->evaluate()->flush();