2014-06-05 Alejandro Gallardo <alejandro.gallardo@artica.es>
* extensions/files_repo/files_repo_get_file.php, extensions/files_repo/files_repo_list.php, extensions/files_repo/functions_files_repo.php, godmode/setup/setup_general.php: Improved the Windows compatibility and fixed some errors. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10120 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3a5c5bc61c
commit
cafbdda344
|
@ -1,3 +1,11 @@
|
|||
2014-06-05 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||
|
||||
* extensions/files_repo/files_repo_get_file.php,
|
||||
extensions/files_repo/files_repo_list.php,
|
||||
extensions/files_repo/functions_files_repo.php,
|
||||
godmode/setup/setup_general.php: Improved the Windows
|
||||
compatibility and fixed some errors.
|
||||
|
||||
2014-06-05 Vanessa Gil <vanessa.gil@artica.es>
|
||||
|
||||
* godmode/agentes/configurar_agentes.php: Changed
|
||||
|
|
|
@ -44,7 +44,7 @@ if (!$check_hash) {
|
|||
}
|
||||
|
||||
// Get the location
|
||||
$files_repo_path = $config['attachment_store']."/files_repo";
|
||||
$files_repo_path = io_safe_output($config['attachment_store'])."/files_repo";
|
||||
$location = $files_repo_path."/".$file['id']."_".$file['name'];
|
||||
if (!file_exists($location) || !is_readable($location) || !is_file($location)) {
|
||||
throw_error(5); // ERROR
|
||||
|
|
|
@ -64,15 +64,18 @@ if (!empty($files)) {
|
|||
$data = array();
|
||||
|
||||
// Prepare the filename for the get_file.php script
|
||||
$relative_path = str_replace($_SERVER['DOCUMENT_ROOT'], '', $file['location']);
|
||||
$document_root = str_replace("\\", "/", io_safe_output($_SERVER['DOCUMENT_ROOT']));
|
||||
$file['location'] = str_replace("\\", "/", io_safe_output($file['location']));
|
||||
$relative_path = str_replace($document_root, '', $file['location']);
|
||||
$file_path = base64_encode($relative_path);
|
||||
$hash = md5($relative_path . $config['dbpass']);
|
||||
$url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash");
|
||||
$date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m';
|
||||
|
||||
$data[0] = "<a href=\"$url\" target=\"_blank\">" . $file['name'] . "</a>"; // Name
|
||||
$data[1] = ui_print_truncate_text($file['description'], 'description', true, true); // Description
|
||||
$data[2] = ui_format_filesize($file['size']); // Size
|
||||
$data[3] = date('F j, Y - H:m', $file['mtime']); // Last modification
|
||||
$data[3] = date($date_format, $file['mtime']); // Last modification
|
||||
|
||||
// Public URL
|
||||
$data[4] = "";
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
function files_repo_check_directory ($print_messages = false) {
|
||||
global $config;
|
||||
|
||||
$attachment_path = $config['attachment_store'];
|
||||
$attachment_path = io_safe_output($config['attachment_store']);
|
||||
$files_repo_path = $attachment_path."/files_repo";
|
||||
|
||||
$result = false;
|
||||
|
@ -27,7 +27,7 @@ function files_repo_check_directory ($print_messages = false) {
|
|||
// attachment/ check
|
||||
if (!is_writable($attachment_path)) {
|
||||
$messages .= ui_print_error_message(array('message' => __('Attachment directory is not writable by HTTP Server')
|
||||
.'</h3>'.'<p>'.__('Please check that the web server has write rights on the {HOMEDIR}/attachment directory'),
|
||||
.'</h3>'.'<p>'.sprinf(__('Please check that the web server has write rights on the %s directory'), $attachment_path),
|
||||
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
|
||||
} else {
|
||||
// attachment/agent_packages/ check
|
||||
|
@ -38,7 +38,7 @@ function files_repo_check_directory ($print_messages = false) {
|
|||
}
|
||||
if (!is_writable($files_repo_path)) {
|
||||
$messages .= ui_print_error_message(array('message' => __('Attachment directory is not writable by HTTP Server')
|
||||
.'</h3>'.'<p>'.__('Please check that the web server has write rights on the {HOMEDIR}/attachment directory'),
|
||||
.'</h3>'.'<p>'.sprinf(__('Please check that the web server has write rights on the %s directory'), $attachment_path),
|
||||
'no_close' => true, 'force_style' => 'color: #000000 !important'), '', true);
|
||||
} else {
|
||||
$result = true;
|
||||
|
@ -127,7 +127,7 @@ function files_repo_get_files ($filter = false, $count = false) {
|
|||
global $config;
|
||||
|
||||
// Don't use the realpath for the download links!
|
||||
$files_repo_path = $config['attachment_store']."/files_repo";
|
||||
$files_repo_path = io_safe_output($config['attachment_store'])."/files_repo";
|
||||
|
||||
$sql = "SELECT * FROM tfiles_repo " . db_format_array_where_clause_sql($filter, "AND", "WHERE");
|
||||
$files = db_get_all_rows_sql($sql);
|
||||
|
@ -169,7 +169,7 @@ function files_repo_get_files ($filter = false, $count = false) {
|
|||
function files_repo_add_file ($file_input_name = "upfile", $description = "", $groups = array(), $public = false) {
|
||||
global $config;
|
||||
|
||||
$attachment_path = $config['attachment_store'];
|
||||
$attachment_path = io_safe_output($config['attachment_store']);
|
||||
$files_repo_path = $attachment_path."/"."files_repo";
|
||||
|
||||
$result = array();
|
||||
|
@ -283,7 +283,7 @@ function files_repo_delete_file ($file_id) {
|
|||
$filename = db_get_value("name", "tfiles_repo", "id", $file_id);
|
||||
|
||||
if ($filename) {
|
||||
$attachment_path = $config['attachment_store'];
|
||||
$attachment_path = io_safe_output($config['attachment_store']);
|
||||
$files_repo_path = $attachment_path."/files_repo";
|
||||
$location = $files_repo_path."/".$file_id."_".$filename;
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ if ($config["integria_enabled"]) {
|
|||
|
||||
$table->data[19][0] = __('Enable Netflow');
|
||||
$rbt_disabled = false;
|
||||
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
$rbt_disabled = true;
|
||||
$table->data[19][0] .= ui_print_help_tip (__('Not supported in Windows systems.'), true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue