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
 /**
  * CCAuth::sign_in and sign_out tests
  */
 public function test_sign()
 {
     $this->assertFalse(CCAuth::valid());
     $this->assertTrue(CCAuth::sign_in(static::$current_user));
     $this->assertTrue(CCAuth::valid());
     $this->assertFalse(CCAuth::sign_out());
 }
Beispiel #3
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 #4
0
 public static function chatcatAjax()
 {
     $auth = modChatCatHelper::getAuth();
     if ($auth) {
         $app = JFactory::getApplication();
         $input = $app->input;
         $action = $input->get('action');
         if ($action == 'cc_get_uid') {
             $auth->respondWithUserID();
             return null;
             //return json_decode($auth->UserIdJSON());
         }
         if ($action == 'cc_get_token') {
             $auth->respondWithToken();
             return null;
             //return json_decode($auth->tokenJSON());
         }
     } else {
         CCAuth::logout();
         return null;
         //return json_decode(CCAuth::logoutJSON());
     }
 }
Beispiel #5
0
 /**
  * Sign out action
  */
 public function action_sign_out()
 {
     if (!CCSession::valid_fingerprint()) {
         return CCRedirect::to('/');
     }
     CCAuth::sign_out();
     return CCRedirect::to('/');
 }
function cc_logout()
{
    CCAuth::logout();
    die;
}
Beispiel #7
0
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="<?php 
echo to('/');
?>
"><?php 
echo App::name();
?>
</a>
			</div>
			
			<div class="collapse navbar-collapse" id="ccf-navbar">
				<ul class="nav navbar-nav">
					<?php 
if (CCAuth::valid()) {
    ?>
					<li>
						<a href="<?php 
    echo to('@auth.sign_out');
    ?>
">Sign Out</a>
					</li>
					<?php 
} else {
    ?>
					<li>
						<a href="<?php 
    echo to('@auth.sign_in');
    ?>
">Sign In</a>
Beispiel #8
0
 static function logout()
 {
     echo CCAuth::logoutJSON();
 }
Beispiel #9
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;