check if Smarty engine is available is now done in check_requirements()
authorAndreas Unterkircher <unki@netshadow.at>
Sat, 29 Mar 2008 07:29:53 +0000 (08:29 +0100)
committerAndreas Unterkircher <unki@netshadow.at>
Sat, 29 Mar 2008 07:34:01 +0000 (08:34 +0100)
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
phpfspot.class.php

index a9e3e686ea3e52fa682d6792de91ba8cdfaf9c12..7cc4e19ec506655a4730b2f163540e6b19c70cb3 100644 (file)
@@ -66,7 +66,7 @@ class PHPFSPOT {
       );
 
       /* Check necessary requirements */
-      if(!$this->checkRequirements()) {
+      if(!$this->check_requirements()) {
          exit(1);
       }
 
@@ -129,12 +129,7 @@ class PHPFSPOT {
       /* Check if some tables need to be created */
       $this->check_config_table();
 
-      /* include Smarty template engine */
-      if(!$this->check_readable($this->cfg->smarty_path .'/libs/Smarty.class.php')) {
-         exit(1);
-      }
-      require $this->cfg->smarty_path .'/libs/Smarty.class.php';
-      /* overload Smarty class if our own template handler */
+      /* overload Smarty class with our own template handler */
       require_once "phpfspot_tmpl.php";
       $this->tmpl = new PHPFSPOT_TMPL($this);
 
@@ -1794,7 +1789,7 @@ class PHPFSPOT {
    /**
     * check if all requirements are met
     */
-   private function checkRequirements()
+   private function check_requirements()
    {
       if(!function_exists("imagecreatefromjpeg")) {
          print "PHP GD library extension is missing<br />\n";
@@ -1823,6 +1818,11 @@ class PHPFSPOT {
          print "PEAR Console_Getopt package is missing<br />\n";
          $missing = true;
       }
+      @include_once $this->cfg->smarty_path .'/libs/Smarty.class.php';
+      if(isset($php_errormsg) && preg_match('/Failed opening.*for inclusion/i', $php_errormsg)) {
+         print "Smarty template engine can not be found in ". $this->cfg->smarty_path ."/libs/Smarty.class.php<br />\n";
+         $missing = true;
+      }
       ini_restore('track_errors');
 
       if(isset($missing))
@@ -1830,7 +1830,7 @@ class PHPFSPOT {
 
       return true;
 
-   } // checkRequirements()
+   } // check_requirements()
 
    private function _debug($text)
    {