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 DifferentialRevisionEditController extends DifferentialController { ..

Decoded Output download

<?php

final class DifferentialRevisionEditController
  extends DifferentialController {

  public function handleRequest(AphrontRequest $request) {
    $viewer = $this->getViewer();

    // If we have a Diff ID, this is an "/attach/123/to/456/" action. The
    // user just created a diff and is trying to use it to create or update
    // a revision.
    $diff_id = $request->getURIData('diffID');

    if ($diff_id) {
      $diff = id(new DifferentialDiffQuery())
        ->setViewer($viewer)
        ->withIDs(array($diff_id))
        ->executeOne();
      if (!$diff) {
        return new Aphront404Response();
      }

      if ($diff->getRevisionID()) {
        $revision = $diff->getRevision();
        return $this->newDialog()
          ->setTitle(pht('Diff Already Attached'))
          ->appendParagraph(
            pht(
              'This diff is already attached to a revision.'))
          ->addCancelButton($revision->getURI(), pht('Continue'));
      }
    } else {
      $diff = null;
    }

    $revision_id = $request->getURIData('id');
    if (!$diff && !$revision_id) {
      return $this->newDialog()
        ->setTitle(pht('Diff Required'))
        ->appendParagraph(
          pht(
            'You can not create a revision without a diff.'))
        ->addCancelButton($this->getApplicationURI());
    }

    $engine = id(new DifferentialRevisionEditEngine())
      ->setController($this);

    if ($diff) {
      $engine->setDiff($diff);
    }

    return $engine->buildResponse();
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class DifferentialRevisionEditController
  extends DifferentialController {

  public function handleRequest(AphrontRequest $request) {
    $viewer = $this->getViewer();

    // If we have a Diff ID, this is an "/attach/123/to/456/" action. The
    // user just created a diff and is trying to use it to create or update
    // a revision.
    $diff_id = $request->getURIData('diffID');

    if ($diff_id) {
      $diff = id(new DifferentialDiffQuery())
        ->setViewer($viewer)
        ->withIDs(array($diff_id))
        ->executeOne();
      if (!$diff) {
        return new Aphront404Response();
      }

      if ($diff->getRevisionID()) {
        $revision = $diff->getRevision();
        return $this->newDialog()
          ->setTitle(pht('Diff Already Attached'))
          ->appendParagraph(
            pht(
              'This diff is already attached to a revision.'))
          ->addCancelButton($revision->getURI(), pht('Continue'));
      }
    } else {
      $diff = null;
    }

    $revision_id = $request->getURIData('id');
    if (!$diff && !$revision_id) {
      return $this->newDialog()
        ->setTitle(pht('Diff Required'))
        ->appendParagraph(
          pht(
            'You can not create a revision without a diff.'))
        ->addCancelButton($this->getApplicationURI());
    }

    $engine = id(new DifferentialRevisionEditEngine())
      ->setController($this);

    if ($diff) {
      $engine->setDiff($diff);
    }

    return $engine->buildResponse();
  }

}

Function Calls

None

Variables

None

Stats

MD5 3197d1eaff038969c27796f54aa5a841
Eval Count 0
Decode Time 103 ms