diff --git a/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php b/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php --- a/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php +++ b/src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php @@ -98,7 +98,7 @@ $this->statuses); } - if (strlen($this->datasourceQuery)) { + if (!phutil_nonempty_string($this->datasourceQuery)) { $where[] = qsprintf( $conn, 'plan.name LIKE %>', diff --git a/src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php --- a/src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php +++ b/src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php @@ -8,7 +8,7 @@ } public function getGenericDescription() { - return pht('Upload a file from a host to Phabricator.'); + return pht('Upload a file.'); } public function getBuildStepGroupKey() { diff --git a/src/applications/legalpad/editor/LegalpadDocumentEditEngine.php b/src/applications/legalpad/editor/LegalpadDocumentEditEngine.php --- a/src/applications/legalpad/editor/LegalpadDocumentEditEngine.php +++ b/src/applications/legalpad/editor/LegalpadDocumentEditEngine.php @@ -131,7 +131,7 @@ ->setKey('requireSignature') ->setOptions( pht('No Signature Required'), - pht('Signature Required to use Phabricator')) + pht('Signature Required to Log In')) ->setAsCheckbox(true) ->setTransactionType( LegalpadDocumentRequireSignatureTransaction::TRANSACTIONTYPE) diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php --- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php +++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php @@ -218,7 +218,7 @@ Statuses will appear in the UI in the order specified. Note the status marked `special` as `duplicate` is not settable directly and will not appear in UI -elements, and that any status marked `silly` does not appear if Phabricator +elements, and that any status marked `silly` does not appear if the software is configured with `phabricator.serious-business` set to true. Examining the default configuration and examples below will probably be helpful diff --git a/src/applications/meta/controller/PhabricatorApplicationUninstallController.php b/src/applications/meta/controller/PhabricatorApplicationUninstallController.php --- a/src/applications/meta/controller/PhabricatorApplicationUninstallController.php +++ b/src/applications/meta/controller/PhabricatorApplicationUninstallController.php @@ -38,7 +38,7 @@ ->appendChild( pht( 'To manage prototypes, enable them by setting %s in your '. - 'Phabricator configuration.', + 'configuration.', phutil_tag('tt', array(), 'phabricator.show-prototypes'))); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -98,9 +98,9 @@ ->appendParagraph( pht( 'This is very unusual and will leave you without any '. - 'content on the Phabricator home page. You should only '. - 'do this if you are certain you know what you are doing.')) - ->addSubmitButton(pht('Completely Break Phabricator')); + 'content on the home page. You should only do this if you '. + 'are certain you know what you are doing.')) + ->addSubmitButton(pht('Completely Break Everything')); } else { $dialog ->appendParagraph( @@ -114,8 +114,7 @@ ->setTitle(pht('Information')) ->appendChild( pht( - 'This application cannot be uninstalled, '. - 'because it is required for Phabricator to work.')); + 'This application is required and cannot be uninstalled.')); } } return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php b/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php --- a/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php +++ b/src/applications/metamta/adapter/PhabricatorMailTestAdapter.php @@ -126,12 +126,12 @@ $guts['headers'] = $header_list; $text_body = $message->getTextBody(); - if (strlen($text_body)) { + if (phutil_nonempty_string($text_body)) { $guts['body'] = $text_body; } $html_body = $message->getHTMLBody(); - if (strlen($html_body)) { + if (phutil_nonempty_string($html_body)) { $guts['html-body'] = $html_body; } diff --git a/src/applications/metamta/constants/MetaMTAReceivedMailStatus.php b/src/applications/metamta/constants/MetaMTAReceivedMailStatus.php --- a/src/applications/metamta/constants/MetaMTAReceivedMailStatus.php +++ b/src/applications/metamta/constants/MetaMTAReceivedMailStatus.php @@ -21,7 +21,7 @@ public static function getHumanReadableName($status) { $map = array( self::STATUS_DUPLICATE => pht('Duplicate Message'), - self::STATUS_FROM_PHABRICATOR => pht('Phabricator Mail'), + self::STATUS_FROM_PHABRICATOR => pht('Mail From Self'), self::STATUS_NO_RECEIVERS => pht('No Receivers'), self::STATUS_UNKNOWN_SENDER => pht('Unknown Sender'), self::STATUS_DISABLED_SENDER => pht('Disabled Sender'), diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php b/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php --- a/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAMailViewController.php @@ -428,7 +428,7 @@ if ($actor_phid) { $actor_str = $viewer->renderHandle($actor_phid); } else { - $actor_str = pht('Generated by Phabricator'); + $actor_str = pht('Generated by Server'); } $properties->addProperty(pht('Actor'), $actor_str); diff --git a/src/applications/metamta/engine/PhabricatorMailEmailEngine.php b/src/applications/metamta/engine/PhabricatorMailEmailEngine.php --- a/src/applications/metamta/engine/PhabricatorMailEmailEngine.php +++ b/src/applications/metamta/engine/PhabricatorMailEmailEngine.php @@ -119,6 +119,8 @@ } $body_limit = PhabricatorEnv::getEnvConfig('metamta.email-body-limit'); + + $body = phutil_string_cast($body); if (strlen($body) > $body_limit) { $body = id(new PhutilUTF8StringTruncator()) ->setMaximumBytes($body_limit) @@ -143,7 +145,7 @@ if ($send_html) { $html_body = $mail->getHTMLBody(); - if (strlen($html_body)) { + if (phutil_nonempty_string($html_body)) { // NOTE: We just drop the entire HTML body if it won't fit. Safely // truncating HTML is hard, and we already have the text body to fall // back to. @@ -166,7 +168,7 @@ if (PhabricatorEnv::getEnvConfig('phabricator.silent')) { $mail->setMessage( pht( - 'Phabricator is running in silent mode. See `%s` '. + 'This software is running in silent mode. See `%s` '. 'in the configuration to change this setting.', 'phabricator.silent')); @@ -226,7 +228,7 @@ $mail = $this->getMail(); $reply_raw = $mail->getReplyTo(); - if (!strlen($reply_raw)) { + if (!phutil_nonempty_string($reply_raw)) { return null; } @@ -241,7 +243,7 @@ // If we don't have a display name, fill in a default. if (!strlen($reply_address->getDisplayName())) { - $reply_address->setDisplayName(pht('Phabricator')); + $reply_address->setDisplayName(PlatformSymbols::getPlatformServerName()); } return $reply_address; @@ -301,7 +303,11 @@ } } - $subject[] = trim($mail->getSubjectPrefix()); + $subject_prefix = $mail->getSubjectPrefix(); + $subject_prefix = phutil_string_cast($subject_prefix); + $subject_prefix = trim($subject_prefix); + + $subject[] = $subject_prefix; // If mail content must be encrypted, we replace the subject with // a generic one. @@ -313,7 +319,7 @@ $subject[] = $encrypt_subject; } else { $vary_prefix = $mail->getVarySubjectPrefix(); - if (strlen($vary_prefix)) { + if (phutil_nonempty_string($vary_prefix)) { if ($this->shouldVarySubject()) { $subject[] = $vary_prefix; } @@ -323,7 +329,7 @@ } foreach ($subject as $key => $part) { - if (!strlen($part)) { + if (!phutil_nonempty_string($part)) { unset($subject[$key]); } } @@ -403,7 +409,7 @@ $headers = array(); $thread_id = $mail->getThreadID(); - if (!strlen($thread_id)) { + if (!phutil_nonempty_string($thread_id)) { return $headers; } @@ -508,8 +514,8 @@ $address = new PhutilEmailAddress($raw_address); - if (!strlen($address->getDisplayName())) { - $address->setDisplayName(pht('Phabricator')); + if (!phutil_nonempty_string($address->getDisplayName())) { + $address->setDisplayName(PlatformSymbols::getPlatformServerName()); } return $address; diff --git a/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php --- a/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php @@ -6,7 +6,7 @@ protected function didConstruct() { $this ->setName('list-inbound') - ->setSynopsis(pht('List inbound messages received by Phabricator.')) + ->setSynopsis(pht('List inbound messages.')) ->setExamples( '**list-inbound**') ->setArguments( diff --git a/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php --- a/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php +++ b/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php @@ -6,7 +6,7 @@ protected function didConstruct() { $this ->setName('list-outbound') - ->setSynopsis(pht('List outbound messages sent by Phabricator.')) + ->setSynopsis(pht('List outbound messages.')) ->setExamples('**list-outbound**') ->setArguments( array( diff --git a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php --- a/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php +++ b/src/applications/metamta/parser/PhabricatorMetaMTAEmailBodyParser.php @@ -81,6 +81,7 @@ } private function stripQuotedText($body) { + $body = phutil_string_cast($body); // Look for "On , wrote:". This may be split across multiple // lines. We need to be careful not to remove all of a message like this: diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php --- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php @@ -263,19 +263,16 @@ MetaMTAReceivedMailStatus::STATUS_UNKNOWN_SENDER, pht( 'This email was sent from an email address ("%s") that is not '. - 'associated with a Phabricator account. To interact with '. - 'Phabricator via email, add this address to your account.', + 'associated with a registered user account. To interact via '. + 'email, add this address to your account.', (string)$this->newFromAddress())); } else { throw new PhabricatorMetaMTAReceivedMailProcessingException( MetaMTAReceivedMailStatus::STATUS_NO_RECEIVERS, pht( - 'Phabricator can not process this mail because no application '. + 'This mail can not be processed because no application '. 'knows how to handle it. Check that the address you sent it to '. - 'is correct.'. - "\n\n". - '(No concrete, enabled subclass of PhabricatorMailReceiver can '. - 'accept this mail.)')); + 'is correct.')); } } } catch (PhabricatorMetaMTAReceivedMailProcessingException $ex) { @@ -348,9 +345,13 @@ private function getRawEmailAddresses($addresses) { $raw_addresses = array(); - foreach (explode(',', $addresses) as $address) { - $raw_addresses[] = $this->getRawEmailAddress($address); + + if (phutil_nonempty_string($addresses)) { + foreach (explode(',', $addresses) as $address) { + $raw_addresses[] = $this->getRawEmailAddress($address); + } } + return array_filter($raw_addresses); } @@ -436,7 +437,7 @@ $status_code, pht( 'Your message does not contain any body text or attachments, so '. - 'Phabricator can not do anything useful with it. Make sure comment '. + 'this server can not do anything useful with it. Make sure comment '. 'text appears at the top of your message: quoted replies, inline '. 'text, and signatures are discarded and ignored.')); } @@ -484,7 +485,7 @@ $headers = implode("\n", $headers); $body = pht(<<getRawTextBody(), $headers); @@ -563,21 +565,20 @@ if ($sender->getIsDisabled()) { $failure_reason = pht( 'Your account ("%s") is disabled, so you can not interact with '. - 'Phabricator over email.', + 'over email.', $sender->getUsername()); } else if ($sender->getIsStandardUser()) { if (!$sender->getIsApproved()) { $failure_reason = pht( 'Your account ("%s") has not been approved yet. You can not '. - 'interact with Phabricator over email until your account is '. - 'approved.', + 'interact over email until your account is approved.', $sender->getUsername()); } else if (PhabricatorUserEmail::isEmailVerificationRequired() && !$sender->getIsEmailVerified()) { $failure_reason = pht( 'You have not verified the email address for your account ("%s"). '. - 'You must verify your email address before you can interact '. - 'with Phabricator over email.', + 'You must verify your email address before you can interact over '. + 'email.', $sender->getUsername()); } } diff --git a/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php b/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php --- a/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php +++ b/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php @@ -395,7 +395,7 @@ // We expect the HTML body was dropped completely after the text body was // truncated. $this->assertTrue( - !strlen($html_body), + !phutil_nonempty_string($html_body), pht('HTML Body Removed')); @@ -416,7 +416,7 @@ $html_body = $mailer->getHTMLBody(); $this->assertEqual($string_1kb, $text_body); - $this->assertTrue(!strlen($html_body)); + $this->assertTrue(!phutil_nonempty_string($html_body)); } } diff --git a/src/applications/metamta/util/PhabricatorMailUtil.php b/src/applications/metamta/util/PhabricatorMailUtil.php --- a/src/applications/metamta/util/PhabricatorMailUtil.php +++ b/src/applications/metamta/util/PhabricatorMailUtil.php @@ -21,11 +21,10 @@ // If a mailbox prefix is configured and present, strip it off. $prefix_key = 'metamta.single-reply-handler-prefix'; $prefix = PhabricatorEnv::getEnvConfig($prefix_key); - $len = strlen($prefix); - if ($len) { + if (phutil_nonempty_string($prefix)) { $prefix = $prefix.'+'; - $len = $len + 1; + $len = strlen($prefix); if (!strncasecmp($raw_address, $prefix, $len)) { $raw_address = substr($raw_address, $len); diff --git a/src/applications/settings/setting/PhabricatorEditorSetting.php b/src/applications/settings/setting/PhabricatorEditorSetting.php --- a/src/applications/settings/setting/PhabricatorEditorSetting.php +++ b/src/applications/settings/setting/PhabricatorEditorSetting.php @@ -42,7 +42,7 @@ } public function validateTransactionValue($value) { - if (!strlen($value)) { + if (!phutil_nonempty_string($value)) { return; } diff --git a/src/applications/settings/setting/PhabricatorSelectSetting.php b/src/applications/settings/setting/PhabricatorSelectSetting.php --- a/src/applications/settings/setting/PhabricatorSelectSetting.php +++ b/src/applications/settings/setting/PhabricatorSelectSetting.php @@ -47,6 +47,7 @@ } final public function validateTransactionValue($value) { + $value = phutil_string_cast($value); if (!strlen($value)) { return; } @@ -66,11 +67,13 @@ } public function getTransactionNewValue($value) { + $value = phutil_string_cast($value); + if (!strlen($value)) { return null; } - return (string)$value; + return $value; } } diff --git a/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php b/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php --- a/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php +++ b/src/infrastructure/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php @@ -77,6 +77,7 @@ } public function escapeStringForLikeClause($value) { + $value = phutil_string_cast($value); $value = addcslashes($value, '\%_'); $value = $this->escapeUTF8String($value); return $value;