diff --git a/lam/lib/pdf.inc b/lam/lib/pdf.inc
index 3acbf092..fa0a2469 100644
--- a/lam/lib/pdf.inc
+++ b/lam/lib/pdf.inc
@@ -227,8 +227,8 @@ function createUserPDF($accounts) {
$pdfFile->Cell(50,5,"",0,0,"R",0);
$pdfFile->Cell(30,5,$quotas[$j][0],0,0,"L",0);
$pdfFile->Cell(30,5,$quotas[$j][2],0,0,"L",0);
- $pdfFile->Cell(30,5,$quotas[$j][3],0,0,"L",0);
$pdfFile->Cell(30,5,$quotas[$j][6],0,0,"L",0);
+ $pdfFile->Cell(30,5,$quotas[$j][3],0,0,"L",0);
$pdfFile->Cell(30,5,$quotas[$j][7],0,1,"L",0);
}
}
@@ -251,8 +251,9 @@ function createUserPDF($accounts) {
while ($file=readdir($h)) {
if (substr($file, -4)=='.pdf') {
$path = $relpath.$file;
- if ($t-filemtime($path)>180)
- @unlink($path);
+ if ($t-filemtime($path)>180) {
+ @unlink($path);
+ }
}
}
closedir($h);
@@ -422,7 +423,6 @@ function createHostPDF($accounts) {
// Create redirector page
-
echo $_SESSION['header'];
echo "
";
echo _("PDF File");
diff --git a/lam/lib/status.inc b/lam/lib/status.inc
index c122c946..b6e0db9c 100644
--- a/lam/lib/status.inc
+++ b/lam/lib/status.inc
@@ -23,29 +23,21 @@ $Id$
LDAP Account Manager status messages.
*/
-function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
-{
+function StatusMessage($MessageTyp,$MessageHeadline,$MessageText,$MessageVariables) {
/* Setting CSS-StyleSheet class depending on the $MessageTyp and rewriting $MessageTyp with a readable string. */
- if($MessageTyp == "INFO")
- {
+ if($MessageTyp == "INFO") {
$class = "class=\"statusInfo\"";
- $MessageTyp = _("Information");
}
- elseif($MessageTyp == "WARN")
- {
+ elseif($MessageTyp == "WARN") {
$class = "class=\"statusWarn\"";
- $MessageTyp = _("Warning");
}
- elseif($MessageTyp == "ERROR")
- {
+ elseif($MessageTyp == "ERROR") {
$class = "class=\"statusError\"";
- $MessageTyp = _("Error");
}
/* Set output-message, when none or false $MessageTyp is submitted. */
- else
- {
+ else {
$class = "class=\"statusError\"";
- $MessageTyp = _("LAM Internal Error");
+ $MessageTyp = s_("LAM Internal Error");
$MessageHeadline = _("Invalid/Missing Message type");
$MessageText = _("Please report this error to the Bug-Tracker at {link=http://lam.sf.net}LDAP Account Manager Development Team{endlink}. The error number is {bold}0001:Invalid/Missing Message type.{endbold} Thank you.");
}
@@ -53,37 +45,41 @@ function StatusMessage($MessageTyp, $MessageHeadline, $MessageText)
$MessageHeadline = parseMessageString($MessageHeadline);
$MessageText = parseMessageString($MessageText);
- $MessageTyp = "$MessageTyp
"; // Format $MessageTyp
- $MessageHeadline = "$MessageHeadline
"; // Format $MessageHeadline
- $MessageText = "$MessageText
"; // Format $MessageText
- echo "
" . $MessageTyp.$MessageHeadline.$MessageText . "
"; // Writing status message
+ //$MessageTyp = "" . $MessageTyp . "
"; // Format $MessageTyp
+ $MessageTyp = "";
+ $MessageHeadline = "" . $MessageHeadline . "
"; // Format $MessageHeadline
+ $MessageText = "" . $MessageText . "
"; // Format $MessageText
+ $format = "" . $MessageTyp . " | " . $MessageHeadline . $MessageText . " |
";
+ for($i=0;$i";
+ }
+ $command = 'printf("' . addslashes($format) . '"' . $variables . ');';
+ echo "command=" . $command . "
";
+ eval($command);
}
/* Use the three replace functions on the submitted Text. */
-function parseMessageString($MessageString)
-{
+function parseMessageString($MessageString) {
return linkText(colorText(boldText($MessageString)));
}
/* Replace {bold} and {endbold} with and HTML-Tags. */
-function boldText($text)
-{
+function boldText($text) {
$pattern = "/\{bold\}([^{]*)\{endbold\}/"; // Regular expression matching {bold}[Text]{endbold}
- $replace = "\\1"; // Replace pattern
+ $replace = "\\1"; // Replace pattern
return preg_replace($pattern,$replace,$text);
}
/* Replace {color=#[HEX-Value]} or {color=[HEX-Value]} and {endcolor} with and HTML-Tags. */
-function colorText($text)
-{
+function colorText($text) {
$pattern = "/\{color=#?([0-9,a-f,A-F]{6})\}([^{]*)\{endcolor\}/"; // Regular expression matching {color=#[HEX-Value]}[Text]{endcolor} or {color=[HEX-Value]}[Text]{endcolor}
$replace = "\\2"; // Replace pattern
return preg_replace($pattern,$replace,$text);
}
/* Replace {link=[Link-Target]} and {endlink} with and HTML-Tags. */
-function linkText($text)
-{
+function linkText($text) {
$pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink}
$replace = "\\2"; //Replace pattern
return preg_replace($pattern,$replace,$text);
diff --git a/lam/templates/help.php b/lam/templates/help.php
index 433d221d..c358f9af 100644
--- a/lam/templates/help.php
+++ b/lam/templates/help.php
@@ -72,10 +72,12 @@ function displayHelp($helpNumber)
/* If submitted help number is not in help/help.inc print error message */
elseif(!array_key_exists($helpNumber,$helpArray))
{
- $reference = "({bold}" . $helpNumber . "{endbold})";
- $errorMessage = _("Sorry this help number $reference is not available.");
+ $variables = array();
+ array_push($variables,$helpNumber);
+ echo "variables[0]=" . $variables[0] . "
";
+ $errorMessage = _("Sorry this help number ({bold}%d{endbold}) is not available.");
echoHTMLHead();
- statusMessage("ERROR","",$errorMessage);
+ statusMessage("ERROR","",$errorMessage,$variables);
echoHTMLFoot();
}
/* Print help site out of $helpArray */
@@ -83,7 +85,9 @@ function displayHelp($helpNumber)
{
echoHTMLHead();
echo " " . $helpArray[$helpNumber]['Headline'] . "
\n";
- echo " " . $helpArray[$helpNumber]['Text'] . "
\n";
+ $format = " " . $helpArray[$helpNumber]['Text'] . "
\n";
+ printf($format,$helpArray[$helpNumber]['variables'][0],$helpArray[$helpNumber]['variables'][1],$helpArray[$helpNumber]['variables'][2],$helpArray[$helpNumber]['variables'][3],$helpArray[$helpNumber]['variables'][4],$helpArray[$helpNumber]['variables'][5],$helpArray[$helpNumber]['variables'][6],$helpArray[$helpNumber]['variables'][7],$helpArray[$helpNumber]['variables'][8],$helpArray[$helpNumber]['variables'][9]);
+ //echo " " . $helpArray[$helpNumber]['Text'] . "
\n";
if($helpArray[$helpNumber]["SeeAlso"] <> "")
{
echo " See also: " . $helpArray[$helpNumber]['SeeAlso'] . "
\n";
diff --git a/lam/templates/login.php b/lam/templates/login.php
index 9326ca98..ab63b546 100644
--- a/lam/templates/login.php
+++ b/lam/templates/login.php
@@ -33,17 +33,19 @@ function display_LoginPage($config_object,$profile)
global $error_message;
// generate 256 bit key and initialization vector for user/passwd-encryption
// check if we can use /dev/random otherwise use /dev/urandom or rand()
- $key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
- if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
- if (! $key) {
- srand((double)microtime()*1234567);
- $key = mcrypt_create_iv(32, MCRYPT_RAND);
- }
- $iv = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
- if (! $iv) $iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
- if (! $iv) {
- srand((double)microtime()*1234567);
- $iv = mcrypt_create_iv(32, MCRYPT_RAND);
+ if(function_exists(mcrypt_create_iv)) {
+ $key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
+ if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
+ if (! $key) {
+ srand((double)microtime()*1234567);
+ $key = mcrypt_create_iv(32, MCRYPT_RAND);
+ }
+ $iv = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
+ if (! $iv) $iv = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
+ if (! $iv) {
+ srand((double)microtime()*1234567);
+ $iv = mcrypt_create_iv(32, MCRYPT_RAND);
+ }
}
// save both in cookie
@@ -108,6 +110,19 @@ function display_LoginPage($config_object,$profile)
+
+
+
+
@@ -255,9 +270,13 @@ function display_LoginPage($config_object,$profile)
// checking if the submitted username/password is correct.
if($_POST['action'] == "checklogin")
{
+ $_SESSION['lampath'] = realpath('../') . "/"; // Save full path to lam in session
+ $_SESSION['lamurl'] = substr($_SERVER['HTTP_REFERER'],0,strlen($_SERVER['HTTP_REFERER'])-19); // Save full URI to lam in session
+
include_once("../lib/ldap.inc"); // Include ldap.php which provides Ldap class
$_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object
+
if($_POST['passwd'] == "")
{
$error_message = _("Empty Password submitted. Try again.");
@@ -266,6 +285,7 @@ if($_POST['action'] == "checklogin")
else
{
$result = $_SESSION['ldap']->connect($_POST['username'],$_POST['passwd']); // Connect to LDAP server for verifing username/password
+
if($result == True) // Username/password correct. Do some configuration and load main frame.
{
$_SESSION['language'] = $_POST['language']; // Write selected language in session
@@ -298,15 +318,6 @@ elseif($_POST['action'] == "profileChange") {
// Load login page
else
{
-
- $_SESSION['lampath'] = realpath('../') . "/";
- $protocol = explode("/",$_SERVER['SERVER_PROTOCOL']);
- $protocol = strToLower($protocol[0]) . "://";
- $_SESSION['lamurl'] = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
- $_SESSION['lamurl'] = substr($_SESSION['lamurl'],0,strlen($_SESSION['lamurl'])-19);
- //echo "lampath=" . $_SESSION['lampath'] . "
";
- //echo "lamurl=" . $_SESSION['lamurl'] . "
";
-
$default_Config = new CfgMain();
$default_Profile = $default_Config->default;
$_SESSION["config"] = new Config($default_Profile); // Create new Config object
diff --git a/lam/tests/status-test.php b/lam/tests/status-test.php
index e280ee44..ae6a7d68 100644
--- a/lam/tests/status-test.php
+++ b/lam/tests/status-test.php
@@ -34,5 +34,6 @@ include_once("../lib/status.inc");
$Typ = "WARN";
$Headline = "Test";
$Text = "{color=00FF00}Farbe{endcolor} {bold}fett{endbold}";
-StatusMessage($Typ,$Headline,$Text);
+$Variables = array();
+StatusMessage($Typ,$Headline,$Text,$Variables);
?>