Esempio n. 1
0
 private static function getSuggestionClient()
 {
     $client = new RingsideApiClients(Config::$api_key, Config::$secret);
     $uid = $client->require_login();
     $delegate = $client->api_client;
     $obj = new ReflectionObject($delegate);
     $suggestionClient = new SuggestionClient($delegate);
     return $suggestionClient;
 }
 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());
 }
Esempio n. 3
0
<?php

/**
 * Profile Listing Page
 * 
 */
require_once dirname(__FILE__) . "/ProfileApp.php";
require_once 'ringside/api/clients/RingsideApiClients.php';
$ringside = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey);
$ringside->setLocalClient(true);
$user = $ringside->require_login();
if ($user == null) {
    return;
}
$uid = $ringside->get_loggedin_user();
$readonly = false;
if (array_key_exists('id', $_REQUEST)) {
    $uid = $_REQUEST['id'];
    $ringside->user = $uid;
    $readonly = true;
}
$flavor = $ringside->getFlavor();
$app = new ProfileApp($uid, $readonly, $ringside->api_client);
$app->saveStatusChanges($_REQUEST);
?>
 
<script language="JavaScript" type="text/javascript">
  function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
Esempio n. 4
0
<?php

/**
 * Profile Listing Page
 * 
 */
require_once dirname(__FILE__) . "/ProfileApp.php";
require_once 'ringside/api/clients/RingsideApiClients.php';
$ringside = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey);
$ringside->setLocalClient(true);
$user = $ringside->require_login();
if ($user == null) {
    return;
}
// Get reference to our app, model and caclulated fields for display
$app = new ProfileApp();
$updateOccured = $app->saveEditChanges($_REQUEST);
$user = $app->getUserData();
$formDataArry = $app->getEditFormData();
//print("form data ".$user->userbasicprofile->political."zz<p>\n");
//var_dump($formDataArry);
$page = 1;
?>

<h1>Edit Profile</h1>

<?php 
include dirname(__FILE__) . "/menu.inc";
if ($updateOccured) {
    ?>
<fb:success><fb:message><strong>Success!</strong>&nbsp;&nbsp;  Your changes have been saved. </fb:message></fb:success>
Esempio n. 5
0
 * 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.
 */
require_once 'ringside/api/clients/RingsideApiClients.php';
/**
 * Demonstrates how to perform identity mapping.
 *
 * @author Jason Kinner <*****@*****.**>
 */
error_log("Facebook params:");
error_log(var_export($_REQUEST, true));
$ringside = null;
if ($_REQUEST['fb_sig_nid'] == 'facebook') {
    error_log("Initializing Facebook client");
    $ringside = new RingsideApiClients('c392078dde1c96d4c019d60420fd07ab', '93694d948f9b1cf0d8567ccf7e67a860', 'http://www.facebook.com', 'http://api.facebook.com/restserver.php', 'http://68.39.18.144:8888/social');
} else {
    error_log("Initializing Ringside client");
    $ringside = new RingsideApiClients('c392078dde1c96d4c019d60420fd07ab', '93694d948f9b1cf0d8567ccf7e67a860', 'http://68.39.18.144:8888/web/', 'http://68.39.18.144:8888/api/restserver.php', 'http://68.39.18.144:8888/social');
}
// This will cause redirect if this user is not yet a principal
$ringside->require_network_login();
?>
You are principal <?php 
echo $ringside->get_network_user();
?>
 on <?php 
echo $ringside->get_network_id();
?>
<br/>
Your name on this network is <fb:name uid="loggedinuser" useyou="false"/>
Esempio n. 6
0
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * 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.
 ******************************************************************************/
/**
 * Load the welcome text.  This can be
 * generated different for a side bar
 * then a canvas.  Canvas is the default
 * layout.
 *
 */
require_once 'ringside/apps/RingsideAppsCommon.php';
require_once 'ringside/api/clients/RingsideApiClients.php';
$client = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey);
$flavor = $client->getFlavor();
RingsideAppsCommon::load('apps.blank', $flavor, 'canvas');
?>

Esempio n. 7
0
<?php

require_once 'ringside/web/RingsideWebUtils.php';
require_once 'ringside/api/clients/RingsideApiClients.php';
require_once 'ringside/web/config/RingsideWebConfig.php';
require_once "ringside/api/dao/Network.php";
$client = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey);
$client->require_login();
$uid = $client->get_loggedin_user();
function getRequestParam($name, $default = NULL)
{
    if (isset($_REQUEST[$name])) {
        return $_REQUEST[$name];
    }
    return $default;
}
$netId = $_REQUEST['net'];
$statusMessage = null;
$errorMessage = null;
$pageHeader = "";
$formAction = $_REQUEST['form_action'];
$createButtonDisplay = "block";
if ($formAction == "edit") {
    $props = array('key', 'name', 'auth_url', 'login_url', 'canvas_url', 'web_url', 'social_url', 'auth_class', 'postmap_url');
    try {
        $resp = $client->api_client->admin_getNetworkProperties(array($netId), $props);
    } catch (Exception $e) {
        $errorMessage = 'Could not get network properties: ' . $e->getMessage();
    }
    if ($errorMessage == null) {
        $name = $resp[0]['name'];
 /**
  * Authorize the user against the api_key, app_id, or canvas_url
  *
  * This produces a SocialSession Object.
  *
  * Possible Params:
  * network_key
  * trust_key
  * api_key
  * canvas_url
  * auth_token
  * social_callback
  */
 public function authorize()
 {
     $network_session = null;
     $network_key = $this->getParam('network_key');
     $auth_token = $this->getParam('auth_token');
     $social_callback = $this->getParam('social_callback');
     $api_key = $this->getParam('api_key');
     $canvas_url = $this->getParam('canvas_url');
     $user_name = $this->getParam('user_name');
     $trust_key = $this->getParam('trust_key');
     if (!isset($trust_key)) {
         $trust_key = $socialApiKey;
     }
     $result = $this->getAppProperties();
     if ($result) {
         $callback = isset($result['callback_url']) ? $result['callback_url'] : '';
         $apiKey = isset($result['api_key']) ? $result['api_key'] : '';
         $apiSecret = isset($result['secret_key']) ? $result['secret_key'] : '';
         if (!isset($social_callback)) {
             $social_callback = $callback;
         }
         try {
             if (isset($apiKey) && isset($apiSecret)) {
                 $auth_url = $this->getAuthUrl($trust_key);
                 $fb = new RingsideApiClients($apiKey, $apiSecret, null, $auth_url);
                 //public function __construct($api_key, $secret, $session_key = null, $url = null) {
                 $result = $fb->do_get_session($auth_token);
                 $session_key = $fb->api_client->session_key;
                 $uid = $fb->api_client->users_getLoggedInUser();
                 $pids = $fb->api_client->users_mapToSubject(array($uid), $network_key, $result['application_id']);
                 //					RingsideSocialDbPrincipal::getPrincipalForSubject($uid, $network_key, $user_name, $trust_key);
                 //if ( isset($pids) ) {
                 // getPrincipalForSubject accepts and returns multiple IDs
                 $pid = 0;
                 if (isset($pids)) {
                     $pid = $pids[0];
                 }
                 // bool setcookie ( string $name [, string $value [, int $expire [, string $path [, string $domain [, bool $secure [, bool $httponly ]]]]]] )
                 $network_session = new RingsideSocialSession();
                 $network_session->setNetwork($network_key);
                 $network_session->addApiSessionKey($apiKey, $session_key);
                 $network_session->setUserId($uid);
                 $network_session->setPrincipalId($pid);
                 $network_session->setTrust($trust_key);
                 $network_session->setCallbackUrl($social_callback);
                 $network_session->setLoggedIn(true);
                 $context = $this->getContext($fb->api_client, $network_session);
                 if (strrpos($social_callback, '?') == 0) {
                     return $social_callback . '?' . $context;
                 } else {
                     return $social_callback . '&' . $context;
                 }
                 //} else {
                 //	$this->error = "Unable to set Principle!";
                 //}
             }
         } catch (Exception $exception) {
             error_log("Exception : " . $exception->getMessage() . "\n" . $exception->getTraceAsString());
             $this->error = "Exception : " . $exception->getMessage() . "\n" . $exception->getTraceAsString();
         }
     }
     if (!isset($network_session)) {
         error_log("Application with api_key: {$api_key} or canvas_url: {$canvas_url} not found!  Creating session and redirecting to {$social_callback}!");
         $network_session = new RingsideSocialSession(null);
         $network_session->setNetwork($network_key);
         $network_session->setTrust($trust_key);
         $network_session->setCallbackUrl($social_callback);
         if (strrpos($social_callback, '?') == 0) {
             return $social_callback . "?social_session_key=" . $network_session->getSessionKey();
         } else {
             return $social_callback . "?social_session_key=" . $network_session->getSessionKey();
         }
     }
 }
Esempio n. 9
0
<h1>Friends</h1>
<div class="">Search your friends:
<form onsubmit="" method="post"><input type="hidden" id="view"
	name="view" value="search" /> <input type="search" id="query"
	name="query" value="" /></form>
</div>
<BR>
<BR>
<div><fb:tabs>
	<fb:tab-item href='friends.php' title='Everyone' selected='true' />
	<fb:tab-item href='friends.php?view=add_friend' title='Add Friend' />
	<fb:tab-item href='friends.php?view=view_invites' title='View Invites' />
</fb:tabs></div>
<?php 
require_once 'ringside/api/clients/RingsideApiClients.php';
$client = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey);
$uid = $client->require_login();
//$user_name = $client->api_client->users_getInfo($uid, "first_name");
$url = $client->get_openfb_url();
$view = null;
isset($_REQUEST['view']) ? $view = $_REQUEST['view'] : ($view = null);
if ($view == null || $view == 'everyone') {
    // If it's not a view, check the action
    if (isset($_REQUEST['action'])) {
        $error = '';
        $message = '';
        $action = $_REQUEST['action'];
        if ($action == 'add_friend') {
            if (isset($_REQUEST['email']) && !empty($_REQUEST['email'])) {
                $next = isset($_REQUEST['next']) ? $_REQUEST['next'] : '/friends.php?view=view_invites';
                $domain_info = $client->api_client->admin_getDomainProperties(array('url'), null, $_REQUEST['fb_sig_nid']);
Esempio n. 10
0
 *
 * 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.
 */
/**
 * Adds some application-specific data to the session. It will be checked
 * by the corresponding get_data.php script.
 *
 * @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);
}
Esempio n. 11
0
 * 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.
 ******************************************************************************/
require_once('ringside/core/client/RingsideRestClient.php');
require_once('config.php');

$server_url = "http://api.facebook.com/restserver.php";
$web_url = 'http://www.facebook.com';
try {
require_once('ringside/api/clients/RingsideApiClients.php');
$fb = new RingsideApiClients($api_key, $secret, $web_url, $server_url);
$ringside = new RingsideRestClient($fb->api_client);

$loggedinuser = $fb->require_login();
$fb->api_client->friends_get();

	$ringside->items_setInfo('testitem', RingsideRestClient::$server_url, 'http://'.$_SERVER['HTTP_HOST']);
	$item = $ringside->items_getInfo('testitem');
	if ($item) {
?>Test Passed<?
$ringside->items_remove('testitem');
	} else {
?>Test FAILED<?
	}
} catch ( Exception $e ) {
?>Test EXCEPTION<br><pre><?php
Esempio n. 12
0
 * 
 * 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.
 ******************************************************************************/
require_once "ringside/web/RingsideWebUtils.php";
require_once "ringside/web/config/RingsideWebConfig.php";
require_once "ringside/api/clients/RingsideApiClients.php";
//This lines should be move to an include file?
$client = new RingsideApiClients(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey);
$client->setLocalClient(true);
$uid = $client->require_login();
$resp = $client->api_client->admin_getNetworkProperties(array(), array('name', 'key'));
//Get the url for the widget code for the code generat
$socialWidgetUrl = RingsideApiClientsConfig::$socialUrl . "/widget.php";
$networkOptions = "";
//Generate the optios for the select element
//The template contains a "select me" option
foreach ($resp as $net) {
    $key = $net['key'];
    $name = $net['name'];
    if (strlen(trim($key)) > 0) {
        $networkOptions .= "<option value='" . $key . "'>" . $name . "</option>";
    }
}
Esempio n. 13
0
 * 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.
 */
require_once 'ringside/api/clients/RingsideApiClients.php';
include_once 'LocalSettings.php';
/**
 * Reads application-specific data out of the session, making sure user mapping is working properly.
 *
 * @author Jason Kinner <*****@*****.**>
 */
// 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_stored_user = '******';
error_log("Calling idmap get_data");
// 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("Stored UID is " . $_SESSION['test_uid']);
// The only mapping we're doing here is _from_ the principal _to_ the network; so we ALWAYS pass a second argument.
$stored_user = $_SESSION['test_uid'];
if (strpos($stored_user, ',') !== false) {
    $stored_user = explode(',', $stored_user);
Esempio n. 14
0
 * the License, or (at your option) any later version.
 *
 * 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 the ringside client libraries
require_once 'config.php';
// Get the ringside client
$ringsideClient = new RingsideApiClients(Config::$api_key, Config::$secret);
$ringsideClient->require_frame();
// Make sure the user is logged in and get the UID
$userid = $ringsideClient->require_login();
// Instantiate the rest client, this is for the ratings api in extension apps
$rest = new RingsideRestClient($ringsideClient->api_client);
$name = $rest->delegate->users_getInfo($userid, "first_name");
// Show the dashboard
?>
<fb:dashboard>
	<fb:action href="index.php?action=list">View Suggestions</fb:action>
	<fb:create-button href="index.php?action=add">Create a Suggestion</fb:create-button>
</fb:dashboard>
<?php 
// Say hi to the user, but let's use an fbml tag, just as another example of using fbml
// instead of html
Esempio n. 15
0
 * 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.
 */
/**
 * 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) {
Esempio n. 16
0
<?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>
Esempio n. 17
0
 public static function get_facebook_url($subdomain = 'www')
 {
     if (class_exists('RingsideApiClients')) {
         $url = RingsideApiClients::get_facebook_url($subdomain);
         return $url;
     }
     return 'http://' . $subdomain . '.facebook.com';
 }
Esempio n. 18
0
 * the License, or (at your option) any later version.
 * 
 * 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}' />";
Esempio n. 19
0
 *
 * 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 the ringside client libraries
include_once 'ringside/api/clients/RingsideApiClients.php';
include_once 'ringside/api/clients/SuggestionClient.php';
include_once 'ringside/api/clients/RingsideRestClient.php';
// Control your configuration via this config file
include_once 'config.php';
// Get the ringside client
RingsideApiClientsConfig::$webUrl = Config::$ringsideWeb;
RingsideApiClientsConfig::$serverUrl = Config::$ringsideApi;
$ringside = new RingsideApiClients(Config::$api_key, Config::$secret);
//// Make sure the user is logged in and get the UID
// TODO: Probably don't need this in the app.  Let the framework figure this out
// suggestions can be anonymous
$userid = $ringside->require_login();
// Show the add and the dashboard.
if ((isset($_REQUEST['existingtopic']) || isset($_REQUEST['newtopic'])) && isset($_REQUEST['suggestion'])) {
    $ownerid = 0;
    $topic = '';
    $suggestion = $_REQUEST['suggestion'];
    // Topics are messed up for new topics
    if (isset($_REQUEST['existingtopic']) && $_REQUEST['existingtopic'] != 'none') {
        $str = $_REQUEST['existingtopic'];
        // comes in the form ownerid:topic
        $pos = strpos($str, ':');
        if ($pos) {