2014-04-08 18:26:23 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
|
|
function pandora_files_repo_install () {
|
|
|
|
global $config;
|
|
|
|
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
if (isset($config['files_repo_installed'])) {
|
|
|
|
if ($config['files_repo_installed'] == 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
|
|
|
|
2014-04-24 12:45:33 +02:00
|
|
|
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
|
|
|
|
$full_sql_dir = $full_extensions_dir."files_repo/sql/";
|
2014-04-08 18:26:23 +02:00
|
|
|
|
|
|
|
/* SQL installation */
|
|
|
|
switch ($config['dbtype']) {
|
|
|
|
case 'mysql':
|
|
|
|
$sentences = file ($full_sql_dir.'files_repo.sql');
|
|
|
|
break;
|
|
|
|
case 'postgresql':
|
|
|
|
$sentences = file ($full_sql_dir.'files_repo.postgreSQL.sql');
|
|
|
|
break;
|
|
|
|
case 'oracle':
|
|
|
|
$sentences = file ($full_sql_dir.'files_repo.oracle.sql');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
foreach ($sentences as $sentence) {
|
|
|
|
if (trim ($sentence) == "")
|
|
|
|
continue;
|
|
|
|
$success = db_process_sql ($sentence);
|
|
|
|
if ($success === false)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Configuration values */
|
|
|
|
$values = array(
|
|
|
|
"token" => "files_repo_installed",
|
|
|
|
"value" => 1
|
|
|
|
);
|
|
|
|
db_process_sql_insert('tconfig', $values);
|
|
|
|
}
|
|
|
|
|
|
|
|
function pandora_files_repo_uninstall () {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
db_process_sql('DROP TABLE `tfiles_repo_group`');
|
|
|
|
db_process_sql('DROP TABLE `tfiles_repo`');
|
|
|
|
db_process_sql('DELETE FROM `tconfig`
|
|
|
|
WHERE `token` LIKE "files_repo_%"');
|
2014-04-08 18:26:23 +02:00
|
|
|
break;
|
|
|
|
case "postgresql":
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
db_process_sql('DROP TABLE "tfiles_repo_group"');
|
|
|
|
db_process_sql('DROP TABLE "tfiles_repo"');
|
|
|
|
db_process_sql('DELETE FROM "tconfig"
|
|
|
|
WHERE "token" LIKE \'files_repo_%\'');
|
2014-04-08 18:26:23 +02:00
|
|
|
break;
|
|
|
|
case "oracle":
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
db_process_sql('DROP TABLE "tfiles_repo_group"');
|
|
|
|
db_process_sql('DROP TABLE "tfiles_repo"');
|
|
|
|
db_process_sql('DELETE FROM tconfig
|
|
|
|
WHERE token LIKE \'files_repo_%\'');
|
2014-04-08 18:26:23 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-04-09 15:14:15 +02:00
|
|
|
if (!empty($config['attachment_store']))
|
2014-04-24 12:45:33 +02:00
|
|
|
delete_dir($config['attachment_store']."/files_repo");
|
2014-04-08 18:26:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function pandora_files_repo_godmode () {
|
|
|
|
global $config;
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
if (!isset($config['files_repo_installed']) || !$config['files_repo_installed']) {
|
|
|
|
ui_print_error_message(__('Extension not installed'));
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// ACL Check
|
|
|
|
check_login ();
|
|
|
|
if (! check_acl ($config['id_user'], 0, "PM")) {
|
|
|
|
db_pandora_audit("ACL Violation", "Trying to access to Files repository");
|
|
|
|
require ("general/noaccess.php");
|
|
|
|
return;
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// Header tabs
|
|
|
|
$godmode['text'] = '<a href="index.php?sec=gextensions&sec2=extensions/files_repo">'
|
|
|
|
. html_print_image ("images/setup.png", true, array ("title" => __('Administration view')))
|
|
|
|
. "</a>";
|
|
|
|
$godmode['godmode'] = 1;
|
|
|
|
$godmode['active'] = 1;
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'
|
|
|
|
. html_print_image ("images/operation.png", true, array ("title" => __('Operation view')))
|
|
|
|
. "</a>";
|
|
|
|
$operation['operation'] = 1;
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
$onheader = array('godmode' => $godmode, 'operation' => $operation);
|
|
|
|
// Header
|
|
|
|
ui_print_page_header (__("Files repository manager"), "images/extensions.png", false, "", true, $onheader);
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-24 12:45:33 +02:00
|
|
|
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
require_once ($full_extensions_dir . "files_repo/functions_files_repo.php");
|
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// Directory files_repo check
|
|
|
|
if (!files_repo_check_directory(true)) {
|
|
|
|
return;
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
|
|
|
$server_content_length = 0;
|
|
|
|
if (isset($_SERVER['CONTENT_LENGTH']))
|
|
|
|
$server_content_length = $_SERVER['CONTENT_LENGTH'];
|
|
|
|
|
2014-05-27 19:05:37 +02:00
|
|
|
// Check for an anoying error that causes the $_POST and $_FILES arrays
|
|
|
|
// were empty if the file is larger than the post_max_size
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
if (intval($server_content_length) > 0 && empty($_POST)) {
|
2014-05-27 19:05:37 +02:00
|
|
|
ui_print_error_message(__('The file exceeds the maximum size'));
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// GET and POST parameters
|
|
|
|
$file_id = (int) get_parameter ("file_id");
|
|
|
|
$add_file = (bool) get_parameter ("add_file");
|
|
|
|
$update_file = (bool) get_parameter ("update_file");
|
|
|
|
$delete_file = (bool) get_parameter ("delete");
|
2014-05-27 19:05:37 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// File add or update
|
|
|
|
if ( $add_file || ($update_file && $file_id > 0) ) {
|
|
|
|
$groups = get_parameter ("groups", array());
|
2014-04-09 15:14:15 +02:00
|
|
|
$public = (bool) get_parameter ("public");
|
2014-04-08 18:26:23 +02:00
|
|
|
$description = io_safe_output((string) get_parameter ("description"));
|
|
|
|
if (mb_strlen($description, "UTF-8") > 200) {
|
|
|
|
$description = mb_substr($description, 0, 200, "UTF-8");
|
|
|
|
}
|
|
|
|
$description = io_safe_input($description);
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
if ($add_file) {
|
2014-04-09 15:14:15 +02:00
|
|
|
$result = files_repo_add_file("upfile", $description, $groups, $public);
|
2014-04-08 18:26:23 +02:00
|
|
|
} elseif ($update_file) {
|
2014-04-09 15:14:15 +02:00
|
|
|
$result = files_repo_update_file($file_id, $description, $groups, $public);
|
2014-04-08 18:26:23 +02:00
|
|
|
$file_id = 0;
|
|
|
|
}
|
|
|
|
if ($result['status'] == false) {
|
|
|
|
ui_print_error_message($result['message']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// File delete
|
|
|
|
if ($delete_file && $file_id > 0) {
|
|
|
|
$result = files_repo_delete_file($file_id);
|
|
|
|
if ($result !== -1) {
|
|
|
|
ui_print_result_message($result, __('Successfully deleted'), __('Could not be deleted'));
|
|
|
|
}
|
|
|
|
$file_id = 0;
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// FORM
|
2014-04-24 12:45:33 +02:00
|
|
|
require ($full_extensions_dir."files_repo/files_repo_form.php");
|
2014-04-08 18:26:23 +02:00
|
|
|
if (!$file_id) {
|
|
|
|
// LIST
|
|
|
|
$manage = true;
|
2014-04-24 12:45:33 +02:00
|
|
|
require ($full_extensions_dir."files_repo/files_repo_list.php");
|
2014-04-08 18:26:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function pandora_files_repo_operation () {
|
|
|
|
global $config;
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// Header tabs
|
|
|
|
$onheader = array();
|
|
|
|
if (check_acl($config['id_user'], 0, "PM")) {
|
|
|
|
$godmode['text'] = '<a href="index.php?sec=gextensions&sec2=extensions/files_repo">'
|
|
|
|
. html_print_image ("images/setup.png", true, array ("title" => __('Administration view')))
|
|
|
|
. "</a>";
|
|
|
|
$godmode['godmode'] = 1;
|
|
|
|
|
|
|
|
$operation['text'] = '<a href="index.php?sec=extensions&sec2=extensions/files_repo">'
|
|
|
|
. html_print_image ("images/operation.png", true, array ("title" => __('Operation view')))
|
|
|
|
. "</a>";
|
|
|
|
$operation['operation'] = 1;
|
|
|
|
$operation['active'] = 1;
|
|
|
|
|
|
|
|
$onheader = array('godmode' => $godmode, 'operation' => $operation);
|
|
|
|
}
|
|
|
|
// Header
|
|
|
|
ui_print_page_header (__("Files repository"), "images/extensions.png", false, "", false, $onheader);
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-24 12:45:33 +02:00
|
|
|
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
|
|
|
|
require_once ($full_extensions_dir."files_repo/functions_files_repo.php");
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// Directory files_repo check
|
|
|
|
if (!files_repo_check_directory(true)) {
|
|
|
|
return;
|
|
|
|
}
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
2014-04-08 18:26:23 +02:00
|
|
|
// LIST
|
2014-04-24 12:45:33 +02:00
|
|
|
$full_extensions_dir = $config['homedir']."/".EXTENSIONS_DIR."/";
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
|
|
|
|
require ($full_extensions_dir . "files_repo/files_repo_list.php");
|
2014-04-08 18:26:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
extensions_add_operation_menu_option(__('Files repository'), null, null, "v1r1");
|
|
|
|
extensions_add_main_function('pandora_files_repo_operation');
|
|
|
|
extensions_add_godmode_menu_option(__('Files repository manager'), 'PM', null, null, "v1r1");
|
|
|
|
extensions_add_godmode_function('pandora_files_repo_godmode');
|
|
|
|
|
2014-04-09 15:14:15 +02:00
|
|
|
//pandora_files_repo_uninstall();
|
2014-04-08 18:26:23 +02:00
|
|
|
pandora_files_repo_install();
|
|
|
|
|
|
|
|
?>
|