public function testNetworkIds() { $params = array('session_key' => 'session-key', 'user' => '10000', 'nid' => '2', 'nuser' => '20000', 'in_iframe' => 0, 'in_canvas' => 1, 'time' => time(), 'added' => 1, 'api_key' => 'api-key'); $_GET =& $params; $_GET['fb_sig'] = Facebook::generate_sig($_GET, 'secret'); foreach ($_GET as $key => $value) { if (strncmp($key, 'fb_sig', 6) === 0) { continue; } $_GET['fb_sig_' . $key] = $value; unset($_GET[$key]); } $ringside = new RingsideApiClients('api-key', 'secret', 'http://localhost/web/url', 'http://localhost/server/url', 'http://localhost/social/url'); $this->assertEquals('10000', $ringside->get_loggedin_user()); $this->assertEquals('2', $ringside->get_network_id()); $this->assertEquals('20000', $ringside->get_network_user()); }
* This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. ******************************************************************************/ include_once 'CommentsUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/api/clients/RingsideApiClients.php'; $ringside = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey); $ringside->require_login(); $uid = $ringside->get_loggedin_user(); $utils = new CommentsUtils(); if ($utils->hasAddParams()) { $callbackurl = isset($_GET['callbackurl']) ? $_GET['callbackurl'] : ''; $returnurl = $_SERVER['HTTP_REFERER']; if (!$utils->isAuthorized()) { echo "<fb:redirect url='{$returnurl}' />"; } else { $result = $ringside->api_client->comments_add($_GET['xid'], $_GET['text'], $_GET['aid']); if (!$utils->selfReferred() && !empty($callbackurl)) { echo "<fb:redirect url='{$callbackurl}' />"; } else { if (!$utils->selfReferred() && !empty($returnurl)) { echo "<fb:redirect url='{$returnurl}' />"; } else { ?>
<?php require_once 'ringside/web/config/RingsideWebConfig.php'; #require_once( 'ringside/web/RingsideWebUtils.php' ); require_once 'ringside/api/clients/RingsideApiClients.php'; #require_once( 'ringside/api/db/RingsideApiDbDatabase.php'); #require_once 'ringside/api/OpenFBAPIException.php'; $client = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey); $client->setLocalClient(true); $client->require_login(); $uid = $client->get_loggedin_user(); $apps = $client->api_client->admin_getAppList(); ?> <ul> <?php foreach ($apps as $app) { ?> <li><?php print $app['name']; ?> </li> <?php } ?> </ul>
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ /** * Document this file. * * @author Jason Kinner <*****@*****.**> */ require_once 'ringside/api/clients/RingsideApiClients.php'; require_once 'config.php'; require_once 'quiz.class.php'; require_once 'quiztable.class.php'; require_once 'answer.class.php'; $ringside = new RingsideApiClients($api_key, $secret); //error_log("Request is ".var_export($_REQUEST, true)); Doctrine_Manager::getInstance()->openConnection($db_url); $quiz = Doctrine::getTable('Quiz')->findOneByUser($_REQUEST['fb_sig_nid'], $ringside->get_loggedin_user()); if (isset($quiz)) { error_log("Quiz is {$quiz}"); error_log("Serialized as " . var_export($quiz->toArray(), true)); } if (isset($_REQUEST['quiz_ids'])) { if ($quiz != null) { $quiz->delete(); } $quiz = new Quiz(); $quiz->nid = $_REQUEST['fb_sig_nid']; $quiz->uid = $ringside->get_loggedin_user(); foreach (explode(',', $_REQUEST['quiz_ids']) as $quiz_id) { error_log("For " . $quiz_id . " user answered " . $_REQUEST['scale_' . $quiz_id]); $a = new Answer(); $a->quiz = $quiz;
* @author Jason Kinner <*****@*****.**> */ require_once 'ringside/api/clients/RingsideApiClients.php'; include_once 'LocalSettings.php'; // If the test runner passing in a network_key, it will be evaluated by this class. $ringside = new RingsideApiClients('idmapapp', 'idmapappsecret', $webUrl, $serverUrl); $ringside->require_login(); $mapped_loggedin_user = "******"; // The only mapping we're doing here is _from_ the network _to_ the principal; so we never pass a second argument. if ($_REQUEST['uids']) { $mapped_loggedin_user = $ringside->api_client->users_mapToPrincipal(explode(',', $_REQUEST['uids'])); } else { // Maps the logged_in_user subject to the principal $mapped_loggedin_user = $ringside->api_client->users_mapToPrincipal(); } // From Facebook developer's wiki: http://wiki.developers.facebook.com/index.php/Gotchas // This is how you get $_SESSION to work with Facebook if (isset($_POST["fb_sig_session_key"])) { $_fb_sig_session_key = str_replace("-", "0", $_POST["fb_sig_session_key"]); session_id($_fb_sig_session_key); } session_start(); error_log("Logged-in users is " . $ringside->get_loggedin_user()); error_log("Mapped logged-in user is " . $mapped_loggedin_user); /* * This will set the test_uid data to the logged-in user's mapped identity. This should * ALWAYS be the same value. */ $_SESSION['test_uid'] = is_array($mapped_loggedin_user) ? implode(',', $mapped_loggedin_user) : $mapped_loggedin_user; error_log("Session key is " . session_id()); echo 'Result{' . $_SESSION['test_uid'] . '}';