Your IP : 216.73.216.240
<?php
/**
* @package FFGate
* @author Yves Hoppe <yves@compojoom.com>
* @date 26.11.13
*
* @copyright Copyright (C) 2008 - 2013 compojoom.com - Yves Hoppe. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die('Restricted access');
$doc = JFactory::getDocument();
if ($this->format == 'raw')
{
// We should load probably some basic CSS files here
}
if (FFGateHelperSettings::_('loadMootools', 1))
{
if (JVERSION >= 3)
{
JHtmlBehavior::framework();
JHtml::_('jquery.framework');
}
else
{
JHTML::_('behavior.mootools');
}
}
// Adding our custom css
$doc->addStyleSheet('media/com_ffgate/css/ffgate.css');
// Adding custom stylesheet with higer priority then ours
$doc->addStyleDeclaration($this->params->get('custom_css', "/* FFGATE CSS */"));
// Christmas promotion 2013
if (FFGateHelperSettings::_('snowEffect', 0))
{
// Load JQuery
JHtml::_('jquery.framework');
$doc->addScript('media/com_ffgate/js/jquery.snow.min.js');
$doc->addScriptDeclaration('
jQuery(document).ready( function(){
jQuery.fn.snow({maxSize: 40});
});
');
}
// Testing if app_id & app_secret ist set
if (empty($this->site->app_id) || empty($this->site->app_secret))
{
JError::raiseError("403", JText::_("COM_FFGATE_CONFIGURE_YOUR_FB_APP_SECRETS"));
}
// Connecting to facebook - should be moved into a function / helper or into model later
$facebook = new Facebook(
array(
'appId' => $this->site->app_id,
'secret' => $this->site->app_secret,
'cookie' => true
)
);
// If site is set to public everybody is going to see the html_text without filtering
if ($this->public)
{
echo JHTML::_('content.prepare', $this->site->html_text);
}
else
{
$signed_request = $facebook->getSignedRequest();
// Should be moved to helper
function parsePageSignedRequest()
{
if (isset($_REQUEST['signed_request']))
{
$encoded_sig = null;
$payload = null;
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
$sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));
return $data;
}
return false;
}
// Check if visitor comes from facebook
if ($signed_request = parsePageSignedRequest())
{
// Content for Fans
if ($signed_request->page->liked)
{
echo JHTML::_('content.prepare', $this->site->html_text);
}
else
{
// Content for no Fans
echo JHTML::_('content.prepare', $this->site->html_text_no_fan);
}
}
else
{
// Show this error to none facebook visitors
JError::raiseError(403, JText::_("COM_FFGATE_THIS_PAGE_IS_RESTRICTED_TO_FACEBOOK_VISITORS"));
}
}
if (FFGateHelperSettings::_('showPoweredby', 1))
{
echo FFGateHelperBasic::footer();
}
if (FFGateHelperSettings::_('disableScrolls', 1)):?>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function () {
FB.init({
appId: '<?php echo $this->site->app_id; ?>',
status: true,
cookie: false,
xfbml: true
});
FB.Canvas.setAutoGrow(100);
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/de_DE/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php endif; ?>
<?php if (FFGateHelperSettings::_('shareButton', 0)): ?>
<div align="right">
<a target="_top"
href="http://www.facebook.com/dialog/feed?app_id=<?php echo $this->site->app_id; ?>&link=https://www.facebook.com/<?php echo $this->site->fbuser; ?>?sk=app_<?php echo $this->site->app_id;
?>&picture=<?php echo JUri::root() . "images/" . $this->site->thumbnail; ?>&name=<?php echo urlencode($this->site->title); ?>&caption=<?php echo urlencode($this->site->caption);
?>&description=<?php echo urlencode($this->site->description); ?>&redirect_uri=https://www.facebook.com/<?php echo $this->site->fbuser;
?>?sk=app_<?php echo $this->site->app_id; ?>&display=page"
class="shareButton"/><?php echo JText::_("COM_FFGATE_SHARE"); ?></a>
</div>
<?php endif; ?>