require_once 'benchmarks.php'; require_once 'FbAuth.php'; require_once 'model_user.php'; //###To make more secure ajax call look use this: http://insecureweb.com/web-security/secure-your-ajax-request-with-jquery/ //I create timer object and start it (TRUE) $timer = new Benchmark_Timer(); $timer->start(); //Establish connection try { DB::get()->connect(); } catch (Exception $e) { print_r($e); //### It must be handle better: writing in the log file (that must be set) and } $realUser = 0; $u = FbAuth::requireAuthenticate(true, false, $realUser); //### This must change later to true and take vcare to pass the cookie if (!$u) { error('Not logged in: Try to refresh the page'); } //In order to debug XML add "?T3ST=1" in the URL if (isset($_REQUEST[$debug_parameter])) { $XML_debug = true; } if (isset($_REQUEST['f']) && $_REQUEST['f'] == "position") { $col = 'position_text'; $value = $_REQUEST['v']; } elseif (isset($_REQUEST['f']) && $_REQUEST['f'] == "institution") { $col = 'institution_text'; $value = $_REQUEST['v']; } elseif (isset($_REQUEST['f']) && $_REQUEST['f'] == "degrees") {
require_once 'benchmarks.php'; require_once 'FbAuth.php'; require_once 'model_user_article.php'; require_once 'controllers.php'; //###To make more secure ajax call look use this: http://insecureweb.com/web-security/secure-your-ajax-request-with-jquery/ //I create timer object and start it (TRUE) $timer = new Benchmark_Timer(); $timer->start(); //Establish connection try { DB::get()->connect(); } catch (Exception $e) { print_r($e); //### It must be handle better: writing in the log file (that must be set) and } $u = FbAuth::requireAuthenticate(true, true); //### This must change later to true and take vcare to pass the cookie if (!$u) { error('Not logged in: Try to refresh the page'); } //In order to debug XML add "?T3ST=1" in the URL if (isset($_REQUEST[$debug_parameter])) { $XML_debug = true; } $a = isset($_REQUEST['a']) ? intval($_REQUEST['a']) : '0'; //$u = isset($_REQUEST['u']) ? $_REQUEST['u'] : '0'; if (isset($_REQUEST['mine'])) { $col = 'its_mine'; $value = !!$_REQUEST['mine']; //###Should claiming an article means also automatically follow it? Controller::a_claim($u, $a);
if ($c == 2) { //Auth as user 10101010 $u = '10101010'; MyAuth::setLoginAuthenticate($u); echo "MyAuth::setLoginAuthenticate({$u}) executed"; } else { if ($c == 3) { //perform the check auth $n = MyAuth::checkAuthentication(false); $e = MyAuth::checkAuthentication(); echo '<pre>'; print_r($_COOKIE); echo "Auth (normal) user is {$n}\n"; echo "Auth (extra secure) user is {$e}"; echo '</pre>'; } else { if ($c == 4) { //perform the check auth $e = FbAuth::requireAuthenticate(false); $n = MyAuth::checkAuthentication(false); echo '<pre>'; print_r($_COOKIE); echo "FbAuth (normal) user is {$e}\n"; echo "MyAuth (normal) user is {$n}"; echo '</pre>'; } } } } } }
require_once 'benchmarks.php'; require_once 'FbAuth.php'; require_once 'model_user_user.php'; require_once 'controllers.php'; //###To make more secure ajax call look use this: http://insecureweb.com/web-security/secure-your-ajax-request-with-jquery/ //I create timer object and start it (TRUE) $timer = new Benchmark_Timer(); $timer->start(); //Establish connection try { DB::get()->connect(); } catch (Exception $e) { print_r($e); //### It must be handle better: writing in the log file (that must be set) and } $u = FbAuth::requireAuthenticate(true, false); //### This must change later to true and take vcare to pass the cookie if (!$u) { error('Not logged in: Try to refresh the page'); } //The other user $v = isset($_REQUEST['v']) ? intval($_REQUEST['v']) : '0'; if (!$v) { error('Error - Other user not specified'); } //In order to debug XML add "?T3ST=1" in the URL if (isset($_REQUEST[$debug_parameter])) { $XML_debug = true; } //$c = new People(); $fOk = false;
return file_get_contents($url); } } public static function getLoginButton() { return $link = '<a href="' . self::$url . '?' . urldecode(http_build_query(self::getLoginParams())) . '"><img src="../helpers/img/facebook.png" width="30" title="Get in with Vkontakte"></a>'; } public static function processLogin() { if (isset($_GET['code'])) { require_once '../config.php'; $params = array('client_id' => self::$client_id, 'redirect_uri' => 'http://' . self::$redirect_host . self::$redirect_path, 'client_secret' => self::$client_secret, 'code' => $_GET['code']); $url = 'https://graph.facebook.com/oauth/access_token'; $tokenInfo = null; parse_str(file_get_contents($url . '?' . http_build_query($params)), $tokenInfo); if (count($tokenInfo) > 0 && isset($tokenInfo['access_token'])) { $params = array('access_token' => $tokenInfo['access_token']); $url = 'https://graph.facebook.com/me'; $userInfo = json_decode(self::get_curl($url . '?' . urldecode(http_build_query($params))), true); $user = explode(' ', $userInfo['name']); $userInfo = array('nickname' => $user[0] . $userInfo['id'], 'email' => null, 'first_name' => $user[0], 'last_name' => $user[1], 'password' => 'fb_id' . $userInfo['id']); require_once 'Session.php'; session_start(); Session::set('user', $userInfo); header('Location: /?route=security/social_auth'); } } } } FbAuth::processLogin();