Convert AphrontErrorView to safe HTML

Summary: Done by searching for `AphrontErrorView` and then `appendChild()`.

Test Plan:
Looked at Commit Detail.
Looked at Revision Detail.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4843
This commit is contained in:
vrana
2013-02-06 16:53:49 -08:00
parent 11bb8db970
commit 059920c2da
31 changed files with 152 additions and 141 deletions

View File

@@ -211,7 +211,7 @@ class AphrontDefaultApplicationConfiguration
if ($ex instanceof AphrontUsageException) { if ($ex instanceof AphrontUsageException) {
$error = new AphrontErrorView(); $error = new AphrontErrorView();
$error->setTitle(phutil_escape_html($ex->getTitle())); $error->setTitle(phutil_escape_html($ex->getTitle()));
$error->appendChild(phutil_escape_html($ex->getMessage())); $error->appendChild($ex->getMessage());
$view = new PhabricatorStandardPageView(); $view = new PhabricatorStandardPageView();
$view->setRequest($this->getRequest()); $view->setRequest($this->getRequest());

View File

@@ -49,10 +49,11 @@ class AphrontRedirectResponse extends AphrontResponse {
), ),
'Continue to: '.$this->getURI()); 'Continue to: '.$this->getURI());
$error->appendChild( $error->appendChild(hsprintf(
'<p>You were stopped here because <tt>debug.stop-on-redirect</tt> '. '<p>You were stopped here because <tt>debug.stop-on-redirect</tt> '.
'is set in your configuration.</p>'. 'is set in your configuration.</p>'.
'<p>'.$link.'</p>'); '<p>%s</p>',
$link));
$view->appendChild($error); $view->appendChild($error);

View File

@@ -31,9 +31,12 @@ final class PhabricatorMustVerifyEmailController
$sent = new AphrontErrorView(); $sent = new AphrontErrorView();
$sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$sent->setTitle(pht('Email Sent')); $sent->setTitle(pht('Email Sent'));
$sent->appendChild('<p>'. $sent->appendChild(phutil_tag(
pht('Another verification email was sent to <strong>%s</strong>.', 'p',
phutil_escape_html($email_address)).'</p>'); array(),
pht(
'Another verification email was sent to %s.',
phutil_tag('strong', array(), $email_address))));
} }
$error_view = new AphrontRequestFailureView(); $error_view = new AphrontRequestFailureView();

View File

@@ -35,20 +35,16 @@ final class PhabricatorConduitConsoleController
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
$status_view->setTitle('Deprecated Method'); $status_view->setTitle('Deprecated Method');
$status_view->appendChild( $status_view->appendChild(
phutil_escape_html( nonempty($reason, "This method is deprecated."));
nonempty(
$reason,
"This method is deprecated.")));
break; break;
case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
$status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING); $status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$status_view->setTitle('Unstable Method'); $status_view->setTitle('Unstable Method');
$status_view->appendChild( $status_view->appendChild(
phutil_escape_html(
nonempty( nonempty(
$reason, $reason,
"This method is new and unstable. Its interface is subject ". "This method is new and unstable. Its interface is subject ".
"to change."))); "to change."));
break; break;
} }
} }

View File

@@ -108,7 +108,7 @@ final class PhabricatorConfigEditController
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle(pht('Configuration Hidden')) ->setTitle(pht('Configuration Hidden'))
->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setSeverity(AphrontErrorView::SEVERITY_WARNING)
->appendChild('<p>'.phutil_escape_html($msg).'</p>'); ->appendChild(phutil_tag('p', array(), $msg));
} else if ($option->getLocked()) { } else if ($option->getLocked()) {
$msg = pht( $msg = pht(
"This configuration is locked and can not be edited from the web ". "This configuration is locked and can not be edited from the web ".
@@ -117,7 +117,7 @@ final class PhabricatorConfigEditController
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle(pht('Configuration Locked')) ->setTitle(pht('Configuration Locked'))
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->appendChild('<p>'.phutil_escape_html($msg).'</p>'); ->appendChild(phutil_tag('p', array(), $msg));
} }
if ($option->getHidden()) { if ($option->getHidden()) {

View File

@@ -23,8 +23,10 @@ final class PhabricatorWorkerTaskDetailController
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('No Such Task'); $error_view->setTitle('No Such Task');
$error_view->appendChild( $error_view->appendChild(phutil_tag(
'<p>This task may have recently been garbage collected.</p>'); 'p',
array(),
'This task may have recently been garbage collected.'));
$error_view->setSeverity(AphrontErrorView::SEVERITY_NODATA); $error_view->setSeverity(AphrontErrorView::SEVERITY_NODATA);
$content = $error_view; $content = $error_view;

View File

@@ -180,12 +180,12 @@ final class DifferentialRevisionViewController extends DifferentialController {
$warning = new AphrontErrorView(); $warning = new AphrontErrorView();
$warning->setTitle('Very Large Diff'); $warning->setTitle('Very Large Diff');
$warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$warning->appendChild( $warning->appendChild(hsprintf(
'%s <strong>%s</strong>',
pht( pht(
'This diff is very large and affects %s files. Load each file '. 'This diff is very large and affects %s files. Load each file '.
'individually.', 'individually.',
new PhutilNumber($count)). new PhutilNumber($count)),
" <strong>".
phutil_tag( phutil_tag(
'a', 'a',
array( array(
@@ -193,8 +193,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
->alter('large', 'true') ->alter('large', 'true')
->setFragment('toc'), ->setFragment('toc'),
), ),
pht('Show All Files Inline')). pht('Show All Files Inline'))));
"</strong>");
$warning = $warning->render(); $warning = $warning->render();
$my_inlines = id(new DifferentialInlineComment())->loadAllWhere( $my_inlines = id(new DifferentialInlineComment())->loadAllWhere(

View File

@@ -245,24 +245,24 @@ final class DifferentialLintFieldSpecification
if ($status == DifferentialLintStatus::LINT_SKIP) { if ($status == DifferentialLintStatus::LINT_SKIP) {
$content = $content =
"<p>This diff was created without running lint. Make sure you are ". "This diff was created without running lint. Make sure you are ".
"OK with that before you accept this diff.</p>"; "OK with that before you accept this diff.";
} else if ($status == DifferentialLintStatus::LINT_POSTPONED) { } else if ($status == DifferentialLintStatus::LINT_POSTPONED) {
$severity = AphrontErrorView::SEVERITY_WARNING; $severity = AphrontErrorView::SEVERITY_WARNING;
$content = $content =
"<p>Postponed linters didn't finish yet. Make sure you are OK with ". "Postponed linters didn't finish yet. Make sure you are OK with ".
"that before you accept this diff.</p>"; "that before you accept this diff.";
} else { } else {
$content = $content =
"<p>This diff has Lint Problems. Make sure you are OK with them ". "This diff has Lint Problems. Make sure you are OK with them ".
"before you accept this diff.</p>"; "before you accept this diff.";
} }
return id(new AphrontErrorView()) return id(new AphrontErrorView())
->setSeverity($severity) ->setSeverity($severity)
->appendChild($content) ->appendChild(phutil_tag('p', array(), $content))
->setTitle(idx($titles, $status, 'Warning')); ->setTitle(idx($titles, $status, 'Warning'));
} }

View File

@@ -200,21 +200,21 @@ final class DifferentialUnitFieldSpecification
); );
if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) { if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
$content = $content =
"<p>This diff has postponed unit tests. The results should be ". "This diff has postponed unit tests. The results should be ".
"coming in soon. You should probably wait for them before accepting ". "coming in soon. You should probably wait for them before accepting ".
"this diff.</p>"; "this diff.";
} else if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_SKIP) { } else if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_SKIP) {
$content = $content =
"<p>Unit tests were skipped when this diff was created. Make sure ". "Unit tests were skipped when this diff was created. Make sure ".
"you are OK with that before you accept this diff.</p>"; "you are OK with that before you accept this diff.";
} else { } else {
$content = $content =
"<p>This diff has Unit Test Problems. Make sure you are OK with ". "This diff has Unit Test Problems. Make sure you are OK with ".
"them before you accept this diff.</p>"; "them before you accept this diff.";
} }
$unit_warning = id(new AphrontErrorView()) $unit_warning = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_ERROR) ->setSeverity(AphrontErrorView::SEVERITY_ERROR)
->appendChild($content) ->appendChild(phutil_tag('p', array(), $content))
->setTitle(idx($titles, $diff->getUnitStatus(), 'Warning')); ->setTitle(idx($titles, $diff->getUnitStatus(), 'Warning'));
} }
return $unit_warning; return $unit_warning;

View File

@@ -46,21 +46,6 @@ final class DifferentialAddCommentView extends AphrontView {
return $this; return $this;
} }
private function generateWarningView(
$status,
array $titles,
$id,
$content) {
$warning = new AphrontErrorView();
$warning->setSeverity(AphrontErrorView::SEVERITY_ERROR);
$warning->setID($id);
$warning->appendChild($content);
$warning->setTitle(idx($titles, $status, 'Warning'));
return $warning;
}
public function render() { public function render() {
require_celerity_resource('differential-revision-add-comment-css'); require_celerity_resource('differential-revision-add-comment-css');

View File

@@ -96,9 +96,8 @@ final class DiffusionBrowseFileController extends DiffusionController {
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('File Renamed'); $notice->setTitle('File Renamed');
$notice->appendChild( $notice->appendChild(
"File history passes through a rename from '". "File history passes through a rename from '".$drequest->getPath().
phutil_escape_html($drequest->getPath())."' to '". "' to '".$renamed."'.");
phutil_escape_html($renamed)."'.");
$content[] = $notice; $content[] = $notice;
} }

View File

@@ -62,8 +62,8 @@ final class DiffusionCommitController extends DiffusionController {
$error_panel->appendChild( $error_panel->appendChild(
"This Diffusion repository is configured to track only one ". "This Diffusion repository is configured to track only one ".
"subdirectory of the entire Subversion repository, and this commit ". "subdirectory of the entire Subversion repository, and this commit ".
"didn't affect the tracked subdirectory ('". "didn't affect the tracked subdirectory ('".$subpath."'), so no ".
phutil_escape_html($subpath)."'), so no information is available."); "information is available.");
$content[] = $error_panel; $content[] = $error_panel;
$content[] = $top_anchor; $content[] = $top_anchor;
} else { } else {
@@ -162,8 +162,7 @@ final class DiffusionCommitController extends DiffusionController {
if ($bad_commit) { if ($bad_commit) {
$error_panel = new AphrontErrorView(); $error_panel = new AphrontErrorView();
$error_panel->setTitle('Bad Commit'); $error_panel->setTitle('Bad Commit');
$error_panel->appendChild( $error_panel->appendChild($bad_commit['description']);
phutil_escape_html($bad_commit['description']));
$content[] = $error_panel; $content[] = $error_panel;
} else if ($is_foreign) { } else if ($is_foreign) {
@@ -207,8 +206,10 @@ final class DiffusionCommitController extends DiffusionController {
$warning_view = id(new AphrontErrorView()) $warning_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setSeverity(AphrontErrorView::SEVERITY_WARNING)
->setTitle('Very Large Commit') ->setTitle('Very Large Commit')
->appendChild( ->appendChild(phutil_tag(
"<p>This commit is very large. Load each file individually.</p>"); 'p',
array(),
"This commit is very large. Load each file individually."));
$change_panel->appendChild($warning_view); $change_panel->appendChild($warning_view);
$change_panel->addButton($show_all_button); $change_panel->addButton($show_all_button);

View File

@@ -60,17 +60,19 @@ final class DiffusionExternalController extends DiffusionController {
if (empty($commits)) { if (empty($commits)) {
$desc = null; $desc = null;
if ($uri) { if ($uri) {
$desc = phutil_escape_html($uri).', at '; $desc = $uri.', at ';
} }
$desc .= phutil_escape_html($id); $desc .= $id;
$content = id(new AphrontErrorView()) $content = id(new AphrontErrorView())
->setTitle('Unknown External') ->setTitle('Unknown External')
->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setSeverity(AphrontErrorView::SEVERITY_WARNING)
->appendChild( ->appendChild(phutil_tag(
"<p>This external ({$desc}) does not appear in any tracked ". 'p',
array(),
"This external ({$desc}) does not appear in any tracked ".
"repository. It may exist in an untracked repository that ". "repository. It may exist in an untracked repository that ".
"Diffusion does not know about.</p>"); "Diffusion does not know about."));
} else if (count($commits) == 1) { } else if (count($commits) == 1) {
$commit = head($commits); $commit = head($commits);
$repo = $repositories[$commit->getRepositoryID()]; $repo = $repositories[$commit->getRepositoryID()];

View File

@@ -43,8 +43,6 @@ final class DiffusionEmptyResultView extends DiffusionView {
$deleted = $this->browseQuery->getDeletedAtCommit(); $deleted = $this->browseQuery->getDeletedAtCommit();
$existed = $this->browseQuery->getExistedAtCommit(); $existed = $this->browseQuery->getExistedAtCommit();
$deleted = self::linkCommit($drequest->getRepository(), $deleted);
$browse = $this->linkBrowse( $browse = $this->linkBrowse(
$drequest->getPath(), $drequest->getPath(),
array( array(
@@ -54,11 +52,14 @@ final class DiffusionEmptyResultView extends DiffusionView {
) )
); );
$existed = "r{$callsign}{$existed}";
$title = 'Path Was Deleted'; $title = 'Path Was Deleted';
$body = "This path does not exist at {$commit}. It was deleted in ". $body = hsprintf(
"{$deleted} and last {$browse} at {$existed}."; "This path does not exist at %s. It was deleted in %s and last %s ".
"at %s.",
$commit,
self::linkCommit($drequest->getRepository(), $deleted),
$browse,
"r{$callsign}{$existed}");
$severity = AphrontErrorView::SEVERITY_WARNING; $severity = AphrontErrorView::SEVERITY_WARNING;
break; break;
case DiffusionBrowseQuery::REASON_IS_UNTRACKED_PARENT: case DiffusionBrowseQuery::REASON_IS_UNTRACKED_PARENT:
@@ -66,7 +67,7 @@ final class DiffusionEmptyResultView extends DiffusionView {
$title = 'Directory Not Tracked'; $title = 'Directory Not Tracked';
$body = $body =
"This repository is configured to track only one subdirectory ". "This repository is configured to track only one subdirectory ".
"of the entire repository ('".phutil_escape_html($subdir)."'), ". "of the entire repository ('{$subdir}'), ".
"but you aren't looking at something in that subdirectory, so no ". "but you aren't looking at something in that subdirectory, so no ".
"information is available."; "information is available.";
$severity = AphrontErrorView::SEVERITY_WARNING; $severity = AphrontErrorView::SEVERITY_WARNING;
@@ -78,7 +79,7 @@ final class DiffusionEmptyResultView extends DiffusionView {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setSeverity($severity); $error_view->setSeverity($severity);
$error_view->setTitle($title); $error_view->setTitle($title);
$error_view->appendChild('<p>'.$body.'</p>'); $error_view->appendChild(phutil_tag('p', array(), $body));
return $error_view->render(); return $error_view->render();
} }

View File

@@ -94,9 +94,10 @@ final class PhabricatorFactHomeController extends PhabricatorFactController {
return id(new AphrontErrorView()) return id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle(pht('No Chartable Facts')) ->setTitle(pht('No Chartable Facts'))
->appendChild( ->appendChild(phutil_tag(
'<p>'.pht( 'p',
'There are no facts that can be plotted yet.').'</p>'); array(),
pht('There are no facts that can be plotted yet.')));
} }
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())

View File

@@ -35,8 +35,10 @@ final class HeraldTranscriptController extends HeraldController {
$notice = id(new AphrontErrorView()) $notice = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle('Old Transcript') ->setTitle('Old Transcript')
->appendChild( ->appendChild(phutil_tag(
'<p>Details of this transcript have been garbage collected.</p>'); 'p',
array(),
'Details of this transcript have been garbage collected.'));
$nav->appendChild($notice); $nav->appendChild($notice);
} else { } else {
$filter = $this->getFilterPHIDs(); $filter = $this->getFilterPHIDs();

View File

@@ -67,12 +67,16 @@ final class PhabricatorMetaMTASendController
$warning = new AphrontErrorView(); $warning = new AphrontErrorView();
$warning->setTitle('Email is Disabled'); $warning->setTitle('Email is Disabled');
$warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$warning->appendChild( $warning->appendChild(phutil_tag(
'<p>'.pht('This installation of Phabricator is currently set to use '. 'p',
'<tt>PhabricatorMailImplementationTestAdapter</tt> to deliver '. array(),
'outbound email. This completely disables outbound email! All '. pht(
'outbound email will be thrown in a deep, dark hole until you '. 'This installation of Phabricator is currently set to use %s to '.
'configure a real adapter.').'</p>'); 'deliver outbound email. This completely disables outbound email! '.
'All outbound email will be thrown in a deep, dark hole until you '.
'configure a real adapter.',
phutil_tag('tt', array(), 'PhabricatorMailImplementationTestAdapter'))
));
} }
$phdlink_href = PhabricatorEnv::getDoclink( $phdlink_href = PhabricatorEnv::getDoclink(

View File

@@ -24,13 +24,14 @@ final class PhabricatorNotificationStatusController
} catch (Exception $ex) { } catch (Exception $ex) {
$status = new AphrontErrorView(); $status = new AphrontErrorView();
$status->setTitle("Notification Server Issue"); $status->setTitle("Notification Server Issue");
$status->appendChild( $status->appendChild(hsprintf(
'Unable to determine server status. This probably means the server '. 'Unable to determine server status. This probably means the server '.
'is not in great shape. The specific issue encountered was:'. 'is not in great shape. The specific issue encountered was:'.
'<br />'. '<br />'.
'<br />'. '<br />'.
'<strong>'.phutil_escape_html(get_class($ex)).'</strong> '. '<strong>%s</strong> %s',
nl2br(phutil_escape_html($ex->getMessage()))); get_class($ex),
phutil_escape_html_newlines($ex->getMessage())));
} }
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(

View File

@@ -30,7 +30,9 @@ final class PhabricatorEmailVerificationController
'href' => '/', 'href' => '/',
), ),
'Continue to Phabricator'); 'Continue to Phabricator');
$home_link = '<br /><p><strong>'.$home_link.'</strong></p>'; $home_link = hsprintf(
'<br /><p><strong>%s</strong></p>',
$home_link);
$settings_link = phutil_tag( $settings_link = phutil_tag(
'a', 'a',
@@ -38,23 +40,26 @@ final class PhabricatorEmailVerificationController
'href' => '/settings/panel/email/', 'href' => '/settings/panel/email/',
), ),
'Return to Email Settings'); 'Return to Email Settings');
$settings_link = '<br /><p><strong>'.$settings_link.'</strong></p>'; $settings_link = hsprintf(
'<br /><p><strong>%s</strong></p>',
$settings_link);
if (!$email) { if (!$email) {
$content = id(new AphrontErrorView()) $content = id(new AphrontErrorView())
->setTitle('Unable To Verify') ->setTitle('Unable To Verify')
->appendChild( ->appendChild(phutil_tag(
'<p>The verification code is incorrect, the email address has '. 'p',
'been removed, or the email address is owned by another user. Make '. array(),
'sure you followed the link in the email correctly.</p>'); 'The verification code is incorrect, the email address has been '.
'removed, or the email address is owned by another user. Make '.
'sure you followed the link in the email correctly.'));
} else if ($email->getIsVerified()) { } else if ($email->getIsVerified()) {
$content = id(new AphrontErrorView()) $content = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle('Address Already Verified') ->setTitle('Address Already Verified')
->appendChild( ->appendChild(hsprintf(
'<p>This email address has already been verified.</p>'. '<p>This email address has already been verified.</p>%s',
$settings_link); $settings_link));
} else { } else {
$guard = AphrontWriteGuard::beginScopedUnguardedWrites(); $guard = AphrontWriteGuard::beginScopedUnguardedWrites();
@@ -65,10 +70,10 @@ final class PhabricatorEmailVerificationController
$content = id(new AphrontErrorView()) $content = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle('Address Verified') ->setTitle('Address Verified')
->appendChild( ->appendChild(hsprintf(
'<p>This email address has now been verified. Thanks!</p>'. '<p>This email address has now been verified. Thanks!</p>%s%s',
$home_link. $home_link,
$settings_link); $settings_link));
} }
return $this->buildApplicationPage( return $this->buildApplicationPage(

View File

@@ -54,7 +54,8 @@ final class PhabricatorPeopleEditController
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle('Changes Saved');
$notice->appendChild('<p>Your changes were saved.</p>'); $notice->appendChild(
phutil_tag('p', array(), 'Your changes were saved.'));
$content[] = $notice; $content[] = $notice;
} }
@@ -578,10 +579,10 @@ final class PhabricatorPeopleEditController
if ($user->getPHID() == $admin->getPHID()) { if ($user->getPHID() == $admin->getPHID()) {
$error = new AphrontErrorView(); $error = new AphrontErrorView();
$error->setTitle('You Shall Journey No Farther'); $error->setTitle('You Shall Journey No Farther');
$error->appendChild( $error->appendChild(hsprintf(
'<p>As you stare into the gaping maw of the abyss, something holds '. '<p>As you stare into the gaping maw of the abyss, something holds '.
'you back.</p>'. 'you back.</p>'.
'<p>You can not delete your own account.</p>'); '<p>You can not delete your own account.</p>'));
return $error; return $error;
} }

View File

@@ -183,8 +183,9 @@ final class PhrictionEditController
$draft_note = new AphrontErrorView(); $draft_note = new AphrontErrorView();
$draft_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $draft_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$draft_note->setTitle('Recovered Draft'); $draft_note->setTitle('Recovered Draft');
$draft_note->appendChild( $draft_note->appendChild(hsprintf(
'<p>Showing a saved draft of your edits, you can '.$discard.'.</p>'); '<p>Showing a saved draft of your edits, you can %s.</p>',
$discard));
} else { } else {
$content_text = $content->getContent(); $content_text = $content->getContent();
$draft_note = null; $draft_note = null;

View File

@@ -41,10 +41,10 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
), ),
'Diffusion User Guide'); 'Diffusion User Guide');
$common = $common = hsprintf(
"Without this daemon, Phabricator will not be able to import or update ". "Without this daemon, Phabricator will not be able to import or update ".
"repositories. For instructions on starting the daemon, see ". "repositories. For instructions on starting the daemon, see %s.",
"<strong>{$documentation}</strong>."; phutil_tag('strong', array(), $documentation));
try { try {
$daemon_running = $this->isPullDaemonRunning(); $daemon_running = $this->isPullDaemonRunning();
@@ -52,17 +52,17 @@ abstract class PhabricatorRepositoryController extends PhabricatorController {
return null; return null;
} }
$title = "Repository Daemon Not Running"; $title = "Repository Daemon Not Running";
$message = $message = hsprintf(
"<p>The repository daemon is not running on this machine. ". "<p>The repository daemon is not running on this machine. %s</p>",
"{$common}</p>"; $common);
} catch (Exception $ex) { } catch (Exception $ex) {
$title = "Unable To Verify Repository Daemon"; $title = "Unable To Verify Repository Daemon";
$message = $message = hsprintf(
"<p>Unable to determine if the repository daemon is running on this ". "<p>Unable to determine if the repository daemon is running on this ".
"machine. {$common}</p>". "machine. %s</p>".
"<p><strong>Exception:</strong> ". "<p><strong>Exception:</strong> %s</p>",
phutil_escape_html($ex->getMessage()). $common,
"</p>"; $ex->getMessage());
} }
$view = new AphrontErrorView(); $view = new AphrontErrorView();

View File

@@ -94,8 +94,7 @@ final class PhabricatorRepositoryEditController
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$error_view->setTitle('Changes Saved'); $error_view->setTitle('Changes Saved');
$error_view->appendChild( $error_view->appendChild('Repository changes were saved.');
'Repository changes were saved.');
} }
$encoding_doc_link = PhabricatorEnv::getDoclink( $encoding_doc_link = PhabricatorEnv::getDoclink(

View File

@@ -51,7 +51,8 @@ final class PhabricatorSettingsPanelAccount
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle('Changes Saved');
$notice->appendChild('<p>Your changes have been saved.</p>'); $notice->appendChild(
phutil_tag('p', array(), 'Your changes have been saved.'));
$notice = $notice->render(); $notice = $notice->render();
} }
} else { } else {

View File

@@ -53,10 +53,12 @@ final class PhabricatorSettingsPanelConduit
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Certificate Regenerated'); $notice->setTitle('Certificate Regenerated');
$notice->appendChild( $notice->appendChild(phutil_tag(
'<p>Your old certificate has been destroyed and you have been issued '. 'p',
array(),
'Your old certificate has been destroyed and you have been issued '.
'a new certificate. Sessions established under the old certificate '. 'a new certificate. Sessions established under the old certificate '.
'are no longer valid.</p>'); 'are no longer valid.'));
$notice = $notice->render(); $notice = $notice->render();
} else { } else {
$notice = null; $notice = null;

View File

@@ -72,7 +72,8 @@ final class PhabricatorSettingsPanelEmailPreferences
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle('Changes Saved');
$notice->appendChild('<p>Your changes have been saved.</p>'); $notice->appendChild(
phutil_tag('p', array(), 'Your changes have been saved.'));
} }
} else { } else {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();

View File

@@ -114,7 +114,8 @@ final class PhabricatorSettingsPanelPassword
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle('Changes Saved');
$notice->appendChild('<p>Your password has been updated.</p>'); $notice->appendChild(
phutil_tag('p', array(), 'Your password has been updated.'));
} }
} else { } else {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();

View File

@@ -119,7 +119,8 @@ final class PhabricatorSettingsPanelProfile
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$error_view->setTitle('Changes Saved'); $error_view->setTitle('Changes Saved');
$error_view->appendChild('<p>Your changes have been saved.</p>'); $error_view->appendChild(
phutil_tag('p', array(), 'Your changes have been saved.'));
$error_view = $error_view->render(); $error_view = $error_view->render();
} }
} }

View File

@@ -92,7 +92,10 @@ final class AphrontErrorView extends AphrontView {
$classes[] = 'aphront-error-severity-'.$this->severity; $classes[] = 'aphront-error-severity-'.$this->severity;
$classes = implode(' ', $classes); $classes = implode(' ', $classes);
return phutil_render_tag( $children = $this->renderHTMLChildren();
$children[] = $list;
return phutil_tag(
'div', 'div',
array( array(
'id' => $this->id, 'id' => $this->id,
@@ -100,13 +103,12 @@ final class AphrontErrorView extends AphrontView {
), ),
array( array(
$title, $title,
phutil_render_tag( phutil_tag(
'div', 'div',
array( array(
'class' => 'aphront-error-view-body', 'class' => 'aphront-error-view-body',
), ),
$this->renderChildren(). $children),
$list),
)); ));
} }
} }

View File

@@ -53,7 +53,7 @@ final class PhabricatorObjectItemListView extends AphrontView {
$string = nonempty($this->noDataString, pht('No data.')); $string = nonempty($this->noDataString, pht('No data.'));
$items = id(new AphrontErrorView()) $items = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NODATA) ->setSeverity(AphrontErrorView::SEVERITY_NODATA)
->appendChild(phutil_escape_html($string)); ->appendChild($string);
} }
$pager = null; $pager = null;

View File

@@ -22,7 +22,7 @@ final class PhabricatorPinboardView extends AphrontView {
$string = nonempty($this->noDataString, pht('No data.')); $string = nonempty($this->noDataString, pht('No data.'));
return id(new AphrontErrorView()) return id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NODATA) ->setSeverity(AphrontErrorView::SEVERITY_NODATA)
->appendChild(phutil_escape_html($string)) ->appendChild($string)
->render(); ->render();
} }