diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0f5bfa75ee..fbc5bc9609 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,28 @@ +2011-05-10 Juan Manuel Ramon + + * include/functions_io.php + include/config_process.php + include/functions_extensions.php + index.php + extensions/insert_data.php + extensions/system_info.php + extensions/extension_uploader.php + extensions/pandora_logs.php + extensions/agents_modules.php + extensions/update_manager.php + extensions/ssh_console.php + extensions/dbmanager.php + extensions/vnc_view.php + extensions/resource_registration.php + extensions/resource_exportation.php + extensions/users_connected.php + extensions/module_groups.php + extensions/plugin_registration.php + godmode/extensions.php: functions in + functions_extensions.php have "extensions_" prefix. + * install.php: Drop database action is not allowed when installation + it's performed over a new database. + 2011-05-11 Miguel de Dios * include/functions_agents.php: added hooks for to enterprise ACL. diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 2e59494d5d..4d34cb0592 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -308,8 +308,8 @@ function mainAgentsModules() { "

"; } -add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png'); -add_extension_main_function('mainAgentsModules'); +extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png'); +extensions_add_main_function('mainAgentsModules'); ?> diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 49b2d8e842..dbf8d5e505 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -147,9 +147,9 @@ function dbmgr_extension_main () { } /* This adds a option in the operation menu */ -add_godmode_menu_option (__('DB interface'), 'PM','gdbman',"dbmanager/icon.png"); +extensions_add_godmode_menu_option (__('DB interface'), 'PM','gdbman',"dbmanager/icon.png"); /* This sets the function to be called when the extension is selected in the operation menu */ -add_extension_godmode_function ('dbmgr_extension_main'); +extensions_add_godmode_function ('dbmgr_extension_main'); ?> diff --git a/pandora_console/extensions/extension_uploader.php b/pandora_console/extensions/extension_uploader.php index da88f5a4ba..ed0aa49ecf 100644 --- a/pandora_console/extensions/extension_uploader.php +++ b/pandora_console/extensions/extension_uploader.php @@ -67,6 +67,6 @@ function extension_uploader_extensions() { echo ""; } -add_godmode_menu_option(__('Extension uploader'), 'AM', 'gextensions'); -add_extension_godmode_function('extension_uploader_extensions'); +extensions_add_godmode_menu_option(__('Extension uploader'), 'AM', 'gextensions'); +extensions_add_godmode_function('extension_uploader_extensions'); ?> diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index ab99632f7f..aa4f5fef62 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -227,6 +227,6 @@ function mainInsertData() { diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 8f01fcc947..c1452daba2 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -275,6 +275,6 @@ function mainModuleGroups() { diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index 0dc4fb81c2..538b6a6dc1 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -56,7 +56,7 @@ function pandoralogs_extension_main () { view_logfile ("/var/log/pandora/pandora_server.error"); } -add_godmode_menu_option (__('System logfiles'), 'PM','glog',""); -add_extension_godmode_function('pandoralogs_extension_main'); +extensions_add_godmode_menu_option (__('System logfiles'), 'PM','glog',""); +extensions_add_godmode_function('pandoralogs_extension_main'); ?> diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index 9a4008894b..a682850b0e 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -160,7 +160,7 @@ function pluginreg_extension_main () { } -add_godmode_menu_option (__('Register plugin'), 'PM','gservers',''); -add_extension_godmode_function('pluginreg_extension_main'); +extensions_add_godmode_menu_option (__('Register plugin'), 'PM','gservers',''); +extensions_add_godmode_function('pluginreg_extension_main'); ?> diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index ef45ffa392..80e896e613 100644 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -58,8 +58,8 @@ if (isset($_GET['get_ptr'])) { } } else { - add_godmode_menu_option (__('Resource exportation'), 'PM','gservers',''); - add_extension_godmode_function('resource_exportation_extension_main'); + extensions_add_godmode_menu_option (__('Resource exportation'), 'PM','gservers',''); + extensions_add_godmode_function('resource_exportation_extension_main'); } function output_xml_resource($hook_enterprise) { diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index cc5fe19064..46fb1e5a22 100644 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -858,6 +858,6 @@ function resource_registration_extension_main() { process_upload_xml($xml); } -add_godmode_menu_option (__('Resource registration'), 'PM','gservers',''); -add_extension_godmode_function('resource_registration_extension_main'); +extensions_add_godmode_menu_option (__('Resource registration'), 'PM','gservers',''); +extensions_add_godmode_function('resource_registration_extension_main'); ?> diff --git a/pandora_console/extensions/ssh_console.php b/pandora_console/extensions/ssh_console.php index 342e44c277..a59b3376f5 100644 --- a/pandora_console/extensions/ssh_console.php +++ b/pandora_console/extensions/ssh_console.php @@ -14,7 +14,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -add_extension_opemode_tab_agent ('ssh_console','SSH Console','extensions/ssh_console/ssh.png',"main_ssh_console"); +extensions_add_opemode_tab_agent ('ssh_console','SSH Console','extensions/ssh_console/ssh.png',"main_ssh_console"); function main_ssh_console () { diff --git a/pandora_console/extensions/system_info.php b/pandora_console/extensions/system_info.php index f3236b325d..c775af365d 100644 --- a/pandora_console/extensions/system_info.php +++ b/pandora_console/extensions/system_info.php @@ -613,8 +613,8 @@ function consoleMode() { if (!isset($argv)) { //Execution across the browser - add_extension_godmode_function('mainSystemInfo'); - add_godmode_menu_option(__('System Info'), 'PM', 'gsetup'); + extensions_add_godmode_function('mainSystemInfo'); + extensions_add_godmode_menu_option(__('System Info'), 'PM', 'gsetup'); } else { $dir = dirname($_SERVER['PHP_SELF']); diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index 6781ef1c8f..e3cd265243 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -153,11 +153,11 @@ function pandora_update_manager_godmode () { if(isset($config['id_user'])) { if (check_acl($config['id_user'], 0, "PM")) { - add_operation_menu_option (__('Update manager')); - add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup'); - add_extension_main_function ('pandora_update_manager_main'); - add_extension_godmode_function ('pandora_update_manager_godmode'); - add_extension_login_function ('pandora_update_manager_login'); + extensions_add_operation_menu_option (__('Update manager')); + extensions_add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup'); + extensions_add_main_function ('pandora_update_manager_main'); + extensions_add_godmode_function ('pandora_update_manager_godmode'); + extensions_add_login_function ('pandora_update_manager_login'); } } diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index fedd940a9f..89797cc352 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -88,15 +88,15 @@ function users_extension_main_god ($god = true) { html_print_table ($table); } } -add_godmode_menu_option (__('Users connected'), 'UM','gusuarios',"users/icon.png"); +extensions_add_godmode_menu_option (__('Users connected'), 'UM','gusuarios',"users/icon.png"); if (isset($config["id_user"])) { if (check_acl ($config["id_user"], 0, "UM")) { - add_operation_menu_option(__('Users connected'), 'usuarios',"users/icon.png"); + extensions_add_operation_menu_option(__('Users connected'), 'usuarios',"users/icon.png"); } } -add_extension_godmode_function('users_extension_main_god'); -add_extension_main_function('users_extension_main'); +extensions_add_godmode_function('users_extension_main_god'); +extensions_add_main_function('users_extension_main'); ?> diff --git a/pandora_console/extensions/vnc_view.php b/pandora_console/extensions/vnc_view.php index 7d49d72d07..1207fd8590 100644 --- a/pandora_console/extensions/vnc_view.php +++ b/pandora_console/extensions/vnc_view.php @@ -27,5 +27,5 @@ function vnc_view() { /* */ } -add_extension_opemode_tab_agent('vnc_view', __('VNC view'), 'images/computer.png', 'vnc_view'); +extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/computer.png', 'vnc_view'); ?> diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index 2ba6234608..cea36a2c77 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -27,7 +27,7 @@ if (! check_acl ($config['id_user'], 0, "PM")) { ui_print_page_header (__('Extensions'). " » ". __('Defined extensions'), "images/extensions.png", false, "", true, "" ); if (sizeof ($config['extensions']) == 0) { - $extensions = getExtensionInfo(); + $extensions = extensions_get_extension_info(); if (empty($extensions)) { echo '

'.__('There are no extensions defined').'

'; return; @@ -139,7 +139,7 @@ if ($disabled != '') { width = '95%'; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 076dad0c0f..7cada4da2d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -126,7 +126,7 @@ if (file_exists ($config["homedir"] . '/include/languages/'.$config["user_langu require_once ($ownDir . 'functions_extensions.php'); -$config['extensions'] = get_extensions (); +$config['extensions'] = extensions_get_extensions (); // Detect if enterprise extension is installed // NOTICE: This variable (config[enterprise_installed] is used in several diff --git a/pandora_console/include/functions_extensions.php b/pandora_console/include/functions_extensions.php index 99e4661e99..d01224bee9 100644 --- a/pandora_console/include/functions_extensions.php +++ b/pandora_console/include/functions_extensions.php @@ -27,7 +27,7 @@ $extension_file = ''; * * @param string $filename with contents of the extension */ -function extension_call_main_function ($filename) { +function extensions_call_main_function ($filename) { global $config; $extension = &$config['extensions'][$filename]; @@ -42,7 +42,7 @@ function extension_call_main_function ($filename) { * * @param string $filename File with extension contents */ -function extension_call_godmode_function ($filename) { +function extensions_call_godmode_function ($filename) { global $config; $extension = &$config['extensions'][$filename]; @@ -71,7 +71,7 @@ function extensions_call_login_function () { * * @param string $page To check */ -function is_extension ($page) { +function extensions_is_extension ($page) { global $config; $filename = basename ($page); @@ -84,7 +84,7 @@ function is_extension ($page) { * * @param bool $enterprise */ -function get_extensions ($enterprise = false) { +function extensions_get_extensions ($enterprise = false) { $dir = EXTENSIONS_DIR; $handle = false; if ($enterprise) @@ -123,7 +123,7 @@ function get_extensions ($enterprise = false) { /* Load extensions in enterprise directory */ if (! $enterprise && file_exists (ENTERPRISE_DIR.'/'.EXTENSIONS_DIR)) - return array_merge ($extensions, get_extensions (true)); + return array_merge ($extensions, extensions_get_extensions (true)); return $extensions; } @@ -131,7 +131,7 @@ function get_extensions ($enterprise = false) { /** * Get disabled open and enterprise extensions */ -function get_disabled_extensions() { +function extensions_get_disabled_extensions() { global $config; $extensions = array (); @@ -167,37 +167,37 @@ function get_disabled_extensions() { $data = array(); $data['operation_menu'] = false; - if (preg_match("//", $content)) { + if (preg_match("//", $content)) { $data['operation_menu'] = true; } $data['godmode_menu'] = false; - if (preg_match('/<\?php(\n|.)*add_godmode_menu_option(\n|.)*\?>/', $content)) { + if (preg_match('/<\?php(\n|.)*extensions_add_godmode_menu_option(\n|.)*\?>/', $content)) { $data['godmode_menu'] = true; } $data['operation_function'] = false; - if (preg_match('/<\?php(\n|.)*add_extension_main_function(\n|.)*\?>/', $content)) { + if (preg_match('/<\?php(\n|.)*extensions_add_main_function(\n|.)*\?>/', $content)) { $data['operation_function'] = true; } $data['login_function'] = false; - if (preg_match('/<\?php(\n|.)*add_extension_login_function(\n|.)*\?>/', $content)) { + if (preg_match('/<\?php(\n|.)*extensions_add_login_function(\n|.)*\?>/', $content)) { $data['login_function'] = true; } $data['extension_ope_tab'] = false; - if (preg_match('/<\?php(\n|.)*add_extension_opemode_tab_agent(\n|.)*\?>/', $content)) { + if (preg_match('/<\?php(\n|.)*extensions_add_opemode_tab_agent(\n|.)*\?>/', $content)) { $data['extension_ope_tab'] = true; } $data['extension_god_tab'] = false; - if (preg_match('/<\?php(\n|.)*add_extension_godmode_tab_agent(\n|.)*\?>/', $content)) { + if (preg_match('/<\?php(\n|.)*extensions_add_godmode_tab_agent(\n|.)*\?>/', $content)) { $data['extension_god_tab'] = true; } $data['godmode_function'] = false; - if (preg_match('/<\?php(\n|.)*add_extension_godmode_function(\n|.)*\?>/', $content)) { + if (preg_match('/<\?php(\n|.)*extensions_add_godmode_function(\n|.)*\?>/', $content)) { $data['godmode_function'] = true; } @@ -220,7 +220,7 @@ function get_disabled_extensions() { /** * Get info of all extensions (enabled/disabled) */ -function getExtensionInfo() { +function extensions_get_extension_info() { global $config; $return = array (); @@ -269,7 +269,7 @@ function getExtensionInfo() { $return[$extension['file']] = $data; } - $return = $return + get_disabled_extensions(); + $return = $return + extensions_get_disabled_extensions(); return $return; } @@ -279,7 +279,7 @@ function getExtensionInfo() { * * @param array $extensions */ -function load_extensions ($extensions) { +function extensions_load_extensions ($extensions) { global $config; global $extension_file; @@ -296,11 +296,11 @@ function load_extensions ($extensions) { * @param string fatherId Id of the parent menu item for the current extension * @param string icon Path to the icon image (18x18 px). If this parameter is blank then predefined icon will be used */ -function add_operation_menu_option ($name, $fatherId = null, $icon = null) { +function extensions_add_operation_menu_option ($name, $fatherId = null, $icon = null) { global $config; global $extension_file; - /* $config['extension_file'] is set in load_extensions(), since that function must + /* $config['extension_file'] is set in extensions_load_extensions(), since that function must be called before any function the extension call, we are sure it will be set. */ $option_menu['name'] = $name; @@ -320,11 +320,11 @@ function add_operation_menu_option ($name, $fatherId = null, $icon = null) { * @param string fatherId Id of the parent menu item for the current extension * @param string icon Path to the icon image (18x18 px). If this parameter is blank then predefined icon will be used */ -function add_godmode_menu_option ($name, $acl, $fatherId = null, $icon = null) { +function extensions_add_godmode_menu_option ($name, $acl, $fatherId = null, $icon = null) { global $config; global $extension_file; - /* $config['extension_file'] is set in load_extensions(), since that function must + /* $config['extension_file'] is set in extensions_load_extensions(), since that function must be called before any function the extension call, we are sure it will be set. */ $option_menu['acl'] = $acl; @@ -344,7 +344,7 @@ function add_godmode_menu_option ($name, $acl, $fatherId = null, $icon = null) { * @param tabIcon Path to the image icon * @param tabFunction Name of the function to execute when this extension is called */ -function add_extension_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction) { +function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction) { global $config; global $extension_file; @@ -364,7 +364,7 @@ function add_extension_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunctio * @param tabIcon Path to the image icon * @param tabFunction Name of the function to execute when this extension is called */ -function add_extension_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction) { +function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction) { global $config; global $extension_file; @@ -381,7 +381,7 @@ function add_extension_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunctio * * @param string $function_name Callback function name */ -function add_extension_main_function ($function_name) { +function extensions_add_main_function ($function_name) { global $config; global $extension_file; @@ -394,7 +394,7 @@ function add_extension_main_function ($function_name) { * * @param string $function_name Callback function name */ -function add_extension_godmode_function ($function_name) { +function extensions_add_godmode_function ($function_name) { global $config; global $extension_file; @@ -407,7 +407,7 @@ function add_extension_godmode_function ($function_name) { * * @param string $function_name Callback function name */ -function add_extension_login_function ($function_name) { +function extensions_add_login_function ($function_name) { global $config; global $extension_file; diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index bb2cd33333..2646c26368 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -322,7 +322,7 @@ function io_unsafe_string ($string) { function __ ($string /*, variable arguments */) { global $l10n; - $extensions = get_extensions(); + $extensions = extensions_get_extensions(); if (empty($extensions)) $extensions = array(); global $config; diff --git a/pandora_console/index.php b/pandora_console/index.php index f1829a12b7..461a55dea3 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -70,7 +70,7 @@ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) { /** * Load the basic configurations of extension and add extensions into menu. */ -load_extensions ($config['extensions']); +extensions_load_extensions ($config['extensions']); if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) { $query = 'https://' . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; @@ -258,14 +258,14 @@ else { require ("general/noaccess.php"); } elseif (file_exists ($page)) { - if (! is_extension ($page)){ + if (! extensions_is_extension ($page)){ require_once($page); } else { if ($sec[0] == 'g') - extension_call_godmode_function (basename ($page)); + extensions_call_godmode_function (basename ($page)); else - extension_call_main_function (basename ($page)); + extensions_call_main_function (basename ($page)); } } else echo '
'.__('Sorry! I can\'t find the page!').''; diff --git a/pandora_console/install.php b/pandora_console/install.php index b235a4bf9a..cad5b0583e 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -36,7 +36,7 @@ options_text = new Array('An existing Database','A new Database'); options_values = new Array('db_exist','db_new'); function ChangeDBDrop(causer) { - if (causer.value != 'db_exist' && window.document.step2_form.engine.value != 'mysql') { + if (causer.value != 'db_exist') { window.document.step2_form.drop.checked=0; window.document.step2_form.drop.disabled=1; } @@ -604,7 +604,7 @@ function install_step3() {
DB Name (pandora by default)
- + Drop Database if exists
Full path to HTTP publication directory