]>
src.bluestatic.org Git - bugdar.git/blob - admin/language.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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 [#]gpl[#] 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/functions_datastore.php' );
25 NavLinks
:: optionsPages ();
26 $navigator- > set_focus ( 'tab' , 'options' , null );
28 if (! can_perform ( 'canadmintools' ))
33 // ###################################################################
35 if ( empty ( $_REQUEST [ 'do' ]))
37 $_REQUEST [ 'do' ] = 'modify' ;
40 // ###################################################################
42 if ( $_REQUEST [ 'do' ] == 'kill' )
44 $count = $db- > query_first ( "SELECT COUNT(*) AS count FROM " . TABLE_PREFIX
. "language" );
45 if ( $count [ 'count' ] < 2 )
47 $admin- > error ( $lang- > string ( 'At least one language needs to be present. Deleting this language would violate that.' ));
50 if ( $bugsys- > options
[ 'defaultlanguage' ] == intval ( $bugsys- > in
[ 'languageid' ]))
52 $admin- > error ( $lang- > string ( 'You cannot delete the default language. Please select another language to be the default language and then delete this one.' ));
55 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "language WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ]));
56 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "localization WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ]));
58 $admin- > redirect ( 'language.php?do=modify' );
61 // ###################################################################
63 if ( $_REQUEST [ 'do' ] == 'delete' )
65 $admin- > page_confirm ( $lang- > string ( 'Are you sure you want to delete this language?' ), 'language.php?do=kill&languageid=' . intval ( $bugsys- > in
[ 'languageid' ]));
68 // ###################################################################
70 if ( $_POST [ 'do' ] == 'insert' )
72 $languageid = $db- > query ( "
73 INSERT INTO " . TABLE_PREFIX
. "language
74 (title, charset, direction, userselect, debug, filename)
76 ('" . $bugsys- > in
[ 'title' ] . "', '" . $bugsys- > in
[ 'charset' ] . "',
77 '" . $bugsys- > in
[ 'direction' ] . "', " . intval ( $bugsys- > in
[ 'userselect' ]) . ",
78 " . intval ( $bugsys- > in
[ 'debug' ]) . ", '" . $bugsys- > in
[ 'filename' ] . "'
84 build_language_cache ( $db- > insert_id ());
86 $admin- > redirect ( 'language.php?do=modify' );
89 // ###################################################################
91 if ( $_REQUEST [ 'do' ] == 'add' )
93 NavLinks
:: languagesAdd ();
94 $navigator- > set_focus ( 'link' , 'options-languages-add' , 'options-languages' );
96 $admin- > page_start ( $lang- > string ( 'New Language' ));
98 $admin- > form_start ( 'language.php' , 'insert' );
99 $admin- > table_start ();
100 $admin- > table_head ( $lang- > string ( 'New Language' ), 2 , 'language_edit' );
102 $admin- > row_input ( $lang- > string ( 'Title' ), 'title' );
103 $admin- > row_input ( $lang- > string ( 'Character Set' ), 'charset' , 'utf-8' );
104 $admin- > list_item ( $lang- > string ( 'Left-to-Right' ), 'ltr' , true );
105 $admin- > list_item ( $lang- > string ( 'Right-to-Left' ), 'rtl' );
106 $admin- > row_list ( $lang- > string ( 'Direction' ), 'direction' );
107 $admin- > row_input ( $lang- > string ( 'Path to XML' ), 'filename' );
108 $admin- > row_yesno ( $lang- > string ( 'User Selectable' ), 'userselect' , true );
109 $admin- > row_yesno ( $lang- > string ( 'Debug Mode (run directly from XML)' ), 'langdebug' , false );
111 $admin- > row_submit ();
118 // ###################################################################
120 if ( $_POST [ 'do' ] == 'update' )
123 UPDATE " . TABLE_PREFIX
. "language
124 SET title = '" . $bugsys- > in
[ 'title' ] . "',
125 charset = '" . $bugsys- > in
[ 'charset' ] . "',
126 direction = '" . $bugsys- > in
[ 'direction' ] . "',
127 userselect = " . intval ( $bugsys- > in
[ 'userselect' ]) . ",
128 debug = " . intval ( $bugsys- > in
[ 'langdebug' ]) . ",
129 filename = '" . $bugsys- > in
[ 'filename' ] . "'
130 WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ])
135 $admin- > redirect ( 'language.php?do=modify' );
138 // ###################################################################
140 if ( $_REQUEST [ 'do' ] == 'edit' )
142 $bugsys- > input_clean ( 'languageid' , TYPE_UINT
);
144 NavLinks
:: languagesEdit ( $bugsys- > in
[ 'languageid' ]);
145 $navigator- > set_focus ( 'link' , 'options-languages-edit' , 'options-languages' );
147 $language = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "language WHERE languageid = " . $bugsys- > in
[ 'languageid' ]);
150 $admin- > error ( $lang- > getlex ( 'error_invalid_id' ));
153 $admin- > page_start ( $lang- > string ( 'Edit Language' ));
155 $admin- > form_start ( 'language.php' , 'update' );
156 $admin- > table_start ();
157 $admin- > table_head ( sprintf ( $lang- > string ( 'Edit Language - %1 $s' ), $language [' title
']), 2, ' language_edit
');
159 $admin- >form_hidden_field(' languageid
', $language [' languageid
']);
161 $admin- >row_input( $lang- >string(' Title
'), ' title
', $language [' title
']);
162 $admin- >row_input( $lang- >string(' Character Set
'), ' charset
', $language [' charset
']);
163 $admin- >list_item( $lang- >string(' Left
- to
- Right
'), ' ltr
', (( $language [' direction
'] == ' ltr
') ? true : false));
164 $admin- >list_item( $lang- >string(' Right
- to
- Left
'), ' rtl
', (( $language [' direction
'] == ' rtl
') ? true : false));
165 $admin- >row_list( $lang- >string(' Direction
'), ' direction
');
166 $admin- >row_input( $lang- >string(' Path to XML
'), ' filename
', $language [' filename
']);
167 $admin- >row_yesno( $lang- >string(' User Selectable
'), ' userselect
', $language [' userselect
']);
168 $admin- >row_yesno( $lang- >string(' Debug
Mode ( run directly from XML
) '), ' langdebug
', (bool) $language [' debug
']);
170 $admin- >row_submit();
177 // ###################################################################
179 if ( $_REQUEST [' do '] == ' reload
')
181 $language = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "language WHERE languageid = " . intval( $bugsys- >in[' languageid
']));
184 $admin- >error( $lang- >getlex(' error_invalid_id
'));
187 build_language_cache( $language [' languageid
']);
189 $admin- >redirect(' language
. php
? do = modify
');
192 // ###################################################################
194 if ( $_REQUEST [' do '] == ' modify
')
196 NavLinks::languagesAdd();
197 $navigator- >set_focus(' link
', ' options
- pages
- languages
', ' options
- pages
');
199 $admin- >page_start( $lang- >string(' Manage Languages
'));
201 $admin- >table_start();
202 $admin- >table_head( $lang- >string(' Manage Languages
'), 4, ' language_manage
');
204 $admin- >table_column_head(array( $lang- >string(' Title
'), $lang- >string(' Charset
'), $lang- >string(' Options
'), $lang- >string(' Actions
')));
206 $languages = $db- >query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC");
207 while ( $language = $db- >fetch_array( $languages ))
209 $admin- >row_multi_item(array(
210 $language [' title
'] => ' l
',
211 $language [' charset
'] => ' c
',
212 (( $bugsys- >options[' defaultlanguage
'] == $language [' languageid
']) ? ' < strong
> ' . $lang- >string(' DEFAULT LANGUAGE
') . ' </ strong
> / ' : ' ') . ( $language [' userselect
'] ? $lang- >string(' User Selectable
') : $lang- >string(' Private ')) => ' c
',
213 "<a href= \" language.php?do=edit&languageid= $language [languageid] \" >[" . $lang- >string(' Edit Settings
') . "]</a> <a href= \" language.php?do=reload&languageid= $language [languageid] \" >[" . $lang- >string(' Reload XML
') . "]</a>" => ' c
'
222 /*=====================================================================*\
223 || ###################################################################
226 || ###################################################################
227 \*=====================================================================*/