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 AlmanacServiceEditor extends AlmanacEditor { public function getEd..

Decoded Output download

<?php

final class AlmanacServiceEditor
  extends AlmanacEditor {

  public function getEditorObjectsDescription() {
    return pht('Almanac Service');
  }

  public function getCreateObjectTitle($author, $object) {
    return pht('%s created this service.', $author);
  }

  public function getCreateObjectTitleForFeed($author, $object) {
    return pht('%s created %s.', $author, $object);
  }

  public function getTransactionTypes() {
    $types = parent::getTransactionTypes();

    $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
    $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;

    return $types;
  }

  protected function validateAllTransactions(
    PhabricatorLiskDAO $object,
    array $xactions) {

    $errors = parent::validateAllTransactions($object, $xactions);

    if ($object->isClusterService()) {
      $can_manage = PhabricatorPolicyFilter::hasCapability(
        $this->getActor(),
        new PhabricatorAlmanacApplication(),
        AlmanacManageClusterServicesCapability::CAPABILITY);
      if (!$can_manage) {
        $errors[] = new PhabricatorApplicationTransactionValidationError(
          null,
          pht('Restricted'),
          pht('You do not have permission to manage cluster services.'),
          null);
      }
    }

    return $errors;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class AlmanacServiceEditor
  extends AlmanacEditor {

  public function getEditorObjectsDescription() {
    return pht('Almanac Service');
  }

  public function getCreateObjectTitle($author, $object) {
    return pht('%s created this service.', $author);
  }

  public function getCreateObjectTitleForFeed($author, $object) {
    return pht('%s created %s.', $author, $object);
  }

  public function getTransactionTypes() {
    $types = parent::getTransactionTypes();

    $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
    $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;

    return $types;
  }

  protected function validateAllTransactions(
    PhabricatorLiskDAO $object,
    array $xactions) {

    $errors = parent::validateAllTransactions($object, $xactions);

    if ($object->isClusterService()) {
      $can_manage = PhabricatorPolicyFilter::hasCapability(
        $this->getActor(),
        new PhabricatorAlmanacApplication(),
        AlmanacManageClusterServicesCapability::CAPABILITY);
      if (!$can_manage) {
        $errors[] = new PhabricatorApplicationTransactionValidationError(
          null,
          pht('Restricted'),
          pht('You do not have permission to manage cluster services.'),
          null);
      }
    }

    return $errors;
  }

}

Function Calls

None

Variables

None

Stats

MD5 7915cca80d8209911c597f2c8a799399
Eval Count 0
Decode Time 69 ms