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 PhabricatorChatLogQuery extends PhabricatorCursorPagedPolicyAwareQuer..

Decoded Output download

<?php

final class PhabricatorChatLogQuery
  extends PhabricatorCursorPagedPolicyAwareQuery {

  private $channelIDs;
  private $maximumEpoch;

  public function withChannelIDs(array $channel_ids) {
    $this->channelIDs = $channel_ids;
    return $this;
  }

  public function withMaximumEpoch($epoch) {
    $this->maximumEpoch = $epoch;
    return $this;
  }

  protected function loadPage() {
    $table  = new PhabricatorChatLogEvent();
    $conn_r = $table->establishConnection('r');

    $data = queryfx_all(
      $conn_r,
      'SELECT * FROM %T e %Q %Q %Q',
      $table->getTableName(),
      $this->buildWhereClause($conn_r),
      $this->buildOrderClause($conn_r),
      $this->buildLimitClause($conn_r));

    $logs = $table->loadAllFromArray($data);

    return $logs;
  }

  protected function willFilterPage(array $events) {
    $channel_ids = mpull($events, 'getChannelID', 'getChannelID');

    $channels = id(new PhabricatorChatLogChannelQuery())
      ->setViewer($this->getViewer())
      ->withIDs($channel_ids)
      ->execute();
    $channels = mpull($channels, null, 'getID');

    foreach ($events as $key => $event) {
      $channel = idx($channels, $event->getChannelID());
      if (!$channel) {
        unset($events[$key]);
        continue;
      }

      $event->attachChannel($channel);
    }

    return $events;
  }

  protected function buildWhereClause(AphrontDatabaseConnection $conn) {
    $where = array();

    $where[] = $this->buildPagingClause($conn);

    if ($this->maximumEpoch !== null) {
      $where[] = qsprintf(
        $conn,
        'epoch <= %d',
        $this->maximumEpoch);
    }

    if ($this->channelIDs !== null) {
      $where[] = qsprintf(
        $conn,
        'channelID IN (%Ld)',
        $this->channelIDs);
    }

    return $this->formatWhereClause($conn, $where);
  }

  public function getQueryApplicationClass() {
    return 'PhabricatorChatLogApplication';
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorChatLogQuery
  extends PhabricatorCursorPagedPolicyAwareQuery {

  private $channelIDs;
  private $maximumEpoch;

  public function withChannelIDs(array $channel_ids) {
    $this->channelIDs = $channel_ids;
    return $this;
  }

  public function withMaximumEpoch($epoch) {
    $this->maximumEpoch = $epoch;
    return $this;
  }

  protected function loadPage() {
    $table  = new PhabricatorChatLogEvent();
    $conn_r = $table->establishConnection('r');

    $data = queryfx_all(
      $conn_r,
      'SELECT * FROM %T e %Q %Q %Q',
      $table->getTableName(),
      $this->buildWhereClause($conn_r),
      $this->buildOrderClause($conn_r),
      $this->buildLimitClause($conn_r));

    $logs = $table->loadAllFromArray($data);

    return $logs;
  }

  protected function willFilterPage(array $events) {
    $channel_ids = mpull($events, 'getChannelID', 'getChannelID');

    $channels = id(new PhabricatorChatLogChannelQuery())
      ->setViewer($this->getViewer())
      ->withIDs($channel_ids)
      ->execute();
    $channels = mpull($channels, null, 'getID');

    foreach ($events as $key => $event) {
      $channel = idx($channels, $event->getChannelID());
      if (!$channel) {
        unset($events[$key]);
        continue;
      }

      $event->attachChannel($channel);
    }

    return $events;
  }

  protected function buildWhereClause(AphrontDatabaseConnection $conn) {
    $where = array();

    $where[] = $this->buildPagingClause($conn);

    if ($this->maximumEpoch !== null) {
      $where[] = qsprintf(
        $conn,
        'epoch <= %d',
        $this->maximumEpoch);
    }

    if ($this->channelIDs !== null) {
      $where[] = qsprintf(
        $conn,
        'channelID IN (%Ld)',
        $this->channelIDs);
    }

    return $this->formatWhereClause($conn, $where);
  }

  public function getQueryApplicationClass() {
    return 'PhabricatorChatLogApplication';
  }

}

Function Calls

None

Variables

None

Stats

MD5 5729e93c4c8e09e7248142bc308f4945
Eval Count 0
Decode Time 91 ms