static function requireAuthenticate($is_ajax = true, $extra_secure = true, &$realUser = null) { global $api_key, $api_key_secret, $adminUserIDs; $u = MyAuth::checkAuthentication($extra_secure); if (!$u) { if ($is_ajax) { return 0; } $facebook = new Facebook($api_key, $api_key_secret); $user = $facebook->require_login(); if ($user) { MyAuth::setLoginAuthenticate($user); } $u = $user; } if (isset($realUser)) { $realUser = $u; } //Return the mock_user if the real user is an administrator and mockuser is set $mu = GetAdminDebug('mock_user'); if ($mu != 'NONE' && in_array(intval($u), $adminUserIDs)) { return $mu; } else { return $u; } }
//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 } */ function aq($val) { return trim($val, "\"'"); } $u = MyAuth::checkAuthentication(false); //### This must change later to true and take vcare to pass the cookie $fp->log($u); if (!$u) { error('Not logged in'); } //In order to debug XML add "?T3ST=1" in the URL if (isset($_REQUEST[$debug_parameter])) { $XML_debug = true; } if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == "createevent") { $fp->log("createevent"); $name = aq($_REQUEST['name']); $description = aq($_REQUEST['description']); $time = aq($_REQUEST['time']);
echo '<pre>'; print_r($_COOKIE); if (isset($_COOKIE['tjc_lo'])) { $a = explode(',', $_COOKIE['tjc_lo']); $t = $a[1]; $curr_t = time(); $exp_time = $curr_t - $t; echo "\nCookie 'lo' was set at ", date('l jS \\of F Y h:i:s A', $t), ' (', intval($exp_time / 60), ' min and ', $exp_time % 60, ' sec ago)'; } echo '</pre>'; } else { 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>'; } } } } }