Example #1
0
 private function __construct()
 {
     $this->m_target_file = tmpDir('targets.targets');
     if (!file_exists($this->m_target_file)) {
         $this->m_target_set = array();
         return;
     }
     $this->m_target_set = Encryption::unserializeFromFile($this->m_target_file);
 }
Example #2
0
 public function initOAuth()
 {
     $this->m_token = Encryption::unserializeFromFile(tmpDir('sina.oauth'));
     if ($this->m_token['auth_timestamp'] + $this->m_token['expires_in'] < time() - 10) {
         $this->reflashToken();
         $this->m_token = Encryption::unserializeFromFile(tmpDir('sina.oauth'));
     }
     if ($this->m_token['auth_timestamp'] + $this->m_token['expires_in'] >= time()) {
         $this->m_oauth = new SaeTClientV2($this->m_cfg['key'], $this->m_cfg['secret'], $this->m_token['access_token']);
     }
 }
Example #3
0
 public function __construct($cfg)
 {
     $this->m_cfg = $cfg;
     $this->m_filters = array(array($this, 'ftForceSync'), array($this, 'ftForceNSync'), array($this, 'ftLevel'));
     $this->m_after_filters = array();
     $this->m_info_file = tmpDir($this->m_source_type . '.info');
     $this->m_token_file = tmpDir($this->m_source_type . '.oauth');
     if (!file_exists($this->m_token_file)) {
         throw new TOException(_er('E_SOURCE_FILE_NOT_EXISTS', $this->m_info_file, $this->m_token_file));
         return;
     }
     if (file_exists($this->m_info_file)) {
         //$this->m_info  = Encryption::unserializeFromFile  ( $this->m_info_file );
         $this->m_info = unserialize(file_get_contents($this->m_info_file));
     }
     $this->m_token = Encryption::unserializeFromFile($this->m_token_file);
 }
<?php

/**
 * *********************************************************
 * 
 * @author cluries
 * @link http://cdbit.com
 * @version 1.0
 * @copyright 2012 http://cdbit.com All rights reserved
 * 
 * *********************************************************
 */
if (islocked('sina')) {
    $takedToken = Encryption::unserializeFromFile(tmpDir('sina.oauth'));
    if (!($takedToken['auth_timestamp'] + $takedToken['expires_in'] < time() - 10)) {
        display(_er('E_LOCKED', 'sina', 'sina'), 0);
    }
}
import('/library/saetv2.ex.class.php');
global $cfg_sina;
$o = new SaeTOAuthV2($cfg_sina['key'], $cfg_sina['secret']);
if (!isset($_REQUEST['code'])) {
    display('sina认证失败');
}
$keys = array();
$keys['code'] = $_REQUEST['code'];
$keys['redirect_uri'] = callbackUrl('sina');
$token = false;
try {
    $token = $o->getAccessToken('code', $keys);
} catch (OAuthException $e) {
Example #5
0
 public function initOAuth()
 {
     $this->m_token = Encryption::unserializeFromFile(tmpDir('tencent.oauth'));
     $this->m_oauth = new MBOpenTOAuth($this->m_cfg['key'], $this->m_cfg['secret'], $this->m_token['oauth_token'], $this->m_token['oauth_token_secret']);
 }
Example #6
0
 public function initOAuth()
 {
     $this->m_token = Encryption::unserializeFromFile(tmpDir('renren.oauth'));
     //var_dump($this->m_token);
     $this->m_oauth = new RenrenOAuth($this->m_cfg['key'], $this->m_cfg['secret']);
 }