MyBB Community Forums

Full Version: Page Manager and Facebook Script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, im trying to add a radio page to my forum that only allows registered users to see the page, I have used this code so far

<?php
if(!$mybb->user['uid'])
{
    error_no_permission();
}
$template .= '<html>
<head>
<title>'.$pages['name'].' - '.$mybb->settings['bbname'].'</title>
{$headerinclude}
</head>
<body>
{$header} 


SECTION1


<br/>
{$footer}
</body>
</html>';

$template=str_replace("\'", "'", addslashes($template));

eval("\$page=\"".$template."\";");

output_page($page);
?>

I tried to add our code for the facebook recommend button on this page http://sharetune.net/misc.php?page=radio into SECTION1 but when I do, and try to load the page it says it hasnt been configured correctly yet seems to work perfectly fine on the other page.

The code in question that doesnt seem to be working is this

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=OURAPPIDISHERE";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

This is a page that I have all that code including the facebook code posted above it will show you the error that happens.
http://sharetune.net/misc.php?page=test
I'm trying to get the gallery to work in page manager rotating photo gallery and wanted to test the code

<?php
// start session
session_start();

// create unique token
$form_token = uniqid();

// commit token to session
$_SESSION['user_token'] = $form_token;
?>


<?php
global $headerinclude, $header, $theme, $footer;

$template='<html>

<head>
<style type="text/css">
.wiki_panel {
background: #7D839C;
color: #fff;
font-size: 11px;
border: 1px outset #D4D4D4;
padding: 8px;
margin: 0 auto;
width: 75%;
text-align:center;
border-top-left-radius: 7px;
border-top-right-radius: 7px;
-moz-border-radius-topleft: 7px;
-moz-border-radius-topright: 7px;
-webkit-border-top-left-radius: 7px;
-webkit-border-top-right-radius: 7px;
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
-moz-border-radius-bottomleft: 7px;
-moz-border-radius-bottomright: 7px;
-webkit-border-bottom-left-radius: 7px;
-webkit-border-bottom-right-radius: 7px;
}
.blkbg {
width:100%;
background:#000;
}
&nbsp;</style>

<title>'.$pages['name'].'</title>
{$headerinclude}
</head>
<body>
{$header}

<table border="0" cellspacing="'.$theme['borderwidth'].'" cellpadding="'.$theme['tablespace'].'" class="tborder">
<thead>
<tr>
<td class="thead">
<strong>'.$pages['name'].'</strong>
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="trow1">
So the idea is for images to end up in here. Working on that still.

</td>
</tr>
<tr>
<td class="trow2">
<div class="wiki_panel">

<div class="blkbg" style="background:#000;width: 100%;">To upload a picture, please use this form:</div>
<br />
<form action="upload.php";method="post";enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MAX_UPLOAD_SIZE ?>" />
<input type="hidden" name="form_token" value="<?php echo $_SESSION[\'form_token\'] ?>" />
<input type="file";name="image" /> <br />
<input type="submit";value="Upload" /><br />
</form>
<p>Max file size: <?php echo to_human(MAX_UPLOAD_SIZE, 0) ?>

</div>
</td>
</tr>
</tbody>
</table>

<br />

{$footer}
</body>
</html>';

$template=str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page=\"".$template."\";");

output_page($page);

?>
(2012-12-24, 06:16 AM)one1one Wrote: [ -> ]
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=OURAPPIDISHERE";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
You will need to escape some of those ' from the code you are adding, so use this one instead:
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=OURAPPIDISHERE";
  fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', '\facebook-jssdk\'));</script>