From 58b6e2cac641eec62209a91fe6beb2e9cefd418a Mon Sep 17 00:00:00 2001 From: vrana Date: Sat, 9 Feb 2013 10:31:09 -0800 Subject: [PATCH] Convert AphrontDialogView to safe HTML Summary: Done by searching for `AphrontDialogView` and then `appendChild()`. Also added some `pht()`. Test Plan: None. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4882 --- ...AphrontDefaultApplicationConfiguration.php | 21 ++++--- .../PhabricatorLDAPLoginController.php | 13 ++-- .../PhabricatorLDAPUnlinkController.php | 6 +- .../controller/PhabricatorLoginController.php | 3 +- .../PhabricatorLogoutController.php | 3 +- .../PhabricatorOAuthLoginController.php | 7 +-- .../PhabricatorOAuthUnlinkController.php | 6 +- .../PhabricatorWorkerTaskUpdateController.php | 5 +- .../DifferentialCommentSaveController.php | 7 +-- .../DifferentialSubscribeController.php | 2 +- .../DrydockLeaseReleaseController.php | 13 ++-- .../DrydockResourceCloseController.php | 11 ++-- ...bricatorHelpKeyboardShortcutController.php | 8 +-- .../PhabricatorMacroDisableController.php | 8 +-- .../controller/ManiphestExportController.php | 8 +-- ...PhabricatorOAuthClientDeleteController.php | 5 +- ...uthClientAuthorizationDeleteController.php | 5 +- .../blog/PhameBlogDeleteController.php | 2 +- .../post/PhamePostDeleteController.php | 2 +- .../post/PhamePostNotLiveController.php | 12 ++-- .../post/PhamePostUnpublishController.php | 2 +- .../controller/PhrictionEditController.php | 8 +-- .../controller/PonderAnswerSaveController.php | 3 +- .../PonderCommentSaveController.php | 3 +- .../PhabricatorProjectUpdateController.php | 6 +- .../panel/PhabricatorSettingsPanelConduit.php | 6 +- ...PhabricatorSettingsPanelEmailAddresses.php | 12 ++-- .../panel/PhabricatorSettingsPanelSSHKeys.php | 10 +-- ...ApplicationTransactionNoEffectResponse.php | 3 +- .../PhabricatorInlineCommentController.php | 2 +- src/view/AphrontDialogView.php | 42 ++++++------- .../PhabricatorObjectSelectorDialog.php | 61 ++++++++++--------- 32 files changed, 152 insertions(+), 153 deletions(-) diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index a950a620a6..9babe737c5 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -227,7 +227,7 @@ class AphrontDefaultApplicationConfiguration phlog($ex); $class = get_class($ex); - $message = phutil_escape_html($ex->getMessage()); + $message = $ex->getMessage(); if ($ex instanceof AphrontQuerySchemaException) { $message .= @@ -243,11 +243,13 @@ class AphrontDefaultApplicationConfiguration $trace = null; } - $content = + $content = hsprintf( '
'. - '
'.$message.'
'. - $trace. - '
'; + '
%s
'. + '%s'. + '', + $message, + $trace); $dialog = new AphrontDialogView(); $dialog @@ -349,7 +351,7 @@ class AphrontDefaultApplicationConfiguration } $file_name = $file_name.' : '.(int)$part['line']; } else { - $file_name = '(Internal)'; + $file_name = phutil_tag('em', array(), '(Internal)'); } @@ -376,11 +378,12 @@ class AphrontDefaultApplicationConfiguration 'wide', )); - return + return hsprintf( '
'. '
Stack Trace
'. - $table->render(). - '
'; + '%s', + '', + phutil_safe_html($table->render())); } } diff --git a/src/applications/auth/controller/PhabricatorLDAPLoginController.php b/src/applications/auth/controller/PhabricatorLDAPLoginController.php index 4dafe831f7..5c912d5a5a 100644 --- a/src/applications/auth/controller/PhabricatorLDAPLoginController.php +++ b/src/applications/auth/controller/PhabricatorLDAPLoginController.php @@ -43,12 +43,11 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Already Linked to Another Account')); - $dialog->appendChild( - '

'.pht('The LDAP account you just authorized is already '. + $dialog->appendChild(phutil_tag('p', array(), pht( + 'The LDAP account you just authorized is already '. 'linked toanother Phabricator account. Before you can link it '. 'to a different LDAP account, you must unlink the old '. - 'account.').'

' - ); + 'account.'))); $dialog->addCancelButton('/settings/panel/ldap/'); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -62,10 +61,8 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Link LDAP Account')); - $dialog->appendChild( - '

'. - pht('Link your LDAP account to your Phabricator account?'). - '

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Link your LDAP account to your Phabricator account?'))); $dialog->addHiddenInput('username', $request->getStr('username')); $dialog->addHiddenInput('password', $request->getStr('password')); $dialog->addSubmitButton(pht('Link Accounts')); diff --git a/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php b/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php index 44cad5a398..c2c7aaf34b 100644 --- a/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php +++ b/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php @@ -18,9 +18,9 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Really unlink account?')); - $dialog->appendChild( - '

'.pht('You will not be able to login using this account '. - 'once you unlink it. Continue?').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You will not be able to login using this account '. + 'once you unlink it. Continue?'))); $dialog->addSubmitButton(pht('Unlink Account')); $dialog->addCancelButton('/settings/panel/ldap/'); diff --git a/src/applications/auth/controller/PhabricatorLoginController.php b/src/applications/auth/controller/PhabricatorLoginController.php index 23de5e7f2d..1ad981cf65 100644 --- a/src/applications/auth/controller/PhabricatorLoginController.php +++ b/src/applications/auth/controller/PhabricatorLoginController.php @@ -29,7 +29,8 @@ final class PhabricatorLoginController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Login Required')); - $dialog->appendChild('

'.pht('You must login to continue.').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You must login to continue.'))); $dialog->addSubmitButton(pht('Login')); $dialog->addCancelButton('/', pht('Cancel')); diff --git a/src/applications/auth/controller/PhabricatorLogoutController.php b/src/applications/auth/controller/PhabricatorLogoutController.php index e2cc5410fa..f75b4c601d 100644 --- a/src/applications/auth/controller/PhabricatorLogoutController.php +++ b/src/applications/auth/controller/PhabricatorLogoutController.php @@ -46,7 +46,8 @@ final class PhabricatorLogoutController $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Log out of Phabricator?')) - ->appendChild('

'.pht('Are you sure you want to log out?').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to log out?'))) ->addSubmitButton(pht('Logout')) ->addCancelButton('/'); diff --git a/src/applications/auth/controller/PhabricatorOAuthLoginController.php b/src/applications/auth/controller/PhabricatorOAuthLoginController.php index dbfcc81810..a226f5e9cf 100644 --- a/src/applications/auth/controller/PhabricatorOAuthLoginController.php +++ b/src/applications/auth/controller/PhabricatorOAuthLoginController.php @@ -116,10 +116,9 @@ final class PhabricatorOAuthLoginController $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Link %s Account', $provider_name)); - $dialog->appendChild( - pht( - '

Link your %s account to your Phabricator account?

', - phutil_escape_html($provider_name))); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Link your %s account to your Phabricator account?', + $provider_name))); $dialog->addHiddenInput('confirm_token', $provider->getAccessToken()); $dialog->addHiddenInput('expires', $oauth_info->getTokenExpires()); $dialog->addHiddenInput('state', $this->oauthState); diff --git a/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php b/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php index bff01b251b..97be2b7b8c 100644 --- a/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php +++ b/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php @@ -34,9 +34,9 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Really unlink account?')); - $dialog->appendChild( - '

'.pht('You will not be able to login using this account '. - 'once you unlink it. Continue?').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You will not be able to login using this account '. + 'once you unlink it. Continue?'))); $dialog->addSubmitButton(pht('Unlink Account')); $dialog->addCancelButton($provider->getSettingsPanelURI()); diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php index 72f9e256aa..e9f9f8ee7b 100644 --- a/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php @@ -72,9 +72,8 @@ final class PhabricatorWorkerTaskUpdateController case 'retry': if ($can_retry) { $dialog->setTitle('Really retry task?'); - $dialog->appendChild( - '

The task will be put back in the queue and executed '. - 'again.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'The task will be put back in the queue and executed again.'))); $dialog->addSubmitButton('Retry Task'); } else { $dialog->setTitle('Can Not Retry'); diff --git a/src/applications/differential/controller/DifferentialCommentSaveController.php b/src/applications/differential/controller/DifferentialCommentSaveController.php index d49232bb37..6f84e33282 100644 --- a/src/applications/differential/controller/DifferentialCommentSaveController.php +++ b/src/applications/differential/controller/DifferentialCommentSaveController.php @@ -60,10 +60,9 @@ final class DifferentialCommentSaveController extends DifferentialController { if (strlen($comment) || $has_inlines) { $dialog->addSubmitButton(pht('Post as Comment')); - $dialog->appendChild('
'); - $dialog->appendChild( - '

'.pht('Do you want to post your feedback anyway, as a normal '. - 'comment?').'

'); + $dialog->appendChild(phutil_tag('br')); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Do you want to post your feedback anyway, as a normal comment?'))); } return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/differential/controller/DifferentialSubscribeController.php b/src/applications/differential/controller/DifferentialSubscribeController.php index 9d1ade910d..99fc019c3a 100644 --- a/src/applications/differential/controller/DifferentialSubscribeController.php +++ b/src/applications/differential/controller/DifferentialSubscribeController.php @@ -43,7 +43,7 @@ final class DifferentialSubscribeController extends DifferentialController { $dialog ->setUser($user) ->setTitle($title) - ->appendChild('

'.$prompt.'

') + ->appendChild(phutil_tag('p', array(), $prompt)) ->setSubmitURI($request->getRequestURI()) ->addSubmitButton($button) ->addCancelButton('/D'.$revision->getID()); diff --git a/src/applications/drydock/controller/DrydockLeaseReleaseController.php b/src/applications/drydock/controller/DrydockLeaseReleaseController.php index 7032917424..dd238e2467 100644 --- a/src/applications/drydock/controller/DrydockLeaseReleaseController.php +++ b/src/applications/drydock/controller/DrydockLeaseReleaseController.php @@ -24,8 +24,8 @@ final class DrydockLeaseReleaseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Lease Not Active')) - ->appendChild( - '

'.pht('You can only release "active" leases.').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'You can only release "active" leases.'))) ->addCancelButton($lease_uri); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -35,11 +35,10 @@ final class DrydockLeaseReleaseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Really release lease?')) - ->appendChild( - '

'.pht( - 'Releasing a lease may cause trouble for the lease holder and '. - 'trigger cleanup of the underlying resource. It can not be '. - 'undone. Continue?').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'Releasing a lease may cause trouble for the lease holder and '. + 'trigger cleanup of the underlying resource. It can not be '. + 'undone. Continue?'))) ->addSubmitButton(pht('Release Lease')) ->addCancelButton($lease_uri); diff --git a/src/applications/drydock/controller/DrydockResourceCloseController.php b/src/applications/drydock/controller/DrydockResourceCloseController.php index 94ac736b78..8b28ce0319 100644 --- a/src/applications/drydock/controller/DrydockResourceCloseController.php +++ b/src/applications/drydock/controller/DrydockResourceCloseController.php @@ -24,8 +24,8 @@ final class DrydockResourceCloseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Resource Not Open')) - ->appendChild( - '

'.pht('You can only close "open" resources.').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'You can only close "open" resources.'))) ->addCancelButton($resource_uri); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -35,10 +35,9 @@ final class DrydockResourceCloseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Really close resource?')) - ->appendChild( - '

'.pht( - 'Closing a resource releases all leases and destroys the '. - 'resource. It can not be undone. Continue?').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'Closing a resource releases all leases and destroys the '. + 'resource. It can not be undone. Continue?'))) ->addSubmitButton(pht('Close Resource')) ->addCancelButton($resource_uri); diff --git a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php index 784f223011..7638535ce4 100644 --- a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php +++ b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php @@ -37,10 +37,10 @@ final class PhabricatorHelpKeyboardShortcutController )); } - $table = - ''. - implode('', $rows). - '
'; + $table = phutil_tag( + 'table', + array('class' => 'keyboard-shortcut-help'), + $rows); $dialog = id(new AphrontDialogView()) ->setUser($user) diff --git a/src/applications/macro/controller/PhabricatorMacroDisableController.php b/src/applications/macro/controller/PhabricatorMacroDisableController.php index 3e9e44aa9e..2dbe854d0c 100644 --- a/src/applications/macro/controller/PhabricatorMacroDisableController.php +++ b/src/applications/macro/controller/PhabricatorMacroDisableController.php @@ -43,10 +43,10 @@ final class PhabricatorMacroDisableController $dialog ->setUser($request->getUser()) ->setTitle(pht('Really disable macro?')) - ->appendChild( - '

'.pht('Really disable the much-beloved image macro %s? '. - 'It will be sorely missed.', phutil_escape_html($macro->getName())). - '

') + ->appendChild(phutil_tag('p', array(), pht( + 'Really disable the much-beloved image macro %s? '. + 'It will be sorely missed.', + $macro->getName()))) ->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/')) ->addSubmitButton(pht('Disable')) ->addCancelButton($view_uri); diff --git a/src/applications/maniphest/controller/ManiphestExportController.php b/src/applications/maniphest/controller/ManiphestExportController.php index 591e8ff310..a33809b745 100644 --- a/src/applications/maniphest/controller/ManiphestExportController.php +++ b/src/applications/maniphest/controller/ManiphestExportController.php @@ -28,7 +28,7 @@ final class ManiphestExportController extends ManiphestController { $dialog->setUser($user); $dialog->setTitle('Excel Export Not Configured'); - $dialog->appendChild( + $dialog->appendChild(hsprintf( '

This system does not have PHPExcel installed. This software '. 'component is required to export tasks to Excel. Have your system '. 'administrator install it from:

'. @@ -38,7 +38,7 @@ final class ManiphestExportController extends ManiphestController { '

'. '
'. '

Your PHP "include_path" needs to be updated to include the '. - 'PHPExcel Classes/ directory.

'); + 'PHPExcel Classes/ directory.

')); $dialog->addCancelButton('/maniphest/'); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -59,8 +59,8 @@ final class ManiphestExportController extends ManiphestController { $dialog->setUser($user); $dialog->setTitle('Export Tasks to Excel'); - $dialog->appendChild( - '

Do you want to export the query results to Excel?

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Do you want to export the query results to Excel?'))); $dialog->addCancelButton('/maniphest/'); $dialog->addSubmitButton('Export to Excel'); diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php index 49601ce66f..ae3f85a3ac 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php @@ -37,9 +37,8 @@ extends PhabricatorOAuthClientBaseController { $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle($title); - $dialog->appendChild( - '

Are you sure you want to delete this client?

' - ); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to delete this client?'))); $dialog->addSubmitButton(); $dialog->addCancelButton($client->getEditURI()); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php index 11b66df39a..4f366c53d9 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php @@ -46,9 +46,8 @@ extends PhabricatorOAuthClientAuthorizationBaseController { $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle($title); - $dialog->appendChild( - '

Are you sure you want to delete this client authorization?

' - ); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to delete this client authorization?'))); $dialog->addSubmitButton(); $dialog->addCancelButton($authorization->getEditURI()); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/phame/controller/blog/PhameBlogDeleteController.php b/src/applications/phame/controller/blog/PhameBlogDeleteController.php index eb6f4695a8..e6d9b4dff6 100644 --- a/src/applications/phame/controller/blog/PhameBlogDeleteController.php +++ b/src/applications/phame/controller/blog/PhameBlogDeleteController.php @@ -41,7 +41,7 @@ final class PhameBlogDeleteController extends PhameController { ->appendChild( pht( 'Really delete the blog "%s"? It will be gone forever.', - phutil_escape_html($blog->getName()))) + $blog->getName())) ->addSubmitButton(pht('Delete')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phame/controller/post/PhamePostDeleteController.php b/src/applications/phame/controller/post/PhamePostDeleteController.php index 26719ff61c..8faa715a5e 100644 --- a/src/applications/phame/controller/post/PhamePostDeleteController.php +++ b/src/applications/phame/controller/post/PhamePostDeleteController.php @@ -41,7 +41,7 @@ final class PhamePostDeleteController extends PhameController { ->appendChild( pht( 'Really delete the post "%s"? It will be gone forever.', - phutil_escape_html($post->getTitle()))) + $post->getTitle())) ->addSubmitButton(pht('Delete')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phame/controller/post/PhamePostNotLiveController.php b/src/applications/phame/controller/post/PhamePostNotLiveController.php index c2b4983736..885bc3b1a9 100644 --- a/src/applications/phame/controller/post/PhamePostNotLiveController.php +++ b/src/applications/phame/controller/post/PhamePostNotLiveController.php @@ -25,16 +25,16 @@ final class PhamePostNotLiveController extends PhameController { $reasons = array(); if (!$post->getBlog()) { - $reasons[] = - '

'.pht('You can not view the live version of this post because it '. + $reasons[] = phutil_tag('p', array(), pht( + 'You can not view the live version of this post because it '. 'is not associated with a blog. Move the post to a blog in order to '. - 'view it live.').'

'; + 'view it live.')); } if ($post->isDraft()) { - $reasons[] = - '

'.pht('You can not view the live version of this post because it '. - 'is still a draft. Use "Preview/Publish" to publish the post.').'

'; + $reasons[] = phutil_tag('p', array(), pht( + 'You can not view the live version of this post because it '. + 'is still a draft. Use "Preview/Publish" to publish the post.')); } if ($reasons) { diff --git a/src/applications/phame/controller/post/PhamePostUnpublishController.php b/src/applications/phame/controller/post/PhamePostUnpublishController.php index efc8153dab..f70cff773c 100644 --- a/src/applications/phame/controller/post/PhamePostUnpublishController.php +++ b/src/applications/phame/controller/post/PhamePostUnpublishController.php @@ -45,7 +45,7 @@ final class PhamePostUnpublishController extends PhameController { pht( 'The post "%s" will no longer be visible to other users until you '. 'republish it.', - phutil_escape_html($post->getTitle()))) + $post->getTitle())) ->addSubmitButton(pht('Unpublish')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index 42ace421a3..83b0b30ddb 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -108,8 +108,8 @@ final class PhrictionEditController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('No Edits')); - $dialog->appendChild( - '

'.pht('You did not make any changes to the document.').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You did not make any changes to the document.'))); $dialog->addCancelButton($request->getRequestURI()); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -122,8 +122,8 @@ final class PhrictionEditController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Empty Page')); - $dialog->appendChild( - '

'.pht('You can not create an empty document.').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You can not create an empty document.'))); $dialog->addCancelButton($request->getRequestURI()); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/ponder/controller/PonderAnswerSaveController.php b/src/applications/ponder/controller/PonderAnswerSaveController.php index 85a311bcc6..9f505a3287 100644 --- a/src/applications/ponder/controller/PonderAnswerSaveController.php +++ b/src/applications/ponder/controller/PonderAnswerSaveController.php @@ -23,7 +23,8 @@ final class PonderAnswerSaveController extends PonderController { $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Empty answer'); - $dialog->appendChild('

Your answer must not be empty.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Your answer must not be empty.'))); $dialog->addCancelButton('/Q'.$question_id); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/ponder/controller/PonderCommentSaveController.php b/src/applications/ponder/controller/PonderCommentSaveController.php index 125fee9a52..54bbc8a2ba 100644 --- a/src/applications/ponder/controller/PonderCommentSaveController.php +++ b/src/applications/ponder/controller/PonderCommentSaveController.php @@ -32,7 +32,8 @@ final class PonderCommentSaveController extends PonderController { $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Empty comment'); - $dialog->appendChild('

Your comment must not be empty.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Your comment must not be empty.'))); $dialog->addCancelButton('/Q'.$question_id); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/project/controller/PhabricatorProjectUpdateController.php b/src/applications/project/controller/PhabricatorProjectUpdateController.php index 9d11fd16a1..2c8b6319e2 100644 --- a/src/applications/project/controller/PhabricatorProjectUpdateController.php +++ b/src/applications/project/controller/PhabricatorProjectUpdateController.php @@ -62,9 +62,9 @@ final class PhabricatorProjectUpdateController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle('Really leave project?'); - $dialog->appendChild( - '

Your tremendous contributions to this project will be sorely '. - 'missed. Are you sure you want to leave?

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Your tremendous contributions to this project will be sorely '. + 'missed. Are you sure you want to leave?'))); $dialog->addCancelButton($project_uri); $dialog->addSubmitButton('Leave Project'); break; diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php index d4ccec4194..7c9199e279 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php @@ -26,9 +26,9 @@ final class PhabricatorSettingsPanelConduit $dialog->setSubmitURI($this->getPanelURI()); $dialog->addSubmitButton('Regenerate'); $dialog->addCancelbutton($this->getPanelURI()); - $dialog->appendChild( - '

Really destroy the old certificate? Any established '. - 'sessions will be terminated.'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Really destroy the old certificate? Any established '. + 'sessions will be terminated.'))); return id(new AphrontDialogResponse()) ->setDialog($dialog); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php index 86a0d10dbc..fee269f09d 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php @@ -191,9 +191,9 @@ final class PhabricatorSettingsPanelEmailAddresses ->setUser($user) ->addHiddenInput('new', 'verify') ->setTitle('Verification Email Sent') - ->appendChild( - '

A verification email has been sent. Click the link in the '. - 'email to verify your address.

') + ->appendChild(phutil_tag('p', array(), pht( + 'A verification email has been sent. Click the link in the '. + 'email to verify your address.'))) ->setSubmitURI($uri) ->addSubmitButton('Done'); @@ -264,9 +264,9 @@ final class PhabricatorSettingsPanelEmailAddresses ->setUser($user) ->addHiddenInput('delete', $email_id) ->setTitle("Really delete address '{$address}'?") - ->appendChild( - '

Are you sure you want to delete this address? You will no '. - 'longer be able to use it to login.

') + ->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to delete this address? You will no '. + 'longer be able to use it to login.'))) ->addSubmitButton('Delete') ->addCancelButton($uri); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php index 133c45ec9c..d7a96c3611 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php @@ -240,7 +240,7 @@ final class PhabricatorSettingsPanelSSHKeys $user = $request->getUser(); - $name = phutil_escape_html($key->getName()); + $name = phutil_tag('strong', array(), $key->getName()); if ($request->isDialogFormPost()) { $key->delete(); @@ -252,10 +252,10 @@ final class PhabricatorSettingsPanelSSHKeys ->setUser($user) ->addHiddenInput('delete', $key->getID()) ->setTitle('Really delete SSH Public Key?') - ->appendChild( - '

The key "'.$name.'" will be permanently deleted, '. - 'and you will not longer be able to use the corresponding private key '. - 'to authenticate.

') + ->appendChild(phutil_tag('p', array(), pht( + 'The key "%s" will be permanently deleted, and you will not longer be '. + 'able to use the corresponding private key to authenticate.', + $name))) ->addSubmitButton('Delete Public Key') ->addCancelButton($this->getPanelURI()); diff --git a/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php b/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php index 9c1caab76e..fe63299d1b 100644 --- a/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php +++ b/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php @@ -57,7 +57,8 @@ final class PhabricatorApplicationTransactionNoEffectResponse ->setTitle($title); foreach ($xactions as $xaction) { - $dialog->appendChild('

'.$xaction->getNoEffectDescription().'

'); + $dialog->appendChild( + phutil_tag('p', array(), $xaction->getNoEffectDescription())); } $dialog->appendChild($tail); diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php index 99fe0b70da..3a8ad2f1ad 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -71,7 +71,7 @@ abstract class PhabricatorInlineCommentController $dialog->setTitle('Really delete this comment?'); $dialog->addHiddenInput('id', $this->getCommentID()); $dialog->addHiddenInput('op', 'delete'); - $dialog->appendChild('

Delete this inline comment?

'); + $dialog->appendChild(hsprintf('

Delete this inline comment?

')); $dialog->addCancelButton('#'); $dialog->addSubmitButton('Delete'); diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index 04122e0027..78e3a4170f 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -99,7 +99,6 @@ final class AphrontDialogView extends AphrontView { ), $this->cancelText); } - $buttons = implode('', $buttons); if (!$this->user) { throw new Exception( @@ -131,6 +130,14 @@ final class AphrontDialogView extends AphrontView { ); $hidden_inputs = array(); + $hidden_inputs[] = phutil_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => '__dialog__', + 'value' => '1', + )); + foreach ($this->hidden as $desc) { list($key, $value) = $desc; $hidden_inputs[] = javelin_tag( @@ -142,37 +149,30 @@ final class AphrontDialogView extends AphrontView { 'sigil' => 'aphront-dialog-application-input' )); } - $hidden_inputs = implode("\n", $hidden_inputs); - $hidden_inputs = - ''. - $hidden_inputs; - if (!$this->renderAsForm) { - $buttons = phabricator_render_form( + $buttons = array(phabricator_form( $this->user, $form_attributes, - $hidden_inputs.$buttons); + array_merge($hidden_inputs, $buttons))); } - $content = - hsprintf('
%s
', $this->title). - '
'. - $this->renderChildren(). - '
'. - '
'. - $buttons. - '
'. - '
'; + $buttons[] = phutil_tag('div', array('style' => 'clear: both;'), ''); + $children = $this->renderHTMLChildren(); + + $content = hsprintf( + '%s%s%s', + phutil_tag('div', array('class' => 'aphront-dialog-head'), $this->title), + phutil_tag('div', array('class' => 'aphront-dialog-body'), $children), + phutil_tag('div', array('class' => 'aphront-dialog-tail'), $buttons)); if ($this->renderAsForm) { - return phabricator_render_form( + return phabricator_form( $this->user, $form_attributes + $attributes, - $hidden_inputs. - $content); + array($hidden_inputs, $content)); } else { - return javelin_render_tag( + return javelin_tag( 'div', $attributes, $content); diff --git a/src/view/control/PhabricatorObjectSelectorDialog.php b/src/view/control/PhabricatorObjectSelectorDialog.php index 1466d4918c..1456c26c52 100644 --- a/src/view/control/PhabricatorObjectSelectorDialog.php +++ b/src/view/control/PhabricatorObjectSelectorDialog.php @@ -101,50 +101,51 @@ final class PhabricatorObjectSelectorDialog { ), $label); } - $options = implode("\n", $options); $instructions = null; if ($this->instructions) { - $instructions = - '

'. - $this->instructions. - '

'; + $instructions = phutil_tag( + 'p', + array('class' => 'phabricator-object-selector-instructions'), + $this->instructions); } - $search_box = phabricator_render_form( + $search_box = phabricator_form( $user, array( 'method' => 'POST', 'action' => $this->submitURI, 'id' => $search_id, ), - ' - - - - - '); - $result_box = - '
'. - '
'; - $attached_box = + hsprintf( + ' + + + + + ', + phutil_tag('select', array('id' => $filter_id), $options), + phutil_tag('input', array('id' => $query_id)))); + + $result_box = phutil_tag( + 'div', + array( + 'class' => 'phabricator-object-selector-results', + 'id' => $results_id, + ), + ''); + + $attached_box = hsprintf( '
'. '
'. - hsprintf( - '
%s
', - $this->header). - '
'. - '
'. - $instructions. + '
%s
'. + '
'. + '%s'. '
'. - '
'; - + '', + $this->header, + $current_id, + $instructions); $dialog = new AphrontDialogView(); $dialog