* * 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. ******************************************************************************/ include_once 'include.php'; require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); $inSession = $social->inSession(); if ($inSession === false) { $next = $_SERVER['REQUEST_URI']; RingsideWebUtils::redirect(RingsideWebConfig::$webRoot . "/login.php?next={$next}"); } $left = array('welcome', 'advert'); $canvas_content = $social->render('canvas', null, 'apps', ''); include 'oneapp.inc';
require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; /** * This is SOCIAL render integration page. * This enables a third party site to point to this page and * get back an application. * * To render through we need to know which network is making the request. * NETWORK: * AUTHENTICATED USER: * */ $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); $inSession = $social->inSession(); $pathInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : ''; $canvas = ''; $trailingSlash = false; if (!empty($pathInfo)) { if ($str[strlen($str) - 1] == "/") { $trailingSlash = true; } $pathInfo = ltrim($pathInfo, "/"); $path_parts = explode('/', trim($pathInfo), 2); $canvas = $path_parts[0]; if (isset($path_parts[1])) { $pathInfo = $path_parts[1]; } else { $pathInfo = '';
* * 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/social/client/RingsideSocialClientLocal.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); ?> <div id="widebar-header"> <div id="global-links"> <ul> <li><a href="<?php echo RingsideWebConfig::$webRoot; ?> /index.php">Home</a></li> <li><?php if ($social->inSession()) { ?> <a href="<?php echo RingsideWebConfig::$webRoot; ?> /logoff.php">Logout</a><?php
<?php require_once 'include.php'; function getLoginNextURL() { $pstr = strtolower($_SERVER["SERVER_PROTOCOL"]); $prot = substr($pstr, 0, strpos($pstr, '/')); $port = $_SERVER["SERVER_PORT"]; return $prot . '://' . $_SERVER['SERVER_NAME'] . ':' . $port . $_SERVER['REQUEST_URI']; } //deal with login stuff, pass variables to JavaScript $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); $inSession = $social->inSession(); $jSession = $inSession ? 'true' : 'false'; $jLoginUrl = RingsideWebConfig::$webRoot . '/login.php?next=' . urlencode(getLoginNextURL()); echo "<script type=\"text/javascript\">\n"; echo " var ringside_fbjs_in_session = {$jSession};\n"; echo " var ringside_fbjs_login_url = \"{$jLoginUrl}\";\n"; echo "</script>\n"; //put links in for stylesheets $styleSheets = array('flora/flora.all.css'); foreach ($styleSheets as $s) { $sPath = RingsideWebConfig::$webRoot . '/js/jquery/css/' . $s; echo "<link rel=\"stylesheet\" href=\"{$sPath}\" type=\"text/css\" media=\"screen\" title=\"Flora (Default)\">\n"; } //include relevant .js files $jqueryIncFiles = array('jquery-1.2.6.js', 'ui.core.js', 'ui.dialog.js', 'ui.resizable.js', 'ui.draggable.js'); foreach ($jqueryIncFiles as $incFile) { $incPath = RingsideWebConfig::$webRoot . '/js/jquery/' . $incFile; echo "<script type='text/javascript' src='{$incPath}'></script>\n";
* 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. ******************************************************************************/ include_once 'include.php'; require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); $inSession = $social->inSession(); if ($inSession === false) { $register = $social->render('canvas', null, 'register', ''); if ($social->getRedirect() != null) { RingsideWebUtils::redirect($social->getRedirect()); } } else { RingsideWebUtils::redirect(RingsideWebConfig::$webRoot . "/index.php"); } $canvas_content = $register; include 'oneapp.inc';
* 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 'include.php'; require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; /** * Canvas page is the controller for displaying most applications. * The standard top and sidebars are used. * The application being invoked is picked from the path info. */ $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideSocialConfig::$apiKey, RingsideSocialConfig::$secretKey, $webSession->getSocial()); $inSession = $social->inSession(); $pathInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : ''; if (empty($pathInfo) || strlen(trim($pathInfo)) < 2) { $canvas = 'index.php'; $pathInfo = ''; } else { $path_parts = explode('/', trim($pathInfo), 3); $canvas = $path_parts[1]; if (isset($path_parts[2])) { $pathInfo = $path_parts[2]; } else { RingsideWebUtils::redirect(ltrim($pathInfo, '/') . '/' . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '')); return; } $pathInfo = ltrim($pathInfo, "/");
require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; /** * Login.php is the end point for the UI of login. * There are a set parameters which the login application can deal with, however, since * we check for session at this point there is an override which needs support here. * * skipcookie - if the session is created walk through the process all over again, but don't log the user out. * popup - don't select oneapp as the template, but choose skinless template by default */ $skipCookie = isset($_REQUEST['skipcookie']) ? true : false; $popUp = isset($_REQUEST['popup']) ? true : false; $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); if ($skipCookie === true) { $canvas_content = $social->render('canvas', null, 'login', ''); if ($social->getRedirect()) { RingsideWebUtils::redirect($social->getRedirect()); return; } } else { if ($social->inSession() === false || !$social->getCurrentUser()) { $canvas_content = $social->render('canvas', null, 'login', ''); if ($social->inSession() !== false) { $webSession->setSocial($social->getNetworkSessionKey()); RingsideWebUtils::redirect($social->getRedirect()); return; } } else {
public function execute($params) { $this->debug('Entering'); $this->debugVar($params); $network_session = null; /* foreach($params as $k => $v) { error_log("RingsideSocialServerRender: $k=$v"); } */ // Recreate Session if we have it error_log("Parameters for widget render are: " . var_export($params, true)); error_log("PHPSESSID=" . (isset($_COOKIE['PHPSESSID']) ? $_COOKIE['PHPSESSID'] : '<empty>')); if (array_key_exists('social_session_key', $params)) { $session_key = $params['social_session_key']; $network_session = new RingsideSocialSession($session_key); $uid = $network_session->getUserId(); if (null == $uid || strlen($uid) == 0) { setcookie('social_session_key', $network_session->getSessionKey()); $uid = $network_session->getUserId(); if (isset($_REQUEST['uid'])) { // TODO: SECURITY: I don't think we should just be able to override the uid. $uid = $_REQUEST['uid']; // TODO: SECURITY: This shouldn't be a valid way to log in. $network_session->setUserId($uid); $network_session->setLoggedIn(true); } } } else { if (isset($_COOKIE['PHPSESSID'])) { // Optimization if user is already logged into web front-end $network_session = new RingsideSocialSession($_COOKIE['PHPSESSID']); error_log("PHPSESSID says session is as follows: " . var_export($network_session, true)); $uid = $network_session->getUserId(); if (!isset($uid)) { // The user has a network session but is not logged in // Run as an anonymous user $trust = new RingsideSocialApiTrust($_REQUEST); $network_session = $trust->getAnonymousSession(); } } else { // Not logged in, so login via annonymous user $trust = new RingsideSocialApiTrust($_REQUEST); $network_session = $trust->getAnonymousSession(); } } $api_session_key = $network_session->getApiSessionKey($params['api_key']); if (null == $api_session_key) { $rest = RingsideSocialUtils::getAdminClient(); $app_props = $rest->admin_getAppProperties(array('secret_key'), null, null, $params['api_key'], $network_session->getNetwork()); error_log("Adding API key for " . $params['api_key'] . " to social session for user " . $network_session->getUserID()); RingsideSocialUtils::getApiSessionKey($params['api_key'], $app_props['secret_key'], $network_session); } else { error_log("Using API session key {$api_session_key} for user " . $network_session->getUserID()); } if (array_key_exists('method', $params)) { $method = $params['method']; if (strcasecmp($method, 'fbml') == 0 && array_key_exists('fbml', $params)) { $fbml = $params['fbml']; //error_log("fbml: $fbml"); $render = new RingsideSocialApiRenderFBML($params); $result = $render->render($network_session, $fbml); //error_log("content: ".$result['content']); return isset($result['content']) ? $result['content'] : $result['error']; } else { if (strcasecmp($method, 'app') == 0) { $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $network_session->getSessionKey()); $inSession = $social->inSession(); error_log("User " . ($inSession ? 'is' : 'is not') . " in session"); if ($inSession) { $path = ''; if (array_key_exists('path', $params)) { $path = $params['path']; } $view = 'canvas'; if (array_key_exists('view', $params)) { $view = $params['view']; } //error_log("About to render: ".$params['app']." view: $view, path: $path"); $rest = RingsideSocialUtils::getAdminClient(); $app_props = $rest->admin_getAppProperties(array('application_id', 'canvas_url'), null, null, $params['api_key'], null, $network_session->getNetwork()); $domain_props = $rest->admin_getDomainProperties(array('resize_url'), null, $network_session->getNetwork()); $content = $social->render($view, $app_props['application_id'], $app_props['canvas_url'], $path); // TODO: Is this where error reporting should happen? //error_log("content: $content"); if (isset($domain_props['resize_url'])) { $content = "<html><head><script type=\"text/javascript\">\n function resizeIframe(id) {\n var iframe = document.getElementById( 'xdiframe' );\n var wrapper = document.getElementById( 'wrapper' );\n var height = Math.max( document.body.offsetHeight, document.body.scrollHeight );\n var width = Math.max( document.body.offsetWidth, document.body.scrollWidth );\n iframe.src = '{$domain_props['resize_url']}?height='+height+'&width='+width+'&id='+id;\n }\n</script></head><body onload=\"resizeIframe('if_" . $params['api_key'] . "');\">" . $content . "<iframe id='xdiframe' width='1' height='1' frameborder='0'/></body></html>"; } return $content; } else { echo "<error>User not Logged in!</error>"; } } } } else { error_log("No method specified for render request"); } }
echo $canvas_content; return; } require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; /** * The setup page is specifically for rendering the setup process. * This is aimed at being a starting point once you have layed out * the distribution. First link to hit is not index.php but * rather /setup.php. This follows the same syntax as everything, * everything is an application! However in the case of setup * and probably some other places the application is rendered with * a modified render call, as the DB is not setup. If the DB is setup * then the application will be called normal. */ $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); // Clear any hint of a session. $social->clearSession(); $webSession->clearSession(); session_destroy(); $pathInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : ''; if (empty($pathInfo) || strlen(trim($pathInfo)) < 2) { $pathInfo = ''; } else { $pathInfo = ltrim($pathInfo, "/"); } $canvas_content = $social->render('canvas', null, 'setup', $pathInfo); include 'oneapp.inc';
* 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 'include.php'; require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); if ($social->inSession() === false) { RingsideWebUtils::redirect(RingsideWebConfig::$webRoot . "/index.php"); } else { $canvas = "Logout"; $canvas_content = $social->render('canvas', null, 'login', ''); $social->clearSession(); $webSession->clearSession(); session_destroy(); // Deleting the social session key is required // for rendering to stop identifying a user. if (array_key_exists('social_session_key', $_COOKIE)) { // Force this cookie to expire setcookie('social_session_key', "", time() - 3600); } // You may not always want to go to the home page
* 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 'include.php'; require_once 'ringside/web/RingsideWebUtils.php'; require_once 'ringside/web/config/RingsideWebConfig.php'; require_once 'ringside/web/session/RingsideWebSession.php'; require_once 'ringside/social/client/RingsideSocialClientLocal.php'; $webSession = new RingsideWebSession(); $social = new RingsideSocialClientLocal(RingsideWebConfig::$networkKey, null, $webSession->getSocial()); $inSession = $social->inSession(); if ($inSession === false) { $next = $_SERVER['REQUEST_URI']; RingsideWebUtils::redirect(RingsideWebConfig::$webRoot . "/login.php?next={$next}"); } $canvas = 'comments'; $canvas_content = $social->render('canvas', null, $canvas, ''); $error = $social->getError(); if ($social->getRedirect() != null) { RingsideWebUtils::redirect($social->getRedirect()); } else { $left = array('welcome', 'advert'); include 'oneapp.inc'; }