'; $godmode['text'] .= html_print_image( 'images/configuration@svg.svg', true, [ 'title' => __('Administration view'), 'class' => 'main_menu_icon invert_filter', ] ); $godmode['text'] .= ''; $godmode['godmode'] = 1; $operation['text'] = ''; $operation['text'] .= html_print_image( 'images/see-details@svg.svg', true, [ 'title' => __('Operation view'), 'class' => 'main_menu_icon invert_filter', ] ); $operation['text'] .= ''; $operation['operation'] = 1; $operation['active'] = 1; $godmode['active'] = 0; if ($tab === 'configuration') { $godmode['active'] = 1; $operation['active'] = 0; } $onheader = [ 'godmode' => $godmode, 'operation' => $operation, ]; // Header. ui_print_standard_header( __('Extensions'), 'images/extensions.png', false, '', true, $onheader, [ [ 'link' => '', 'label' => __('Tools'), ], [ 'link' => '', 'label' => __('Files repository'), ], ] ); require_once __DIR__.'/../../include/functions_files_repository.php'; // Directory files_repo check. if (files_repo_check_directory() === false) { return; } $server_content_length = 0; if (isset($_SERVER['CONTENT_LENGTH'])) { $server_content_length = $_SERVER['CONTENT_LENGTH']; } // Check for an anoying error that causes the $_POST and $_FILES arrays. // were empty if the file is larger than the post_max_size. if (intval($server_content_length) > 0 && empty($_POST)) { ui_print_error_message( __('Problem uploading. Please check this PHP runtime variable values:
  post_max_size (currently '.ini_get('post_max_size').')
') ); } // 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'); // File add or update. if ($add_file === true || ($update_file === true && $file_id > 0)) { $groups = get_parameter('groups', []); $public = (bool) get_parameter('public'); $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); if ($add_file === true) { $result = files_repo_add_file('upfile', $description, $groups, $public); } else if ($update_file === true) { $result = files_repo_update_file($file_id, $description, $groups, $public); $file_id = 0; } if ($result['status'] == false) { ui_print_error_message($result['message']); } else { if ($add_file === true) { ui_print_success_message(__('Successfully created')); } else if ($update_file === true) { ui_print_success_message(__('Successfully updated')); } } } // File delete. if ($delete_file === true && $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; } $operation['active'] = 1; if ($tab === 'configuration') { include_once __DIR__.'/files_repo_form.php'; } else { include_once __DIR__.'/files_repo_list.php'; }