2011-01-16 22:51:39 +01:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group aphront
|
|
|
|
*/
|
|
|
|
class AphrontDefaultApplicationConfiguration
|
|
|
|
extends AphrontApplicationConfiguration {
|
|
|
|
|
2011-02-24 23:52:57 +01:00
|
|
|
public function __construct() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-16 22:51:39 +01:00
|
|
|
public function getApplicationName() {
|
|
|
|
return 'aphront-default';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getURIMap() {
|
2011-02-24 23:52:57 +01:00
|
|
|
return $this->getResourceURIMapRules() + array(
|
2011-01-16 22:51:39 +01:00
|
|
|
'/' => array(
|
2011-01-23 06:09:13 +01:00
|
|
|
'$' => 'PhabricatorDirectoryMainController',
|
2011-01-16 22:51:39 +01:00
|
|
|
),
|
|
|
|
'/directory/' => array(
|
2011-01-23 06:09:13 +01:00
|
|
|
'item/$'
|
|
|
|
=> 'PhabricatorDirectoryItemListController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'item/edit/(?:(?P<id>\d+)/)?$'
|
2011-01-23 06:09:13 +01:00
|
|
|
=> 'PhabricatorDirectoryItemEditController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'item/delete/(?P<id>\d+)/'
|
2011-01-23 06:09:13 +01:00
|
|
|
=> 'PhabricatorDirectoryItemDeleteController',
|
2011-01-16 22:51:39 +01:00
|
|
|
'category/$'
|
2011-01-23 06:09:13 +01:00
|
|
|
=> 'PhabricatorDirectoryCategoryListController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'category/edit/(?:(?P<id>\d+)/)?$'
|
2011-01-23 06:09:13 +01:00
|
|
|
=> 'PhabricatorDirectoryCategoryEditController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'category/delete/(?P<id>\d+)/'
|
2011-01-23 06:09:13 +01:00
|
|
|
=> 'PhabricatorDirectoryCategoryDeleteController',
|
|
|
|
),
|
2011-01-23 03:33:00 +01:00
|
|
|
'/file/' => array(
|
|
|
|
'$' => 'PhabricatorFileListController',
|
|
|
|
'upload/$' => 'PhabricatorFileUploadController',
|
2011-05-22 20:55:10 +02:00
|
|
|
'dropupload/$' => 'PhabricatorFileDropUploadController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'(?P<view>info)/(?P<phid>[^/]+)/' => 'PhabricatorFileViewController',
|
|
|
|
'(?P<view>view)/(?P<phid>[^/]+)/' => 'PhabricatorFileViewController',
|
|
|
|
'(?P<view>download)/(?P<phid>[^/]+)/' => 'PhabricatorFileViewController',
|
2011-05-03 19:45:45 +02:00
|
|
|
'macro/' => array(
|
|
|
|
'$' => 'PhabricatorFileMacroListController',
|
|
|
|
'edit/(?:(?P<id>\d+)/)?$' => 'PhabricatorFileMacroEditController',
|
|
|
|
'delete/(?P<id>\d+)/$' => 'PhabricatorFileMacroDeleteController',
|
|
|
|
),
|
2011-05-02 23:20:24 +02:00
|
|
|
'proxy/$' => 'PhabricatorFileProxyController',
|
2011-05-22 23:40:51 +02:00
|
|
|
'xform/(?P<transform>[^/]+)/(?P<phid>[^/]+)/'
|
|
|
|
=> 'PhabricatorFileTransformController',
|
2011-01-23 03:33:00 +01:00
|
|
|
),
|
2011-01-23 06:09:13 +01:00
|
|
|
'/phid/' => array(
|
2011-01-26 18:02:09 +01:00
|
|
|
'$' => 'PhabricatorPHIDLookupController',
|
|
|
|
'list/$' => 'PhabricatorPHIDListController',
|
2011-01-23 06:09:13 +01:00
|
|
|
'new/$' => 'PhabricatorPHIDAllocateController',
|
2011-01-16 22:51:39 +01:00
|
|
|
),
|
2011-01-24 03:09:16 +01:00
|
|
|
'/people/' => array(
|
|
|
|
'$' => 'PhabricatorPeopleListController',
|
Provide an activity log for login and administrative actions
Summary: This isn't complete, but I figured I'd ship it for review while it's still smallish.
Provide an activity log for high-level system actions (logins, admin actions). This basically allows two things to happen:
- The log itself is useful if there are shenanigans.
- Password login can check it and start CAPTCHA'ing users after a few failed attempts.
I'm going to change how the admin stuff works a little bit too, since right now you can make someone an agent, grab their certificate, revert them back to a normal user, and then act on their behalf over Conduit. This is a little silly, I'm going to move "agent" to the create workflow instead. I'll also add a confirm/email step to the administrative password reset flow.
Test Plan: Took various administrative and non-administrative actions, they appeared in the logs. Filtered the logs in a bunch of different ways.
Reviewers: jungejason, tuomaspelkonen, aran
CC:
Differential Revision: 302
2011-05-18 03:42:21 +02:00
|
|
|
'logs/$' => 'PhabricatorPeopleLogsController',
|
2011-05-12 19:06:54 +02:00
|
|
|
'edit/(?:(?P<id>\d+)/(?:(?P<view>\w+)/)?)?$'
|
|
|
|
=> 'PhabricatorPeopleEditController',
|
2011-01-24 03:09:16 +01:00
|
|
|
),
|
2011-02-08 05:56:27 +01:00
|
|
|
'/p/(?P<username>\w+)/$' => 'PhabricatorPeopleProfileController',
|
2011-02-20 03:28:41 +01:00
|
|
|
'/profile/' => array(
|
|
|
|
'edit/$' => 'PhabricatorPeopleProfileEditController',
|
|
|
|
),
|
2011-01-24 18:00:29 +01:00
|
|
|
'/conduit/' => array(
|
|
|
|
'$' => 'PhabricatorConduitConsoleController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'method/(?P<method>[^/]+)$' => 'PhabricatorConduitConsoleController',
|
2011-01-24 18:00:29 +01:00
|
|
|
'log/$' => 'PhabricatorConduitLogController',
|
|
|
|
),
|
2011-02-08 05:56:27 +01:00
|
|
|
'/api/(?P<method>[^/]+)$' => 'PhabricatorConduitAPIController',
|
2011-01-24 22:18:41 +01:00
|
|
|
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2011-02-08 05:56:27 +01:00
|
|
|
'/D(?P<id>\d+)' => 'DifferentialRevisionViewController',
|
2011-01-24 22:18:41 +01:00
|
|
|
'/differential/' => array(
|
2011-01-26 00:19:06 +01:00
|
|
|
'$' => 'DifferentialRevisionListController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'filter/(?P<filter>\w+)/$' => 'DifferentialRevisionListController',
|
2011-02-05 21:20:18 +01:00
|
|
|
'diff/' => array(
|
2011-02-08 05:56:27 +01:00
|
|
|
'(?P<id>\d+)/$' => 'DifferentialDiffViewController',
|
2011-02-05 21:20:18 +01:00
|
|
|
'create/$' => 'DifferentialDiffCreateController',
|
|
|
|
),
|
2011-02-01 05:38:13 +01:00
|
|
|
'changeset/$' => 'DifferentialChangesetViewController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'revision/edit/(?:(?P<id>\d+)/)?$'
|
2011-01-25 22:26:09 +01:00
|
|
|
=> 'DifferentialRevisionEditController',
|
2011-01-30 21:08:40 +01:00
|
|
|
'comment/' => array(
|
2011-02-08 05:56:27 +01:00
|
|
|
'preview/(?P<id>\d+)/$' => 'DifferentialCommentPreviewController',
|
2011-01-30 21:08:40 +01:00
|
|
|
'save/$' => 'DifferentialCommentSaveController',
|
|
|
|
'inline/' => array(
|
2011-02-08 05:56:27 +01:00
|
|
|
'preview/(?P<id>\d+)/$' =>
|
2011-02-03 04:38:43 +01:00
|
|
|
'DifferentialInlineCommentPreviewController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'edit/(?P<id>\d+)/$' => 'DifferentialInlineCommentEditController',
|
2011-01-30 21:08:40 +01:00
|
|
|
),
|
|
|
|
),
|
2011-02-19 23:36:13 +01:00
|
|
|
'subscribe/(?P<action>add|rem)/(?P<id>\d+)/$'
|
|
|
|
=> 'DifferentialSubscribeController',
|
2011-01-24 22:18:41 +01:00
|
|
|
),
|
|
|
|
|
2011-01-25 22:48:05 +01:00
|
|
|
'/typeahead/' => array(
|
2011-02-08 05:56:27 +01:00
|
|
|
'common/(?P<type>\w+)/$'
|
2011-01-25 22:48:05 +01:00
|
|
|
=> 'PhabricatorTypeaheadCommonDatasourceController',
|
|
|
|
),
|
2011-01-26 02:40:21 +01:00
|
|
|
|
|
|
|
'/mail/' => array(
|
|
|
|
'$' => 'PhabricatorMetaMTAListController',
|
|
|
|
'send/$' => 'PhabricatorMetaMTASendController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'view/(?P<id>\d+)/$' => 'PhabricatorMetaMTAViewController',
|
2011-01-26 19:40:38 +01:00
|
|
|
'lists/$' => 'PhabricatorMetaMTAMailingListsController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'lists/edit/(?:(?P<id>\d+)/)?$'
|
2011-01-26 19:40:38 +01:00
|
|
|
=> 'PhabricatorMetaMTAMailingListEditController',
|
2011-05-05 08:09:42 +02:00
|
|
|
'receive/$' => 'PhabricatorMetaMTAReceiveController',
|
|
|
|
'received/$' => 'PhabricatorMetaMTAReceivedListController',
|
2011-05-30 20:07:05 +02:00
|
|
|
'sendgrid/$' => 'PhabricatorMetaMTASendGridReceiveController',
|
2011-01-26 19:40:38 +01:00
|
|
|
),
|
2011-01-26 22:21:12 +01:00
|
|
|
|
2011-01-31 20:55:26 +01:00
|
|
|
'/login/' => array(
|
|
|
|
'$' => 'PhabricatorLoginController',
|
|
|
|
'email/$' => 'PhabricatorEmailLoginController',
|
2011-02-08 05:56:27 +01:00
|
|
|
'etoken/(?P<token>\w+)/$' => 'PhabricatorEmailTokenController',
|
2011-01-31 20:55:26 +01:00
|
|
|
),
|
2011-02-24 23:52:57 +01:00
|
|
|
|
2011-01-31 06:28:45 +01:00
|
|
|
'/logout/$' => 'PhabricatorLogoutController',
|
2011-02-02 22:48:52 +01:00
|
|
|
|
2011-02-21 07:47:56 +01:00
|
|
|
'/oauth/' => array(
|
|
|
|
'(?P<provider>github|facebook)/' => array(
|
|
|
|
'login/$' => 'PhabricatorOAuthLoginController',
|
|
|
|
'diagnose/$' => 'PhabricatorOAuthDiagnosticsController',
|
2011-02-22 07:51:34 +01:00
|
|
|
'unlink/$' => 'PhabricatorOAuthUnlinkController',
|
2011-02-21 07:47:56 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2011-02-02 22:48:52 +01:00
|
|
|
'/xhprof/' => array(
|
2011-02-08 05:56:27 +01:00
|
|
|
'profile/(?P<phid>[^/]+)/$' => 'PhabricatorXHProfProfileController',
|
2011-02-02 22:48:52 +01:00
|
|
|
),
|
2011-02-03 07:38:42 +01:00
|
|
|
|
|
|
|
'/~/' => 'DarkConsoleController',
|
2011-02-06 07:36:21 +01:00
|
|
|
|
|
|
|
'/settings/' => array(
|
2011-02-08 05:56:27 +01:00
|
|
|
'(?:page/(?P<page>[^/]+)/)?$' => 'PhabricatorUserSettingsController',
|
2011-02-06 07:36:21 +01:00
|
|
|
),
|
2011-02-08 19:53:59 +01:00
|
|
|
|
|
|
|
'/maniphest/' => array(
|
|
|
|
'$' => 'ManiphestTaskListController',
|
|
|
|
'view/(?P<view>\w+)/$' => 'ManiphestTaskListController',
|
|
|
|
'task/' => array(
|
2011-02-20 23:15:53 +01:00
|
|
|
'create/$' => 'ManiphestTaskEditController',
|
|
|
|
'edit/(?P<id>\d+)/$' => 'ManiphestTaskEditController',
|
2011-05-21 03:56:18 +02:00
|
|
|
'descriptionchange/(?P<id>\d+)/$' =>
|
|
|
|
'ManiphestTaskDescriptionChangeController',
|
2011-02-08 19:53:59 +01:00
|
|
|
),
|
|
|
|
'transaction/' => array(
|
|
|
|
'save/' => 'ManiphestTransactionSaveController',
|
2011-05-10 17:29:28 +02:00
|
|
|
'preview/(?P<id>\d+)/$' => 'ManiphestTransactionPreviewController',
|
2011-02-08 19:53:59 +01:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
'/T(?P<id>\d+)$' => 'ManiphestTaskDetailController',
|
2011-02-13 03:26:15 +01:00
|
|
|
|
|
|
|
'/github-post-receive/(?P<id>\d+)/(?P<token>[^/]+)/$'
|
|
|
|
=> 'PhabricatorRepositoryGitHubPostReceiveController',
|
2011-02-19 23:36:13 +01:00
|
|
|
|
2011-02-13 03:26:15 +01:00
|
|
|
'/repository/' => array(
|
|
|
|
'$' => 'PhabricatorRepositoryListController',
|
|
|
|
'create/$' => 'PhabricatorRepositoryCreateController',
|
2011-03-07 07:29:22 +01:00
|
|
|
'edit/(?P<id>\d+)/(?:(?P<view>\w+)?/)?$' =>
|
|
|
|
'PhabricatorRepositoryEditController',
|
2011-02-13 03:26:15 +01:00
|
|
|
'delete/(?P<id>\d+)/$' => 'PhabricatorRepositoryDeleteController',
|
2011-04-06 05:49:31 +02:00
|
|
|
'project/(?P<id>\d+)/' =>
|
|
|
|
'PhabricatorRepositoryArcanistProjectEditController',
|
2011-02-13 03:26:15 +01:00
|
|
|
),
|
2011-02-15 00:34:20 +01:00
|
|
|
|
|
|
|
'/search/' => array(
|
|
|
|
'$' => 'PhabricatorSearchController',
|
|
|
|
'(?P<id>\d+)/$' => 'PhabricatorSearchController',
|
2011-05-16 20:43:39 +02:00
|
|
|
'attach/(?P<phid>[^/]+)/(?P<type>\w+)/$'
|
|
|
|
=> 'PhabricatorSearchAttachController',
|
|
|
|
'select/(?P<type>\w+)/$'
|
|
|
|
=> 'PhabricatorSearchSelectController',
|
2011-02-15 00:34:20 +01:00
|
|
|
),
|
2011-02-21 03:41:23 +01:00
|
|
|
|
|
|
|
'/project/' => array(
|
|
|
|
'$' => 'PhabricatorProjectListController',
|
|
|
|
'edit/(?:(?P<id>\d+)/)?$' => 'PhabricatorProjectEditController',
|
|
|
|
'view/(?P<id>\d+)/$' => 'PhabricatorProjectProfileController',
|
|
|
|
'affiliation/(?P<id>\d+)/$'
|
|
|
|
=> 'PhabricatorProjectAffiliationEditController',
|
2011-02-24 23:52:57 +01:00
|
|
|
),
|
|
|
|
|
2011-03-11 18:34:22 +01:00
|
|
|
'/r(?P<callsign>[A-Z]+)(?P<commit>[a-z0-9]+)$'
|
|
|
|
=> 'DiffusionCommitController',
|
2011-03-08 00:13:36 +01:00
|
|
|
'/diffusion/' => array(
|
|
|
|
'$' => 'DiffusionHomeController',
|
2011-03-13 01:17:34 +01:00
|
|
|
'(?P<callsign>[A-Z]+)/' => array(
|
|
|
|
'$' => 'DiffusionRepositoryController',
|
2011-03-31 10:07:51 +02:00
|
|
|
'repository/'.
|
|
|
|
'(?P<path>[^/]+)/'.
|
|
|
|
'$'
|
|
|
|
=> 'DiffusionRepositoryController',
|
2011-03-14 06:03:30 +01:00
|
|
|
'change/'.
|
|
|
|
'(?P<path>.*?)'.
|
|
|
|
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
|
|
|
'$'
|
|
|
|
=> 'DiffusionChangeController',
|
2011-03-13 01:17:34 +01:00
|
|
|
'history/'.
|
2011-03-09 02:31:44 +01:00
|
|
|
'(?P<path>.*?)'.
|
|
|
|
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
|
|
|
'$'
|
|
|
|
=> 'DiffusionHistoryController',
|
2011-03-13 01:17:34 +01:00
|
|
|
'browse/'.
|
2011-03-09 02:31:44 +01:00
|
|
|
'(?P<path>.*?)'.
|
|
|
|
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
|
|
|
'(?:[$](?P<line>\d+))?'.
|
|
|
|
'$'
|
|
|
|
=> 'DiffusionBrowseController',
|
2011-03-31 02:36:16 +02:00
|
|
|
'diff/'.
|
|
|
|
'(?P<path>.*?)'.
|
|
|
|
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
|
|
|
'$'
|
|
|
|
=> 'DiffusionDiffController',
|
2011-03-31 08:27:06 +02:00
|
|
|
'lastmodified/'.
|
|
|
|
'(?P<path>.*?)'.
|
|
|
|
'(?:[;](?P<commit>[a-z0-9]+))?'.
|
|
|
|
'$'
|
|
|
|
=> 'DiffusionLastModifiedController',
|
2011-03-09 02:31:44 +01:00
|
|
|
),
|
2011-04-04 04:20:47 +02:00
|
|
|
'services/' => array(
|
|
|
|
'path/' => array(
|
|
|
|
'complete/$' => 'DiffusionPathCompleteController',
|
|
|
|
'validate/$' => 'DiffusionPathValidateController',
|
|
|
|
),
|
|
|
|
),
|
2011-03-08 00:13:36 +01:00
|
|
|
),
|
|
|
|
|
2011-03-10 22:48:29 +01:00
|
|
|
'/daemon/' => array(
|
2011-03-27 07:55:18 +02:00
|
|
|
'task/(?P<id>\d+)/$' => 'PhabricatorWorkerTaskDetailController',
|
2011-03-15 21:38:14 +01:00
|
|
|
'log/' => array(
|
2011-05-03 02:05:22 +02:00
|
|
|
'$' => 'PhabricatorDaemonLogListController',
|
|
|
|
'combined/$' => 'PhabricatorDaemonCombinedLogController',
|
2011-03-15 21:38:14 +01:00
|
|
|
'(?P<id>\d+)/$' => 'PhabricatorDaemonLogViewController',
|
|
|
|
),
|
2011-03-11 18:34:22 +01:00
|
|
|
'timeline/$' => 'PhabricatorDaemonTimelineConsoleController',
|
|
|
|
'timeline/(?P<id>\d+)/$' => 'PhabricatorDaemonTimelineEventController',
|
2011-03-10 22:48:29 +01:00
|
|
|
'$' => 'PhabricatorDaemonConsoleController',
|
|
|
|
),
|
|
|
|
|
2011-03-22 21:49:46 +01:00
|
|
|
'/herald/' => array(
|
|
|
|
'$' => 'HeraldHomeController',
|
|
|
|
'view/(?P<view>[^/]+)/$' => 'HeraldHomeController',
|
2011-03-22 22:34:38 +01:00
|
|
|
'new/(?:(?P<type>[^/]+)/)?$' => 'HeraldNewController',
|
2011-04-04 08:45:27 +02:00
|
|
|
'rule/(?:(?P<id>\d+)/)?$' => 'HeraldRuleController',
|
2011-03-24 19:07:36 +01:00
|
|
|
'delete/(?P<id>\d+)/$' => 'HeraldDeleteController',
|
2011-03-24 21:49:21 +01:00
|
|
|
'test/$' => 'HeraldTestConsoleController',
|
|
|
|
'transcript/$' => 'HeraldTranscriptListController',
|
2011-03-25 05:32:26 +01:00
|
|
|
'transcript/(?P<id>\d+)/(?:(?P<filter>\w+)/)?$'
|
|
|
|
=> 'HeraldTranscriptController',
|
2011-03-22 21:49:46 +01:00
|
|
|
),
|
|
|
|
|
2011-03-31 04:21:09 +02:00
|
|
|
'/preferences/' => array(
|
|
|
|
'$' => 'PhabricatorEditPreferencesController'
|
|
|
|
),
|
2011-04-01 02:06:33 +02:00
|
|
|
|
|
|
|
'/uiexample/' => array(
|
|
|
|
'$' => 'PhabricatorUIExampleRenderController',
|
|
|
|
'view/(?P<class>[^/]+)/$' => 'PhabricatorUIExampleRenderController',
|
|
|
|
),
|
|
|
|
|
2011-04-03 23:48:36 +02:00
|
|
|
'/owners/' => array(
|
|
|
|
'$' => 'PhabricatorOwnersListController',
|
|
|
|
'view/(?P<view>[^/]+)/$' => 'PhabricatorOwnersListController',
|
2011-04-04 07:03:27 +02:00
|
|
|
'edit/(?P<id>\d+)/$' => 'PhabricatorOwnersEditController',
|
|
|
|
'new/$' => 'PhabricatorOwnersEditController',
|
2011-04-03 23:48:36 +02:00
|
|
|
'package/(?P<id>\d+)/$' => 'PhabricatorOwnersDetailController',
|
2011-04-04 07:03:27 +02:00
|
|
|
'delete/(?P<id>\d+)/$' => 'PhabricatorOwnersDeleteController',
|
2011-04-03 23:48:36 +02:00
|
|
|
),
|
|
|
|
|
2011-04-07 04:17:05 +02:00
|
|
|
'/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',
|
|
|
|
),
|
|
|
|
|
2011-04-08 20:13:29 +02:00
|
|
|
'/status/$' => 'PhabricatorStatusController',
|
|
|
|
|
2011-06-10 08:53:53 +02:00
|
|
|
'/paste/' => array(
|
|
|
|
'$' => 'PhabricatorPasteHomeController',
|
|
|
|
'create/' => 'PhabricatorPasteCreateController',
|
|
|
|
),
|
|
|
|
|
|
|
|
'/P(?P<id>\d+)$' => 'PhabricatorPasteViewController',
|
|
|
|
|
2011-05-28 20:36:00 +02:00
|
|
|
'/help/' => array(
|
|
|
|
'keyboardshortcut/$' => 'PhabricatorHelpKeyboardShortcutController',
|
|
|
|
),
|
2011-06-13 01:06:17 +02:00
|
|
|
|
|
|
|
'/countdown/' => array(
|
|
|
|
'$'
|
|
|
|
=> 'PhabricatorCountdownListController',
|
|
|
|
'(?P<id>\d+)/$'
|
|
|
|
=> 'PhabricatorCountdownViewController',
|
|
|
|
'edit/(?:(?P<id>\d+)/)?$'
|
|
|
|
=> 'PhabricatorCountdownEditController',
|
|
|
|
'delete/(?P<id>\d+)/$'
|
|
|
|
=> 'PhabricatorCountdownDeleteController'
|
|
|
|
),
|
2011-02-24 23:52:57 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getResourceURIMapRules() {
|
|
|
|
return array(
|
|
|
|
'/res/' => array(
|
|
|
|
'(?P<package>pkg/)?(?P<hash>[a-f0-9]{8})/(?P<path>.+\.(?:css|js))$'
|
|
|
|
=> 'CelerityResourceController',
|
|
|
|
),
|
2011-01-16 22:51:39 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildRequest() {
|
|
|
|
$request = new AphrontRequest($this->getHost(), $this->getPath());
|
|
|
|
$request->setRequestData($_GET + $_POST);
|
2011-02-02 22:48:52 +01:00
|
|
|
$request->setApplicationConfiguration($this);
|
2011-01-16 22:51:39 +01:00
|
|
|
return $request;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handleException(Exception $ex) {
|
|
|
|
|
2011-05-09 10:10:40 +02:00
|
|
|
// Always log the unhandled exception.
|
|
|
|
phlog($ex);
|
|
|
|
|
2011-01-16 22:51:39 +01:00
|
|
|
$class = phutil_escape_html(get_class($ex));
|
|
|
|
$message = phutil_escape_html($ex->getMessage());
|
|
|
|
|
|
|
|
$content =
|
|
|
|
'<div class="aphront-unhandled-exception">'.
|
|
|
|
'<h1>Unhandled Exception "'.$class.'": '.$message.'</h1>'.
|
|
|
|
'<code>'.phutil_escape_html((string)$ex).'</code>'.
|
|
|
|
'</div>';
|
|
|
|
|
2011-02-27 05:57:21 +01:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
if (!$user) {
|
|
|
|
// If we hit an exception very early, we won't have a user.
|
|
|
|
$user = new PhabricatorUser();
|
2011-02-17 23:32:01 +01:00
|
|
|
}
|
|
|
|
|
2011-02-27 05:57:21 +01:00
|
|
|
$dialog = new AphrontDialogView();
|
|
|
|
$dialog
|
|
|
|
->setTitle('Exception!')
|
|
|
|
->setClass('aphront-exception-dialog')
|
|
|
|
->setUser($user)
|
|
|
|
->appendChild($content)
|
|
|
|
->addCancelButton('/');
|
2011-01-16 22:51:39 +01:00
|
|
|
|
2011-02-27 05:57:21 +01:00
|
|
|
$response = new AphrontDialogResponse();
|
|
|
|
$response->setDialog($dialog);
|
2011-01-16 22:51:39 +01:00
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function willSendResponse(AphrontResponse $response) {
|
|
|
|
$request = $this->getRequest();
|
2011-05-16 20:43:39 +02:00
|
|
|
$response->setRequest($request);
|
2011-01-16 22:51:39 +01:00
|
|
|
if ($response instanceof AphrontDialogResponse) {
|
|
|
|
if (!$request->isAjax()) {
|
2011-01-23 02:48:55 +01:00
|
|
|
$view = new PhabricatorStandardPageView();
|
2011-02-05 02:53:14 +01:00
|
|
|
$view->setRequest($request);
|
2011-01-16 22:51:39 +01:00
|
|
|
$view->appendChild(
|
|
|
|
'<div style="padding: 2em 0;">'.
|
|
|
|
$response->buildResponseString().
|
|
|
|
'</div>');
|
|
|
|
$response = new AphrontWebpageResponse();
|
|
|
|
$response->setContent($view->render());
|
|
|
|
return $response;
|
2011-02-02 01:42:36 +01:00
|
|
|
} else {
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
|
|
->setContent(array(
|
|
|
|
'dialog' => $response->buildResponseString(),
|
|
|
|
));
|
2011-01-16 22:51:39 +01:00
|
|
|
}
|
2011-02-05 20:45:13 +01:00
|
|
|
} else if ($response instanceof AphrontRedirectResponse) {
|
|
|
|
if ($request->isAjax()) {
|
|
|
|
return id(new AphrontAjaxResponse())
|
|
|
|
->setContent(
|
|
|
|
array(
|
|
|
|
'redirect' => $response->getURI(),
|
|
|
|
));
|
|
|
|
}
|
2011-01-30 17:44:28 +01:00
|
|
|
} else if ($response instanceof Aphront404Response) {
|
2011-01-30 18:15:01 +01:00
|
|
|
|
|
|
|
$failure = new AphrontRequestFailureView();
|
|
|
|
$failure->setHeader('404 Not Found');
|
|
|
|
$failure->appendChild(
|
|
|
|
'<p>The page you requested was not found.</p>');
|
|
|
|
|
2011-01-30 17:44:28 +01:00
|
|
|
$view = new PhabricatorStandardPageView();
|
|
|
|
$view->setTitle('404 Not Found');
|
2011-02-02 22:48:52 +01:00
|
|
|
$view->setRequest($this->getRequest());
|
2011-01-30 18:15:01 +01:00
|
|
|
$view->appendChild($failure);
|
|
|
|
|
2011-01-30 17:44:28 +01:00
|
|
|
$response = new AphrontWebpageResponse();
|
|
|
|
$response->setContent($view->render());
|
|
|
|
$response->setHTTPResponseCode(404);
|
|
|
|
return $response;
|
2011-01-16 22:51:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2011-01-30 01:16:09 +01:00
|
|
|
public function build404Controller() {
|
2011-01-30 17:44:28 +01:00
|
|
|
return array(new Phabricator404Controller($this->getRequest()), array());
|
2011-01-30 01:16:09 +01:00
|
|
|
}
|
|
|
|
|
2011-04-04 19:29:46 +02:00
|
|
|
public function buildRedirectController($uri) {
|
|
|
|
return array(
|
|
|
|
new PhabricatorRedirectController($this->getRequest()),
|
|
|
|
array(
|
|
|
|
'uri' => $uri,
|
|
|
|
));
|
|
|
|
}
|
2011-01-16 22:51:39 +01:00
|
|
|
|
|
|
|
}
|