mcramer
2012-09-12 753da5086597913f77ae5dd6dab788a025b99c2b
interface/lib/classes/remoting.inc.php
@@ -1079,7 +1079,7 @@
               return false;
         }
            if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
         $affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params);
         $affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params, 'client:' . ($reseller_id ? 'reseller' : 'client') . ':on_after_update');
         
         $app->remoting_lib->ispconfig_sysuser_update($params,$client_id);
         
@@ -1255,6 +1255,8 @@
   //* Add a record
   public function sites_database_add($session_id, $client_id, $params)
    {
        global $app;
      if(!$this->checkPerm($session_id, 'sites_database_add')) {
         $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
         return false;
@@ -1277,6 +1279,8 @@
   //* Update a record
   public function sites_database_update($session_id, $client_id, $primary_id, $params)
    {
        global $app;
      if(!$this->checkPerm($session_id, 'sites_database_update')) {
         $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
         return false;
@@ -1298,6 +1302,7 @@
   //* Delete a record
   public function sites_database_delete($session_id, $primary_id)
    {
        global $app;
      if(!$this->checkPerm($session_id, 'sites_database_delete')) {
         $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
         return false;
@@ -2651,6 +2656,12 @@
      }
      */
      
        /* copied from the client_edit php */
      exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
      $app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
      exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
         
      //$app->uses('tform');
      //* Save changes to Datalog
@@ -2673,7 +2684,7 @@
    protected function insertQuery($formdef_file, $client_id, $params,$event_identifier = '')
    {
        $sql = $this->insertQueryPrepare($formdef_file, $client_id, $params);
        if($sql !== false) return $this->insertQueryExecute($sql, $params,$event_identifier = '');
        if($sql !== false) return $this->insertQueryExecute($sql, $params,$event_identifier);
        else return false;
    }
@@ -2695,7 +2706,7 @@
         $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
         return false;
      }
      $app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG);
        return $sql;
   }
   
@@ -2717,7 +2728,7 @@
      // set a few values for compatibility with tform actions, mostly used by plugins
      $this->id = $insert_id;
      $this->dataRecord = $params;
      $app->log('Executed insertQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
      if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
   
      //$app->uses('tform');
@@ -2734,7 +2745,7 @@
      global $app;
      
      $sql = $this->updateQueryPrepare($formdef_file, $client_id, $primary_id, $params);
        if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params,$event_identifier = '');
        if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params,$event_identifier);
        else return false;
   }
   
@@ -2782,6 +2793,7 @@
      }
      
      $affected_rows = $app->db->affectedRows();
      $app->log('Executed updateQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
      
      if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
      
@@ -2812,6 +2824,7 @@
      $this->oldDataRecord = $old_rec;
      $this->id = $primary_id;
      $this->dataRecord = $old_rec;
      $app->log('Executed deleteQuery, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
      //$this->dataRecord = $params;
      
      //* Get the SQL query