| | |
| | | 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); |
| | | |
| | |
| | | //* 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; |
| | |
| | | //* 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; |
| | |
| | | //* 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; |
| | |
| | | } |
| | | */ |
| | | |
| | | /* 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 |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | $this->server->fault('data_processing_error', $app->remoting_lib->errorMessage); |
| | | return false; |
| | | } |
| | | |
| | | $app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG); |
| | | return $sql; |
| | | } |
| | | |
| | |
| | | // 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'); |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | $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); |
| | | |
| | |
| | | $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 |