From 39dd4ecc8b4a2b3b98a7ffe7056ae64240b22d56 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Sun, 11 May 2014 17:39:37 -0400
Subject: [PATCH] - Added functions client_get_emailcontact and client_login_get to remote api. - Add option to _get functions of the remote-api to return all records when primaryID = -1 - Fixed permission problem in _get functions of remote api. - Fixed typo in german dashboard language file.

---
 interface/lib/classes/remoting_lib.inc.php |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 5d1b23d..d85612b 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -233,8 +233,19 @@
 	function getDataRecord($primary_id) {
 		global $app;
 		$escape = '`';
+		$this->loadUserProfile();
 		if(@is_numeric($primary_id)) {
-			return parent::getDataRecord($primary_id);
+			if($primary_id > 0) {
+				// Return a single record
+				return parent::getDataRecord($primary_id);
+			} elseif($primary_id == -1) {
+				// Return a array with all records
+				$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape;
+				return $app->db->queryAllRecords($sql);
+			} else {
+				throw new SoapFault('invalid_id', 'The ID has to be > 0 or -1.');
+				return array();
+			}
 		} elseif (@is_array($primary_id) || @is_object($primary_id)) {
 			if(@is_object($primary_id)) $primary_id = get_object_vars($primary_id); // do not use cast (array)xxx because it returns private and protected properties!
 			$sql_offset = 0;

--
Gitblit v1.9.1