/** * Move SCOs to the shared content folder * @param obj $aconnect a connect_class object * @param array sco-ids as array keys * @return bool false if error or nothing to move true if a move occured */ function aconnect_move_to_shared($aconnect, $scolist) { // Get shared folder sco-id $shscoid = aconnect_get_folder($aconnect, 'content'); // Iterate through list of sco and move them all to the shared folder if (!empty($shscoid)) { foreach ($scolist as $scoid => $data) { $params = array('action' => 'sco-move', 'folder-id' => $shscoid, 'sco-id' => $scoid); $aconnect->create_request($params); } return true; } else { return false; } }
/** * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $adobeconnect An object from the form in mod_form.php * @return boolean Success/Fail */ function adobeconnect_update_instance($adobeconnect) { global $DB; $adobeconnect->timemodified = time(); $adobeconnect->id = $adobeconnect->instance; $aconnect = aconnect_login(); $meetfldscoid = aconnect_get_folder($aconnect, 'my-meetings'); // Look for meetings whose names are similar $filter = array('filter-like-name' => $adobeconnect->name); $namematches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); if (empty($namematches)) { $namematches = array(); } // Find meeting URLs that are similar $url = $adobeconnect->meeturl; $filter = array('filter-like-url-path' => $url); $urlmatches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); if (empty($urlmatches)) { $urlmatches = array(); } else { // format url for comparison if (false === strpos($url, '/') or 0 != strpos($url, '/')) { $url = '/' . $url; } } $url = adobeconnect_clean_meet_url($url); // Get all instances of the activity meetings $param = array('instanceid' => $adobeconnect->instance); $grpmeetings = $DB->get_records('adobeconnect_meeting_groups', $param); if (empty($grpmeetings)) { $grpmeetings = array(); } // If no errors then check to see if the updated name and URL are actually different // If true, then update the meeting names and URLs now. $namechange = true; $urlchange = true; $timechange = true; // Look for meeting name change foreach ($namematches as $matchkey => $match) { if (array_key_exists($match->scoid, $grpmeetings)) { if (0 == substr_compare($match->name, $adobeconnect->name . '_', 0, strlen($adobeconnect->name . '_'), false)) { // Break out of loop and change all referenced meetings $namechange = false; break; } elseif (date('c', $adobeconnect->starttime) == $match->starttime) { $timechange = false; break; } elseif (date('c', $adobeconnect->endtime) == $match->endtime) { $timechange = false; break; } } } // Look for URL change foreach ($urlmatches as $matchkey => $match) { if (array_key_exists($match->scoid, $grpmeetings)) { if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) { // Break out of loop and change all referenced meetings $urlchange = false; break; } elseif (date('c', $adobeconnect->starttime) == $match->starttime) { $timechange = false; break; } elseif (date('c', $adobeconnect->endtime) == $match->endtime) { $timechange = false; break; } } } if ($timechange or $urlchange or $namechange) { $group = ''; $meetingobj = new stdClass(); foreach ($grpmeetings as $scoid => $grpmeeting) { if ($adobeconnect->groupmode) { $group = groups_get_group($grpmeeting->groupid); $group = '_' . $group->name; } else { $group = ''; } $meetingobj->scoid = $grpmeeting->meetingscoid; $meetingobj->name = $adobeconnect->name . $group; // updating meeting URL using the API corrupts the meeting for some reason // $meetingobj->meeturl = $data['meeturl'] . '_' . $group->name; $meetingobj->starttime = date('c', $adobeconnect->starttime); $meetingobj->endtime = date('c', $adobeconnect->endtime); // Update each meeting instance if (!aconnect_update_meeting($aconnect, $meetingobj, $meetfldscoid)) { debugging('error updating meeting', DEBUG_DEVELOPER); } if (empty($adobeconnect->meetingpublic)) { aconnect_update_meeting_perm($aconnect, $grpmeeting->meetingscoid, ADOBE_MEETPERM_PRIVATE); } else { aconnect_update_meeting_perm($aconnect, $grpmeeting->meetingscoid, ADOBE_MEETPERM_PUBLIC); } // Update calendar event $param = array('courseid' => $adobeconnect->course, 'instance' => $adobeconnect->id, 'groupid' => $grpmeeting->groupid, 'modulename' => 'adobeconnect'); $eventid = $DB->get_field('event', 'id', $param); if (!empty($eventid)) { $event = new stdClass(); $event->id = $eventid; $event->name = $meetingobj->name; $event->description = format_module_intro('adobeconnect', $adobeconnect, $adobeconnect->coursemodule); $event->courseid = $adobeconnect->course; $event->groupid = $grpmeeting->groupid; $event->userid = 0; $event->instance = $adobeconnect->id; $event->eventtype = 0 == $grpmeeting->groupid ? 'course' : 'group'; $event->timestart = $adobeconnect->starttime; $event->timeduration = $adobeconnect->endtime - $adobeconnect->starttime; $event->visible = 1; $event->modulename = 'adobeconnect'; $calendarevent = calendar_event::load($eventid); $calendarevent->update($event); } } } aconnect_logout($aconnect); return $DB->update_record('adobeconnect', $adobeconnect); }
foreach ($crsroles as $roleid => $crsrole) { if (user_has_role_assignment($usrobj->id, $roleid, $context->id)) { $usrcanjoin = true; } } // user has to be in a group if ($usrcanjoin and confirm_sesskey($sesskey)) { $usrprincipal = 0; $validuser = true; $groupobj = groups_get_group($groupid); // Get the meeting sco-id $param = array('instanceid' => $cm->instance, 'groupid' => $groupid); $meetingscoid = $DB->get_field('adobeconnect_meeting_groups', 'meetingscoid', $param); $aconnect = aconnect_login(); // Check if the meeting still exists on the Adobe server $meetfldscoid = aconnect_get_folder($aconnect, 'my-meetings'); $filter = array('filter-sco-id' => $meetingscoid); $meeting = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); if (!empty($meeting)) { $meeting = current($meeting); } if (!($usrprincipal = aconnect_user_exists($aconnect, $usrobj))) { if (!($usrprincipal = aconnect_create_user($aconnect, $usrobj))) { // DEBUG print_object("error creating user"); print_object($aconnect->_xmlresponse); $validuser = false; } } $context = get_context_instance(CONTEXT_MODULE, $id); // Check the user's capabilities and assign them the Adobe Role
function validation($data, $files) { global $CFG; $errors = parent::validation($data, $files); $aconnect = aconnect_login(); // Search for a Meeting with the same starting name. It will cause a duplicate // meeting name (and error) when the user begins to add participants to the meeting $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); $filter = array('filter-like-name' => $data['name']); $namematches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); if (empty($namematches)) { $namematches = array(); } // Now search for existing meeting room URLs $url = $data['meeturl']; // Check to see if there are any trailing slashes or additional parts to the url // ex. mymeeting/mysecondmeeting/ Only the 'mymeeting' part is valid if (0 != substr_count($url, '/') and false !== strpos($url, '/', 1)) { $errors['meeturl'] = get_string('invalidadobemeeturl', 'adobeconnect'); } $filter = array('filter-like-url-path' => $url); $urlmatches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); if (empty($urlmatches)) { $urlmatches = array(); } else { // format url for comparison if (false === strpos($url, '/') or 0 != strpos($url, '/')) { $url = '/' . $url; } } // Adding activity if (empty($data['update'])) { if ($data['starttime'] == $data['endtime']) { $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); } elseif ($data['endtime'] < $data['starttime']) { $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); } // Check for local activities with the same name if (record_exists('adobeconnect', 'name', $data['name'])) { $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); return $errors; } // Check Adobe connect server for duplicated names foreach ($namematches as $matchkey => $match) { if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); } } foreach ($urlmatches as $matchkey => $match) { $matchurl = rtrim($match->url, '/'); if (0 == substr_compare($matchurl, $url . '_', 0, strlen($url . '_'), false)) { $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); } } } else { // Updating activity // Look for existing meeting names, excluding this activity's group meeting(s) $sql = "SELECT meetingscoid, groupid FROM {$CFG->prefix}adobeconnect_meeting_groups " . " WHERE instanceid = " . $data['instance']; $grpmeetings = get_records_sql($sql); if (empty($grpmeetings)) { $grpmeetings = array(); } foreach ($namematches as $matchkey => $match) { if (!array_key_exists($match->scoid, $grpmeetings)) { if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); } } } foreach ($urlmatches as $matchkey => $match) { if (!array_key_exists($match->scoid, $grpmeetings)) { if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) { $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); } } } // Validate start and end times if ($data['starttime'] == $data['endtime']) { $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); } elseif ($data['endtime'] < $data['starttime']) { $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); } } aconnect_logout($aconnect); return $errors; }
/** * This function search through the user-meetings folder for a folder named * after the user's login name and returns the sco-id of the user's folder * * @param obj - adobe connection connection object * @param string - the name of the user's folder * @return mixed - sco-id of the user folder (int) or false if no folder exists * */ function aconnect_get_user_folder_sco_id($aconnect, $folder_name) { $scoid = false; $usr_meet_scoid = aconnect_get_folder($aconnect, 'user-meetings'); if (empty($usr_meet_scoid)) { return $scoid; } $params = array('action' => 'sco-expanded-contents', 'sco-id' => $usr_meet_scoid, 'filter-name' => $folder_name); if ($aconnect->request($params)) { $dom = new DomDocument(); $dom->loadXML($aconnect->get_xmlresponse()); $domnodelist = $dom->getElementsByTagName('sco'); if (!empty($domnodelist->length)) { if ($domnodelist->item(0)->hasAttributes()) { $domnode = $domnodelist->item(0)->attributes->getNamedItem('sco-id'); if (!is_null($domnode)) { $scoid = (int) $domnode->nodeValue; } } } } return $scoid; }
$protocol = 'https://'; } // Create a Connect Pro login session for this user $usrobj = new stdClass(); $usrobj = clone $USER; $login = $usrobj->username; $aconnect = new connect_class_dom($CFG->adobeconnect_host, $CFG->adobeconnect_port, '', '', '', $https); $aconnect->request_http_header_login(1, $login); $adobesession = $aconnect->get_cookie(); $params = array('instanceid' => $cm->instance, 'groupid' => $groupid); $sql = "SELECT meetingscoid FROM {adobeconnect_meeting_groups} amg WHERE " . "amg.instanceid = :instanceid AND amg.groupid = :groupid"; $meetscoid = $DB->get_record_sql($sql, $params); // Get the Meeting recording details $aconnect = aconnect_login(); $recordings = array(); $fldid = aconnect_get_folder($aconnect, 'content'); $data = aconnect_get_recordings($aconnect, $fldid, $meetscoid->meetingscoid); if (!empty($data)) { $recordings = $data; } // If at first you don't succeed ... $data2 = aconnect_get_recordings($aconnect, $meetscoid->meetingscoid, $meetscoid->meetingscoid); if (!empty($data2)) { $recordings = $data2; } aconnect_logout($aconnect); if ((!isset($recordings[$recordingid]) || empty($recordings[$recordingid])) && confirm_sesskey()) { /// Print the page header $url = new moodle_url('/mod/adobeconnect/view.php', array('id' => $cm->id)); $context = get_context_instance(CONTEXT_MODULE, $cm->id); if ($groupid) {
function adobe_connection_test($host = '', $port = 80, $username = '', $password = '', $httpheader = '', $emaillogin, $https = false) { if (empty($host) or empty($port) or 0 == $port or empty($username) or empty($password) or empty($httpheader)) { echo "</p>One of the required parameters is blank or incorrect: <br />" . "Host: {$host}<br /> Port: {$port}<br /> Username: {$username}<br /> Password: {$password}" . "<br /> HTTP Header: {$httpheader}</p>"; die; } $aconnect = new connect_class_dom($host, $port, $username, $password, '', $https); $params = array('action' => 'common-info'); // Send common-info call to obtain the session key. echo '<p>Sending common-info call:</p>'; $aconnect->create_request($params); $response = $aconnect->get_xmlresponse(); if (!empty($response)) { // Get the session key from the XML response. $aconnect->read_cookie_xml($response); $cookie = $aconnect->get_cookie(); if (empty($cookie)) { echo '<p>unable to obtain session key from common-info call</p>'; echo '<p>xmlrequest:</p>'; $doc = new DOMDocument(); if ($doc->loadXML($aconnect->get_xmlrequest())) { echo '<p>' . htmlspecialchars($doc->saveXML()) . '</p>'; } else { echo '<p>unable to display the XML request</p>'; } echo '<p>xmlresponse:</p>'; $doc = new DOMDocument(); if ($doc->loadXML($aconnect->get_xmlresponse())) { echo '<p>' . htmlspecialchars($doc->saveHTML()) . '</p>'; } else { echo '<p>unable to display the XML response</p>'; } } else { // Print success. echo '<p style="color:#006633">successfully obtained the session key: ' . $aconnect->get_cookie() . '</p>'; // Test logging in as the administrator. $params = array('action' => 'login', 'login' => $aconnect->get_username(), 'password' => $aconnect->get_password()); if ($aconnect->request($params)) { echo '<p style="color:#006633">successfully logged in as admin user</p>'; // Test retrieval of folders. echo '<p>Testing retrevial of shared content, recording and meeting folders:</p>'; $folderscoid = aconnect_get_folder($aconnect, 'content'); if ($folderscoid) { echo '<p style="color:#006633">successfully obtained shared content folder scoid: ' . $folderscoid . '</p>'; } else { echo '<p>error obtaining shared content folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } $folderscoid = aconnect_get_folder($aconnect, 'forced-archives'); if ($folderscoid) { echo '<p style="color:#006633">successfully obtained forced-archives (meeting recordings) folder scoid: ' . $folderscoid . '</p>'; } else { echo '<p>error obtaining forced-archives (meeting recordings) folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } $folderscoid = aconnect_get_folder($aconnect, 'meetings'); if ($folderscoid) { echo '<p style="color:#006633">successfully obtained meetings folder scoid: ' . $folderscoid . '</p>'; } else { echo '<p>error obtaining meetings folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } // Test creating a meeting. $folderscoid = aconnect_get_folder($aconnect, 'meetings'); $meeting = new stdClass(); $meeting->name = 'testmeetingtest'; $time = time(); $meeting->starttime = $time; $time = $time + 60 * 60; $meeting->endtime = $time; if ($meetingscoid = aconnect_create_meeting($aconnect, $meeting, $folderscoid)) { echo '<p style="color:#006633">successfully created meeting <b>testmeetingtest</b> scoid: ' . $meetingscoid . '</p>'; } else { echo '<p>error creating meeting <b>testmeetingtest</b> folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } // Test creating a user. $user = new stdClass(); $user->username = '******'; $user->firstname = 'testusertest'; $user->lastname = 'testusertest'; $user->email = '*****@*****.**'; if (!empty($emaillogin)) { $user->username = $user->email; } $skipdeletetest = false; if (!($usrprincipal = aconnect_user_exists($aconnect, $user))) { $usrprincipal = aconnect_create_user($aconnect, $user); if ($usrprincipal) { echo '<p style="color:#006633">successfully created user <b>testusertest</b> principal-id: ' . $usrprincipal . '</p>'; } else { echo '<p>error creating user <b>testusertest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; aconnect_logout($aconnect); die; } } else { echo '<p>user <b>testusertest</b> already exists skipping delete user test</p>'; $skipdeletetest = true; } // Test assigning a user a role to the meeting. if (aconnect_check_user_perm($aconnect, $usrprincipal, $meetingscoid, ADOBE_PRESENTER, true)) { echo '<p style="color:#006633">successfully assigned user <b>testusertest</b>' . ' presenter role in meeting <b>testmeetingtest</b>: ' . $usrprincipal . '</p>'; } else { echo '<p>error assigning user <b>testusertest</b> presenter role in meeting <b>testmeetingtest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } // Test removing role from meeting. if (aconnect_check_user_perm($aconnect, $usrprincipal, $meetingscoid, ADOBE_REMOVE_ROLE, true)) { echo '<p style="color:#006633">successfully removed presenter role for user <b>testusertest</b>' . ' in meeting <b>testmeetingtest</b>: ' . $usrprincipal . '</p>'; } else { echo '<p>error remove presenter role for user <b>testusertest</b> in meeting <b>testmeetingtest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } // Test removing user from server. if (!$skipdeletetest) { if (aconnect_delete_user($aconnect, $usrprincipal)) { echo '<p style="color:#006633">successfully removed user <b>testusertest</b> principal-id: ' . $usrprincipal . '</p>'; } else { echo '<p>error removing user <b>testusertest</b></p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } } // Test removing meeting from server. if ($meetingscoid) { if (aconnect_remove_meeting($aconnect, $meetingscoid)) { echo '<p style="color:#006633">successfully removed meeting <b>testmeetingtest</b> scoid: ' . $meetingscoid . '</p>'; } else { echo '<p>error removing meeting <b>testmeetingtest</b> folder</p>'; echo '<p style="color:#680000">XML request:<br />' . htmlspecialchars($aconnect->get_xmlrequest()) . '</p>'; echo '<p style="color:#680000">XML response:<br />' . htmlspecialchars($aconnect->get_xmlresponse()) . '</p>'; } } } else { echo '<p style="color:#680000">logging in as ' . $username . ' was not successful, check to see if the' . ' username and password are correct </p>'; } } } else { echo '<p style="color:#680000">common-info API call returned an empty document.' . ' Please check your settings and try again </p>'; } aconnect_logout($aconnect); }
public function validation($data, $files) { global $DB, $USER, $COURSE; $errors = parent::validation($data, $files); $usrobj = clone $USER; $name = empty($usrobj->idnumber) ? $usrobj->username : $usrobj->idnumber; $usrobj->username = set_username($name, $usrobj->email); $aconnect = aconnect_login(); $groupprincipalid = aconnect_get_host_group($aconnect); // Check if the user exists and if not create the new user. if (!($usrprincipal = aconnect_user_exists($aconnect, $usrobj))) { if (!($usrprincipal = aconnect_create_user($aconnect, $usrobj))) { debugging("error creating user", DEBUG_DEVELOPER); } } // Add the user to the host group if they aren't already. aconnect_add_user_group($aconnect, $groupprincipalid, $usrprincipal); // Search for a Meeting with the same starting name. It will cause a duplicate // meeting name (and error) when the user begins to add participants to the meeting. $meetfldscoid = aconnect_get_folder($aconnect, 'meetings'); $filter = array('filter-like-name' => $data['name']); $namematches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); // Search the user's adobe connect folder. $usrfldscoid = aconnect_get_user_folder_sco_id($aconnect, $usrobj->username); if (!empty($usrfldscoid)) { $namematches = $namematches + aconnect_meeting_exists($aconnect, $usrfldscoid, $filter); } if (empty($namematches)) { $namematches = array(); } // Now search for existing meeting room URLs. $url = $data['meeturl'] = adobeconnect_clean_meet_url($data['meeturl']); // Check to see if there are any trailing slashes or additional parts to the url // ex. mymeeting/mysecondmeeting/ Only the 'mymeeting' part is valid. if (0 != substr_count($url, '/') and false !== strpos($url, '/', 1)) { $errors['meeturl'] = get_string('invalidadobemeeturl', 'adobeconnect'); } $filter = array('filter-like-url-path' => $url); $urlmatches = aconnect_meeting_exists($aconnect, $meetfldscoid, $filter); // Search the user's adobe connect folder. if (!empty($usrfldscoid)) { $urlmatches = $urlmatches + aconnect_meeting_exists($aconnect, $usrfldscoid, $filter); } if (empty($urlmatches)) { $urlmatches = array(); } else { // Format url for comparison. if (false === strpos($url, '/') or 0 != strpos($url, '/')) { $url = '/' . $url; } } // Check URL for correct length and format. if (!empty($data['meeturl'])) { if (strlen($data['meeturl']) > 60) { $errors['meeturl'] = get_string('longurl', 'adobeconnect'); } else { if (!preg_match('/^[a-z][a-z\\-]*/i', $data['meeturl'])) { $errors['meeturl'] = get_string('invalidurl', 'adobeconnect'); } } } // Check for available groups if groupmode is selected. if ($data['groupmode'] > 0) { $crsgroups = groups_get_all_groups($COURSE->id); if (empty($crsgroups)) { $errors['groupmode'] = get_string('missingexpectedgroups', 'adobeconnect'); } } // Adding activity. if (empty($data['update'])) { if ($data['starttime'] == $data['endtime']) { $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); } else { if ($data['endtime'] < $data['starttime']) { $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); } } // Check for local activities with the same name. $params = array('name' => $data['name']); if ($DB->record_exists('adobeconnect', $params)) { $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); return $errors; } // Check Adobe connect server for duplicated names. foreach ($namematches as $match) { if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); } } foreach ($urlmatches as $match) { $matchurl = rtrim($match->url, '/'); if (0 == substr_compare($matchurl, $url . '_', 0, strlen($url . '_'), false)) { $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); } } } else { // Updating activity // Look for existing meeting names, excluding this activity's group meeting(s). $grpmeetings = $DB->get_records('adobeconnect_meeting_groups', array('instanceid' => $data['instance']), null, 'meetingscoid, groupid'); if (empty($grpmeetings)) { $grpmeetings = array(); } foreach ($namematches as $match) { if (!array_key_exists($match->scoid, $grpmeetings)) { if (0 == substr_compare($match->name, $data['name'] . '_', 0, strlen($data['name'] . '_'), false)) { $errors['name'] = get_string('duplicatemeetingname', 'adobeconnect'); } } } foreach ($urlmatches as $match) { if (!array_key_exists($match->scoid, $grpmeetings)) { if (0 == substr_compare($match->url, $url . '_', 0, strlen($url . '_'), false)) { $errors['meeturl'] = get_string('duplicateurl', 'adobeconnect'); } } } // Validate start and end times. if ($data['starttime'] == $data['endtime']) { $errors['starttime'] = get_string('samemeettime', 'adobeconnect'); $errors['endtime'] = get_string('samemeettime', 'adobeconnect'); } else { if ($data['endtime'] < $data['starttime']) { $errors['starttime'] = get_string('greaterstarttime', 'adobeconnect'); } } } aconnect_logout($aconnect); if ($aconnect->timeout()) { $errors = array('name' => get_string('errortimeout', 'adobeconnect')); } return $errors; }