From: Andreas Unterkircher Date: Fri, 29 Jun 2007 17:46:43 +0000 (+0000) Subject: issue3, first requirement checks X-Git-Tag: phpfspot-1.2~203 X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=605439cc3bceba0e1974448a5c669e33303fcc90 issue3, first requirement checks git-svn-id: file:///var/lib/svn/phpfspot/trunk@132 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- diff --git a/phpfspot.class.php b/phpfspot.class.php index 191e066..907b6dc 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -16,6 +16,11 @@ class PHPFSPOT { public function __construct() { + /* Check necessary requirements */ + if(!$this->checkRequirements()) { + exit(1); + } + $this->cfg = new PHPFSPOT_CFG; $this->db = new PHPFSPOT_DB(&$this, $this->cfg->fspot_db); @@ -798,7 +803,7 @@ class PHPFSPOT { } // get_photo_tags() - function showTextImage($txt, $color=000000, $space=4, $font=4, $w=300) + public function showTextImage($txt, $color=000000, $space=4, $font=4, $w=300) { if (strlen($color) != 6) $color = 000000; @@ -824,6 +829,40 @@ class PHPFSPOT { } // showTextImage() + private function checkRequirements() + { + if(!function_exists("imagecreatefromjpeg")) { + print "PHP GD library extension is missing
\n"; + $missing = true; + } + + if(!function_exists("mysql_connect")) { + print "PHP MySQL library extension is missing
\n"; + $missing = true; + } + + if(!function_exists("sqlite3_open")) { + print "PHP SQLite3 library extension is missing
\n"; + $missing = true; + } + + /* Check for HTML_AJAX PEAR package, lent from Horde project */ + ini_set('track_errors', 1); + @include 'HTML/AJAX/Server.php'; + if(isset($php_errormsg)) { + print "PEAR HTML_AJAX package is missing
\n"; + $missing = true; + } + ini_restore('track_errors'); + + if(isset($missing)) + return false; + + return true; + + } // checkRequirements() + + } ?>