Project

General

Profile

« Previous | Next » 

Revision 1986

Added by Dietmar about 11 years ago

! If the advanced option languages ​​Page was disabled or pages exist with one language only,
then all available languages ​​are shown to be selected in the User-Settings implemented in backend

View differences:

index.php
23 23
function build_page( &$admin, &$database )
24 24
{
25 25
//	global $HEADING, $TEXT;
26
    $mLang = Translate::getinstance();
27
	$oReg  = WbAdaptor::getInstance();
26 28
	include_once(WB_PATH.'/framework/functions-utf8.php');
27 29
	// Setup template object, parse vars to it, then parse it
28 30
	// Setup template object, parse vars to it, then parse it
......
67 69
$aLangAddons = array();
68 70
$aLangBrowser = array();
69 71

  
70
// read available languages from table addons
71
$sql  = 'SELECT * FROM `'.TABLE_PREFIX.'addons` ';
72
$sql .= 'WHERE `type` = \'language\' ORDER BY `directory`';
73
if( $oLang = $database->query($sql) )
74
{
75
    while( $aLang = $oLang->fetchRow(MYSQL_ASSOC) )
76
    {
77
        $aLangAddons[$aLang['directory']] = $aLang['name'];
78
    }
79
}
80 72

  
81 73
// default, if no information from client available
82 74
$sAutoLanguage = DEFAULT_LANGUAGE;
75
// read available languages from table addons
76
$aLangAddons = $admin->getAvailableLanguages();
83 77

  
84
$aLangUsed = array_flip(explode(',',$admin->GetLanguagesInUsed()));
78
$aLangUsed = array_flip(explode(',',$admin->getLanguagesInUsed()));
85 79
$aLangUsed = array_intersect_key($aLangAddons, $aLangUsed);
80
if( (sizeof($aLangUsed)<2) || !($oReg->PageLanguages) ){
81
    $aLangUsed =  $aLangAddons;    
82
}
86 83
$template->set_block('main_block', 'language_list_block', 'language_list');
87 84
foreach( $aLangUsed as $sDirectory => $sName  )
88 85
{

Also available in: Unified diff