From ba0af0e70733384247505811ffa4dc6c8500e787 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 30 May 2014 17:18:59 +0000 Subject: [PATCH] 2014-05-30 Miguel de Dios * extensions/files_repo/files_repo_list.php: fixed PHP warnings. Incident: #847 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10056 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++ .../extensions/files_repo/files_repo_list.php | 34 +++++++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9043078271..d7426b21cf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2014-05-30 Miguel de Dios + + * extensions/files_repo/files_repo_list.php: fixed PHP warnings. + + Incident: #847 + 2014-05-30 Sergio Martin * godmode/servers/recon_script.php: Improve layout of recon scripts diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 2377566891..f8889861b7 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -28,18 +28,23 @@ $filter['order'] = array('field' => 'id', 'order' => 'DESC'); $files = files_repo_get_files($filter); if (!empty($files)) { - + echo "
"; - + + if (!isset($manage)) { + $manage = false; + } + // Pagination if ($manage) { $url = ui_get_full_url("index.php?sec=gextensions&sec2=extensions/files_repo"); - } else { + } + else { $url = ui_get_full_url("index.php?sec=extensions&sec2=extensions/files_repo"); } $total_files = files_repo_get_files(false, true); ui_pagination($total_files, $url, $offset); - + $table = new stdClass(); $table->width = '98%'; $table->style = array(); @@ -54,21 +59,21 @@ if (!empty($files)) { $table->head[3] = __("Last modification"); $table->head[4] = ""; $table->data = array(); - + foreach ($files as $file_id => $file) { $data = array(); - + // Prepare the filename for the get_file.php script $relative_path = str_replace($_SERVER['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"); - + $data[0] = "" . $file['name'] . ""; // 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 - + // Public URL $data[4] = ""; if (!empty($file['hash'])) { @@ -79,18 +84,18 @@ if (!empty($files)) { $data[4] .= html_print_image('images/world.png', true, array('title' => __('Public link'))); // Public link image $data[4] .= " "; } - + $data[4] .= ""; $data[4] .= html_print_image('images/download.png', true, array('title' => __('Download'))); // Download image $data[4] .= ""; - + if ($manage) { - + $config_url = ui_get_full_url("index.php?sec=gextensions&sec2=extensions/files_repo&file_id=$file_id"); $data[4] .= " "; $data[4] .= html_print_image('images/config.png', true, array('title' => __('Edit'))); // Edit image $data[4] .= ""; - + $delete_url = ui_get_full_url("index.php?sec=gextensions&sec2=extensions/files_repo&delete=1&file_id=$file_id"); $data[4] .= " "; $data[4] .= html_print_image('images/cross.png', true, array('title' => __('Delete'))); // Delete image @@ -99,8 +104,9 @@ if (!empty($files)) { $table->data[] = $data; } html_print_table($table); - -} else { + +} +else { ui_print_info_message(__('No items')); }