|
1 | | -<?php |
2 | | -/** |
3 | | - * User has successfully authenticated with Twitter. Access tokens saved to |
4 | | - * session and database. |
5 | | - * |
6 | | - * PHP Version 5.2 |
7 | | - * |
8 | | - * The contents of this file are subject to the Mozilla Public License |
9 | | - * Version 1.1 (the "License"); you may not use this file except in |
10 | | - * compliance with the License. You may obtain a copy of the License at |
11 | | - * http://www.mozilla.org/MPL/ |
12 | | - * |
13 | | - * Software distributed under the License is distributed on an "AS IS" |
14 | | - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
15 | | - * License for the specific language governing rights and limitations |
16 | | - * under the License. |
17 | | - * |
18 | | - * @category phpMyFAQ |
19 | | - * @package Services |
20 | | - * @author Thorsten Rinne <thorsten@phpmyfaq.de> |
21 | | - * @copyright 2010 phpMyFAQ Team |
22 | | - * @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License Version 1.1 |
23 | | - * @link http://www.phpmyfaq.de |
24 | | - * @since 2010-09-18 |
25 | | - */ |
26 | | - |
27 | | -// |
28 | | -// Prepend and start the PHP session |
29 | | -// |
30 | | -define('PMF_ROOT_DIR', dirname(dirname(dirname(__FILE__)))); |
31 | | - |
32 | | -require_once PMF_ROOT_DIR . '/inc/Init.php'; |
33 | | -require_once PMF_ROOT_DIR . '/inc/libs/twitteroauth/twitteroauth.php'; |
34 | | -define('IS_VALID_PHPMYFAQ', null); |
35 | | -PMF_Init::cleanRequest(); |
36 | | -session_name(PMF_COOKIE_NAME_AUTH . trim($faqconfig->get('main.phpMyFAQToken'))); |
37 | | -session_start(); |
38 | | - |
39 | | -if (empty($_SESSION['access_token']) || |
40 | | - empty($_SESSION['access_token']['oauth_token']) || |
41 | | - empty($_SESSION['access_token']['oauth_token_secret'])) { |
42 | | - header('Location: ./clearsessions.php'); |
43 | | -} |
44 | | - |
45 | | -$accessToken = $_SESSION['access_token']; |
46 | | - |
47 | | -$connection = new TwitterOAuth($faqconfig->get('socialnetworks.twitterConsumerKey'), |
48 | | - $faqconfig->get('socialnetworks.twitterConsumerSecret'), |
49 | | - $accessToken['oauth_token'], |
50 | | - $accessToken['oauth_token_secret']); |
51 | | - |
52 | | -$content = $connection->get('account/verify_credentials'); |
0 commit comments