Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper almost 11 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

index.php
20 20
//Workaround if this is first page (WBAdmin in use)
21 21

  
22 22
// put all inside a function to prevent global vars
23
function build_page( &$admin, &$database )
23
function build_page( admin $admin )
24 24
{
25
//	global $HEADING, $TEXT;
26
    $mLang = Translate::getInstance();
27
	$oReg  = WbAdaptor::getInstance();
25
	$oReg   = WbAdaptor::getInstance();
26
    $oDb    = WbDatabase::getInstance();
27
    $oTrans = Translate::getInstance();
28
	$oTrans->enableAddon('admin\\preferences');
28 29
	include_once(WB_PATH.'/framework/functions-utf8.php');
29 30
	// Setup template object, parse vars to it, then parse it
30 31
	// Setup template object, parse vars to it, then parse it
......
32 33
	$template = new Template(dirname($admin->correct_theme_source('preferences.htt')));
33 34
	$template->set_file( 'page', 'preferences.htt' );
34 35
	$template->set_block( 'page', 'main_block', 'main' );
35
	$mLang = Translate::getInstance();
36
//	$mLang->enableAddon('admin\preferences');
37
	$template->set_var($mLang->getLangArray());
36
	$template->set_var($oTrans->getLangArray());
38 37

  
39 38
// read user-info from table users and assign it to template
40
	$sql  = 'SELECT `display_name`, `username`, `email` FROM `'.TABLE_PREFIX.'users` ';
39
	$sql  = 'SELECT `display_name`, `username`, `email` FROM `'.$oDb->TablePrefix.'users` ';
41 40
	$sql .= 'WHERE `user_id` = '.(int)$admin->get_user_id();
42
	if( $res_user = $database->query($sql) )
43
	{
44
		if( $rec_user = $res_user->fetchRow() )
45
		{
41
	if (($res_user = $oDb->doQuery($sql))) {
42
		if (($rec_user = $res_user->fetchRow(MYSQL_ASSOC))) {
46 43
			$template->set_var('DISPLAY_NAME', $rec_user['display_name']);
47 44
			$template->set_var('USERNAME',     $rec_user['username']);
48 45
			$template->set_var('EMAIL',        $rec_user['email']);
......
159 156
// Parse template for preferences form
160 157
	$template->parse('main', 'main_block', false);
161 158
	$output = $template->finish($template->parse('output', 'page'));
162
	$mLang->disableAddon();
163 159

  
164 160
	return $output;
165 161
}
......
167 163
if( !(isset($admin) && is_object($admin) && (get_class($admin) == 'admin')) )
168 164
{
169 165
    require( '../../config.php' );
170
	require_once( WB_PATH.'/framework/class.admin.php' );
171 166
	$admin = new admin('Preferences');
172 167
}
173
echo build_page($admin, $database);
168
echo build_page($admin);
174 169
$admin->print_footer();

Also available in: Unified diff