Exemple #1
0
 /**
  * @param Request $request
  * @return Response
  */
 protected function handle(Request $request)
 {
     $folderId = intval($request->get('folder'));
     if (empty($folderId)) {
         $folderId = FolderGetTop();
     }
     $uploadId = intval($request->get('upload'));
     $agents = $request->get('agents') ?: '';
     if (!empty($uploadId) && !empty($agents) && is_array($agents)) {
         $rc = $this->agentsAdd($uploadId, $agents, $request);
         if (empty($rc)) {
             $status = GetRunnableJobList();
             $scheduler_msg = empty($status) ? _("Is the scheduler running? ") : '';
             $url = Traceback_uri() . "?mod=showjobs&upload={$uploadId}";
             $text = _("Your jobs have been added to job queue.");
             $linkText = _("View Jobs");
             $msg = "{$scheduler_msg}" . "{$text} <a href=\"{$url}\">{$linkText}</a>";
             $vars['message'] = $msg;
         } else {
             $text = _("Scheduling of Agent(s) failed: ");
             $vars['message'] = $text . $rc;
         }
     }
     $vars['uploadScript'] = ActiveHTTPscript("Uploads");
     $vars['agentScript'] = ActiveHTTPscript("Agents");
     $vars['folderId'] = $folderId;
     $vars['folderListOptions'] = FolderListOption(-1, 0, 1, $folderId);
     $vars['folderListUploads'] = FolderListUploads_perm($folderId, Auth::PERM_WRITE);
     $vars['baseUri'] = Traceback_uri();
     $vars['uploadId'] = $uploadId;
     $parmAgentList = MenuHook::getAgentPluginNames("ParmAgents");
     $out = '<ol>';
     $parmAgentFoots = '';
     foreach ($parmAgentList as $parmAgent) {
         $agent = plugin_find($parmAgent);
         $out .= "<br/><b>" . $agent->AgentName . ":</b><br/>";
         $out .= $agent->renderContent($vars);
         $parmAgentFoots .= $agent->renderFoot($vars);
     }
     $out .= '</ol>';
     $vars['out'] = $out;
     $vars['outFoot'] = '<script language="javascript"> ' . $parmAgentFoots . '</script>';
     return $this->render('agent_adder.html.twig', $this->mergeWithDefault($vars));
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     global $PG_CONN;
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $FolderSelectId = GetParm('selectfolderid', PARM_INTEGER);
             if (empty($FolderSelectId)) {
                 $FolderSelectId = FolderGetTop();
             }
             $FolderId = GetParm('oldfolderid', PARM_INTEGER);
             $NewName = GetParm('newname', PARM_TEXT);
             $NewDesc = GetParm('newdesc', PARM_TEXT);
             if (!empty($FolderId)) {
                 $FolderSelectId = $FolderId;
                 $rc = $this->Edit($FolderId, $NewName, $NewDesc);
                 if ($rc == 1) {
                     /* Need to refresh the screen */
                     $text = _("Folder Properties changed");
                     $V .= displayMessage($text);
                 }
             }
             $V .= _("<p>The folder properties that can be changed are the folder name and\n     description.  First select the folder to edit. Then enter the new values.\n     If no value is entered, then the corresponding field will not be changed.</p>");
             /* Get the folder info */
             $sql = "SELECT * FROM folder WHERE folder_pk = '{$FolderSelectId}';";
             $result = pg_query($PG_CONN, $sql);
             DBCheckResult($result, $sql, __FILE__, __LINE__);
             $Folder = pg_fetch_assoc($result);
             pg_free_result($result);
             /* Display the form */
             $V .= "<form method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the folder to edit:  \n");
             $V .= "<li>{$text}";
             $Uri = Traceback_uri() . "?mod=" . $this->Name . "&selectfolderid=";
             $V .= "<select name='oldfolderid' onChange='window.location.href=\"{$Uri}\" + this.value'>\n";
             $V .= FolderListOption(-1, 0, 1, $FolderSelectId);
             $V .= "</select><P />\n";
             $text = _("Change folder name:  \n");
             $V .= "<li>{$text}";
             $V .= "<INPUT type='text' name='newname' size=40 value=\"" . htmlentities($Folder['folder_name'], ENT_COMPAT) . "\" />\n";
             $text = _("Change folder description:  \n");
             $V .= "<P /><li>{$text}";
             $V .= "<INPUT type='text' name='newdesc' size=60 value=\"" . htmlentities($Folder['folder_desc'], ENT_COMPAT) . "\" />\n";
             $V .= "</ol>\n";
             $text = _("Edit");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     global $Plugins;
     global $PG_CONN;
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $OldFolderId = GetParm('oldfolderid', PARM_INTEGER);
             $TargetFolderId = GetParm('targetfolderid', PARM_INTEGER);
             if (!empty($OldFolderId) && !empty($TargetFolderId)) {
                 $rc = $this->Move($OldFolderId, $TargetFolderId);
                 if ($rc == 1) {
                     /* create sucess mesage */
                     $sql = "SELECT * FROM folder where folder_pk = '{$TargetFolderId}';";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $NRow = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $sql = "SELECT * FROM folder where folder_pk = '{$OldFolderId}';";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $ORow = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $text = _("Moved folder ");
                     $text1 = _(" to folder ");
                     $success = $text . $ORow['folder_name'] . $text1 . $NRow['folder_name'];
                     $V .= displayMessage($success);
                 } else {
                     $text = _("Could not move folder!: ");
                     $V .= displayMessage($text . $rc);
                 }
             }
             /* Display the form */
             $V .= "<form method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the source folder to move:  \n");
             $V .= "<li>{$text}";
             $V .= "<select name='oldfolderid'>\n";
             $V .= FolderListOption(-1, 0, 0);
             $V .= "</select><P />\n";
             $text = _("Select the destination folder:  \n");
             $V .= "<li>{$text}";
             $V .= "<select name='targetfolderid'>\n";
             $V .= FolderListOption(-1, 0);
             $V .= "</select><P />\n";
             $V .= "</ol>\n";
             $text = _("Move");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $PG_CONN;
     $V = "";
     $R = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $folder = GetParm('folder', PARM_INTEGER);
             if (!empty($folder)) {
                 $rc = $this->Delete($folder);
                 $sql = "SELECT * FROM folder where folder_pk = '{$folder}';";
                 $result = pg_query($PG_CONN, $sql);
                 DBCheckResult($result, $sql, __FILE__, __LINE__);
                 $Folder = pg_fetch_assoc($result);
                 pg_free_result($result);
                 if (empty($rc)) {
                     /* Need to refresh the screen */
                     $text = _("Deletion of folder ");
                     $text1 = _(" added to job queue");
                     $R .= displayMessage($text . $Folder['folder_name'] . $text1);
                 } else {
                     $text = _("Deletion of ");
                     $text1 = _(" failed: ");
                     $R .= displayMessage($text . $Folder['folder_name'] . $text1 . $rc);
                 }
             }
             $V .= "{$R}\n";
             $V .= "<form method='post'>\n";
             // no url = this url
             $text = _("Select the folder to");
             $text1 = _("delete");
             $V .= "{$text} <em>{$text1}</em>.\n";
             $V .= "<ul>\n";
             $text = _("This will");
             $text1 = _("delete");
             $text2 = _("the folder, all subfolders, and all uploaded files stored within the folder!");
             $V .= "<li>{$text} <em>{$text1}</em> {$text2}\n";
             $text = _("Be very careful with your selection since you can delete a lot of work!");
             $V .= "<li>{$text}\n";
             $text = _("All analysis only associated with the deleted uploads will also be deleted.");
             $V .= "<li>{$text}\n";
             $text = _("THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.");
             $V .= "<li>{$text}\n";
             $V .= "</ul>\n";
             $text = _("Select the folder to delete:  ");
             $V .= "<P>{$text}\n";
             $V .= "<select name='folder'>\n";
             $text = _("select folder");
             $V .= "<option value=''>[{$text}]</option>\n";
             $V .= FolderListOption(-1, 0);
             $V .= "</select><P />\n";
             $text = _("Delete");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
Exemple #5
0
 /**
  * \brief Display the user record edit form
  * 
  * \param $UserRec - Database users record for the user to be edited.
  * \param $SessionIsAdmin - Boolean: This session is by an admin
  * \return the text of the display form on success, or error on failure.
  */
 function DisplayForm($UserRec, $SessionIsAdmin)
 {
     global $PG_CONN;
     $OutS = "";
     // Output string
     /* Build HTML form */
     $OutS .= "<form name='user_edit' method='POST'>\n";
     $OutS .= "<p><input type='hidden' name='user_pk' value='{$UserRec['user_pk']}'/></p>";
     $OutS .= "<p />\n";
     if ($SessionIsAdmin) {
         $OutS .= _("Select the user to edit: ");
         $OutS .= "<select name='userid' onchange='RefreshPage(this.value);'>\n";
     }
     /* For Admins, get the list of all users 
      * For non-admins, only show themself
      */
     if ($SessionIsAdmin) {
         $sql = "SELECT * FROM users ORDER BY user_name;";
     } else {
         $sql = "SELECT * FROM users WHERE user_pk='" . $UserRec['user_pk'] . "' ORDER BY user_name;";
     }
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     while ($row = pg_fetch_assoc($result)) {
         $Selected = $row['user_pk'] == $UserRec['user_pk'] ? "Selected" : "";
         $OutS .= "<option {$Selected} value='" . $row['user_pk'] . "'>";
         $OutS .= htmlentities($row['user_name']);
         $OutS .= "</option>\n";
     }
     pg_free_result($result);
     $OutS .= "</select><hr>\n";
     $TableStyle = "style='border:1px solid black; border-collapse: collapse; '";
     $TRStyle = "style='border:1px solid black; text-align:left; background:lightyellow;'";
     $OutS .= "<table {$TableStyle} width='100%'>";
     $Field = "user_name";
     $Val = htmlentities($UserRec[$Field], ENT_QUOTES);
     $text = _("Username.");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td><input type='text' value='{$Val}' name='{$Field}' size=20></td>\n";
     $OutS .= "</tr>\n";
     $Field = "user_desc";
     $Val = htmlentities($UserRec[$Field], ENT_QUOTES);
     $text = _("Description (name, contact, or other information).  This may be blank.");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td><input type='text' value='{$Val}' name='{$Field}' size=60></td>\n";
     $OutS .= "</tr>\n";
     $Field = "user_email";
     $Val = htmlentities($UserRec[$Field], ENT_QUOTES);
     $text = _("Email address. This may be blank.");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td><input type='text' value='{$Val}' name='{$Field}' size=60></td>\n";
     $OutS .= "</tr>\n";
     $Field = "email_notify";
     $Checked = $UserRec[$Field] == 'y' ? "checked" : "";
     $text = _("E-mail notification on job completion");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td><input type=checkbox name='{$Field}' {$Checked}></td>";
     $OutS .= "</tr>\n";
     if ($SessionIsAdmin) {
         $Field = "user_perm";
         $Val = htmlentities($UserRec[$Field], ENT_QUOTES);
         $text = _("Select the user's access level.");
         $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
         $OutS .= "<td><select name='{$Field}'>\n";
         $text1 = _("None (very basic, no database access)");
         $text2 = _("Read-only (read, but no writes or downloads)");
         $text4 = _("Read-Write (read, download, or edit information)");
         $text9 = _("Full Administrator (all access including adding and deleting users)");
         $OutS .= "<option " . ($Val == PLUGIN_DB_NONE ? "selected" : "") . " value='" . PLUGIN_DB_NONE . "'>{$text1}</option>\n";
         $OutS .= "<option " . ($Val == PLUGIN_DB_READ ? "selected" : "") . " value='" . PLUGIN_DB_READ . "'>{$text2}</option>\n";
         $OutS .= "<option " . ($Val == PLUGIN_DB_WRITE ? "selected" : "") . " value='" . PLUGIN_DB_WRITE . "'>{$text4}</option>\n";
         $OutS .= "<option " . ($Val == PLUGIN_DB_ADMIN ? "selected" : "") . " value='" . PLUGIN_DB_ADMIN . "'>{$text9}</option>\n";
         $OutS .= "</select></td>\n";
         $OutS .= "</tr>\n";
     }
     if ($SessionIsAdmin) {
         $Field = "root_folder_fk";
         $Val = htmlentities($UserRec[$Field], ENT_QUOTES);
         $text = _("Select the user's top-level folder. Access is restricted to this folder.");
         $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
         $OutS .= "<td><select name='{$Field}'>";
         $ParentFolder = -1;
         $Depth = 0;
         $IncludeTop = 1;
         // include top level folder in selecet list
         $SelectedFolderPk = $UserRec[$Field];
         $OutS .= FolderListOption($ParentFolder, $Depth, $IncludeTop, $SelectedFolderPk);
         $OutS .= "</select></td>\n";
         $OutS .= "</tr>\n";
     }
     if ($SessionIsAdmin) {
         $Checked = $UserRec['_blank_pass'] == 'on' ? "checked" : "";
         $text = _("Blank the user's account. This will will set the password to a blank password.");
         $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
         $OutS .= "<td><input type='checkbox' name='_blank_pass' {$Checked} ></td>\n";
         $OutS .= "</tr>\n";
     }
     $text = _("Password.");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td><input type='password' name='_pass1' size=20></td>\n";
     $OutS .= "</tr>\n";
     $text = _("Re-enter password.");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td><input type='password' name='_pass2' size=20></td>\n";
     $OutS .= "</tr>\n";
     $Field = "user_agent_list";
     $text = _("Default agents selected when uploading data. ");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th><td>";
     $OutS .= AgentCheckBoxMake(-1, array("agent_unpack", "agent_adj2nest", "wget_agent"), $UserRec['user_name']);
     $OutS .= "</td></tr>\n";
     $Field = "default_bucketpool_fk";
     $text = _("Default bucket pool");
     $OutS .= "<tr {$TRStyle}><th width='25%'>{$text}</th>";
     $OutS .= "<td>";
     $OutS .= SelectBucketPool($UserRec[$Field]);
     $OutS .= "</td></tr>\n";
     $OutS .= "</table><P />";
     $text = _("Update Account");
     $OutS .= "<input type='submit' name='UpdateBtn' value='{$text}'>\n";
     $OutS .= "</form>\n";
     return $OutS;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $Folder = GetParm('folder', PARM_INTEGER);
             $GetURL = GetParm('geturl', PARM_TEXT);
             $Desc = GetParm('description', PARM_TEXT);
             // may be null
             $Name = GetParm('name', PARM_TEXT);
             // may be null
             $Accept = GetParm('accept', PARM_TEXT);
             // may be null
             $Reject = GetParm('reject', PARM_TEXT);
             // may be null
             $Level = GetParm('level', PARM_TEXT);
             // may be null
             $public = GetParm('public', PARM_TEXT);
             // may be null
             if (empty($public)) {
                 $public_perm = PERM_NONE;
             } else {
                 $public_perm = PERM_READ;
             }
             if (!empty($GetURL) && !empty($Folder)) {
                 $rc = $this->Upload($Folder, $GetURL, $Desc, $Name, $Accept, $Reject, $Level, $public_perm);
                 if (empty($rc)) {
                     /* Need to refresh the screen */
                     $GetURL = NULL;
                     $Desc = NULL;
                     $Name = NULL;
                     $Accept = NULL;
                     $Reject = NULL;
                     $Level = NULL;
                 } else {
                     $text = _("Upload failed for");
                     $V .= displayMessage("{$text} {$GetURL}: {$rc}");
                 }
             }
             /* Set default values */
             if (empty($Level)) {
                 $Level = 1;
             }
             /* Set default values */
             if (empty($GetURL)) {
                 $GetURL = 'http://';
             }
             /* Display instructions */
             $text22 = _("Starting in FOSSology v 2.2 only your group and any other group you assign will have access to your uploaded files.  To manage your own group go into Admin > Groups > Manage Group Users.  To manage permissions for this one upload, go to Admin > Upload Permissions");
             $V .= "<p><b>{$text22}</b><p>";
             $V .= _("This option permits uploading a single file (which may be iso, tar, rpm, jar, zip, bz2, msi, cab, etc.) or a directory from a remote web or FTP server to FOSSology.\n");
             $V .= _("The file or directory to upload must be accessible via a URL and must not require human interaction ");
             $V .= _("such as login credentials.\n");
             /* Display the form */
             $V .= "<form method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the folder for storing the uploaded file (directory):");
             $V .= "<li>{$text}\n";
             $V .= "<select name='folder'>\n";
             $V .= FolderListOption(-1, 0);
             $V .= "</select><P />\n";
             $text = _("Enter the URL to the file (directory):");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='geturl' size=60 value='" . htmlentities($GetURL) . "'/><br />\n";
             $text = _("NOTE");
             $text1 = _(": If the URL requires authentication or navigation to access, then the upload will fail. Only provide a URL that goes directly to the file (directory). The URL can begin with HTTP://, HTTPS://, or FTP://.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text = _("(Optional) Enter a description of this file (directory):");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='description' size=60 value='" . htmlentities($Desc) . "'/><P />\n";
             $text = _("(Optional) Enter a viewable name for this file (directory):");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='name' size=60 value='" . htmlentities($Name) . "'/><br />\n";
             $text = _("NOTE");
             $text1 = _(": If no name is provided, then the uploaded file (directory) name will be used.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text = _("(Optional) Enter comma-separated lists of file name suffixes or patterns to accept:");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='accept' size=60 value='" . htmlentities($Accept) . "'/><P />\n";
             $text = _("NOTE");
             $text1 = _(": If any of the wildcard characters, *, ?, [ or ], appear in an element of acclist, it will be treated as a pattern, rather than a suffix.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text = _("(Optional) Enter comma-separated lists of file name suffixes or patterns to reject:");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='reject' size=60 value='" . htmlentities($Reject) . "'/><P />\n";
             $text = _("NOTE");
             $text1 = _(": If any of the wildcard characters, *, ?, [ or ], appear in an element of rejlist, it will be treated as a pattern, rather than a suffix.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text = _("(Optional) maximum recursion depth (inf or 0 for infinite):");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='level' size=60 value='" . htmlentities($Level) . "'/><P />\n";
             $text1 = _("(Optional) Make Public");
             $V .= "<li>";
             $V .= "<input type='checkbox' name='public' value='public' > {$text1} <p>\n";
             if (@$_SESSION['UserLevel'] >= PLUGIN_DB_WRITE) {
                 $text = _("Select optional analysis");
                 $V .= "<li>{$text}<br />\n";
                 $Skip = array("agent_unpack", "agent_adj2nest", "wget_agent");
                 $V .= AgentCheckBoxMake(-1, $Skip);
             }
             $V .= "</ol>\n";
             $text = _("Upload");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             $V .= "<p><b>{$text22}</b>";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 public function Output()
 {
     /* If this is a POST, then process the request. */
     $folder = GetParm('folder', PARM_INTEGER);
     if (!empty($folder)) {
         $userId = Auth::getUserId();
         $sql = "SELECT folder_name FROM folder join users on (users.user_pk = folder.user_fk or users.user_perm = 10) where folder_pk = \$1 and users.user_pk = \$2;";
         $Folder = $this->dbManager->getSingleRow($sql, array($folder, $userId), __METHOD__ . "GetRowWithFolderName");
         if (!empty($Folder['folder_name'])) {
             $rc = $this->Delete($folder, $userId);
             if (empty($rc)) {
                 /* Need to refresh the screen */
                 $text = _("Deletion of folder ");
                 $text1 = _(" added to job queue");
                 $this->vars['message'] = $text . $Folder['folder_name'] . $text1;
             } else {
                 $text = _("Deletion of ");
                 $text1 = _(" failed: ");
                 $this->vars['message'] = $text . $Folder['folder_name'] . $text1 . $rc;
             }
         } else {
             $text = _("Cannot delete this folder :: Permission denied");
             $this->vars['message'] = $text;
         }
     }
     $V = "<form method='post'>\n";
     // no url = this url
     $text = _("Select the folder to");
     $text1 = _("delete");
     $V .= "{$text} <em>{$text1}</em>.\n";
     $V .= "<ul>\n";
     $text = _("This will");
     $text1 = _("delete");
     $text2 = _("the folder, all subfolders, and all uploaded files stored within the folder!");
     $V .= "<li>{$text} <em>{$text1}</em> {$text2}\n";
     $text = _("Be very careful with your selection since you can delete a lot of work!");
     $V .= "<li>{$text}\n";
     $text = _("All analysis only associated with the deleted uploads will also be deleted.");
     $V .= "<li>{$text}\n";
     $text = _("THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.");
     $V .= "<li>{$text}\n";
     $V .= "</ul>\n";
     $text = _("Select the folder to delete:  ");
     $V .= "<P>{$text}\n";
     $V .= "<select name='folder'>\n";
     $text = _("select folder");
     $V .= "<option value=''>[{$text}]</option>\n";
     $V .= FolderListOption(-1, 0);
     $V .= "</select><P />\n";
     $text = _("Delete");
     $V .= "<input type='submit' value='{$text}'>\n";
     $V .= "</form>\n";
     return $V;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 public function Output()
 {
     /* If this is a POST, then process the request. */
     $FolderSelectId = GetParm('selectfolderid', PARM_INTEGER);
     if (empty($FolderSelectId)) {
         $FolderSelectId = FolderGetTop();
     }
     $FolderId = GetParm('oldfolderid', PARM_INTEGER);
     $NewName = GetParm('newname', PARM_TEXT);
     $NewDesc = GetParm('newdesc', PARM_TEXT);
     if (!empty($FolderId)) {
         $FolderSelectId = $FolderId;
         $rc = $this->Edit($FolderId, $NewName, $NewDesc);
         if ($rc == 1) {
             /* Need to refresh the screen */
             $text = _("Folder Properties changed");
             $this->vars["message"] = $text;
         }
     }
     /* Get the folder info */
     $sql = 'SELECT * FROM folder WHERE folder_pk = $1;';
     $Folder = $this->dbManager->getSingleRow($sql, array($FolderSelectId), __METHOD__ . "getFolderRow");
     /* Display the form */
     $formVars["onchangeURI"] = Traceback_uri() . "?mod=" . $this->Name . "&selectfolderid=";
     $formVars["folderListOption"] = FolderListOption(-1, 0, 1, $FolderSelectId);
     $formVars["folder_name"] = $Folder['folder_name'];
     $formVars["folder_desc"] = $Folder['folder_desc'];
     return $this->renderString("admin-folder-edit-form.html.twig", $formVars);
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     $R = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $ParentId = GetParm('parentid', PARM_INTEGER);
             $NewFolder = GetParm('newname', PARM_TEXT);
             $Desc = GetParm('description', PARM_TEXT);
             if (!empty($ParentId) && !empty($NewFolder)) {
                 $rc = $this->Create($ParentId, $NewFolder, $Desc);
                 $Uri = Traceback_uri() . "?mod=refresh&remod=" . $this->Name;
                 if ($rc == 1) {
                     /* Need to refresh the screen */
                     $text = _("Folder");
                     $text1 = _("Created");
                     $R .= displayMessage("{$text} {$NewFolder} {$text1}");
                 } else {
                     if ($rc == 4) {
                         $text = _("Folder");
                         $text1 = _("Exists");
                         $R .= displayMessage("{$text} {$NewFolder} {$text1}");
                     }
                 }
             }
             /* Display the form */
             $V .= "{$R}\n";
             $V .= "<form method='POST'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the parent folder:  \n");
             $V .= "<li>{$text}";
             $V .= "<select name='parentid'>\n";
             $root_folder_pk = GetUserRootFolder();
             $V .= FolderListOption($root_folder_pk, 0);
             $V .= "</select><P />\n";
             $text = _("Enter the new folder name:  \n");
             $V .= "<li>{$text}";
             $V .= "<INPUT type='text' name='newname' size=40 />\n<br>";
             $text = _("Enter a meaningful description:  \n");
             $V .= "<br><li>{$text}";
             $V .= "<INPUT type='text' name='description' size=80 />\n";
             $V .= "</ol>\n";
             $text = _("Create");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
Exemple #10
0
 /**
  * \brief Display the user record edit form
  * 
  * \param $UserRec - Database users record for the user to be edited.
  * \param $SessionIsAdmin - Boolean: This session is by an admin
  * \return the text of the display form on success, or error on failure.
  */
 private function DisplayForm($UserRec, $SessionIsAdmin)
 {
     $vars = array('isSessionAdmin' => $SessionIsAdmin, 'userId' => $UserRec['user_pk']);
     /* For Admins, get the list of all users 
      * For non-admins, only show themself
      */
     if ($SessionIsAdmin) {
         $stmt = __METHOD__ . '.asSessionAdmin';
         $sql = "SELECT * FROM users ORDER BY user_name";
         $this->dbManager->prepare($stmt, $sql);
         $res = $this->dbManager->execute($stmt);
         $allUsers = array();
         while ($row = $this->dbManager->fetchArray($res)) {
             $allUsers[$row['user_pk']] = htmlentities($row['user_name']);
         }
         $this->dbManager->freeResult($res);
         $vars['allUsers'] = $allUsers;
     }
     $vars['userName'] = $UserRec['user_name'];
     $vars['userDescription'] = $UserRec['user_desc'];
     $vars['userEMail'] = $UserRec["user_email"];
     $vars['eMailNotification'] = $UserRec['email_notify'] == 'y';
     if ($SessionIsAdmin) {
         $vars['allAccessLevels'] = array(PLUGIN_DB_NONE => _("None (very basic, no database access)"), PLUGIN_DB_READ => _("Read-only (read, but no writes or downloads)"), PLUGIN_DB_WRITE => _("Read-Write (read, download, or edit information)"), PLUGIN_DB_ADMIN => _("Full Administrator (all access including adding and deleting users)"));
         $vars['accessLevel'] = $UserRec['user_perm'];
         $SelectedFolderPk = $UserRec['root_folder_fk'];
         $vars['folderListOption'] = FolderListOption($ParentFolder = -1, $Depth = 0, $IncludeTop = 1, $SelectedFolderPk);
     }
     $vars['isBlankPassword'] = $UserRec['_blank_pass'] == 'on';
     $vars['agentSelector'] = AgentCheckBoxMake(-1, array("agent_unpack", "agent_adj2nest", "wget_agent"), $UserRec['user_name']);
     $vars['bucketPool'] = SelectBucketPool($UserRec["default_bucketpool_fk"]);
     return $vars;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $SourceFiles = GetParm('sourcefiles', PARM_STRING);
             $GroupNames = GetParm('groupnames', PARM_INTEGER);
             $FolderPk = GetParm('folder', PARM_INTEGER);
             $HostName = GetParm('host', PARM_STRING);
             $Desc = GetParm('description', PARM_STRING);
             // may be null
             $Name = GetParm('name', PARM_STRING);
             // may be null
             $public = GetParm('public', PARM_TEXT);
             // may be null
             if (empty($public)) {
                 $public_perm = PERM_NONE;
             } else {
                 $public_perm = PERM_READ;
             }
             if (!empty($SourceFiles) && !empty($FolderPk)) {
                 if (empty($HostName)) {
                     $HostName = "localhost";
                 }
                 $rc = $this->Upload($FolderPk, $SourceFiles, $GroupNames, $Desc, $Name, $HostName, $public_perm);
                 if (empty($rc)) {
                     // clear form fileds
                     $SourceFiles = NULL;
                     $GroupNames = NULL;
                     $FolderPk = NULL;
                     $Desc = NULL;
                     $Name = NULL;
                 } else {
                     $text = _("Upload failed for");
                     $V .= displayMessage("{$text} {$SourceFiles}: {$rc}");
                 }
             }
             /* Display instructions */
             $text22 = _("Starting in FOSSology v 2.2 only your group and any other group you assign will have access to your uploaded files.  To manage your own group go into Admin > Groups > Manage Group Users.  To manage permissions for this one upload, go to Admin > Upload Permissions");
             $V .= "<p><b>{$text22}</b><p>";
             $V .= _("This option permits uploading a file, set of files, or a directory from the web server to FOSSology.\n");
             $V .= _("This option is designed for developers who have large source code directories that they wish to analyze (and the directories are already mounted on the web server's system).\n");
             $V .= _("This option only uploads files located on the FOSSology web server.\n");
             $V .= _("If your file is located elsewhere, then use one of the other upload options.\n");
             /* Display the form */
             $V .= "<form method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the folder for storing the upload:");
             $V .= "<li>{$text}\n";
             $V .= "<select name='folder'>\n";
             //$V .= FolderListOption($FolderPk,0);
             $V .= FolderListOption(-1, 0);
             $V .= "</select>\n";
             $text = _("Select the directory or file(s) on the server to upload:");
             $V .= "<p><li>{$text}<br />\n";
             $hostlist = HostListOption();
             if ($hostlist) {
                 // if only one host, do not display it
                 $V .= "<select name='host'>\n";
                 $V .= $hostlist;
                 $V .= "</select>\n";
             }
             $V .= "<input type='text' name='sourcefiles' size='60' value='" . htmlentities($SourceFiles, ENT_QUOTES) . "'/><br />\n";
             $text = _("NOTE");
             $text1 = _(": Contents under a directory will be recursively included.");
             $V .= "<strong>{$text}</strong>{$text1}\n";
             $V .= _("If you specify the regular expression for the filename, right now, just support '*', then multiple filenames will be selected.\n");
             $text = _("(Optional) Enter a description for this Upload:");
             $V .= "<p><li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='description' size=60 value='" . htmlentities($Desc, ENT_QUOTES) . "'/>\n";
             $text = _("(Optional) Enter a viewable name for this Upload:");
             $V .= "<p><li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='name' size=60 value='" . htmlentities($Name, ENT_QUOTES) . "' /><br />\n";
             $text = _("NOTE");
             $text1 = _(": If no name is provided, then the uploaded file name will be used.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text1 = _("(Optional) Make Public");
             $V .= "<li>";
             $V .= "<input type='checkbox' name='public' value='public' > {$text1} <p>\n";
             if (@$_SESSION['UserLevel'] >= PLUGIN_DB_WRITE) {
                 $text = _("Select optional analysis");
                 $V .= "<li>{$text}<br />\n";
                 $Skip = array("agent_unpack", "agent_adj2nest", "wget_agent");
                 $V .= AgentCheckBoxMake(-1, $Skip);
             }
             $V .= "</ol>\n";
             $text = _("Upload");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             $V .= "<p><b>{$text22}</b><p>";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $Folder = GetParm('folder', PARM_INTEGER);
             $VCSType = GetParm('vcstype', PARM_TEXT);
             $GetURL = GetParm('geturl', PARM_TEXT);
             $Desc = GetParm('description', PARM_TEXT);
             // may be null
             $Name = GetParm('name', PARM_TEXT);
             // may be null
             $Username = GetParm('username', PARM_TEXT);
             $Passwd = GetParm('passwd', PARM_TEXT);
             $public = GetParm('public', PARM_TEXT);
             // may be null
             if (empty($public)) {
                 $public_perm = PERM_NONE;
             } else {
                 $public_perm = PERM_READ;
             }
             if (!empty($GetURL) && !empty($Folder)) {
                 $rc = $this->Upload($Folder, $VCSType, $GetURL, $Desc, $Name, $Username, $Passwd, $public_perm);
                 if (empty($rc)) {
                     /* Need to refresh the screen */
                     $VCSType = NULL;
                     $GetURL = NULL;
                     $Desc = NULL;
                     $Name = NULL;
                     $Username = NULL;
                     $Passwd = NULL;
                 } else {
                     $text = _("Upload failed for");
                     $V .= displayMessage("{$text} {$GetURL}: {$rc}");
                 }
             }
             /* Set default values */
             if (empty($GetURL)) {
                 $GetURL = 'http://';
             }
             /* Display instructions */
             $text22 = _("Starting in FOSSology v 2.2 only your group and any other group you assign will have access to your uploaded files.  To manage your own group go into Admin > Groups > Manage Group Users.  To manage permissions for this one upload, go to Admin > Upload Permissions");
             $V .= "<p><b>{$text22}</b><p>";
             $V .= _("You can upload source code from a version control system; one risk is that FOSSology will store your username/password of a repository to database, also run checkout source code from command line with username and password explicitly.");
             /* Display the form */
             $V .= "<form method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the folder for storing the uploaded file (directory):");
             $V .= "<li>{$text}\n";
             $V .= "<select name='folder'>\n";
             $V .= FolderListOption(-1, 0);
             $V .= "</select><P />\n";
             $text = _("Select the type of version control system:");
             $V .= "<li>{$text}\n";
             $V .= "<select name='vcstype'>\n";
             $V .= "<option value='SVN'>SVN</option>";
             $V .= "<option value='Git'>Git</option>";
             #$V.= "<option value='CVS'>CVS</option>";
             $V .= "</select><P />\n";
             $text = _("Enter the URL of the repo:");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='geturl' size=60 value='" . htmlentities($GetURL) . "'/><br />\n";
             $text = _("NOTE");
             $text1 = _(": The URL can begin with HTTP://, HTTPS:// . When do git upload, if https url fails, please try http URL.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text = _("(Optional) Enter a description of this file (directory):");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='description' size=60 value='" . htmlentities($Desc) . "'/><P />\n";
             $text = _("(Optional) Enter a viewable name for this file (directory):");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='name' size=60 value='" . htmlentities($Name) . "'/><br />\n";
             $text = _("NOTE");
             $text1 = _(": If no name is provided, then the uploaded file (directory) name will be used.");
             $V .= "<b>{$text}</b>{$text1}<P />\n";
             $text = _("(Optional) Username:"******"<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='username' size=60 value='" . htmlentities($Username) . "'/><P />\n";
             $text = _("(Optional) Password:"******"<li>{$text}<br />\n";
             $V .= "<INPUT type='password' name='passwd' size=60 value='" . htmlentities($Passwd) . "'/><P />\n";
             $text1 = _("(Optional) Make Public");
             $V .= "<li>";
             $V .= "<input type='checkbox' name='public' value='public' > {$text1} <p>\n";
             if (@$_SESSION['UserLevel'] >= PLUGIN_DB_WRITE) {
                 $text = _("Select optional analysis");
                 $V .= "<li>{$text}<br />\n";
                 $Skip = array("agent_unpack", "agent_adj2nest", "wget_agent");
                 $V .= AgentCheckBoxMake(-1, $Skip);
             }
             $V .= "</ol>\n";
             $text = _("Upload");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             $V .= "<p><b>{$text22}</b>";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $folder_pk = GetParm('folder', PARM_INTEGER);
             $Desc = GetParm('description', PARM_TEXT);
             // may be null
             $Name = GetParm('name', PARM_TEXT);
             // may be null
             $public = GetParm('public', PARM_TEXT);
             // may be null
             if (empty($public)) {
                 $public_perm = PERM_NONE;
             } else {
                 $public_perm = PERM_READ;
             }
             if (file_exists(@$_FILES['getfile']['tmp_name']) && !empty($folder_pk)) {
                 $rc = $this->Upload($folder_pk, @$_FILES['getfile']['tmp_name'], $Desc, $Name, $public_perm);
                 if (empty($rc)) {
                     // reset form fields
                     $GetURL = NULL;
                     $Desc = NULL;
                     $Name = NULL;
                 } else {
                     $text = _("Upload failed for file");
                     $V .= displayMessage("{$text} {$_FILES['getfile']['name']}: {$rc}");
                 }
             }
             /* Set default values */
             if (empty($GetURL)) {
                 $GetURL = 'http://';
             }
             /* Display instructions */
             $text22 = _("Starting in FOSSology v 2.2 only your group and any other group you assign will have access to your uploaded files.  To manage your own group go into Admin > Groups > Manage Group Users.  To manage permissions for this one upload, go to Admin > Upload Permissions");
             $V .= "<p><b>{$text22}</b><p>";
             $V .= _("This option permits uploading a single file (which may be iso, tar, rpm, jar, zip, bz2, msi, cab, etc.) from your computer to FOSSology.\n");
             $V .= _("Your FOSSology server has imposed a maximum upload file size of");
             $V .= " " . ini_get('upload_max_filesize') . " ";
             $V .= _("bytes.");
             /* Display the form */
             $V .= "<form enctype='multipart/form-data' method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the folder for storing the uploaded file:");
             $V .= "<li>{$text}\n";
             $V .= "<select name='folder'>\n";
             $V .= FolderListOption(-1, 0);
             $V .= "</select><P />\n";
             $text = _("Select the file to upload:");
             $V .= "<li>{$text}<br />\n";
             $V .= "<input name='getfile' size='60' type='file' /><br />\n";
             $text = _("(Optional) Enter a description of this file:");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='description' size=60 value='" . htmlentities($Desc) . "'/><P />\n";
             $text = _("(Optional) Enter a viewable name for this file:");
             $V .= "<li>{$text}<br />\n";
             $V .= "<INPUT type='text' name='name' size=60 value='" . htmlentities($Name) . "'/><br />\n";
             $text1 = _("If no name is provided, then the uploaded file name will be used.");
             $V .= "{$text1}<P />\n";
             $text1 = _("(Optional) Make Public");
             $V .= "<li>";
             $V .= "<input type='checkbox' name='public' value='public' > {$text1} <p>\n";
             if (@$_SESSION['UserLevel'] >= PLUGIN_DB_WRITE) {
                 $text = _("Select optional analysis");
                 $V .= "<li>{$text}<br />\n";
                 $Skip = array("agent_unpack", "agent_adj2nest", "wget_agent");
                 $V .= AgentCheckBoxMake(-1, $Skip);
                 $V .= "<p>";
             }
             $V .= "</ol>\n";
             $text = _("After you press Upload, please be patient while your file is transferring.");
             $V .= "<p>{$text}<br>\n";
             $text = _("Upload");
             $V .= "<p>&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' value='{$text}'>\n";
             $V .= "</form>\n";
             $V .= "<p><b>{$text22}</b><p>";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     global $PG_CONN;
     global $PERM_NAMES;
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $User = GetParm('username', PARM_TEXT);
             if (!empty($User)) {
                 $rc = $this->Add();
                 if (empty($rc)) {
                     /* Need to refresh the screen */
                     $text = _("User");
                     $text1 = _("added");
                     $V .= displayMessage("{$text} {$User} {$text1}.");
                 } else {
                     $V .= displayMessage($rc);
                 }
             }
             $default_bucketpool_fk = 0;
             /* Build HTML form */
             $V .= "<form name='formy' method='POST'>\n";
             // no url = this url
             $V .= _("To create a new user, enter the following information:<P />\n");
             $Style = "<tr><td colspan=2 style='background:black;'></td></tr><tr>";
             $V .= "<table style='border:1px solid black; text-align:left; background:lightyellow;' width='75%'>";
             $Val = htmlentities(GetParm('username', PARM_TEXT), ENT_QUOTES);
             $text = _("Username");
             $V .= "{$Style}<th width='25%' >{$text}</th>";
             $V .= "<td><input type='text' value='{$Val}' name='username' size=20></td>\n";
             $V .= "</tr>\n";
             $Val = htmlentities(GetParm('description', PARM_TEXT), ENT_QUOTES);
             $text = _("Description, full name, contact, etc. (optional)");
             $V .= "{$Style}<th>{$text}</th>\n";
             $V .= "<td><input type='text' name='description' value='{$Val}' size=60></td>\n";
             $V .= "</tr>\n";
             $Val = htmlentities(GetParm('email', PARM_TEXT), ENT_QUOTES);
             $text = _("Email address (optional)");
             $V .= "{$Style}<th>{$text}</th>\n";
             $V .= "<td><input type='text' name='email' value='{$Val}' size=60></td>\n";
             $V .= "</tr>\n";
             $text = _("Access level");
             $V .= "{$Style}<th>{$text}</th>";
             $V .= "<td><select name='permission'>\n";
             $text = _("None (very basic, no database access)");
             $V .= "<option value='" . PLUGIN_DB_NONE . "'>{$text}</option>\n";
             $text = _("Read-only (read, but no writes or downloads)");
             $V .= "<option selected value='" . PLUGIN_DB_READ . "'>{$text}</option>\n";
             $text = _("Read-Write (read, download, or edit information)");
             $V .= "<option value='" . PLUGIN_DB_WRITE . "'>{$text}</option>\n";
             $text = _("Full Administrator (all access including adding and deleting users)");
             $V .= "<option value='" . PLUGIN_DB_ADMIN . "'>{$text}</option>\n";
             $V .= "</select></td>\n";
             $V .= "</tr>\n";
             $text = _("User root folder");
             $V .= "{$Style}<th>{$text}";
             $V .= "</th>";
             $V .= "<td><select name='folder'>";
             $V .= FolderListOption(-1, 0);
             $V .= "</select></td>\n";
             $V .= "</tr>\n";
             $text = _("Password (optional)");
             $V .= "{$Style}<th>{$text}</th><td><input type='password' name='pass1' size=20></td>\n";
             $V .= "</tr>\n";
             $text = _("Re-enter password");
             $V .= "{$Style}<th>{$text}</th><td><input type='password' name='pass2' size=20></td>\n";
             $V .= "</tr>\n";
             $text = _("E-mail Notification");
             $text1 = _("Check to enable email notification when upload scan completes .");
             $V .= "{$Style}<th>{$text}</th><td><input type='checkbox'" . "name='enote' value='y' checked='checked'>" . "{$text1}</td>\n";
             $V .= "</tr>\n";
             $text = _("Agents selected by default when uploading");
             $V .= "{$Style}<th>{$text}\n</th><td> ";
             $V .= AgentCheckBoxMake(-1, array("agent_unpack", "agent_adj2nest", "wget_agent"));
             $V .= "</td>\n";
             $text = _("Default bucketpool");
             $V .= "{$Style}<th>{$text}</th>";
             $V .= "<td>";
             $V .= SelectBucketPool($default_bucketpool_fk);
             $V .= "</td>";
             $V .= "</tr>\n";
             /*
                     /******  New Upload Group ****** /
                     /* Get master array of groups * /
                     $sql = "select group_pk, group_name from groups order by group_name";
                     $groupresult = pg_query($PG_CONN, $sql);
                     DBCheckResult($groupresult, $sql, __FILE__, __LINE__);
                     $GroupArray = array();
                     while ($GroupRow = pg_fetch_assoc($groupresult))
                       $GroupArray[$GroupRow['group_pk']] = $GroupRow['group_name'];
                     pg_free_result($groupresult);
                     $text = _("Group to give access permission for every new upload");
                     $V.= "$Style<th>$text</th>";
                     $V.= "<td>";
                     $V .= Array2SingleSelect($GroupArray, "new_upload_group_fk", "", true, false);
                     $V.= "</td>";
                     $V .= "</tr>\n";
             
                     /******  New Upload Permissions ****** /
                     $text = _("Access Permission to give the above group");
                     $V.= "$Style<th>$text</th>";
                     $V.= "<td>";
                     $V .= Array2SingleSelect($PERM_NAMES, "new_upload_perm", "", true, false);
                     $V.= "</td>";
                     $V .= "</tr>\n";
             */
             $V .= "</table border=0><P />";
             $text = _("Add User");
             $V .= "<input type='submit' value='{$text}'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 public function Output()
 {
     $V = "";
     /* If this is a POST, then process the request. */
     $ParentId = GetParm('parentid', PARM_INTEGER);
     $NewFolder = GetParm('newname', PARM_TEXT);
     $Desc = GetParm('description', PARM_TEXT);
     if (!empty($ParentId) && !empty($NewFolder)) {
         $rc = $this->create($ParentId, $NewFolder, $Desc);
         if ($rc == 1) {
             /* Need to refresh the screen */
             $text = _("Folder");
             $text1 = _("Created");
             $this->vars['message'] = "{$text} {$NewFolder} {$text1}";
         } else {
             if ($rc == 4) {
                 $text = _("Folder");
                 $text1 = _("Exists");
                 $this->vars['message'] = "{$text} {$NewFolder} {$text1}";
             }
         }
     }
     /* Display the form */
     $V .= "<form method='POST'>\n";
     // no url = this url
     $V .= "<ol>\n";
     $text = _("Select the parent folder:  \n");
     $V .= "<li>{$text}";
     $V .= "<select name='parentid'>\n";
     $root_folder_pk = GetUserRootFolder();
     $V .= FolderListOption($root_folder_pk, 0);
     $V .= "</select><P />\n";
     $text = _("Enter the new folder name:  \n");
     $V .= "<li>{$text}";
     $V .= "<INPUT type='text' name='newname' size=40 />\n<br>";
     $text = _("Enter a meaningful description:  \n");
     $V .= "<br><li>{$text}";
     $V .= "<INPUT type='text' name='description' size=80 />\n";
     $V .= "</ol>\n";
     $text = _("Create");
     $V .= "<input type='submit' value='{$text}!'>\n";
     $V .= "</form>\n";
     return $V;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 public function Output()
 {
     /* If this is a POST, then process the request. */
     $ParentId = GetParm('parentid', PARM_INTEGER);
     $NewFolder = GetParm('newname', PARM_TEXT);
     $Desc = GetParm('description', PARM_TEXT);
     if (!empty($ParentId) && !empty($NewFolder)) {
         $rc = $this->create($ParentId, $NewFolder, $Desc);
         if ($rc == 1) {
             /* Need to refresh the screen */
             $text = _("Folder");
             $text1 = _("Created");
             $this->vars['message'] = "{$text} " . htmlentities($NewFolder) . " {$text1}";
         } else {
             if ($rc == 4) {
                 $text = _("Folder");
                 $text1 = _("Exists");
                 $this->vars['message'] = "{$text} " . htmlentities($NewFolder) . " {$text1}";
             }
         }
     }
     $root_folder_pk = GetUserRootFolder();
     $formVars["folderOptions"] = FolderListOption($root_folder_pk, 0);
     return $this->renderString("admin-folder-create-form.html.twig", $formVars);
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $Folder = GetParm('folder', PARM_INTEGER);
             if (empty($Folder)) {
                 $Folder = FolderGetTop();
             }
             $uploadpk = GetParm('upload', PARM_INTEGER);
             if (array_key_exists('agents', $_REQUEST)) {
                 $agents = $_POST['agents'];
             } else {
                 $agents = '';
             }
             if (!empty($uploadpk) && !empty($agents) && is_array($agents)) {
                 $rc = $this->AgentsAdd($uploadpk, $agents);
                 if (empty($rc)) {
                     $URL = Traceback_uri() . "?mod=showjobs&upload={$uploadpk} ";
                     /* Need to refresh the screen */
                     $text = _("Your jobs have been added to job queue.");
                     $LinkText = _("View Jobs");
                     $msg = "{$text} <a href={$URL}>{$LinkText}</a>";
                     $V .= displayMessage($msg);
                 } else {
                     $text = _("Scheduling of Agent(s) failed: ");
                     $V .= displayMessage($text . $rc);
                 }
             }
             /**
              * Create the AJAX (Active HTTP) javascript for doing the reply
              * and showing the response. 
              */
             $V .= ActiveHTTPscript("Uploads");
             $V .= "<script language='javascript'>\n";
             $V .= "function Uploads_Reply()\n";
             $V .= "  {\n";
             $V .= "  if ((Uploads.readyState==4) && (Uploads.status==200))\n";
             $V .= "    {\n";
             /* Remove all options */
             $V .= "    document.getElementById('uploaddiv').innerHTML = '<select size=\\'10\\' name=\\'upload\\' onChange=\\'Agents_Get(\"" . Traceback_uri() . "?mod=upload_agent_options&upload=\" + this.value)\\'>' + Uploads.responseText + '</select><P />';\n";
             //$V .= "alert(document.getElementById('uploaddiv').innerHTML)\n";
             $V .= "    document.getElementById('agentsdiv').innerHTML = '';\n";
             /* Add new options */
             $V .= "    }\n";
             $V .= "  }\n";
             $V .= "</script>\n";
             $V .= ActiveHTTPscript("Agents");
             $V .= "<script language='javascript'>\n";
             $V .= "function Agents_Reply()\n";
             $V .= "  {\n";
             $V .= "  if ((Agents.readyState==4) && (Agents.status==200))\n";
             $V .= "    {\n";
             /* Remove all options */
             $V .= "    document.getElementById('agentsdiv').innerHTML = '<select multiple size=\\'10\\' id=\\'agents\\' name=\\'agents[]\\'>' + Agents.responseText + '</select>';\n";
             /* Add new options */
             $V .= "    }\n";
             $V .= "  }\n";
             $V .= "</script>\n";
             /*************************************************************/
             /* Display the form */
             $V .= "<form name='formy' method='post'>\n";
             // no url = this url
             $V .= _("Select an uploaded file for additional analysis.\n");
             $V .= "<ol>\n";
             $text = _("Select the folder containing the upload you wish to analyze:");
             $V .= "<li>{$text}<br>\n";
             $V .= "<select name='folder'\n";
             $V .= "onLoad='Uploads_Get((\"" . Traceback_uri() . "?mod=upload_options&folder={$Folder}' ";
             $V .= "onChange='Uploads_Get(\"" . Traceback_uri() . "?mod=upload_options&folder=\" + this.value)'>\n";
             $V .= FolderListOption(-1, 0, 1, $Folder);
             $V .= "</select><P />\n";
             $text = _("Select the upload to analyze:");
             $V .= "<li>{$text}<br>";
             $V .= "<div id='uploaddiv'>\n";
             $V .= "<select size='10' name='upload' onChange='Agents_Get(\"" . Traceback_uri() . "?mod=upload_agent_options&upload=\" + this.value)'>\n";
             $List = FolderListUploads_perm($Folder, PERM_WRITE);
             foreach ($List as $L) {
                 $V .= "<option value='" . $L['upload_pk'] . "'>";
                 $V .= htmlentities($L['name']);
                 if (!empty($L['upload_desc'])) {
                     $V .= " (" . htmlentities($L['upload_desc']) . ")";
                 }
                 $V .= "</option>\n";
             }
             $V .= "</select><P />\n";
             $V .= "</div>\n";
             $text = _("Select additional analysis.");
             $V .= "<li>{$text}<br>\n";
             $V .= "<div id='agentsdiv'>\n";
             $V .= "<select multiple size='10' id='agents' name='agents[]'></select>\n";
             $V .= "</div>\n";
             $V .= "</ol>\n";
             $text = _("Analyze");
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     global $Plugins;
     global $PG_CONN;
     global $PERM_NAMES;
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $text = _("Move upload to different folder.");
             $V .= "<H2>{$text}</H1>\n";
             /* If this is a POST, then process the request. */
             $OldFolderId = GetParm('oldfolderid', PARM_INTEGER);
             $UploadId = GetParm('uploadid', PARM_INTEGER);
             $TargetFolderId = GetParm('targetfolderid', PARM_INTEGER);
             if (!empty($OldFolderId) && !empty($TargetFolderId)) {
                 /* check upload permission */
                 $UploadPerm = GetUploadPerm($UploadId);
                 if ($UploadPerm < PERM_WRITE) {
                     $text = _("Permission Denied");
                     echo "<h2>{$text}<h2>";
                     return;
                 }
                 $rc = $this->Move($UploadId, $TargetFolderId, $OldFolderId);
                 if ($rc == 1) {
                     /* Need to refresh the screen */
                     $sql = "SELECT * FROM folder where folder_pk = '{$TargetFolderId}';";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $NRow = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $sql = "SELECT pfile_fk FROM upload WHERE upload_pk='{$UploadId}';";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $row = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $pfileNum = $row['pfile_fk'];
                     $sql = "SELECT ufile_name FROM uploadtree WHERE " . "upload_fk='{$UploadId}' and pfile_fk={$pfileNum};";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $row = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $base = basename($row['ufile_name']);
                     $sql = "SELECT * FROM folder where folder_pk = '{$OldFolderId}';";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $ORow = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $text = _("Moved");
                     $text1 = _("from folder");
                     $text2 = _("to folder");
                     $success = "{$text} {$base} {$text1} {$ORow['folder_name']} {$text2} {$NRow['folder_name']}";
                     $V .= displayMessage($success);
                 }
             }
             /* Create the AJAX (Active HTTP) javascript for doing the reply
                and showing the response. */
             $V .= ActiveHTTPscript("Uploads");
             $V .= "<script language='javascript'>\n";
             $V .= "function Uploads_Reply()\n";
             $V .= "  {\n";
             $V .= "  if ((Uploads.readyState==4) && (Uploads.status==200))\n";
             $V .= "    {\n";
             /* Remove all options */
             $V .= "    document.getElementById('uploaddiv').innerHTML = '<select name=\\'uploadid\\'>' + Uploads.responseText + '</select><P />';\n";
             /* Add new options */
             $V .= "    }\n";
             $V .= "  }\n";
             $V .= "</script>\n";
             /* Build the  HTML form */
             $V .= "<form name='formy' method='post'>\n";
             // no url = this url
             /* Display the form */
             $V .= "<form method='post'>\n";
             // no url = this url
             $V .= "<ol>\n";
             $text = _("Select the folder containing the upload you wish to move:  \n");
             $V .= "<li>{$text}";
             $V .= "<select name='oldfolderid'\n";
             $V .= "onLoad='Uploads_Get((\"" . Traceback_uri() . "?mod=upload_options&folder=-1' ";
             $V .= "onChange='Uploads_Get(\"" . Traceback_uri() . "?mod=upload_options&folder=\" + this.value)'>\n";
             $root_folder_pk = GetUserRootFolder();
             $V .= FolderListOption($root_folder_pk, 0);
             $V .= "</select><P />\n";
             $text = _("Select the upload you wish to move:  \n");
             $V .= "<li>{$text}";
             $V .= "<div id='uploaddiv'>\n";
             $V .= "<select name='uploadid'>\n";
             $List = FolderListUploads_perm($root_folder_pk, PERM_WRITE);
             foreach ($List as $L) {
                 $V .= "<option value='" . $L['upload_pk'] . "'>";
                 $V .= htmlentities($L['name']);
                 if (!empty($L['upload_desc'])) {
                     $V .= " (" . htmlentities($L['upload_desc']) . ")";
                 }
                 if (!empty($L['upload_ts'])) {
                     $V .= " :: " . substr($L['upload_ts'], 0, 19);
                 }
                 $V .= "</option>\n";
             }
             $V .= "</select><P />\n";
             $V .= "</div>\n";
             $text = _("Select the destination folder:  \n");
             $V .= "<li>{$text}";
             $V .= "<select name='targetfolderid'>\n";
             $V .= FolderListOption($root_folder_pk, 0);
             $V .= "</select><P />\n";
             $V .= "</ol>\n";
             $text = "Move";
             $V .= "<input type='submit' value='{$text}!'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 function Output()
 {
     global $PG_CONN;
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     $folder_pk = GetParm('folder', PARM_TEXT);
     $FolderSelectId = GetParm('selectfolderid', PARM_INTEGER);
     if (empty($FolderSelectId)) {
         $FolderSelectId = GetUserRootFolder();
     }
     $NewName = GetArrayVal("newname", $_POST);
     $NewDesc = GetArrayVal("newdesc", $_POST);
     $upload_pk = GetArrayVal("upload_pk", $_POST);
     if (empty($upload_pk)) {
         $upload_pk = GetParm('upload', PARM_INTEGER);
     }
     /* Check Upload permission */
     if (!empty($upload_pk)) {
         $UploadPerm = GetUploadPerm($upload_pk);
         if ($UploadPerm < PERM_WRITE) {
             $text = _("Permission Denied");
             echo "<h2>{$text}<h2>";
             return;
         }
     }
     $rc = $this->UpdateUploadProperties($upload_pk, $NewName, $NewDesc);
     if ($rc == 0) {
         $text = _("Nothing to Change");
         $V .= displayMessage($text);
     } else {
         if ($rc == 1) {
             $text = _("Upload Properties successfully changed");
             $V .= displayMessage($text);
         }
     }
     /* define js_url */
     $V .= js_url();
     /* Build the HTML form */
     $V .= "<form name='formy' method='post'>\n";
     // no url = this url
     $V .= "<ol>\n";
     $text = _("Select the folder that contains the upload:  \n");
     $V .= "<li>{$text}";
     /*** Display folder select list, on change request new page with folder= in url ***/
     $Uri = Traceback_uri() . "?mod=" . $this->Name . "&selectfolderid=";
     $V .= "<select name='oldfolderid' onChange='window.location.href=\"{$Uri}\" + this.value'>\n";
     $V .= FolderListOption(-1, 0, 1, $FolderSelectId);
     $V .= "</select><P />\n";
     /*** Display upload select list, on change, request new page with new upload= in url ***/
     $text = _("Select the upload you wish to edit:  \n");
     $V .= "<li>{$text}";
     // Get list of all upload records in this folder
     $UploadList = FolderListUploads_perm($FolderSelectId, PERM_WRITE);
     // Make data array for upload select list.  Key is upload_pk, value is a composite
     // of the upload_filename and upload_ts.
     $UploadArray = array();
     foreach ($UploadList as $UploadRec) {
         $SelectText = htmlentities($UploadRec['name']);
         if (!empty($UploadRec['upload_ts'])) {
             $SelectText .= ", " . substr($UploadRec['upload_ts'], 0, 19);
         }
         $UploadArray[$UploadRec['upload_pk']] = $SelectText;
     }
     /* Get selected upload info to display*/
     if (empty($upload_pk)) {
         // no upload selected, so use the top one in the select list
         reset($UploadArray);
         $upload_pk = key($UploadArray);
     }
     if ($upload_pk) {
         // case where upload is set in the URL
         $sql = "SELECT * FROM upload WHERE upload_pk = '{$upload_pk}'";
         $result = pg_query($PG_CONN, $sql);
         DBCheckResult($result, $sql, __FILE__, __LINE__);
         if (pg_num_rows($result) == 0) {
             /* Bad upload_pk */
             $text = _("Missing upload.");
             $V .= displayMessage($text);
             pg_free_result($result);
             return 0;
         }
         $UploadRec = pg_fetch_assoc($result);
         pg_free_result($result);
         $V .= "<INPUT type='hidden' name='upload_pk' value='{$upload_pk}' />\n";
     } else {
         // no uploads in the folder
         $UploadRec = array();
     }
     $url = Traceback_uri() . "?mod=upload_properties&folder={$folder_pk}&upload=";
     $onchange = "onchange=\"js_url(this.value, '{$url}')\"";
     $V .= Array2SingleSelect($UploadArray, "uploadselect", $upload_pk, false, false, $onchange);
     /* Input upload_filename */
     $text = _("Upload name:  \n");
     $V .= "<li>{$text}";
     if (empty($UploadRec['upload_filename'])) {
         $upload_filename = "";
     } else {
         $upload_filename = htmlentities($UploadRec['upload_filename']);
     }
     $V .= "<INPUT type='text' name='newname' size=40 value='{$upload_filename}' />\n";
     /* Input upload_desc */
     $text = _("Upload description:  \n");
     $V .= "<li>{$text}";
     if (empty($UploadRec['upload_desc'])) {
         $upload_desc = "";
     } else {
         $upload_desc = htmlentities($UploadRec['upload_desc'], ENT_QUOTES);
     }
     $V .= "<INPUT type='text' name='newdesc' size=60 value='{$upload_desc}' />\n";
     $V .= "</ol>\n";
     $text = _("Edit");
     $V .= "<input type='submit' value='{$text}!'>\n";
     $V .= "</form>\n";
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
Exemple #20
0
 public function Output()
 {
     /* If this is a POST, then process the request. */
     $User = GetParm('username', PARM_TEXT);
     if (!empty($User)) {
         $rc = $this->Add();
         if (empty($rc)) {
             $text = _("User");
             $text1 = _("added");
             $this->vars['message'] = "{$text} {$User} {$text1}.";
         } else {
             $this->vars['message'] = $rc;
         }
     }
     $V = "<form name='formy' method='POST'>\n";
     $V .= _("To create a new user, enter the following information:<P />\n");
     $Style = "<tr><td colspan=2 style='background:black;'></td></tr><tr>";
     $V .= "<table style='border:1px solid black; text-align:left; background:lightyellow;' width='75%'>";
     $Val = htmlentities(GetParm('username', PARM_TEXT), ENT_QUOTES);
     $text = _("Username");
     $V .= "{$Style}<th width='25%' >{$text}</th>";
     $V .= "<td><input type='text' value='{$Val}' name='username' size=20></td>\n";
     $V .= "</tr>\n";
     $Val = htmlentities(GetParm('description', PARM_TEXT), ENT_QUOTES);
     $text = _("Description, full name, contact, etc. (optional)");
     $V .= "{$Style}<th>{$text}</th>\n";
     $V .= "<td><input type='text' name='description' value='{$Val}' size=60></td>\n";
     $V .= "</tr>\n";
     $Val = htmlentities(GetParm('email', PARM_TEXT), ENT_QUOTES);
     $text = _("Email address (optional)");
     $V .= "{$Style}<th>{$text}</th>\n";
     $V .= "<td><input type='text' name='email' value='{$Val}' size=60></td>\n";
     $V .= "</tr>\n";
     $text = _("Access level");
     $V .= "{$Style}<th>{$text}</th>";
     $V .= "<td><select name='permission'>\n";
     $text = _("None (very basic, no database access)");
     $V .= "<option value='" . PLUGIN_DB_NONE . "'>{$text}</option>\n";
     $text = _("Read-only (read, but no writes or downloads)");
     $V .= "<option selected value='" . PLUGIN_DB_READ . "'>{$text}</option>\n";
     $text = _("Read-Write (read, download, or edit information)");
     $V .= "<option value='" . PLUGIN_DB_WRITE . "'>{$text}</option>\n";
     $text = _("Full Administrator (all access including adding and deleting users)");
     $V .= "<option value='" . PLUGIN_DB_ADMIN . "'>{$text}</option>\n";
     $V .= "</select></td>\n";
     $V .= "</tr>\n";
     $text = _("User root folder");
     $V .= "{$Style}<th>{$text}";
     $V .= "</th>";
     $V .= "<td><select name='folder'>";
     $V .= FolderListOption(-1, 0);
     $V .= "</select></td>\n";
     $V .= "</tr>\n";
     $text = _("Password (optional)");
     $V .= "{$Style}<th>{$text}</th><td><input type='password' name='pass1' size=20></td>\n";
     $V .= "</tr>\n";
     $text = _("Re-enter password");
     $V .= "{$Style}<th>{$text}</th><td><input type='password' name='pass2' size=20></td>\n";
     $V .= "</tr>\n";
     $text = _("E-mail Notification");
     $text1 = _("Check to enable email notification when upload scan completes .");
     $V .= "{$Style}<th>{$text}</th><td><input type='checkbox'" . "name='enote' value='y' checked='checked'>" . "{$text1}</td>\n";
     $V .= "</tr>\n";
     $text = _("Agents selected by default when uploading");
     $V .= "{$Style}<th>{$text}\n</th><td> ";
     $V .= AgentCheckBoxMake(-1, array("agent_unpack", "agent_adj2nest", "wget_agent"));
     $V .= "</td>\n";
     $text = _("Default bucketpool");
     $V .= "{$Style}<th>{$text}</th>";
     $V .= "<td>";
     $default_bucketpool_fk = 0;
     $V .= SelectBucketPool($default_bucketpool_fk);
     $V .= "</td>";
     $V .= "</tr>\n";
     $V .= "</table border=0><P />";
     $text = _("Add User");
     $V .= "<input type='submit' value='{$text}'>\n";
     $V .= "</form>\n";
     return $V;
 }
 /**
  * \brief Generate the text for this plugin.
  */
 public function Output()
 {
     $V = "";
     /* If this is a POST, then process the request. */
     $uploadpk = GetParm('upload', PARM_INTEGER);
     if (!empty($uploadpk)) {
         $rc = $this->Delete($uploadpk);
         if (empty($rc)) {
             /* Need to refresh the screen */
             $URL = Traceback_uri() . "?mod=showjobs&upload={$uploadpk} ";
             $LinkText = _("View Jobs");
             $text = _("Deletion added to job queue.");
             $msg = "{$text} <a href={$URL}>{$LinkText}</a>";
             $V .= displayMessage($msg);
         } else {
             $text = _("Deletion Scheduling failed: ");
             $V .= DisplayMessage($text . $rc);
         }
     }
     /* Create the AJAX (Active HTTP) javascript for doing the reply
        and showing the response. */
     $V .= ActiveHTTPscript("Uploads");
     $V .= "<script language='javascript'>\n";
     $V .= "function Uploads_Reply()\n";
     $V .= "  {\n";
     $V .= "  if ((Uploads.readyState==4) && (Uploads.status==200))\n";
     $V .= "    {\n";
     /* Remove all options */
     //$V.= "    document.formy.upload.innerHTML = Uploads.responseText;\n";
     $V .= "    document.getElementById('uploaddiv').innerHTML = '<BR><select name=\\'upload\\' size=\\'10\\'>' + Uploads.responseText + '</select><P />';\n";
     /* Add new options */
     $V .= "    }\n";
     $V .= "  }\n";
     $V .= "</script>\n";
     /* Build HTML form */
     $V .= "<form name='formy' method='post'>\n";
     // no url = this url
     $text = _("Select the uploaded file to");
     $text1 = _("delete");
     $V .= "{$text} <em>{$text1}</em>\n";
     $V .= "<ul>\n";
     $text = _("This will");
     $text1 = _("delete");
     $text2 = _("the upload file!");
     $V .= "<li>{$text} <em>{$text1}</em> {$text2}\n";
     $text = _("Be very careful with your selection since you can delete a lot of work!\n");
     $V .= "<li>{$text}";
     $text = _("All analysis only associated with the deleted upload file will also be deleted.\n");
     $V .= "<li>{$text}";
     $text = _("THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.\n");
     $V .= "<li>{$text}";
     $V .= "</ul>\n";
     $text = _("Select the uploaded file to delete:");
     $V .= "<P>{$text}<P>\n";
     $V .= "<ol>\n";
     $text = _("Select the folder containing the file to delete: ");
     $V .= "<li>{$text}";
     $V .= "<select name='folder' ";
     $V .= "onLoad='Uploads_Get((\"" . Traceback_uri() . "?mod=upload_options&folder=-1' ";
     $V .= "onChange='Uploads_Get(\"" . Traceback_uri() . "?mod=upload_options&folder=\" + this.value)'>\n";
     $root_folder_pk = GetUserRootFolder();
     $V .= FolderListOption($root_folder_pk, 0);
     $V .= "</select><P />\n";
     $text = _("Select the uploaded project to delete:");
     $V .= "<li>{$text}";
     $V .= "<div id='uploaddiv'>\n";
     $V .= "<BR><select name='upload' size='10'>\n";
     $List = FolderListUploads_perm($root_folder_pk, Auth::PERM_WRITE);
     foreach ($List as $L) {
         $V .= "<option value='" . $L['upload_pk'] . "'>";
         $V .= htmlentities($L['name']);
         if (!empty($L['upload_desc'])) {
             $V .= " (" . htmlentities($L['upload_desc']) . ")";
         }
         if (!empty($L['upload_ts'])) {
             $V .= " :: " . substr($L['upload_ts'], 0, 19);
         }
         $V .= "</option>\n";
     }
     $V .= "</select><P />\n";
     $V .= "</div>\n";
     $V .= "</ol>\n";
     $text = _("Delete");
     $V .= "<input type='submit' value='{$text}!'>\n";
     $V .= "</form>\n";
     return $V;
 }
 public function Output()
 {
     $V = "";
     $upload_id = GetParm('upload', PARM_INTEGER);
     $manage = GetParm('manage', PARM_TEXT);
     /* If this is a POST, then process the request. */
     $Folder = GetParm('folder', PARM_INTEGER);
     if (empty($Folder)) {
         $Folder = FolderGetTop();
     }
     $rc = $this->ManageTag($Folder, $upload_id, $manage);
     if (1 == $rc) {
         $text1 = _("all uploads in folder");
         $text2 = _("in folder");
         $folder_path = FolderGetName($Folder);
         $upload_name = GetUploadName($upload_id);
         if (empty($upload_id)) {
             $text = $text1;
         } else {
             $text = "'{$upload_name}' {$text2}";
         }
         $Msg = "{$manage} {$text} '{$folder_path}'";
         $this->vars['message'] = $Msg;
         // reset form fields
     }
     /**
      * Create the AJAX (Active HTTP) javascript for doing the reply
      * and showing the response.
      * get upload list under one folder
      */
     $V .= ActiveHTTPscript("Uploads");
     $V .= "<script language='javascript'>\n";
     $V .= "function Uploads_Reply()\n";
     $V .= "  {\n";
     $V .= "  if ((Uploads.readyState==4) && (Uploads.status==200))\n";
     $V .= "    {\n";
     $V .= "    document.getElementById('tagdiv').innerHTML = '<select size=\\'10\\' name=\\'upload\\' onChange=\\'Tagging_Get(\"" . Traceback_uri() . "?mod=upload_tagging&upload=\" + this.value)\\'>' + Uploads.responseText+ '</select><P/>';\n";
     $V .= "    document.getElementById('manage_tag').style.display= 'none';\n";
     $V .= "    document.getElementById('manage_tag_all').style.display= 'block';\n";
     $V .= "    }\n";
     $V .= "  }\n";
     $V .= "</script>\n";
     /** select one upload */
     $V .= ActiveHTTPscript("Tagging");
     $V .= "<script language='javascript'>\n";
     $V .= "function Tagging_Reply()\n";
     $V .= "  {\n";
     $V .= "  if ((Tagging.readyState==4) && (Tagging.status==200))\n";
     $V .= "    {\n";
     $V .= "    document.getElementById('manage_tag_all').style.display= 'none';\n";
     $V .= "    document.getElementById('manage_tag').style.display= 'block';\n";
     $V .= "    document.getElementById('manage_tag').innerHTML = Tagging.responseText;\n";
     $V .= "    }\n";
     $V .= "  }\n";
     $V .= "</script>\n";
     $V .= "<form name='formy' method='post'>\n";
     // no url = this url
     $V .= _("Displaying tags while browsing can be slow for large uploads.  This interface allows you to select an upload to disable (or enable) the tag display.  By default the tag display is enabled.<p>\n");
     $V .= "<ol>\n";
     $text = _("Select the folder containing the upload you wish to enable/disable:");
     $V .= "<li>{$text}<br>\n";
     $V .= "<select name='folder'\n";
     $V .= "onLoad='Uploads_Get((\"" . Traceback_uri() . "?mod=upload_options&folder={$Folder}' ";
     $V .= "onChange='Uploads_Get(\"" . Traceback_uri() . "?mod=upload_options&folder=\" + this.value)'>\n";
     $V .= FolderListOption(-1, 0, 1, $Folder);
     $V .= "</select><P />\n";
     $text = _("Select the upload to  enable/disable:");
     $V .= "<li>{$text}<br>";
     $V .= "<div id='tagdiv'>\n";
     $V .= "<select size='10' name='upload' onChange='Tagging_Get(\"" . Traceback_uri() . "?mod=upload_tagging&upload=\" + this.value)'>\n";
     $List = FolderListUploads_perm($Folder, Auth::PERM_WRITE);
     foreach ($List as $L) {
         $V .= "<option value='" . $L['upload_pk'] . "'>";
         $V .= htmlentities($L['name']);
         if (!empty($L['upload_desc'])) {
             $V .= " (" . htmlentities($L['upload_desc']) . ")";
         }
         $V .= "</option>\n";
     }
     $V .= "</select><P />\n";
     $V .= "</div>\n";
     $V .= "<div id='manage_tag_all'>";
     $text = _("Disable");
     $V .= "<input type='submit' name='manage'  value='{$text}'>\n";
     $text = _("Enable");
     $V .= "<input type='submit' name='manage' value='{$text}'>\n";
     $V .= "</div>";
     $V .= "<div id='manage_tag'>";
     $V .= "</div>";
     return $V;
 }
/**
 * \brief Create the folder tree, using OPTION tags.
 * NOTE: The caller must already have created the FORM and SELECT tags.
 * This is recursive!
 * NOTE: If there is a recursive loop in the folder table, then
 * this will loop INFINITELY.
 *
 * \param $ParentFolder Parents folder_fk
 * \param $Depth  Tree depth to create
 * \param $IncludeTop  True to include fossology root folder
 * \param $SelectId folder_fk of selected folder
 *
 * \return HTML of the folder tree
 */
function FolderListOption($ParentFolder, $Depth, $IncludeTop = 1, $SelectId = -1)
{
    if ($ParentFolder == "-1") {
        $ParentFolder = FolderGetTop();
    }
    if (empty($ParentFolder)) {
        return;
    }
    global $PG_CONN;
    if (empty($PG_CONN)) {
        return;
    }
    $V = "";
    if ($Depth != 0 || $IncludeTop) {
        if ($ParentFolder == $SelectId) {
            $V .= "<option value='{$ParentFolder}' SELECTED>";
        } else {
            $V .= "<option value='{$ParentFolder}'>";
        }
        if ($Depth != 0) {
            $V .= "&nbsp;&nbsp;";
        }
        for ($i = 1; $i < $Depth; $i++) {
            $V .= "&nbsp;&nbsp;";
        }
        /* Load this folder's name */
        $sql = "SELECT folder_name FROM folder WHERE folder_pk={$ParentFolder} LIMIT 1;";
        $result = pg_query($PG_CONN, $sql);
        DBCheckResult($result, $sql, __FILE__, __LINE__);
        $row = pg_fetch_assoc($result);
        $Name = trim($row['folder_name']);
        if ($Name == "") {
            $Name = "[default]";
        }
        /* Load any subfolders */
        /* Now create the HTML */
        $V .= htmlentities($Name);
        $V .= "</option>\n";
    }
    /* Load any subfolders */
    $sql = "SELECT folder.folder_pk, folder.folder_name AS name,\n            folder.folder_desc AS description, \n            foldercontents.parent_fk AS parent, \n            foldercontents.foldercontents_mode, \n            NULL AS ts, NULL AS upload_pk, NULL AS pfile_fk, NULL AS ufile_mode\n            FROM folder, foldercontents\n            WHERE foldercontents.foldercontents_mode = " . FolderDao::MODE_FOLDER . "\n            AND foldercontents.parent_fk ={$ParentFolder}\n            AND foldercontents.child_id = folder.folder_pk\n            AND folder.folder_pk is not null\n            ORDER BY name";
    $result = pg_query($PG_CONN, $sql);
    DBCheckResult($result, $sql, __FILE__, __LINE__);
    if (pg_num_rows($result) > 0) {
        $Hide = "";
        if ($Depth > 0) {
            $Hide = "style='display:none;'";
        }
        while ($row = pg_fetch_assoc($result)) {
            $V .= FolderListOption($row['folder_pk'], $Depth + 1, $IncludeTop, $SelectId);
        }
    }
    pg_free_result($result);
    return $V;
}
 /**
  * \brief Generate the text for this plugin.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     global $PG_CONN;
     global $PERM_NAMES;
     $V = "";
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             /* If this is a POST, then process the request. */
             $UserId = GetParm('userid', PARM_INTEGER);
             if (!empty($UserId)) {
                 $rc = $this->Edit();
                 if (empty($rc)) {
                     $sql = "SELECT user_pk, user_name FROM users WHERE user_pk={$UserId};";
                     $result = pg_query($PG_CONN, $sql);
                     DBCheckResult($result, $sql, __FILE__, __LINE__);
                     $row = pg_fetch_assoc($result);
                     pg_free_result($result);
                     $userName = $row['user_name'];
                     // display status
                     $V .= displayMessage("User {$userName} updated.");
                 } else {
                     $V .= displayMessage($rc);
                 }
             }
             /* Get the list of users */
             $sql = "SELECT user_pk,user_name,user_desc,user_pass,\n                                root_folder_fk,user_perm,user_email,email_notify,\n                                user_agent_list,default_bucketpool_fk,ui_preference,\n                                new_upload_group_fk, new_upload_perm FROM users WHERE\n                                user_pk != '" . @$_SESSION['UserId'] . "' ORDER BY user_name;";
             $result = pg_query($PG_CONN, $sql);
             DBCheckResult($result, $sql, __FILE__, __LINE__);
             $row0 = pg_fetch_assoc($result);
             /* Create JavaScript for updating users */
             $V .= "\n<script language='javascript'>\n";
             $V .= "document.onreadystatechange = function(){\n        if(document.readyState=='complete'){SetInfo(" . $row0['user_pk'] . ");}\n      }";
             $V .= "</script>\n";
             $V .= "\n<script language='javascript'>\n";
             $V .= "var Username = new Array();\n";
             $V .= "var Userdesc = new Array();\n";
             $V .= "var Useremail = new Array();\n";
             $V .= "var Userenote = new Array();\n";
             $V .= "var Useragents = new String(\"\");\n";
             $V .= "var Userperm = new Array();\n";
             $V .= "var Userblock = new Array();\n";
             $V .= "var Userfolder = new Array();\n";
             $V .= "var default_bucketpool_fk = new Array();\n";
             $V .= "var new_upload_group_fk = new Array();\n";
             $V .= "var new_upload_perm = new Array();\n";
             $V .= "var UiPref = new Array();\n";
             pg_result_seek($result, 0);
             while ($row = pg_fetch_assoc($result)) {
                 $R = $row;
                 //echo "<pre>Users are:\n";
                 //print_r($R) . "\n</pre>";
                 $Id = $R['user_pk'];
                 $Val = str_replace('"', "\\\"", $R['user_name']);
                 $V .= "Username[" . $Id . '] = "' . $Val . "\";\n";
                 $Val = str_replace('"', "\\\"", $R['user_desc']);
                 $V .= "Userdesc[" . $Id . '] = "' . $Val . "\";\n";
                 $Val = str_replace('"', "\\\"", $R['user_email']);
                 $V .= "Useremail[" . $Id . '] = "' . $Val . "\";\n";
                 $V .= "Userenote[" . $Id . '] = "' . $R['email_notify'] . "\";\n";
                 $V .= "UiPref[" . $Id . '] = "' . $R['ui_preference'] . "\";\n";
                 $V .= "Useragents[" . $Id . '] = "' . $R['user_agent_list'] . "\";\n";
                 $V .= "Userfolder[" . $Id . '] = "' . $R['root_folder_fk'] . "\";\n";
                 $V .= "default_bucketpool_fk[" . $Id . '] = "' . $R['default_bucketpool_fk'] . "\";\n";
                 $V .= "new_upload_group_fk[" . $Id . '] = "' . $R['new_upload_group_fk'] . "\";\n";
                 $V .= "new_upload_perm[" . $Id . '] = "' . $R['new_upload_perm'] . "\";\n";
                 $V .= "Userperm[" . $Id . '] = "' . $R['user_perm'] . "\";\n";
                 if (substr($R['user_pass'], 0, 1) == ' ') {
                     $Block = 1;
                 } else {
                     $Block = 0;
                 }
                 $V .= "Userblock[" . $Id . "] = '{$Block}';\n";
             }
             $V .= "\n              function clearBoxes()\n              {\n                var cbList = document.getElementsByTagName('input');\n                for(j=0; j<cbList.length; j++)\n                {\n                  if(cbList[j].getAttribute('type') == 'checkbox')\n                  {\n                    var aname = cbList[j].getAttribute('name');\n                    if(String.search('Check_agent', aname) != -1)\n                    {\n                      continue;\n                    }\n                    else\n                    {\n                      cbList[j].checked=false;\n                    }\n                   }\n                  }\n                }\n                                 \n                function SetBoxes(id)\n                {\n                  if(!id) { return; }\n\n                  var prefix='Check_';\n                  var agents = Useragents[id].split(',');\n\n                  var cbList = document.getElementsByTagName('input');\n                  for(j=0; j<cbList.length; j++)\n                  {\n                    if(cbList[j].getAttribute('type') == 'checkbox')\n                    {\n                      uiName = cbList[j].getAttribute('name');\n                      if(uiName.search(/Check_agent/) != -1)\n                      {\n                        for(i=0; i<agents.length; i++)\n                        {\n                          aName = prefix + agents[i];\n                          // need to remove Check_ from the name\n                          noCheck = uiName.replace(/Check_/, '');\n                          if(agents.indexOf(noCheck) == -1)\n                          {\n                            cbList[j].checked=false;\n                            continue;\n                          }\n                          else\n                          {\n                            cbList[j].checked=true;\n                            continue;\n                          }\n                        }\n                      }\n                    }\n                  }\n                }\n                \n                function SetInfo(id)\n                {\n                  if(id == 0) { clearBoxes(); }\n                  document.userEditAny.username.value = Username[id];\n                  document.userEditAny.email.value = Useremail[id];\n                  document.userEditAny.description.value = Userdesc[id];\n                  document.userEditAny.permission.value = Userperm[id];\n                  document.userEditAny.folder.value = Userfolder[id];\n                  document.userEditAny.default_bucketpool_fk.value = default_bucketpool_fk[id];\n                  document.userEditAny.new_upload_group_fk.value = new_upload_group_fk[id];\n                  document.userEditAny.new_upload_perm.value = new_upload_perm[id];\n                  if (Userblock[id] == 1) { document.userEditAny.block.checked=true; }\n                  else { document.userEditAny.block.checked=false; }\n                  if (Userenote[id] == \"\") { document.userEditAny.enote.checked=false; }\n                  else { document.userEditAny.enote.checked=true; }\n                  \n                  if (UiPref[id] == \"\") {\n                    document.getElementById('simple').checked=true;\n                  }\n                  else if (UiPref[id] == 'simple') {\n                    document.getElementById('original').checked=false;\n                    document.getElementById('simple').checked=true;\n\t\t              }\n\t\t              else {\n\t\t                document.getElementById('simple').checked=false;\n  \t                document.getElementById('original').checked=true;\n\t\t              }\n                  \n                  if(Useragents[id].length == 0)\n                  {\n                      clearBoxes();\n                    }\n                    else\n                    {\n                        SetBoxes(id);\n                    }\n              }\n              ";
             $V .= "</script>\n";
             /* Build HTML form */
             $V .= "<form name='userEditAny' method='POST'>\n";
             // no url = this url
             if (empty($UserId)) {
                 $UserId = $row0['user_pk'];
             }
             $Uri = Traceback_uri();
             $V .= "<P />\n";
             $text = _("To edit");
             $text1 = _("another");
             $text2 = _(" user on this system, alter any of the following information.");
             $V .= "{$text} <strong>{$text1}</strong>{$text2}<P />\n";
             $text = _("To edit");
             $text1 = _("your");
             $text2 = _(" account settings, use");
             $text3 = _("Account Settings.");
             $V .= "{$text} <strong>{$text1}</strong>{$text2}\n         <a href='{$Uri}?mod=user_edit_self'>{$text3}</a><P />\n";
             $V .= _("Select the user to edit: ");
             $V .= "<select name='userid' onClick='SetInfo(this.value);' onchange='SetInfo(this.value);'>\n";
             //$V .= "<option selected value='0'>--select user--</option>\n";
             pg_result_seek($result, 0);
             while ($row = pg_fetch_assoc($result)) {
                 $Selected = "";
                 if ($UserId == $row['user_pk']) {
                     $Selected = "selected";
                 }
                 $V .= "<option {$Selected} value='" . $row['user_pk'] . "'>";
                 $V .= htmlentities($row['user_name']);
                 $V .= "</option>\n";
             }
             pg_free_result($result);
             $V .= "</select>\n";
             $Style = "<tr><td colspan=3 style='background:black;'></td></tr><tr>";
             $V .= "<table style='border:1px solid black; text-align:left; background:lightyellow;' width='100%'>";
             $Val = htmlentities(GetParm('username', PARM_TEXT), ENT_QUOTES);
             $text = _("Change the username.");
             $V .= "{$Style}<th width='25%'>{$text}</th>";
             $V .= "<td><input type='text' value='{$Val}' name='username' size=20></td>\n";
             $V .= "</tr>\n";
             $Val = htmlentities(GetParm('description', PARM_TEXT), ENT_QUOTES);
             $text = _("Change the user's description (name, contact, or other information).  This may be blank.");
             $V .= "{$Style}<th>{$text}</th>\n";
             $V .= "<td><input type='text' name='description' value='{$Val}' size=60></td>\n";
             $V .= "</tr>\n";
             $Val = htmlentities(GetParm('email', PARM_TEXT), ENT_QUOTES);
             $text = _("Change the user's email address. This may be blank.");
             $V .= "{$Style}<th>{$text}</th>\n";
             $V .= "<td><input type='text' name='email' value='{$Val}' size=60></td>\n";
             $V .= "</tr>\n";
             $text = _("Select the user's access level.");
             $V .= "{$Style}<th>{$text}</th>";
             $Val = GetParm('permission', PARM_INTEGER);
             $V .= "<td><select name='permission'>\n";
             $text1 = _("None (very basic, no database access)");
             $text2 = _("Read-only (read, but no writes or downloads)");
             $text3 = _("Download (Read-only, but can download files)");
             $text4 = _("Read-Write (read, download, or edit information)");
             $text5 = _("Upload (read-write, and permits uploading files)");
             $text6 = _("Analyze (... and permits scheduling analysis tasks)");
             $text7 = _("Delete (... and permits deleting uploaded files and analysis)");
             $text8 = _("Debug (... and allows access to debugging functions)");
             $text9 = _("Full Administrator (all access including adding and deleting users)");
             $V .= "<option " . ($Val == 0 ? "selected" : "") . " value='" . PLUGIN_DB_NONE . "'>{$text1}</option>\n";
             $V .= "<option " . ($Val == 1 ? "selected" : "") . " value='" . PLUGIN_DB_READ . "'>{$text2}</option>\n";
             $V .= "<option " . ($Val == 3 ? "selected" : "") . " value='" . PLUGIN_DB_WRITE . "'>{$text4}</option>\n";
             $V .= "<option " . ($Val == 10 ? "selected" : "") . " value='" . PLUGIN_DB_ADMIN . "'>{$text9}</option>\n";
             $V .= "</select></td>\n";
             $V .= "</tr>\n";
             $text = _("Select the user's top-level folder. Access is restricted to this folder.");
             $V .= "{$Style}<th>{$text}";
             $V .= "</th>";
             $V .= "<td><select name='folder'>";
             $V .= FolderListOption(-1, 0);
             $V .= "</select></td>\n";
             $V .= "</tr>\n";
             $text = _("Block the user's account. This will prevent logins.");
             $V .= "{$Style}<th>{$text}</th><td><input type='checkbox' name='block' value='1'></td>\n";
             $text = _("Blank the user's account. This will will set the password to a blank password.");
             $V .= "{$Style}<th>{$text}</th><td><input type='checkbox' name='blank' value='1'></td>\n";
             $text = _("Change the user's password.");
             $V .= "{$Style}<th>{$text}</th><td><input type='password' name='pass1' size=20></td>\n";
             $V .= "</tr>\n";
             $text = _("Re-enter the user's password.");
             $V .= "<tr><th>{$text}</th><td><input type='password' name='pass2' size=20></td>\n";
             $V .= "</tr>\n";
             $text = _("E-mail Notification");
             $V .= "{$Style}<th>{$text}</th><td><input type=checkbox name='enote'";
             $V .= "</tr>\n";
             $V .= "</tr>\n";
             $text = _("Default Agents: Select the agent(s) to automatically run when uploading data. These selections can be changed on the upload screens.");
             $V .= "{$Style}<th>{$text}\n</th><td> ";
             $V .= AgentCheckBoxMake(-1, array("agent_unpack", "agent_adj2nest", "wget_agent"));
             $V .= "</td>\n";
             $V .= "</tr>\n";
             $Val = GetParm('default_bucketpool_fk', PARM_INTEGER);
             $text = _("Default bucket pool");
             $V .= "{$Style}<th>{$text}</th>\n";
             $V .= "<td>";
             $V .= SelectBucketPool($Val);
             $V .= "</td>\n";
             $V .= "</tr>\n";
             /*
                     / ******  New Upload Group ****** /
                     / * Get master array of groups * /
                     $sql = "select group_pk, group_name from groups order by group_name";
                     $groupresult = pg_query($PG_CONN, $sql);
                     DBCheckResult($groupresult, $sql, __FILE__, __LINE__);
                     $GroupArray = array();
                     while ($GroupRow = pg_fetch_assoc($groupresult))
                       $GroupArray[$GroupRow['group_pk']] = $GroupRow['group_name'];
                     pg_free_result($groupresult);
                     $text = _("Group to give access permission for every new upload");
                     $V.= "$Style<th>$text</th>";
                     $V.= "<td>";
                     $V .= Array2SingleSelect($GroupArray, "new_upload_group_fk", $R['new_upload_group_fk'], true, false);
                     $V.= "</td>";
                     $V .= "</tr>\n";
             
                     / ******  New Upload Permissions ****** /
                     $text = _("Access Permission to give the above group");
                     $V.= "$Style<th>$text</th>";
                     $V.= "<td>";
                     $Selected = (empty($R['new_upload_perm'])) ? -1 : $R['new_upload_perm'];
                     $V .= Array2SingleSelect($PERM_NAMES, "new_upload_perm", $Selected, true, false);
                     $V.= "</td>";
                     $V .= "</tr>\n";
             */
             $text = _("User Interface Options");
             $text1 = _("Use the simplified UI (Default)");
             $text2 = _("Use the original UI");
             //$V .= "$Style<th>$text</th><td><input type='radio'" .
             "name='whichui' id='simple' value='simple' checked='checked'>" . "{$text1}<br><input type='radio'" . "name='whichui' id='original' value='original'>" . "{$text2}</td>\n";
             $V .= "</table><P />";
             $text = _("Update Account");
             $V .= "<input type='submit' value='{$text}'>\n";
             $V .= "</form>\n";
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }