*** empty log message ***

This commit is contained in:
duergner 2003-10-18 11:26:49 +00:00
parent ea47bf0a16
commit 47e750db6e
5 changed files with 68 additions and 56 deletions

View File

@ -227,8 +227,8 @@ function createUserPDF($accounts) {
$pdfFile->Cell(50,5,"",0,0,"R",0); $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][0],0,0,"L",0);
$pdfFile->Cell(30,5,$quotas[$j][2],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][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); $pdfFile->Cell(30,5,$quotas[$j][7],0,1,"L",0);
} }
} }
@ -251,10 +251,11 @@ function createUserPDF($accounts) {
while ($file=readdir($h)) { while ($file=readdir($h)) {
if (substr($file, -4)=='.pdf') { if (substr($file, -4)=='.pdf') {
$path = $relpath.$file; $path = $relpath.$file;
if ($t-filemtime($path)>180) if ($t-filemtime($path)>180) {
@unlink($path); @unlink($path);
} }
} }
}
closedir($h); closedir($h);
// Close PDF // Close PDF
@ -422,7 +423,6 @@ function createHostPDF($accounts) {
// Create redirector page // Create redirector page
echo $_SESSION['header']; echo $_SESSION['header'];
echo "<html><head><title>"; echo "<html><head><title>";
echo _("PDF File"); echo _("PDF File");

View File

@ -23,29 +23,21 @@ $Id$
LDAP Account Manager status messages. 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. */ /* Setting CSS-StyleSheet class depending on the $MessageTyp and rewriting $MessageTyp with a readable string. */
if($MessageTyp == "INFO") if($MessageTyp == "INFO") {
{
$class = "class=\"statusInfo\""; $class = "class=\"statusInfo\"";
$MessageTyp = _("Information");
} }
elseif($MessageTyp == "WARN") elseif($MessageTyp == "WARN") {
{
$class = "class=\"statusWarn\""; $class = "class=\"statusWarn\"";
$MessageTyp = _("Warning");
} }
elseif($MessageTyp == "ERROR") elseif($MessageTyp == "ERROR") {
{
$class = "class=\"statusError\""; $class = "class=\"statusError\"";
$MessageTyp = _("Error");
} }
/* Set output-message, when none or false $MessageTyp is submitted. */ /* Set output-message, when none or false $MessageTyp is submitted. */
else else {
{
$class = "class=\"statusError\""; $class = "class=\"statusError\"";
$MessageTyp = _("LAM Internal Error"); $MessageTyp = s_("LAM Internal Error");
$MessageHeadline = _("Invalid/Missing Message type"); $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."); $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); $MessageHeadline = parseMessageString($MessageHeadline);
$MessageText = parseMessageString($MessageText); $MessageText = parseMessageString($MessageText);
$MessageTyp = "<h1 $class>$MessageTyp</h1>"; // Format $MessageTyp //$MessageTyp = "<h1 " . $class . ">" . $MessageTyp . "</h1>"; // Format $MessageTyp
$MessageHeadline = "<h2 $class>$MessageHeadline</h2>"; // Format $MessageHeadline $MessageTyp = "<img src=\"../graphics/" . strtolower($MessageTyp) . ".jpg\" alt=\"" . $MessageTyp . "\" width=\"50\" height=\"60\">";
$MessageText = "<p $class>$MessageText</p>"; // Format $MessageText $MessageHeadline = "<h2 " . $class . ">" . $MessageHeadline . "</h2>"; // Format $MessageHeadline
echo "<div $class><br>" . $MessageTyp.$MessageHeadline.$MessageText . "<br></div>"; // Writing status message $MessageText = "<p " . $class . ">" . $MessageText . "</p>"; // Format $MessageText
$format = "<div " . $class . "><br><table><tr><td>" . $MessageTyp . "</td><td>" . $MessageHeadline . $MessageText . "</td></tr></table><br></div>";
for($i=0;$i<count($MessageVariables);$i++) {
$variables .= "," . $MessageVariables[$i];
echo "variable[" . $i . "]=" . $variables[$i] . "<br>";
}
$command = 'printf("' . addslashes($format) . '"' . $variables . ');';
echo "command=" . $command . "<br>";
eval($command);
} }
/* Use the three replace functions on the submitted Text. */ /* Use the three replace functions on the submitted Text. */
function parseMessageString($MessageString) function parseMessageString($MessageString) {
{
return linkText(colorText(boldText($MessageString))); return linkText(colorText(boldText($MessageString)));
} }
/* Replace {bold} and {endbold} with <b> and </b> HTML-Tags. */ /* Replace {bold} and {endbold} with <b> and </b> HTML-Tags. */
function boldText($text) function boldText($text) {
{
$pattern = "/\{bold\}([^{]*)\{endbold\}/"; // Regular expression matching {bold}[Text]{endbold} $pattern = "/\{bold\}([^{]*)\{endbold\}/"; // Regular expression matching {bold}[Text]{endbold}
$replace = "<b class\"status\">\\1</b>"; // Replace pattern $replace = "<b class=\"status\">\\1</b>"; // Replace pattern
return preg_replace($pattern,$replace,$text); return preg_replace($pattern,$replace,$text);
} }
/* Replace {color=#[HEX-Value]} or {color=[HEX-Value]} and {endcolor} with <font color="#[HEX-Value]"> and </font> HTML-Tags. */ /* Replace {color=#[HEX-Value]} or {color=[HEX-Value]} and {endcolor} with <font color="#[HEX-Value]"> and </font> 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} $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 = "<font color=\"#\\1\">\\2</font>"; // Replace pattern $replace = "<font color=\"#\\1\">\\2</font>"; // Replace pattern
return preg_replace($pattern,$replace,$text); return preg_replace($pattern,$replace,$text);
} }
/* Replace {link=[Link-Target]} and {endlink} with <a href="[Link-Target]" target="_blank"> and </a> HTML-Tags. */ /* Replace {link=[Link-Target]} and {endlink} with <a href="[Link-Target]" target="_blank"> and </a> HTML-Tags. */
function linkText($text) function linkText($text) {
{
$pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink} $pattern = "/\{link=([^}]*)\}([^{]*)\{endlink\}/"; // Regular expression matching {link=[Link-Target]}[Text]{endlink}
$replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>"; //Replace pattern $replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>"; //Replace pattern
return preg_replace($pattern,$replace,$text); return preg_replace($pattern,$replace,$text);

View File

@ -72,10 +72,12 @@ function displayHelp($helpNumber)
/* If submitted help number is not in help/help.inc print error message */ /* If submitted help number is not in help/help.inc print error message */
elseif(!array_key_exists($helpNumber,$helpArray)) elseif(!array_key_exists($helpNumber,$helpArray))
{ {
$reference = "({bold}" . $helpNumber . "{endbold})"; $variables = array();
$errorMessage = _("Sorry this help number $reference is not available."); array_push($variables,$helpNumber);
echo "variables[0]=" . $variables[0] . "<br>";
$errorMessage = _("Sorry this help number ({bold}%d{endbold}) is not available.");
echoHTMLHead(); echoHTMLHead();
statusMessage("ERROR","",$errorMessage); statusMessage("ERROR","",$errorMessage,$variables);
echoHTMLFoot(); echoHTMLFoot();
} }
/* Print help site out of $helpArray */ /* Print help site out of $helpArray */
@ -83,7 +85,9 @@ function displayHelp($helpNumber)
{ {
echoHTMLHead(); echoHTMLHead();
echo " <h1 class=\"help\">" . $helpArray[$helpNumber]['Headline'] . "</h1>\n"; echo " <h1 class=\"help\">" . $helpArray[$helpNumber]['Headline'] . "</h1>\n";
echo " <p class=\"help\">" . $helpArray[$helpNumber]['Text'] . "</p>\n"; $format = " <p class=\"help\">" . $helpArray[$helpNumber]['Text'] . "</p>\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 " <p class=\"help\">" . $helpArray[$helpNumber]['Text'] . "</p>\n";
if($helpArray[$helpNumber]["SeeAlso"] <> "") if($helpArray[$helpNumber]["SeeAlso"] <> "")
{ {
echo " <p class=\"help\">See also: " . $helpArray[$helpNumber]['SeeAlso'] . "</p>\n"; echo " <p class=\"help\">See also: " . $helpArray[$helpNumber]['SeeAlso'] . "</p>\n";

View File

@ -33,6 +33,7 @@ function display_LoginPage($config_object,$profile)
global $error_message; global $error_message;
// generate 256 bit key and initialization vector for user/passwd-encryption // generate 256 bit key and initialization vector for user/passwd-encryption
// check if we can use /dev/random otherwise use /dev/urandom or rand() // check if we can use /dev/random otherwise use /dev/urandom or rand()
if(function_exists(mcrypt_create_iv)) {
$key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM); $key = @mcrypt_create_iv(32, MCRYPT_DEV_RANDOM);
if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM); if (! $key) $key = @mcrypt_create_iv(32, MCRYPT_DEV_URANDOM);
if (! $key) { if (! $key) {
@ -45,6 +46,7 @@ function display_LoginPage($config_object,$profile)
srand((double)microtime()*1234567); srand((double)microtime()*1234567);
$iv = mcrypt_create_iv(32, MCRYPT_RAND); $iv = mcrypt_create_iv(32, MCRYPT_RAND);
} }
}
// save both in cookie // save both in cookie
setcookie("Key", base64_encode($key), 0, "/"); setcookie("Key", base64_encode($key), 0, "/");
@ -108,6 +110,19 @@ function display_LoginPage($config_object,$profile)
</tr> </tr>
</table> </table>
<hr><br><br> <hr><br><br>
<?php
if(! function_exists('mcrypt_create_iv')) {
StatusMessage("ERROR", "Your PHP does not support MCrypt, you will not be able to log in! Please install the required package.","See http://lam.sf.net/documentation/faq.html#2 for Suse/RedHat");
?>
</body>
</html>
<?php
exit;
}
if(! function_exists('mHash')) {
StatusMessage("WARN", "Your PHP does not support MHash, you will only be able to use CRYPT/PLAIN for user passwords! Please install the required package.","See http://lam.sf.net/documentation/faq.html#2 for Suse/RedHat");
}
?>
<p align="center"> <p align="center">
<b><?php echo _("Enter Username and Password for Account") . ":"; ?></b> <b><?php echo _("Enter Username and Password for Account") . ":"; ?></b>
</p> </p>
@ -255,9 +270,13 @@ function display_LoginPage($config_object,$profile)
// checking if the submitted username/password is correct. // checking if the submitted username/password is correct.
if($_POST['action'] == "checklogin") 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 include_once("../lib/ldap.inc"); // Include ldap.php which provides Ldap class
$_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object $_SESSION['ldap'] = new Ldap($_SESSION['config']); // Create new Ldap object
if($_POST['passwd'] == "") if($_POST['passwd'] == "")
{ {
$error_message = _("Empty Password submitted. Try again."); $error_message = _("Empty Password submitted. Try again.");
@ -266,6 +285,7 @@ if($_POST['action'] == "checklogin")
else else
{ {
$result = $_SESSION['ldap']->connect($_POST['username'],$_POST['passwd']); // Connect to LDAP server for verifing username/password $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. if($result == True) // Username/password correct. Do some configuration and load main frame.
{ {
$_SESSION['language'] = $_POST['language']; // Write selected language in session $_SESSION['language'] = $_POST['language']; // Write selected language in session
@ -298,15 +318,6 @@ elseif($_POST['action'] == "profileChange") {
// Load login page // Load login page
else 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'] . "<br>";
//echo "lamurl=" . $_SESSION['lamurl'] . "<br>";
$default_Config = new CfgMain(); $default_Config = new CfgMain();
$default_Profile = $default_Config->default; $default_Profile = $default_Config->default;
$_SESSION["config"] = new Config($default_Profile); // Create new Config object $_SESSION["config"] = new Config($default_Profile); // Create new Config object

View File

@ -34,5 +34,6 @@ include_once("../lib/status.inc");
$Typ = "WARN"; $Typ = "WARN";
$Headline = "Test"; $Headline = "Test";
$Text = "{color=00FF00}Farbe{endcolor} {bold}fett{endbold}"; $Text = "{color=00FF00}Farbe{endcolor} {bold}fett{endbold}";
StatusMessage($Typ,$Headline,$Text); $Variables = array();
StatusMessage($Typ,$Headline,$Text,$Variables);
?> ?>