Пример #1
0
<?php

include "citrix.php";
$citrix = new Citrix('API Key');
$citrix->set_organizer_key('organizer_key');
$citrix->set_access_token('access_token');
try {
    $organizer_key = $citrix->get_organizer_key();
    $citrix->pr($organizer_key);
} catch (Exception $e) {
    $citrix->pr($e->getMessage());
}
try {
    $webinars = $citrix->citrixonline_get_list_of_webinars();
    $citrix->pr($webinars);
} catch (Exception $e) {
    $citrix->pr($e->getMessage());
}
try {
    $response = $citrix->citrixonline_create_registrant_of_webinar('webinar id', $data = array('first_name' => 'First Name', 'last_name' => 'Lastnmae', 'email' => '*****@*****.**'));
    $citrix->pr($response);
} catch (Exception $e) {
    $citrix->pr($e->getMessage());
}
try {
    $webinars = $citrix->get_registrants_of_webinars('webinar id');
    $citrix->pr($webinars);
} catch (Exception $e) {
    $citrix->pr($e->getMessage());
}
Пример #2
0
<?php

include "citrix.php";
$citrix = new Citrix('7d4acae493336cd5ce1250ca777972bf');
$citrix->set_organizer_key('8551721408137636611');
$citrix->set_access_token('ec562df331a64de61e033b6852332b29');
try {
    echo "gets here";
    $response = $citrix->citrixonline_create_registrant_of_webinar('7361625418674996736', $data = array('first_name' => 'Paul', 'last_name' => 'McCarthy', 'email' => '*****@*****.**'));
    echo $response;
    $citrix->pr($response);
} catch (Exception $e) {
    $citrix->pr($e->getMessage());
}
Пример #3
0
 function hc_frontend_submit_connector()
 {
     global $wpdb;
     check_ajax_referer('hyconspecialsecurityforajaxstring', 'security');
     require_once 'includes/apis/hc_services_helper.php';
     $my_connector = $wpdb->get_results("SELECT * FROM wp_connectors WHERE IntegrationID=" . $_POST['id_connector']);
     $my_connector = $my_connector[0];
     $my_webinar = $wpdb->get_results("SELECT * FROM wp_hyCong2w where IntegrationID=" . $_POST['id_connector']);
     $my_webinar = isset($my_webinar[0]) ? $my_webinar[0] : null;
     $my_mailinglist = $wpdb->get_results("SELECT * FROM wp_mailingList where IntegrationID=" . $_POST['id_connector']);
     $my_mailingList = isset($my_mailinglist[0]) ? $my_mailinglist[0] : null;
     //only insert into stats if not admin
     if (!current_user_can('moderate_comments')) {
         $result2 = $wpdb->insert('wp_hc_subscribers', array('id_connector' => $my_connector->IntegrationID, 'email' => $_POST['email'], 'name' => $_POST['name'], 'date' => date('Y-m-d H:i:s'), 'post' => $_POST['id_post'], 'referer' => $_POST['referer'], 'trackingcode' => $_POST['trackingcode'], 'referingdomain' => $_POST['referingdomain'], 'commentsubscriber' => $commentsubscriber), array('%d', '%s', '%s', '%s', '%d', '%s', '%s', '%s', '%d'));
     }
     //attend the webinar
     $my_webinar = $wpdb->get_results("SELECT * FROM wp_hyCong2w where IntegrationID=" . $my_connector->IntegrationID);
     $my_webinar = isset($my_webinar[0]) ? $my_webinar[0] : null;
     $this->updateHCCounter();
     if ($my_webinar) {
         $names = explode(" ", $_POST['name'], 2);
         // new version of g2w
         require_once 'includes/apis/g2w/citrix.php';
         $citrix = new Citrix(get_option("hc_g2w_app_id"));
         $citrix->set_organizer_key(get_option("hc_g2w_organizer_key"));
         $citrix->set_access_token(get_option("hc_g2w_access_token"));
         try {
             if ($names[1] == "") {
                 $names[1] = "-";
             }
             $response = $citrix->citrixonline_create_registrant_of_webinar($my_webinar->webinarKey, $data = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']));
         } catch (Exception $e) {
         }
         // old version of g2w
         $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']);
         gtw_attend($info, $my_webinar->webinarKey);
     }
     //register the user
     if ($my_connector->allow_registration == 1) {
         $names = explode(" ", $_POST['name'], 2);
         $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email'], 'role' => $my_connector->registration_role);
         $this->hc_setup_user($info);
     }
     //split testing functionality
     $variation = $wpdb->get_row("SELECT * FROM hc_variations WHERE id=" . $_POST['id_variation']);
     $tpl_type = $wpdb->get_row("SELECT * FROM hc_tpl_types WHERE idConnector=" . $_POST['id_connector'] . " AND type=" . $variation->type);
     //if ($tpl_type->testing == 1) {
     $conversions = $variation->conversions + 1;
     // make sure user not admin - admin conversions should not be logged.
     if (!current_user_can('moderate_comments')) {
         $result3 = $wpdb->update('hc_variations', array('conversions' => $conversions), array('id' => $variation->id), array('%d'), array('%d'));
         $stopTest = $this->_updateVariationsData($variation->id);
     }
     //}
     //connect to the mailing list using the custom code or the api
     if ($my_connector->apiConnection != "1") {
         $manualSubmit = true;
     } else {
         $manualSubmit = false;
     }
     if (!$manualSubmit) {
         switch ($my_mailingList->autoresponderType) {
             case 'aweber':
                 try {
                     $aweber_settings = get_option('hc_aweber_api_settings');
                     extract($aweber_settings);
                     $aweber = $this->_get_aweber_api($consumer_key, $consumer_secret);
                     $account = $aweber->getAccount($access_key, $access_secret);
                     $listURL = "/accounts/{$account->id}/lists/{$my_mailingList->settings}";
                     $list = $account->loadFromUrl($listURL);
                     # create a subscriber
                     $params = array('email' => $_POST['email'], 'ip_address' => $_SERVER['REMOTE_ADDR'], 'ad_tracking' => 'client_lib_example', 'last_followup_message_number_sent' => 0, 'misc_notes' => 'my cool app', 'name' => $_POST['name']);
                     $subscribers = $list->subscribers;
                     $new_subscriber = $subscribers->create($params);
                 } catch (AWeberAPIException $exc) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             case 'infusionsoft':
                 try {
                     $client = $this->_get_infusionsoft_client();
                     $apikey = get_option('hc_infusionsoft_appkey');
                     $names = explode(" ", $_POST['name'], 2);
                     $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']);
                     $contact_id = infusionsoft_addContact($info, $client, $apikey);
                     if ($contact_id) {
                         $result = infusionsoft_addToCampaign($contact_id, $my_mailingList->settings, $client, $apikey);
                         $result2 = infusionsoft_addEmailOptin($_POST['email'], $client, $apikey);
                     }
                 } catch (Exception $e) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             case 'mailchimp':
                 try {
                     $names = explode(" ", $_POST['name'], 2);
                     $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']);
                     if (!mailchimp_addContact($info, $my_mailingList->settings, get_option('hc_mailchimp_appkey'))) {
                         echo $my_connector->TyPage;
                         die;
                     }
                 } catch (Exception $e) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             case 'icontact':
                 try {
                     $names = explode(" ", $_POST['name'], 2);
                     $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']);
                     $result = icontact_addContact($info, $my_mailingList->settings, get_option('hc_icontact_appid'), get_option('hc_icontact_appkey'), get_option('hc_icontact_appurl'));
                     if (!$result) {
                         echo $my_connector->TyPage;
                         die;
                     }
                 } catch (Exception $e) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             case 'officeautopilot':
                 try {
                     $names = explode(" ", $_POST['name'], 2);
                     $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']);
                     $result = officeautopilot_addContact($info, $my_mailingList->settings, get_option('hc_officeautopilot_appkey'), get_option('hc_officeautopilot_appid'));
                     if (!$result) {
                         echo $my_connector->TyPage;
                         die;
                     }
                 } catch (Exception $e) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             case 'constantcontact':
                 try {
                     $names = explode(" ", $_POST['name'], 2);
                     $info = array('first_name' => $names[0], 'last_name' => $names[1], 'email' => $_POST['email']);
                     $result = constantcontact_addContact($info, $my_mailingList->settings, get_option('hc_constantcontact_appkey'), get_option('hc_constant_contact_username'), get_option('hc_constant_contact_token'));
                     if (!$result) {
                         echo $my_connector->TyPage;
                         die;
                     }
                 } catch (Exception $e) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             case 'getresponse':
                 try {
                     $info = array('name' => $_POST['name'], 'email' => $_POST['email']);
                     $result = getresponse_addContact($info, $my_mailingList->settings, get_option('hc_getresponse_appkey'));
                     if (!$result) {
                         echo $my_connector->TyPage;
                         die;
                     }
                 } catch (Exception $e) {
                     echo $my_connector->TyPage;
                     die;
                 }
                 break;
             default:
                 //nothing for default
         }
     } else {
         //we're going to submit the details manually through html web form code
         echo $my_connector->custom_code;
         die;
     }
     echo $my_connector->TyPage;
     die;
 }