diff --git a/setup/check_install.php b/setup/check_install.php index e8339b2268..eaa43e36d0 100644 --- a/setup/check_install.php +++ b/setup/check_install.php @@ -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 "
".($available ? $passed_icon : (isset($version) ? $warning_icon : $error_icon)). + ' '. + lang('Checking for JPGraph in %1',$jpgraph_path).': '. + (isset($version) ? lang('Version').' '.$version : lang('False')); + + if (!$available) + { + echo "
\n".lang('You dont have JPGraph version %1 or higher installed! It is needed from ProjectManager for Ganttcharts.',$min_version)."
\n"; + echo lang('Please download a recent version from %1 and install it as %2.', + 'jpgraph.net/download/', + $jpgraph_path); + } + echo "
\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 '
'.lang('Return to Setup')."\n"; + echo '
'.lang('Return to Setup')."\n"; } $setup_tpl->pparse('out','T_footer'); //echo "\n\n";