diff --git a/includes/functions.php b/includes/functions.php index e04d36c..ab90286 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -85,8 +85,8 @@ function initialize() { $configarray = $_SESSION['configarray']; // timeout - if( !ini_get('safe_mode') && ini_get('max_execution_time') != $configarray["timeout"]) { - ini_set('max_execution_time', $configarray["timeout"]); + if( !ini_get('safe_mode') && ini_get('max_execution_time') != $configarray["settings"]["timeout"]) { + ini_set('max_execution_time', $configarray["settings"]["timeout"]); } // set defaults if vars are empty @@ -1318,7 +1318,7 @@ function getConfigArray() { global $conn; $retArray = array(); - //Navigation + // Navigation $query = "SELECT * from cfg_mainmenu"; $mainmenutablerows = fetchArrayDB($query, $conn); @@ -1387,7 +1387,7 @@ function getConfigArray() { $adminmenuarray["q=logout"] = "Logout"; $retArray["adminmenuarray"] = $adminmenuarray; - //Overview Boxes + // Overview Boxes $ret = array(); $query = "SELECT * from cfg_overviewboxes order by sortorder asc"; @@ -1405,7 +1405,7 @@ function getConfigArray() { } $retArray["infoboxarray"] = $ret; - //Queries + // Queries $dbret = array(); $query = "SELECT * from cfg_queries"; $querytablerows = fetchArrayDB($query, $conn); @@ -1414,17 +1414,21 @@ function getConfigArray() { } $retArray["queryarray"] = $dbret; - // Set Timeout - $query = "SELECT * from cfg_config where confkey='timeout'"; - $row = fetchArrayDB($query, $conn); - $retArray["timeout"] = $row[0]['confval']; + // General settings + $query = "SELECT * from cfg_config"; + $rows = fetchArrayDB($query, $conn); + $ret = array(); + foreach ($rows as $key => $val) { + $ret[$val['confkey']] = $val['confval']; + } + $retArray["settings"] = $ret; // Set Stylesheet $query = "SELECT stylesheet from cfg_users where username='".$_SESSION["logindata"]["user"]."'"; $row = fetchArrayDB($query, $conn); $retArray["stylesheet"] = $row[0]['stylesheet']; - //Colors + // Colors $query = "SELECT * from cfg_colors"; $rows = fetchArrayDB($query, $conn); @@ -1451,6 +1455,22 @@ function getConfigArray() { } +/** + * findPath - find a external program in the search path + * + * @param string $binary the external program to search for + * @param string $search_path the search path in which to look for the external program + * @return string the full path to the external program or empty string if not found + */ +function findPath($binary, $search_path) { + foreach ($search_path as $path) { + if ((file_exists($path . "/" . $binary)) && (is_readable($path . "/" . $binary))) { + return($path . "/" . $binary); + } + } +} + + /** * connectDB - establish a DB connection via ADODB * @@ -1670,7 +1690,7 @@ function fetchSplitArrayDB($sql, $DBconn = FALSE, $rows_per_page = '20') { * @return string Auto-increment ID if insert was performed */ function updateDB($table, $cells, $keys, $DBconn = FALSE, $autoquote = TRUE) { -// $DBconn->debug = true; + //$DBconn->debug = true; $DBconn->Replace($table, $cells, $keys, $autoquote); return $DBconn->Insert_ID(); diff --git a/includes/global.php b/includes/global.php index 30d6dd4..f0aeca2 100644 --- a/includes/global.php +++ b/includes/global.php @@ -57,7 +57,18 @@ $config = array(); // ** Current TSM Monitor version ** // $config["tsm_monitor_version"] = '0.1.0'; +// ** Set TSM Monitor server OS to a general value (only 'unix' or 'win32') ** // +$config["server_os"] = (strstr(PHP_OS, "WIN")) ? "win32" : "unix"; + +// ** Search paths for external programs (dsmadmc, php, ...) ** // +if ($config["server_os"] == "win32") { + $config["search_path"] = array('c:/php', 'c:/progra~1/php', 'd:/php', 'd:/progra~1/php', 'c:/progra~1/tivoli/tsm/baclient', 'd:/progra~1/tivoli/tsm/baclient'); +} elseif ($config["server_os"] == "unix") { + $config["search_path"] = array('/bin', '/sbin', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin', '/usr/tivoli/tsm/client/admin/bin', '/opt/tivoli/tsm/client/ba/bin'); +} + // ** Paths (libraries, includes, ...) ** // +$config["base_path"] = ereg_replace("(.*[\\\/])includes", "\\1", dirname(__FILE__)); $config["library_path"] = ereg_replace("(.*[\\\/])includes", "\\1extlib", dirname(__FILE__)); $config["include_path"] = dirname(__FILE__); diff --git a/install.php b/install.php index 6464353..11a9adb 100644 --- a/install.php +++ b/install.php @@ -29,13 +29,37 @@ */ include_once "includes/global.php"; -if ($_REQUEST["step"] != "30" && $_REQUEST["step"] != "40") { +if ($_REQUEST["step"] != "50" || $_REQUEST["refresh"] != "") { include_once "includes/page_head.php"; } // allow the upgrade script to run for as long as it needs to ini_set("max_execution_time", "0"); +// check if the necessary PHP extensions are loaded +$exts = array("session", "sockets"); +$ext_load = true; +foreach ($exts as $ext) { + if (!extension_loaded($ext)){ + $ext_load = false; + $ext_miss .= "
Error
+The following PHP extensions are missing:
+Please install those PHP extensions and retry the installation process.
+ + +