From 3e2bc6a975303bfb1ac656c5431d30c4aae82289 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Tue, 22 Sep 2009 03:11:38 -0400
Subject: [PATCH] - Fix dl() use in installer (#1486150): use is_readable() instead

---
 installer/check.php |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/installer/check.php b/installer/check.php
index 9bdb41b..4593051 100644
--- a/installer/check.php
+++ b/installer/check.php
@@ -55,14 +55,17 @@
 <h3>Checking PHP extensions</h3>
 <p class="hint">The following modules/extensions are <em>required</em> to run RoundCube:</p>
 <?php
-    
+
+// get extensions location
+$ext_dir = ini_get('extension_dir');
+
 $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
 foreach ($required_php_exts AS $name => $ext) {
     if (extension_loaded($ext)) {
         $RCI->pass($name);
     } else {
-        $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
-        $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : '';
+        $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
+        $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
         $RCI->fail($name, $msg, $source_urls[$name]);
     }
     echo '<br />';
@@ -78,8 +81,8 @@
         $RCI->pass($name);
     }
     else {
-        $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
-        $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : '';
+        $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
+        $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
         $RCI->na($name, $msg, $source_urls[$name]);
     }
     echo '<br />';
@@ -99,8 +102,8 @@
         $RCI->pass($database);
     }
     else {
-        $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
-        $msg = @dl($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed';
+        $_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
+        $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed';
         $RCI->na($database, $msg, $source_urls[$database]);
     }
     echo '<br />';

--
Gitblit v1.9.1