public static function handleBrowseRequest($options = [], $conditions = [], $responseID = null, $responseData = []) { if (!empty($_GET['ProjectID']) && ctype_digit($_GET['ProjectID']) && ($Project = Project::getByID($_GET['ProjectID']))) { $conditions['ProjectID'] = $Project->ID; $responseData['Project'] = $Project; } return parent::handleBrowseRequest($options, $conditions, $responseID, $responseData); }
public static function handleChangeMaintainerRequest(Project $Project) { $GLOBALS['Session']->requireAuthentication(); if (empty($_REQUEST['username'])) { return static::throwError('Parameter "username" required'); } if (!($Project->Maintainer = User::getByUsername($_REQUEST['username']))) { return static::throwError('User not found'); } if ($_SERVER['REQUEST_METHOD'] != 'POST') { return static::respond('confirm', ['question' => sprintf(_('Are you sure you want to make %s the maintainer of %s?'), htmlspecialchars($Project->Maintainer->FullName), htmlspecialchars($Project->Title))]); } $Project->save(); return static::respond('maintainerChanged', ['data' => $Project]); }