]>
src.bluestatic.org Git - bugdar.git/blob - admin/language.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 require_once ( './global.php' );
14 require_once ( './includes/functions_datastore.php' );
16 if (! can_perform ( 'canadmintools' ))
21 // ###################################################################
23 if ( empty ( $_REQUEST [ 'do' ]))
25 $_REQUEST [ 'do' ] = 'modify' ;
28 // ###################################################################
30 if ( $_REQUEST [ 'do' ] == 'kill' )
32 $count = $db- > query_first ( "SELECT COUNT(*) AS count FROM " . TABLE_PREFIX
. "language" );
33 if ( $count [ 'count' ] < 2 )
35 $admin- > error ( $lang- > string ( 'At least one language needs to be present. Deleting this language would violate that.' ));
38 if ( $bugsys- > options
[ 'defaultlanguage' ] == intval ( $bugsys- > in
[ 'languageid' ]))
40 $admin- > error ( $lang- > string ( 'You cannot delete the default language. Please select another language to be the default language and then delete this one.' ));
43 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "language WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ]));
44 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "localization WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ]));
46 $admin- > redirect ( 'language.php?do=modify' );
49 // ###################################################################
51 if ( $_REQUEST [ 'do' ] == 'delete' )
53 $admin- > page_confirm ( $lang- > string ( 'Are you sure you want to delete this language?' ), 'language.php?do=kill&languageid=' . intval ( $bugsys- > in
[ 'languageid' ]));
56 // ###################################################################
58 if ( $_POST [ 'do' ] == 'insert' )
60 $languageid = $db- > query ( "
61 INSERT INTO " . TABLE_PREFIX
. "language
62 (title, charset, direction, userselect, debug, filename)
64 ('" . $bugsys- > in
[ 'title' ] . "', '" . $bugsys- > in
[ 'charset' ] . "',
65 '" . $bugsys- > in
[ 'direction' ] . "', " . intval ( $bugsys- > in
[ 'userselect' ]) . ",
66 " . intval ( $bugsys- > in
[ 'debug' ]) . ", '" . $bugsys- > in
[ 'filename' ] . "'
72 build_language_cache ( $db- > insert_id ());
74 $admin- > redirect ( 'language.php?do=modify' );
77 // ###################################################################
79 if ( $_REQUEST [ 'do' ] == 'add' )
81 $admin- > page_start ( $lang- > string ( 'New Language' ));
83 $admin- > form_start ( 'language.php' , 'insert' );
84 $admin- > table_start ();
85 $admin- > table_head ( $lang- > string ( 'New Language' ), 2 , 'language_edit' );
87 $admin- > row_input ( $lang- > string ( 'Title' ), 'title' );
88 $admin- > row_input ( $lang- > string ( 'Character Set' ), 'charset' , 'utf-8' );
89 $admin- > list_item ( $lang- > string ( 'Left-to-Right' ), 'ltr' , true );
90 $admin- > list_item ( $lang- > string ( 'Right-to-Left' ), 'rtl' );
91 $admin- > row_list ( $lang- > string ( 'Direction' ), 'direction' );
92 $admin- > row_input ( $lang- > string ( 'Path to XML' ), 'filename' );
93 $admin- > row_yesno ( $lang- > string ( 'User Selectable' ), 'userselect' , true );
94 $admin- > row_yesno ( $lang- > string ( 'Debug Mode (run directly from XML)' ), 'langdebug' , false );
103 // ###################################################################
105 if ( $_POST [ 'do' ] == 'update' )
108 UPDATE " . TABLE_PREFIX
. "language
109 SET title = '" . $bugsys- > in
[ 'title' ] . "',
110 charset = '" . $bugsys- > in
[ 'charset' ] . "',
111 direction = '" . $bugsys- > in
[ 'direction' ] . "',
112 userselect = " . intval ( $bugsys- > in
[ 'userselect' ]) . ",
113 debug = " . intval ( $bugsys- > in
[ 'langdebug' ]) . ",
114 filename = '" . $bugsys- > in
[ 'filename' ] . "'
115 WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ])
120 $admin- > redirect ( 'language.php?do=modify' );
123 // ###################################################################
125 if ( $_REQUEST [ 'do' ] == 'edit' )
127 $language = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "language WHERE languageid = " . intval ( $bugsys- > in
[ 'languageid' ]));
130 $admin- > error ( $lang- > getlex ( 'error_invalid_id' ));
133 $admin- > page_start ( $lang- > string ( 'Edit Language' ));
135 $admin- > form_start ( 'language.php' , 'update' );
136 $admin- > table_start ();
137 $admin- > table_head ( sprintf ( $lang- > string ( 'Edit Language - %1 $s' ), $language [' title
']), 2, ' language_edit
');
139 $admin- >form_hidden_field(' languageid
', $language [' languageid
']);
141 $admin- >row_input( $lang- >string(' Title
'), ' title
', $language [' title
']);
142 $admin- >row_input( $lang- >string(' Character Set
'), ' charset
', $language [' charset
']);
143 $admin- >list_item( $lang- >string(' Left
- to
- Right
'), ' ltr
', (( $language [' direction
'] == ' ltr
') ? true : false));
144 $admin- >list_item( $lang- >string(' Right
- to
- Left
'), ' rtl
', (( $language [' direction
'] == ' rtl
') ? true : false));
145 $admin- >row_list( $lang- >string(' Direction
'), ' direction
');
146 $admin- >row_input( $lang- >string(' Path to XML
'), ' filename
', $language [' filename
']);
147 $admin- >row_yesno( $lang- >string(' User Selectable
'), ' userselect
', $language [' userselect
']);
148 $admin- >row_yesno( $lang- >string(' Debug
Mode ( run directly from XML
) '), ' langdebug
', (bool) $language [' debug
']);
150 $admin- >row_submit(' < a href
= "language.php?do=delete&languageid=' . $language ['languageid'] . '" >[ ' . $lang- >string(' Delete
') . ' ]</ a
> ');
157 // ###################################################################
159 if ( $_REQUEST [' do '] == ' reload
')
161 $language = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "language WHERE languageid = " . intval( $bugsys- >in[' languageid
']));
164 $admin- >error( $lang- >getlex(' error_invalid_id
'));
167 build_language_cache( $language [' languageid
']);
169 $admin- >redirect(' language
. php
? do = modify
');
172 // ###################################################################
174 if ( $_REQUEST [' do '] == ' modify
')
176 $admin- >page_start( $lang- >string(' Manage Languages
'));
178 $admin- >table_start();
179 $admin- >table_head( $lang- >string(' Manage Languages
'), 4, ' language_manage
');
181 $admin- >table_column_head(array( $lang- >string(' Title
'), $lang- >string(' Charset
'), $lang- >string(' Options
'), $lang- >string(' Actions
')));
183 $languages = $db- >query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC");
184 while ( $language = $db- >fetch_array( $languages ))
186 $admin- >row_multi_item(array(
187 $language [' title
'] => ' l
',
188 $language [' charset
'] => ' c
',
189 (( $bugsys- >options[' defaultlanguage
'] == $language [' languageid
']) ? ' < strong
> ' . $lang- >string(' DEFAULT LANGUAGE
') . ' </ strong
> / ' : ' ') . ( $language [' userselect
'] ? $lang- >string(' User Selectable
') : $lang- >string(' Private ')) => ' c
',
190 "<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
'
194 $admin- >row_span(' < a href
= "language.php?do=add" >[ ' . $lang- >string(' Add
New Language
') . ' ]</ a
> ', ' tfoot
', ' center
', 4);
200 /*=====================================================================*\
201 || ###################################################################
204 || ###################################################################
205 \*=====================================================================*/