* * 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';
session_destroy(); if ($trailingSlash === true) { $canvas = "../login"; } else { $canvas = "login"; } RingsideWebUtils::redirect(RingsideWebConfig::$webRoot . '/ringside.php/' . $canvas); } else { if (empty($canvas) || strlen(trim($canvas)) < 2) { $canvas = 'welcome'; $pathInfo = ''; } } } try { $text = $social->render('canvas', null, $canvas, $pathInfo); } catch (Exception $exception) { error_log('Getting application page failed. $exception'); } if ($social->getRedirect() != null) { RingsideWebUtils::redirect($social->getRedirect()); } else { if ($social->isRaw()) { echo $text; } else { ?> <html> <head> <link rel="stylesheet" href="<?php echo RingsideWebConfig::$webRoot; ?>
* 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';
} 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, "/"); } if ($inSession === false) { $left = array(); } else { $left = array(); } $top = 'menu'; // This is the same list as is used inside $social->render, below. Hopefully this will be cached soon so there will only be one actual round-trip to the API server. $canvas_content = $social->render('canvas', null, $canvas, $pathInfo); $error = $social->getError(); $iframe = $social->getIFrame(); if ($social->getRedirect() != null) { RingsideWebUtils::redirect($social->getRedirect()); } else { // Social pages get RAW others get TEMPLATE if ($social->isRaw()) { echo $canvas_content; } else { include 'oneapp.inc'; } }
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 { // error_log("Already logged in as ".$social->getCurrentUser().' on '.$social->getCurrentNetwork()); $redirect_url = RingsideWebConfig::$webRoot . '/index.php';
* 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=" . urlencode($next)); } $left = array('apps', 'welcome', 'advert'); $top = 'menu'; $canvas_content = $social->render('canvas', null, 'friends', ''); include 'oneapp.inc';
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';
* 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'; }