Revision 1987
Added by Dietmar about 11 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
11 | 11 |
! = Update/Change |
12 | 12 |
=============================================================================== |
13 | 13 |
|
14 |
19 Oct-2013 Build 1987 Dietmar Woellbrink (Luisehahne) |
|
15 |
! see Build 1986 |
|
16 |
also implemented in frontend account |
|
14 | 17 |
19 Oct-2013 Build 1986 Dietmar Woellbrink (Luisehahne) |
15 | 18 |
! If the advanced option languages Page was disabled or pages exist with one language only, |
16 | 19 |
then all available languages are shown to be selected in the User-Settings implemented in backend |
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3'); |
54 |
if(!defined('REVISION')) define('REVISION', '1986');
|
|
54 |
if(!defined('REVISION')) define('REVISION', '1987');
|
|
55 | 55 |
if(!defined('SP')) define('SP', ''); |
branches/2.8.x/wb/account/htt/preferences.htt | ||
---|---|---|
11 | 11 |
<div class="details"> |
12 | 12 |
<h3>{HEADING_MY_SETTINGS}</h3> |
13 | 13 |
<form name="details" action="{ACTION_URL}" method="post"> |
14 |
<input type="hidden" name="redirect" value="{HTTP_REFERER}" />
|
|
14 |
<input type="hidden" name="redirect" value="{REFERER_ID}" />
|
|
15 | 15 |
<table> |
16 | 16 |
<tr> |
17 | 17 |
<td>{TEXT_DISPLAY_NAME}:</td> |
... | ... | |
70 | 70 |
<button class="error" type="reset" name="reset" value="reset">{TEXT_RESET}</button> |
71 | 71 |
<button type="submit" name="action" value="details">{MOD_PREFERENCE_SAVE_SETTINGS}</button> |
72 | 72 |
<!-- END show_detail_send_block --> |
73 |
<button type="button" value="cancel" onclick="javascript:window.location='{HTTP_REFERER}';">{TEXT_CANCEL}</button>
|
|
73 |
<button type="{SUBMIT_BUTTON}" name="action" value="{VALUE_BUTTON}" onclick="javascript:window.location='{HTTP_REFERER}';">{TEXT_CANCEL}</button>
|
|
74 | 74 |
</td> |
75 | 75 |
</tr> |
76 | 76 |
</table> |
branches/2.8.x/wb/account/languages/EN.php | ||
---|---|---|
30 | 30 |
'SAVE_EMAIL' => 'save email', |
31 | 31 |
'SAVE_PASSWORD' => 'save password', |
32 | 32 |
'SAVE_LANGUAGE' => 'Switch language', |
33 |
'SET_PREFERENCES_LANGUAGE' => 'Settings are possible only in your linguistic setting! You first have to change the language and start the settings anew!',
|
|
33 |
'SET_PREFERENCES_LANGUAGE' => 'For your language, there is no valid pages. Please select a valid language and switch to this language!',
|
|
34 | 34 |
); |
35 | 35 |
$TEXT['USERNAME'] = 'Loginname'; |
36 | 36 |
$HEADING['SIGNUP2_CONFIMED_REGISTRATION'] = 'Unlock account'; |
branches/2.8.x/wb/account/languages/DE.php | ||
---|---|---|
33 | 33 |
'SAVE_EMAIL' => 'Email speichern', |
34 | 34 |
'SAVE_PASSWORD' => 'Passwort speichern', |
35 | 35 |
'SAVE_LANGUAGE' => 'Sprache wechseln', |
36 |
'SET_PREFERENCES_LANGUAGE' => 'Einstellungen sind nur in Ihrer Spracheinstellung möglich! Sie müssen zuerst die Sprache wechseln und die Einstellungen neu aufrufen!',
|
|
36 |
'SET_PREFERENCES_LANGUAGE' => 'Für deine Sprache existiert keine gültige Seite. Bitte wähle eine gültige Sprache aus und wechsele zu dieser Sprache!!',
|
|
37 | 37 |
); |
38 | 38 |
|
39 | 39 |
$HEADING['SIGNUP2_CONFIMED_REGISTRATION'] = 'Kontofreischaltung'; |
branches/2.8.x/wb/account/preferences_form.php | ||
---|---|---|
23 | 23 |
} |
24 | 24 |
/* -------------------------------------------------------- */ |
25 | 25 |
|
26 |
$oReg = WbAdaptor::getInstance(); |
|
27 |
$mLang = Translate::getinstance(); |
|
28 |
|
|
26 | 29 |
if($wb->is_authenticated() === false) { |
27 | 30 |
// User needs to login first |
28 | 31 |
header("Location: ".WB_URL."/account/login.php?redirect=".$wb->link); |
... | ... | |
46 | 49 |
$sLanguage = LANGUAGE.'.php'; |
47 | 50 |
|
48 | 51 |
$LanguageDir = WB_PATH .'/account/languages/'; |
49 |
|
|
50 | 52 |
$sLanguageFile = ( file_exists($LanguageDir.$sUserLanguage.'.php') ? $LanguageDir.$sUserLanguage.'.php' : $LanguageDir.$sLanguage); |
51 | 53 |
$sLanguageFile = ( is_readable($sLanguageFile) ? $sLanguageFile : $LanguageDir.$sDefaultLanguage.'.php' ); |
52 | 54 |
// load module default language file (EN) |
... | ... | |
85 | 87 |
default: |
86 | 88 |
// do nothing |
87 | 89 |
endswitch; // switch |
88 |
// require(dirname(__FILE__).'/save_preferences.php'); |
|
90 |
|
|
89 | 91 |
// get existing values from database |
90 | 92 |
$sql = "SELECT `display_name`,`email`,`language`,`timezone`,`date_format`,`time_format` "; |
91 | 93 |
$sql .= "FROM `".TABLE_PREFIX."users` "; |
... | ... | |
111 | 113 |
$template->set_block('main_block', 'show_email_send_block', 'show_email_send'); |
112 | 114 |
$template->set_block('main_block', 'show_password_send_block', 'show_password_send'); |
113 | 115 |
|
114 |
if(($sUserLanguage != LANGUAGE) ) { |
|
116 |
$aLangAddons = array(); |
|
117 |
$aLangBrowser = array(); |
|
118 |
// default, if no information from client available |
|
119 |
$sAutoLanguage = DEFAULT_LANGUAGE; |
|
120 |
|
|
121 |
// read available languages from table addons |
|
122 |
$aLangAddons = $admin->getAvailableLanguages(); |
|
123 |
|
|
124 |
$aLangUsed = array_flip(explode(',',$wb->getLanguagesInUsed())); |
|
125 |
$aLangUsed = array_intersect_key($aLangAddons, $aLangUsed); |
|
126 |
if( (sizeof($aLangUsed)<2) || !($oReg->PageLanguages) ){ |
|
127 |
$aLangUsed = $aLangAddons; |
|
128 |
} |
|
129 |
|
|
130 |
if( !(array_key_exists($sUserLanguage, $aLangUsed)) ) { |
|
115 | 131 |
$template->parse('show_detail_send', ''); |
116 | 132 |
$template->parse('show_email_send', ''); |
117 | 133 |
$template->parse('show_password_send', ''); |
... | ... | |
122 | 138 |
} |
123 | 139 |
|
124 | 140 |
// Insert language text and messages visibilty="hidden" |
141 |
// WB_URL.'/account/preferences.php' |
|
125 | 142 |
$template->set_var(array( |
126 |
'HTTP_REFERER' => ( $wb->get_session('HTTP_REFERER')!='' ? $_SESSION['HTTP_REFERER'] : WB_URL), |
|
143 |
'REFERER_ID' => ( $wb->get_session('HTTP_REFERER')!='' ? $_SESSION['HTTP_REFERER'] : WB_URL), |
|
144 |
'HTTP_REFERER' => (!(array_key_exists($sUserLanguage, $aLangUsed)) ?WB_URL.'/account/preferences.php':( $wb->get_session('HTTP_REFERER')!='' ? $_SESSION['HTTP_REFERER'] : WB_URL)), |
|
127 | 145 |
'CSS_BLOCK' => $sIncludeHeadLinkCss, |
128 | 146 |
'TEXT_SAVE' => $TEXT['SAVE'], |
129 | 147 |
'TEXT_RESET' => $TEXT['RESET'], |
130 |
'TEXT_CANCEL' => ($sUserLanguage!=LANGUAGE) ? $MOD_PREFERENCE['SAVE_LANGUAGE']:$TEXT['CANCEL'], |
|
131 |
'MOD_PREFERENCE_SET_PREFERENCES_LANGUAGE' => ($sUserLanguage!=LANGUAGE) ? $MOD_PREFERENCE['SET_PREFERENCES_LANGUAGE']:'', |
|
132 |
'DISPLAY_PREFERENCES_LANGUAGE' => ($sUserLanguage!=LANGUAGE) ? '':'display:none', |
|
148 |
'SUBMIT_BUTTON' => (!(array_key_exists($sUserLanguage, $aLangUsed)) ?'submit':'button'), |
|
149 |
'VALUE_BUTTON' => (!(array_key_exists($sUserLanguage, $aLangUsed)) ?'details':'cancel'), |
|
150 |
'TEXT_CANCEL' => (!(array_key_exists($sUserLanguage, $aLangUsed)) ? $MOD_PREFERENCE['SAVE_LANGUAGE']:$TEXT['CANCEL']), |
|
151 |
'MOD_PREFERENCE_SET_PREFERENCES_LANGUAGE' => !(array_key_exists($sUserLanguage, $aLangUsed)) ? $MOD_PREFERENCE['SET_PREFERENCES_LANGUAGE']:'', |
|
152 |
'DISPLAY_PREFERENCES_LANGUAGE' => !(array_key_exists($sUserLanguage, $aLangUsed)) ? '':'display:none', |
|
133 | 153 |
'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'], |
134 | 154 |
'TEXT_EMAIL' => $TEXT['EMAIL'], |
135 | 155 |
'TEXT_LANGUAGE' => $TEXT['LANGUAGE'], |
... | ... | |
142 | 162 |
) |
143 | 163 |
); |
144 | 164 |
|
145 |
$aLangAddons = array(); |
|
146 |
$aLangBrowser = array(); |
|
147 |
|
|
148 |
// read available languages from table addons |
|
149 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '; |
|
150 |
$sql .= 'WHERE `type` = \'language\' ORDER BY `directory`'; |
|
151 |
if( $oLang = $database->query($sql) ) |
|
152 |
{ |
|
153 |
while( $aLang = $oLang->fetchRow(MYSQL_ASSOC) ) |
|
154 |
{ |
|
155 |
$aLangAddons[$aLang['directory']] = $aLang['name']; |
|
156 |
} |
|
157 |
} |
|
158 |
|
|
159 |
// default, if no information from client available |
|
160 |
$sAutoLanguage = DEFAULT_LANGUAGE; |
|
161 |
|
|
162 |
//$sAutoLanguage = 'FR'; |
|
163 |
$aLangUsed = array_flip(explode(',',$wb->GetLanguagesInUsed())); |
|
164 |
$aLangUsed = array_intersect_key($aLangAddons, $aLangUsed); |
|
165 |
//$sAutoLanguage = array_key_exists($sAutoLanguage,$aLangUsed) ? $sAutoLanguage : DEFAULT_LANGUAGE; |
|
166 |
|
|
167 | 165 |
// read available languages from table addons and assign it to the template |
168 | 166 |
$template->set_block('main_block', 'language_list_block', 'language_list'); |
169 | 167 |
foreach( $aLangUsed as $sDirectory => $sName ) |
branches/2.8.x/wb/account/signup_form.php | ||
---|---|---|
49 | 49 |
if($_SESSION['display_form']) |
50 | 50 |
{ |
51 | 51 |
|
52 |
$sIncludeHeadLinkCss = ''; |
|
53 |
if( is_readable(WB_PATH .'/account/frontend.css')) { |
|
54 |
$sIncludeHeadLinkCss .= '<link href="'.WB_URL.'/account/frontend.css"'; |
|
55 |
$sIncludeHeadLinkCss .= ' rel="stylesheet" type="text/css" media="screen" />'."\n"; |
|
56 |
} |
|
52 |
$sIncludeHeadLinkCss = '';
|
|
53 |
if( is_readable(WB_PATH .'/account/frontend.css')) {
|
|
54 |
$sIncludeHeadLinkCss .= '<link href="'.WB_URL.'/account/frontend.css"';
|
|
55 |
$sIncludeHeadLinkCss .= ' rel="stylesheet" type="text/css" media="screen" />'."\n";
|
|
56 |
}
|
|
57 | 57 |
|
58 | 58 |
// set template file and assign module and template block |
59 | 59 |
$oTpl = new Template(dirname(__FILE__).'/htt','keep'); |
... | ... | |
121 | 121 |
); |
122 | 122 |
|
123 | 123 |
|
124 |
$aLangAddons = array(); |
|
125 |
$aLangBrowser = array(); |
|
124 |
$aLangAddons = array();
|
|
125 |
$aLangBrowser = array();
|
|
126 | 126 |
// read available languages from table addons |
127 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` '; |
|
128 |
$sql .= 'WHERE `type` = \'language\' ORDER BY `directory`'; |
|
129 |
if( $oLang = $database->query($sql) ) |
|
130 |
{ |
|
131 |
while( $aLang = $oLang->fetchRow(MYSQL_ASSOC) ) |
|
132 |
{ |
|
133 |
$aLangAddons[$aLang['directory']] = $aLang['name']; |
|
134 |
} |
|
135 |
} |
|
127 |
$aLangAddons = $admin->getAvailableLanguages(); |
|
136 | 128 |
|
137 | 129 |
// default, if no information from client available |
138 |
$sAutoLanguage = DEFAULT_LANGUAGE; |
|
130 |
$sAutoLanguage = DEFAULT_LANGUAGE;
|
|
139 | 131 |
// detect client language |
140 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
141 |
if(preg_match('/([a-z]{2})(?:-[a-z]{2})*/i', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches)) { |
|
142 |
$sAutoLanguage = strtoupper($matches[1]); |
|
143 |
} |
|
144 |
} |
|
132 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
133 |
if(preg_match('/([a-z]{2})(?:-[a-z]{2})*/i', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches)) { |
|
134 |
$sAutoLanguage = strtoupper($matches[1]); |
|
135 |
} |
|
136 |
} |
|
137 |
|
|
138 |
$sAutoLanguage=($wb->get_session('LANGUAGE')) ? $_SESSION['LANGUAGE'] : $sAutoLanguage; |
|
145 | 139 |
|
146 |
$sAutoLanguage=($wb->get_session('LANGUAGE')) ? $_SESSION['LANGUAGE'] : $sAutoLanguage; |
|
147 |
|
|
148 |
//$sAutoLanguage = 'NL'; |
|
149 |
$aLangUsed = array_flip(explode(',',$wb->GetLanguagesInUsed())); |
|
150 |
$aLangUsed = array_intersect_key($aLangAddons, $aLangUsed); |
|
151 |
$sAutoLanguage = array_key_exists($sAutoLanguage,$aLangUsed) ? $sAutoLanguage : DEFAULT_LANGUAGE; |
|
152 |
//print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />'; |
|
153 |
//print_r( $aLangUsed ); print '</pre>'; // flush ();sleep(10); die(); |
|
140 |
//$sAutoLanguage = 'NL'; |
|
141 |
$aLangUsed = array_flip(explode(',',$wb->getLanguagesInUsed())); |
|
142 |
$aLangUsed = array_intersect_key($aLangAddons, $aLangUsed); |
|
143 |
if( (sizeof($aLangUsed)<2) || !($oReg->PageLanguages) ){ |
|
144 |
$aLangUsed = $aLangAddons; |
|
145 |
} |
|
146 |
$sAutoLanguage = array_key_exists($sAutoLanguage,$aLangUsed) ? $sAutoLanguage : DEFAULT_LANGUAGE; |
|
154 | 147 |
// read available languages from table addons and assign it to the template |
155 | 148 |
$oTpl->set_block('main_block', 'language_list_block', 'language_list'); |
156 | 149 |
foreach( $aLangUsed as $sDirectory => $aName ) |
Also available in: Unified diff
! see Build 1986
also implemented in frontend account