2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* 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. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4336 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-05-11 12:15:14 +00:00
parent 2e140d4939
commit 566685548d
21 changed files with 91 additions and 66 deletions

View File

@ -1,3 +1,28 @@
2011-05-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* 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 <miguel.dedios@artica.es> 2011-05-11 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_agents.php: added hooks for to enterprise ACL. * include/functions_agents.php: added hooks for to enterprise ACL.

View File

@ -308,8 +308,8 @@ function mainAgentsModules() {
"</p>"; "</p>";
} }
add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png'); extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agents_modules/icon_menu.png');
add_extension_main_function('mainAgentsModules'); extensions_add_main_function('mainAgentsModules');
?> ?>

View File

@ -147,9 +147,9 @@ function dbmgr_extension_main () {
} }
/* This adds a option in the operation menu */ /* 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 */ /* 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');
?> ?>

View File

@ -67,6 +67,6 @@ function extension_uploader_extensions() {
echo "</form>"; echo "</form>";
} }
add_godmode_menu_option(__('Extension uploader'), 'AM', 'gextensions'); extensions_add_godmode_menu_option(__('Extension uploader'), 'AM', 'gextensions');
add_extension_godmode_function('extension_uploader_extensions'); extensions_add_godmode_function('extension_uploader_extensions');
?> ?>

View File

@ -227,6 +227,6 @@ function mainInsertData() {
<?php <?php
} }
add_extension_godmode_function('mainInsertData'); extensions_add_godmode_function('mainInsertData');
add_godmode_menu_option(__('Insert Data'), 'AW', 'gagente'); extensions_add_godmode_menu_option(__('Insert Data'), 'AW', 'gagente');
?> ?>

View File

@ -275,6 +275,6 @@ function mainModuleGroups() {
<?php <?php
} }
add_operation_menu_option(__("Modules groups"), 'estado', 'module_groups/icon_menu.png'); extensions_add_operation_menu_option(__("Modules groups"), 'estado', 'module_groups/icon_menu.png');
add_extension_main_function('mainModuleGroups'); extensions_add_main_function('mainModuleGroups');
?> ?>

View File

@ -56,7 +56,7 @@ function pandoralogs_extension_main () {
view_logfile ("/var/log/pandora/pandora_server.error"); view_logfile ("/var/log/pandora/pandora_server.error");
} }
add_godmode_menu_option (__('System logfiles'), 'PM','glog',""); extensions_add_godmode_menu_option (__('System logfiles'), 'PM','glog',"");
add_extension_godmode_function('pandoralogs_extension_main'); extensions_add_godmode_function('pandoralogs_extension_main');
?> ?>

View File

@ -160,7 +160,7 @@ function pluginreg_extension_main () {
} }
add_godmode_menu_option (__('Register plugin'), 'PM','gservers',''); extensions_add_godmode_menu_option (__('Register plugin'), 'PM','gservers','');
add_extension_godmode_function('pluginreg_extension_main'); extensions_add_godmode_function('pluginreg_extension_main');
?> ?>

View File

@ -58,8 +58,8 @@ if (isset($_GET['get_ptr'])) {
} }
} }
else { else {
add_godmode_menu_option (__('Resource exportation'), 'PM','gservers',''); extensions_add_godmode_menu_option (__('Resource exportation'), 'PM','gservers','');
add_extension_godmode_function('resource_exportation_extension_main'); extensions_add_godmode_function('resource_exportation_extension_main');
} }
function output_xml_resource($hook_enterprise) { function output_xml_resource($hook_enterprise) {

View File

@ -858,6 +858,6 @@ function resource_registration_extension_main() {
process_upload_xml($xml); process_upload_xml($xml);
} }
add_godmode_menu_option (__('Resource registration'), 'PM','gservers',''); extensions_add_godmode_menu_option (__('Resource registration'), 'PM','gservers','');
add_extension_godmode_function('resource_registration_extension_main'); extensions_add_godmode_function('resource_registration_extension_main');
?> ?>

View File

@ -14,7 +14,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // 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 () { function main_ssh_console () {

View File

@ -613,8 +613,8 @@ function consoleMode() {
if (!isset($argv)) { if (!isset($argv)) {
//Execution across the browser //Execution across the browser
add_extension_godmode_function('mainSystemInfo'); extensions_add_godmode_function('mainSystemInfo');
add_godmode_menu_option(__('System Info'), 'PM', 'gsetup'); extensions_add_godmode_menu_option(__('System Info'), 'PM', 'gsetup');
} }
else { else {
$dir = dirname($_SERVER['PHP_SELF']); $dir = dirname($_SERVER['PHP_SELF']);

View File

@ -153,11 +153,11 @@ function pandora_update_manager_godmode () {
if(isset($config['id_user'])) { if(isset($config['id_user'])) {
if (check_acl($config['id_user'], 0, "PM")) { if (check_acl($config['id_user'], 0, "PM")) {
add_operation_menu_option (__('Update manager')); extensions_add_operation_menu_option (__('Update manager'));
add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup'); extensions_add_godmode_menu_option (__('Update manager settings'), 'PM','gsetup');
add_extension_main_function ('pandora_update_manager_main'); extensions_add_main_function ('pandora_update_manager_main');
add_extension_godmode_function ('pandora_update_manager_godmode'); extensions_add_godmode_function ('pandora_update_manager_godmode');
add_extension_login_function ('pandora_update_manager_login'); extensions_add_login_function ('pandora_update_manager_login');
} }
} }

View File

@ -88,15 +88,15 @@ function users_extension_main_god ($god = true) {
html_print_table ($table); 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 (isset($config["id_user"])) {
if (check_acl ($config["id_user"], 0, "UM")) { 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'); extensions_add_godmode_function('users_extension_main_god');
add_extension_main_function('users_extension_main'); extensions_add_main_function('users_extension_main');
?> ?>

View File

@ -27,5 +27,5 @@ function vnc_view() {
/* <iframe width="95%" height="500px" src="http://<?php echo $ipAgent;?>:5801"></iframe> */ /* <iframe width="95%" height="500px" src="http://<?php echo $ipAgent;?>:5801"></iframe> */
} }
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');
?> ?>

View File

@ -27,7 +27,7 @@ if (! check_acl ($config['id_user'], 0, "PM")) {
ui_print_page_header (__('Extensions'). " &raquo; ". __('Defined extensions'), "images/extensions.png", false, "", true, "" ); ui_print_page_header (__('Extensions'). " &raquo; ". __('Defined extensions'), "images/extensions.png", false, "", true, "" );
if (sizeof ($config['extensions']) == 0) { if (sizeof ($config['extensions']) == 0) {
$extensions = getExtensionInfo(); $extensions = extensions_get_extension_info();
if (empty($extensions)) { if (empty($extensions)) {
echo '<h3>'.__('There are no extensions defined').'</h3>'; echo '<h3>'.__('There are no extensions defined').'</h3>';
return; return;
@ -139,7 +139,7 @@ if ($disabled != '') {
<?php <?php
} }
$extensions = getExtensionInfo(); $extensions = extensions_get_extension_info();
$table->width = '95%'; $table->width = '95%';

View File

@ -126,7 +126,7 @@ if (file_exists ($config["homedir"] . '/include/languages/'.$config["user_langu
require_once ($ownDir . 'functions_extensions.php'); require_once ($ownDir . 'functions_extensions.php');
$config['extensions'] = get_extensions (); $config['extensions'] = extensions_get_extensions ();
// Detect if enterprise extension is installed // Detect if enterprise extension is installed
// NOTICE: This variable (config[enterprise_installed] is used in several // NOTICE: This variable (config[enterprise_installed] is used in several

View File

@ -27,7 +27,7 @@ $extension_file = '';
* *
* @param string $filename with contents of the extension * @param string $filename with contents of the extension
*/ */
function extension_call_main_function ($filename) { function extensions_call_main_function ($filename) {
global $config; global $config;
$extension = &$config['extensions'][$filename]; $extension = &$config['extensions'][$filename];
@ -42,7 +42,7 @@ function extension_call_main_function ($filename) {
* *
* @param string $filename File with extension contents * @param string $filename File with extension contents
*/ */
function extension_call_godmode_function ($filename) { function extensions_call_godmode_function ($filename) {
global $config; global $config;
$extension = &$config['extensions'][$filename]; $extension = &$config['extensions'][$filename];
@ -71,7 +71,7 @@ function extensions_call_login_function () {
* *
* @param string $page To check * @param string $page To check
*/ */
function is_extension ($page) { function extensions_is_extension ($page) {
global $config; global $config;
$filename = basename ($page); $filename = basename ($page);
@ -84,7 +84,7 @@ function is_extension ($page) {
* *
* @param bool $enterprise * @param bool $enterprise
*/ */
function get_extensions ($enterprise = false) { function extensions_get_extensions ($enterprise = false) {
$dir = EXTENSIONS_DIR; $dir = EXTENSIONS_DIR;
$handle = false; $handle = false;
if ($enterprise) if ($enterprise)
@ -123,7 +123,7 @@ function get_extensions ($enterprise = false) {
/* Load extensions in enterprise directory */ /* Load extensions in enterprise directory */
if (! $enterprise && file_exists (ENTERPRISE_DIR.'/'.EXTENSIONS_DIR)) 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; return $extensions;
} }
@ -131,7 +131,7 @@ function get_extensions ($enterprise = false) {
/** /**
* Get disabled open and enterprise extensions * Get disabled open and enterprise extensions
*/ */
function get_disabled_extensions() { function extensions_get_disabled_extensions() {
global $config; global $config;
$extensions = array (); $extensions = array ();
@ -167,37 +167,37 @@ function get_disabled_extensions() {
$data = array(); $data = array();
$data['operation_menu'] = false; $data['operation_menu'] = false;
if (preg_match("/<?php(\n|.)*add_operation_menu_option(\n|.)*?>/", $content)) { if (preg_match("/<?php(\n|.)*extensions_add_operation_menu_option(\n|.)*?>/", $content)) {
$data['operation_menu'] = true; $data['operation_menu'] = true;
} }
$data['godmode_menu'] = false; $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['godmode_menu'] = true;
} }
$data['operation_function'] = false; $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['operation_function'] = true;
} }
$data['login_function'] = false; $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['login_function'] = true;
} }
$data['extension_ope_tab'] = false; $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_ope_tab'] = true;
} }
$data['extension_god_tab'] = false; $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['extension_god_tab'] = true;
} }
$data['godmode_function'] = false; $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; $data['godmode_function'] = true;
} }
@ -220,7 +220,7 @@ function get_disabled_extensions() {
/** /**
* Get info of all extensions (enabled/disabled) * Get info of all extensions (enabled/disabled)
*/ */
function getExtensionInfo() { function extensions_get_extension_info() {
global $config; global $config;
$return = array (); $return = array ();
@ -269,7 +269,7 @@ function getExtensionInfo() {
$return[$extension['file']] = $data; $return[$extension['file']] = $data;
} }
$return = $return + get_disabled_extensions(); $return = $return + extensions_get_disabled_extensions();
return $return; return $return;
} }
@ -279,7 +279,7 @@ function getExtensionInfo() {
* *
* @param array $extensions * @param array $extensions
*/ */
function load_extensions ($extensions) { function extensions_load_extensions ($extensions) {
global $config; global $config;
global $extension_file; 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 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 * @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 $config;
global $extension_file; 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 called before any function the extension call, we are sure it will
be set. */ be set. */
$option_menu['name'] = $name; $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 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 * @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 $config;
global $extension_file; 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 called before any function the extension call, we are sure it will
be set. */ be set. */
$option_menu['acl'] = $acl; $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 tabIcon Path to the image icon
* @param tabFunction Name of the function to execute when this extension is called * @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 $config;
global $extension_file; 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 tabIcon Path to the image icon
* @param tabFunction Name of the function to execute when this extension is called * @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 $config;
global $extension_file; global $extension_file;
@ -381,7 +381,7 @@ function add_extension_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunctio
* *
* @param string $function_name Callback function name * @param string $function_name Callback function name
*/ */
function add_extension_main_function ($function_name) { function extensions_add_main_function ($function_name) {
global $config; global $config;
global $extension_file; global $extension_file;
@ -394,7 +394,7 @@ function add_extension_main_function ($function_name) {
* *
* @param string $function_name Callback 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 $config;
global $extension_file; global $extension_file;
@ -407,7 +407,7 @@ function add_extension_godmode_function ($function_name) {
* *
* @param string $function_name Callback 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 $config;
global $extension_file; global $extension_file;

View File

@ -322,7 +322,7 @@ function io_unsafe_string ($string) {
function __ ($string /*, variable arguments */) { function __ ($string /*, variable arguments */) {
global $l10n; global $l10n;
$extensions = get_extensions(); $extensions = extensions_get_extensions();
if (empty($extensions)) $extensions = array(); if (empty($extensions)) $extensions = array();
global $config; global $config;

View File

@ -70,7 +70,7 @@ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) {
/** /**
* Load the basic configurations of extension and add extensions into menu. * 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'])) { if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
$query = 'https://' . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; $query = 'https://' . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
@ -258,14 +258,14 @@ else {
require ("general/noaccess.php"); require ("general/noaccess.php");
} }
elseif (file_exists ($page)) { elseif (file_exists ($page)) {
if (! is_extension ($page)){ if (! extensions_is_extension ($page)){
require_once($page); require_once($page);
} }
else { else {
if ($sec[0] == 'g') if ($sec[0] == 'g')
extension_call_godmode_function (basename ($page)); extensions_call_godmode_function (basename ($page));
else else
extension_call_main_function (basename ($page)); extensions_call_main_function (basename ($page));
} }
} }
else echo '<br /><strong class="error">'.__('Sorry! I can\'t find the page!').'</strong>'; else echo '<br /><strong class="error">'.__('Sorry! I can\'t find the page!').'</strong>';

View File

@ -36,7 +36,7 @@
options_text = new Array('An existing Database','A new Database'); options_text = new Array('An existing Database','A new Database');
options_values = new Array('db_exist','db_new'); options_values = new Array('db_exist','db_new');
function ChangeDBDrop(causer) { 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.checked=0;
window.document.step2_form.drop.disabled=1; window.document.step2_form.drop.disabled=1;
} }
@ -604,7 +604,7 @@ function install_step3() {
<div>DB Name (pandora by default)</div> <div>DB Name (pandora by default)</div>
<input class='login' type='text' name='dbname' value='pandora'> <input class='login' type='text' name='dbname' value='pandora'>
<input class='login' type='checkbox' name='drop' value=1> <input class='login' type='checkbox' name='drop' value=1 disabled>
Drop Database if exists Drop Database if exists
<div>Full path to HTTP publication directory<br> <div>Full path to HTTP publication directory<br>