You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2012/07/26 20:18:02 UTC

svn commit: r1366122 - /incubator/openmeetings/trunk/plugins/joomla/com_openmeetings_conference/admin/om_gateway/openmeetings_gateway.php

Author: solomax
Date: Thu Jul 26 18:18:02 2012
New Revision: 1366122

URL: http://svn.apache.org/viewvc?rev=1366122&view=rev
Log:
OPENMEETINGS-383 somehow working

Modified:
    incubator/openmeetings/trunk/plugins/joomla/com_openmeetings_conference/admin/om_gateway/openmeetings_gateway.php

Modified: incubator/openmeetings/trunk/plugins/joomla/com_openmeetings_conference/admin/om_gateway/openmeetings_gateway.php
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/plugins/joomla/com_openmeetings_conference/admin/om_gateway/openmeetings_gateway.php?rev=1366122&r1=1366121&r2=1366122&view=diff
==============================================================================
--- incubator/openmeetings/trunk/plugins/joomla/com_openmeetings_conference/admin/om_gateway/openmeetings_gateway.php (original)
+++ incubator/openmeetings/trunk/plugins/joomla/com_openmeetings_conference/admin/om_gateway/openmeetings_gateway.php Thu Jul 26 18:18:02 2012
@@ -1,64 +1,64 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") +  you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Check to ensure this file is included in Joomla!
-defined('_JEXEC') or die();
-
-require_once('lib/openmeetings_rest_service.php');
-
-class openmeetings_gateway {
-	var $session_id = "";
-	var $params = "";
-	
-	function getOMUrl() {
-		if (!$this->params) {
-			$this->params = &JComponentHelper::getParams( 'com_openmeetings_conference' );
-		}
-		return $this->params->get('url') . '/' . $this->params->get('context');
-	}
-
-	function getUrl() {
-		return $this->getOMUrl() . "/services/";
-	}
-
-	function var_to_str($in) {
-		if(is_bool($in)) {
-			return $in ? "true" : "false";
-		} else {
-			return $in;
-		}
-	}
-	
-	function getRestService() {
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Check to ensure this file is included in Joomla!
+defined('_JEXEC') or die();
+
+require_once('lib/openmeetings_rest_service.php');
+
+class openmeetings_gateway {
+	var $session_id = "";
+	var $params = "";
+	
+	function getOMUrl() {
+		if (!$this->params) {
+			$this->params = &JComponentHelper::getParams( 'com_openmeetings_conference' );
+		}
+		return $this->params->get('url') . '/' . $this->params->get('context');
+	}
+
+	function getUrl() {
+		return $this->getOMUrl() . "/services/";
+	}
+
+	function var_to_str($in) {
+		if(is_bool($in)) {
+			return $in ? "true" : "false";
+		} else {
+			return $in;
+		}
+	}
+	
+	function getRestService() {
 		$restService = new openmeetings_rest_service();
 		$err = $restService->getError();
 		if ($err) {
 			echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
 			echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
 			exit();
-		}
+		}
 		return $restService;
-	}
-	
-	function checkResult($restService, $result) {
-		if ($restService->fault) {
+	}
+	
+	function checkResult($restService, $result) {
+		if ($restService->fault()) {
 			echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>';
 		} else {
 			$err = $restService->getError();
@@ -71,32 +71,32 @@ class openmeetings_gateway {
 			}
 		}
 		return -1;
-	}
-
-	/**
-	 * TODO: Get Error Service and show detailed Error Message
-	 */
-	function openmeetings_loginuser() {
-		$restService = getRestService();
-
-		$response = $restService->call($this->getUrl()."UserService/getSession","session_id");
-
-		if (-1 != checkResult($restService, $response)) {
-			$this->session_id = $response;
-
-			$result = $restService->call($this->getUrl()."UserService/loginUser?"
-				. "SID=".$this->session_id
-				. "&username=" . urlencode($this->params->get('username'))
-				. "&userpass=" . urlencode($this->params->get('password'))
-				);
-
-			return -1 == checkResult($restService, $result);
-		}
-		return false;
-	}
-
-	function getFlvRecordingByExternalUserId($user_id) {
-		$restService = getRestService();
+	}
+
+	/**
+	 * TODO: Get Error Service and show detailed Error Message
+	 */
+	function openmeetings_loginuser() {
+		$restService = $this->getRestService();
+
+		$response = $restService->call($this->getUrl()."UserService/getSession","session_id");
+
+		if (-1 != $this->checkResult($restService, $response)) {
+			$this->session_id = $response;
+
+			$result = $restService->call($this->getUrl()."UserService/loginUser?"
+				. "SID=".$this->session_id
+				. "&username=" . urlencode($this->params->get('username'))
+				. "&userpass=" . urlencode($this->params->get('password'))
+				);
+
+			return -1 == $this->checkResult($restService, $result);
+		}
+		return false;
+	}
+
+	function getFlvRecordingByExternalUserId($user_id) {
+		$restService = $this->getRestService();
 		
 		$url = $this->getUrl()."RoomService/getFlvRecordingByExternalUserId?" .
 				"SID=".$this->session_id .
@@ -104,24 +104,24 @@ class openmeetings_gateway {
 		
 		$result = $restService->call($url,"");
 			
-		return checkResult($restService, $result);
-	}
-
-	function getFlvRecordingByExternalRoomTypeAndCreator($insertedBy) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function getFlvRecordingByExternalRoomTypeAndCreator($insertedBy) {
+		$restService = $this->getRestService();
 		
 		$url = $this->getUrl()."RoomService/getFlvRecordingByExternalRoomTypeAndCreator?" .
-				"SID=".$this->session_id .
+				"SID=".$this->session_id .
 				"&insertedBy=" . urlencode($insertedBy) .
 				"&externalRoomType=" . urlencode($this->params->get('moduleKey'));
 		
 		$result = $restService->call($url,"");
 			
-		return checkResult($restService, $result);
-	}
-
-	function getFlvRecordingByExternalRoomType() {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function getFlvRecordingByExternalRoomType() {
+		$restService = $this->getRestService();
 		
 		$url = $this->getUrl()."RoomService/getFlvRecordingByExternalRoomType?" .
 				"SID=".$this->session_id .
@@ -129,11 +129,11 @@ class openmeetings_gateway {
 		
 		$result = $restService->call($url,"");
 			
-		return checkResult($restService, $result);
-	}
-
-	function deleteFlvRecording($flvRecordingId) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function deleteFlvRecording($flvRecordingId) {
+		$restService = $this->getRestService();
 		
 		$url = $this->getUrl()."RoomService/deleteFlvRecording?" .
 				"SID=" . $this->session_id .
@@ -141,11 +141,11 @@ class openmeetings_gateway {
 		
 		$result = $restService->call($url,"");
 			
-		return checkResult($restService, $result);
-	}
-
-	function setUserObjectAndGenerateRecordingHashByURL($openmeetings) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function setUserObjectAndGenerateRecordingHashByURL($openmeetings) {
+		$restService = $this->getRestService();
 		$result = $restService->call($this->getUrl().'UserService/setUserObjectAndGenerateRecordingHashByURL?'.
 				'SID='.$this->session_id .
 				'&username='.urlencode($openmeetings->username) .
@@ -157,39 +157,39 @@ class openmeetings_gateway {
 				'return'
 		);
 		
-		return checkResult($restService, $result);
-	}
-
-	function openmeetings_createroomwithmod($openmeetings) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function openmeetings_createroomwithmod($openmeetings) {
+		$restService = $this->getRestService();
 		
 		$url = $this->getUrl()."RoomService/addRoomWithModerationAndRecordingFlags?" .
 			"SID=" . $this->session_id .
-			"&name" . urlencode($openmeetings->name) .
-			"&roomtypes_id" . $openmeetings->roomtypes_id .
-			"&comment" . $openmeetings->comment .
-			"&numberOfPartizipants" . $openmeetings->numberOfPartizipants .
-			"&ispublic" . $openmeetings->ispublic .
-			"&appointment" . $openmeetings->appointment .
-			"&isDemoRoom" . $openmeetings->isDemoRoom .
-			"&demoTime" . $openmeetings->demoTime .
-			"&isModeratedRoom" . $openmeetings->isModeratedRoom .
-			"&externalRoomType" . urlencode($this->params->get('moduleKey')) .
-			"&allowUserQuestions" . "true" .
-			"&isAudioOnly" . "false" .
-			"&waitForRecording" . "true" .
+			"&name" . urlencode($openmeetings->name) .
+			"&roomtypes_id" . $openmeetings->roomtypes_id .
+			"&comment" . $openmeetings->comment .
+			"&numberOfPartizipants" . $openmeetings->numberOfPartizipants .
+			"&ispublic" . $openmeetings->ispublic .
+			"&appointment" . $openmeetings->appointment .
+			"&isDemoRoom" . $openmeetings->isDemoRoom .
+			"&demoTime" . $openmeetings->demoTime .
+			"&isModeratedRoom" . $openmeetings->isModeratedRoom .
+			"&externalRoomType" . urlencode($this->params->get('moduleKey')) .
+			"&allowUserQuestions" . "true" .
+			"&isAudioOnly" . "false" .
+			"&waitForRecording" . "true" .
 			"&allowRecording" . "true";
-		
+		
 		
 		$result = $restService->call($url,"");
 			
-		return checkResult($restService, $result);
-	}
-
-	function openmeetings_setUserObjectAndGenerateRoomHash($username, $firstname, $lastname,
-		$profilePictureUrl, $email, $externalUserId, $room_id, $becomeModeratorAsInt,
-		$showAudioVideoTestAsInt) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function openmeetings_setUserObjectAndGenerateRoomHash($username, $firstname, $lastname,
+		$profilePictureUrl, $email, $externalUserId, $room_id, $becomeModeratorAsInt,
+		$showAudioVideoTestAsInt) {
+		$restService = $this->getRestService();
 		
 		$result = $restService->call($this->getUrl()."UserService/setUserObjectAndGenerateRoomHash?" .
 				"SID=".$this->session_id.
@@ -204,21 +204,21 @@ class openmeetings_gateway {
 				"&becomeModeratorAsInt=".$becomeModeratorAsInt.
 				"&showAudioVideoTestAsInt=".$showAudioVideoTestAsInt);
 		
-		return checkResult($restService, $result);
-	}
-
-	function deleteRoom($openmeetings) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function deleteRoom($openmeetings) {
+		$restService = $this->getRestService();
 		
 		$result = $restService->call($this->getUrl()."RoomService/deleteRoom?" .
 				"SID=".$this->session_id.
 				"&rooms_id=".$openmeetings->room_id);
 		
-		return checkResult($restService, $result);
-	}
-
-	function updateRoomWithModeration($openmeetings) {
-		$restService = getRestService();
+		return $this->checkResult($restService, $result);
+	}
+
+	function updateRoomWithModeration($openmeetings) {
+		$restService = $this->getRestService();
 			
 		$result = $restService->call($this->getUrl()."RoomService/updateRoomWithModeration?" .
 				"SID=".$this->session_id .
@@ -233,7 +233,7 @@ class openmeetings_gateway {
 				"&demoTime=" . $openmeetings->demoTime .
 				"&isModeratedRoom=" . $openmeetings->isModeratedRoom);
 		
-		return checkResult($restService, $result);
-	}
-}
-?>
+		return $this->checkResult($restService, $result);
+	}
+}
+?>