コード例 #1
1
SetDefine('FS_CACHE', DIR_ABS . '../cache/');
SetDefine('DIR_CLASSES', DIR_ABS . '../classes/');
// Include Smarty
SetDefine('DIR_SMARTY', DIR_ABS . '../smarty/');
// Include SIMPL
include_once FS_SIMPL . 'simpl.php';
include_once DIR_ABS . '../inc/functions.php';
include_once DIR_SMARTY . 'Smarty.class.php';
include_once DIR_CLASSES . 'utilities.php';
// Connect to database
$db = new Db();
$db->Connect();
// Create the template object
$smarty = new FormTemplates();
// Assign the mode to the templates
$smarty->assign('mode', $mode);
SetDefine('CONSUMER_KEY', '');
SetDefine('CONSUMER_SECRET', '');
SetDefine('OAUTH_CALLBACK', ADDRESS . 'callback');
$myUser = new User();
$myAccountInfo = new AccountInfo();
// If the user has already logged in the past week
if (isset($_COOKIE['session']) && $_COOKIE['session'] != '') {
    // Look the user up and set their session
    $myUser->SetValue('sessionid', $_COOKIE['session']);
    $myUser->GetInfo(NULL, array('sessionid'));
    if ($myUser->GetPrimary() != '') {
        $myAccountInfo->SetValue('user_id', $myUser->GetPrimary());
        $myAccountInfo->GetInfo(NULL, array('user_id'));
    }
}
コード例 #2
0
 public function get(RESTApiRequest $request, $id)
 {
     $info = new \AccountInfo();
     $user_info = $info->getMainInfo();
     $user_info['id'] = \User::getInstance()->getId();
     return $this->filterDocument($user_info);
 }
コード例 #3
0
ファイル: pyload_types.php プロジェクト: nemiah/trinityDB
 public function __construct($vals = null)
 {
     if (!isset(self::$_TSPEC)) {
         self::$_TSPEC = array(1 => array('var' => 'validuntil', 'type' => TType::I64), 2 => array('var' => 'login', 'type' => TType::STRING), 3 => array('var' => 'options', 'type' => TType::MAP, 'ktype' => TType::STRING, 'vtype' => TType::STRING, 'key' => array('type' => TType::STRING), 'val' => array('type' => TType::STRING)), 4 => array('var' => 'valid', 'type' => TType::BOOL), 5 => array('var' => 'trafficleft', 'type' => TType::I64), 6 => array('var' => 'maxtraffic', 'type' => TType::I64), 7 => array('var' => 'premium', 'type' => TType::BOOL), 8 => array('var' => 'type', 'type' => TType::STRING));
     }
     if (is_array($vals)) {
         if (isset($vals['validuntil'])) {
             $this->validuntil = $vals['validuntil'];
         }
         if (isset($vals['login'])) {
             $this->login = $vals['login'];
         }
         if (isset($vals['options'])) {
             $this->options = $vals['options'];
         }
         if (isset($vals['valid'])) {
             $this->valid = $vals['valid'];
         }
         if (isset($vals['trafficleft'])) {
             $this->trafficleft = $vals['trafficleft'];
         }
         if (isset($vals['maxtraffic'])) {
             $this->maxtraffic = $vals['maxtraffic'];
         }
         if (isset($vals['premium'])) {
             $this->premium = $vals['premium'];
         }
         if (isset($vals['type'])) {
             $this->type = $vals['type'];
         }
     }
 }
コード例 #4
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/application_top.php';
if (!isset($_GET['oauth_token'])) {
    throw new SimplException('A Technical Error has Occurred. Please try again.', 2, 'Error: Tried to use callback without GET token.', '/');
}
$myUser = new User();
$myAccountInfo = new AccountInfo();
$myAccountAccess = new AccountAccess();
// Make the temp conenction
$connection = new FormspringOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['temporary_credentials']['oauth_token'], $_SESSION['temporary_credentials']['oauth_token_secret']);
// Get the long lasting token credentials
$token_credentials = $connection->getAccessToken($_GET['oauth_verifier']);
// Grab the details of this user
$details = $connection->get("profile/details");
// Save it to the database
$myUser->ResetValues();
// Check to see if this user is already in the DB
$myUser->SetValue('username', $details->response->username);
$myUser->GetInfo(NULL, array('username'));
// Add the new token credentials
$myUser->SetValue('oauth_token', $token_credentials['oauth_token']);
$myUser->SetValue('oauth_token_secret', $token_credentials['oauth_token_secret']);
// Create a unique ID for the session
$myUser->SetValue('sessionid', uniqid());
// Update the user information if found or insert if new
if (!$myUser->Save()) {
    throw new SimplException('Error Saving Formspring Client Token', 2, 'Error: Error Saving Formspring Client Token :' . $details->response->username);
}
// Set the session cookie
if (!isset($_GET['delegate'])) {
コード例 #5
0
ファイル: Pyload.php プロジェクト: nemiah/trinityDB
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 0:
                 if ($ftype == TType::LST) {
                     $this->success = array();
                     $_size180 = 0;
                     $_etype183 = 0;
                     $xfer += $input->readListBegin($_etype183, $_size180);
                     for ($_i184 = 0; $_i184 < $_size180; ++$_i184) {
                         $elem185 = null;
                         $elem185 = new AccountInfo();
                         $xfer += $elem185->read($input);
                         $this->success[] = $elem185;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }