FOSSology  4.4.0
Open Source License Compliance by Open Source Software
delete-file-browse.php
1 <?php
2 /*
3 /*
4  SPDX-FileCopyrightText: © 2023 Simran Nigam <nigamsimran14@gmail.com>
5  SPDX-FileContributor: Simran Nigam <nigamsimran14@gmail.com>
6 
7  SPDX-License-Identifier: GPL-2.0-only
8 */
9 
15 
20 use Symfony\Component\HttpFoundation\Request;
21 use Symfony\Component\HttpFoundation\RedirectResponse;
22 
28 {
29  const NAME = "browse_upload_delete";
30 
32  private $uploadDao;
33 
35  private $folderDao;
36 
37  function __construct()
38  {
39  parent::__construct(self::NAME, array(
40  self::TITLE => _("Delete Uploaded File"),
41  self::PERMISSION => Auth::PERM_ADMIN,
42  self::REQUIRES_LOGIN => true
43  ));
44 
45  global $container;
46  $this->uploadDao = $container->get('dao.upload');
47  $this->folderDao = $container->get('dao.folder');
48  }
49 
53  function RegisterMenus()
54  {
55  $text = _("Delete Browse File");
56  menu_insert("Browse-Pfile::Delete",0,$this->Name,$text);
57  } // RegisterMenus()
58 
63  protected function handle(Request $request)
64  {
65  $vars = array();
66 
67  $uploadpk = $request->get('upload');
68  $folderId = $request->get('folder');
69 
70  if (!empty($uploadpk)) {
74  $adminUploadDelete = plugin_find("admin_upload_delete");
75  $adminUploadDelete->TryToDelete($uploadpk, $folderId);
76  }
77  return new RedirectResponse(Traceback_uri() . '?mod=' . 'showjobs');
78  }
79 }
80 
81 register_plugin(new BrowseUploadDelete());
UI plugin to delete uploaded files.
Contains the constants and helpers for authentication of user.
Definition: Auth.php:24
menu_insert($Path, $LastOrder=0, $URI=NULL, $Title=NULL, $Target=NULL, $HTML=NULL)
Given a Path, order level for the last item, and optional plugin name, insert the menu item.
Traceback_uri()
Get the URI without query to this location.
Definition: common-parm.php:97
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
UI namespace for DelAgent.