protected function handle(Request $request) { // Handle request $this->folderDao->ensureTopLevelFolder(); $message = ""; $description = ""; if ($request->isMethod(Request::METHOD_POST)) { list($success, $message, $description) = $this->handleUpload($request); } $vars['message'] = $message; $vars['descriptionInputValue'] = $description ?: ""; $vars['descriptionInputName'] = self::DESCRIPTION_INPUT_NAME; $vars['folderParameterName'] = self::FOLDER_PARAMETER_NAME; $vars['upload_max_filesize'] = ini_get('upload_max_filesize'); $vars['agentCheckBoxMake'] = ''; $rootFolder = $this->folderDao->getRootFolder(Auth::getUserId()); $folderStructure = $this->folderDao->getFolderStructure($rootFolder->getId()); $vars['folderStructure'] = $folderStructure; $vars['baseUrl'] = $request->getBaseUrl(); $vars['moduleName'] = $this->getName(); $vars[self::FOLDER_PARAMETER_NAME] = $request->get(self::FOLDER_PARAMETER_NAME); $parmAgentList = MenuHook::getAgentPluginNames("ParmAgents"); $vars['parmAgentContents'] = array(); $vars['parmAgentFoots'] = array(); foreach ($parmAgentList as $parmAgent) { $agent = plugin_find($parmAgent); $vars['parmAgentContents'][] = $agent->renderContent($vars); $vars['parmAgentFoots'][] = $agent->renderFoot($vars); } $session = $request->getSession(); $session->set(self::UPLOAD_FORM_BUILD_PARAMETER_NAME, time() . ':' . $_SERVER['REMOTE_ADDR']); $vars['uploadFormBuild'] = $session->get(self::UPLOAD_FORM_BUILD_PARAMETER_NAME); $vars['uploadFormBuildParameterName'] = self::UPLOAD_FORM_BUILD_PARAMETER_NAME; if (@$_SESSION[Auth::USER_LEVEL] >= PLUGIN_DB_WRITE) { $skip = array("agent_unpack", "agent_adj2nest", "wget_agent"); $vars['agentCheckBoxMake'] = AgentCheckBoxMake(-1, $skip); } return $this->handleView($request, $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": /* 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; }
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. */ 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. */ $User = GetParm('username', PARM_TEXT); if (!empty($User)) { $rc = $this->Edit(); if (empty($rc)) { /* Need to refresh the screen */ $text = _("User information updated."); $V .= displayMessage($text); } else { $V .= displayMessage($rc); } } // Get the user data $sql = "SELECT * FROM users WHERE user_pk='" . @$_SESSION['UserId'] . "';"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); $R = pg_fetch_assoc($result); pg_free_result($result); /* Build HTML form */ $V .= "<form name='formy' method='POST'>\n"; // no url = this url /* if login by siteminder, didn't show this in page*/ if (siteminder_check() == -1) { $V .= _("You <font color='red'>must</font> provide your current password in order to make any changes.<br />\n"); $text = _("Enter your password"); $V .= "{$text}: <input type='password' name='pass0' size=20>\n"; $V .= "<hr>\n"; } $V .= _("To change user information, edit the following fields. You do not need to edit every field. Only fields with edits will be changed.<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='100%'>"; $Val = htmlentities($R['user_name'], 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($R['user_desc'], 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($R['user_email'], 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 = _("Password"); $text1 = _("Re-enter password"); $V .= "{$Style}<th>{$text}<br>{$text1}</th><td>"; $V .= "<input type='password' name='pass1' size=20><br />\n"; $V .= "<input type='password' name='pass2' size=20></td>\n"; $V .= "</tr>\n"; if (empty($R['email_notify'])) { $Checked = ""; } else { $Checked = "checked='checked'"; } $text = _("E-mail Notification"); $V .= "{$Style}<th>{$text}</th><td>\n"; $V .= "<input name='emailnotify' type='checkbox' {$Checked}>"; $V .= "</tr>\n"; if (@$_SESSION['UserLevel'] > PLUGIN_DB_READ) { $text = _("Default scans"); $V .= "{$Style}<th>{$text}\n</th><td>\n"; /* * added this code so the form makes sense. You can have an admin define default agents * but if you don't have Analyze or better permissions, then those agents are not available to * you! With out this code the default agent text was there, but nothing else... this way * the form at least makes sense. Turns out agent unpack is always around so both * conditions must be checked. */ $AgentList = menu_find("Agents", $Depth); if (!empty($AgentList)) { foreach ($AgentList as $AgentItem) { $uri = $AgentItem->URI; } if ($uri == "agent_unpack" && count($AgentList) == 1) { $text = _("You do not have permission to change your default agents"); $V .= "<h3>{$text}</h3>\n"; } else { $V .= AgentCheckBoxMake(-1, array("agent_unpack", "agent_adj2nest", "wget_agent")); } } $V .= "</td></tr>\n"; $text = _("Default bucketpool"); $V .= "{$Style}<th>{$text}</th>"; $V .= "<td>"; $Val = htmlentities($R['default_bucketpool_fk'], ENT_QUOTES); $V .= SelectBucketPool($Val); $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", $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"; */ } $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; }
/** * \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 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": /* 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> <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 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; } 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; }