public function __construct($form, $user) { $this->pay_key = false; $this->setMyPurchase($form, $user); $this->setAmount(); $this->setGCFee(); $this->setOwnerFee(); $this->setCommissionFee(); $this->testing = gcr::paypalSandbox; $app = $this->my_purchase->getPurchaseTypeApp(); if ($this->testing) { $this->ipn_url = 'https://' . $app->getshortName() . '.globalcampus.us/purchase/ipn'; } else { $this->ipn_url = $app->getUrl() . '/purchase/ipn'; } $this->my_purchase->setAmount($this->amount); $this->my_purchase->setGcFee($this->gc_fee); $this->my_purchase->setOwnerFee($this->owner_fee); $this->my_purchase->setCommissionFee($this->commission_fee); $this->my_purchase->setPurchaseTypeDescription($this->my_purchase->getPurchaseDescription()); $this->my_purchase->save(); $this->my_purchase->assignSeller(); $this->receivers = self::getReceivers($this->my_purchase); if (count($this->receivers) < 2) { global $CFG; $CFG->current_app->gcError('No receivers found for Paypal chained payment, purchase ID: ' . $this->my_purchase->getId(), 'gcdatabaseerror'); } gcr::loadSdk('paypal_adaptive_payments'); }
public static function deleteBucket($app) { $user_storage_s3 = Doctrine::getTable('GcrUserStorageS3')->findOneByAppId($app->getShortName()); if ($user_storage_s3) { $account = GcrUserStorageS3Table::getAccount($app); define('AWS_KEY', $account->getAccessKeyId()); define('AWS_SECRET_KEY', $account->getSecretAccessKey()); gcr::loadSdk('aws'); $api = new AmazonS3(); $api->delete_bucket($user_storage_s3->getBucketName(), true); $user_storage_s3->delete(); } }
public function __construct($app = false) { $this->app = $app; if (!$app) { global $CFG; $this->app = $CFG->current_app; } $account = GcrUserStorageS3Table::getAccount($this->app); define('AWS_KEY', $account->getAccessKeyId()); define('AWS_SECRET_KEY', $account->getSecretAccessKey()); gcr::loadSdk('aws'); $this->api = new AmazonS3(); if (!($user_storage_s3 = Doctrine::getTable('GcrUserStorageS3')->findOneByAppId($this->app->getInstitution()->getShortName()))) { $user_storage_s3 = $this->createBucket($account); } else { $this->bucket = $user_storage_s3->getBucketName(); } }
public function executeView($request) { $this->authorizeRequest($request); $this->gc_chat_session_id = 0; $chat_session = false; $user_id = $request->getParameter('user_id'); if ($user_id) { if ($this->mhr_user = $this->user->getApp()->getUserById($user_id)) { if ($invites = $this->user->getPendingChatInvites($this->mhr_user)) { $invites[0]->createUserSession(); $this->gc_chat_session_id = $invites[0]->getSessionId(); } else { if ($chats = $this->user->getChatSessionsWithUser($this->mhr_user)) { $this->gc_chat_session_id = $chats[0]->getId(); } else { if ($this->mhr_user->getAvailabilityStatus()->showChat()) { if ($chat_session = $this->user->inviteUserToChat($this->mhr_user)) { $this->gc_chat_session_id = $chat_session->getId(); } } } } } } if (!$chat_session) { $chat_session = Doctrine::getTable('GcrChatSession')->find($this->gc_chat_session_id); if (!$chat_session) { global $CFG; $CFG->current_app->gcError('Chat session not found', 'gcdatabaseerror'); } } gcr::loadSdk('opentok'); $this->api = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); $this->session_id = $chat_session->getRoomId(); $metadata = '{"username": "******"}'; $this->token = $this->api->generate_token($this->session_id, RoleConstants::PUBLISHER, null, $metadata); $this->getResponse()->setTitle($this->mhr_user->getFullnameString() . ' - Video Conference'); sfConfig::set('sf_escaping_strategy', false); }
public function createChatSession() { try { $this->app->beginTransaction(); // create chat session record $chat_session = new GcrChatSession(); gcr::loadSdk('opentok'); $api = new OpenTokSDK(API_Config::API_KEY, API_Config::API_SECRET); $session = $api->create_session($_SERVER["REMOTE_ADDR"]); $chat_session->setRoomId($session->getSessionId()); $chat_session->setEschoolId($this->app->getShortName()); $chat_session->setTimeCreated(time()); $chat_session->save(); // create chat session users record $chat_session->createUserSession($this); $this->app->commitTransaction(); } catch (Doctrine_Exception $e) { $this->app->rollbackTransaction(); global $CFG; $CFG->current_app->gcError($e->getMessage(), 'gcdatabaseerror'); } return $chat_session; }