FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ajax-uploads.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008-2013 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
9 use Symfony\Component\HttpFoundation\Response;
10 
21 define("TITLE_CORE_UPLOADS", _("List Uploads as Options"));
22 
23 class core_uploads extends FO_Plugin
24 {
25  function __construct()
26  {
27  $this->Name = "upload_options";
28  $this->Title = TITLE_CORE_UPLOADS;
29  $this->DBaccess = PLUGIN_DB_READ;
30  $this->OutputType = 'Text'; /* This plugin needs no HTML content help */
31 
32  parent::__construct();
33  }
34 
38  function Output()
39  {
40  $FolderId = GetParm("folder",PARM_INTEGER);
41  if (empty($FolderId)) {
42  $FolderId = FolderGetTop();
43  }
44  $V = '';
45  $uploadList = FolderListUploads_perm($FolderId, Auth::PERM_WRITE);
46  foreach ($uploadList as $upload) {
47  $V .= "<option value='" . $upload['upload_pk'] . "'>";
48  $V .= htmlentities($upload['name']);
49  if (! empty($upload['upload_desc'])) {
50  $V .= " (" . htmlentities($upload['upload_desc']) . ")";
51  }
52  if (! empty($upload['upload_ts'])) {
53  $V .= " :: " . htmlentities(Convert2BrowserTime($upload['upload_ts']));
54  }
55  $V .= "</option>\n";
56  }
57  return new Response($V, Response::HTTP_OK, array('Content-type'=>'text/plain'));
58  }
59 }
60 
61 $NewPlugin = new core_uploads();
62 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:57
Contains the constants and helpers for authentication of user.
Definition: Auth.php:24
__construct()
base constructor. Most plugins will just use this
Output()
Display the loaded menu and plugins.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
FolderListUploads_perm($ParentFolder, $perm)
Returns an array of uploads in a folder.
const PARM_INTEGER
Definition: common-parm.php:14
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:46
Convert2BrowserTime($server_time)
Convert the server time to browser time.
Definition: common-ui.php:312
#define PERM_WRITE
Read-Write permission.
Definition: libfossology.h:33
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
Definition: libfossology.h:37