*** 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(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 "<html><head><title>";
echo _("PDF File");

View File

@ -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 = "<h1 $class>$MessageTyp</h1>"; // Format $MessageTyp
$MessageHeadline = "<h2 $class>$MessageHeadline</h2>"; // Format $MessageHeadline
$MessageText = "<p $class>$MessageText</p>"; // Format $MessageText
echo "<div $class><br>" . $MessageTyp.$MessageHeadline.$MessageText . "<br></div>"; // Writing status message
//$MessageTyp = "<h1 " . $class . ">" . $MessageTyp . "</h1>"; // Format $MessageTyp
$MessageTyp = "<img src=\"../graphics/" . strtolower($MessageTyp) . ".jpg\" alt=\"" . $MessageTyp . "\" width=\"50\" height=\"60\">";
$MessageHeadline = "<h2 " . $class . ">" . $MessageHeadline . "</h2>"; // Format $MessageHeadline
$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. */
function parseMessageString($MessageString)
{
function parseMessageString($MessageString) {
return linkText(colorText(boldText($MessageString)));
}
/* 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}
$replace = "<b class\"status\">\\1</b>"; // Replace pattern
$replace = "<b class=\"status\">\\1</b>"; // Replace pattern
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. */
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 = "<font color=\"#\\1\">\\2</font>"; // Replace pattern
return preg_replace($pattern,$replace,$text);
}
/* 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}
$replace = "<a href=\"\\1\" target=\"_blank\">\\2</a>"; //Replace pattern
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 */
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] . "<br>";
$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 " <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"] <> "")
{
echo " <p class=\"help\">See also: " . $helpArray[$helpNumber]['SeeAlso'] . "</p>\n";

View File

@ -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)
</tr>
</table>
<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">
<b><?php echo _("Enter Username and Password for Account") . ":"; ?></b>
</p>
@ -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'] . "<br>";
//echo "lamurl=" . $_SESSION['lamurl'] . "<br>";
$default_Config = new CfgMain();
$default_Profile = $default_Config->default;
$_SESSION["config"] = new Config($default_Profile); // Create new Config object

View File

@ -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);
?>