private static function generateNonSandboxedCode(&$params)
 {
     //Get the rendered HTML code for the app
     $server = new RingsideSocialServerRender();
     $responseHTML = $server->execute($params);
     //Need to clean up the code so we can document.wrte it out
     //No line breaks, escape \, and break up script tags
     $bad = array("\n", "\"", "<script", "</script>");
     $good = array("", "\\\"", "<sc\" + \"ript", "</sc\" + \"ript>");
     $newphrase = str_replace($bad, $good, $responseHTML);
     //Generate the JavaScript that will write the HTML out onto the page
     //We are in script tags alread so no need for them here
     $scriptOut = 'document.write( "' . $newphrase . '" );';
     return $scriptOut;
 }
예제 #2
0
파일: render.php 프로젝트: jkinner/ringside
 * 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 "LocalSettings.php";
require_once "ringside/social/RingsideSocialServerRender.php";
require_once 'ringside/api/Session.php';
$override_from_query_string = array('social_session_key');
// TODO: This requires the API and Social tiers to be co-located (or to have a shared session repository)
session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
session_cache_limiter('none');
$server = new RingsideSocialServerRender();
if (isset($_REQUEST['format']) && $_REQUEST['format'] == 'JSON') {
    // The widget requires JSON for cross domain support
    $json_response = null;
    $responseHTML = '';
    try {
        error_log("fbml render request=" . $_REQUEST['fbml']);
        $fbmlReq = $_REQUEST['fbml'];
        $responseHTML = $server->execute($_REQUEST);
    } catch (Exception $e) {
        $json_response = json_encode(array('response' => 'error', 'widgetid' => $_REQUEST['widgetid'], 'message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine()));
        error_log($e->getTraceAsString());
    }
    if (is_null($json_response)) {
        if (array_key_exists('widgetid', $_REQUEST)) {
            $response['widgetid'] = $_REQUEST['widgetid'];