From 1e6deff8ba67f052cebb946d40cb82bb2cba57f8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 12 Apr 2013 08:10:22 -0700 Subject: [PATCH] Don't use deprected "1" value to cURL CURLOPT_SSL_VERIFYHOST Summary: Fixes T2962. That task discusses this issue. Test Plan: Read php-curl documentation to verify this change makes sense. Sent an email with SES. Reviewers: btrahan, garoevans Reviewed By: garoevans CC: aran Maniphest Tasks: T2962 Differential Revision: https://secure.phabricator.com/D5669 --- externals/amazon-ses/ses.php | 2 +- src/__phutil_library_map__.php | 2 + .../PhabricatorApplicationPhortune.php | 1 + .../PhortuneAccountBuyController.php | 75 +++++++++++++++++++ .../edges/constants/PhabricatorEdgeConfig.php | 5 ++ 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/applications/phortune/controller/PhortuneAccountBuyController.php diff --git a/externals/amazon-ses/ses.php b/externals/amazon-ses/ses.php index bec4230df2..01a1b234c4 100644 --- a/externals/amazon-ses/ses.php +++ b/externals/amazon-ses/ses.php @@ -495,7 +495,7 @@ final class SimpleEmailServiceRequest $curl = curl_init(); curl_setopt($curl, CURLOPT_USERAGENT, 'SimpleEmailService/php'); - curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, ($this->ses->verifyHost() ? 1 : 0)); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, ($this->ses->verifyHost() ? 2 : 0)); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, ($this->ses->verifyPeer() ? 1 : 0)); // Request types diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a0d589d85c..6f9ab2d590 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1556,6 +1556,7 @@ phutil_register_library_map(array( 'PholioTransactionType' => 'applications/pholio/constants/PholioTransactionType.php', 'PholioTransactionView' => 'applications/pholio/view/PholioTransactionView.php', 'PhortuneAccount' => 'applications/phortune/storage/PhortuneAccount.php', + 'PhortuneAccountBuyController' => 'applications/phortune/controller/PhortuneAccountBuyController.php', 'PhortuneAccountEditor' => 'applications/phortune/editor/PhortuneAccountEditor.php', 'PhortuneAccountQuery' => 'applications/phortune/query/PhortuneAccountQuery.php', 'PhortuneAccountTransaction' => 'applications/phortune/storage/PhortuneAccountTransaction.php', @@ -3252,6 +3253,7 @@ phutil_register_library_map(array( 0 => 'PhortuneDAO', 1 => 'PhabricatorPolicyInterface', ), + 'PhortuneAccountBuyController' => 'PhortuneController', 'PhortuneAccountEditor' => 'PhabricatorApplicationTransactionEditor', 'PhortuneAccountQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhortuneAccountTransaction' => 'PhabricatorApplicationTransaction', diff --git a/src/applications/phortune/application/PhabricatorApplicationPhortune.php b/src/applications/phortune/application/PhabricatorApplicationPhortune.php index fda70d2b12..5440cda2aa 100644 --- a/src/applications/phortune/application/PhabricatorApplicationPhortune.php +++ b/src/applications/phortune/application/PhabricatorApplicationPhortune.php @@ -35,6 +35,7 @@ final class PhabricatorApplicationPhortune extends PhabricatorApplication { 'paymentmethod/' => array( 'edit/' => 'PhortunePaymentMethodEditController', ), + 'buy/(?P\d+)/' => 'PhortuneAccountBuyController', ), 'account/' => array( '' => 'PhortuneAccountListController', diff --git a/src/applications/phortune/controller/PhortuneAccountBuyController.php b/src/applications/phortune/controller/PhortuneAccountBuyController.php new file mode 100644 index 0000000000..ea993556d9 --- /dev/null +++ b/src/applications/phortune/controller/PhortuneAccountBuyController.php @@ -0,0 +1,75 @@ +accountID = $data['accountID']; + $this->id = $data['id']; + } + + public function processRequest() { + $request = $this->getRequest(); + $user = $request->getUser(); + + $account = id(new PhortuneAccountQuery()) + ->setViewer($user) + ->withIDs(array($this->accountID)) + ->executeOne(); + if (!$account) { + return new Aphront404Response(); + } + + $account_uri = $this->getApplicationURI($account->getID().'/'); + + $product = id(new PhortuneProductQuery()) + ->setViewer($user) + ->withIDs(array($this->id)) + ->executeOne(); + if (!$product) { + return new Aphront404Response(); + } + + $title = pht('Buy %s', $product->getProductName()); + + $payment_method_uri = $this->getApplicationURI( + $account->getID().'/paymentmethod/edit/'); + + $new_method = phutil_tag( + 'a', + array( + 'href' => $payment_method_uri, + 'sigil' => 'workflow', + ), + pht('Add New Payment Method')); + + + $form = id(new AphrontFormView()) + ->setUser($user) + ->appendChild( + id(new AphrontFormStaticControl()) + ->setLabel(pht('Stuff')) + ->setValue($product->getProductName())) + ->appendChild( + id(new AphrontFormRadioButtonControl()) + ->setLabel(pht('Payment Method'))) + ->appendChild( + id(new AphrontFormMarkupControl()) + ->setValue($new_method)) + ->appendChild( + id(new AphrontFormSubmitControl()) + ->setValue(pht("Dolla Dolla Bill Y'all"))); + + return $this->buildApplicationPage( + $form, + array( + 'title' => $title, + 'device' => true, + 'dust' => true, + )); + + } +} diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php index 2b36e138ed..e73bf76f03 100644 --- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php +++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php @@ -45,6 +45,9 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { const TYPE_ACCOUNT_HAS_MEMBER = 27; const TYPE_MEMBER_HAS_ACCOUNT = 28; + const TYPE_PURCAHSE_HAS_CHARGE = 29; + const TYPE_CHARGE_HAS_PURCHASE = 30; + const TYPE_TEST_NO_CYCLE = 9000; @@ -125,6 +128,8 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants { PhabricatorPHIDConstants::PHID_TYPE_CONP => 'ConpherenceThread', PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'PhrictionDocument', PhabricatorPHIDConstants::PHID_TYPE_ACNT => 'PhortuneAccount', + PhabricatorPHIDConstants::PHID_TYPE_PRCH => 'PhortunePurchase', + PhabricatorPHIDConstants::PHID_TYPE_CHRG => 'PhortuneCharge', ); $class = idx($class_map, $phid_type);