Added user specific languages.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@722 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-01-07 13:24:44 +00:00
parent 2a3f25e724
commit 86a472e3e4
5 changed files with 22 additions and 8 deletions

View File

@ -457,6 +457,7 @@ if ( $action )
$changes = array();
if ( $new_username != $row[Username] ) $changes[] = "Username = '$new_username'";
if ( $new_password != $row[Password] ) $changes[] = "Password = password('$new_password')";
if ( $new_username != $row[Language] ) $changes[] = "Language = '$new_language'";
if ( $new_enabled != $row[Enabled] ) $changes[] = "Enabled = '$new_enabled'";
if ( $new_stream != $row[Stream] ) $changes[] = "Stream = '$new_stream'";
if ( $new_events != $row[Events] ) $changes[] = "Events = '$new_events'";

View File

@ -144,7 +144,7 @@ $jws = array(
'options' => array( 'w'=>760, 'h'=>440 ),
'optionhelp' => array( 'w'=>320, 'h'=>240 ),
'restarting' => array( 'w'=>250, 'h'=>150 ),
'user' => array( 'w'=>230, 'h'=>320 ),
'user' => array( 'w'=>230, 'h'=>340 ),
'settings' => array( 'w'=>200, 'h'=>225 ),
'logout' => array( 'w'=>200, 'h'=>100 ),
'bandwidth' => array( 'w'=>200, 'h'=>90 ),

View File

@ -143,7 +143,7 @@ function validateForm( form )
<tr>
<td align="left" class="smallhead"><?= $zmSlangId ?></td>
<td align="left" class="smallhead"><?= $zmSlangUsername ?></td>
<td align="left" class="smallhead"><?= $zmSlangPassword ?></td>
<td align="left" class="smallhead"><?= $zmSlangLanguage ?></td>
<td align="left" class="smallhead"><?= $zmSlangEnabled ?></td>
<td align="left" class="smallhead"><?= $zmSlangStream ?></td>
<td align="left" class="smallhead"><?= $zmSlangEvents ?></td>
@ -162,7 +162,7 @@ function validateForm( form )
<tr onMouseOver="this.className='over'" onMouseOut="this.className='out'">
<td align="left" class="ruled"><?= $row[Id] ?></td>
<td align="left" class="ruled"><?= makeLink( "javascript: newWindow( '$PHP_SELF?view=user&uid=$row[Id]', 'zmUser', ".$jws['user']['w'].", ".$jws['user']['h']." );", $row[Username].($user[Username]==$row[Username]?"*":""), canEdit( 'System' ) ) ?></td>
<td align="left" class="ruled">********</td>
<td align="left" class="ruled"><?= $row[Language]?$row[Language]:'default' ?></td>
<td align="left" class="ruled"><?= $row[Enabled]?$zmSlangYes:$zmSlangNo ?></td>
<td align="left" class="ruled"><?= $row[Stream] ?></td>
<td align="left" class="ruled"><?= $row[Events] ?></td>

View File

@ -76,6 +76,7 @@ function closeWindow()
<tr><td align="right" class="text"><?= $zmSlangUsername ?></td><td align="left" class="text"><input type="text" name="new_username" value="<?= $row[Username] ?>" size="16" class="form"></td></tr>
<tr><td align="right" class="text"><?= $zmSlangNewPassword ?></td><td align="left" class="text"><input type="password" name="new_password" value="<?= $row[Password] ?>" size="16" class="form"></td></tr>
<tr><td align="right" class="text"><?= $zmSlangConfirmPassword ?></td><td align="left" class="text"><input type="password" name="new_password2" value="<?= $row[Password] ?>" size="16" class="form"></td></tr>
<tr><td align="right" class="text"><?= $zmSlangLanguage ?></td><td align="left" class="text"><input type="text" name="new_language" value="<?= $row[Language] ?>" size="16" class="form"></td></tr>
<?php
$new_enabled = $row[Enabled];
$yesno = array( 0=>$zmSlangNo, 1=>$zmSlangYes );

View File

@ -1,12 +1,24 @@
<?php
// Change this to be whatever you want your default language to be
$default_lang = "en_gb";
$lang_file = 'zm_lang_'.ZM_LANG_DEFAULT.'.php';
$fallback_lang_file = 'zm_lang_en_gb.php';
$system_lang_file = 'zm_lang_'.ZM_LANG_DEFAULT.'.php';
if ( !file_exists( $lang_file ) )
if ( $user[Language] )
{
$lang_file = 'zm_lang_'.$default_lang.'.php';
$user_lang_file = 'zm_lang_'.$user[Language].'.php';
}
if ( $user_lang_file && file_exists( $user_lang_file ) )
{
$lang_file = $user_lang_file;
}
elseif ( file_exists( $system_lang_file ) )
{
$lang_file = $system_lang_file;
}
else
{
$lang_file = $fallback_lang_file;
}
require_once( $lang_file );