[Gnucash-changes] added graceful handling of empty archive directories of quieter lists

Neil Williams codehelp at cvs.gnucash.org
Sat May 8 17:50:04 EDT 2004


Log Message:
-----------
added graceful handling of empty archive directories of quieter lists

Modified Files:
--------------
    mail-search:
        search.php

Revision Data
-------------
Index: search.php
===================================================================
RCS file: /home/cvs/cvsroot/mail-search/search.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lsearch.php -Lsearch.php -u -r1.6 -r1.7
--- search.php
+++ search.php
@@ -453,9 +453,27 @@
 	array_push($start, $temp);
 }
 
+$self = $_SERVER["PHP_SELF"];
+if(!$self) { $self = "search.php"; }
+
 foreach($start as $folder) {
-	if(!($dp = opendir("$base/$folder")))
-		die ("Cannot open search start directory.");
+	if(!($dp = @opendir("$base/$folder"))) {
+		print "<h2>Sorry, the $folder archive is empty.</h2>";
+		print "<p>Please try another <a href=\"$self\">search</a> </p>\n";
+		?>
+</div>
+<div style="clear:both;float:none;">&nbsp;</div>
+<div id="tail">
+<p style="float:right;padding-right:1em;"><a href='http://validator.w3.org/check/referer'>Validate</a> </p>
+<p style="text-align:center;"><b>Copyright &copy; 2001-2004 The GnuCash Project</b></p>
+<p style="text-align:center;">Search problem reports to:
+<a href="mailto:linux at codehelp.co.uk"><b>Neil Williams &lt;linux at codehelp.co.uk&gt;</b></a></p>
+</div>
+</body>
+</html>
+<?php
+		exit;
+	}
 	while($file = readdir($dp)) {
 		if(($file != '.')&&($file != '..')) {
 			if(ereg("date\.html",$file)) { continue; }
@@ -566,8 +584,6 @@
 }
 print "<p>Search terms: <b>$termstring</b><br>\n";
 print "Case <b>$case</b></p>\n";
-$self = $_SERVER["PHP_SELF"];
-if(!$self) { $self = "search.php"; }
 print "<p><a href=\"$self\">New Search</a> </p>\n";
 print "<p>Archives searched:<br>\n";
 foreach($start as $item) { print "$item "; }


More information about the Gnucash-changes mailing list