[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[14549] branches/SM-1_4-STABLE/squirrelmail/src/ help.php
From:       pdontthink () users ! sourceforge ! net
Date:       2016-02-01 18:22:41
Message-ID: E1aQJ7b-0001NQ-KF () sfs-ml-4 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 14549
          http://sourceforge.net/p/squirrelmail/code/14549
Author:   pdontthink
Date:     2016-02-01 18:22:40 +0000 (Mon, 01 Feb 2016)
Log Message:
-----------
Add more accurate error reporting

Modified Paths:
--------------
    branches/SM-1_4-STABLE/squirrelmail/src/help.php

Modified: branches/SM-1_4-STABLE/squirrelmail/src/help.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/src/help.php	2016-02-01 10:36:15 UTC (rev \
                14548)
+++ branches/SM-1_4-STABLE/squirrelmail/src/help.php	2016-02-01 18:22:40 UTC (rev \
14549) @@ -158,17 +158,27 @@
     // Get the chapter numbers, title and decriptions.
     for ($i=0, $cnt = count($helpdir); $i < $cnt; $i++) {
         if (file_exists("../help/$user_language/$helpdir[$i]")) {
-            // First try the selected language.
-            $doc = file("../help/$user_language/$helpdir[$i]");
-            $help_info = get_info($doc, 0);
-            $toc[] = array($i+1, $help_info[0], $help_info[2]);
+            if (is_readable("../help/$user_language/$helpdir[$i]")) {
+                // First try the selected language.
+                $doc = file("../help/$user_language/$helpdir[$i]");
+                $help_info = get_info($doc, 0);
+                $toc[] = array($i+1, $help_info[0], $help_info[2]);
+            } else {
+                $toc[] = array($i+1, _("This chapter file is not readable"),
+                         sprintf(_("For some reason, the file for chapter %s is not \
readable."), $i+1)); +            }
         } elseif (file_exists("../help/en_US/$helpdir[$i]")) {
-            // If the selected language can't be found, try English.
-            $doc = file("../help/en_US/$helpdir[$i]");
-            $help_info = get_info($doc, 0);
-            $toc[] = array($i+1, $help_info[0],
-                    _("This chapter is not available in the selected language. It \
                will be displayed in English instead.") .
-                    '<br />' . $help_info[2]);
+            if (is_readable("../help/en_US/$helpdir[$i]")) {
+                // If the selected language can't be found, try English.
+                $doc = file("../help/en_US/$helpdir[$i]");
+                $help_info = get_info($doc, 0);
+                $toc[] = array($i+1, $help_info[0],
+                        _("This chapter is not available in the selected language. \
It will be displayed in English instead.") . +                        '<br />' . \
$help_info[2]); +            } else {
+                $toc[] = array($i+1, _("This chapter file is not readable"),
+                         sprintf(_("For some reason, the file for chapter %s is not \
readable."), $i+1)); +            }
         } else {
             // If English can't be found, the chapter went MIA.
             $toc[] = array($i+1, _("This chapter is missing"),
@@ -201,19 +211,29 @@
 
     // Get the chapter.
     if (file_exists("../help/$user_language/" . $helpdir[$chapter-1])) {
-        // First try the selected language.
-        $doc = file("../help/$user_language/" . $helpdir[$chapter-1]);
+        if (is_readable("../help/$user_language/" . $helpdir[$chapter-1])) {
+            // First try the selected language.
+           $doc = file("../help/$user_language/" . $helpdir[$chapter-1]);
+        } else {
+            error_box(sprintf(_("For some reason, the file for chapter %s is not \
readable."), $chapter), $color); +            echo '<br />';
+        }
     } elseif (file_exists("../help/en_US/" . $helpdir[$chapter-1])) {
-        // If the selected language can't be found, try English.
-        $doc = file("../help/en_US/" . $helpdir[$chapter-1]);
-        error_box(_("This chapter is not available in the selected language. It will \
                be displayed in English instead."), $color);
-        echo '<br />';
+        if (is_readable("../help/en_US/" . $helpdir[$chapter-1])) {
+            // If the selected language can't be found, try English.
+            $doc = file("../help/en_US/" . $helpdir[$chapter-1]);
+            error_box(_("This chapter is not available in the selected language. It \
will be displayed in English instead."), $color); +            echo '<br />';
+        } else {
+            error_box(sprintf(_("For some reason, the file for chapter %s is not \
readable."), $chapter), $color); +            echo '<br />';
+        }
     } else {
         // If English can't be found, the chapter went MIA.
         $display_chapter = FALSE;
     }
 
-    // Write the chpater header.
+    // Write the chapter header.
     echo '<div style="text-align: center;"><small>';
     if ($chapter <= 1){
         echo '<font color="' . $color[9] . '">' . _("Previous")
@@ -267,4 +287,4 @@
         );
 
 ?>
-</table></body></html>
\ No newline at end of file
+</table></body></html>

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic