Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php final class PhortuneMerchantAddManagerController extends PhortuneMerchantControll..

Decoded Output download

<?php

final class PhortuneMerchantAddManagerController
  extends PhortuneMerchantController {

  protected function shouldRequireMerchantEditCapability() {
    return true;
  }

  protected function handleMerchantRequest(AphrontRequest $request) {
    $viewer = $request->getViewer();
    $merchant = $this->getMerchant();

    $v_members = array();
    $e_members = null;
    $merchant_uri = $merchant->getManagersURI();

    if ($request->isFormOrHiSecPost()) {
      $xactions = array();
      $v_members = $request->getArr('managerPHIDs');
      $type_edge = PhabricatorTransactions::TYPE_EDGE;

      $xactions[] = id(new PhortuneMerchantTransaction())
        ->setTransactionType($type_edge)
        ->setMetadataValue(
          'edge:type',
          PhortuneMerchantHasMemberEdgeType::EDGECONST)
        ->setNewValue(
          array(
            '+' => array_fuse($v_members),
          ));

      $editor = id(new PhortuneMerchantEditor())
        ->setActor($viewer)
        ->setContentSourceFromRequest($request)
        ->setContinueOnNoEffect(true);

      try {
        $editor->applyTransactions($merchant, $xactions);

        return id(new AphrontRedirectResponse())->setURI($merchant_uri);
      } catch (PhabricatorApplicationTransactionValidationException $ex) {
        $validation_exception = $ex;
        $e_members = $ex->getShortMessage($type_edge);
      }
    }

    $form = id(new AphrontFormView())
      ->setUser($viewer)
      ->appendControl(
        id(new AphrontFormTokenizerControl())
          ->setDatasource(new PhabricatorPeopleDatasource())
          ->setLabel(pht('New Managers'))
          ->setName('managerPHIDs')
          ->setValue($v_members)
          ->setError($e_members));

    return $this->newDialog()
      ->setTitle(pht('Add New Managers'))
      ->appendForm($form)
      ->setWidth(AphrontDialogView::WIDTH_FORM)
      ->addCancelButton($merchant_uri)
      ->addSubmitButton(pht('Add Manager'));

  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhortuneMerchantAddManagerController
  extends PhortuneMerchantController {

  protected function shouldRequireMerchantEditCapability() {
    return true;
  }

  protected function handleMerchantRequest(AphrontRequest $request) {
    $viewer = $request->getViewer();
    $merchant = $this->getMerchant();

    $v_members = array();
    $e_members = null;
    $merchant_uri = $merchant->getManagersURI();

    if ($request->isFormOrHiSecPost()) {
      $xactions = array();
      $v_members = $request->getArr('managerPHIDs');
      $type_edge = PhabricatorTransactions::TYPE_EDGE;

      $xactions[] = id(new PhortuneMerchantTransaction())
        ->setTransactionType($type_edge)
        ->setMetadataValue(
          'edge:type',
          PhortuneMerchantHasMemberEdgeType::EDGECONST)
        ->setNewValue(
          array(
            '+' => array_fuse($v_members),
          ));

      $editor = id(new PhortuneMerchantEditor())
        ->setActor($viewer)
        ->setContentSourceFromRequest($request)
        ->setContinueOnNoEffect(true);

      try {
        $editor->applyTransactions($merchant, $xactions);

        return id(new AphrontRedirectResponse())->setURI($merchant_uri);
      } catch (PhabricatorApplicationTransactionValidationException $ex) {
        $validation_exception = $ex;
        $e_members = $ex->getShortMessage($type_edge);
      }
    }

    $form = id(new AphrontFormView())
      ->setUser($viewer)
      ->appendControl(
        id(new AphrontFormTokenizerControl())
          ->setDatasource(new PhabricatorPeopleDatasource())
          ->setLabel(pht('New Managers'))
          ->setName('managerPHIDs')
          ->setValue($v_members)
          ->setError($e_members));

    return $this->newDialog()
      ->setTitle(pht('Add New Managers'))
      ->appendForm($form)
      ->setWidth(AphrontDialogView::WIDTH_FORM)
      ->addCancelButton($merchant_uri)
      ->addSubmitButton(pht('Add Manager'));

  }

}

Function Calls

None

Variables

None

Stats

MD5 0a21b758cd364c48cc9d0a06b01ffc0f
Eval Count 0
Decode Time 121 ms