From 34f41362b7e53e7f91c7e4e647c5b5901c74a793 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 4 Aug 2014 16:00:58 +0000 Subject: [PATCH] 2014-08-04 Miguel de Dios * include/functions_config.php, include/functions_update_manager.php: some fixes into the update manager. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10376 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++ pandora_console/include/functions_config.php | 41 +++++++++++++------ .../include/functions_update_manager.php | 19 +++++++-- 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fb89e53fe4..a1ccfd791d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2014-08-04 Miguel de Dios + + * include/functions_config.php, + include/functions_update_manager.php: some fixes into the update + manager. + 2014-08-04 Alejandro Gallardo * general/main_menu.php: Now the submenus opened by the diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 062996a969..8e697e43d7 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -781,17 +781,31 @@ function config_process_config () { // config_update_value ('autoupdate', true); // } - require_once ($config["homedir"]."/include/auth/mysql.php"); + require_once ($config["homedir"] . "/include/auth/mysql.php"); - // Next is the directory where "/attachment" directory is placed, to upload files stores. - // This MUST be writtable by http server user, and should be in pandora root. - // By default, Pandora adds /attachment to this, so by default is the pandora console home dir + + // Next is the directory where "/attachment" directory is placed, + // to upload files stores. This MUST be writtable by http server + // user, and should be in pandora root. By default, Pandora adds + // /attachment to this, so by default is the pandora console home + // dir. if (!isset ($config['attachment_store'])) { - config_update_value ( 'attachment_store', $config['homedir'].'/attachment'); + config_update_value('attachment_store', + $config['homedir'] . '/attachment'); + } + else { + //Fixed when the user moves the pandora console to another dir + //after the first uses. + if (!is_dir($config['attachment_store'])) { + config_update_value('attachment_store', + $config['homedir'] . '/attachment'); + } } + if (!isset ($config['fontpath'])) { - config_update_value ( 'fontpath', $config['homedir'].'/include/fonts/smallfont.ttf'); + config_update_value('fontpath', + $config['homedir'] . '/include/fonts/smallfont.ttf'); } if (!isset ($config['style'])) { @@ -919,7 +933,8 @@ function config_process_config () { } if (!isset ($config['ldap_base_dn'])) { - config_update_value ( 'ldap_base_dn', 'ou=People,dc=edu,dc=example,dc=org'); + config_update_value('ldap_base_dn', + 'ou=People,dc=edu,dc=example,dc=org'); } if (!isset ($config['ldap_login_attr'])) { @@ -1030,11 +1045,11 @@ function config_process_config () { config_update_value( 'api_password', ''); } - if(defined('METACONSOLE')) { + if (defined('METACONSOLE')) { // Customizable sections (Metaconsole) enterprise_include_once ('include/functions_enterprise.php'); $customizable_sections = enterprise_hook('enterprise_get_customizable_sections'); - + if($customizable_sections != ENTERPRISE_NOT_HOOK) { foreach($customizable_sections as $k => $v) { if (!isset ($config[$k])) { @@ -1050,7 +1065,7 @@ function config_process_config () { if (!isset ($config['relative_path']) && (isset ($_POST['nick']) || isset ($config['id_user'])) && isset($config['enterprise_installed'])) { - + $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { @@ -1153,7 +1168,8 @@ function config_process_config () { } if (!isset($config['custom_report_front_logo'])) { - config_update_value ('custom_report_front_logo', 'images/pandora_logo_white.jpg'); + config_update_value ('custom_report_front_logo', + 'images/pandora_logo_white.jpg'); } if (!isset($config['custom_report_front_header'])) { @@ -1161,7 +1177,8 @@ function config_process_config () { } if (!isset($config['custom_report_front_firstpage'])) { - config_update_value ('custom_report_front_firstpage', "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . ui_get_full_url(false, false, false, false) . "/images/pandora_report_logo.png" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"); + config_update_value ('custom_report_front_firstpage', + "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . ui_get_full_url(false, false, false, false) . "/images/pandora_report_logo.png" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"); } if (!isset($config['custom_report_front_footer'])) { diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index 3814f55c8b..bc324f719e 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -73,10 +73,12 @@ function update_manager_get_config_values() { function rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); + foreach ($objects as $object) { if ($object != "." && $object != "..") { - if (filetype($dir."/".$object) == "dir") - rrmdir($dir."/".$object); else unlink($dir."/".$object); + if (filetype($dir . "/" . $object) == "dir") + rrmdir($dir . "/" . $object); + else unlink($dir . "/" . $object); } } reset($objects); @@ -373,8 +375,10 @@ function update_manager_starting_update() { "/downloads/last_package.tgz"; try { + rrmdir($config['attachment_store'] . + "/downloads/temp_update/pandora_console"); + $phar = new PharData($path_package); - rrmdir($config['attachment_store'] . "/downloads/temp_update/pandora_console"); $phar->extractTo($config['attachment_store'] . "/downloads/temp_update"); } catch (Exception $e) { @@ -395,7 +399,14 @@ function update_manager_starting_update() { array('value' => 50), array('token' => 'progress_update')); - $full_path = $config['attachment_store'] . "/downloads/temp_update/pandora_console"; + $path_array = array('downloads', 'temp_update', 'pandora_console'); + $full_path = $config['attachment_store']; + foreach ($path_array as $directory) { + $full_path = $full_path . '/' . $directory; + if (!is_dir($full_path)) { + mkdir($full_path); + } + } $homedir = $config['homedir'];