From 5de7e68671d76877074d29e8c284434aa72dfa23 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Wed, 9 Apr 2025 16:58:45 +0000 Subject: [PATCH] remove dbInfo.php, CORE #38 --- gulliver/bin/tasks/templates/dbInfo.php.tpl | 138 ------------------ gulliver/bin/tasks/templates/dbInfo.xml.tpl | 43 ------ .../bin/tasks/templates/sysGeneric.php.tpl | 2 +- workflow/engine/PmBootstrap.php | 1 - workflow/public_html/sysGeneric.php | 42 +++--- 5 files changed, 19 insertions(+), 207 deletions(-) delete mode 100644 gulliver/bin/tasks/templates/dbInfo.php.tpl delete mode 100644 gulliver/bin/tasks/templates/dbInfo.xml.tpl diff --git a/gulliver/bin/tasks/templates/dbInfo.php.tpl b/gulliver/bin/tasks/templates/dbInfo.php.tpl deleted file mode 100644 index b8085d502..000000000 --- a/gulliver/bin/tasks/templates/dbInfo.php.tpl +++ /dev/null @@ -1,138 +0,0 @@ - '; - //if( eregi('[a-zA-Z]', $target) ) - if (preg_match('[a-zA-Z]', $target)) { //Made compatible to PHP 5.3 - $ntarget = gethostbyname($target); - } else { - $ntarget = gethostbyaddr($target); - } - $msg .= $ntarget; - return($msg); -} - - function getDbServicesAvailables() - { - $servicesAvailables = array(); - - $dbServices = array( - 'mysql' => array( - 'id' => 'mysql', - 'command' => 'mysqli_connect', - 'name' => 'MySql' - ), - 'pgsql' => array( - 'id' => 'pgsql', - 'command' => 'pg_connect', - 'name' => 'PostgreSQL' - ), - 'mssql' => array( - 'id' => 'mssql', - 'command' => 'mssql_connect', - 'name' => 'Microsoft SQL Server'), - 'oracle'=> array( - 'id' => 'oracle', - 'command' => 'oci_connect', - 'name' => 'Oracle' - ), - 'informix'=> array( - 'id' => 'informix', - 'command' => 'ifx_connect', - 'name' => 'Informix' - ), - 'sqlite' => array( - 'id' => 'sqlite', - 'command' => 'sqlite_open', - 'name' => 'SQLite' - ) - ); - - foreach ($dbServices as $service) { - if (@function_exists($service['command'])) { - $servicesAvailables[] = $service; - } - } - return $servicesAvailables; - } - - function getDbServerVersion($driver) - { - try { - switch ($driver) { - case 'mysql': - $results = \Illuminate\Support\Facades\DB::select(rawQuery("select version()")); - - preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $results[0]->{'version()'}, $version); - - $v = $version[0]; - break; - } - return (isset($v))?$v:'none'; - } catch (Exception $e) { - return ($e->getMessage()); - } - } - - if (file_exists(PATH_METHODS . 'login/version-{projectName}.php')) { - include('version-{projectName}.php'); - } else { - define('PRG_VERSION', 'Development Version'); - } - - if (getenv('HTTP_CLIENT_IP')) { - $ip = getenv('HTTP_CLIENT_IP'); - } elseif (getenv('HTTP_X_FORWARDED_FOR')) { - $ip = getenv('HTTP_X_FORWARDED_FOR'); - } else { - $ip = getenv('REMOTE_ADDR'); - } - - $redhat = ''; - if (file_exists('/etc/redhat-release')) { - $fnewsize = filesize('/etc/redhat-release'); - $fp = fopen('/etc/redhat-release', 'r'); - $redhat = fread($fp, $fnewsize); - fclose($fp); - } - - $redhat .= " (" . PHP_OS . ")"; - - //$dbNetView = new NET(DB_HOST); - //$dbNetView->loginDbServer(DB_USER, DB_PASS); - - $availdb = ''; - foreach (getDbServicesAvailables() as $key => $val) { - if ($availdb != '') { - $availdb .= ', '; - } - $availdb .= $val['name']; - } - - $Fields['SYSTEM'] = $redhat; - $Fields['DATABASE'] = 'MySql (Version ' . getDbServerVersion('mysql') .')'; - $Fields['DATABASE_SERVER'] = DB_HOST; - $Fields['DATABASE_NAME'] = DB_NAME; - $Fields['PHP'] = phpversion(); - $Fields['FLUID'] = PRG_VERSION; - $Fields['IP'] = lookup($ip); - $Fields['ENVIRONMENT'] = SYS_SYS; - $Fields['SERVER_SOFTWARE'] = getenv('SERVER_SOFTWARE'); - $Fields['SERVER_NAME'] = getenv('SERVER_NAME'); - $Fields['AVAILABLE_DB'] = $availdb; - $Fields['SERVER_PROTOCOL'] = getenv('SERVER_PROTOCOL'); - $Fields['SERVER_PORT'] = getenv('SERVER_PORT'); - $Fields['REMOTE_HOST'] = getenv('REMOTE_HOST'); - $Fields['SERVER_ADDR'] = getenv('SERVER_ADDR'); - $Fields['HTTP_USER_AGENT'] = getenv('HTTP_USER_AGENT'); - - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/dbInfo', '', $Fields); - G::RenderPage('publish', 'raw'); diff --git a/gulliver/bin/tasks/templates/dbInfo.xml.tpl b/gulliver/bin/tasks/templates/dbInfo.xml.tpl deleted file mode 100644 index acb4df45e..000000000 --- a/gulliver/bin/tasks/templates/dbInfo.xml.tpl +++ /dev/null @@ -1,43 +0,0 @@ - - - - System Information - - - {projectName} - - - Operating System - - - - Web Server - - - Server Name - - - Server IP Address - - - PHP version - - - Database - - - Database Server IP Address - - - Database Name - - - Available Databases - - - User's Browser - - - User's Ip Address - - \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/sysGeneric.php.tpl b/gulliver/bin/tasks/templates/sysGeneric.php.tpl index 36da20d20..8d290addb 100644 --- a/gulliver/bin/tasks/templates/sysGeneric.php.tpl +++ b/gulliver/bin/tasks/templates/sysGeneric.php.tpl @@ -312,7 +312,7 @@ $docuroot = explode ( PATH_SEP , $_SERVER['DOCUMENT_ROOT'] ); else { //This sentence is used when you lost the Session if ( SYS_TARGET != 'authentication' and SYS_TARGET != 'login' - and SYS_TARGET != 'dbInfo' and SYS_TARGET != 'sysLoginVerify' + and SYS_TARGET != 'sysLoginVerify' and SYS_TARGET != 'updateTranslation' and SYS_COLLECTION != 'services' ){ header ("location: ".SYS_URI."login/login.php"); die(); diff --git a/workflow/engine/PmBootstrap.php b/workflow/engine/PmBootstrap.php index 4f38b2eec..19effb867 100644 --- a/workflow/engine/PmBootstrap.php +++ b/workflow/engine/PmBootstrap.php @@ -288,7 +288,6 @@ class PmBootstrap extends Bootstrap $noLoginFiles[] = 'login'; $noLoginFiles[] = 'authentication'; $noLoginFiles[] = 'login_Ajax'; - $noLoginFiles[] = 'dbInfo'; $noLoginFiles[] = 'sysLoginVerify'; $noLoginFiles[] = 'processes_Ajax'; $noLoginFiles[] = 'updateTranslation'; diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index d2b6da7c9..00f32c219 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -542,30 +542,25 @@ if (defined('SYS_TEMP') && SYS_TEMP != '') { require_once($phpFile); die(); } else { - if (SYS_TARGET == "dbInfo") { //Show dbInfo when no SYS_SYS - $pathFile = PATH_METHODS . "login/dbInfo.php"; - require_once($pathFile); - } else { - if (substr(SYS_SKIN, 0, - 2) === 'ux' && SYS_TARGET != 'sysLoginVerify') { // new ux sysLogin - extjs based form - $pathFile = PATH_CONTROLLERS . 'main.php'; - require_once $pathFile; - $controllerClass = 'Main'; - $controllerAction = SYS_TARGET == 'sysLoginVerify' ? SYS_TARGET : 'sysLogin'; - //if the method exists - if (method_exists( - $controllerClass, - $controllerAction - )) { - $controller = new $controllerClass(); - $controller->setHttpRequestData($_REQUEST); - $controller->call($controllerAction); - } - } else { // classic sysLogin interface - $pathFile = PATH_METHODS . "login/sysLogin.php"; - require_once($pathFile); - die(); + if (substr(SYS_SKIN, 0, + 2) === 'ux' && SYS_TARGET != 'sysLoginVerify') { // new ux sysLogin - extjs based form + $pathFile = PATH_CONTROLLERS . 'main.php'; + require_once $pathFile; + $controllerClass = 'Main'; + $controllerAction = SYS_TARGET == 'sysLoginVerify' ? SYS_TARGET : 'sysLogin'; + //if the method exists + if (method_exists( + $controllerClass, + $controllerAction + )) { + $controller = new $controllerClass(); + $controller->setHttpRequestData($_REQUEST); + $controller->call($controllerAction); } + } else { // classic sysLogin interface + $pathFile = PATH_METHODS . "login/sysLogin.php"; + require_once($pathFile); + die(); } if (DEBUG_TIME_LOG) { Bootstrap::logTimeByPage(); @@ -873,7 +868,6 @@ if (!defined('EXECUTE_BY_CRON')) { $noLoginFiles[] = 'authentication'; $noLoginFiles[] = 'authenticationSso'; $noLoginFiles[] = 'login_Ajax'; - $noLoginFiles[] = 'dbInfo'; $noLoginFiles[] = 'sysLoginVerify'; $noLoginFiles[] = 'processes_Ajax'; $noLoginFiles[] = 'showLogoFile';