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 ManiphestReplyHandler extends PhabricatorApplicationTransactionReplyH..

Decoded Output download

<?php

final class ManiphestReplyHandler
  extends PhabricatorApplicationTransactionReplyHandler {

  public function validateMailReceiver($mail_receiver) {
    if (!($mail_receiver instanceof ManiphestTask)) {
      throw new Exception(pht('Mail receiver is not a %s!', 'ManiphestTask'));
    }
  }

  public function getObjectPrefix() {
    return 'T';
  }

  protected function didReceiveMail(
    PhabricatorMetaMTAReceivedMail $mail,
    $body) {

    $object = $this->getMailReceiver();
    $is_new = !$object->getID();
    $actor = $this->getActor();

    $xactions = array();

    if ($is_new) {
      $xactions[] = $this->newTransaction()
        ->setTransactionType(PhabricatorTransactions::TYPE_CREATE)
        ->setNewValue(true);

      $xactions[] = $this->newTransaction()
        ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE)
        ->setNewValue(nonempty($mail->getSubject(), pht('Untitled Task')));

      $xactions[] = $this->newTransaction()
        ->setTransactionType(
          ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE)
        ->setNewValue($body);

      $actor_phid = $actor->getPHID();
      if ($actor_phid) {
        $xactions[] = $this->newTransaction()
          ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
          ->setNewValue(
            array(
              '+' => array($actor_phid),
            ));
      }
    }

    return $xactions;
  }


}
 ?>

Did this file decode correctly?

Original Code

<?php

final class ManiphestReplyHandler
  extends PhabricatorApplicationTransactionReplyHandler {

  public function validateMailReceiver($mail_receiver) {
    if (!($mail_receiver instanceof ManiphestTask)) {
      throw new Exception(pht('Mail receiver is not a %s!', 'ManiphestTask'));
    }
  }

  public function getObjectPrefix() {
    return 'T';
  }

  protected function didReceiveMail(
    PhabricatorMetaMTAReceivedMail $mail,
    $body) {

    $object = $this->getMailReceiver();
    $is_new = !$object->getID();
    $actor = $this->getActor();

    $xactions = array();

    if ($is_new) {
      $xactions[] = $this->newTransaction()
        ->setTransactionType(PhabricatorTransactions::TYPE_CREATE)
        ->setNewValue(true);

      $xactions[] = $this->newTransaction()
        ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE)
        ->setNewValue(nonempty($mail->getSubject(), pht('Untitled Task')));

      $xactions[] = $this->newTransaction()
        ->setTransactionType(
          ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE)
        ->setNewValue($body);

      $actor_phid = $actor->getPHID();
      if ($actor_phid) {
        $xactions[] = $this->newTransaction()
          ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
          ->setNewValue(
            array(
              '+' => array($actor_phid),
            ));
      }
    }

    return $xactions;
  }


}

Function Calls

None

Variables

None

Stats

MD5 373bc163e8474cc54090f13067fd96b9
Eval Count 0
Decode Time 163 ms