From fbdcc4579d09d6069d3b72fc1c0ae5f1b6891e79 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 19 Nov 2009 08:44:03 -0500
Subject: [PATCH] - Updated Bind export script. - Added missing remoting functions
---
interface/web/admin/form/remote_user.tform.php | 65
/dev/null | 88 -
remoting_client/examples/soap-client-add.php | 80 +
remoting_client/examples/soap-client-update.php | 83 +
interface/lib/classes/remoting.inc.php | 984 +++++++++++++++++++
interface/lib/classes/remoting_lib.inc.php | 1479 ++++++++++++++--------------
interface/web/mail/form/spamfilter_policy.tform.php | 2
helper_scripts/dns_export_to_bind.php | 142 +-
remoting_client/examples/soap-client-delete.php | 29
remoting_client/examples/soap_config.php | 14
10 files changed, 2,038 insertions(+), 928 deletions(-)
diff --git a/helper_scripts/dns_export_to_bind.php b/helper_scripts/dns_export_to_bind.php
index 9ce662b..56628d7 100644
--- a/helper_scripts/dns_export_to_bind.php
+++ b/helper_scripts/dns_export_to_bind.php
@@ -1,72 +1,72 @@
-<?php
-$host="IP-Adresse-ISP-CONFIG-Master-Server";
-$user="MYSQL-USER";
-$password="PASSWORD";
-mysql_connect($host,$user,$password) or die(mysql_error());
-mysql_select_db("dbispconfig");
-$result = "";
-$result = mysql_query("SELECT id,origin,ns,ttl,mbox,serial,refresh,retry,expire,minimum FROM dns_soa;");
-function hostname2ipfunktion($tmp1, $timeout = 1)
- {
- if ($tmp1 == 0)
- {
- $query = `nslookup -timeout=$timeout -retry=0 $tmp1`;
- if(preg_match('/\nAddress: (.*)\n/', $query, $matches))
- return trim($matches[1]);
- return $tmp1;
- }
- }
-
-while($row = mysql_fetch_array($result))
- {
-### Hier ALLES Aktivieren bei Primary Nameserver ########################################################################################
- $varx11=substr($row["origin"],0,-1);
- unlink("/var/cache/bind/$varx11");
- $arr1[$x11]="zone \"$varx11\" in { type master; file \"$varx11\"; };\n";
- $x11=$x11+1;
- $result2 = mysql_query("select name,type,aux,data from dns_rr where zone=$row[id] ORDER BY name ASC;");
- $arr3[0]="\$TTL ".$row['ttl']."\n@ IN SOA ".$row['ns']." ".$row['mbox']." (\n ".$row['serial']." ;Serial\n"." ".$row['refresh']." ;Refresh\n"." ".$row['retry']." ;Retry\n"." ".$row['expire']." ;Expire\n"." ".$row['minimum']." ) ;Minimum\n\n";
-
- $xx1=1;
- while($row2 = mysql_fetch_row($result2))
- {
- $arr2[$xx1]=$row2['0']." IN ".$row2['1']." ";
-
- if ($row2['2']>0)
- {
- $arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n";
- }
- else
- {
- $arr3[$xx1]=$arr2[$xx1].$row2['3']."\n";
- }
- $xx1=$xx1+1;
- }
- $f = fopen("/var/cache/bind/$varx11", "a+");
- foreach($arr3 as $values) fputs($f, $values);
- fclose($f);
- $arr2=array();
- $arr3=array();
-### ENDE Prim�rer Nameserver ###########################################################################################################
-
-### Hier ALLES Aktivieren bei Secondary Nameserver ######################################################################################
-# $tmp1 = substr($row["ns"],0,-1);
-# $tmp2 = substr($row["origin"],0,-1);
-# $nsip = hostname2ipfunktion($tmp1);
-# if ($nsip == $tmp1) # {
-# echo "$tmp2 $tmp1 Not a valid Nameserver";
-# echo "\n";
-# }
-# else # {
-# $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n";
-# $x11=$x11+1;
-# }
-### ENDE Secondary Nameserver ###########################################################################################################
- }
-
-unlink ("/etc/bind/named.conf.local");
-$fx = fopen("/etc/bind/named.conf.local", "a+");
-foreach($arr1 as $values) fputs($fx, $values);
-fclose($fx);
-exec("/etc/init.d/bind9 reload");
+<?php
+$host="IP-Adresse-ISP-CONFIG-Master-Server";
+$user="MYSQL-USER";
+$password="PASSWORD";
+mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_select_db("dbispconfig");
+$result = "";
+$result = mysql_query("SELECT id,origin,ns,ttl,mbox,serial,refresh,retry,expire,minimum FROM dns_soa;");
+function hostname2ipfunktion($tmp1, $timeout = 1)
+ {
+ if ($tmp1 == 0)
+ {
+ $query = `nslookup -timeout=$timeout -retry=0 $tmp1`;
+ if(preg_match('/\nAddress: (.*)\n/', $query, $matches))
+ return trim($matches[1]);
+ return $tmp1;
+ }
+ }
+
+while($row = mysql_fetch_array($result))
+ {
+### Hier ALLES Aktivieren bei Primary Nameserver ########################################################################################
+ $varx11=substr($row["origin"],0,-1);
+ unlink("/var/cache/bind/$varx11");
+ $arr1[$x11]="zone \"$varx11\" in { type master; file \"$varx11\"; };\n";
+ $x11=$x11+1;
+ $result2 = mysql_query("select name,type,aux,data from dns_rr where zone=$row[id] ORDER BY name ASC;");
+ $arr3[0]="\$TTL ".$row['ttl']."\n@ IN SOA ".$row['ns']." ".$row['mbox']." (\n ".$row['serial']." ;Serial\n"." ".$row['refresh']." ;Refresh\n"." ".$row['retry']." ;Retry\n"." ".$row['expire']." ;Expire\n"." ".$row['minimum']." ) ;Minimum\n\n";
+
+ $xx1=1;
+ while($row2 = mysql_fetch_row($result2))
+ {
+ $arr2[$xx1]=$row2['0']." IN ".$row2['1']." ";
+
+ if ($row2['2']>0)
+ {
+ $arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n";
+ }
+ else
+ {
+ $arr3[$xx1]=$arr2[$xx1].$row2['3']."\n";
+ }
+ $xx1=$xx1+1;
+ }
+ $f = fopen("/var/cache/bind/$varx11", "a+");
+ foreach($arr3 as $values) fputs($f, $values);
+ fclose($f);
+ $arr2=array();
+ $arr3=array();
+### ENDE Prim�rer Nameserver ###########################################################################################################
+
+### Hier ALLES Aktivieren bei Secondary Nameserver ######################################################################################
+# $tmp1 = substr($row["ns"],0,-1);
+# $tmp2 = substr($row["origin"],0,-1);
+# $nsip = hostname2ipfunktion($tmp1);
+# if ($nsip == $tmp1) # {
+# echo "$tmp2 $tmp1 Not a valid Nameserver";
+# echo "\n";
+# }
+# else # {
+# $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n";
+# $x11=$x11+1;
+# }
+### ENDE Secondary Nameserver ###########################################################################################################
+ }
+
+unlink ("/etc/bind/named.conf.local");
+$fx = fopen("/etc/bind/named.conf.local", "a+");
+foreach($arr1 as $values) fputs($fx, $values);
+fclose($fx);
+exec("/etc/init.d/bind9 reload");
?>
\ No newline at end of file
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 07b28f3..7e4256e 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -1,7 +1,7 @@
<?php
/*
-Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -866,24 +866,992 @@
*
*
*
- * * klient add :)
+ * * Client functions
*
*
*/
-
- public function client_add($session_id,$domain_id, $client_id, $params)
+ //* Get client details
+ public function client_get($session_id, $client_id)
+ {
+ 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;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../client/form/client.tform.php');
+ return $app->remoting_lib->getDataRecord($client_id);
+ }
+
+
+ public function client_add($session_id, $reseller_id, $params)
{
if (!$this->checkPerm($session_id, 'client_add'))
{
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
- $affected_rows = $this->klientadd('../client/form/client.tform.php',$domain_id, $client_id, $params);
+ $affected_rows = $this->klientadd('../client/form/client.tform.php',$reseller_id, $params);
return $affected_rows;
}
+
+ public function client_update($session_id, $reseller_id, $client_id, $params)
+ {
+ global $app;
+
+ if (!$this->checkPerm($session_id, 'client_update'))
+ {
+ $this->server->fault('permission_denied','You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../client/form/client.tform.php', $reseller_id, $client_id, $params);
+
+ $app->remoting_lib->ispconfig_sysuser_update($params,$client_id);
+
+ return $affected_rows;
+ }
+ public function client_delete($session_id,$client_id)
+ {
+ global $app;
+
+ if (!$this->checkPerm($session_id, 'client_delete'))
+ {
+ $this->server->fault('permission_denied','You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id);
+
+ $app->remoting_lib->ispconfig_sysuser_delete($client_id);
+
+ return $affected_rows;
+ }
+
+ // Website functions ---------------------------------------------------------------------------------------
+
+ //* Get cron details
+ public function sites_cron_get($session_id, $cron_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_cron_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/cron.tform.php');
+ return $app->remoting_lib->getDataRecord($cron_id);
+ }
+
+ //* Add a cron record
+ public function sites_cron_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_cron_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../sites/form/cron.tform.php',$client_id,$params);
+ }
+
+ //* Update cron record
+ public function sites_cron_update($session_id, $client_id, $cron_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_cron_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/cron.tform.php',$client_id,$cron_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete cron record
+ public function sites_cron_delete($session_id, $cron_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_cron_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/cron.tform.php',$cron_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_database_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_database_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/database.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_database_add($session_id, $client_id, $params)
+ {
+ 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;
+ }
+ return $this->insertQuery('../sites/form/database.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function sites_database_update($session_id, $client_id, $primary_id, $params)
+ {
+ 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;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/database.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_database_delete($session_id, $primary_id)
+ {
+ 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;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/database.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_ftp_user_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_ftp_user_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/ftp_user.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_ftp_user_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_ftp_user_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../sites/form/ftp_user.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_ftp_user_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_ftp_user_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_ftp_user_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_shell_user_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_shell_user_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/shell_user.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_shell_user_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_shell_user_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../sites/form/shell_user.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function sites_shell_user_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_shell_user_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_shell_user_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_shell_user_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_web_domain_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_web_domain_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/web_domain.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_web_domain_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_domain_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_domain_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_web_domain_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_domain_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // -----------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_web_aliasdomain_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/web_aliasdomain.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_web_aliasdomain_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_web_aliasdomain_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function sites_web_subdomain_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../sites/form/web_subdomain.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function sites_web_subdomain_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../sites/form/web_subdomain.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function sites_web_subdomain_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+
+ // DNS Function --------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_zone_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_zone_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_zone_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_zone_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_soa.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_zone_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_zone_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_zone_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_zone_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_aaaa_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_aaaa_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_aaaa_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_aaaa_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_aaaa.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_aaaa_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_aaaa_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_aaaa_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_a_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_a_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_a_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_a_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_a.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_a_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_a_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_a_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_a_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_alias_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_alias_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_alias_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_alias_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_alias.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_alias_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_alias_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_alias_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_alias_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_cname_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_cname_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_cname_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_cname_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_cname.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_cname_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_cname_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_cname_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_cname_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_hinfo_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_hinfo_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_hinfo_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_hinfo_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_hinfo.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_hinfo_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_hinfo_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_hinfo_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_mx_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_mx_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_mx_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_mx_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_mx.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_mx_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_mx_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_mx_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_mx_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_ns_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_ns_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_ns_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_ns_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_ns.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_ns_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_ns_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_ns_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_ns_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_ptr_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_ptr_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_ptr_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_ptr_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_ptr.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_ptr_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_ptr_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_ptr_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_ptr_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_rp_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_rp_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_rp_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_rp_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_rp.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_rp_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_rp_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_rp_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_rp_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_srv_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_srv_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_srv_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_srv_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_srv.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_srv_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_srv_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_srv_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_srv_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+
+ //* Get record details
+ public function dns_txt_get($session_id, $primary_id)
+ {
+ global $app;
+
+ if(!$this->checkPerm($session_id, 'dns_txt_get')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $app->uses('remoting_lib');
+ $app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php');
+ return $app->remoting_lib->getDataRecord($primary_id);
+ }
+
+ //* Add a record
+ public function dns_txt_add($session_id, $client_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_txt_add')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ return $this->insertQuery('../dns/form/dns_txt.tform.php',$client_id,$params);
+ }
+
+ //* Update a record
+ public function dns_txt_update($session_id, $client_id, $primary_id, $params)
+ {
+ if(!$this->checkPerm($session_id, 'dns_txt_update')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php',$client_id,$primary_id,$params);
+ return $affected_rows;
+ }
+
+ //* Delete a record
+ public function dns_txt_delete($session_id, $primary_id)
+ {
+ if(!$this->checkPerm($session_id, 'dns_txt_delete')) {
+ $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+ return false;
+ }
+ $affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php',$primary_id);
+ return $affected_rows;
+ }
+
+
+
+
+
+
+
+
+
+
@@ -892,7 +1860,7 @@
- private function klientadd($formdef_file, $client_id, $params)
+ private function klientadd($formdef_file, $reseller_id, $params)
{
global $app, $tform, $remoting_lib;
$app->uses('remoting_lib');
@@ -901,7 +1869,7 @@
$app->remoting_lib->loadFormDef($formdef_file);
//* load the user profile of the client
- $app->remoting_lib->loadUserProfile($client_id);
+ $app->remoting_lib->loadUserProfile($reseller_id);
//* Get the SQL query
$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
@@ -926,7 +1894,7 @@
$new_rec = $app->remoting_lib->getDataRecord($insert_id);
$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec);
- $app->remoting_lib->dodaj_usera($params,$insert_id);
+ $app->remoting_lib->ispconfig_sysuser_add($params,$insert_id);
}
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index a85b8fe..f5b88a5 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -1,731 +1,748 @@
-<?php
-
-/*
-Copyright (c) 2007, Till Brehm, projektfarm Gmbh
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of ISPConfig nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---UPDATED 08.2009--
-Full SOAP support for ISPConfig 3.1.4 b
-Updated by Arkadiusz Roch & Artur Edelman
-Copyright (c) Tri-Plex technology
-
-*/
-
-/**
-* Formularbehandlung
-*
-* Funktionen zur Umwandlung von Formulardaten
-* sowie zum vorbereiten von HTML und SQL
-* Ausgaben
-*
-* Tabellendefinition
-*
-* Datentypen:
-* - INTEGER (Wandelt Ausdr�cke in Int um)
-* - DOUBLE
-* - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
-* - VARCHAR (kein weiterer Format Check)
-* - DATE (Datumsformat, Timestamp Umwandlung)
-*
-* Formtype:
-* - TEXT (normales Textfeld)
-* - PASSWORD (Feldinhalt wird nicht angezeigt)
-* - SELECT (Gibt Werte als option Feld aus)
-* - MULTIPLE (Select-Feld mit nehreren Werten)
-*
-* VALUE:
-* - Wert oder Array
-*
-* SEPARATOR
-* - Trennzeichen f�r multiple Felder
-*
-* Hinweis:
-* Das ID-Feld ist nicht bei den Table Values einzuf�gen.
-*/
-
-class remoting_lib {
-
- /**
- * Definition of the database atble (array)
- * @var tableDef
- */
- private $tableDef;
-
- /**
- * Private
- * @var action
- */
- private $action;
-
- /**
- * Table name (String)
- * @var table_name
- */
- private $table_name;
-
- /**
- * Debug Variable
- * @var debug
- */
- private $debug = 0;
-
- /**
- * name of the primary field of the database table (string)
- * @var table_index
- */
- var $table_index;
-
- /**
- * contains the error messages
- * @var errorMessage
- */
- var $errorMessage = '';
-
- var $dateformat = "d.m.Y";
- var $formDef = array();
- var $wordbook;
- var $module;
- var $primary_id;
- var $diffrec = array();
-
- var $sys_username;
- var $sys_userid;
- var $sys_default_group;
- var $sys_groups;
-
-
- //* Load the form definition from file.
- function loadFormDef($file) {
- global $app,$conf;
-
- include_once($file);
-
- $this->formDef = $form;
- unset($this->formDef['tabs']);
-
- //* Copy all fields from all tabs into one form definition
- foreach($form['tabs'] as $tab) {
- foreach($tab['fields'] as $key => $value) {
- $this->formDef['fields'][$key] = $value;
- }
- }
- unset($form);
-
- return true;
- }
-
- //* Load the user profile
- function loadUserProfile($client_id = 0) {
- global $app,$conf;
-
- $client_id = intval($client_id);
-
- if($client_id == 0) {
- $this->sys_username = 'admin';
- $this->sys_userid = 1;
- $this->sys_default_group = 1;
- $this->sys_groups = 1;
- } else {
- //* Load the client data
- $client = $app->db->queryOneRecord("SELECT username FROM client WHERE client_id = $client_id");
- if($client["username"] == '') {
- $this->errorMessage .= 'No client with ID $client_id found.';
- return false;
- }
- //* load system user
- $user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$app->db->quote($client["username"])."'");
- if(empty($user["userid"])) {
- $this->errorMessage .= 'No user with the username '.$client['username'].' found.';
- return false;
- }
- $this->sys_username = $user['username'];
- $this->sys_userid = $user['userid'];
- $this->sys_default_group = $user['default_group'];
- $this->sys_groups = $user['groups'];
- }
-
- return true;
-
- }
-
-
- /**
- * Converts data in human readable form
- *
- * @param record
- * @return record
- */
- function decode($record) {
- $new_record = '';
- if(is_array($record)) {
- foreach($this->formDef['fields'] as $key => $field) {
- switch ($field['datatype']) {
- case 'VARCHAR':
- $new_record[$key] = stripslashes($record[$key]);
- break;
-
- case 'TEXT':
- $new_record[$key] = stripslashes($record[$key]);
- break;
-
- case 'DATE':
- if($record[$key] > 0) {
- $new_record[$key] = date($this->dateformat,$record[$key]);
- }
- break;
-
- case 'INTEGER':
- $new_record[$key] = intval($record[$key]);
- break;
-
- case 'DOUBLE':
- $new_record[$key] = $record[$key];
- break;
-
- case 'CURRENCY':
- $new_record[$key] = number_format($record[$key], 2, ',', '');
- break;
-
- default:
- $new_record[$key] = stripslashes($record[$key]);
- }
- }
-
- }
-
- return $new_record;
- }
-
- /**
- * Get the key => value array of a form filled from a datasource definitiom
- *
- * @param field = array with field definition
- * @param record = Dataset as array
- * @return key => value array for the value field of a form
- */
-
- function getDatasourceData($field, $record) {
- global $app;
-
- $values = array();
-
- if($field["datasource"]["type"] == 'SQL') {
-
- // Preparing SQL string. We will replace some
- // common placeholders
- $querystring = $field["datasource"]["querystring"];
- $querystring = str_replace("{USERID}",$this->sys_userid,$querystring);
- $querystring = str_replace("{GROUPID}",$this->sys_default_group,$querystring);
- $querystring = str_replace("{GROUPS}",$this->sys_groups,$querystring);
- $table_idx = $this->formDef['db_table_idx'];
-
- $tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
- $querystring = str_replace("{RECORDID}",$tmp_recordid,$querystring);
- unset($tmp_recordid);
-
- $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
-
- // Getting the records
- $tmp_records = $app->db->queryAllRecords($querystring);
- if($app->db->errorMessage != '') die($app->db->errorMessage);
- if(is_array($tmp_records)) {
- $key_field = $field["datasource"]["keyfield"];
- $value_field = $field["datasource"]["valuefield"];
- foreach($tmp_records as $tmp_rec) {
- $tmp_id = $tmp_rec[$key_field];
- $values[$tmp_id] = $tmp_rec[$value_field];
- }
- }
- }
-
- if($field["datasource"]["type"] == 'CUSTOM') {
- // Calls a custom class to validate this record
- if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
- $datasource_class = $field["datasource"]['class'];
- $datasource_function = $field["datasource"]['function'];
- $app->uses($datasource_class);
- $values = $app->$datasource_class->$datasource_function($field, $record);
- } else {
- $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
- }
- }
-
- return $values;
-
- }
-
- /**
- * Converts the data in a format to store it in the database table
- *
- * @param record = Datensatz als Array
- * @return record
- */
- function encode($record) {
-
- if(is_array($record)) {
- foreach($this->formDef['fields'] as $key => $field) {
-
- if(isset($field['validators']) && is_array($field['validators'])) $this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
-
- switch ($field['datatype']) {
- case 'VARCHAR':
- if(!@is_array($record[$key])) {
- $new_record[$key] = (isset($record[$key]))?mysql_real_escape_string($record[$key]):'';
- } else {
- $new_record[$key] = implode($field['separator'],$record[$key]);
- }
- break;
- case 'TEXT':
- if(!is_array($record[$key])) {
- $new_record[$key] = mysql_real_escape_string($record[$key]);
- } else {
- $new_record[$key] = implode($field['separator'],$record[$key]);
- }
- break;
- case 'DATE':
- if($record[$key] > 0) {
- list($tag,$monat,$jahr) = explode('.',$record[$key]);
- $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
- } else {
- $new_record[$key] = 0;
- }
- break;
- case 'INTEGER':
- $new_record[$key] = (isset($record[$key]))?intval($record[$key]):0;
- //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
- //if($key == 'refresh') die($record[$key]);
- break;
- case 'DOUBLE':
- $new_record[$key] = mysql_real_escape_string($record[$key]);
- break;
- case 'CURRENCY':
- $new_record[$key] = str_replace(",",".",$record[$key]);
- break;
- }
-
- // The use of the field value is deprecated, use validators instead
- if(isset($field['regex']) && $field['regex'] != '') {
- // Enable that "." matches also newlines
- $field['regex'] .= 's';
- if(!preg_match($field['regex'], $record[$key])) {
- $errmsg = $field['errmsg'];
- $this->errorMessage .= $errmsg."\r\n";
- }
- }
-
-
- }
- }
- return $new_record;
- }
-
- /**
- * process the validators for a given field.
- *
- * @param field_name = Name of the field
- * @param field_value = value of the field
- * @param validatoors = Array of validators
- * @return record
- */
-
- function validateField($field_name, $field_value, $validators) {
-
- global $app;
-
- $escape = '`';
-
- // loop trough the validators
- foreach($validators as $validator) {
-
- switch ($validator['type']) {
- case 'REGEX':
- $validator['regex'] .= 's';
- if(!preg_match($validator['regex'], $field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- break;
- case 'UNIQUE':
- if($this->action == 'NEW') {
- $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
- if($num_rec["number"] > 0) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- } else {
- $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
- if($num_rec["number"] > 0) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- }
- break;
- case 'NOTEMPTY':
- if(empty($field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- break;
- case 'ISEMAIL':
- if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- break;
- case 'ISINT':
- $tmpval = intval($field_value);
- if($tmpval === 0 and !empty($field_value)) {
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- break;
- case 'ISPOSITIVE':
- if(!is_numeric($field_value) || $field_value <= 0){
- $errmsg = $validator['errmsg'];
- if(isset($this->wordbook[$errmsg])) {
- $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
- } else {
- $this->errorMessage .= $errmsg."<br>\r\n";
- }
- }
- break;
- case 'CUSTOM':
- // Calls a custom class to validate this record
- if($validator['class'] != '' and $validator['function'] != '') {
- $validator_class = $validator['class'];
- $validator_function = $validator['function'];
- $app->uses($validator_class);
- $this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
- } else {
- $this->errorMessage .= "Custom validator class or function is empty<br>\r\n";
- }
- break;
- default:
- $this->errorMessage .= "Unknown Validator: ".$validator['type'];
- break;
- }
-
-
- }
-
- return true;
- }
-
- /**
- * Create SQL statement
- *
- * @param record = Datensatz als Array
- * @param action = INSERT oder UPDATE
- * @param primary_id
- * @return record
- */
- function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-
- global $app;
-
- $this->action = $action;
- $this->primary_id = $primary_id;
-
- $record = $this->encode($record,$tab);
- $sql_insert_key = '';
- $sql_insert_val = '';
- $sql_update = '';
-
- if(!is_array($this->formDef)) $app->error("No form definition found.");
-
- // gehe durch alle Felder des Tabs
- if(is_array($record)) {
- foreach($this->formDef['fields'] as $key => $field) {
- // Wenn es kein leeres Passwortfeld ist
- if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
- // Erzeuge Insert oder Update Quelltext
- if($action == "INSERT") {
- if($field['formtype'] == 'PASSWORD') {
- $sql_insert_key .= "`$key`, ";
- if($field['encryption'] == 'CRYPT') {
- $salt="$1$";
- for ($n=0;$n<8;$n++) {
- $salt.=chr(mt_rand(64,126));
- }
- $salt.="$";
- // $salt = substr(md5(time()),0,2);
- $record[$key] = crypt($record[$key],$salt);
- } else {
- $record[$key] = md5($record[$key]);
- }
- $sql_insert_val .= "'".$record[$key]."', ";
- } elseif ($field['formtype'] == 'CHECKBOX') {
- $sql_insert_key .= "`$key`, ";
- if($record[$key] == '') {
- // if a checkbox is not set, we set it to the unchecked value
- $sql_insert_val .= "'".$field['value'][0]."', ";
- $record[$key] = $field['value'][0];
- } else {
- $sql_insert_val .= "'".$record[$key]."', ";
- }
- } else {
- $sql_insert_key .= "`$key`, ";
- $sql_insert_val .= "'".$record[$key]."', ";
- }
- } else {
- if($field['formtype'] == 'PASSWORD') {
- if($field['encryption'] == 'CRYPT') {
- $salt="$1$";
- for ($n=0;$n<8;$n++) {
- $salt.=chr(mt_rand(64,126));
- }
- $salt.="$";
- // $salt = substr(md5(time()),0,2);
- $record[$key] = crypt($record[$key],$salt);
- } else {
- $record[$key] = md5($record[$key]);
- }
- $sql_update .= "`$key` = '".$record[$key]."', ";
- } elseif ($field['formtype'] == 'CHECKBOX') {
- if($record[$key] == '') {
- // if a checkbox is not set, we set it to the unchecked value
- $sql_update .= "`$key` = '".$field['value'][0]."', ";
- $record[$key] = $field['value'][0];
- } else {
- $sql_update .= "`$key` = '".$record[$key]."', ";
- }
- } else {
- $sql_update .= "`$key` = '".$record[$key]."', ";
- }
- }
- } else {
- // we unset the password filed, if empty to tell the datalog function
- // that the password has not been changed
- unset($record[$key]);
- }
- }
- }
-
-
-
- if(stristr($this->formDef['db_table'],'.')) {
- $escape = '';
- } else {
- $escape = '`';
- }
-
-
- if($action == "INSERT") {
- if($this->formDef['auth'] == 'yes') {
- // Setze User und Gruppe
- $sql_insert_key .= "`sys_userid`, ";
- $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$this->sys_userid."', ";
- $sql_insert_key .= "`sys_groupid`, ";
- $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$this->sys_default_group."', ";
- $sql_insert_key .= "`sys_perm_user`, ";
- $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
- $sql_insert_key .= "`sys_perm_group`, ";
- $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
- $sql_insert_key .= "`sys_perm_other`, ";
- $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
- }
- $sql_insert_key = substr($sql_insert_key,0,-2);
- $sql_insert_val = substr($sql_insert_val,0,-2);
- $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
- } else {
- if($primary_id != 0) {
- $sql_update = substr($sql_update,0,-2);
- $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
- if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
- } else {
- $app->error("Primary ID fehlt!");
- }
- }
-
- return $sql;
- }
-
- function getDeleteSQL($primary_id) {
-
- if(stristr($this->formDef['db_table'],'.')) {
- $escape = '';
- } else {
- $escape = '`';
- }
-
- $sql = "DELETE FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
- return $sql;
- }
-
-
- function getDataRecord($primary_id) {
- global $app;
- $escape = '`';
- if(@is_numeric($primary_id)) {
- $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
- return $app->db->queryOneRecord($sql);
- } elseif (@is_array($primary_id)) {
- $sql_where = '';
- foreach($primary_id as $key => $val) {
- $key = $app->db->quote($key);
- $val = $app->db->quote($val);
- $sql_where .= "$key = '$val' AND ";
- }
- $sql_where = substr($sql_where,0,-5);
- $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where;
- return $app->db->queryAllRecords($sql);
- } else {
- $this->errorMessage = 'The ID must be either an integer or an array.';
- return array();
- }
-
-
- }
-
- function dodaj_usera($params,$insert_id){
- global $app,$sql1;
- $username = $params["username"];
- $password = $params["password"];
- $modules = 'mail,sites,dns,tools';
- $startmodule = 'mail';
- $usertheme = $params["usertheme"];
- $type = 'user';
- $active = 1;
- $language = $params["language"];
- $groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
- $groups = $groupid;
- $sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
- VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
- $app->db->query($sql1);
- }
-
- function datalogSave($action,$primary_id, $record_old, $record_new) {
- global $app,$conf;
-
- if(stristr($this->formDef['db_table'],'.')) {
- $escape = '';
- } else {
- $escape = '`';
- }
-
- $diffrec = array();
-
- if(is_array($record_new) && count($record_new) > 0) {
- foreach($record_new as $key => $val) {
- if($record_old[$key] != $val) {
- // Record has changed
- $diffrec[$key] = array('old' => $record_old[$key],
- 'new' => $val);
- }
- }
- } elseif(is_array($record_old)) {
- foreach($record_old as $key => $val) {
- if($record_new[$key] != $val) {
- // Record has changed
- $diffrec[$key] = array('new' => $record_new[$key],
- 'old' => $val);
- }
- }
- }
- $this->diffrec = $diffrec;
-
-
- // Full diff records for ISPConfig, they have a different format then the simple diffrec
- $diffrec_full = array();
-
- if(is_array($record_old) && count($record_old) > 0) {
- foreach($record_old as $key => $val) {
- if(isset($record_new[$key]) && $record_new[$key] != $val) {
- // Record has changed
- $diffrec_full['old'][$key] = $val;
- $diffrec_full['new'][$key] = $record_new[$key];
- } else {
- $diffrec_full['old'][$key] = $val;
- $diffrec_full['new'][$key] = $val;
- }
- }
- } elseif(is_array($record_new)) {
- foreach($record_new as $key => $val) {
- if(isset($record_new[$key]) && $record_old[$key] != $val) {
- // Record has changed
- $diffrec_full['new'][$key] = $val;
- $diffrec_full['old'][$key] = $record_old[$key];
- } else {
- $diffrec_full['new'][$key] = $val;
- $diffrec_full['old'][$key] = $val;
- }
- }
- }
-
- /*
- echo "<pre>";
- print_r($diffrec_full);
- echo "</pre>";
- */
-
- // Insert the server_id, if the record has a server_id
- $server_id = (isset($record_old["server_id"]) && $record_old["server_id"] > 0)?$record_old["server_id"]:0;
- if(isset($record_new["server_id"])) $server_id = $record_new["server_id"];
-
- if(count($this->diffrec) > 0) {
- $diffstr = $app->db->quote(serialize($diffrec_full));
- $username = $app->db->quote($this->sys_username);
- $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
- // $action = ($action == 'INSERT')?'i':'u';
-
- if($action == 'INSERT') $action = 'i';
- if($action == 'UPDATE') $action = 'u';
- if($action == 'DELETE') $action = 'd';
- $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$this->formDef['db_table']."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
- $app->db->query($sql);
- }
-
- return true;
-
- }
-
-}
-
-?>
+<?php
+
+/*
+Copyright (c) 2007, Till Brehm, projektfarm Gmbh
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--UPDATED 08.2009--
+Full SOAP support for ISPConfig 3.1.4 b
+Updated by Arkadiusz Roch & Artur Edelman
+Copyright (c) Tri-Plex technology
+
+*/
+
+/**
+* Formularbehandlung
+*
+* Funktionen zur Umwandlung von Formulardaten
+* sowie zum vorbereiten von HTML und SQL
+* Ausgaben
+*
+* Tabellendefinition
+*
+* Datentypen:
+* - INTEGER (Wandelt Ausdr�cke in Int um)
+* - DOUBLE
+* - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
+* - VARCHAR (kein weiterer Format Check)
+* - DATE (Datumsformat, Timestamp Umwandlung)
+*
+* Formtype:
+* - TEXT (normales Textfeld)
+* - PASSWORD (Feldinhalt wird nicht angezeigt)
+* - SELECT (Gibt Werte als option Feld aus)
+* - MULTIPLE (Select-Feld mit nehreren Werten)
+*
+* VALUE:
+* - Wert oder Array
+*
+* SEPARATOR
+* - Trennzeichen f�r multiple Felder
+*
+* Hinweis:
+* Das ID-Feld ist nicht bei den Table Values einzuf�gen.
+*/
+
+class remoting_lib {
+
+ /**
+ * Definition of the database atble (array)
+ * @var tableDef
+ */
+ private $tableDef;
+
+ /**
+ * Private
+ * @var action
+ */
+ private $action;
+
+ /**
+ * Table name (String)
+ * @var table_name
+ */
+ private $table_name;
+
+ /**
+ * Debug Variable
+ * @var debug
+ */
+ private $debug = 0;
+
+ /**
+ * name of the primary field of the database table (string)
+ * @var table_index
+ */
+ var $table_index;
+
+ /**
+ * contains the error messages
+ * @var errorMessage
+ */
+ var $errorMessage = '';
+
+ var $dateformat = "d.m.Y";
+ var $formDef = array();
+ var $wordbook;
+ var $module;
+ var $primary_id;
+ var $diffrec = array();
+
+ var $sys_username;
+ var $sys_userid;
+ var $sys_default_group;
+ var $sys_groups;
+
+
+ //* Load the form definition from file.
+ function loadFormDef($file) {
+ global $app,$conf;
+
+ include_once($file);
+
+ $this->formDef = $form;
+ unset($this->formDef['tabs']);
+
+ //* Copy all fields from all tabs into one form definition
+ foreach($form['tabs'] as $tab) {
+ foreach($tab['fields'] as $key => $value) {
+ $this->formDef['fields'][$key] = $value;
+ }
+ }
+ unset($form);
+
+ return true;
+ }
+
+ //* Load the user profile
+ function loadUserProfile($client_id = 0) {
+ global $app,$conf;
+
+ $client_id = intval($client_id);
+
+ if($client_id == 0) {
+ $this->sys_username = 'admin';
+ $this->sys_userid = 1;
+ $this->sys_default_group = 1;
+ $this->sys_groups = 1;
+ } else {
+ //* Load the client data
+ $client = $app->db->queryOneRecord("SELECT username FROM client WHERE client_id = $client_id");
+ if($client["username"] == '') {
+ $this->errorMessage .= 'No client with ID $client_id found.';
+ return false;
+ }
+ //* load system user
+ $user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$app->db->quote($client["username"])."'");
+ if(empty($user["userid"])) {
+ $this->errorMessage .= 'No user with the username '.$client['username'].' found.';
+ return false;
+ }
+ $this->sys_username = $user['username'];
+ $this->sys_userid = $user['userid'];
+ $this->sys_default_group = $user['default_group'];
+ $this->sys_groups = $user['groups'];
+ }
+
+ return true;
+
+ }
+
+
+ /**
+ * Converts data in human readable form
+ *
+ * @param record
+ * @return record
+ */
+ function decode($record) {
+ $new_record = '';
+ if(is_array($record)) {
+ foreach($this->formDef['fields'] as $key => $field) {
+ switch ($field['datatype']) {
+ case 'VARCHAR':
+ $new_record[$key] = stripslashes($record[$key]);
+ break;
+
+ case 'TEXT':
+ $new_record[$key] = stripslashes($record[$key]);
+ break;
+
+ case 'DATE':
+ if($record[$key] > 0) {
+ $new_record[$key] = date($this->dateformat,$record[$key]);
+ }
+ break;
+
+ case 'INTEGER':
+ $new_record[$key] = intval($record[$key]);
+ break;
+
+ case 'DOUBLE':
+ $new_record[$key] = $record[$key];
+ break;
+
+ case 'CURRENCY':
+ $new_record[$key] = number_format($record[$key], 2, ',', '');
+ break;
+
+ default:
+ $new_record[$key] = stripslashes($record[$key]);
+ }
+ }
+
+ }
+
+ return $new_record;
+ }
+
+ /**
+ * Get the key => value array of a form filled from a datasource definitiom
+ *
+ * @param field = array with field definition
+ * @param record = Dataset as array
+ * @return key => value array for the value field of a form
+ */
+
+ function getDatasourceData($field, $record) {
+ global $app;
+
+ $values = array();
+
+ if($field["datasource"]["type"] == 'SQL') {
+
+ // Preparing SQL string. We will replace some
+ // common placeholders
+ $querystring = $field["datasource"]["querystring"];
+ $querystring = str_replace("{USERID}",$this->sys_userid,$querystring);
+ $querystring = str_replace("{GROUPID}",$this->sys_default_group,$querystring);
+ $querystring = str_replace("{GROUPS}",$this->sys_groups,$querystring);
+ $table_idx = $this->formDef['db_table_idx'];
+
+ $tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
+ $querystring = str_replace("{RECORDID}",$tmp_recordid,$querystring);
+ unset($tmp_recordid);
+
+ $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
+
+ // Getting the records
+ $tmp_records = $app->db->queryAllRecords($querystring);
+ if($app->db->errorMessage != '') die($app->db->errorMessage);
+ if(is_array($tmp_records)) {
+ $key_field = $field["datasource"]["keyfield"];
+ $value_field = $field["datasource"]["valuefield"];
+ foreach($tmp_records as $tmp_rec) {
+ $tmp_id = $tmp_rec[$key_field];
+ $values[$tmp_id] = $tmp_rec[$value_field];
+ }
+ }
+ }
+
+ if($field["datasource"]["type"] == 'CUSTOM') {
+ // Calls a custom class to validate this record
+ if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
+ $datasource_class = $field["datasource"]['class'];
+ $datasource_function = $field["datasource"]['function'];
+ $app->uses($datasource_class);
+ $values = $app->$datasource_class->$datasource_function($field, $record);
+ } else {
+ $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
+ }
+ }
+
+ return $values;
+
+ }
+
+ /**
+ * Converts the data in a format to store it in the database table
+ *
+ * @param record = Datensatz als Array
+ * @return record
+ */
+ function encode($record) {
+
+ if(is_array($record)) {
+ foreach($this->formDef['fields'] as $key => $field) {
+
+ if(isset($field['validators']) && is_array($field['validators'])) $this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
+
+ switch ($field['datatype']) {
+ case 'VARCHAR':
+ if(!@is_array($record[$key])) {
+ $new_record[$key] = (isset($record[$key]))?mysql_real_escape_string($record[$key]):'';
+ } else {
+ $new_record[$key] = implode($field['separator'],$record[$key]);
+ }
+ break;
+ case 'TEXT':
+ if(!is_array($record[$key])) {
+ $new_record[$key] = mysql_real_escape_string($record[$key]);
+ } else {
+ $new_record[$key] = implode($field['separator'],$record[$key]);
+ }
+ break;
+ case 'DATE':
+ if($record[$key] > 0) {
+ list($tag,$monat,$jahr) = explode('.',$record[$key]);
+ $new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+ } else {
+ $new_record[$key] = 0;
+ }
+ break;
+ case 'INTEGER':
+ $new_record[$key] = (isset($record[$key]))?intval($record[$key]):0;
+ //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
+ //if($key == 'refresh') die($record[$key]);
+ break;
+ case 'DOUBLE':
+ $new_record[$key] = mysql_real_escape_string($record[$key]);
+ break;
+ case 'CURRENCY':
+ $new_record[$key] = str_replace(",",".",$record[$key]);
+ break;
+ }
+
+ // The use of the field value is deprecated, use validators instead
+ if(isset($field['regex']) && $field['regex'] != '') {
+ // Enable that "." matches also newlines
+ $field['regex'] .= 's';
+ if(!preg_match($field['regex'], $record[$key])) {
+ $errmsg = $field['errmsg'];
+ $this->errorMessage .= $errmsg."\r\n";
+ }
+ }
+
+
+ }
+ }
+ return $new_record;
+ }
+
+ /**
+ * process the validators for a given field.
+ *
+ * @param field_name = Name of the field
+ * @param field_value = value of the field
+ * @param validatoors = Array of validators
+ * @return record
+ */
+
+ function validateField($field_name, $field_value, $validators) {
+
+ global $app;
+
+ $escape = '`';
+
+ // loop trough the validators
+ foreach($validators as $validator) {
+
+ switch ($validator['type']) {
+ case 'REGEX':
+ $validator['regex'] .= 's';
+ if(!preg_match($validator['regex'], $field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ break;
+ case 'UNIQUE':
+ if($this->action == 'INSERT') {
+ $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
+ if($num_rec["number"] > 0) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ } else {
+ $num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
+ if($num_rec["number"] > 0) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ }
+ break;
+ case 'NOTEMPTY':
+ if(empty($field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ break;
+ case 'ISEMAIL':
+ if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ break;
+ case 'ISINT':
+ $tmpval = intval($field_value);
+ if($tmpval === 0 and !empty($field_value)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ break;
+ case 'ISPOSITIVE':
+ if(!is_numeric($field_value) || $field_value <= 0){
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br>\r\n";
+ }
+ }
+ break;
+ case 'CUSTOM':
+ // Calls a custom class to validate this record
+ if($validator['class'] != '' and $validator['function'] != '') {
+ $validator_class = $validator['class'];
+ $validator_function = $validator['function'];
+ $app->uses($validator_class);
+ $this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
+ } else {
+ $this->errorMessage .= "Custom validator class or function is empty<br>\r\n";
+ }
+ break;
+ default:
+ $this->errorMessage .= "Unknown Validator: ".$validator['type'];
+ break;
+ }
+
+
+ }
+
+ return true;
+ }
+
+ /**
+ * Create SQL statement
+ *
+ * @param record = Datensatz als Array
+ * @param action = INSERT oder UPDATE
+ * @param primary_id
+ * @return record
+ */
+ function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
+
+ global $app;
+
+ $this->action = $action;
+ $this->primary_id = $primary_id;
+
+ $record = $this->encode($record,$tab);
+ $sql_insert_key = '';
+ $sql_insert_val = '';
+ $sql_update = '';
+
+ if(!is_array($this->formDef)) $app->error("No form definition found.");
+
+ // gehe durch alle Felder des Tabs
+ if(is_array($record)) {
+ foreach($this->formDef['fields'] as $key => $field) {
+ // Wenn es kein leeres Passwortfeld ist
+ if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
+ // Erzeuge Insert oder Update Quelltext
+ if($action == "INSERT") {
+ if($field['formtype'] == 'PASSWORD') {
+ $sql_insert_key .= "`$key`, ";
+ if($field['encryption'] == 'CRYPT') {
+ $salt="$1$";
+ for ($n=0;$n<8;$n++) {
+ $salt.=chr(mt_rand(64,126));
+ }
+ $salt.="$";
+ // $salt = substr(md5(time()),0,2);
+ $record[$key] = crypt($record[$key],$salt);
+ } else {
+ $record[$key] = md5($record[$key]);
+ }
+ $sql_insert_val .= "'".$record[$key]."', ";
+ } elseif ($field['formtype'] == 'CHECKBOX') {
+ $sql_insert_key .= "`$key`, ";
+ if($record[$key] == '') {
+ // if a checkbox is not set, we set it to the unchecked value
+ $sql_insert_val .= "'".$field['value'][0]."', ";
+ $record[$key] = $field['value'][0];
+ } else {
+ $sql_insert_val .= "'".$record[$key]."', ";
+ }
+ } else {
+ $sql_insert_key .= "`$key`, ";
+ $sql_insert_val .= "'".$record[$key]."', ";
+ }
+ } else {
+ if($field['formtype'] == 'PASSWORD') {
+ if($field['encryption'] == 'CRYPT') {
+ $salt="$1$";
+ for ($n=0;$n<8;$n++) {
+ $salt.=chr(mt_rand(64,126));
+ }
+ $salt.="$";
+ // $salt = substr(md5(time()),0,2);
+ $record[$key] = crypt($record[$key],$salt);
+ } else {
+ $record[$key] = md5($record[$key]);
+ }
+ $sql_update .= "`$key` = '".$record[$key]."', ";
+ } elseif ($field['formtype'] == 'CHECKBOX') {
+ if($record[$key] == '') {
+ // if a checkbox is not set, we set it to the unchecked value
+ $sql_update .= "`$key` = '".$field['value'][0]."', ";
+ $record[$key] = $field['value'][0];
+ } else {
+ $sql_update .= "`$key` = '".$record[$key]."', ";
+ }
+ } else {
+ $sql_update .= "`$key` = '".$record[$key]."', ";
+ }
+ }
+ } else {
+ // we unset the password filed, if empty to tell the datalog function
+ // that the password has not been changed
+ unset($record[$key]);
+ }
+ }
+ }
+
+
+
+ if(stristr($this->formDef['db_table'],'.')) {
+ $escape = '';
+ } else {
+ $escape = '`';
+ }
+
+
+ if($action == "INSERT") {
+ if($this->formDef['auth'] == 'yes') {
+ // Setze User und Gruppe
+ $sql_insert_key .= "`sys_userid`, ";
+ $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$this->sys_userid."', ";
+ $sql_insert_key .= "`sys_groupid`, ";
+ $sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$this->sys_default_group."', ";
+ $sql_insert_key .= "`sys_perm_user`, ";
+ $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
+ $sql_insert_key .= "`sys_perm_group`, ";
+ $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
+ $sql_insert_key .= "`sys_perm_other`, ";
+ $sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
+ }
+ $sql_insert_key = substr($sql_insert_key,0,-2);
+ $sql_insert_val = substr($sql_insert_val,0,-2);
+ $sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
+ } else {
+ if($primary_id != 0) {
+ $sql_update = substr($sql_update,0,-2);
+ $sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+ if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+ } else {
+ $app->error("Primary ID fehlt!");
+ }
+ }
+
+ return $sql;
+ }
+
+ function getDeleteSQL($primary_id) {
+
+ if(stristr($this->formDef['db_table'],'.')) {
+ $escape = '';
+ } else {
+ $escape = '`';
+ }
+
+ $sql = "DELETE FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+ return $sql;
+ }
+
+
+ function getDataRecord($primary_id) {
+ global $app;
+ $escape = '`';
+ if(@is_numeric($primary_id)) {
+ $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+ return $app->db->queryOneRecord($sql);
+ } elseif (@is_array($primary_id)) {
+ $sql_where = '';
+ foreach($primary_id as $key => $val) {
+ $key = $app->db->quote($key);
+ $val = $app->db->quote($val);
+ $sql_where .= "$key = '$val' AND ";
+ }
+ $sql_where = substr($sql_where,0,-5);
+ $sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where;
+ return $app->db->queryAllRecords($sql);
+ } else {
+ $this->errorMessage = 'The ID must be either an integer or an array.';
+ return array();
+ }
+
+
+ }
+
+ function ispconfig_sysuser_add($params,$insert_id){
+ global $app,$sql1;
+ $username = $app->db->quote($params["username"]);
+ $password = $app->db->quote($params["password"]);
+ $modules = 'mail,sites,dns,tools';
+ $startmodule = 'mail';
+ $usertheme = $app->db->quote($params["usertheme"]);
+ $type = 'user';
+ $active = 1;
+ $insert_id = intval($insert_id);
+ $language = $app->db->quote($params["language"]);
+ $groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
+ $groups = $groupid;
+ $sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
+ VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
+ $app->db->query($sql1);
+ }
+
+ function ispconfig_sysuser_update($params,$client_id){
+ global $app;
+ $username = $app->db->quote($params["username"]);
+ $password = $app->db->quote($params["password"]);
+ $client_id = intval($client_id);
+ $sql = "UPDATE sys_user set username = '$username', passwort = md5('$password') WHERE client_id = $client_id";
+ $app->db->query($sql);
+ }
+
+ function ispconfig_sysuser_delete($client_id){
+ global $app;
+ $client_id = intval($client_id);
+ $sql = "DELETE FROM sys_user WHERE client_id = $client_id";
+ $app->db->query($sql);
+ }
+
+ function datalogSave($action,$primary_id, $record_old, $record_new) {
+ global $app,$conf;
+
+ if(stristr($this->formDef['db_table'],'.')) {
+ $escape = '';
+ } else {
+ $escape = '`';
+ }
+
+ $diffrec = array();
+
+ if(is_array($record_new) && count($record_new) > 0) {
+ foreach($record_new as $key => $val) {
+ if($record_old[$key] != $val) {
+ // Record has changed
+ $diffrec[$key] = array('old' => $record_old[$key],
+ 'new' => $val);
+ }
+ }
+ } elseif(is_array($record_old)) {
+ foreach($record_old as $key => $val) {
+ if($record_new[$key] != $val) {
+ // Record has changed
+ $diffrec[$key] = array('new' => $record_new[$key],
+ 'old' => $val);
+ }
+ }
+ }
+ $this->diffrec = $diffrec;
+
+
+ // Full diff records for ISPConfig, they have a different format then the simple diffrec
+ $diffrec_full = array();
+
+ if(is_array($record_old) && count($record_old) > 0) {
+ foreach($record_old as $key => $val) {
+ if(isset($record_new[$key]) && $record_new[$key] != $val) {
+ // Record has changed
+ $diffrec_full['old'][$key] = $val;
+ $diffrec_full['new'][$key] = $record_new[$key];
+ } else {
+ $diffrec_full['old'][$key] = $val;
+ $diffrec_full['new'][$key] = $val;
+ }
+ }
+ } elseif(is_array($record_new)) {
+ foreach($record_new as $key => $val) {
+ if(isset($record_new[$key]) && $record_old[$key] != $val) {
+ // Record has changed
+ $diffrec_full['new'][$key] = $val;
+ $diffrec_full['old'][$key] = $record_old[$key];
+ } else {
+ $diffrec_full['new'][$key] = $val;
+ $diffrec_full['old'][$key] = $val;
+ }
+ }
+ }
+
+ /*
+ echo "<pre>";
+ print_r($diffrec_full);
+ echo "</pre>";
+ */
+
+ // Insert the server_id, if the record has a server_id
+ $server_id = (isset($record_old["server_id"]) && $record_old["server_id"] > 0)?$record_old["server_id"]:0;
+ if(isset($record_new["server_id"])) $server_id = $record_new["server_id"];
+
+ if(count($this->diffrec) > 0) {
+ $diffstr = $app->db->quote(serialize($diffrec_full));
+ $username = $app->db->quote($this->sys_username);
+ $dbidx = $this->formDef['db_table_idx'].":".$primary_id;
+ // $action = ($action == 'INSERT')?'i':'u';
+
+ if($action == 'INSERT') $action = 'i';
+ if($action == 'UPDATE') $action = 'u';
+ if($action == 'DELETE') $action = 'd';
+ $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$this->formDef['db_table']."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+ $app->db->query($sql);
+ }
+
+ return true;
+
+ }
+
+}
+
+?>
diff --git a/interface/web/admin/form/remote_user.tform.php b/interface/web/admin/form/remote_user.tform.php
index ad5b561..d89cccf 100644
--- a/interface/web/admin/form/remote_user.tform.php
+++ b/interface/web/admin/form/remote_user.tform.php
@@ -33,35 +33,42 @@
*/
-$lista_funkcji = array();
-$lista_funkcji['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete'] = 'Mail domain functions<br>';
+$function_list = array();
+$function_list['mail_domain_get,mail_domain_add,mail_domain_update,mail_domain_delete'] = 'Mail domain functions<br>';
+$function_list['mail_user_add,mail_user_update,mail_user_delete'] = 'Mail user functions<br>';
+$function_list['mail_alias_add,mail_alias_update,mail_alias_delete'] = 'Mail alias functions<br>';
+$function_list['mail_forward_add,mail_forward_update,mail_forward_delete'] = 'Mail forward functions<br>';
+$function_list['mail_catchall_add,mail_catchall_update,mail_catchall_delete'] = 'Mail catchall functions<br>';
+$function_list['mail_transport_add,mail_transport_update,mail_transport_delete'] = 'Mail transport functions<br>';
+$function_list['mail_whitelist_add,mail_whitelist_update,mail_whitelist_delete'] = 'Mail whitelist functions<br>';
+$function_list['mail_blacklist_add,mail_blacklist_update,mail_blacklist_delete'] = 'Mail blacklist functions<br>';
+$function_list['mail_spamfilter_user_add,mail_spamfilter_user_update,mail_spamfilter_user_delete'] = 'Mail spamfilter user functions<br>';
+$function_list['mail_policy_add,mail_policy_update,mail_policy_delete'] = 'Mail spamfilter policy functions<br>';
+$function_list['mail_fetchmail_add,mail_fetchmail_update,mail_fetchmail_delete'] = 'Mail fetchmail functions<br>';
+$function_list['mail_whitelist_add,mail_whitelist_update,mail_whitelist_delete'] = 'Mail whitelist functions<br>';
+$function_list['mail_blacklist_add,mail_blacklist_update,mail_blacklist_delete'] = 'Mail blacklist functions<br>';
+$function_list['mail_filter_add,mail_filter_update,mail_filter_delete'] = 'Mail filter functions<br>';
-$lista_funkcji['mail_user_add,mail_user_update,mail_user_delete'] = 'Mail user functions<br>';
-
-$lista_funkcji['mail_alias_add,mail_alias_update,mail_alias_delete'] = 'Mail alias functions<br>';
-
-$lista_funkcji['mail_forward_add,mail_forward_update,mail_forward_delete'] = 'Mail forward functions<br>';
-
-$lista_funkcji['mail_catchall_add,mail_catchall_update,mail_catchall_delete'] = 'Mail catchall functions<br>';
-
-$lista_funkcji['mail_transport_add,mail_transport_update,mail_transport_delete'] = 'Mail transport functions<br>';
-
-$lista_funkcji['mail_whitelist_add,mail_whitelist_update,mail_whitelist_delete'] = 'Mail whitelist functions<br>';
-
-$lista_funkcji['mail_blacklist_add,mail_blacklist_update,mail_blacklist_delete'] = 'Mail blacklist functions<br>';
-
-$lista_funkcji['mail_spamfilter_user_add,mail_spamfilter_user_update,mail_spamfilter_user_delete'] = 'Mail spamfilter user functions<br>';
-
-$lista_funkcji['mail_policy_add,mail_policy_update,mail_policy_delete'] = 'Mail spamfilter policy functions<br>';
-
-$lista_funkcji['mail_fetchmail_add,mail_fetchmail_update,mail_fetchmail_delete'] = 'Mail fetchmail functions<br>';
-
-$lista_funkcji['mail_whitelist_add,mail_whitelist_update,mail_whitelist_delete'] = 'Mail whitelist functions<br>';
-
-$lista_funkcji['mail_blacklist_add,mail_blacklist_update,mail_blacklist_delete'] = 'Mail blacklist functions<br>';
-
-$lista_funkcji['mail_filter_add,mail_filter_update,mail_filter_delete'] = 'Mail filter functions<br>';
-
+$function_list['client_get,client_add,client_update,client_delete'] = 'Client functions<br>';
+$function_list['sites_cron_get,sites_cron_add,sites_cron_update,sites_cron_delete'] = 'Sites cron functions<br>';
+$function_list['sites_database_get,sites_database_add,sites_database_update,sites_database_delete'] = 'Sites database functions<br>';
+$function_list['sites_ftp_user_get,sites_ftp_user_add,sites_ftp_user_update,sites_ftp_user_delete'] = 'Sites FTP-User functions<br>';
+$function_list['sites_shell_user_get,sites_shell_user_add,sites_shell_user_update,sites_shell_user_delete'] = 'Sites Shell-User functions<br>';
+$function_list['sites_web_domain_get,sites_web_domain_add,sites_web_domain_update,sites_web_domain_delete'] = 'Sites Domain functions<br>';
+$function_list['sites_web_aliasdomain_get,sites_web_aliasdomain_add,sites_web_aliasdomain_update,sites_web_aliasdomain_delete'] = 'Sites Aliasdomain functions<br>';
+$function_list['sites_web_subdomain_get,sites_web_subdomain_add,sites_web_subdomain_update,sites_web_subdomain_delete'] = 'Sites Subdomain functions<br>';
+$function_list['dns_zone_get,dns_zone_add,dns_zone_update,dns_zone_delete'] = 'DNS zone functions<br>';
+$function_list['dns_a_get,dns_a_add,dns_a_update,dns_a_delete'] = 'DNS a functions<br>';
+$function_list['dns_aaaa_get,dns_aaaa_add,dns_aaaa_update,dns_aaaa_delete'] = 'DNS aaaa functions<br>';
+$function_list['dns_alias_get,dns_alias_add,dns_alias_update,dns_alias_delete'] = 'DNS alias functions<br>';
+$function_list['dns_cname_get,dns_cname_add,dns_cname_update,dns_cname_delete'] = 'DNS cname functions<br>';
+$function_list['dns_hinfo_get,dns_hinfo_add,dns_hinfo_update,dns_hinfo_delete'] = 'DNS hinfo functions<br>';
+$function_list['dns_mx_get,dns_mx_add,dns_mx_update,dns_mx_delete'] = 'DNS mx functions<br>';
+$function_list['dns_ns_get,dns_ns_add,dns_ns_update,dns_ns_delete'] = 'DNS ns functions<br>';
+$function_list['dns_ptr_get,dns_ptr_add,dns_ptr_update,dns_ptr_delete'] = 'DNS ptr functions<br>';
+$function_list['dns_rp_get,dns_rp_add,dns_rp_update,dns_rp_delete'] = 'DNS rp functions<br>';
+$function_list['dns_srv_get,dns_srv_add,dns_srv_update,dns_srv_delete'] = 'DNS srv functions<br>';
+$function_list['dns_txt_get,dns_txt_add,dns_txt_update,dns_txt_delete'] = 'DNS txt functions<br>';
$form["title"] = "Remote user";
@@ -135,7 +142,7 @@
'regex' => '',
'errmsg' => '',
'default' => '',
- 'value' => $lista_funkcji,
+ 'value' => $function_list,
'separator' => ';',
'width' => '',
'maxlength' => '',
diff --git a/interface/web/mail/form/spamfilter_policy.tform.php b/interface/web/mail/form/spamfilter_policy.tform.php
index e701f9b..0e83e67 100644
--- a/interface/web/mail/form/spamfilter_policy.tform.php
+++ b/interface/web/mail/form/spamfilter_policy.tform.php
@@ -48,7 +48,7 @@
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
-$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = 'r'; //r = read, i = insert, u = update, d = delete
$form["tabs"]['policy'] = array (
'title' => "Policy",
diff --git a/remoting_client/examples/soap-client-add.php b/remoting_client/examples/soap-client-add.php
new file mode 100644
index 0000000..ed78d0f
--- /dev/null
+++ b/remoting_client/examples/soap-client-add.php
@@ -0,0 +1,80 @@
+<?php
+
+require('soap_config.php');
+
+$client = new SoapClient(null, array('location' => $soap_location,
+ 'uri' => $soap_uri));
+
+try {
+ if($session_id = $client->login($username,$password)) {
+ echo 'Login successfull. SessionID:'.$session_id.'<br />';
+ }
+
+ $params = array( 'server_id' => 1,
+ 'company_name' => 'Company',
+ 'contact_name' => 'John Doe',
+ 'username' =>'john',
+ 'password' =>'test',
+ 'language' =>'en',
+ 'usertheme' =>'default',
+ 'street' =>'mainstreet 10',
+ 'zip' =>'12345',
+ 'city' =>'Homecity',
+ 'state' =>'non-US',
+ 'country' =>'EN',
+ 'telephone' =>'',
+ 'mobile' =>'',
+ 'fax' =>'',
+ 'email' =>'',
+ 'internet' =>'',
+ 'icq' =>'',
+ 'notes' =>'',
+ 'template_master' => '1',
+ 'template_additional' =>'',
+ 'default_mailserver' =>'1',
+ 'limit_maildomain' =>'1',
+ 'limit_mailbox' =>'-1',
+ 'limit_mailalias' =>'-1',
+ 'limit_mailforward' =>'-1',
+ 'limit_mailcatchall' =>'-1',
+ 'limit_mailrouting' => '-1',
+ 'limit_mailfilter' =>'-1',
+ 'limit_fetchmail' =>'-1',
+ 'limit_mailquota' =>'-1',
+ 'limit_spamfilter_wblist' =>'-1',
+ 'limit_spamfilter_user' =>'-1',
+ 'limit_spamfilter_policy' =>'-1',
+ 'default_webserver' =>'1',
+ 'limit_web_domain' =>'-1',
+ 'web_php_options' =>"SuPHP",
+ 'limit_web_aliasdomain' =>'-1',
+ 'limit_web_subdomain' =>'-1',
+ 'limit_ftp_user' =>'-1',
+ 'limit_shell_user' =>'-1',
+ 'ssh_chroot' =>'None',
+ 'default_dnsserver' =>'1',
+ 'limit_dns_zone' =>'-1',
+ 'limit_dns_record' =>'-1',
+ 'limit_client' =>'0',
+ 'default_dbserver' =>'1',
+ 'limit_database' =>'-1',
+ 'limit_cron' =>'0',
+ 'limit_cron_type' =>'',
+ 'limit_cron_frequency' =>'-1');
+
+
+ $reseller_id = 0;
+ $domain_id = $client->client_add($session_id, $reseller_id, $params);
+
+
+
+ if($client->logout($session_id)) {
+ echo 'Logout.<br />';
+ }
+
+
+} catch (SoapFault $e) {
+ die('SOAP Error: '.$e->getMessage());
+}
+
+?>
diff --git a/remoting_client/examples/soap-client-delete.php b/remoting_client/examples/soap-client-delete.php
new file mode 100644
index 0000000..3a05759
--- /dev/null
+++ b/remoting_client/examples/soap-client-delete.php
@@ -0,0 +1,29 @@
+<?php
+
+require('soap_config.php');
+
+
+$client = new SoapClient(null, array('location' => $soap_location,
+ 'uri' => $soap_uri));
+
+
+try {
+ if($session_id = $client->login($username,$password)) {
+ echo 'Login successfull. SessionID:'.$session_id.'<br />';
+ }
+
+ $client_id = 3;
+ $affected_rows = $client->client_delete($session_id, $client_id);
+
+
+
+ if($client->logout($session_id)) {
+ echo 'Logout.<br />';
+ }
+
+
+} catch (SoapFault $e) {
+ die('SOAP Error: '.$e->getMessage());
+}
+
+?>
diff --git a/remoting_client/examples/soap-client-update.php b/remoting_client/examples/soap-client-update.php
new file mode 100644
index 0000000..a0ea101
--- /dev/null
+++ b/remoting_client/examples/soap-client-update.php
@@ -0,0 +1,83 @@
+<?php
+
+require('soap_config.php');
+
+
+$client = new SoapClient(null, array('location' => $soap_location,
+ 'uri' => $soap_uri));
+
+
+try {
+ if($session_id = $client->login($username,$password)) {
+ echo 'Login successfull. SessionID:'.$session_id.'<br />';
+ }
+
+ $params = array( 'server_id' => 1,
+ 'company_name' => 'Company',
+ 'contact_name' => 'John Doe 3',
+ 'username' =>'john2',
+ 'password' =>'test',
+ 'language' =>'en',
+ 'usertheme' =>'default',
+ 'street' =>'mainstreet 10',
+ 'zip' =>'12345',
+ 'city' =>'Homecity',
+ 'state' =>'non-US',
+ 'country' =>'EN',
+ 'telephone' =>'',
+ 'mobile' =>'',
+ 'fax' =>'',
+ 'email' =>'',
+ 'internet' =>'',
+ 'icq' =>'',
+ 'notes' =>'',
+ 'template_master' => '1',
+ 'template_additional' =>'',
+ 'default_mailserver' =>'1',
+ 'limit_maildomain' =>'1',
+ 'limit_mailbox' =>'-1',
+ 'limit_mailalias' =>'-1',
+ 'limit_mailforward' =>'-1',
+ 'limit_mailcatchall' =>'-1',
+ 'limit_mailrouting' => '-1',
+ 'limit_mailfilter' =>'-1',
+ 'limit_fetchmail' =>'-1',
+ 'limit_mailquota' =>'-1',
+ 'limit_spamfilter_wblist' =>'-1',
+ 'limit_spamfilter_user' =>'-1',
+ 'limit_spamfilter_policy' =>'-1',
+ 'default_webserver' =>'1',
+ 'limit_web_domain' =>'-1',
+ 'web_php_options' =>"SuPHP",
+ 'limit_web_aliasdomain' =>'-1',
+ 'limit_web_subdomain' =>'-1',
+ 'limit_ftp_user' =>'-1',
+ 'limit_shell_user' =>'-1',
+ 'ssh_chroot' =>'None',
+ 'default_dnsserver' =>'1',
+ 'limit_dns_zone' =>'-1',
+ 'limit_dns_record' =>'-1',
+ 'limit_client' =>'0',
+ 'default_dbserver' =>'1',
+ 'limit_database' =>'-1',
+ 'limit_cron' =>'0',
+ 'limit_cron_type' =>'',
+ 'limit_cron_frequency' =>'-1');
+
+
+ $reseller_id = 0;
+ $client_id = 3;
+ $return_client_id = $client->client_update($session_id, $reseller_id, $client_id, $params);
+
+
+
+ if($client->logout($session_id)) {
+ echo 'Logout.<br />';
+ }
+
+
+} catch (SoapFault $e) {
+ die('SOAP Error: '.$e->getMessage());
+}
+
+?>
diff --git a/remoting_client/examples/soap-klient-add.php b/remoting_client/examples/soap-klient-add.php
deleted file mode 100644
index 9123965..0000000
--- a/remoting_client/examples/soap-klient-add.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-$username = 'axelf';
-$password = 'axelf';
-
-$soap_location = 'http://localhost:8080/remote/index.php';
-$soap_uri = 'http://localhost:8080/remote/';
-
-
-$client = new SoapClient(null, array('location' => $soap_location,
- 'uri' => $soap_uri));
-
-
-try {
- if($session_id = $client->login($username,$password)) {
- echo 'Zalogowany. Sesja:'.$session_id.'<br />';
- }
-
- $params = array( 'server_id' => 1,
-
- 'company_name' => 'abm',
- 'contact_name' => 'artur',
- 'username' =>'artek123',
- 'password' =>'artek123',
- 'language' =>'pl',
- 'usertheme' =>'default',
- 'street' =>'dobrzanskiego',
- 'zip' =>'05-071',
- 'city' =>'sulejowek',
- 'state' =>'non-US',
- 'country' =>'PL',
- 'telephone' =>'',
- 'mobile' =>'',
- 'fax' =>'',
- 'email' =>'',
- 'internet' =>'',
- 'icq' =>'',
- 'notes' =>'',
- 'template_master' => '1',
- 'template_additional' =>'',
- 'default_mailserver' =>'1',
- 'limit_maildomain' =>'1',
- 'limit_mailbox' =>'-1',
- 'limit_mailalias' =>'-1',
- 'limit_mailforward' =>'-1',
- 'limit_mailcatchall' =>'-1',
- 'limit_mailrouting' => '-1',
- 'limit_mailfilter' =>'-1',
- 'limit_fetchmail' =>'-1',
- 'limit_mailquota' =>'-1',
- 'limit_spamfilter_wblist' =>'-1',
- 'limit_spamfilter_user' =>'-1',
- 'limit_spamfilter_policy' =>'-1',
- 'default_webserver' =>'1',
- 'limit_web_domain' =>'-1',
- 'web_php_options' =>"SuPHP",
- 'limit_web_aliasdomain' =>'-1',
- 'limit_web_subdomain' =>'-1',
- 'limit_ftp_user' =>'-1',
- 'limit_shell_user' =>'-1',
- 'ssh_chroot' =>'None',
- 'default_dnsserver' =>'1',
- 'limit_dns_zone' =>'-1',
- 'limit_dns_record' =>'-1',
- 'limit_client' =>'0',
- 'default_dbserver' =>'1',
- 'limit_database' =>'-1',
- 'limit_cron' =>'0',
- 'limit_cron_type' =>'',
- 'limit_cron_frequency' =>'-1');
-
-
- $client_id = 0;
- $domain_id = $client->klient_add($session_id,$domain_id, $params);
-
-
-
- if($client->logout($session_id)) {
- echo 'Wylogowany.<br />';
- }
-
- }
-catch (SoapFault $e) {
- die('SOAP Blad: '.$e->getMessage());
- }
-
-?>
-
diff --git a/remoting_client/examples/soap_config.php b/remoting_client/examples/soap_config.php
new file mode 100644
index 0000000..279d0f5
--- /dev/null
+++ b/remoting_client/examples/soap_config.php
@@ -0,0 +1,14 @@
+<?php
+
+$username = 'admin';
+$password = 'admin';
+
+/*
+$soap_location = 'http://localhost:8080/ispconfig3/interface/web/remote/index.php';
+$soap_uri = 'http://localhost:8080/ispconfig3/interface/web/remote/';
+*/
+
+$soap_location = 'http://localhost:8080/remote/index.php';
+$soap_uri = 'http://localhost:8080/remote/';
+
+?>
--
Gitblit v1.9.1