mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-23 13:55:43 +02:00
2011-07-26 Sergio Martin <sergio.martin@artica.es>
* pandoradb_data.sql pandoradb.data.postgreSQL.sql pandoradb.data.oracle.sql: Set as default the language of the admin when install * include/config_process.php include/functions.php index.php operation/users/user_edit.php general/pandora_help.php godmode/users/configure_user.php: Added default option in the language combo when edit a user. If this option is choose, this user will has the general setup language Fixed too the problem of the help screens language Bug: 3375174 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4623 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
1167360e3b
commit
b9f2f2355d
@ -1,3 +1,22 @@
|
|||||||
|
2011-07-26 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* pandoradb_data.sql
|
||||||
|
pandoradb.data.postgreSQL.sql
|
||||||
|
pandoradb.data.oracle.sql: Set as default
|
||||||
|
the language of the admin when install
|
||||||
|
|
||||||
|
* include/config_process.php
|
||||||
|
include/functions.php
|
||||||
|
index.php
|
||||||
|
operation/users/user_edit.php
|
||||||
|
general/pandora_help.php
|
||||||
|
godmode/users/configure_user.php: Added default
|
||||||
|
option in the language combo when edit a user. If
|
||||||
|
this option is choose, this user will has the
|
||||||
|
general setup language
|
||||||
|
Fixed too the problem of the help screens language
|
||||||
|
Bug: 3375174
|
||||||
|
|
||||||
2011-07-22 Miguel de Dios <miguel.dedios@artica.es>
|
2011-07-22 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/functions.php: fixed the not login when open new window in some
|
* include/functions.php: fixed the not login when open new window in some
|
||||||
|
@ -29,8 +29,10 @@ require_once ("../include/functions_html.php");
|
|||||||
<?php
|
<?php
|
||||||
$id = get_parameter ('id');
|
$id = get_parameter ('id');
|
||||||
|
|
||||||
|
$user_language = get_user_language ();
|
||||||
|
|
||||||
/* Possible file locations */
|
/* Possible file locations */
|
||||||
$safe_language = safe_url_extraclean ($config["language"], "en");
|
$safe_language = safe_url_extraclean ($user_language, "en");
|
||||||
$safe_id = safe_url_extraclean ($id, "");
|
$safe_id = safe_url_extraclean ($id, "");
|
||||||
$files = array ($config["homedir"]."/include/help/".$safe_language."/help_".$safe_id.".php",
|
$files = array ($config["homedir"]."/include/help/".$safe_language."/help_".$safe_id.".php",
|
||||||
$config["homedir"].ENTERPRISE_DIR."/include/help/".$safe_language."/help_".$safe_id.".php",
|
$config["homedir"].ENTERPRISE_DIR."/include/help/".$safe_language."/help_".$safe_id.".php",
|
||||||
|
@ -36,9 +36,6 @@ if (ENTERPRISE_NOT_HOOK !== enterprise_include('include/functions_policies.php')
|
|||||||
$id = get_parameter ('id', get_parameter ('id_user', '')); // ID given as parameter
|
$id = get_parameter ('id', get_parameter ('id_user', '')); // ID given as parameter
|
||||||
|
|
||||||
$user_info = get_user_info ($id);
|
$user_info = get_user_info ($id);
|
||||||
if ($user_info["language"] == ""){
|
|
||||||
$user_info["language"] = $config["language"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! check_acl ($config['id_user'], 0, "UM")) {
|
if (! check_acl ($config['id_user'], 0, "UM")) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
@ -87,7 +84,7 @@ if ($new_user && $config['admin_can_add_user']) {
|
|||||||
$user_info['phone'] = '';
|
$user_info['phone'] = '';
|
||||||
$user_info['comments'] = '';
|
$user_info['comments'] = '';
|
||||||
$user_info['is_admin'] = 0;
|
$user_info['is_admin'] = 0;
|
||||||
$user_info['language'] = $config["language"];
|
$user_info['language'] = 'default';
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$user_info['id_skin'] = '';
|
$user_info['id_skin'] = '';
|
||||||
}
|
}
|
||||||
@ -113,7 +110,7 @@ if ($create_user) {
|
|||||||
$values['phone'] = (string) get_parameter ('phone');
|
$values['phone'] = (string) get_parameter ('phone');
|
||||||
$values['comments'] = (string) get_parameter ('comments');
|
$values['comments'] = (string) get_parameter ('comments');
|
||||||
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
|
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
|
||||||
$values['language'] = get_parameter ('language', $config["language"]);
|
$values['language'] = get_parameter ('language', 'default');
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$values['id_skin'] = (int) get_parameter ('skin', 0);
|
$values['id_skin'] = (int) get_parameter ('skin', 0);
|
||||||
}
|
}
|
||||||
@ -195,7 +192,7 @@ if ($update_user) {
|
|||||||
$values['phone'] = (string) get_parameter ('phone');
|
$values['phone'] = (string) get_parameter ('phone');
|
||||||
$values['comments'] = (string) get_parameter ('comments');
|
$values['comments'] = (string) get_parameter ('comments');
|
||||||
$values['is_admin'] = get_parameter ('is_admin', 0 );
|
$values['is_admin'] = get_parameter ('is_admin', 0 );
|
||||||
$values['language'] = (string) get_parameter ('language', $config["language"]);
|
$values['language'] = (string) get_parameter ('language');
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
$values['id_skin'] = get_parameter ('skin', 0);
|
$values['id_skin'] = get_parameter ('skin', 0);
|
||||||
}
|
}
|
||||||
@ -300,7 +297,7 @@ $table->data[1][1] = html_print_input_text_extended ('fullname', $user_info['ful
|
|||||||
|
|
||||||
$table->data[2][0] = __('Language');
|
$table->data[2][0] = __('Language');
|
||||||
$table->data[2][1] = html_print_select_from_sql ('SELECT id_language, name FROM tlanguage',
|
$table->data[2][1] = html_print_select_from_sql ('SELECT id_language, name FROM tlanguage',
|
||||||
'language', $user_info["language"], '', '', '', true);
|
'language', $user_info['language'], '', __('Default'), 'default', true);
|
||||||
|
|
||||||
if ($config['user_can_update_password']) {
|
if ($config['user_can_update_password']) {
|
||||||
$table->data[4][0] = __('Password');
|
$table->data[4][0] = __('Password');
|
||||||
@ -367,7 +364,11 @@ $table->data[11][1] = html_print_select($values, 'flash_charts', $user_info["fla
|
|||||||
$table->data[12][0] = __('Block size for pagination');
|
$table->data[12][0] = __('Block size for pagination');
|
||||||
$table->data[12][1] = html_print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
|
$table->data[12][1] = html_print_input_text ('block_size', $user_info["block_size"], '', 5, 5, true);
|
||||||
|
|
||||||
echo '<form method="post">';
|
if($id == $config['id_user']) {
|
||||||
|
$table->data[12][1] .= html_print_input_hidden('quick_language_change', 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<form method="post" autocomplete="off">';
|
||||||
|
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
|
|
||||||
|
@ -28,8 +28,6 @@ $pandora_version = 'v4.0dev';
|
|||||||
/* Help to debug problems. Override global PHP configuration */
|
/* Help to debug problems. Override global PHP configuration */
|
||||||
if (!isset($develop_bypass)) $develop_bypass = 0;
|
if (!isset($develop_bypass)) $develop_bypass = 0;
|
||||||
|
|
||||||
$develop_bypass = 1;
|
|
||||||
|
|
||||||
if ($develop_bypass != 1) {
|
if ($develop_bypass != 1) {
|
||||||
// error_reporting(E_ALL);
|
// error_reporting(E_ALL);
|
||||||
|
|
||||||
@ -89,7 +87,6 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
|||||||
else {
|
else {
|
||||||
$config["remote_addr"] = null;
|
$config["remote_addr"] = null;
|
||||||
}
|
}
|
||||||
$config['user_language'] = $config["language"];
|
|
||||||
|
|
||||||
// Set a the system timezone default
|
// Set a the system timezone default
|
||||||
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")){
|
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")){
|
||||||
@ -98,12 +95,8 @@ if ((!isset($config["timezone"])) OR ($config["timezone"] == "")){
|
|||||||
|
|
||||||
date_default_timezone_set($config["timezone"]);
|
date_default_timezone_set($config["timezone"]);
|
||||||
|
|
||||||
// Set user language if provided, overriding System language
|
|
||||||
if (isset ($config['id_user'])){
|
if (isset ($config['id_user'])){
|
||||||
$userinfo = get_user_info ($config['id_user']);
|
$userinfo = get_user_info ($config['id_user']);
|
||||||
if ($userinfo["language"] != ""){
|
|
||||||
$config['user_language'] = $userinfo["language"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// If block_size or flash_chart are provided then override global settings
|
// If block_size or flash_chart are provided then override global settings
|
||||||
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
||||||
@ -121,8 +114,10 @@ if (isset ($config['id_user'])){
|
|||||||
|
|
||||||
$l10n = NULL;
|
$l10n = NULL;
|
||||||
|
|
||||||
if (file_exists ($config["homedir"] . '/include/languages/'.$config["user_language"].'.mo')) {
|
$user_language = get_user_language ();
|
||||||
$l10n = new gettext_reader (new CachedFileReader ($config["homedir"] . '/include/languages/'.$config["user_language"].'.mo'));
|
|
||||||
|
if (file_exists ($config["homedir"] . '/include/languages/'.$user_language.'.mo')) {
|
||||||
|
$l10n = new gettext_reader (new CachedFileReader ($config["homedir"] . '/include/languages/'.$user_language.'.mo'));
|
||||||
$l10n->load_tables();
|
$l10n->load_tables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,6 +312,44 @@ function get_system_time () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function provide the user language configuration if is not default, otherwise return the system language
|
||||||
|
*
|
||||||
|
* @param int $id_user
|
||||||
|
*
|
||||||
|
* @return string user active language code
|
||||||
|
*/
|
||||||
|
function get_user_language ($id_user = false) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$quick_language = get_parameter('quick_language_change', 0);
|
||||||
|
|
||||||
|
if($quick_language) {
|
||||||
|
$language = get_parameter('language', 0);
|
||||||
|
|
||||||
|
if($language === 'default') {
|
||||||
|
return $config['language'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($language !== 0) {
|
||||||
|
return $language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($id_user === false && isset($config['id_user'])) {
|
||||||
|
$id_user = $config['id_user'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($id_user !== false) {
|
||||||
|
$userinfo = get_user_info ($id_user);
|
||||||
|
if ($userinfo['language'] != 'default'){
|
||||||
|
return $userinfo['language'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config['language'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INTERNAL (use ui_print_timestamp for output): Transform an amount of time in seconds into a human readable
|
* INTERNAL (use ui_print_timestamp for output): Transform an amount of time in seconds into a human readable
|
||||||
* strings of minutes, hours or days.
|
* strings of minutes, hours or days.
|
||||||
|
@ -179,15 +179,11 @@ elseif (! isset ($config['id_user']) && isset ($_GET["login"])) {
|
|||||||
//Remove everything that might have to do with people's passwords or logins
|
//Remove everything that might have to do with people's passwords or logins
|
||||||
unset ($_GET['pass'], $pass, $_POST['pass'], $_REQUEST['pass'], $login_good);
|
unset ($_GET['pass'], $pass, $_POST['pass'], $_REQUEST['pass'], $login_good);
|
||||||
|
|
||||||
// Set user language if provided, overriding System language
|
$user_language = get_user_language ($config['id_user']);
|
||||||
$userinfo = get_user_info ($config['id_user']);
|
|
||||||
if ($userinfo["language"] != ""){
|
|
||||||
$config['language'] = $userinfo["language"];
|
|
||||||
}
|
|
||||||
|
|
||||||
$l10n = NULL;
|
$l10n = NULL;
|
||||||
if (file_exists ('./include/languages/'.$config["language"].'.mo')) {
|
if (file_exists ('./include/languages/'.$user_language.'.mo')) {
|
||||||
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$config["language"].'.mo'));
|
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$user_language.'.mo'));
|
||||||
$l10n->load_tables();
|
$l10n->load_tables();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,8 @@ include_once($config['homedir'] . '/include/functions_users.php');
|
|||||||
include_once ($config['homedir'] . '/include/functions_groups.php');
|
include_once ($config['homedir'] . '/include/functions_groups.php');
|
||||||
|
|
||||||
$id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
|
$id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
|
||||||
$user_info = get_user_info ($id);
|
|
||||||
if ($user_info["language"] == ""){
|
|
||||||
$user_info["language"] = $config["language"];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$user_info = get_user_info ($id);
|
||||||
$id = $user_info["id_user"]; //This is done in case there are problems with uppercase/lowercase (MySQL auth has that problem)
|
$id = $user_info["id_user"]; //This is done in case there are problems with uppercase/lowercase (MySQL auth has that problem)
|
||||||
|
|
||||||
if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM")) AND ($id != $config["id_user"])){
|
if ((!check_acl ($config["id_user"], users_get_groups ($id), "UM")) AND ($id != $config["id_user"])){
|
||||||
@ -138,10 +135,11 @@ html_print_input_text_extended ("phone", $user_info["phone"], '', '', '10', '30'
|
|||||||
|
|
||||||
echo '</td></tr><tr><td class="datos">'.__('Language').'</td><td class="datos2">';
|
echo '</td></tr><tr><td class="datos">'.__('Language').'</td><td class="datos2">';
|
||||||
echo html_print_select_from_sql ('SELECT id_language, name FROM tlanguage',
|
echo html_print_select_from_sql ('SELECT id_language, name FROM tlanguage',
|
||||||
'language', $user_info["language"], '', '', '', true);
|
'language', $user_info["language"], '', __('Default'), 'default', true);
|
||||||
|
|
||||||
echo '</td></tr><tr><td class="datos2">'.__('Comments').'</td><td class="datos">';
|
echo '</td></tr><tr><td class="datos2">'.__('Comments').'</td><td class="datos">';
|
||||||
html_print_textarea ("comments", 2, 60, $user_info["comments"], ($view_mode ? 'readonly="readonly"' : ''));
|
html_print_textarea ("comments", 2, 60, $user_info["comments"], ($view_mode ? 'readonly="readonly"' : ''));
|
||||||
|
html_print_input_hidden('quick_language_change', 1);
|
||||||
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
$own_info = get_user_info ($config['id_user']);
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||||
|
@ -269,8 +269,8 @@ END;;
|
|||||||
--
|
--
|
||||||
BEGIN
|
BEGIN
|
||||||
LOCK TABLE tusuario IN EXCLUSIVE MODE;
|
LOCK TABLE tusuario IN EXCLUSIVE MODE;
|
||||||
INSERT INTO tusuario (id_user, fullname, firstname, lastname, middlename, password, comments, last_connect, registered, email, phone, is_admin, flash_chart) VALUES
|
INSERT INTO tusuario (id_user, fullname, firstname, lastname, middlename, password, comments, last_connect, registered, email, phone, is_admin, flash_chart, language) VALUES
|
||||||
('admin', 'Pandora', 'Pandora', 'Admin', ' ', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, -1);
|
('admin', 'Pandora', 'Pandora', 'Admin', ' ', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, -1, 'default');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
END;;
|
END;;
|
||||||
|
|
||||||
|
@ -247,8 +247,8 @@ SELECT setval('ttipo_modulo_id_tipo_seq', (SELECT (SELECT MAX(id_tipo) FROM ttip
|
|||||||
--
|
--
|
||||||
-- Dumping data for table "tusuario"
|
-- Dumping data for table "tusuario"
|
||||||
--
|
--
|
||||||
INSERT INTO "tusuario" ("id_user", "fullname", "firstname", "lastname", "middlename", "password", "comments", "last_connect", "registered", "email", "phone", "is_admin", "flash_chart") VALUES
|
INSERT INTO "tusuario" ("id_user", "fullname", "firstname", "lastname", "middlename", "password", "comments", "last_connect", "registered", "email", "phone", "is_admin", "flash_chart", "language") VALUES
|
||||||
('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, -1);
|
('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, -1, 'default');
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table "tusuario_perfil"
|
-- Dumping data for table "tusuario_perfil"
|
||||||
|
@ -250,8 +250,8 @@ INSERT INTO `ttipo_modulo` VALUES
|
|||||||
--
|
--
|
||||||
-- Dumping data for table `tusuario`
|
-- Dumping data for table `tusuario`
|
||||||
--
|
--
|
||||||
INSERT INTO `tusuario` (`id_user`, `fullname`, `firstname`, `lastname`, `middlename`, `password`, `comments`, `last_connect`, `registered`, `email`, `phone`, `is_admin`, `flash_chart`) VALUES
|
INSERT INTO `tusuario` (`id_user`, `fullname`, `firstname`, `lastname`, `middlename`, `password`, `comments`, `last_connect`, `registered`, `email`, `phone`, `is_admin`, `flash_chart`, `language`) VALUES
|
||||||
('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, -1);
|
('admin', 'Pandora', 'Pandora', 'Admin', '', '1da7ee7d45b96d0e1f45ee4ee23da560', 'Admin Pandora', 1232642121, 0, 'admin@example.com', '555-555-5555', 1, -1, 'default');
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table `tusuario_perfil`
|
-- Dumping data for table `tusuario_perfil`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user