Esempio n. 1
0
 public function envelope($data)
 {
     global $AUTH, $DBO;
     $valid_formats = array("json");
     $this->_data = new stdClass();
     if (isset($data->id)) {
         $this->_id = (int) $data->id;
     }
     if (isset($data->token)) {
         $this->_token = dbo::escape($data->token);
     }
     if (isset($data->transaction)) {
         $this->_transaction = (int) $data->transaction;
     }
     if (isset($data->api)) {
         $this->_api = dbo::escape($data->api);
     }
     if (isset($data->data)) {
         $this->_data = $data->data;
     }
     if (isset($data->format) && in_array(strtolower($data->format), $valid_formats)) {
         $this->_format = strtolower($data->format);
     }
     if ($this->_id == -1) {
         return false;
     }
     global $DBO;
     $sql = "SELECT `a`.`space` FROM `##_customer` `a`\n\t\t                LEFT JOIN `##_auth_user` `b` ON (`b`.`customer_id`=`a`.`id`)\n\t\t                WHERE `a`.`deleted`=0 AND `b`.`id`='" . $this->_id . "' LIMIT 0,1;";
     $DBO->query($sql);
     if ($DBO->result_count != 1) {
         exit("Error: Table space could not be found!");
     }
     $this->_tbl_space = $DBO->result("single");
 }