mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Facebook draft
This commit is contained in:
64
e107_plugins/facebook/admin_config.php
Normal file
64
e107_plugins/facebook/admin_config.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* e107 Release Plugin
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/admin_config.php,v $
|
||||
* $Revision: 11315 $
|
||||
* $Date: 2010-02-10 10:18:01 -0800 (Wed, 10 Feb 2010) $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
require_once("../../class2.php");
|
||||
if (!getperms("P")) { header("location:".e_BASE."index.php"); exit; }
|
||||
|
||||
/*
|
||||
* After initialization we'll be able to call dispatcher via e107::getAdminUI()
|
||||
* so this is the first we should do on admin page.
|
||||
* Global instance variable is not needed.
|
||||
* NOTE: class is auto-loaded - see class2.php __autoload()
|
||||
*/
|
||||
/* $dispatcher = */
|
||||
|
||||
|
||||
|
||||
|
||||
new plugin_facebook_admin();
|
||||
|
||||
/*
|
||||
* Uncomment the below only if you disable the auto observing above
|
||||
* Example: $dispatcher = new plugin_release_admin(null, null, false);
|
||||
*/
|
||||
//$dispatcher->runObservers(true);
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
|
||||
/*
|
||||
* Send page content
|
||||
*/
|
||||
e107::getAdminUI()->runPage();
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
||||
/* OBSOLETE - see admin_shortcodes::sc_admin_menu()
|
||||
function admin_config_adminmenu()
|
||||
{
|
||||
//global $rp;
|
||||
//$rp->show_options();
|
||||
e107::getRegistry('admin/release_dispatcher')->renderMenu();
|
||||
}
|
||||
*/
|
||||
|
||||
/* OBSOLETE - done within header.php
|
||||
function headerjs() // needed for the checkboxes - how can we remove the need to duplicate this code?
|
||||
{
|
||||
return e107::getAdminUI()->getHeader();
|
||||
}
|
||||
*/
|
||||
?>
|
65
e107_plugins/facebook/e_header.php
Normal file
65
e107_plugins/facebook/e_header.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
$fbPref = e107::getPlugPref('facebook');
|
||||
|
||||
// print_a($fbPref);
|
||||
// $appId = $fbPref['appId'];
|
||||
echo " ";
|
||||
$code = <<<EOT
|
||||
$(function() {
|
||||
$('body').append('<div id="fb-root"></div>
|
||||
<div class="fb-login-button">Login with Facebook</div>
|
||||
|
||||
<div
|
||||
class="fb-registration"
|
||||
data-fields="[{'name':'name'}, {'name':'email'},
|
||||
{'name':'favorite_car','description':'What is your favorite car?',
|
||||
'type':'text'}]"
|
||||
data-redirect-uri="URL_TO_LOAD_AFTER_REGISTRATION"
|
||||
</div>
|
||||
');
|
||||
|
||||
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
appId : '{$fbPref['appId']}',
|
||||
status : true,
|
||||
cookie : true,
|
||||
xfbml : true,
|
||||
oauth : true
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: document.location.protocol + '//connect.facebook.net/en_US/all.js' ,
|
||||
// success: callback,
|
||||
dataType: "script",
|
||||
cache: true
|
||||
});
|
||||
});
|
||||
EOT;
|
||||
|
||||
|
||||
$core = "";
|
||||
|
||||
$perms = "email";
|
||||
|
||||
$code = <<<EOT
|
||||
|
||||
|
||||
|
||||
EOT;
|
||||
|
||||
|
||||
$link = "https://www.facebook.com/dialog/oauth?client_id={$fbPref['appId']}
|
||||
&redirect_uri=".e_SELF."&scope={$perms}&response_type=token";
|
||||
*/
|
||||
// echo "<a href='{$link}'>Login with Facebook</a>";
|
||||
|
||||
|
||||
// e107::js('inline',$code,'jquery',3);
|
||||
|
||||
?>
|
25
e107_plugins/facebook/e_shortcode.php
Normal file
25
e107_plugins/facebook/e_shortcode.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class facebook_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
function sc_fb($parm='')
|
||||
{
|
||||
$fbPref = e107::getPlugPref('facebook');
|
||||
$perms = "email";
|
||||
|
||||
if($parm == 'login')
|
||||
{
|
||||
$link = "https://www.facebook.com/dialog/oauth?client_id={$fbPref['appId']}
|
||||
&redirect_uri=".e_SELF."&scope={$perms}&response_type=token";
|
||||
|
||||
return "<a href='{$link}'>Login with Facebook</a>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
69
e107_plugins/facebook/includes/admin.php
Normal file
69
e107_plugins/facebook/includes/admin.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* facebookd under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* facebook Plugin Administration UI
|
||||
*
|
||||
* $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.8/e107_plugins/facebook/includes/admin.php $
|
||||
* $Id: admin.php 12754 2012-05-26 12:21:39Z e107coders $
|
||||
*/
|
||||
|
||||
//require_once(e_HANDLER.'admin_handler.php'); - autoloaded - see class2.php __autoload()
|
||||
class plugin_facebook_admin extends e_admin_dispatcher
|
||||
{
|
||||
|
||||
protected $modes = array(
|
||||
'main' => array(
|
||||
'controller' => 'plugin_facebook_admin_ui',
|
||||
'path' => null,
|
||||
'ui' => 'plugin_facebook_admin_form_ui',
|
||||
'uipath' => null
|
||||
)
|
||||
);
|
||||
|
||||
protected $adminMenu = array(
|
||||
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'),
|
||||
);
|
||||
|
||||
protected $adminMenuAliases = array(
|
||||
'main/edit' => 'main/list'
|
||||
);
|
||||
|
||||
/**
|
||||
* Navigation menu title
|
||||
* @var string
|
||||
*/
|
||||
protected $menuTitle = 'facebook Menu';
|
||||
}
|
||||
|
||||
class plugin_facebook_admin_ui extends e_admin_ui
|
||||
{
|
||||
// required
|
||||
protected $pluginTitle = "e107 facebook";
|
||||
protected $pluginName = 'facebook';
|
||||
// protected $table = "facebook";
|
||||
|
||||
|
||||
// optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName);
|
||||
protected $prefs = array(
|
||||
'appId' => array('title'=> 'Facebook AppId', 'type'=>'text', 'data' => 'string', 'validate' => true),
|
||||
'appSecret' => array('title'=> 'Facebook AppSecret', 'type'=>'text', 'data' => 'string', 'validate' => true),
|
||||
|
||||
// 'xfbml' => array('title'=> 'xfbml', 'type' => 'boolean', 'data' => 'int'),
|
||||
// 'oauth' => array('title'=> 'oAuth', 'type' => 'boolean', 'data' => 'int')
|
||||
);
|
||||
|
||||
// optional
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class plugin_facebook_admin_form_ui extends e_admin_form_ui
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user