Implement a check on change of language. Make sure that the specified language file exists. Reports errors to UI
This commit is contained in:
parent
9973b1fbaf
commit
5b9ccc6889
|
@ -24,6 +24,8 @@ if ( !canEdit('System') ) {
|
|||
return;
|
||||
}
|
||||
|
||||
global $error_message;
|
||||
|
||||
if ( $action == 'delete' ) {
|
||||
if ( isset($_REQUEST['object']) ) {
|
||||
if ( $_REQUEST['object'] == 'server' ) {
|
||||
|
@ -65,10 +67,19 @@ if ( $action == 'delete' ) {
|
|||
}
|
||||
|
||||
if ( isset($newValue) && ($newValue != $config['Value']) ) {
|
||||
# Handle special cases first
|
||||
if ($config['Name'] == 'ZM_LANG_DEFAULT') {
|
||||
# Verify that the language file exists in the lang directory.
|
||||
if (!file_exists(ZM_PATH_WEB.'/lang/'.$newValue.'.php')) {
|
||||
$error_message .= 'Error setting ' . $config['Name'].'. New value ' .$newValue.' not saved because '.ZM_PATH_WEB.'/lang/'.$newValue.'.php doesn\'t exist.<br/>';
|
||||
ZM\Error($error_message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dbQuery('UPDATE Config SET Value=? WHERE Name=?', array($newValue, $config['Name']));
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
} # end if value changed
|
||||
} # end foreach config entry
|
||||
if ( $changed ) {
|
||||
switch ( $_REQUEST['tab'] ) {
|
||||
case 'system' :
|
||||
|
|
Loading…
Reference in New Issue