From 91e1bacc034def374dfbf9a6241835f3546f07a0 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 18 Jan 2012 10:54:54 -0500
Subject: [PATCH] - Fixed a timezone warning in updater. - Fixed a database password encryption error in remote API. - Fixed database add example script. - Added examply for new query syntax for forwards.

---
 remoting_client/examples/sites_database_add.php |   10 +++++-----
 interface/lib/classes/remoting_lib.inc.php      |   13 +++++++++----
 install/update.php                              |    2 +-
 remoting_client/examples/soap_config.php        |    4 ++--
 remoting_client/examples/mail_forward_get.php   |    1 +
 5 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/install/update.php b/install/update.php
index 8786658..8e00a87 100644
--- a/install/update.php
+++ b/install/update.php
@@ -96,7 +96,7 @@
 $conf["mysql"]["ispconfig_password"] = $conf_old["db_password"];
 $conf['language'] = $conf_old['language'];
 if($conf['language'] == '{language}') $conf['language'] = 'en';
-$conf['timezone'] = $conf_old['timezone'];
+$conf['timezone'] = (isset($conf_old['timezone']))?$conf_old['timezone']:'UTC';
 if($conf['timezone'] == '{timezone}' or trim($conf['timezone']) == '') $conf['timezone'] = 'UTC';
 
 if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"];
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 1310737..9073941 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -536,11 +536,16 @@
                                                 if($field['formtype'] == 'PASSWORD') {
                                                         $sql_insert_key .= "`$key`, ";
                                                         if($field['encryption'] == 'CRYPT') {
-                                                                $record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+																$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+														} elseif ($field['encryption'] == 'MYSQL') {
+																$sql_insert_val .= "PASSWORD('".$app->db->quote($record[$key])."'), ";
+														} elseif ($field['encryption'] == 'CLEARTEXT') {
+																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
                                                         } else {
-                                                                $record[$key] = md5($record[$key]);
+                                                                $record[$key] = md5(stripslashes($record[$key]));
+																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
                                                         }
-														$sql_insert_val .= "'".$record[$key]."', ";
                                                 } elseif ($field['formtype'] == 'CHECKBOX') {
                                                         $sql_insert_key .= "`$key`, ";
 														if($record[$key] == '') {
@@ -645,7 +650,7 @@
 				foreach($primary_id as $key => $val) {
 					$key = $app->db->quote($key);
 					$val = $app->db->quote($val);
-					if(strpos($val,'%')) {
+					if(stristr($val,'%')) {
 						$sql_where .= "$key like '$val' AND ";
 					} else {
 						$sql_where .= "$key = '$val' AND ";
diff --git a/remoting_client/examples/mail_forward_get.php b/remoting_client/examples/mail_forward_get.php
index e47d578..31c35ca 100644
--- a/remoting_client/examples/mail_forward_get.php
+++ b/remoting_client/examples/mail_forward_get.php
@@ -18,6 +18,7 @@
 	$forwarding_id = 1;
 	
 	$mail_forwarding_record = $client->mail_forward_get($session_id, $forwarding_id);
+	// $mail_forwarding_record = $client->mail_forward_get($session_id, array('source' => '%@test.int'));
 
 	print_r($mail_forwarding_record);
 	
diff --git a/remoting_client/examples/sites_database_add.php b/remoting_client/examples/sites_database_add.php
index 2d2ee33..0337dad 100644
--- a/remoting_client/examples/sites_database_add.php
+++ b/remoting_client/examples/sites_database_add.php
@@ -18,12 +18,12 @@
 	$client_id = 1;
 	$params = array(
 			'server_id' => 1,
-			'type' => 'y',
-			'database_name' => 'db_o',
-			'database_user' => 'test',
-			'database_password' => 'test',
+			'type' => 'mysql',
+			'database_name' => 'db_name1',
+			'database_user' => 'db_name1',
+			'database_password' => 'db_name1',
 			'database_charset' => 'UTF8',
-			'remote_access' => 'y',
+			'remote_access' => 'n',
 			'remote_ips' => '',
 			'active' => 'y'
 			);
diff --git a/remoting_client/examples/soap_config.php b/remoting_client/examples/soap_config.php
index b3c282d..3487677 100644
--- a/remoting_client/examples/soap_config.php
+++ b/remoting_client/examples/soap_config.php
@@ -8,7 +8,7 @@
 $soap_uri = 'http://localhost:8080/ispconfig3/interface/web/remote/';
 */
 
-$soap_location = 'http://192.168.0.110:8080/remote/index.php';
-$soap_uri = 'http://192.168.0.110:8080/remote/';
+$soap_location = 'http://192.168.0.105:8080/remote/index.php';
+$soap_uri = 'http://192.168.0.105:8080/remote/';
 
 ?>

--
Gitblit v1.9.1