forked from extern/egroupware
using new check_load_extension function
This commit is contained in:
parent
bf036043b2
commit
aca05a32e3
@ -1,31 +1,16 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - calendar: rounded corners *
|
||||
* http://www.egroupware.org *
|
||||
* Written by RalfBecker@outdoor-training.de *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/**
|
||||
* eGroupWare Calendar: rounded corners
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package calendar
|
||||
* @copyright (c) 2004-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
// some constanst for pre php4.3
|
||||
if (!defined('PHP_SHLIB_SUFFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so');
|
||||
}
|
||||
if (!defined('PHP_SHLIB_PREFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
|
||||
}
|
||||
|
||||
if (!extension_loaded('gd') && !@dl(PHP_SHLIB_PREFIX.'gd.'.PHP_SHLIB_SUFFIX))
|
||||
{
|
||||
die("Can't load the needed php-extension 'gd' !!!");
|
||||
}
|
||||
check_load_extension('gd',true); // true = throw exception if not loadable
|
||||
|
||||
foreach(array('width'=>1,'height'=>1,'color1'=>'000080','color2'=>'ffffff') as $name => $default)
|
||||
{
|
||||
@ -84,4 +69,3 @@ else
|
||||
imagepng($image);
|
||||
}
|
||||
imagedestroy($image);
|
||||
?>
|
||||
|
@ -1,31 +1,16 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - calendar: rounded corners *
|
||||
* http://www.egroupware.org *
|
||||
* Written by RalfBecker@outdoor-training.de *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/**
|
||||
* eGroupWare Calendar: rounded corners
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package calendar
|
||||
* @copyright (c) 2004-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
// some constanst for pre php4.3
|
||||
if (!defined('PHP_SHLIB_SUFFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so');
|
||||
}
|
||||
if (!defined('PHP_SHLIB_PREFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
|
||||
}
|
||||
|
||||
if (!extension_loaded('gd') && !@dl(PHP_SHLIB_PREFIX.'gd.'.PHP_SHLIB_SUFFIX))
|
||||
{
|
||||
die("Can't load the needed php-extension 'gd' !!!");
|
||||
}
|
||||
check_load_extension('gd',true); // true = throw exception if not loadable
|
||||
|
||||
foreach(array('width'=>-20,'height'=>40,'border'=>1,'color'=>'000080','bgcolor'=>'0000FF') as $name => $default)
|
||||
{
|
||||
@ -85,4 +70,3 @@ else
|
||||
imagepng($image);
|
||||
}
|
||||
imagedestroy($image);
|
||||
?>
|
||||
|
@ -103,7 +103,7 @@ class etemplate_request
|
||||
{
|
||||
if (is_null(self::$request_class))
|
||||
{
|
||||
self::$request_class = extension_loaded('mcrypt') && function_exists('gzcompress') &&
|
||||
self::$request_class = check_load_extension('mcrypt') && function_exists('gzcompress') &&
|
||||
self::init_crypt() ? __CLASS__ : 'etemplate_request_session';
|
||||
}
|
||||
if (self::$request_class != __CLASS__)
|
||||
@ -342,7 +342,7 @@ class etemplate_request
|
||||
{
|
||||
$key = $GLOBALS['egw_info']['server']['db_pass'].EGW_SERVER_ROOT;
|
||||
}
|
||||
if (!extension_loaded('mcrypt') && (!function_exists('dl') || !@dl(PHP_SHLIB_PREFIX.'mcrypt'.'.'.PHP_SHLIB_SUFFIX)))
|
||||
if (!check_load_extension('mcrypt'))
|
||||
{
|
||||
error_log(__METHOD__."() required PHP extension mcrypt not loaded and can not be loaded, eTemplate requests get NOT encrypted!");
|
||||
return false;
|
||||
|
@ -7,7 +7,7 @@
|
||||
* @package api
|
||||
* @subpackage db
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
@ -46,15 +46,6 @@
|
||||
* }
|
||||
*/
|
||||
|
||||
// some constanst for pre php4.3
|
||||
if (!defined('PHP_SHLIB_SUFFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so');
|
||||
}
|
||||
if (!defined('PHP_SHLIB_PREFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
|
||||
}
|
||||
if(empty($GLOBALS['egw_info']['server']['db_type']))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['db_type'] = 'mysql';
|
||||
@ -406,8 +397,7 @@ class egw_db
|
||||
$this->Host != $GLOBALS['egw']->db->Host ||
|
||||
$this->Port != $GLOBALS['egw']->db->Port)))
|
||||
{
|
||||
if (!extension_loaded($php_extension) && (!function_exists('dl') ||
|
||||
!dl(PHP_SHLIB_PREFIX.$php_extension.'.'.PHP_SHLIB_SUFFIX)))
|
||||
if (!check_load_extension($php_extension))
|
||||
{
|
||||
$this->halt("Necessary php database support for $this->Type (".PHP_SHLIB_PREFIX.$php_extension.'.'.PHP_SHLIB_SUFFIX.") not loaded and can't be loaded, exiting !!!");
|
||||
return null; // in case error-reporting = 'no'
|
||||
|
@ -20,16 +20,6 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
// some constants for pre php4.3
|
||||
if (!defined('PHP_SHLIB_SUFFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_SUFFIX',$is_windows ? 'dll' : 'so');
|
||||
}
|
||||
if (!defined('PHP_SHLIB_PREFIX'))
|
||||
{
|
||||
define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* eGW session handling
|
||||
*
|
||||
@ -381,7 +371,7 @@ class egw_session
|
||||
}
|
||||
if (is_null(self::$mcrypt))
|
||||
{
|
||||
if (!extension_loaded('mcrypt') && (!function_exists('dl') || !@dl(PHP_SHLIB_PREFIX.'mcrypt'.'.'.PHP_SHLIB_SUFFIX)))
|
||||
if (!check_load_extension('mcrypt'))
|
||||
{
|
||||
error_log(__METHOD__."() required PHP extension mcrypt not loaded and can not be loaded, sessions get NOT encrypted!");
|
||||
return false;
|
||||
|
@ -70,10 +70,8 @@ class egw_session_memcache
|
||||
*/
|
||||
public static function open($save_path, $session_name)
|
||||
{
|
||||
if (!extension_loaded('memcache') && !dl(PHP_SHLIB_PREFIX.'memcache.'.PHP_SHLIB_SUFFIX))
|
||||
{
|
||||
throw new Exception("Required PHP extension 'memcache' not loaded AND can NOT be loaded!");
|
||||
}
|
||||
check_load_extension('memcache',true); // true = throw exception if not loadable
|
||||
|
||||
self::$memcache = new Memcache;
|
||||
foreach(explode(',',$save_path) as $path)
|
||||
{
|
||||
|
@ -1462,10 +1462,7 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper
|
||||
{
|
||||
foreach(array('pdo','pdo_'.self::$pdo_type) as $ext)
|
||||
{
|
||||
if (!extension_loaded($ext) && function_exists('dl') && !dl($dl=PHP_SHLIB_PREFIX.$ext.'.'.PHP_SHLIB_SUFFIX))
|
||||
{
|
||||
throw new Exception ("PHP extension '$ext' not loaded AND can NOT be loaded via dl('$dl')!");
|
||||
}
|
||||
check_load_extension($ext,true); // true = throw Exception
|
||||
}
|
||||
$pdo_available = true;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ $checks = array(
|
||||
'func' => 'php_ini_check',
|
||||
'value' => 7,
|
||||
'warning' => '<div class="setup_info">' . lang('The mbstring.func_overload = 7 is needed to fully support unicode (utf-8) or other multibyte-charsets.') . "</div>",
|
||||
'change' => extension_loaded('mbstring') || function_exists('dl') && @dl(PHP_SHLIB_PREFIX.'mbstring.'.PHP_SHLIB_SUFFIX) ? 'mbstring.func_overload = 7' : '',
|
||||
'change' => check_load_extension('mbstring') ? 'mbstring.func_overload = 7' : '',
|
||||
),
|
||||
'ldap' => array(
|
||||
'func' => 'extension_check',
|
||||
@ -422,7 +422,7 @@ function extension_check($name,$args)
|
||||
return True; // check only under windows
|
||||
}
|
||||
// we check for the existens of 'dl', as multithreaded webservers dont have it !!!
|
||||
$available = extension_loaded($name) || function_exists('dl') && @dl(PHP_SHLIB_PREFIX.$name.'.'.PHP_SHLIB_SUFFIX);
|
||||
$available = check_load_extension($name);
|
||||
|
||||
echo '<div>'.($available ? $passed_icon : $warning_icon).' <span'.($available ? '' : ' class="setup_warning"').'>'.lang('Checking extension %1 is loaded or loadable',$name).': '.($available ? lang('True') : lang('False'))."</span></div>\n";
|
||||
|
||||
|
@ -75,7 +75,6 @@ class setup_header
|
||||
|
||||
$GLOBALS['egw_info']['server']['show_domain_selectbox'] = false;
|
||||
$GLOBALS['egw_info']['server']['db_persistent'] = True;
|
||||
$GLOBALS['egw_info']['server']['sessions_type'] = !$this->check_load_extension('session') ? 'db' :'php4';
|
||||
$GLOBALS['egw_info']['login_template_set'] = 'idots';
|
||||
$GLOBALS['egw_info']['server']['mcrypt_enabled'] = False;
|
||||
$GLOBALS['egw_info']['server']['versions']['mcrypt'] = '';
|
||||
@ -228,15 +227,6 @@ class setup_header
|
||||
return $iv;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if a named extension is loaded or loadable
|
||||
*/
|
||||
function check_load_extension($extension)
|
||||
{
|
||||
return extension_loaded($extension) ||
|
||||
function_exists('dl') && @dl(PHP_SHLIB_PREFIX.$extension.'.'.PHP_SHLIB_SUFFIX);
|
||||
}
|
||||
|
||||
function check_db_support(&$detected)
|
||||
{
|
||||
$supported_db = $detected = array();
|
||||
@ -254,7 +244,7 @@ class setup_header
|
||||
$ext = array_shift($data);
|
||||
$func_to_check = array_shift($data);
|
||||
$name = isset($this->db_fullnames[$db]) ? $this->db_fullnames[$db] : strtoupper($db);
|
||||
if ($this->check_load_extension($ext) || $func_to_check && function_exists($func_to_check))
|
||||
if (check_load_extension($ext) || $func_to_check && function_exists($func_to_check))
|
||||
{
|
||||
$detected[] = lang('You appear to have %1 support.',$name);
|
||||
$supported_db = array_merge($supported_db,$data);
|
||||
|
Loading…
Reference in New Issue
Block a user