vogelor
2010-05-04 4142f13c51fbfccb2effcbb0fed8fbbab3421def
interface/lib/classes/remoting.inc.php
@@ -40,6 +40,9 @@
   private $session_timeout = 600;
   
   private $server;
   public $oldDataRecord;
   public $dataRecord;
   public $id;
   
   /*
   These variables shall stay global. 
@@ -232,33 +235,39 @@
   
   public function mail_user_filter_add($session_id, $client_id, $params)
   {
      global $app;
      if (!$this->checkPerm($session_id, 'mail_user_filter_add')){
         $this->server->fault('permission_denied','You do not have the permissions to access this function.');
         return false;
      }
      $affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params);
      $app->plugin->raiseEvent('mail:mail_user_filter:on_after_insert',$this);
      return $affected_rows;
   }
   public function mail_user_filter_update($session_id, $client_id, $primary_id, $params)
   {
      global $app;
      if (!$this->checkPerm($session_id, 'mail_user_filter_update'))
      {
         $this->server->fault('permission_denied','You do not have the permissions to access this function.');
         return false;
      }
      $affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params);
      $app->plugin->raiseEvent('mail:mail_user_filter:on_after_update',$this);
      return $affected_rows;
   }
   public function mail_user_filter_delete($session_id,$domain_id)
   {
      global $app;
      if (!$this->checkPerm($session_id, 'mail_user_filter_delete'))
      {
         $this->server->fault('permission_denied','You do not have the permissions to access this function.');
         return false;
      }
      $affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php',$domain_id);
      $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
      return $affected_rows;
   }
@@ -882,6 +891,26 @@
      $app->uses('remoting_lib');
      $app->remoting_lib->loadFormDef('../client/form/client.tform.php');
      return $app->remoting_lib->getDataRecord($client_id);
   }
   public function client_get_id($session_id, $sys_userid)
    {
      global $app;
      if(!$this->checkPerm($session_id, 'client_get')) {
         $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
         return false;
      }
      $sys_userid = intval($sys_userid);
      $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
      if(isset($rec['client_id'])) {
         return intval($rec['client_id']);
      } else {
         $this->server->fault('no_client_found', 'There is no sysuser account for this client ID.');
         return false;
      }
   }
   
   
@@ -1913,11 +1942,11 @@
      
      $app->uses('remoting_lib');
      
      //* Load the form definition
      $app->remoting_lib->loadFormDef($formdef_file);
      //* load the user profile of the client
      $app->remoting_lib->loadUserProfile($client_id);
      //* Load the form definition
      $app->remoting_lib->loadFormDef($formdef_file);
      
      //* Get the SQL query
      $sql = $app->remoting_lib->getSQL($params,'INSERT',0);
@@ -1945,7 +1974,9 @@
         
      }
      
      // set a few values for compatibility with tform actions, mostly used by plugins
      $this->id = $insert_id;
      $this->dataRecord = $params;
      
      
      return $insert_id;
@@ -1958,11 +1989,11 @@
      
      $app->uses('remoting_lib');
      
      //* Load the form definition
      $app->remoting_lib->loadFormDef($formdef_file);
      //* load the user profile of the client
      $app->remoting_lib->loadUserProfile($client_id);
      //* Load the form definition
      $app->remoting_lib->loadFormDef($formdef_file);
      
      //* Get the SQL query
      $sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id);
@@ -1972,6 +2003,12 @@
      }
      
      $old_rec = $app->remoting_lib->getDataRecord($primary_id);
      // set a few values for compatibility with tform actions, mostly used by plugins
      $this->oldDataRecord = $old_rec;
      $this->id = $primary_id;
      $this->dataRecord = $params;
      
      $app->db->query($sql);
      
@@ -1999,6 +2036,9 @@
      
      $app->uses('remoting_lib');
      
      //* load the user profile of the client
      $app->remoting_lib->loadUserProfile($client_id);
      //* Load the form definition
      $app->remoting_lib->loadFormDef($formdef_file);