From cb6c900276f2abaf1f36e31ad230bba25e8bed5d Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 16 Nov 2003 09:20:31 +0000 Subject: [PATCH] save pdftext only if needed, changed error message if write failed --- lam/lib/config.inc | 5 ++++- lam/templates/config/confsave.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 7f692c0e..7591e138 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -138,7 +138,7 @@ class Config { var $pwdhash; // text to include in user PDF files - var $pdftext; + var $pdftext = ""; // name of configuration file var $file; @@ -675,7 +675,10 @@ class Config { // $value: string containing the text // returns true if $value has correct format and could be saved function set_pdftext($value) { + // check if text changed + if ($value == $this->pdftext) return true; if (is_string($value)) { + // save to file $pdffile = substr(__FILE__, 0, strlen(__FILE__) - 15) . "/config/pdf/" . $this->file . ".txt"; $file = @fopen($pdffile, "w"); if ($file) { diff --git a/lam/templates/config/confsave.php b/lam/templates/config/confsave.php index 206e81d6..b6496053 100644 --- a/lam/templates/config/confsave.php +++ b/lam/templates/config/confsave.php @@ -198,7 +198,7 @@ if (!$conf->set_pwdhash($pwdhash)) { } if (!$conf->set_pdftext($pdftext)) { - echo ("" . _("PDF text is invalid!") . ""); + echo ("" . _("Saving PDF text failed!") . ""); echo ("\n


" . _("Back to preferences...") . ""); exit; }