From 63bf69b6098f17a39dbafcc1d9442596f530c50d Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 3 Aug 2003 11:05:40 +0000 Subject: [PATCH] translation update --- lam/lib/profiles.inc | 104 +++++++++++++---------- lam/templates/lists/listgroups.php | 4 +- lam/templates/lists/listhosts.php | 4 +- lam/templates/lists/listusers.php | 4 +- lam/templates/profedit/profilecreate.php | 13 ++- lam/templates/profedit/profiledelete.php | 3 + lam/templates/profedit/profilehost.php | 3 + lam/templates/profedit/profilemain.php | 3 + lam/templates/profedit/profileuser.php | 3 + 9 files changed, 86 insertions(+), 55 deletions(-) diff --git a/lam/lib/profiles.inc b/lam/lib/profiles.inc index 48482477..cc5b9443 100644 --- a/lam/lib/profiles.inc +++ b/lam/lib/profiles.inc @@ -233,47 +233,54 @@ function saveUserProfile($account, $profile) { exit; } $path = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/users/" . $profile . ".pru"; - $file = fopen($path, "w"); - // replace user and group names - $homedir = $account->general_homedir; - $profpath = $account->smb_profilePath; - $scriptPath = $account->smb_scriptPath; - $smbhome = $account->smb_smbhome; - if ($account->general_username) { - $homedir = str_replace($account->general_username, "\$user", $homedir); - $profpath = str_replace($account->general_username, "\$user", $profpath); - $scriptPath = str_replace($account->general_username, "\$user", $scriptPath); - $smbhome = str_replace($account->general_username, "\$user", $smbhome); + $file = @fopen($path, "w"); + if ($file) { + // replace user and group names + $homedir = $account->general_homedir; + $profpath = $account->smb_profilePath; + $scriptPath = $account->smb_scriptPath; + $smbhome = $account->smb_smbhome; + if ($account->general_username) { + $homedir = str_replace($account->general_username, "\$user", $homedir); + $profpath = str_replace($account->general_username, "\$user", $profpath); + $scriptPath = str_replace($account->general_username, "\$user", $scriptPath); + $smbhome = str_replace($account->general_username, "\$user", $smbhome); + } + if ($account->general_group) { + $homedir = str_replace($account->general_group, "\$group", $homedir); + $profpath = str_replace($account->general_group, "\$group", $profpath); + $scriptPath = str_replace($account->general_group, "\$group", $scriptPath); + $smbhome = str_replace($account->general_group, "\$group", $smbhome); + } + // write attributes + if (isset($account->general_group)) fputs($file, "general_group: " . $account->general_group . "\n"); + if (isset($account->general_groupadd)) fputs($file, "general_groupadd: " . implode(";", $account->general_groupadd) . "\n"); + if (isset($account->general_homedir)) fputs($file, "general_homedir: " . $homedir . "\n"); + if (isset($account->general_shell)) fputs($file, "general_shell: " . $account->general_shell . "\n"); + if (isset($account->unix_password_no)) fputs($file, "unix_password_no: " . $account->unix_password_no . "\n"); + if (isset($account->unix_pwdwarn)) fputs($file, "unix_pwdwarn: " . $account->unix_pwdwarn . "\n"); + if (isset($account->unix_pwdallowlogin)) fputs($file, "unix_pwdallowlogin: " . $account->unix_pwdallowlogin . "\n"); + if (isset($account->unix_pwdminage)) fputs($file, "unix_pwdminage: " . $account->unix_pwdminage . "\n"); + if (isset($account->unix_pwdmaxage)) fputs($file, "unix_pwdmaxage: " . $account->unix_pwdmaxage . "\n"); + if (isset($account->unix_pwdexpire)) fputs($file, "unix_pwdexpire: " . $account->unix_pwdexpire . "\n"); + if (isset($account->unix_deactivated)) fputs($file, "unix_deactivated: " . $account->unix_deactivated . "\n"); + if (isset($account->smb_password_no)) fputs($file, "smb_password_no: " . $account->smb_password_no . "\n"); + if (isset($account->smb_useunixpwd)) fputs($file, "smb_useunixpwd: " . $account->smb_useunixpwd . "\n"); + if (isset($account->smb_flagsD)) fputs($file, "smb_flagsD: " . $account->smb_flagsD . "\n"); + if (isset($account->smb_homedrive)) fputs($file, "smb_homedrive: " . $account->smb_homedrive . "\n"); + if (isset($account->smb_scriptPath)) fputs($file, "smb_scriptPath: " . $scriptPath . "\n"); + if (isset($account->smb_profilePath)) fputs($file, "smb_profilePath: " . $profpath . "\n"); + if (isset($account->smb_smbuserworkstations)) fputs($file, "smb_smbuserworkstations: " . $account->smb_smbuserworkstations . "\n"); + if (isset($account->smb_smbhome)) fputs($file, "smb_smbhome: " . $smbhome . "\n"); + if (isset($account->smb_domain)) fputs($file, "smb_domain: " . $account->smb_domain . "\n"); + // close file + fclose($file); } - if ($account->general_group) { - $homedir = str_replace($account->general_group, "\$group", $homedir); - $profpath = str_replace($account->general_group, "\$group", $profpath); - $scriptPath = str_replace($account->general_group, "\$group", $scriptPath); - $smbhome = str_replace($account->general_group, "\$group", $smbhome); + else { + StatusMessage("ERROR", _("Unable to save profile!"), $path); + return false; } - // write attributes - if (isset($account->general_group)) fputs($file, "general_group: " . $account->general_group . "\n"); - if (isset($account->general_groupadd)) fputs($file, "general_groupadd: " . implode(";", $account->general_groupadd) . "\n"); - if (isset($account->general_homedir)) fputs($file, "general_homedir: " . $homedir . "\n"); - if (isset($account->general_shell)) fputs($file, "general_shell: " . $account->general_shell . "\n"); - if (isset($account->unix_password_no)) fputs($file, "unix_password_no: " . $account->unix_password_no . "\n"); - if (isset($account->unix_pwdwarn)) fputs($file, "unix_pwdwarn: " . $account->unix_pwdwarn . "\n"); - if (isset($account->unix_pwdallowlogin)) fputs($file, "unix_pwdallowlogin: " . $account->unix_pwdallowlogin . "\n"); - if (isset($account->unix_pwdminage)) fputs($file, "unix_pwdminage: " . $account->unix_pwdminage . "\n"); - if (isset($account->unix_pwdmaxage)) fputs($file, "unix_pwdmaxage: " . $account->unix_pwdmaxage . "\n"); - if (isset($account->unix_pwdexpire)) fputs($file, "unix_pwdexpire: " . $account->unix_pwdexpire . "\n"); - if (isset($account->unix_deactivated)) fputs($file, "unix_deactivated: " . $account->unix_deactivated . "\n"); - if (isset($account->smb_password_no)) fputs($file, "smb_password_no: " . $account->smb_password_no . "\n"); - if (isset($account->smb_useunixpwd)) fputs($file, "smb_useunixpwd: " . $account->smb_useunixpwd . "\n"); - if (isset($account->smb_flagsD)) fputs($file, "smb_flagsD: " . $account->smb_flagsD . "\n"); - if (isset($account->smb_homedrive)) fputs($file, "smb_homedrive: " . $account->smb_homedrive . "\n"); - if (isset($account->smb_scriptPath)) fputs($file, "smb_scriptPath: " . $scriptPath . "\n"); - if (isset($account->smb_profilePath)) fputs($file, "smb_profilePath: " . $profpath . "\n"); - if (isset($account->smb_smbuserworkstations)) fputs($file, "smb_smbuserworkstations: " . $account->smb_smbuserworkstations . "\n"); - if (isset($account->smb_smbhome)) fputs($file, "smb_smbhome: " . $smbhome . "\n"); - if (isset($account->smb_domain)) fputs($file, "smb_domain: " . $account->smb_domain . "\n"); - // close file - fclose($file); + return true; } // saves an account object to an group profile with name $profile (without .prg) @@ -291,12 +298,19 @@ function saveHostProfile($account, $profile) { exit; } $path = substr(__FILE__, 0, strlen(__FILE__) - 17) . "/config/profiles/hosts/" . $profile . ".prh"; - $file = fopen($path, "w"); - // write attributes - if (isset($account->general_group)) fputs($file, "general_group: " . $account->general_group . "\n"); - if (isset($account->smb_domain)) fputs($file, "smb_domain: " . $account->smb_domain . "\n"); - // close file - fclose($file); + $file = @fopen($path, "w"); + if ($file) { + // write attributes + if (isset($account->general_group)) fputs($file, "general_group: " . $account->general_group . "\n"); + if (isset($account->smb_domain)) fputs($file, "smb_domain: " . $account->smb_domain . "\n"); + // close file + fclose($file); + } + else { + StatusMessage("ERROR", _("Unable to save profile!"), $path); + return false; + } + return true; } // deletes a user profile diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index 480b8baf..66ec4ccd 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -170,12 +170,12 @@ echo "\n"; // print filter row echo ""; -echo ""; +echo ""; echo ""; // print input boxes for filters for ($k = 0; $k < sizeof ($desc_array); $k++) { echo ""; - echo (""); echo ""; } diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index dd5e343a..725dd54f 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -176,12 +176,12 @@ echo "\n"; // print filter row echo ""; -echo ""; +echo ""; echo ""; // print input boxes for filters for ($k = 0; $k < sizeof ($desc_array); $k++) { echo ""; - echo (""); echo ""; } diff --git a/lam/templates/lists/listusers.php b/lam/templates/lists/listusers.php index 6da20ed1..542e8340 100644 --- a/lam/templates/lists/listusers.php +++ b/lam/templates/lists/listusers.php @@ -192,13 +192,13 @@ if ($user_count != 0) { echo "\n"; echo "\n"; - echo ""; + echo ""; echo "\n"; // print input boxes for filters for ($k = 0; $k < sizeof ($desc_array); $k++) { echo ""; - echo (""); echo ""; } diff --git a/lam/templates/profedit/profilecreate.php b/lam/templates/profedit/profilecreate.php index fa3e02b1..51ed6aa4 100644 --- a/lam/templates/profedit/profilecreate.php +++ b/lam/templates/profedit/profilecreate.php @@ -27,11 +27,14 @@ include_once("../../lib/status.inc"); include_once("../../lib/account.inc"); include_once("../../lib/profiles.inc"); include_once("../../lib/ldap.inc"); +include_once("../../lib/config.inc"); // start session session_save_path("../../sess"); @session_start(); +setlanguage(); + // abort button was pressed in profileuser/~host.php // back to profile editor if ($_POST['abort']) { @@ -223,8 +226,9 @@ if ($_GET['type'] == "user") { exit; } // save profile - saveUserProfile($acct, $profname); - echo ("

" . _("Profile $profname was saved.") . "

"); + if (saveUserProfile($acct, $profname)) { + echo StatusMessage("INFO", _("Profile was saved."), $profname); + } echo ("

" . _("Back to Profile Editor") . "

"); } @@ -249,8 +253,9 @@ elseif ($_GET['type'] == "host") { exit; } // save profile - saveHostProfile($acct, $profname); - echo ("

" . _("Profile $profname was saved.") . "

"); + if (saveHostProfile($acct, $profname)) { + echo StatusMessage("INFO", _("Profile was saved."), $profname); + } echo ("

" . _("Back to Profile Editor") . "

"); } diff --git a/lam/templates/profedit/profiledelete.php b/lam/templates/profedit/profiledelete.php index 0bad6c4b..93465c6e 100644 --- a/lam/templates/profedit/profiledelete.php +++ b/lam/templates/profedit/profiledelete.php @@ -25,11 +25,14 @@ $Id$ include_once("../../lib/profiles.inc"); include_once("../../lib/ldap.inc"); +include_once("../../lib/config.inc"); // start session session_save_path("../../sess"); @session_start(); +setlanguage(); + // check if user is logged in, if not go to login if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) { echo("\n"); diff --git a/lam/templates/profedit/profilehost.php b/lam/templates/profedit/profilehost.php index 9393689e..486731f6 100644 --- a/lam/templates/profedit/profilehost.php +++ b/lam/templates/profedit/profilehost.php @@ -26,11 +26,14 @@ $Id$ include_once("../../lib/profiles.inc"); include_once("../../lib/ldap.inc"); include_once("../../lib/account.inc"); +include_once("../../lib/config.inc"); // start session session_save_path("../../sess"); @session_start(); +setlanguage(); + // check if user is logged in, if not go to login if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) { echo("\n"); diff --git a/lam/templates/profedit/profilemain.php b/lam/templates/profedit/profilemain.php index 44c23f55..d520df1d 100644 --- a/lam/templates/profedit/profilemain.php +++ b/lam/templates/profedit/profilemain.php @@ -25,11 +25,14 @@ $Id$ include_once("../../lib/profiles.inc"); include_once("../../lib/ldap.inc"); +include_once("../../lib/config.inc"); // start session session_save_path("../../sess"); @session_start(); +setlanguage(); + // check if user is logged in, if not go to login if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) { echo(""); diff --git a/lam/templates/profedit/profileuser.php b/lam/templates/profedit/profileuser.php index 2be478f0..79f47eff 100644 --- a/lam/templates/profedit/profileuser.php +++ b/lam/templates/profedit/profileuser.php @@ -26,11 +26,14 @@ $Id$ include_once("../../lib/profiles.inc"); include_once("../../lib/ldap.inc"); include_once("../../lib/account.inc"); +include_once("../../lib/config.inc"); // start session session_save_path("../../sess"); @session_start(); +setlanguage(); + // check if user is logged in, if not go to login if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) { echo("\n");