public function individualRoom($roomId) { $smarty = new RoomGeneratorSmarty(); $room = Room::getRoomById($roomId); $apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); $token = $apiObj->generate_token($room->getSessionId()); $smarty->assign('title', 'OpenTok Room Generator - PHP'); $smarty->assign('sessionId', $room->getSessionId()); $smarty->assign('token', $token); $smarty->assign('roomId', $room->getRoomId()); $smarty->display($_SERVER['DOCUMENT_ROOT'] . '/php_generator/app/view/rooms/individual_room.tpl'); }
$apiServer = 'https://api.opentok.com'; $apiObj = new OpenTokSDK($apiKey, $apiSecret); } if ($action == 'request') { $avchat_token = ''; if (empty($grp)) { $grp = $userid < $to ? md5($userid) . md5($to) : md5($to) . md5($userid); $grp = md5($_SERVER['HTTP_HOST'] . $grp); if ($videoPluginType == '3') { $location = time(); if (!empty($_SERVER['REMOTE_ADDR'])) { $location = $_SERVER['REMOTE_ADDR']; } $session = $apiObj->create_session($location); $grp = $session->getSessionId(); $avchat_token = $apiObj->generate_token($grp); } } if (isset($chatroommode)) { sendChatroomMessage($to, $avchat_language[19] . " <a token ='" . $avchat_token . "' href='javascript:void(0);' onclick=\"javascript:jqcc.ccavchat.join('" . $to . "');\">" . $avchat_language[20] . "</a> ", 0); } else { if ($videoPluginType == '6') { sendMessage($to, $avchat_language[2] . " <a class='avchat_link_" . $grp . "' token ='" . $avchat_token . "' href='javascript:void(0);' class='avchat_link_" . $grp . "' onclick=\"javascript:jqcc.ccavchat.accept('" . $userid . "','" . $grp . "');\">" . $avchat_language[3] . "</a> " . $avchat_language[45] . "<a href='javascript:void(0);' class='avchat_link_" . $grp . "' onclick=\"javascript:jqcc.ccavchat.reject_call('" . $userid . "','" . $grp . "');\">" . $avchat_language[43] . ".</a>" . $avchat_language[46], 1); } else { sendMessage($to, $avchat_language[2] . " <a class='avchat_link_" . $grp . "' token ='" . $avchat_token . "' href='javascript:void(0);' class='avchat_link_" . $grp . "' onclick=\"javascript:jqcc.ccavchat.accept('" . $userid . "','" . $grp . "');\">" . $avchat_language[3] . "</a> " . $avchat_language[46], 1); } incrementCallback(); $_REQUEST['callback']; if ($videoPluginType == '6') { sendMessage($to, $avchat_language[5] . $avchat_language[44] . "<a href='javascript:void(0);' class='avchat_link_" . $grp . "' onclick=\"javascript:jqcc.ccavchat.cancel_call('" . $to . "','" . $grp . "');\">" . $avchat_language[43] . ".</a>", 2); } else {
$ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded')); curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-TB-TOKEN-ATUH: {$token}")); $result = curl_exec($ch); echo $result; //echo curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); } assert_options(ASSERT_CALLBACK, 'my_assert_handler'); set_exception_handler('exception_handler'); require_once '../OpenTokSDK.php'; $a = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); $token = $a->generate_token(); assert('$token'); $token = $a->generate_token("mysession"); assert('$token'); $token = $a->generate_token("mysession", RoleConstants::SUBSCRIBER); assert('$token'); $token = $a->generate_token("mysession", RoleConstants::PUBLISHER); assert('$token'); $token = $a->generate_token("mysession", RoleConstants::MODERATOR); assert('$token'); try { $token = $a->generate_token("mysession", "randomString"); assert(false); } catch (Exception $e) { assert('$e'); }
if (!empty($_REQUEST['basedata'])) { $basedata = $_REQUEST['basedata']; } if (!checkcURL() && $videoPluginType == '2') { echo "<div style='background:white;'>Please contact your site administrator to configure this plugin.</div>"; exit; } if ($videoPluginType == '2') { include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'API_Config.php'; include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'OpenTokSDK.php'; $apiKey = '348501'; $apiSecret = '1022308838584cb6eba1fd9548a64dc1f8439774'; $apiServer = 'https://api.opentok.com/hl'; $apiObj = new OpenTokSDK($apiKey, $apiSecret); if (empty($_SESSION['avchat_token'])) { $_SESSION['avchat_token'] = $apiObj->generate_token(); } } if ($_REQUEST['action'] == 'request') { if ($videoPluginType == '2') { $location = time(); $session = $apiObj->create_session($location); $grp = $session->getSessionId(); } else { $grp = time(); } sendMessage($_REQUEST['to'], $broadcast_language[2] . " <a href='javascript:void(0);' onclick=\"javascript:jqcc.ccbroadcast.accept('" . $userid . "','" . $grp . "');\">" . $broadcast_language[3] . "</a> " . $broadcast_language[4], 1); sendMessage($_REQUEST['to'], $broadcast_language[5], 2); if (!empty($_REQUEST['callback'])) { header('content-type: application/json; charset=utf-8'); echo $_REQUEST['callback'] . '()';
<?php /*! * OpenTok PHP Library * http://www.tokbox.com/ * * Copyright 2010, TokBox, Inc. * */ require_once 'SDK/API_Config.php'; require_once 'SDK/OpenTokSDK.php'; $apiObj = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); $session = $apiObj->create_session($_SERVER["REMOTE_ADDR"]); echo $session->getSessionId(); echo "<br/>"; echo $apiObj->generate_token();
<?php /*! * OpenTok PHP Library v0.90.0 * http://www.tokbox.com/ * * Copyright 2010, TokBox, Inc. * * Date: November 05 14:50:00 2010 */ require_once 'OpenTokSDK.php'; $a = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); print $a->generate_token(); print "\n"; print $a->generate_token('mysession'); print "\n"; print $a->generate_token('mysession', RoleConstants::MODERATOR); print "\n"; try { print $a->create_session('127.0.0.1')->getSessionId(); } catch (OpenTokException $e) { print $e->getMessage(); } print "\n";
user_sessions.php?tab=schedule">Return to dashboard</a></p> </div> </div><!-- Session Message --> </div><!-- ALL SCREEN OUTER --> </div> <?php } else { if ($fetch['time_requested'] == '1' || strtotime($date) >= strtotime($fetch['session_datetime']) && strtotime($date) <= strtotime($fetch['session_datetime'] . "+" . $fetch['duration'] . " MINUTES ")) { $field = " tokbox_id "; $table = " users "; $condition = " AND id = '" . $fetch['exp_applied_id'] . "' "; $user_dt = getDetail($field, $table, $condition); $sessionId = $user_dt[0]['tokbox_id']; $apiObj = new OpenTokSDK($tokboxApi, $tokboxApiSecret); $tokenId = $apiObj->generate_token($sessionId, RoleConstants::PUBLISHER, null, $_SESSION['LoginUserId']); ?> <div class="SmallVideoCont"> <div id="smallvideo"></div><!-- Small Video --> </div> <div id="exp_id"><?php echo $fetch['exp_applied_id']; ?> </div> <script type="text/javascript"> var root = "<?php echo $root; ?> "; var type="user"; var s_id = "<?php
\t\t\t\t\tdocument.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='" \t\t\t\t\t\t\t\t\t+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" ); \t\t\t\t</script> \t\t\t</div>\t \t</body> \t</html> EOD; } else { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'API_Config.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'OpenTokSDK.php'; $apiKey = '23262682'; $apiSecret = '4c03c626ca826d554d66c16d74afb80fe2d0e3dc'; $apiServer = 'https://api.opentok.com/hl'; $sessionid = $_REQUEST['grp']; $apiObj = new OpenTokSDK($apiKey, $apiSecret); $token = $apiObj->generate_token(); if (!empty($_REQUEST['chatroommode'])) { if (empty($_REQUEST['join'])) { sendChatroomMessage($sessionid, $broadcast_language[9] . " <a href='javascript:void(0);' onclick=\"javascript:jqcc.ccbroadcast.join('" . $_REQUEST['grp'] . "');\">" . $broadcast_language[10] . "</a>"); } $sql = "select vidsession from cometchat_chatrooms where id = '" . mysql_real_escape_string($sessionid) . "'"; $query = mysql_query($sql); $chatroom = mysql_fetch_array($query); if (empty($chatroom['vidsession'])) { $session = $apiObj->create_session(time()); $newsessionid = $session->getSessionId(); $sql = "update cometchat_chatrooms set vidsession = '" . mysql_real_escape_string($newsessionid) . "' where id = '" . mysql_real_escape_string($sessionid) . "'"; $query = mysql_query($sql); $sessionid = $newsessionid; } else { $sessionid = $chatroom['vidsession'];
<?php $sql = " SELECT s.time_requested,s.session_datetime,s.duration,s.title,s.description,s.question, "; $sql .= " u.id,u.fname,u.lname "; $sql .= " FROM sessions as s LEFT JOIN users as u ON(s.user_id = u.id) "; $sql .= " WHERE s.exp_applied_id='" . $_SESSION['LoginUserId'] . "' and s.status='2' "; $sql .= " and (('" . $date . "' >= s.session_datetime and '" . $date . "' <= DATE_ADD(s.session_datetime, INTERVAL s.duration MINUTE)) or (s.time_requested='1'))"; $query = mysql_query($sql) or die(mysql_error()); if ($query) { if (mysql_num_rows($query) > 0) { $field = " tokbox_id "; $table = " users "; $condition = " AND id = '" . $_SESSION['LoginUserId'] . "' "; $user_dt = getDetail($field, $table, $condition); $sessionId = $user_dt[0]['tokbox_id']; $apiObj = new OpenTokSDK($tokboxApi, $tokboxApiSecret); $tokenId = $apiObj->generate_token($sessionId, RoleConstants::PUBLISHER, null, 'exp'); ?> <div id="exp_id" style="display:none;"><?php echo $_SESSION['LoginUserId']; ?> </div> <script type="text/javascript"> var type="exp"; var apiKey = "<?php echo $tokboxApi; ?> "; var apiSecret = "<?php echo $tokboxApiSecret;
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'OpenTokSDK.php'; $apiKey = '348501'; $apiSecret = '1022308838584cb6eba1fd9548a64dc1f8439774'; $apiServer = 'https://api.opentok.com'; $apiObj = new OpenTokSDK($apiKey, $apiSecret); } if ($_REQUEST['action'] == 'request') { $avchat_token = ''; if ($videoPluginType == '3') { $location = time(); if (!empty($_SERVER['REMOTE_ADDR'])) { $location = $_SERVER['REMOTE_ADDR']; } $session = $apiObj->create_session($location); $grp = $session->getSessionId(); $avchat_token = $apiObj->generate_token($grp); } else { $grp = sha1(time() + $userid + 'from'); } if (isset($_REQUEST['chatroommode'])) { sendChatroomMessage($_REQUEST['to'], $avchat_language[19] . " <a token ='" . $avchat_token . "' href='javascript:void(0);' onclick=\"javascript:jqcc.ccavchat.join('" . $_REQUEST['to'] . "');\">" . $avchat_language[20] . "</a> "); } else { sendMessageTo($_REQUEST['to'], $avchat_language[2] . " <a token ='" . $avchat_token . "' href='javascript:void(0);' onclick=\"javascript:jqcc.ccavchat.accept('" . $userid . "','" . $grp . "');\">" . $avchat_language[3] . "</a> " . $avchat_language[4]); $temp_callback = $_REQUEST['callback']; $_REQUEST['callback'] = time(); sendSelfMessage($_REQUEST['to'], $avchat_language[5]); $_REQUEST['callback'] = $temp_callback; } if (!empty($_REQUEST['callback'])) { header('content-type: application/json; charset=utf-8'); echo $_REQUEST['callback'] . '()';