Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php
index c5da89eadf..cd15cc4b82 100644
--- a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php
+++ b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php
@@ -1,641 +1,638 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @group aphront
*/
class AphrontDefaultApplicationConfiguration
extends AphrontApplicationConfiguration {
public function __construct() {
}
public function getApplicationName() {
return 'aphront-default';
}
public function getURIMap() {
return $this->getResourceURIMapRules() + array(
'/(?:(?P<filter>jump)/)?$' =>
'PhabricatorDirectoryMainController',
'/(?:(?P<filter>feed)/)' => array(
'public/$' => 'PhabricatorFeedPublicStreamController',
'(?:(?P<subfilter>[^/]+)/)?$' =>
'PhabricatorDirectoryMainController',
),
'/directory/' => array(
'(?P<id>\d+)/$'
=> 'PhabricatorDirectoryCategoryViewController',
'edit/$'
=> 'PhabricatorDirectoryEditController',
'item/edit/(?:(?P<id>\d+)/)?$'
=> 'PhabricatorDirectoryItemEditController',
'item/delete/(?P<id>\d+)/'
=> 'PhabricatorDirectoryItemDeleteController',
'category/edit/(?:(?P<id>\d+)/)?$'
=> 'PhabricatorDirectoryCategoryEditController',
'category/delete/(?P<id>\d+)/'
=> 'PhabricatorDirectoryCategoryDeleteController',
),
'/file/' => array(
'$' => 'PhabricatorFileListController',
'filter/(?P<filter>\w+)/$' => 'PhabricatorFileListController',
'upload/$' => 'PhabricatorFileUploadController',
'dropupload/$' => 'PhabricatorFileDropUploadController',
'delete/(?P<id>\d+)/$' => 'PhabricatorFileDeleteController',
'info/(?P<phid>[^/]+)/' => 'PhabricatorFileInfoController',
'data/(?P<key>[^/]+)/(?P<phid>[^/]+)/'
=> 'PhabricatorFileDataController',
// TODO: This is a deprecated version of /data/. Remove it after
// old links have had a chance to rot.
'alt/(?P<key>[^/]+)/(?P<phid>[^/]+)/'
=> 'PhabricatorFileDataController',
'macro/' => array(
'$' => 'PhabricatorFileMacroListController',
'edit/(?:(?P<id>\d+)/)?$' => 'PhabricatorFileMacroEditController',
'delete/(?P<id>\d+)/$' => 'PhabricatorFileMacroDeleteController',
),
'proxy/$' => 'PhabricatorFileProxyController',
'xform/(?P<transform>[^/]+)/(?P<phid>[^/]+)/'
=> 'PhabricatorFileTransformController',
),
'/phid/' => array(
'$' => 'PhabricatorPHIDLookupController',
),
'/people/' => array(
'$' => 'PhabricatorPeopleListController',
'logs/$' => 'PhabricatorPeopleLogsController',
'edit/(?:(?P<id>\d+)/(?:(?P<view>\w+)/)?)?$'
=> 'PhabricatorPeopleEditController',
),
'/p/(?P<username>\w+)/(?:(?P<page>\w+)/)?$'
=> 'PhabricatorPeopleProfileController',
'/conduit/' => array(
'$' => 'PhabricatorConduitConsoleController',
'method/(?P<method>[^/]+)/$' => 'PhabricatorConduitConsoleController',
'log/$' => 'PhabricatorConduitLogController',
'log/view/(?P<view>[^/]+)/$' => 'PhabricatorConduitLogController',
'token/$' => 'PhabricatorConduitTokenController',
),
'/api/(?P<method>[^/]+)$' => 'PhabricatorConduitAPIController',
'/D(?P<id>\d+)' => 'DifferentialRevisionViewController',
'/differential/' => array(
'$' => 'DifferentialRevisionListController',
'filter/(?P<filter>\w+)/$' => 'DifferentialRevisionListController',
'stats/(?P<filter>\w+)/$' => 'DifferentialRevisionStatsController',
'diff/' => array(
'(?P<id>\d+)/$' => 'DifferentialDiffViewController',
'create/$' => 'DifferentialDiffCreateController',
),
'changeset/$' => 'DifferentialChangesetViewController',
'revision/edit/(?:(?P<id>\d+)/)?$'
=> 'DifferentialRevisionEditController',
'comment/' => array(
'preview/(?P<id>\d+)/$' => 'DifferentialCommentPreviewController',
'save/$' => 'DifferentialCommentSaveController',
'inline/' => array(
'preview/(?P<id>\d+)/$' =>
'DifferentialInlineCommentPreviewController',
'edit/(?P<id>\d+)/$' => 'DifferentialInlineCommentEditController',
),
),
'subscribe/(?P<action>add|rem)/(?P<id>\d+)/$'
=> 'DifferentialSubscribeController',
),
'/typeahead/' => array(
'common/(?P<type>\w+)/$'
=> 'PhabricatorTypeaheadCommonDatasourceController',
),
'/mail/' => array(
'$' => 'PhabricatorMetaMTAListController',
'send/$' => 'PhabricatorMetaMTASendController',
'view/(?P<id>\d+)/$' => 'PhabricatorMetaMTAViewController',
'lists/$' => 'PhabricatorMetaMTAMailingListsController',
'lists/edit/(?:(?P<id>\d+)/)?$'
=> 'PhabricatorMetaMTAMailingListEditController',
'receive/$' => 'PhabricatorMetaMTAReceiveController',
'received/$' => 'PhabricatorMetaMTAReceivedListController',
'sendgrid/$' => 'PhabricatorMetaMTASendGridReceiveController',
),
'/login/' => array(
'$' => 'PhabricatorLoginController',
'email/$' => 'PhabricatorEmailLoginController',
'etoken/(?P<token>\w+)/$' => 'PhabricatorEmailTokenController',
'refresh/$' => 'PhabricatorRefreshCSRFController',
'validate/$' => 'PhabricatorLoginValidateController',
),
'/logout/$' => 'PhabricatorLogoutController',
'/oauth/' => array(
'(?P<provider>\w+)/' => array(
'login/$' => 'PhabricatorOAuthLoginController',
'diagnose/$' => 'PhabricatorOAuthDiagnosticsController',
'unlink/$' => 'PhabricatorOAuthUnlinkController',
),
),
'/oauthserver/' => array(
'auth/' => 'PhabricatorOAuthServerAuthController',
'test/' => 'PhabricatorOAuthServerTestController',
'token/' => 'PhabricatorOAuthServerTokenController',
'clientauthorization/' => array(
'$' => 'PhabricatorOAuthClientAuthorizationListController',
'delete/(?P<phid>[^/]+)/' =>
'PhabricatorOAuthClientAuthorizationDeleteController',
'edit/(?P<phid>[^/]+)/' =>
'PhabricatorOAuthClientAuthorizationEditController',
),
'client/' => array(
'$' => 'PhabricatorOAuthClientListController',
'create/$' => 'PhabricatorOAuthClientEditController',
'delete/(?P<phid>[^/]+)/$' =>
'PhabricatorOAuthClientDeleteController',
'edit/(?P<phid>[^/]+)/$' => 'PhabricatorOAuthClientEditController',
'view/(?P<phid>[^/]+)/$' => 'PhabricatorOAuthClientViewController',
),
),
'/xhprof/' => array(
'profile/(?P<phid>[^/]+)/$' => 'PhabricatorXHProfProfileController',
),
'/~/' => 'DarkConsoleController',
'/settings/' => array(
'(?:page/(?P<page>[^/]+)/)?$' => 'PhabricatorUserSettingsController',
),
'/maniphest/' => array(
'$' => 'ManiphestTaskListController',
'view/(?P<view>\w+)/$' => 'ManiphestTaskListController',
'report/(?:(?P<view>\w+)/)?$' => 'ManiphestReportController',
'batch/$' => 'ManiphestBatchEditController',
'task/' => array(
'create/$' => 'ManiphestTaskEditController',
'edit/(?P<id>\d+)/$' => 'ManiphestTaskEditController',
'descriptionchange/(?P<id>\d+)/$' =>
'ManiphestTaskDescriptionChangeController',
'descriptiondiff/$' =>
'ManiphestTaskDescriptionDiffController',
'descriptionpreview/$' =>
'ManiphestTaskDescriptionPreviewController',
),
'transaction/' => array(
'save/' => 'ManiphestTransactionSaveController',
'preview/(?P<id>\d+)/$' => 'ManiphestTransactionPreviewController',
),
'export/(?P<key>[^/]+)/$' => 'ManiphestExportController',
),
'/T(?P<id>\d+)$' => 'ManiphestTaskDetailController',
'/repository/' => array(
'$' => 'PhabricatorRepositoryListController',
'create/$' => 'PhabricatorRepositoryCreateController',
'edit/(?P<id>\d+)/(?:(?P<view>\w+)?/)?$' =>
'PhabricatorRepositoryEditController',
'delete/(?P<id>\d+)/$' => 'PhabricatorRepositoryDeleteController',
'project/(?P<id>\d+)/' =>
'PhabricatorRepositoryArcanistProjectEditController',
),
'/search/' => array(
'$' => 'PhabricatorSearchController',
'(?P<key>[^/]+)/$' => 'PhabricatorSearchController',
'attach/(?P<phid>[^/]+)/(?P<type>\w+)/(?:(?P<action>\w+)/)?$'
=> 'PhabricatorSearchAttachController',
'select/(?P<type>\w+)/$'
=> 'PhabricatorSearchSelectController',
'index/(?P<phid>[^/]+)/$' => 'PhabricatorSearchIndexController',
),
'/project/' => array(
'$' => 'PhabricatorProjectListController',
'filter/(?P<filter>[^/]+)/$' => 'PhabricatorProjectListController',
'edit/(?P<id>\d+)/$' => 'PhabricatorProjectProfileEditController',
'view/(?P<id>\d+)/(?:(?P<page>\w+)/)?$'
=> 'PhabricatorProjectProfileController',
'create/$' => 'PhabricatorProjectCreateController',
'update/(?P<id>\d+)/(?P<action>[^/]+)/$'
=> 'PhabricatorProjectUpdateController',
),
'/r(?P<callsign>[A-Z]+)(?P<commit>[a-z0-9]+)$'
=> 'DiffusionCommitController',
'/diffusion/' => array(
'$' => 'DiffusionHomeController',
'(?P<callsign>[A-Z]+)/' => array(
'$' => 'DiffusionRepositoryController',
'repository/'.
'(?P<path>[^/]+)/'.
'$'
=> 'DiffusionRepositoryController',
'change/'.
'(?P<path>.*?)'.
'(?:[;](?P<commit>[a-z0-9]+))?'.
'$'
=> 'DiffusionChangeController',
'history/'.
'(?P<path>.*?)'.
'(?:[;](?P<commit>[a-z0-9]+))?'.
'$'
=> 'DiffusionHistoryController',
'browse/'.
'(?P<path>.*?)'.
'(?:[;](?P<commit>[a-z0-9]+))?'.
'(?:[$](?P<line>\d+(?:-\d+)?))?'.
'$'
=> 'DiffusionBrowseController',
'diff/'.
'(?P<path>.*?)'.
'(?:[;](?P<commit>[a-z0-9]+))?'.
'$'
=> 'DiffusionDiffController',
'lastmodified/'.
'(?P<path>.*?)'.
'(?:[;](?P<commit>[a-z0-9]+))?'.
'$'
=> 'DiffusionLastModifiedController',
),
'services/' => array(
'path/' => array(
'complete/$' => 'DiffusionPathCompleteController',
'validate/$' => 'DiffusionPathValidateController',
),
),
- 'author/' => array(
- '$' => 'DiffusionCommitListController',
- '(?P<username>\w+)/$' => 'DiffusionCommitListController',
- ),
'symbol/(?P<name>[^/]+)/$' => 'DiffusionSymbolController',
),
'/daemon/' => array(
'task/(?P<id>\d+)/$' => 'PhabricatorWorkerTaskDetailController',
'task/(?P<id>\d+)/(?P<action>[^/]+)/$'
=> 'PhabricatorWorkerTaskUpdateController',
'log/' => array(
'$' => 'PhabricatorDaemonLogListController',
'combined/$' => 'PhabricatorDaemonCombinedLogController',
'(?P<id>\d+)/$' => 'PhabricatorDaemonLogViewController',
),
'timeline/$' => 'PhabricatorDaemonTimelineConsoleController',
'timeline/(?P<id>\d+)/$' => 'PhabricatorDaemonTimelineEventController',
'$' => 'PhabricatorDaemonConsoleController',
),
'/herald/' => array(
'$' => 'HeraldHomeController',
'view/(?P<view>[^/]+)/' => array(
'$' => 'HeraldHomeController',
'(?P<global>global)/$' => 'HeraldHomeController'
),
'new/(?:(?P<type>[^/]+)/)?$' => 'HeraldNewController',
'rule/(?:(?P<id>\d+)/)?$' => 'HeraldRuleController',
'history/(?P<id>\d+)/$' => 'HeraldRuleEditHistoryController',
'delete/(?P<id>\d+)/$' => 'HeraldDeleteController',
'test/$' => 'HeraldTestConsoleController',
'all/' => array(
'$' => 'HeraldAllRulesController',
'view/(?P<view>[^/]+)/$' => 'HeraldAllRulesController',
),
'transcript/$' => 'HeraldTranscriptListController',
'transcript/(?P<id>\d+)/(?:(?P<filter>\w+)/)?$'
=> 'HeraldTranscriptController',
),
'/uiexample/' => array(
'$' => 'PhabricatorUIExampleRenderController',
'view/(?P<class>[^/]+)/$' => 'PhabricatorUIExampleRenderController',
),
'/owners/' => array(
'$' => 'PhabricatorOwnersListController',
'view/(?P<view>[^/]+)/$' => 'PhabricatorOwnersListController',
'edit/(?P<id>\d+)/$' => 'PhabricatorOwnersEditController',
'new/$' => 'PhabricatorOwnersEditController',
'package/(?P<id>\d+)/$' => 'PhabricatorOwnersDetailController',
'delete/(?P<id>\d+)/$' => 'PhabricatorOwnersDeleteController',
'(?P<scope>related|attention)/' => array(
'$' => 'PhabricatorOwnerRelatedListController',
'(?P<view>package|owner)/$'
=> 'PhabricatorOwnerRelatedListController',
),
),
'/audit/' => array(
'$' => 'PhabricatorAuditListController',
- 'view/(?P<filter>[^/]+)/$' => 'PhabricatorAuditListController',
+ 'view/(?P<filter>[^/]+)/(?:(?P<name>[^/]+)/)?$'
+ => 'PhabricatorAuditListController',
'edit/$' => 'PhabricatorAuditEditController',
'addcomment/$' => 'PhabricatorAuditAddCommentController',
'preview/(?P<id>\d+)/$' => 'PhabricatorAuditPreviewController',
),
'/xhpast/' => array(
'$' => 'PhabricatorXHPASTViewRunController',
'view/(?P<id>\d+)/$'
=> 'PhabricatorXHPASTViewFrameController',
'frameset/(?P<id>\d+)/$'
=> 'PhabricatorXHPASTViewFramesetController',
'input/(?P<id>\d+)/$'
=> 'PhabricatorXHPASTViewInputController',
'tree/(?P<id>\d+)/$'
=> 'PhabricatorXHPASTViewTreeController',
'stream/(?P<id>\d+)/$'
=> 'PhabricatorXHPASTViewStreamController',
),
'/status/$' => 'PhabricatorStatusController',
'/paste/' => array(
'$' => 'PhabricatorPasteListController',
'filter/(?P<filter>\w+)/$' => 'PhabricatorPasteListController',
),
'/P(?P<id>\d+)$' => 'PhabricatorPasteViewController',
'/help/' => array(
'keyboardshortcut/$' => 'PhabricatorHelpKeyboardShortcutController',
),
'/countdown/' => array(
'$'
=> 'PhabricatorCountdownListController',
'(?P<id>\d+)/$'
=> 'PhabricatorCountdownViewController',
'edit/(?:(?P<id>\d+)/)?$'
=> 'PhabricatorCountdownEditController',
'delete/(?P<id>\d+)/$'
=> 'PhabricatorCountdownDeleteController'
),
'/V(?P<id>\d+)$' => 'PhabricatorSlowvotePollController',
'/vote/' => array(
'(?:view/(?P<view>\w+)/)?$' => 'PhabricatorSlowvoteListController',
'create/' => 'PhabricatorSlowvoteCreateController',
),
// Match "/w/" with slug "/".
'/w(?P<slug>/)$' => 'PhrictionDocumentController',
// Match "/w/x/y/z/" with slug "x/y/z/".
'/w/(?P<slug>.+/)$' => 'PhrictionDocumentController',
'/phriction/' => array(
'$' => 'PhrictionListController',
'list/(?P<view>[^/]+)/$' => 'PhrictionListController',
'history(?P<slug>/)$' => 'PhrictionHistoryController',
'history/(?P<slug>.+/)$' => 'PhrictionHistoryController',
'edit/(?:(?P<id>\d+)/)?$' => 'PhrictionEditController',
'delete/(?P<id>\d+)/$' => 'PhrictionDeleteController',
'preview/$' => 'PhrictionDocumentPreviewController',
'diff/(?P<id>\d+)/$' => 'PhrictionDiffController',
),
'/calendar/' => array(
'$' => 'PhabricatorCalendarBrowseController',
),
'/drydock/' => array(
'$' => 'DrydockResourceListController',
'resource/$' => 'DrydockResourceListController',
'resource/allocate/$' => 'DrydockResourceAllocateController',
'host/' => array(
'$' => 'DrydockHostListController',
'edit/$' => 'DrydockHostEditController',
'edit/(?P<id>\d+)/$' => 'DrydockhostEditController',
),
'lease/$' => 'DrydockLeaseListController',
),
'/chatlog/' => array(
'$' =>
'PhabricatorChatLogChannelListController',
'channel/(?P<channel>[^/]+)/$' =>
'PhabricatorChatLogChannelLogController',
),
);
}
protected function getResourceURIMapRules() {
return array(
'/res/' => array(
'(?P<package>pkg/)?(?P<hash>[a-f0-9]{8})/(?P<path>.+\.(?:css|js))$'
=> 'CelerityResourceController',
),
);
}
public function buildRequest() {
$request = new AphrontRequest($this->getHost(), $this->getPath());
$request->setRequestData($_GET + $_POST);
$request->setApplicationConfiguration($this);
return $request;
}
public function handleException(Exception $ex) {
// Always log the unhandled exception.
phlog($ex);
$class = phutil_escape_html(get_class($ex));
$message = phutil_escape_html($ex->getMessage());
if (PhabricatorEnv::getEnvConfig('phabricator.show-stack-traces')) {
$trace = $this->renderStackTrace($ex->getTrace());
} else {
$trace = null;
}
$content =
'<div class="aphront-unhandled-exception">'.
'<div class="exception-message">'.$message.'</div>'.
$trace.
'</div>';
$user = $this->getRequest()->getUser();
if (!$user) {
// If we hit an exception very early, we won't have a user.
$user = new PhabricatorUser();
}
$dialog = new AphrontDialogView();
$dialog
->setTitle('Unhandled Exception ("'.$class.'")')
->setClass('aphront-exception-dialog')
->setUser($user)
->appendChild($content);
if ($this->getRequest()->isAjax()) {
$dialog->addCancelButton('/', 'Close');
}
$response = new AphrontDialogResponse();
$response->setDialog($dialog);
return $response;
}
public function willSendResponse(AphrontResponse $response) {
$request = $this->getRequest();
$response->setRequest($request);
if ($response instanceof AphrontDialogResponse) {
if (!$request->isAjax()) {
$view = new PhabricatorStandardPageView();
$view->setRequest($request);
$view->appendChild(
'<div style="padding: 2em 0;">'.
$response->buildResponseString().
'</div>');
$response = new AphrontWebpageResponse();
$response->setContent($view->render());
return $response;
} else {
return id(new AphrontAjaxResponse())
->setContent(array(
'dialog' => $response->buildResponseString(),
));
}
} else if ($response instanceof AphrontRedirectResponse) {
if ($request->isAjax()) {
return id(new AphrontAjaxResponse())
->setContent(
array(
'redirect' => $response->getURI(),
));
}
}
return $response;
}
public function build404Controller() {
return array(new Phabricator404Controller($this->getRequest()), array());
}
public function buildRedirectController($uri) {
return array(
new PhabricatorRedirectController($this->getRequest()),
array(
'uri' => $uri,
));
}
private function renderStackTrace($trace) {
$libraries = PhutilBootloader::getInstance()->getAllLibraries();
// TODO: Make this configurable?
$host = 'https://secure.phabricator.com';
$browse = array(
'arcanist' =>
$host.'/diffusion/ARC/browse/origin:master/src/',
'phutil' =>
$host.'/diffusion/PHU/browse/origin:master/src/',
'phabricator' =>
$host.'/diffusion/P/browse/origin:master/src/',
);
$rows = array();
$depth = count($trace);
foreach ($trace as $part) {
$lib = null;
$file = idx($part, 'file');
$relative = $file;
foreach ($libraries as $library) {
$root = phutil_get_library_root($library);
if (Filesystem::isDescendant($file, $root)) {
$lib = $library;
$relative = Filesystem::readablePath($file, $root);
break;
}
}
$where = '';
if (isset($part['class'])) {
$where .= $part['class'].'::';
}
if (isset($part['function'])) {
$where .= $part['function'].'()';
}
if ($file) {
if (isset($browse[$lib])) {
$file_name = phutil_render_tag(
'a',
array(
'href' => $browse[$lib].$relative.'$'.$part['line'],
'title' => $file,
'target' => '_blank',
),
phutil_escape_html($relative));
} else {
$file_name = phutil_render_tag(
'span',
array(
'title' => $file,
),
phutil_escape_html($relative));
}
$file_name = $file_name.' : '.(int)$part['line'];
} else {
$file_name = '<em>(Internal)</em>';
}
$rows[] = array(
$depth--,
phutil_escape_html($lib),
$file_name,
phutil_escape_html($where),
);
}
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
'Depth',
'Library',
'File',
'Where',
));
$table->setColumnClasses(
array(
'n',
'',
'',
'wide',
));
return
'<div class="exception-trace">'.
'<div class="exception-trace-header">Stack Trace</div>'.
$table->render().
'</div>';
}
}
diff --git a/src/applications/audit/controller/list/PhabricatorAuditListController.php b/src/applications/audit/controller/list/PhabricatorAuditListController.php
index c8884b5a1a..1eb2631ce9 100644
--- a/src/applications/audit/controller/list/PhabricatorAuditListController.php
+++ b/src/applications/audit/controller/list/PhabricatorAuditListController.php
@@ -1,453 +1,473 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PhabricatorAuditListController extends PhabricatorAuditController {
private $filter;
+ private $name;
private $filterStatus;
public function willProcessRequest(array $data) {
$this->filter = idx($data, 'filter');
+ $this->name = idx($data, 'name');
}
public function processRequest() {
$request = $this->getRequest();
if ($request->isFormPost()) {
// If the list filter is POST'ed, redirect to GET so the page can be
// bookmarked.
$uri = $request->getRequestURI();
$phid = head($request->getArr('phid'));
- if ($phid) {
+ $user = id(new PhabricatorUser())->loadOneWhere(
+ 'phid = %s',
+ $phid);
+
+ $uri = $request->getRequestURI();
+ if ($user) {
+ $username = phutil_escape_uri($user->getUsername());
+ $uri = '/audit/view/'.$this->filter.'/'.$username.'/';
+ } else if ($phid) {
+ $uri = $request->getRequestURI();
$uri = $uri->alter('phid', $phid);
- return id(new AphrontRedirectResponse())->setURI($uri);
}
+
+ return id(new AphrontRedirectResponse())->setURI($uri);
}
$nav = $this->buildNavAndSelectFilter();
$this->filterStatus = $request->getStr('status', 'all');
$handle = $this->loadHandle();
$nav->appendChild($this->buildListFilters($handle));
$title = null;
$message = null;
if (!$handle) {
switch ($this->filter) {
case 'project':
$title = 'Choose A Project';
$message = 'Choose a project to view audits for.';
break;
case 'package':
case 'packagecommits':
$title = 'Choose a Package';
$message = 'Choose a package to view audits for.';
break;
}
}
if (!$message) {
$nav->appendChild($this->buildViews($handle));
} else {
$panel = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
->setTitle($title)
->appendChild($message);
$nav->appendChild($panel);
}
return $this->buildStandardPageResponse(
$nav,
array(
'title' => 'Audits',
));
}
private function buildNavAndSelectFilter() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/audit/view/'));
$nav->addLabel('Active');
$nav->addFilter('active', 'Need Attention');
$nav->addLabel('Audits');
$nav->addFilter('audits', 'All');
$nav->addFilter('user', 'By User');
$nav->addFilter('project', 'By Project');
$nav->addFilter('package', 'By Package');
$nav->addLabel('Commits');
$nav->addFilter('commits', 'All');
- $nav->addFilter('author', 'By User');
+ $nav->addFilter('author', 'By Author');
$nav->addFilter('packagecommits', 'By Package');
$this->filter = $nav->selectFilter($this->filter, 'active');
return $nav;
}
private function buildListFilters(PhabricatorObjectHandle $handle = null) {
$request = $this->getRequest();
$user = $request->getUser();
$form = new AphrontFormView();
$form->setUser($user);
$show_status = false;
$show_user = false;
$show_project = false;
$show_package = false;
switch ($this->filter) {
case 'audits':
case 'commits':
$show_status = true;
break;
case 'active':
$show_user = true;
break;
case 'author':
case 'user':
$show_user = true;
$show_status = true;
break;
case 'project':
$show_project = true;
$show_status = true;
break;
case 'package':
case 'packagecommits':
$show_package = true;
$show_status = true;
break;
}
if ($show_user || $show_project || $show_package) {
if ($show_user) {
- $uri = '/typeahead/common/user/';
+ $uri = '/typeahead/common/users/';
$label = 'User';
} else if ($show_project) {
$uri = '/typeahead/common/projects/';
$label = 'Project';
} else if ($show_package) {
$uri = '/typeahead/common/packages/';
$label = 'Package';
}
$tok_value = null;
if ($handle) {
$tok_value = array(
$handle->getPHID() => $handle->getFullName(),
);
}
$form->appendChild(
id(new AphrontFormTokenizerControl())
->setName('phid')
->setLabel($label)
->setLimit(1)
->setDatasource($uri)
->setValue($tok_value));
}
if ($show_status) {
$form->appendChild(
id(new AphrontFormToggleButtonsControl())
->setName('status')
->setLabel('Status')
->setBaseURI($request->getRequestURI(), 'status')
->setValue($this->filterStatus)
->setButtons(
array(
'all' => 'All',
'open' => 'Open',
)));
}
$form->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Filter Audits'));
$view = new AphrontListFilterView();
$view->appendChild($form);
return $view;
}
private function loadHandle() {
$request = $this->getRequest();
$default = null;
switch ($this->filter) {
case 'user':
case 'active':
case 'author':
$default = $request->getUser()->getPHID();
+ if ($this->name) {
+ $user = id(new PhabricatorUser())->loadOneWhere(
+ 'username = %s',
+ $this->name);
+ if ($user) {
+ $default = $user->getPHID();
+ }
+ }
break;
}
$phid = $request->getStr('phid', $default);
if (!$phid) {
return null;
}
$phids = array($phid);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$handle = $handles[$phid];
$this->validateHandle($handle);
return $handle;
}
private function validateHandle(PhabricatorObjectHandle $handle) {
switch ($this->filter) {
case 'active':
case 'user':
case 'author':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_USER) {
throw new Exception("PHID must be a user PHID!");
}
break;
case 'package':
case 'packagecommits':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_OPKG) {
throw new Exception("PHID must be a package PHID!");
}
break;
case 'project':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_PROJ) {
throw new Exception("PHID must be a project PHID!");
}
break;
case 'audits':
case 'commits':
break;
default:
throw new Exception("Unknown filter '{$this->filter}'!");
}
}
private function buildViews(PhabricatorObjectHandle $handle = null) {
$views = array();
switch ($this->filter) {
case 'active':
$views[] = $this->buildAuditView($handle);
$views[] = $this->buildCommitView($handle);
break;
case 'audits':
case 'user':
case 'package':
case 'project':
$views[] = $this->buildAuditView($handle);
break;
case 'commits':
case 'packagecommits':
case 'author':
$views[] = $this->buildCommitView($handle);
break;
}
return $views;
}
private function buildAuditView(PhabricatorObjectHandle $handle = null) {
$request = $this->getRequest();
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$query = new PhabricatorAuditQuery();
if ($this->filter != 'active') {
$query->setOffset($pager->getOffset());
$query->setLimit($pager->getPageSize() + 1);
}
$phids = null;
switch ($this->filter) {
case 'user':
case 'active':
$obj = id(new PhabricatorUser())->loadOneWhere(
'phid = %s',
$handle->getPHID());
if (!$obj) {
throw new Exception("Invalid user!");
}
$phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($obj);
break;
case 'project':
case 'package':
$phids = array($handle->getPHID());
break;
case 'audits';
break;
default:
throw new Exception("Unknown filter!");
}
if ($phids) {
$query->withAuditorPHIDs($phids);
}
switch ($this->filter) {
case 'audits':
case 'user':
case 'project':
case 'package':
switch ($this->filterStatus) {
case 'open':
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
break;
}
break;
case 'active':
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
break;
}
if ($handle) {
$handle_name = phutil_escape_html($handle->getName());
} else {
$handle_name = null;
}
switch ($this->filter) {
case 'active':
$header = 'Required Audits';
$nodata = 'No commits require your audit.';
break;
case 'user':
$header = "Audits for {$handle_name}";
$nodata = "No matching audits by {$handle_name}.";
break;
case 'audits':
$header = "Audits";
$nodata = "No matching audits.";
break;
case 'project':
$header = "Audits in Project '{$handle_name}'";
$nodata = "No matching audits in project '{$handle_name}'.";
break;
case 'package':
$header = "Audits for Package '{$handle_name}'";
$nodata = "No matching audits in package '{$handle_name}'.";
break;
}
$audits = $query->execute();
$audits = $pager->sliceResults($audits);
$view = new PhabricatorAuditListView();
$view->setAudits($audits);
$view->setNoDataString($nodata);
$phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$view->setHandles($handles);
$panel = new AphrontPanelView();
$panel->setHeader($header);
$panel->appendChild($view);
$panel->appendChild($pager);
return $panel;
}
private function buildCommitView(PhabricatorObjectHandle $handle = null) {
$request = $this->getRequest();
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$query = new PhabricatorAuditCommitQuery();
$query->needCommitData(true);
if ($this->filter != 'active') {
$query->setOffset($pager->getOffset());
$query->setLimit($pager->getPageSize() + 1);
}
switch ($this->filter) {
case 'active':
case 'author':
$query->withAuthorPHIDs(array($handle->getPHID()));
break;
case 'packagecommits':
$query->withPackagePHIDs(array($handle->getPHID()));
break;
}
switch ($this->filter) {
case 'active':
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
break;
case 'author':
case 'packagecommits':
switch ($this->filterStatus) {
case 'open':
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
break;
}
break;
}
if ($handle) {
$handle_name = phutil_escape_html($handle->getName());
} else {
$handle_name = null;
}
switch ($this->filter) {
case 'active':
$header = 'Problem Commits';
$nodata = 'None of your commits have open concerns.';
break;
case 'author':
$header = "Commits by {$handle_name}";
$nodata = "No matching commits by {$handle_name}.";
break;
case 'commits':
$header = "Commits";
$nodata = "No matching commits.";
break;
case 'packagecommits':
$header = "Commits in Package '{$handle_name}'";
$nodata = "No matching commits in package '{$handle_name}'.";
break;
}
$commits = $query->execute();
$commits = $pager->sliceResults($commits);
$view = new PhabricatorAuditCommitListView();
$view->setUser($request->getUser());
$view->setCommits($commits);
$view->setNoDataString($nodata);
$phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$view->setHandles($handles);
$panel = new AphrontPanelView();
$panel->setHeader($header);
$panel->appendChild($view);
$panel->appendChild($pager);
return $panel;
}
}
diff --git a/src/applications/diffusion/controller/commitlist/DiffusionCommitListController.php b/src/applications/diffusion/controller/commitlist/DiffusionCommitListController.php
deleted file mode 100644
index e159735bd0..0000000000
--- a/src/applications/diffusion/controller/commitlist/DiffusionCommitListController.php
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-
-/*
- * Copyright 2011 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-class DiffusionCommitListController extends DiffusionController {
-
- private $username;
-
- public function willProcessRequest(array $data) {
- if (isset($data['username'])) {
- $this->username = $data['username'];
- }
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- if ($this->username) {
- $user = id(new PhabricatorUser())->loadOneWhere(
- 'username = %s',
- $this->username);
- } else {
- $user = $request->getUser();
- }
-
- $content = array();
- if (!$user) {
- $error_view = new AphrontErrorView();
- $error_view->setSeverity(AphrontErrorView::SEVERITY_ERROR);
- $error_body = 'User name '.
- '<b>'.phutil_escape_html($this->username).'</b>'.
- ' doesn\'t exist.';
-
- $error_view->setTitle("Error");
- $error_view->appendChild('<p>'.$error_body.'</p>');
-
- $content[] = $error_view;
- } else {
-
- $pager = new AphrontPagerView();
- $pager->setOffset($request->getInt('offset'));
- $pager->setURI($request->getRequestURI(), 'offset');
-
- $query = new PhabricatorSearchQuery();
- $query->setParameter('type', PhabricatorPHIDConstants::PHID_TYPE_CMIT);
- $query->setParameter('author', array($user->getPHID()));
- $query->setParameter('limit', $pager->getPageSize() + 1);
- $query->setParameter('offset', $pager->getOffset());
-
- $user_link = phutil_render_tag(
- 'a',
- array(
- 'href' => '/p/'.$user->getUsername().'/',
- ),
- phutil_escape_html($user->getUsername()));
-
- $engine = PhabricatorSearchEngineSelector::newSelector()->newEngine();
- $results = $engine->executeSearch($query);
- $results = $pager->sliceResults($results);
- $result_phids = ipull($results, 'phid');
- $commit_table = self::createCommitTable($result_phids, $user);
-
- $list_panel = new AphrontPanelView();
- $list_panel->setHeader('Commits by '.$user_link);
- $list_panel->appendChild($commit_table);
- $list_panel->appendChild($pager);
-
- $content[] = $list_panel;
- }
-
- return $this->buildStandardPageResponse(
- $content,
- array(
- 'title' => 'Commit List',
- ));
- }
-
-
- /**
- * @param array $commit_phids phids of the commits to render
- * @param PhabricatorUser $user phabricator user
- * @return AphrontTableView
- */
- private static function createCommitTable(
- array $commit_phids, PhabricatorUser $user) {
-
- $loader = new PhabricatorObjectHandleData($commit_phids);
- $handles = $loader->loadHandles();
- $objects = $loader->loadObjects();
-
- $rows = array();
- foreach ($commit_phids as $phid) {
- $handle = $handles[$phid];
- $object = $objects[$phid];
-
- $summary = null;
- if ($object) {
- $commit_data = $object->getCommitData();
- if ($commit_data) {
- $summary = $commit_data->getSummary();
- }
- }
-
- $epoch = $handle->getTimeStamp();
- $date = phabricator_date($epoch, $user);
- $time = phabricator_time($epoch, $user);
- $link = phutil_render_tag(
- 'a',
- array(
- 'href' => $handle->getURI(),
- ),
- phutil_escape_html($handle->getName()));
- $rows[] = array(
- $link,
- $date,
- $time,
- phutil_escape_html($summary),
- );
- }
- $commit_table = new AphrontTableView($rows);
- $commit_table->setHeaders(
- array(
- 'Commit',
- 'Date',
- 'Time',
- 'Summary',
- ));
- $commit_table->setColumnClasses(
- array(
- '',
- '',
- 'right',
- 'wide',
- ));
-
- return $commit_table;
- }
-
-}
diff --git a/src/applications/diffusion/controller/commitlist/__init__.php b/src/applications/diffusion/controller/commitlist/__init__.php
deleted file mode 100644
index edb00e7fdf..0000000000
--- a/src/applications/diffusion/controller/commitlist/__init__.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-/**
- * This file is automatically generated. Lint this module to rebuild it.
- * @generated
- */
-
-
-
-phutil_require_module('phabricator', 'applications/diffusion/controller/base');
-phutil_require_module('phabricator', 'applications/people/storage/user');
-phutil_require_module('phabricator', 'applications/phid/constants');
-phutil_require_module('phabricator', 'applications/phid/handle/data');
-phutil_require_module('phabricator', 'applications/search/selector/base');
-phutil_require_module('phabricator', 'applications/search/storage/query');
-phutil_require_module('phabricator', 'view/control/pager');
-phutil_require_module('phabricator', 'view/control/table');
-phutil_require_module('phabricator', 'view/form/error');
-phutil_require_module('phabricator', 'view/layout/panel');
-phutil_require_module('phabricator', 'view/utils');
-
-phutil_require_module('phutil', 'markup');
-phutil_require_module('phutil', 'utils');
-
-
-phutil_require_source('DiffusionCommitListController.php');
diff --git a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
index 0e7ae2f0fd..43369cea89 100644
--- a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
+++ b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
@@ -1,228 +1,220 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorPeopleProfileController extends PhabricatorPeopleController {
private $username;
private $page;
public function willProcessRequest(array $data) {
$this->username = idx($data, 'username');
$this->page = idx($data, 'page');
}
public function processRequest() {
$viewer = $this->getRequest()->getUser();
$user = id(new PhabricatorUser())->loadOneWhere(
'userName = %s',
$this->username);
if (!$user) {
return new Aphront404Response();
}
require_celerity_resource('phabricator-profile-css');
$profile = id(new PhabricatorUserProfile())->loadOneWhere(
'userPHID = %s',
$user->getPHID());
if (!$profile) {
$profile = new PhabricatorUserProfile();
}
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/p/'.$user->getUserName().'/'));
$nav->addFilter('feed', 'Feed');
$nav->addFilter('about', 'About');
$nav->addSpacer();
$nav->addLabel('Activity');
$external_arrow = "\xE2\x86\x97";
$nav->addFilter(
null,
"Revisions {$external_arrow}",
'/differential/filter/revisions/?phid='.$user->getPHID());
$nav->addFilter(
null,
"Tasks {$external_arrow}",
'/maniphest/view/action/?users='.$user->getPHID());
$nav->addFilter(
null,
"Commits {$external_arrow}",
- '/diffusion/author/'.$user->getUserName().'/');
+ '/audit/view/author/'.phutil_escape_uri($user->getUserName()).'/');
$oauths = id(new PhabricatorUserOAuthInfo())->loadAllWhere(
'userID = %d',
$user->getID());
$oauths = mpull($oauths, null, 'getOAuthProvider');
$providers = PhabricatorOAuthProvider::getAllProviders();
$added_spacer = false;
foreach ($providers as $provider) {
if (!$provider->isProviderEnabled()) {
continue;
}
$provider_key = $provider->getProviderKey();
if (!isset($oauths[$provider_key])) {
continue;
}
$name = $provider->getProviderName().' Profile';
$href = $oauths[$provider_key]->getAccountURI();
if ($href) {
if (!$added_spacer) {
$nav->addSpacer();
$nav->addLabel('Linked Accounts');
$added_spacer = true;
}
$nav->addFilter(null, $name.' '.$external_arrow, $href);
}
}
$this->page = $nav->selectFilter($this->page, 'feed');
switch ($this->page) {
case 'feed':
$content = $this->renderUserFeed($user);
break;
case 'about':
$content = $this->renderBasicInformation($user, $profile);
break;
default:
throw new Exception("Unknown page '{$this->page}'!");
}
$src_phid = $user->getProfileImagePHID();
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $src_phid);
if ($file) {
$picture = $file->getBestURI();
} else {
$picture = null;
}
$header = new PhabricatorProfileHeaderView();
$header
->setProfilePicture($picture)
->setName($user->getUserName().' ('.$user->getRealName().')')
->setDescription($profile->getTitle());
$header->appendChild($nav);
$nav->appendChild(
'<div style="padding: 1em;">'.$content.'</div>');
if ($user->getPHID() == $viewer->getPHID()) {
$nav->addSpacer();
$nav->addFilter(null, 'Edit Profile...', '/settings/page/profile/');
}
if ($viewer->getIsAdmin()) {
$nav->addSpacer();
$nav->addFilter(
null,
'Administrate User...',
'/people/edit/'.$user->getID().'/');
}
return $this->buildStandardPageResponse(
$header,
array(
'title' => $user->getUsername(),
));
}
private function renderBasicInformation($user, $profile) {
$blurb = nonempty(
$profile->getBlurb(),
'//Nothing is known about this rare specimen.//');
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
$blurb = $engine->markupText($blurb);
- $commit_list =
- phutil_render_tag(
- 'a',
- array(
- 'href' => '/diffusion/author/'.
- phutil_escape_uri($user->getUsername()),
- ),
- 'Recent Commits');
$viewer = $this->getRequest()->getUser();
$content =
'<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Basic Information</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>PHID</th>
<td>'.phutil_escape_html($user->getPHID()).'</td>
</tr>
<tr>
<th>User Since</th>
<td>'.phabricator_datetime($user->getDateCreated(),
$viewer).
'</td>
</tr>
</table>
</div>
</div>';
$content .=
'<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Flavor Text</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>Blurb</th>
<td>'.$blurb.'</td>
</tr>
</table>
</div>
</div>';
return $content;
}
private function renderUserFeed(PhabricatorUser $user) {
$query = new PhabricatorFeedQuery();
$query->setFilterPHIDs(
array(
$user->getPHID(),
));
$stories = $query->execute();
$builder = new PhabricatorFeedBuilder($stories);
$builder->setUser($this->getRequest()->getUser());
$view = $builder->buildView();
return
'<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Activity Feed</h1>
<div class="phabricator-profile-info-pane">
'.$view->render().'
</div>
</div>';
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 20, 8:17 AM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
241550
Default Alt Text
(49 KB)

Event Timeline