3 require_once('lib/ACConnection.php');
4 require_once('lib/ACUser.php');
6 class ACRoom extends ACConnection {
9 public function createRoom($sessionid, $roomname) {
11 $fp = @fsockopen($this->adobe_connect_host, $this->adobe_connect_port);
15 if ($this->checkRoom($sessionid, $roomname)) {
19 $roomname = trim($roomname);
20 $url = "/api/xml?action=sco-update&name=$roomname&folder-id=".$this->adobe_connect_folderid."&type=meeting&session=$sessionid";
21 fputs($fp, "GET ".$url." HTTP/1.0\r\nHost: ".$this->adobe_connect_host."\r\n\r\n");
23 while($line = fgets($fp)) {
25 if (preg_match('/\ sco-id=\"([0-9]*)\"/', $line, $result)) {
39 public function deleteRoom($sessionid, $roomname) {
41 if (!$scoid = $this->checkRoom($sessionid, $roomname)) {
45 $fp = @fsockopen($this->adobe_connect_host, $this->adobe_connect_port);
50 $url = "/api/xml?action=sco-delete&sco-id=$scoid&session=$sessionid";
51 fputs($fp, "GET ".$url." HTTP/1.0\r\nHost: ".$this->adobe_connect_host."\r\n\r\n");
53 $response = $this->checkResponse($fp, __FUNCTION__);
61 public function assignUser($sessionid, $username, $roomname, $role) {
63 if (!$scoid = $this->checkRoom($sessionid, $roomname)) {
68 $principalid = $user->checkUser($sessionid, $username);
84 return $this->assignAction($sessionid, $scoid, $principalid, $acrole);
88 public function assignAction($sessionid, $scoid, $principalid, $role) {
90 $fp = @fsockopen($this->adobe_connect_host, $this->adobe_connect_port);
95 $url = "/api/xml?action=permissions-update&permission-id=$role&acl-id=$scoid&principal-id=$principalid&session=$sessionid";
96 fputs($fp, "GET ".$url." HTTP/1.0\r\nHost: ".$this->adobe_connect_host."\r\n\r\n");
98 $response = $this->checkResponse($fp, __FUNCTION__);
105 public function getRoomUrl($sessionid, $scoid) {
108 $fp = @fsockopen($this->adobe_connect_host, $this->adobe_connect_port);
113 $url = "/api/xml?action=sco-info&sco-id=$scoid&session=$sessionid";
114 fputs($fp, "GET ".$url." HTTP/1.0\r\nHost: ".$this->adobe_connect_host."\r\n\r\n");
116 while ($line = fgets($fp)) {
117 if (preg_match('@\<url-path\>\/([^/]+)@', $line, $result)) {
118 $roomurl = $result[1];
123 if (empty($roomurl)) {
131 public function checkRoom($sessionid, $roomname) {
133 $fp = @fsockopen($this->adobe_connect_host, $this->adobe_connect_port);
138 $url = "/api/xml?action=sco-expanded-contents&sco-id=".$this->adobe_connect_folderid."&filter-type=meeting&filter-name=$roomname&session=$sessionid";
139 fputs($fp, "GET ".$url." HTTP/1.0\r\nHost: ".$this->adobe_connect_host."\r\n\r\n");
141 while($line = fgets($fp)) {
143 if (preg_match('/\ sco-id=\"([0-9]*)\"/', $line, $result)) {