Beispiel #1
0
function get_auth()
{
    global $vbulletin;
    global $db;
    $user_id = $vbulletin->userinfo['userid'];
    if ($user_id > 0) {
        // Get the API key from the settings
        $api_key = $vbulletin->options['chat_cat_messenger_api'];
        $secret = $vbulletin->options['chat_cat_messenger_secret'];
        $profilepic = $db->query_first("\r\n\t\t\tSELECT userid, dateline, height, width\r\n\t\t\tFROM " . TABLE_PREFIX . "customavatar\r\n\t\t\tWHERE userid = " . $user_id);
        if ($profilepic['dateline']) {
            $img = $vbulletin->options['bburl'] . '/image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $user_id;
            // . "&dateline=$profilepic[dateline]&type=avtar";
        } else {
            $img = null;
        }
        $src = urldecode($img);
        $location = $vbulletin->userinfo['field2'];
        $bod = $vbulletin->userinfo['birthday'];
        if (!empty($bod)) {
            $year = explode("-", $bod);
            $bod = $year['2'];
        }
        // Get the user's description
        $description = $vbulletin->userinfo['field1'];
        // Create a new Auth instance
        $auth = new CCAuth($user_id, $secret, $api_key, '');
        // Authenticate the user
        $auth->setUserInfo($vbulletin->userinfo['username'], $description, null, $bod, $location, null, $src, array('homepageLink' => $vbulletin->options['bburl'] . '/member.php?' . $vbulletin->userinfo['userid']));
        return $auth;
    }
    return null;
}
Beispiel #2
0
 public static function getAuth()
 {
     $user = JFactory::getUser();
     if ($user->id > 0) {
         $module = JModuleHelper::getModule('mod_chatcat');
         $params = new JRegistry($module->params);
         $api_key = $params->get('chatcat-api-key');
         $secret = $params->get('chatcat-secret');
         // Create a new Auth instance
         $auth = new CCAuth($user->id, $secret, $api_key, '');
         // Authenticate the user
         $auth->setUserInfo($user->username, null, null, null, null, null, null, array());
         return $auth;
     } else {
         return null;
     }
 }
function getAuth()
{
    global $current_user;
    $doc = new DOMDocument();
    $doc->loadHTML(get_avatar($current_user->ID, 100));
    $xpath = new DOMXPath($doc);
    $src = $xpath->evaluate('string(//img/@src)');
    $exp = explode('&d=', $src);
    $src = urldecode($exp[1]);
    // Is the user logged in?
    if ($current_user->ID > 0) {
        // Get the API key from the settings
        $options = get_option('cc_options');
        // Get the user's description
        $description = get_the_author_meta('description', $current_user->ID, $_SERVER['HTTP_HOST']);
        // Create a new Auth instance
        $auth = new CCAuth($current_user->ID, $options['secret'], $options['api_key'], '');
        // Authenticate the user
        $auth->setUserInfo($current_user->display_name, $description, null, null, null, null, $src, array());
        return $auth;
    }
    return null;
}
Beispiel #4
0
function get_auth()
{
    $user_id = $_REQUEST['uid'];
    //getting user details
    if ($user_id > 0) {
        $api_key = $_REQUEST['api_key'];
        $secret = $_REQUEST['secret'];
        $src = urldecode($_REQUEST['src']);
        $username = $_REQUEST['username'];
        $description = $_REQUEST['description'];
        $yearOfBirth = $_REQUEST['yearOfBirth'];
        $location = $_REQUEST['location'];
        $homepage = urldecode($_REQUEST['homepage']);
        $sex = $_REQUEST['sex'];
        $sex = $sex == 'Male' ? 'M' : 'F';
        // Create a new Auth instance
        $auth = new CCAuth($user_id, $secret, $api_key, '');
        // Authenticate the user
        $auth->setUserInfo($username, $description, $sex, $yearOfBirth, $location, null, $src, array('homepageLink' => $homepage));
        return $auth;
    }
    return null;
}
Beispiel #5
0
require_once 'CCAuth.php';
$uid = isset($_REQUEST['uid']) ? $_REQUEST['uid'] : null;
$api = isset($_REQUEST['api']) ? $_REQUEST['api'] : null;
$uname = isset($_REQUEST['uname']) ? $_REQUEST['uname'] : null;
$desc = isset($_REQUEST['desc']) ? $_REQUEST['desc'] : null;
$src = isset($_REQUEST['src']) ? $_REQUEST['src'] : null;
$src = urldecode($src);
$home = isset($_REQUEST['home']) ? $_REQUEST['home'] : null;
$home = urldecode($home);
$bod = isset($_REQUEST['birthday']) ? $_REQUEST['birthday'] : null;
$location = isset($_REQUEST['location']) ? $_REQUEST['location'] : null;
$secret = isset($_REQUEST['secret']) ? $_REQUEST['secret'] : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
// echo $uid.'--'.$api.'--'.$uname.'--'.$desc.'-'.$src;
// die;
if ($uid > 0) {
    // Create a new Auth instance
    $auth = new CCAuth($uid, $secret, $api, '');
    // Authenticate the user
    $auth->setUserInfo($uname, $desc, null, $bod, $location, null, $src, array('homepageLink' => $home));
    if ($action == 'cc_get_uid') {
        $auth->respondWithUserID();
    }
    if ($action == 'cc_get_token') {
        $auth->respondWithToken();
    }
} else {
    CCAuth::logout();
}
die;