Ejemplo n.º 1
0
 protected function api_execute($module, $method, $data)
 {
     if ($this->auth !== null) {
         $this->auth->perform($data);
     }
     return $this->api->execute($module, $method, $data);
 }
Ejemplo n.º 2
0
 public function perform(IX4BApiClient $api, &$data)
 {
     if (!$this->logged_in) {
         $resp = $api->execute('User', 'login', array('username' => $this->username, 'password' => $this->password));
         if (!$resp || $resp['status'] != 'ok') {
             throw new ApiAuthorizationException();
         }
         $this->logged_in = true;
     }
 }