several fixes around jpgraph:

- fixed wrongly reported jpgraph path "/jpgraph", if open_basedir is active and parent of EGroupware dir not accessible
- detect if jpgraph.php is direct in jpraph directory or in src subdirectory
- allow to specifiy arbitrary jpgraph path via defining EGW_JPGRAPH_PATH (eg. in header.inc.php)
--> should fix most jpgraph related issues
This commit is contained in:
Ralf Becker 2010-09-25 07:46:37 +00:00
parent 867b8a66f6
commit ebb491c071

View File

@ -9,7 +9,6 @@
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
$run_by_webserver = !!$_SERVER['PHP_SELF'];
$is_windows = strtoupper(substr(PHP_OS,0,3)) == 'WIN';
@ -44,6 +43,7 @@ else
return is_null($arg1) ? $msg : str_replace(array('%1','%2','%3','%4'),array($arg1,$arg2,$arg3,$arg4),$msg);
}
}
$checks = array(
'phpversion' => array(
'func' => 'php_version',
@ -737,6 +737,50 @@ function php_ini_check($name,$args)
return $result;
}
function jpgraph_check($name,array $args)
{
global $passed_icon, $error_icon, $warning_icon;
$egw_path = defined(EGW_SERVER_ROOT) ? EGW_SERVER_ROOT : dirname(dirname(__FILE__));
if (!($jpgraph_path = realpath($egw_path.'/..')))
{
$jpgraph_path = dirname($egw_path); // realpath can fail because eg. open_basedir does NOT include ..
}
$jpgraph_path .= SEP.'jpgraph';
$min_version = isset($args['min_version']) ? $args['min_version'] : '1.13';
$available = false;
if (($check = file_exists($jpgraph_path) && is_dir($jpgraph_path)) &&
(file_exists($jpgraph_path.'/src/jpgraph.php') || file_exists($jpgraph_path.'/jpgraph.php')))
{
if (file_exists($jpgraph_path.'/VERSION') && preg_match('/Version: v([0-9.]+)/',file_get_contents($jpgraph_path.'/VERSION'),$matches))
{
$version = $matches[1];
$available = version_compare($version,$min_version,'>=');
}
else
{
$version = 'unknown';
}
}
echo "<div>".($available ? $passed_icon : (isset($version) ? $warning_icon : $error_icon)).
' <span'.($available?'':' class="setup_warning"').'>'.
lang('Checking for JPGraph in %1',$jpgraph_path).': '.
(isset($version) ? lang('Version').' '.$version : lang('False'));
if (!$available)
{
echo "<br />\n".lang('You dont have JPGraph version %1 or higher installed! It is needed from ProjectManager for Ganttcharts.',$min_version)."<br />\n";
echo lang('Please download a recent version from %1 and install it as %2.',
'<a href="http://jpgraph.net/download/" target="_blank">jpgraph.net/download/</a>',
$jpgraph_path);
}
echo "</span></div>\n";
return $available;
}
function get_php_ini()
{
ob_start();
@ -831,7 +875,7 @@ if ($run_by_webserver)
{
echo lang('Please fix the above errors (%1) and warnings(%2)',$error_icon,$warning_icon).'. ';
}
echo '<br /><a href="'.str_replace('check_install.php','',$_SERVER['HTTP_REFERER']).'">'.lang('Return to Setup')."</a></h3>\n";
echo '<br /><a href="'.str_replace('check_install.php','',@$_SERVER['HTTP_REFERER']).'">'.lang('Return to Setup')."</a></h3>\n";
}
$setup_tpl->pparse('out','T_footer');
//echo "</body>\n</html>\n";