コード例 #1
0
ファイル: authentication.php プロジェクト: ByteKing/Main
 /**
  * Checks if the selected server belongs to the user.
  *
  * @return bool
  */
 public final function isServer()
 {
     $permissions = new Permissions();
     if (!isset($_COOKIE['pp_server_hash']) || empty($_COOKIE['pp_server_hash'])) {
         return false;
     }
     $query = ORM::forTable('servers')->where(array('hash' => $_COOKIE['pp_server_hash'], 'active' => 1));
     if (!$this->isAdmin()) {
         $query->where_in('id', $permissions->listServers());
     }
     return $query->findOne();
 }
コード例 #2
0
ファイル: server.php プロジェクト: ByteKing/Main
 /**
  * Builds server data using a specified ID, Hash, and Root Administrator Status.
  *
  * @param string $hash The server hash.
  * @return mixed Returns an array on success or false on failure.
  */
 private function _buildData($hash)
 {
     $query = ORM::forTable('servers')->where(array('hash' => $hash, 'active' => 1));
     if (!User::isAdmin()) {
         $query->where_in('id', Permissions::listServers());
     }
     $this->server = $query->findOne();
     if (!$this->server) {
         $this->found_server = false;
         $this->found_node = false;
         return;
     } else {
         $this->found_server = true;
     }
     $this->node = ORM::forTable('nodes')->where(array('id' => $this->server->node))->findOne();
     $this->found_node = !$this->node ? false : true;
 }