Exemplo n.º 1
0
/**
 * Fetch the $_POST vars and format into JSON 
 * to POST to GoToWebinar
 *  Return value is a webinar key
 * Also, write vals into webinars db
 */
function createWebinar()
{
    global $globalCurlOptions, $db;
    $startDateAry = explode("/", $_POST['startDate']);
    $startTimeAry = explode(":", $_POST['startTime']);
    $startTS = mktime($startTimeAry[0], $startTimeAry[1], 0, $startDateAry[0], $startDateAry[1], $startDateAry[2]);
    $duration = $_POST['duration'] * 60 * 60;
    $endTS = $startTS + $duration;
    $description = $_POST['presenter'] . "\r\n" . $_POST['description'];
    $webinarDetails = array("subject" => $_POST['title'], "description" => $description, "times" => array(array("startTime" => date("c", $startTS), "endTime" => date("c", $endTS))), "timeZone" => $_POST['timezone']);
    $tokenAry = getAuthToken("gtw");
    $accessToken = $tokenAry['access_token'];
    $organizerKey = $tokenAry['organizer_key'];
    $webinarInfo = json_encode($webinarDetails);
    $ch = curl_init();
    $url = "https://api.citrixonline.com:443/G2W/rest/organizers/" . $organizerKey . "/webinars";
    $headers = array("Authorization: " . $accessToken, "Accept: application/json", "Content-Type: application/json; charset=UTF-8", "Content-Length: " . strlen($webinarInfo));
    curl_setopt_array($ch, $globalCurlOptions);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $webinarInfo);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $result = curl_exec($ch);
    $mtgInfo = json_decode($result, TRUE);
    $webinarKey = $mtgInfo['webinarKey'];
    // Add to DB
    $q = "INSERT INTO webinars SET\n       title        =    '" . mysqli_real_escape_string($db, $_POST['title']) . "',\n       presenter    =    '" . mysqli_real_escape_string($db, $_POST['presenter']) . "',\n       description  =    '" . mysqli_real_escape_string($db, $_POST['description']) . "',\n       startTime    =    '" . date("Y-m-d H:i:00", $startTS) . "',\n       endTime      =    '" . date("Y-m-d H:i:00", $endTS) . "',\n       timezone     =    '" . $_POST['timezone'] . "',\n       campaignID   =    '" . $_POST['campaignID'] . "',\n       webinarKey   =    '{$webinarKey}'";
    if (!mysqli_query($db, $q)) {
        printf("Error: %s\n", mysqli_sqlstate($db));
    }
    mysqli_close($db);
    echo "<p>Webinar key {$webinarKey} has been created</p>";
}
 public function module_setConfigInfo($params)
 {
     $dbuser = $params["dbuname"];
     $dbpass = $params["dbpass"];
     $dbname = $params["dbname"];
     $mod_auth_token = getAuthToken("portcullis");
     addConfigKey($mod_auth_token, "dbuser", $dbuser);
     addConfigKey($mod_auth_token, "dbpass", $dbpass);
     addConfigKey($mod_auth_token, "dbname", $dbname);
     return "config_success";
 }
Exemplo n.º 3
0
function setHeaders($shopId, $requestId, $timestamp, $mode, $authToken, $key, $client)
{
    //Création des en-têtes shopId, requestId, timestamp, mode et authToken
    $ns = 'http://v5.ws.vads.lyra.com/Header/';
    $headerShopId = new SOAPHeader($ns, 'shopId', $shopId);
    $headerRequestId = new SOAPHeader($ns, 'requestId', $requestId);
    $headerTimestamp = new SOAPHeader($ns, 'timestamp', $timestamp);
    $headerMode = new SOAPHeader($ns, 'mode', $mode);
    $authToken = getAuthToken($requestId, $timestamp, $key);
    $headerAuthToken = new SOAPHeader($ns, 'authToken', $authToken);
    //Ajout des en-têtes dans le SOAP Header
    $headers = array($headerShopId, $headerRequestId, $headerTimestamp, $headerMode, $headerAuthToken);
    $client->__setSoapHeaders($headers);
}
Exemplo n.º 4
0
function authenticateAndSend($deviceRegistrationId, $messageText, $c2dm_user_name, $c2dm_password, $c2dm_source, $c2dm_service)
{
    //Get above parameters from DB and the generate request (To get //parameters from DB have to implement. For now these parameters are coming //from request)
    $authCode = getAuthToken($c2dm_user_name, $c2dm_password, $c2dm_source, $c2dm_service);
    $headers = array('Authorization: GoogleLogin auth=' . $authCode);
    $data = array('registration_id' => $deviceRegistrationId, 'collapse_key' => 'TEST', 'data.message' => $messageText);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://android.clients.google.com/c2dm/send");
    if ($headers) {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    }
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    $response = curl_exec($ch);
    curl_close($ch);
    echo $response;
}
Exemplo n.º 5
0
function sendInvitationMail($blogid, $userid, $name, $comment, $senderName, $senderEmail)
{
    $ctx = Model_Context::getInstance();
    $pool = DBModel::getInstance();
    if (empty($blogid)) {
        $pool->reset('BlogSettings');
        $blogid = $pool->getCell('max(blogid)');
        // If no blogid, get the latest created blogid.
    }
    $email = User::getEmail($userid);
    $pool->reset('Users');
    $pool->setQualifier('userid', 'eq', $userid);
    $password = getCell('password');
    $authtoken = getAuthToken($userid);
    $blogName = getBlogName($blogid);
    if (empty($email)) {
        return 1;
    }
    if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
        return 2;
    }
    if (empty($name)) {
        $name = User::getName($userid);
    }
    if (strcmp($email, Utils_Unicode::lessenAsEncoding($email, 64)) != 0) {
        return 11;
    }
    //$loginid = POD::escapeString(Utils_Unicode::lessenAsEncoding($email, 64));
    $name = POD::escapeString(Utils_Unicode::lessenAsEncoding($name, 32));
    //$headers = 'From: ' . encodeMail($senderName) . '<' . $senderEmail . ">\n" . 'X-Mailer: ' . TEXTCUBE_NAME . "\n" . "MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n";
    if (empty($name)) {
        $subject = _textf('귀하를 %1님이 초대합니다', $senderName);
    } else {
        $subject = _textf('%1님을 %2님이 초대합니다', $name, $senderName);
    }
    $message = file_get_contents(ROOT . "/resources/style/letter/letter.html");
    $message = str_replace('[##_title_##]', _text('초대장'), $message);
    $message = str_replace('[##_content_##]', $comment, $message);
    $message = str_replace('[##_images_##]', $ctx->getProperty('uri.service') . "/resources/style/letter", $message);
    $message = str_replace('[##_link_##]', getInvitationLink(getBlogURL($blogName), $email, $password, $authtoken), $message);
    $message = str_replace('[##_go_blog_##]', getBlogURL($blogName), $message);
    $message = str_replace('[##_link_title_##]', _text('블로그 바로가기'), $message);
    if (empty($name)) {
        $message = str_replace('[##_to_##]', '', $message);
    } else {
        $message = str_replace('[##_to_##]', _text('받는 사람') . ': ' . $name, $message);
    }
    $message = str_replace('[##_sender_##]', _text('보내는 사람') . ': ' . $senderName, $message);
    $ret = sendEmail($senderName, $senderEmail, $name, $email, $subject, $message);
    if ($ret !== true) {
        return array(14, $ret[1]);
    }
    return true;
}
Exemplo n.º 6
0
 * Send webinar details in array
 *  Return value: 
 *
 *	Array
 *	(
 *	[joinURL] => https://www.gotomeeting.com/join/982668581
 *	[meetingid] => 982668581
 *	[maxParticipants] => 26
 *	[uniqueMeetingId] => 982668581
 *	[conferenceCallInfo] => US: +1 (657) 220-3412
 * Access Code: 982-668-581
 *	)
 *
*/
include "citrix_auth.php";
$tokenAry = getAuthToken("gtm");
$accessToken = $tokenAry['access_token'];
$meetingDetails = array("subject" => "Test of GTM API", "starttime" => date("c", mktime(9, 22, 0, 12, 25, 2015)), "endtime" => date("c", mktime(10, 22, 0, 12, 25, 2015)), "passwordrequired" => false, "conferencecallinfo" => "Free", "timezonekey" => "", "meetingtype" => "scheduled");
$mtgAry = createMeeting($accessToken, $meetingDetails);
print_r($mtgAry);
// =========================================================================
//    Create a GTM meeting
function createMeeting($accessToken, $meetingDetails)
{
    global $globalCurlOptions;
    $meetingInfo = json_encode($meetingDetails);
    $ch = curl_init();
    $url = "https://api.citrixonline.com:443/G2M/rest/meetings";
    $headers = array("Authorization: " . $accessToken, "Accept: application/json", "Content-Type: application/json; charset=UTF-8", "Content-Length: " . strlen($meetingInfo));
    curl_setopt_array($ch, $globalCurlOptions);
    curl_setopt($ch, CURLOPT_URL, $url);
Exemplo n.º 7
0
<?php

session_start();
include_once '../properties/c2dm_account.php';
getAuthToken($c2dm_user_name, $c2dm_password, $c2dm_source, $c2dm_service);
function getAuthToken($username, $password, $source, $service)
{
    if (isset($_SESSION['google_auth_id']) && $_SESSION['google_auth_id'] != null) {
        return $_SESSION['google_auth_id'];
    }
    // get an authorization token
    $ch = curl_init();
    if (!ch) {
        return false;
    }
    curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");
    $post_fields = "accountType=" . urlencode('GOOGLE') . "&Email=" . urlencode($userName) . "&Passwd=" . urlencode($password) . "&source=" . urlencode($source) . "&service=" . urlencode($service);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $response = curl_exec($ch);
    curl_close($ch);
    if (strpos($response, '200 OK') === false) {
        return false;
    }
    // find the auth code
    preg_match("/(Auth=)([\\w|-]+)/", $response, $matches);
Exemplo n.º 8
0
</td>
													<td class="email"><?php 
        echo htmlspecialchars($value['loginid']);
        ?>
</td>
													<td class="date"><?php 
        echo Timestamp::format5($value['created']);
        ?>
</td>
													<td class="posting"><?php 
        echo $value['posting'];
        ?>
</td>
													<td class="status">
<?php 
        $authtoken = getAuthToken($value['userid']);
        if ($value['lastlogin'] == 0) {
            ?>
													<?php 
            echo _t('미참여');
            if ($value['acl'] & BITWISE_ADMINISTRATOR) {
                $invitationURL = getInvitationLink(getBlogURLById($blogid), htmlspecialchars($value['loginid']), $value['password'], $authtoken);
                echo '<a href="' . $invitationURL . '">' . _t('초대 링크') . '</a>';
            }
        } else {
            ?>
													<?php 
            echo _t('참여중');
            if ($value['acl'] & BITWISE_ADMINISTRATOR && !empty($authtoken) && !is_null($authtoken)) {
                $invitationURL = getInvitationLink(getBlogURLById($blogid), htmlspecialchars($value['loginid']), $value['password'], $authtoken);
                echo '<a href="' . $invitationURL . '">' . _t('재발급 링크') . '</a>';
Exemplo n.º 9
0
function sendInvitationMail($blogid, $userid, $name, $comment, $senderName, $senderEmail)
{
    global $database, $service, $hostURL, $serviceURL;
    if (empty($blogid)) {
        $blogid = POD::queryCell("SELECT max(blogid)\n\t\t\tFROM {$database['prefix']}BlogSettings");
        // If no blogid, get the latest created blogid.
    }
    $email = getUserEmail($userid);
    $password = POD::queryCell("SELECT password\n\t\tFROM {$database['prefix']}Users\n\t\tWHERE userid = " . $userid);
    $authtoken = getAuthToken($userid);
    $blogName = getBlogName($blogid);
    if (empty($email)) {
        return 1;
    }
    if (!preg_match('/^[^@]+@([-a-zA-Z0-9]+\\.)+[-a-zA-Z0-9]+$/', $email)) {
        return 2;
    }
    if (empty($name)) {
        $name = User::getName($userid);
    }
    if (strcmp($email, UTF8::lessenAsEncoding($email, 64)) != 0) {
        return 11;
    }
    //$loginid = POD::escapeString(UTF8::lessenAsEncoding($email, 64));
    $name = POD::escapeString(UTF8::lessenAsEncoding($name, 32));
    //$headers = 'From: ' . encodeMail($senderName) . '<' . $senderEmail . ">\n" . 'X-Mailer: ' . TEXTCUBE_NAME . "\n" . "MIME-Version: 1.0\nContent-Type: text/html; charset=utf-8\n";
    if (empty($name)) {
        $subject = _textf('귀하를 %1님이 초대합니다', $senderName);
    } else {
        $subject = _textf('%1님을 %2님이 초대합니다', $name, $senderName);
    }
    $message = file_get_contents(ROOT . "/resources/style/letter/letter.html");
    $message = str_replace('[##_title_##]', _text('초대장'), $message);
    $message = str_replace('[##_content_##]', $comment, $message);
    $message = str_replace('[##_images_##]', $serviceURL . "/resources/style/letter", $message);
    $message = str_replace('[##_link_##]', getInvitationLink(getBlogURL($blogName), $email, $password, $authtoken), $message);
    $message = str_replace('[##_go_blog_##]', getBlogURL($blogName), $message);
    $message = str_replace('[##_link_title_##]', _text('블로그 바로가기'), $message);
    if (empty($name)) {
        $message = str_replace('[##_to_##]', '', $message);
    } else {
        $message = str_replace('[##_to_##]', _text('받는 사람') . ': ' . $name, $message);
    }
    $message = str_replace('[##_sender_##]', _text('보내는 사람') . ': ' . $senderName, $message);
    $ret = sendEmail($senderName, $senderEmail, $name, $email, $subject, $message);
    if ($ret !== true) {
        return array(14, $ret[1]);
    }
    return true;
}
Exemplo n.º 10
0
#!/usr/bin/php
<?php 
// Fetch the auth tokens for the GoToWebinar product
// Send webinar details in array
// Return value:      [webinarKey] => 3409050463727985163
include "citrix_auth.php";
$tokenAry = getAuthToken("gtw");
$webinarDetails = array("subject" => "Test of GTW API", "description" => "This is the description of the test webinar", "times" => array(array("startTime" => date("c", mktime(9, 22, 0, 12, 25, 2015)), "endTime" => date("c", mktime(10, 22, 0, 12, 25, 2015)))), "timeZone" => "");
$mtgAry = createWebinar($tokenAry, $webinarDetails);
print_r($mtgAry);
// =========================================================================
//    Create a GTM webinar
function createWebinar($tokenAry, $webinarDetails)
{
    $accessToken = $tokenAry['access_token'];
    $organizerKey = $tokenAry['organizer_key'];
    $webinarInfo = json_encode($webinarDetails);
    $ch = curl_init();
    $url = "https://api.citrixonline.com:443/G2W/rest/organizers/" . $organizerKey . "/webinars";
    $headers = array("Authorization: " . $accessToken, "Accept: application/json", "Content-Type: application/json; charset=UTF-8", "Content-Length: " . strlen($webinarInfo));
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
    curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $webinarInfo);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    # required for https urls
<?php 
require_once '../lib/mod_lib.php';
$keys = getConfigKeys(getAuthToken("portcullis"));
if (!array_key_exists('dbname', $keys) || !array_key_exists('dbpass', $keys) || !array_key_exists('dbuser', $keys)) {
    notifyerr("<b >Module Not Configured Properly!</b>");
    redirect("?m=modules");
}
$dbname = $keys["dbname"][1];
$dbuser = $keys["dbuser"][1];
$dbpass = $keys["dbpass"][1];
$conx = mysql_connect("localhost", $dbuser, $dbpass);
mysql_select_db($dbname, $conx);
?>
<fieldset>
	<legend>Import From A Portcullis Database</legend>
	<body>
		<center>
			
			
		<?php 
if ($_GET["tabid"] == NULL) {
    echo "<div class='box' style='width:60%'>";
    echo "<h3 class='label success'>Available Results</h3>";
    echo "<form action='#' class='uniForm' method='post'>";
    $q = mysql_query("select * from MRESULTT", $conx);
    echo "<table class='bttable'>";
    while ($row = mysql_fetch_array($q)) {
        echo "<tr><td>";
        $table = $row["rtabname"];
        $resname = $row["rname"];
Exemplo n.º 12
0
/**
 * Register the user (GTW will send them email)
 * Return key and joinURL
 */
function createGTWregistration($formValues)
{
    global $db, $globalCurlOptions;
    $tokenAry = getAuthToken("gtw");
    $accessToken = $tokenAry['access_token'];
    $organizerKey = $tokenAry['organizer_key'];
    $q = "SELECT webinarKey from webinars WHERE id='" . $formValues['webinarID'] . "'";
    if ($result = $db->query($q)) {
        while ($obj = $result->fetch_object()) {
            $webinarKey = $obj->webinarKey;
        }
    } else {
        die("Cannot find this webinar. Sorry.");
    }
    $userDetails = array("firstName" => $formValues['firstName'], "lastName" => $formValues['lastName'], "email" => $formValues['emailAddress']);
    $userInfo = json_encode($userDetails);
    $ch = curl_init();
    $url = "https://api.citrixonline.com:443/G2W/rest/organizers/" . $organizerKey . "/webinars/" . $webinarKey . "/registrants";
    $headers = array("Authorization: " . $accessToken, "Accept: application/json", "Content-Type: application/json; charset=UTF-8", "Content-Length: " . strlen($userInfo));
    curl_setopt_array($ch, $globalCurlOptions);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $userInfo);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    $result = curl_exec($ch);
    curl_close($ch);
    $mtgInfo = json_decode($result, TRUE);
    return $mtgInfo;
}