Author: nextgens
Date: 2008-05-08 09:23:12 +0000 (Thu, 08 May 2008)
New Revision: 19835

Modified:
   trunk/website/includes/common.inc.php
Log:
website: log an error and handle the whole thing better

Modified: trunk/website/includes/common.inc.php
===================================================================
--- trunk/website/includes/common.inc.php       2008-05-08 09:19:47 UTC (rev 
19834)
+++ trunk/website/includes/common.inc.php       2008-05-08 09:23:12 UTC (rev 
19835)
@@ -42,9 +42,10 @@
        if (isset($page))
        {
                #echo "common - page exists 
".dirname(__FILE__).'/'.$page.'.inc.php';
-               if (file_exists(dirname(__FILE__).'/'.$page.'.inc.php')) {
+               $tmpfile = dirname(__FILE__).'/'.$page.'.inc.php';
+               if (file_exists($tmpfile)) {
                        #echo "file exists";
-                       include dirname(__FILE__).'/'.$page.'.inc.php';         
                                        // include file with  $pages-array
+                       include $tmpfile;
                        foreach ( $lang_q as $aLang => $relevance )             
                                        // loop through each language
                        {       
                                foreach ( $pages as $userlang => $path )        
                                        // loop through each language-file
@@ -59,11 +60,14 @@
                                }

                        }       
-                       if (!isset($file))
-                       {
-                               $file = $pages['en']; //if no match, default to 
english
-                       }               
+               } else {
+                       syslog(LOG_CRIT, "Huh, someone attempted to access a 
non-existent file! $tmpfile");
                }
+
+               if (!isset($file))
+               {
+                       $file = $pages['en']; //if no match, default to english
+               }               
        }
        return $file;



Reply via email to