]>
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 $bugsys- > input_clean ( 'languageid' , TYPE_UINT
);
45 $count = $db- > query_first ( "SELECT COUNT(*) AS count FROM " . TABLE_PREFIX
. "language" );
46 if ( $count [ 'count' ] < 2 )
48 $admin- > error ( $lang- > string ( 'At least one language needs to be present. Deleting this language would violate that.' ));
51 if ( $bugsys- > options
[ 'defaultlanguage' ] == $bugsys- > in
[ 'languageid' ])
53 $admin- > error ( $lang- > string ( 'You cannot delete the default language. Please select another language to be the default language and then delete this one.' ));
56 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "language WHERE languageid = " . $bugsys- > in
[ 'languageid' ]);
57 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "localization WHERE languageid = " . $bugsys- > in
[ 'languageid' ]);
59 $admin- > redirect ( 'language.php?do=modify' );
62 // ###################################################################
64 if ( $_REQUEST [ 'do' ] == 'delete' )
66 $admin- > page_confirm ( $lang- > string ( 'Are you sure you want to delete this language?' ), 'language.php?do=kill&languageid=' . $bugsys- > input_clean ( 'languageid' , TYPE_UINT
));
69 // ###################################################################
71 if ( $_POST [ 'do' ] == 'insert' )
73 $languageid = $db- > query ( "
74 INSERT INTO " . TABLE_PREFIX
. "language
75 (title, charset, direction, userselect, debug, filename)
77 ('" . $bugsys- > in
[ 'title' ] . "', '" . $bugsys- > in
[ 'charset' ] . "',
78 '" . $bugsys- > in
[ 'direction' ] . "', " . $bugsys- > input_clean ( 'userselect' , TYPE_UINT
) . ",
79 " . $bugsys- > input_clean ( 'debug' , TYPE_UINT
) . ", '" . $bugsys- > in
[ 'filename' ] . "'
85 build_language_cache ( $db- > insert_id ());
87 $admin- > redirect ( 'language.php?do=modify' );
90 // ###################################################################
92 if ( $_REQUEST [ 'do' ] == 'add' )
94 NavLinks
:: languagesAdd ();
95 $navigator- > set_focus ( 'link' , 'options-languages-add' , 'options-languages' );
97 $admin- > page_start ( $lang- > string ( 'New Language' ));
99 $admin- > form_start ( 'language.php' , 'insert' );
100 $admin- > table_start ();
101 $admin- > table_head ( $lang- > string ( 'New Language' ));
103 $admin- > row_input ( $lang- > string ( 'Title' ), 'title' );
104 $admin- > row_input ( $lang- > string ( 'Character Set' ), 'charset' , 'utf-8' );
105 $admin- > list_item ( $lang- > string ( 'Left-to-Right' ), 'ltr' , true );
106 $admin- > list_item ( $lang- > string ( 'Right-to-Left' ), 'rtl' );
107 $admin- > row_list ( $lang- > string ( 'Direction' ), 'direction' );
108 $admin- > row_input ( $lang- > string ( 'Path to XML' ), 'filename' );
109 $admin- > row_yesno ( $lang- > string ( 'User Selectable' ), 'userselect' , true );
110 $admin- > row_yesno ( $lang- > string ( 'Debug Mode (run directly from XML)' ), 'langdebug' , false );
112 $admin- > row_submit ();
119 // ###################################################################
121 if ( $_POST [ 'do' ] == 'update' )
124 UPDATE " . TABLE_PREFIX
. "language
125 SET title = '" . $bugsys- > in
[ 'title' ] . "',
126 charset = '" . $bugsys- > in
[ 'charset' ] . "',
127 direction = '" . $bugsys- > in
[ 'direction' ] . "',
128 userselect = " . $bugsys- > input_clean ( 'userselect' , TYPE_UINT
) . ",
129 debug = " . $bugsys- > input_clean ( 'langdebug' , TYPE_UINT
) . ",
130 filename = '" . $bugsys- > in
[ 'filename' ] . "'
131 WHERE languageid = " . $bugsys- > input_clean ( 'languageid' , TYPE_UINT
)
136 $admin- > redirect ( 'language.php?do=modify' );
139 // ###################################################################
141 if ( $_REQUEST [ 'do' ] == 'edit' )
143 $bugsys- > input_clean ( 'languageid' , TYPE_UINT
);
145 NavLinks
:: languagesEdit ( $bugsys- > in
[ 'languageid' ]);
146 $navigator- > set_focus ( 'link' , 'options-languages-edit' , 'options-languages' );
148 $language = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "language WHERE languageid = " . $bugsys- > in
[ 'languageid' ]);
151 $admin- > error ( $lang- > getlex ( 'error_invalid_id' ));
154 $admin- > page_start ( $lang- > string ( 'Edit Language' ));
156 $admin- > form_start ( 'language.php' , 'update' );
157 $admin- > table_start ();
158 $admin- > table_head ( sprintf ( $lang- > string ( 'Edit Language - %1 $s' ), $language [' title
']));
160 $admin- >form_hidden_field(' languageid
', $language [' languageid
']);
162 $admin- >row_input( $lang- >string(' Title
'), ' title
', $language [' title
']);
163 $admin- >row_input( $lang- >string(' Character Set
'), ' charset
', $language [' charset
']);
164 $admin- >list_item( $lang- >string(' Left
- to
- Right
'), ' ltr
', (( $language [' direction
'] == ' ltr
') ? true : false));
165 $admin- >list_item( $lang- >string(' Right
- to
- Left
'), ' rtl
', (( $language [' direction
'] == ' rtl
') ? true : false));
166 $admin- >row_list( $lang- >string(' Direction
'), ' direction
');
167 $admin- >row_input( $lang- >string(' Path to XML
'), ' filename
', $language [' filename
']);
168 $admin- >row_yesno( $lang- >string(' User Selectable
'), ' userselect
', $language [' userselect
']);
169 $admin- >row_yesno( $lang- >string(' Debug
Mode ( run directly from XML
) '), ' langdebug
', (bool) $language [' debug
']);
171 $admin- >row_submit();
178 // ###################################################################
180 if ( $_REQUEST [' do '] == ' reload
')
182 $language = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "language WHERE languageid = " . $bugsys- >input_clean(' languageid
', TYPE_UINT));
185 $admin- >error( $lang- >getlex(' error_invalid_id
'));
188 build_language_cache( $language [' languageid
']);
190 $admin- >redirect(' language
. php
? do = modify
');
193 // ###################################################################
195 if ( $_REQUEST [' do '] == ' modify
')
197 NavLinks::languagesAdd();
198 $navigator- >set_focus(' link
', ' options
- pages
- languages
', ' options
- pages
');
200 $admin- >page_start( $lang- >string(' Manage Languages
'));
202 $admin- >table_start();
203 $admin- >table_head( $lang- >string(' Manage Languages
'), 4, ' language_manage
');
205 $admin- >table_column_head(array( $lang- >string(' Title
'), $lang- >string(' Charset
'), $lang- >string(' Options
'), $lang- >string(' Actions
')));
207 $languages = $db- >query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC");
208 while ( $language = $db- >fetch_array( $languages ))
210 $admin- >row_multi_item(array(
211 $language [' title
'] => ' l
',
212 $language [' charset
'] => ' c
',
213 (( $bugsys- >options[' defaultlanguage
'] == $language [' languageid
']) ? ' < strong
> ' . $lang- >string(' DEFAULT LANGUAGE
') . ' </ strong
> / ' : ' ') . ( $language [' userselect
'] ? $lang- >string(' User Selectable
') : $lang- >string(' Private ')) => ' c
',
214 "<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
'
223 /*=====================================================================*\
224 || ###################################################################
227 || ###################################################################
228 \*=====================================================================*/