Exemple #1
0
 /**
  * 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;
 }