diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 471cfb343e..3c7b042ca5 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,18 @@ + +2009-03-26 Sancho Lerena + + * pandoradb.sql: SLA parameters now accept float values. + + * extras/pandoradb_migrate_v2.x_to_v3.0.sql: SLA parameters now accept + float values after a table update. + + * godmode/setup/filemgr.php: New feature: a file manager, accesible only by + pandora Administrators. Have some security checks but is not intended to be + used by anyone not admin. + + * godmode/menu.php: Added filemanager and fixed minor problem under SNMP + Godmode (fake submenu). + 2009-03-26 Esteban Sanchez * include/javascript/jquery.ui.dialog.js: Added to repository. diff --git a/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql b/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql index 9230f6ac8d..6f712bc31b 100644 --- a/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql +++ b/pandora_console/extras/pandoradb_migrate_v2.x_to_v3.0.sql @@ -1,3 +1,10 @@ +ALTER TABLE treport_content_sla_combined CHANGE sla_max `sla_max` double(18,2) NOT NULL default 0; + +ALTER TABLE treport_content_sla_combined CHANGE sla_min `sla_min` double(18,2) NOT NULL default 0; + +ALTER TABLE treport_content_sla_combined CHANGE sla_limit `sla_limit` double(18,2) NOT NULL default 0; + + ALTER TABLE ttrap add `priority` tinyint(4) unsigned NOT NULL default '2'; INSERT INTO `tconfig` VALUES (24, 'loginhash_pwd', ''); diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 34869f9c94..befa56bd37 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -94,9 +94,8 @@ if (give_acl($config['id_user'], 0, "AW")) { $menu["gsnmpconsole"]["sec2"] = "godmode/snmpconsole/snmp_alert"; $menu["gsnmpconsole"]["id"] = "god-snmpc"; - //SNMP Console alert $sub = array (); - $sub["godmode/snmpconsole/snmp_alert"]["text"] = __('Component groups'); + //$sub["godmode/snmpconsole/snmp_alert"]["text"] = __('Component groups'); enterprise_hook ('snmpconsole_submenu'); @@ -153,6 +152,9 @@ if (give_acl ($config['id_user'], 0, "PM")) { $menu["gsetup"]["id"] = "god-setup"; $sub = array (); + + $sub["godmode/setup/filemgr"]["text"] = __('File Manager'); + $sub["godmode/setup/links"]["text"] = __('Links'); $sub["godmode/setup/news"]["text"] = __('Site news'); diff --git a/pandora_console/godmode/setup/filemgr.php b/pandora_console/godmode/setup/filemgr.php new file mode 100644 index 0000000000..1d124ccdfd --- /dev/null +++ b/pandora_console/godmode/setup/filemgr.php @@ -0,0 +1,266 @@ +".__("attach_error").""; + } else { + // Delete temporal file + unlink ($_FILES['userfile']['tmp_name']); + } + + } +} + +// Delete file +$delete = get_parameter ("delete", ""); +if ($delete != ""){ + echo "

".__("Deleting file")."

"; + $file = get_parameter ("delete", ""); + $directory = get_parameter ("directory", ""); + + $full_filename = $directory . "/". $file; + if (!is_dir ($full_filename)){ + echo "

".__("Deleting")." ".$full_filename."

"; + unlink ($full_filename); + } +} + +echo "

".__("File manager")."

"; + +$current_directory = get_parameter ("directory", "/"); + +// CREATE DIR +// Upload file +if (isset($_GET["create_dir"])) { + $newdir = get_parameter ("newdir",""); + if ($newdir != ""){ + mkdir($current_directory."/".$newdir); + echo "

".__("Created directory '$newdir'")."

"; + } + +} + + +// A miminal security check to avoid directory traversal +if (preg_match("/\.\./", $current_directory)) + $current_directory = "images"; +if (preg_match("/^\//", $current_directory)) + $current_directory = "images"; +if (preg_match("/^manager/", $current_directory)) + $current_directory = "images"; + +echo "
"; +echo ""; + +echo "
"; +echo __("Base directory"); +echo ""; + + +/* Add custom directories here */ +$fallback_directory = "images"; + +$available_directory["images"] = "images"; +$available_directory["attachment"] = "attachment"; +$available_directory["include/languages"] = "languages"; + +$banned_directory["include"] = 1; +$banned_directory["godmode"] = 1; +$banned_directory["operation"] = 1; +$banned_directory["reporting"] = 1; +$banned_directory["general"] = 1; +$banned_directory["enterprise"] = 1; + +if (isset($banned_directory[$current_directory])) + $current_directory = $fallback_directory; + +// Current directory +$available_directory[$current_directory] = $current_directory; + +print_select ($available_directory, 'directory', $current_directory, '', '', '', false, false); +echo "  "; + +$real_directory = $config["homedir"] . "/". $current_directory; + +if (is_writable($real_directory)) { + echo "
"; + echo __("Upload new file"); + echo ""; + echo ""; + echo "  "; + echo ""; + echo ""; + echo "
"; +} else { + echo ""; + echo ""; + echo "

".__('Current directory is not writtable by HTTP Server')."

"; + echo '

'; + echo __('Please check that current directory has write rights for HTTP server'); + echo "

"; +} + + +echo "

".__("Current directory"). " : ".$current_directory . "

"; +// Upload form + + // List files + + $directoryHandler = ""; + $result = array (); + if (! $directoryHandler = @opendir ($real_directory)) { + echo ("
\nerror: directory \"$current_directory\" doesn't exist!\n
\n"); + return 0; + } + + while (false !== ($fileName = @readdir ($directoryHandler))) { + $result[$fileName] = $fileName; + // TODO: Read filetype (image, directory) + // If directory create a link to navigate. + } + asort($result, SORT_STRING); + + if (@count ($result) === 0) { + echo __ ("No files found"); + } else { + asort ($result); + + echo ""; + + $prev_dir = split( "/", $current_directory ); + $prev_dir_str = ""; + for ($ax = 0; $ax < (count($prev_dir)-1); $ax++){ + + $prev_dir_str .= $prev_dir[$ax]; + if ($ax < (count($prev_dir)-2)) + $prev_dir_str .= "/"; + } + + if ($prev_dir_str != ""){ + echo ""; + } + echo "
"; + echo "".__("Go prev. directory")." "; + echo "
"; + echo __ ("Filename"); + echo ""; + echo __ ("Image info"); + echo ""; + echo __ ("Last update"); + echo ""; + echo __ ("Owner"); + echo ""; + echo __ ("Perms"); + echo ""; + echo __ ("Filesize"); + echo ""; + echo __ ("File type"); + echo ""; + echo __ ("Directory"); + echo ""; + echo __ ("Del"); + while (@count($result) > 0){ + $temp = array_shift ($result); + $fullfilename = $current_directory.'/'.$temp; + $mimetype = ""; + if (($temp != "..") AND ($temp != ".")){ + echo "
"; + if (!is_dir ($current_directory.'/'.$temp)){ + echo "$temp"; + } else + echo "/$temp"; + + echo ""; + if (preg_match("/image/", $mimetype)){ + list($ancho, $altura, $tipo, $atr) = getimagesize($fullfilename); + echo $ancho."x".$altura; + } + echo ""; + if (!is_dir ($fullfilename)) + echo date("F d Y H:i:s.", filemtime($fullfilename)); + echo ""; + if (!is_dir ($fullfilename)) + echo fileowner($fullfilename); + + echo ""; + if (!is_dir ($fullfilename)) + if (!is_readable($fullfilename)) + echo ""; + echo __("Read"); + + echo ""; + if (!is_dir ($fullfilename)) + echo filesize($fullfilename); + else + echo "<DIR>"; + + echo ""; + if (!is_dir ($fullfilename)) + echo $mimetype; + else + echo "<DIR>"; + + echo ""; + if (!is_dir ($fullfilename)) + echo ""; + else + echo ""; + echo ""; + echo ""; + } + } + echo "
"; + + if (is_writable($current_directory)){ + echo "

"; + echo "
"; + echo __("Create directory"); + echo "  "; + echo ""; + echo "  "; + echo ""; + echo "
"; + } + } + + +?> + diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 93352030cb..e824432c22 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -716,9 +716,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_sla_combined` ( `id` INTEGER UNSIGNED NOT NULL auto_increment, `id_report_content` INTEGER UNSIGNED NOT NULL, `id_agent_module` int(10) unsigned NOT NULL, - `sla_max` int(11) NOT NULL default 0, - `sla_min` int(11) NOT NULL default 0, - `sla_limit` int(11) NOT NULL default 0, + `sla_max` double(18,2) NOT NULL default 0, + `sla_min` double(18,2) NOT NULL default 0, + `sla_limit` double(18,2) NOT NULL default 0, PRIMARY KEY(`id`), FOREIGN KEY (`id_report_content`) REFERENCES treport_content(`id_rc`) ON UPDATE CASCADE ON DELETE CASCADE,