本文整理汇总了PHP中PhabricatorEnv::getDoclink方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv::getDoclink方法的具体用法?PHP PhabricatorEnv::getDoclink怎么用?PHP PhabricatorEnv::getDoclink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEnv
的用法示例。
在下文中一共展示了PhabricatorEnv::getDoclink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$request = $this->getRequest();
if ($request->isFormPost()) {
$parser = new ArcanistDiffParser();
$diff = null;
try {
$diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
} catch (Exception $ex) {
$diff = $request->getStr('diff');
}
$changes = $parser->parseDiff($diff);
$diff = DifferentialDiff::newFromRawChanges($changes);
$diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setUnitStatus(DifferentialLintStatus::LINT_SKIP);
$diff->setAuthorPHID($request->getUser()->getPHID());
$diff->setCreationMethod('web');
$diff->save();
return id(new AphrontRedirectResponse())->setURI('/differential/diff/' . $diff->getID() . '/');
}
$form = new AphrontFormView();
$arcanist_href = PhabricatorEnv::getDoclink('article/Arcanist_User_Guide.html');
$arcanist_link = phutil_render_tag('a', array('href' => $arcanist_href, 'target' => '_blank'), 'Arcanist');
$form->setAction('/differential/diff/create/')->setEncType('multipart/form-data')->setUser($request->getUser())->appendChild('<p class="aphront-form-instructions">The best way to create a ' . "Differential diff is by using {$arcanist_link}, but you " . 'can also just paste a diff (e.g., from <tt>svn diff</tt> or ' . '<tt>git diff</tt>) into this box or upload it as a file if you ' . 'really want.</p>')->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Raw Diff')->setName('diff')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))->appendChild(id(new AphrontFormFileControl())->setLabel('Raw Diff from file')->setName('diff-file'))->appendChild(id(new AphrontFormSubmitControl())->setValue("Create Diff »"));
$panel = new AphrontPanelView();
$panel->setHeader('Create New Diff');
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
return $this->buildStandardPageResponse($panel, array('title' => 'Create Diff', 'tab' => 'create'));
}
示例2: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$user = $this->getRequest()->getUser();
$page = $this->buildStandardPageView();
$page->setApplicationName('OAuth Server');
$page->setBaseURI('/oauthserver/');
$page->setTitle(idx($data, 'title'));
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/oauthserver/'));
$nav->addLabel('Client Authorizations');
$nav->addFilter('clientauthorization', 'My Authorizations');
$nav->addSpacer();
$nav->addLabel('Clients');
$nav->addFilter('client/create', 'Create Client');
foreach ($this->getExtraClientFilters() as $filter) {
$nav->addFilter($filter['url'], $filter['label']);
}
$nav->addFilter('client', 'My Clients');
$nav->selectFilter($this->getFilter(), 'clientauthorization');
$nav->appendChild($view);
$page->appendChild($nav);
$doc_href = PhabricatorEnv::getDoclink('article/Using_the_Phabricator_OAuth_Server.html');
$page->setTabs(array('help' => array('name' => 'Help', 'href' => $doc_href)), null);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例3: buildPropertyView
private function buildPropertyView(PhabricatorApplication $application, PhabricatorActionListView $actions)
{
$viewer = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView());
$properties->setActionList($actions);
$properties->addProperty(pht('Description'), $application->getShortDescription());
if ($application->getFlavorText()) {
$properties->addProperty(null, phutil_tag('em', array(), $application->getFlavorText()));
}
if ($application->isPrototype()) {
$proto_href = PhabricatorEnv::getDoclink('User Guide: Prototype Applications');
$learn_more = phutil_tag('a', array('href' => $proto_href, 'target' => '_blank'), pht('Learn More'));
$properties->addProperty(pht('Prototype'), pht('This application is a prototype. %s', $learn_more));
}
$overview = $application->getOverview();
if (strlen($overview)) {
$overview = new PHUIRemarkupView($viewer, $overview);
$properties->addSectionHeader(pht('Overview'), PHUIPropertyListView::ICON_SUMMARY);
$properties->addTextContent($overview);
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $application);
$properties->addSectionHeader(pht('Policies'), 'fa-lock');
foreach ($application->getCapabilities() as $capability) {
$properties->addProperty($application->getCapabilityLabel($capability), idx($descriptions, $capability));
}
return $properties;
}
示例4: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$class = $request->getURIData('class');
$sources = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorTypeaheadDatasource')->execute();
if (!isset($sources[$class])) {
return new Aphront404Response();
}
$source = $sources[$class];
$application_class = $source->getDatasourceApplicationClass();
if ($application_class) {
$result = id(new PhabricatorApplicationQuery())->setViewer($this->getViewer())->withClasses(array($application_class))->execute();
if (!$result) {
return new Aphront404Response();
}
}
$source->setViewer($viewer);
$title = pht('Typeahead Function Help');
$functions = $source->getAllDatasourceFunctions();
ksort($functions);
$content = array();
$content[] = '= ' . pht('Overview');
$content[] = pht('Typeahead functions are an advanced feature which allow you to build ' . 'more powerful queries. This document explains functions available ' . 'for the selected control.' . "\n\n" . 'For general help with search, see the [[ %s | Search User Guide ]] in ' . 'the documentation.' . "\n\n" . 'Note that different controls support //different// functions ' . '(depending on what the control is doing), so these specific functions ' . 'may not work everywhere. You can always check the help for a control ' . 'to review which functions are available for that control.', PhabricatorEnv::getDoclink('Search User Guide'));
$table = array();
$table_header = array(pht('Function'), pht('Token Name'), pht('Summary'));
$table[] = '| ' . implode(' | ', $table_header) . ' |';
$table[] = '|---|---|---|';
foreach ($functions as $function => $spec) {
$spec = $spec + array('summary' => null, 'arguments' => null);
if (idx($spec, 'arguments')) {
$signature = '**' . $function . '(**//' . $spec['arguments'] . '//**)**';
} else {
$signature = '**' . $function . '()**';
}
$name = idx($spec, 'name', '');
$summary = idx($spec, 'summary', '');
$table[] = '| ' . $signature . ' | ' . $name . ' | ' . $summary . ' |';
}
$table = implode("\n", $table);
$content[] = '= ' . pht('Function Quick Reference');
$content[] = pht('This table briefly describes available functions for this control. ' . 'For details on a particular function, see the corresponding section ' . 'below.');
$content[] = $table;
$content[] = '= ' . pht('Using Typeahead Functions');
$content[] = pht("In addition to typing user and project names to build queries, you can " . "also type the names of special functions which give you more options " . "and the ability to express more complex queries.\n\n" . "Functions have an internal name (like `%s`) and a human-readable name, " . "like `Current Viewer`. In general, you can type either one to select " . "the function. You can also click the {nav icon=search} button on any " . "typeahead control to browse available functions and find this " . "documentation.\n\n" . "This documentation uses the internal names to make it clear where " . "tokens begin and end. Specifically, you will find queries written " . "out like this in the documentation:\n\n%s\n\n" . "When this query is actually shown in the control, it will look more " . "like this:\n\n%s", 'viewer()', '> viewer(), alincoln', '> {nav Current Viewer} {nav alincoln (Abraham Lincoln)}');
$middot = "·";
foreach ($functions as $function => $spec) {
$arguments = idx($spec, 'arguments', '');
$name = idx($spec, 'name');
$content[] = '= ' . $function . '(' . $arguments . ') ' . $middot . ' ' . $name;
$content[] = $spec['description'];
}
$content = implode("\n\n", $content);
$content_box = new PHUIRemarkupView($viewer, $content);
$header = id(new PHUIHeaderView())->setHeader($title);
$document = id(new PHUIDocumentViewPro())->setHeader($header)->appendChild($content_box);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Function Help'));
$crumbs->setBorder(true);
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($document);
}
示例5: handleRequest
public function handleRequest(AphrontRequest $request)
{
$admin = $request->getUser();
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession($admin, $request, $this->getApplicationURI());
$v_type = 'standard';
if ($request->isFormPost()) {
$v_type = $request->getStr('type');
if ($v_type == 'standard' || $v_type == 'bot' || $v_type == 'list') {
return id(new AphrontRedirectResponse())->setURI($this->getApplicationURI('new/' . $v_type . '/'));
}
}
$title = pht('Create New User');
$standard_caption = pht('Create a standard user account. These users can log in to Phabricator, ' . 'use the web interface and API, and receive email.');
$standard_admin = pht('Administrators are limited in their ability to access or edit these ' . 'accounts after account creation.');
$bot_caption = pht('Create a bot/script user account, to automate interactions with other ' . 'systems. These users can not use the web interface, but can use the ' . 'API.');
$bot_admin = pht('Administrators have greater access to edit these accounts.');
$types = array();
$can_create = $this->hasApplicationCapability(PeopleCreateUsersCapability::CAPABILITY);
if ($can_create) {
$types[] = array('type' => 'standard', 'name' => pht('Create Standard User'), 'help' => pht('Create a standard user account.'));
}
$types[] = array('type' => 'bot', 'name' => pht('Create Bot User'), 'help' => pht('Create a new user for use with automated scripts.'));
$types[] = array('type' => 'list', 'name' => pht('Create Mailing List User'), 'help' => pht('Create a mailing list user to represent an existing, external ' . 'mailing list like a Google Group or a Mailman list.'));
$buttons = id(new AphrontFormRadioButtonControl())->setLabel(pht('Account Type'))->setName('type')->setValue($v_type);
foreach ($types as $type) {
$buttons->addButton($type['type'], $type['name'], $type['help']);
}
$form = id(new AphrontFormView())->setUser($admin)->appendRemarkupInstructions(pht('Choose the type of user account to create. For a detailed ' . 'explanation of user account types, see [[ %s | User Guide: ' . 'Account Roles ]].', PhabricatorEnv::getDoclink('User Guide: Account Roles')))->appendChild($buttons)->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($this->getApplicationURI())->setValue(pht('Continue')));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title);
$box = id(new PHUIObjectBoxView())->setHeaderText($title)->appendChild($form);
return $this->buildApplicationPage(array($crumbs, $box), array('title' => $title));
}
示例6: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$query = id(new PhabricatorNotificationQuery())->setViewer($user)->withUserPHIDs(array($user->getPHID()))->setLimit(15);
$stories = $query->execute();
$clear_ui_class = 'phabricator-notification-clear-all';
$clear_uri = id(new PhutilURI('/notification/clear/'));
if ($stories) {
$builder = new PhabricatorNotificationBuilder($stories);
$notifications_view = $builder->buildView();
$content = $notifications_view->render();
$clear_uri->setQueryParam('chronoKey', head($stories)->getChronologicalKey());
} else {
$content = phutil_tag_div('phabricator-notification no-notifications', pht('You have no notifications.'));
$clear_ui_class .= ' disabled';
}
$clear_ui = javelin_tag('a', array('sigil' => 'workflow', 'href' => (string) $clear_uri, 'class' => $clear_ui_class), pht('Mark All Read'));
$notifications_link = phutil_tag('a', array('href' => '/notification/'), pht('Notifications'));
if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
$connection_status = new PhabricatorNotificationStatusView();
} else {
$connection_status = phutil_tag('a', array('href' => PhabricatorEnv::getDoclink('Notifications User Guide: Setup and Configuration')), pht('Notification Server not enabled.'));
}
$connection_ui = phutil_tag('div', array('class' => 'phabricator-notification-footer'), $connection_status);
$header = phutil_tag('div', array('class' => 'phabricator-notification-header'), array($notifications_link, $clear_ui));
$content = hsprintf('%s%s%s', $header, $content, $connection_ui);
$unread_count = id(new PhabricatorFeedStoryNotification())->countUnread($user);
$json = array('content' => $content, 'number' => (int) $unread_count);
return id(new AphrontAjaxResponse())->setContent($json);
}
示例7: handleHosting
public function handleHosting(PhabricatorRepository $repository)
{
$request = $this->getRequest();
$user = $request->getUser();
$v_hosting = $repository->isHosted();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$next_uri = $this->getRepositoryControllerURI($repository, 'edit/serve/');
if ($request->isFormPost()) {
$v_hosting = $request->getBool('hosting');
$xactions = array();
$template = id(new PhabricatorRepositoryTransaction());
$type_hosting = PhabricatorRepositoryTransaction::TYPE_HOSTING;
$xactions[] = id(clone $template)->setTransactionType($type_hosting)->setNewValue($v_hosting);
id(new PhabricatorRepositoryEditor())->setContinueOnNoEffect(true)->setContentSourceFromRequest($request)->setActor($user)->applyTransactions($repository, $xactions);
return id(new AphrontRedirectResponse())->setURI($next_uri);
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Edit Hosting'));
$title = pht('Edit Hosting (%s)', $repository->getName());
$hosted_control = id(new AphrontFormRadioButtonControl())->setName('hosting')->setLabel(pht('Hosting'))->addButton(true, pht('Host Repository on Phabricator'), pht('Phabricator will host this repository. Users will be able to ' . 'push commits to Phabricator. Phabricator will not pull ' . 'changes from elsewhere.'))->addButton(false, pht('Host Repository Elsewhere'), pht('Phabricator will pull updates to this repository from a master ' . 'repository elsewhere (for example, on GitHub or Bitbucket). ' . 'Users will not be able to push commits to this repository.'))->setValue($v_hosting);
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Hosting');
$form = id(new AphrontFormView())->setUser($user)->appendRemarkupInstructions(pht('Phabricator can host repositories, or it can track repositories ' . 'hosted elsewhere (like on GitHub or Bitbucket). For information ' . 'on configuring hosting, see [[ %s | Diffusion User Guide: ' . 'Repository Hosting]]', $doc_href))->appendChild($hosted_control)->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save and Continue'))->addCancelButton($edit_uri));
$object_box = id(new PHUIObjectBoxView())->setHeaderText($title)->setForm($form);
return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title));
}
示例8: buildStandardPageResponse
public function buildStandardPageResponse($view, array $data)
{
$page = $this->buildStandardPageView();
$page->setApplicationName('Herald');
$page->setBaseURI('/herald/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("☿");
$doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/herald/'))->addLabel('Rules')->addFilter('new', 'Create Rule');
$rules_map = HeraldContentTypeConfig::getContentTypeMap();
$first_filter = null;
foreach ($rules_map as $key => $value) {
$nav->addFilter('view/' . $key, $value);
if (!$first_filter) {
$first_filter = 'view/' . $key;
}
}
$nav->addSpacer()->addLabel('Utilities')->addFilter('test', 'Test Console')->addFilter('transcript', 'Transcripts');
$user = $this->getRequest()->getUser();
if ($user->getIsAdmin()) {
$nav->addSpacer()->addLabel('Admin');
$view_PHID = nonempty($this->getRequest()->getStr('phid'), null);
foreach ($rules_map as $key => $value) {
$nav->addFilter('all/view/' . $key, $value);
}
}
$nav->selectFilter($this->getFilter(), $first_filter);
$nav->appendChild($view);
$page->appendChild($nav);
$tabs = array('help' => array('href' => $doclink, 'name' => 'Help'));
$page->setTabs($tabs, null);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
示例9: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$this->requireApplicationCapability(DiffusionCreateRepositoriesCapability::CAPABILITY);
if ($request->isFormPost()) {
if ($request->getStr('type')) {
switch ($request->getStr('type')) {
case 'create':
$uri = $this->getApplicationURI('create/');
break;
case 'import':
default:
$uri = $this->getApplicationURI('import/');
break;
}
return id(new AphrontRedirectResponse())->setURI($uri);
}
}
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Repository Hosting');
$doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Diffusion User Guide: Repository Hosting'));
$form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormRadioButtonControl())->setName('type')->addButton('create', pht('Create a New Hosted Repository'), array(pht('Create a new, empty repository which Phabricator will host. ' . 'For instructions on configuring repository hosting, see %s.', $doc_link)))->addButton('import', pht('Import an Existing External Repository'), pht("Import a repository hosted somewhere else, like GitHub, " . "Bitbucket, or your organization's existing servers. " . "Phabricator will read changes from the repository but will " . "not host or manage it. The authoritative master version of " . "the repository will stay where it is now.")))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Continue'))->addCancelButton($this->getApplicationURI()));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('New Repository'));
$form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('Create or Import Repository'))->setForm($form);
return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => pht('New Repository')));
}
示例10: buildResponse
private function buildResponse($title, $body)
{
$nav = $this->buildSideNavView();
$nav->selectFilter('database/');
if (!$title) {
$title = pht('Database Status');
}
$crumbs = $this->buildApplicationCrumbs();
$crumbs->setBorder(true);
if ($this->database) {
$crumbs->addTextCrumb(pht('Database Status'), $this->getApplicationURI('database/'));
if ($this->table) {
$crumbs->addTextCrumb($this->database, $this->getApplicationURI('database/' . $this->database . '/'));
if ($this->column || $this->key) {
$crumbs->addTextCrumb($this->table, $this->getApplicationURI('database/' . $this->database . '/' . $this->table . '/'));
if ($this->column) {
$crumbs->addTextCrumb($this->column);
} else {
$crumbs->addTextCrumb($this->key);
}
} else {
$crumbs->addTextCrumb($this->table);
}
} else {
$crumbs->addTextCrumb($this->database);
}
} else {
$crumbs->addTextCrumb(pht('Database Status'));
}
$doc_link = PhabricatorEnv::getDoclink('Managing Storage Adjustments');
$header = id(new PHUIHeaderView())->setHeader($title)->setProfileHeader(true)->addActionLink(id(new PHUIButtonView())->setTag('a')->setIcon('fa-book')->setHref($doc_link)->setText(pht('Learn More')));
$content = id(new PhabricatorConfigPageView())->setHeader($header)->setContent($body);
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->setNavigation($nav)->appendChild($content)->addClass('white-background');
}
示例11: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$user = $request->getUser();
$drequest = $this->getDiffusionRequest();
$callsign = $drequest->getRepository()->getCallsign();
$repository = $drequest->getRepository();
$commit = $drequest->loadCommit();
$data = $commit->loadCommitData();
$page_title = pht('Edit Diffusion Commit');
if (!$commit) {
return new Aphront404Response();
}
$commit_phid = $commit->getPHID();
$edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
$current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit_phid, $edge_type);
if ($request->isFormPost()) {
$xactions = array();
$proj_phids = $request->getArr('projects');
$xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $edge_type)->setNewValue(array('=' => array_fuse($proj_phids)));
$editor = id(new PhabricatorAuditEditor())->setActor($user)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request);
$xactions = $editor->applyTransactions($commit, $xactions);
return id(new AphrontRedirectResponse())->setURI('/r' . $callsign . $commit->getCommitIdentifier());
}
$tokenizer_id = celerity_generate_unique_node_id();
$form = id(new AphrontFormView())->setUser($user)->setAction($request->getRequestURI()->getPath())->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($current_proj_phids)->setID($tokenizer_id)->setCaption(javelin_tag('a', array('href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create'), pht('Create New Project')))->setDatasource(new PhabricatorProjectDatasource()));
$reason = $data->getCommitDetail('autocloseReason', false);
$reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED;
if ($reason !== false) {
switch ($reason) {
case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
$desc = pht('No, Repository Importing');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
$desc = pht('No, Autoclose Disabled');
break;
case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH:
$desc = pht('No, Not On Autoclose Branch');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED:
$desc = pht('Yes, Forced Via bin/repository CLI Tool.');
break;
case null:
$desc = pht('Yes');
break;
default:
$desc = pht('Unknown');
break;
}
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
$doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Learn More'));
$form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Autoclose?'))->setValue(array($desc, " · ", $doc_link)));
}
Javelin::initBehavior('project-create', array('tokenizerID' => $tokenizer_id));
$submit = id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton('/r' . $callsign . $commit->getCommitIdentifier());
$form->appendChild($submit);
$crumbs = $this->buildCrumbs(array('commit' => true));
$crumbs->addTextCrumb(pht('Edit'));
$form_box = id(new PHUIObjectBoxView())->setHeaderText($page_title)->setForm($form);
return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $page_title));
}
示例12: getOptions
public function getOptions()
{
$doc_href = PhabricatorEnv::getDoclink('Configuring a File Domain');
$doc_name = pht('Configuration Guide: Configuring a File Domain');
// This is all of the IANA special/reserved blocks in IPv4 space.
$default_address_blacklist = array('0.0.0.0/8', '10.0.0.0/8', '100.64.0.0/10', '127.0.0.0/8', '169.254.0.0/16', '172.16.0.0/12', '192.0.0.0/24', '192.0.2.0/24', '192.88.99.0/24', '192.168.0.0/16', '198.18.0.0/15', '198.51.100.0/24', '203.0.113.0/24', '224.0.0.0/4', '240.0.0.0/4', '255.255.255.255/32');
return array($this->newOption('security.alternate-file-domain', 'string', null)->setLocked(true)->setSummary(pht('Alternate domain to serve files from.'))->setDescription(pht('By default, Phabricator serves files from the same domain ' . 'the application is served from. This is convenient, but ' . 'presents a security risk.' . "\n\n" . 'You should configure a CDN or alternate file domain to mitigate ' . 'this risk. Configuring a CDN will also improve performance. See ' . '[[ %s | %s ]] for instructions.', $doc_href, $doc_name))->addExample('https://files.phabcdn.net/', pht('Valid Setting')), $this->newOption('security.hmac-key', 'string', '[D\\t~Y7eNmnQGJ;rnH6aF;m2!vJ8@v8C=Cs:aQS\\.Qw')->setHidden(true)->setSummary(pht('Key for HMAC digests.'))->setDescription(pht('Default key for HMAC digests where the key is not important ' . '(i.e., the hash itself is secret). You can change this if you ' . 'want (to any other string), but doing so will break existing ' . 'sessions and CSRF tokens.')), $this->newOption('security.require-https', 'bool', false)->setLocked(true)->setSummary(pht('Force users to connect via HTTPS instead of HTTP.'))->setDescription(pht("If the web server responds to both HTTP and HTTPS requests but " . "you want users to connect with only HTTPS, you can set this " . "to true to make Phabricator redirect HTTP requests to HTTPS.\n\n" . "Normally, you should just configure your server not to accept " . "HTTP traffic, but this setting may be useful if you originally " . "used HTTP and have now switched to HTTPS but don't want to " . "break old links, or if your webserver sits behind a load " . "balancer which terminates HTTPS connections and you can not " . "reasonably configure more granular behavior there.\n\n" . "IMPORTANT: Phabricator determines if a request is HTTPS or not " . "by examining the PHP `%s` variable. If you run " . "Apache/mod_php this will probably be set correctly for you " . "automatically, but if you run Phabricator as CGI/FCGI (e.g., " . "through nginx or lighttpd), you need to configure your web " . "server so that it passes the value correctly based on the " . "connection type.", "\$_SERVER['HTTPS']"))->setBoolOptions(array(pht('Force HTTPS'), pht('Allow HTTP'))), $this->newOption('security.require-multi-factor-auth', 'bool', false)->setLocked(true)->setSummary(pht('Require all users to configure multi-factor authentication.'))->setDescription(pht('By default, Phabricator allows users to add multi-factor ' . 'authentication to their accounts, but does not require it. ' . 'By enabling this option, you can force all users to add ' . 'at least one authentication factor before they can use their ' . 'accounts.'))->setBoolOptions(array(pht('Multi-Factor Required'), pht('Multi-Factor Optional'))), $this->newOption('phabricator.csrf-key', 'string', '0b7ec0592e0a2829d8b71df2fa269b2c6172eca3')->setHidden(true)->setSummary(pht('Hashed with other inputs to generate CSRF tokens.'))->setDescription(pht('This is hashed with other inputs to generate CSRF tokens. If ' . 'you want, you can change it to some other string which is ' . 'unique to your install. This will make your install more secure ' . 'in a vague, mostly theoretical way. But it will take you like 3 ' . 'seconds of mashing on your keyboard to set it up so you might ' . 'as well.')), $this->newOption('phabricator.mail-key', 'string', '5ce3e7e8787f6e40dfae861da315a5cdf1018f12')->setHidden(true)->setSummary(pht('Hashed with other inputs to generate mail tokens.'))->setDescription(pht("This is hashed with other inputs to generate mail tokens. If " . "you want, you can change it to some other string which is " . "unique to your install. In particular, you will want to do " . "this if you accidentally send a bunch of mail somewhere you " . "shouldn't have, to invalidate all old reply-to addresses.")), $this->newOption('uri.allowed-protocols', 'set', array('http' => true, 'https' => true, 'mailto' => true))->setSummary(pht('Determines which URI protocols are auto-linked.'))->setDescription(pht("When users write comments which have URIs, they'll be " . "automatically linked if the protocol appears in this set. This " . "whitelist is primarily to prevent security issues like " . "%s URIs.", 'javascript://'))->addExample("http\nhttps", pht('Valid Setting'))->setLocked(true), $this->newOption('uri.allowed-editor-protocols', 'set', array('http' => true, 'https' => true, 'txmt' => true, 'mvim' => true, 'vim' => true, 'subl' => true, 'emacs' => true, 'editor' => true))->setSummary(pht('Whitelists editor protocols for "Open in Editor".'))->setDescription(pht('Users can configure a URI pattern to open files in a text ' . 'editor. The URI must use a protocol on this whitelist.'))->setLocked(true), $this->newOption('celerity.resource-hash', 'string', 'd9455ea150622ee044f7931dabfa52aa')->setSummary(pht('An input to the hash function when building resource hashes.'))->setDescription(pht('This value is an input to the hash function when building ' . 'resource hashes. It has no security value, but if you ' . 'accidentally poison user caches (by pushing a bad patch or ' . 'having something go wrong with a CDN, e.g.) you can change this ' . 'to something else and rebuild the Celerity map to break user ' . 'caches. Unless you are doing Celerity development, it is ' . 'exceptionally unlikely that you need to modify this.')), $this->newOption('remarkup.enable-embedded-youtube', 'bool', false)->setBoolOptions(array(pht('Embed YouTube videos'), pht("Don't embed YouTube videos")))->setSummary(pht('Determines whether or not YouTube videos get embedded.'))->setDescription(pht("If you enable this, linked YouTube videos will be embedded " . "inline. This has mild security implications (you'll leak " . "referrers to YouTube) and is pretty silly (but sort of " . "awesome).")), $this->newOption('security.outbound-blacklist', 'list<string>', $default_address_blacklist)->setLocked(true)->setSummary(pht('Blacklist subnets to prevent user-initiated outbound ' . 'requests.'))->setDescription(pht('Phabricator users can make requests to other services from ' . 'the Phabricator host in some circumstances (for example, by ' . 'creating a repository with a remote URL or having Phabricator ' . 'fetch an image from a remote server).' . "\n\n" . 'This may represent a security vulnerability if services on ' . 'the same subnet will accept commands or reveal private ' . 'information over unauthenticated HTTP GET, based on the source ' . 'IP address. In particular, all hosts in EC2 have access to ' . 'such a service.' . "\n\n" . 'This option defines a list of netblocks which Phabricator ' . 'will decline to connect to. Generally, you should list all ' . 'private IP space here.'))->addExample(array('0.0.0.0/0'), pht('No Outbound Requests')), $this->newOption('security.strict-transport-security', 'bool', false)->setLocked(true)->setBoolOptions(array(pht('Use HSTS'), pht('Do Not Use HSTS')))->setSummary(pht('Enable HTTP Strict Transport Security (HSTS).'))->setDescription(pht('HTTP Strict Transport Security (HSTS) sends a header which ' . 'instructs browsers that the site should only be accessed ' . 'over HTTPS, never HTTP. This defuses an attack where an ' . 'adversary gains access to your network, then proxies requests ' . 'through an unsecured link.' . "\n\n" . 'Do not enable this option if you serve (or plan to ever serve) ' . 'unsecured content over plain HTTP. It is very difficult to ' . 'undo this change once users\' browsers have accepted the ' . 'setting.')));
}
示例13: buildApplicationCrumbs
protected function buildApplicationCrumbs()
{
$crumbs = parent::buildApplicationCrumbs();
$doc_name = 'Calendar User Guide: Exporting Events';
$doc_href = PhabricatorEnv::getDoclink($doc_name);
$crumbs->addAction(id(new PHUIListItemView())->setName(pht('Guide: Exporting Events'))->setIcon('fa-book')->setHref($doc_href));
return $crumbs;
}
示例14: render
public function render()
{
$drequest = $this->getDiffusionRequest();
$current_branch = $drequest->getBranch();
$repository = $drequest->getRepository();
Javelin::initBehavior('phabricator-tooltips');
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
$rows = array();
$rowc = array();
foreach ($this->branches as $branch) {
$commit = idx($this->commits, $branch->getCommitIdentifier());
if ($commit) {
$details = $commit->getSummary();
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
} else {
$datetime = null;
$details = null;
}
switch ($repository->shouldSkipAutocloseBranch($branch->getShortName())) {
case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING:
$icon = 'fa-times bluegrey';
$tip = pht('Repository Importing');
break;
case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED:
$icon = 'fa-times bluegrey';
$tip = pht('Repository Autoclose Disabled');
break;
case PhabricatorRepository::BECAUSE_BRANCH_UNTRACKED:
$icon = 'fa-times bluegrey';
$tip = pht('Branch Untracked');
break;
case PhabricatorRepository::BECAUSE_BRANCH_NOT_AUTOCLOSE:
$icon = 'fa-times bluegrey';
$tip = pht('Branch Autoclose Disabled');
break;
case null:
$icon = 'fa-check bluegrey';
$tip = pht('Autoclose Enabled');
break;
default:
$icon = 'fa-question';
$tip = pht('Status Unknown');
break;
}
$status_icon = id(new PHUIIconView())->setIconFont($icon)->addSigil('has-tooltip')->setHref($doc_href)->setMetadata(array('tip' => $tip, 'size' => 200));
$rows[] = array(phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'history', 'branch' => $branch->getShortName()))), pht('History')), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'branch' => $branch->getShortName()))), $branch->getShortName()), self::linkCommit($drequest->getRepository(), $branch->getCommitIdentifier()), $status_icon, $datetime, AphrontTableView::renderSingleDisplayLine($details));
if ($branch->getShortName() == $current_branch) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
}
$view = new AphrontTableView($rows);
$view->setHeaders(array(pht('History'), pht('Branch'), pht('Head'), pht(''), pht('Modified'), pht('Details')));
$view->setColumnClasses(array('', 'pri', '', '', '', 'wide'));
$view->setRowClasses($rowc);
return $view->render();
}
示例15: buildClusterNotificationStatus
private function buildClusterNotificationStatus()
{
$viewer = $this->getViewer();
$servers = PhabricatorNotificationServerRef::newRefs();
Javelin::initBehavior('phabricator-tooltips');
$rows = array();
foreach ($servers as $server) {
if ($server->isAdminServer()) {
$type_icon = 'fa-database sky';
$type_tip = pht('Admin Server');
} else {
$type_icon = 'fa-bell sky';
$type_tip = pht('Client Server');
}
$type_icon = id(new PHUIIconView())->setIcon($type_icon)->addSigil('has-tooltip')->setMetadata(array('tip' => $type_tip));
$messages = array();
$details = array();
if ($server->isAdminServer()) {
try {
$details = $server->loadServerStatus();
$status_icon = 'fa-exchange green';
$status_label = pht('Version %s', idx($details, 'version'));
} catch (Exception $ex) {
$status_icon = 'fa-times red';
$status_label = pht('Connection Error');
$messages[] = $ex->getMessage();
}
} else {
try {
$server->testClient();
$status_icon = 'fa-exchange green';
$status_label = pht('Connected');
} catch (Exception $ex) {
$status_icon = 'fa-times red';
$status_label = pht('Connection Error');
$messages[] = $ex->getMessage();
}
}
if ($details) {
$uptime = idx($details, 'uptime');
$uptime = $uptime / 1000;
$uptime = phutil_format_relative_time_detailed($uptime);
$clients = pht('%s Active / %s Total', new PhutilNumber(idx($details, 'clients.active')), new PhutilNumber(idx($details, 'clients.total')));
$stats = pht('%s In / %s Out', new PhutilNumber(idx($details, 'messages.in')), new PhutilNumber(idx($details, 'messages.out')));
} else {
$uptime = null;
$clients = null;
$stats = null;
}
$status_view = array(id(new PHUIIconView())->setIcon($status_icon), ' ', $status_label);
$messages = phutil_implode_html(phutil_tag('br'), $messages);
$rows[] = array($type_icon, $server->getProtocol(), $server->getHost(), $server->getPort(), $status_view, $uptime, $clients, $stats, $messages);
}
$table = id(new AphrontTableView($rows))->setNoDataString(pht('No notification servers are configured.'))->setHeaders(array(null, pht('Proto'), pht('Host'), pht('Port'), pht('Status'), pht('Uptime'), pht('Clients'), pht('Messages'), null))->setColumnClasses(array(null, null, null, null, null, null, null, null, 'wide'));
$doc_href = PhabricatorEnv::getDoclink('Cluster: Notifications');
$header = id(new PHUIHeaderView())->setHeader(pht('Cluster Notification Status'))->addActionLink(id(new PHUIButtonView())->setIcon('fa-book')->setHref($doc_href)->setTag('a')->setText(pht('Documentation')));
return id(new PHUIObjectBoxView())->setHeader($header)->setTable($table);
}