mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Some cleanup
This commit is contained in:
@@ -1,85 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* we need a full wide page, no sidebar,
|
* we need a full wide page, no sidebar,
|
||||||
* where place the Facebook Invite Friends Flash Object,
|
* where place the Facebook Invite Friends Flash Object,
|
||||||
* this Object can't be styled so... put it in CUSTOMPAGES
|
* this Object can't be styled so... put it in CUSTOMPAGES
|
||||||
*
|
|
||||||
* but we can use a popup page instead ?
|
|
||||||
*/
|
|
||||||
//TODO use popup window for 'invite friends'.
|
|
||||||
$CUSTOMPAGES = array_push( explode( ' ' , $CUSTOMPAGES ) , ' facebook.php' );
|
|
||||||
|
|
||||||
include_once (e_PLUGIN.'facebook/facebook_function.php');
|
|
||||||
|
|
||||||
//echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>';
|
|
||||||
|
|
||||||
echo '<link rel="stylesheet" href="'.e_PLUGIN.'facebook/facebook.css" type="text/css" />';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* if we are in comment.php page add "publish_to_facebook" checkbox to the form
|
|
||||||
*
|
*
|
||||||
*/
|
* but we can use a popup page instead ?
|
||||||
|
*/
|
||||||
|
|
||||||
if( ( ( e_PAGE == "comment.php") || ( eregi( 'extend' , e_QUERY ) ) ) && (is_fb()))
|
if (USER_AREA == TRUE)
|
||||||
{
|
{
|
||||||
|
//TODO use popup window for 'invite friends'.
|
||||||
|
$CUSTOMPAGES = array_push(explode(' ', $CUSTOMPAGES), ' facebook.php');
|
||||||
|
$fb = e107::getSingleton('e_facebook',e_PLUGIN.'facebook/facebook_function.php');
|
||||||
echo '<script type="text/javascript">
|
|
||||||
|
include_once (e_PLUGIN.'facebook/facebook_function.php');
|
||||||
|
|
||||||
|
//echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>';
|
||||||
|
|
||||||
|
echo '<link rel="stylesheet" href="'.e_PLUGIN.'facebook/facebook.css" type="text/css" />';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if we are in comment.php page add "publish_to_facebook" checkbox to the form
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (((e_PAGE == "comment.php") || (eregi('extend', e_QUERY))) && ($fb->fb_uid))
|
||||||
|
{
|
||||||
|
|
||||||
|
echo '<script type="text/javascript">
|
||||||
document.observe("dom:loaded", function() {
|
document.observe("dom:loaded", function() {
|
||||||
|
|
||||||
var commentbutton = document.getElementsByName("commentsubmit")[0];
|
var commentbutton = document.getElementsByName("commentsubmit")[0];
|
||||||
|
|
||||||
commentbutton.insert( {"after" : " <img src=\"http://static.ak.fbcdn.net/images/icons/favicon.gif\" /><input type=\"checkbox\" name=\"publish_to_facebook\" checked /> Publish Comment to Facebook"}) }); </script>';
|
commentbutton.insert( {"after" : " <img src=\"http://static.ak.fbcdn.net/images/icons/favicon.gif\" /><input type=\"checkbox\" name=\"publish_to_facebook\" checked /> Publish Comment to Facebook"}) }); </script>';
|
||||||
|
|
||||||
onloadRegister('facebook_show_feed_checkbox();');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple Pure Javascript code , do same thing of prototype!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
echo '
|
|
||||||
var commentbutton = document.getElementsByName("commentsubmit")[0];
|
|
||||||
|
|
||||||
var checkbox = document.createElement("input");
|
|
||||||
checkbox.type = "checkbox";
|
|
||||||
checkbox.name = "publish_to_facebook";
|
|
||||||
checkbox.defaultChecked = true;
|
|
||||||
|
|
||||||
var txt = document.createTextNode("Publish Comment to Facebook");
|
|
||||||
|
|
||||||
var img = document.createElement("img");
|
onloadRegister('facebook_show_feed_checkbox();');
|
||||||
img.setAttribute("src", "http://static.ak.fbcdn.net/images/icons/favicon.gif");
|
|
||||||
img.setAttribute("alt", "");
|
/**
|
||||||
img.setAttribute("style", "padding-left:5px");
|
* Simple Pure Javascript code , do same thing of prototype!
|
||||||
|
*
|
||||||
commentbutton.parentNode.insertBefore(img,commentbutton.nextSibling);
|
*/
|
||||||
img.parentNode.insertBefore(checkbox,img.nextSibling);
|
|
||||||
checkbox.parentNode.insertBefore(txt,checkbox.nextSibling);
|
/*
|
||||||
';
|
echo '
|
||||||
|
var commentbutton = document.getElementsByName("commentsubmit")[0];
|
||||||
*/
|
|
||||||
|
var checkbox = document.createElement("input");
|
||||||
/**
|
checkbox.type = "checkbox";
|
||||||
* if we are in the signup page add the Facebook Connect Button
|
checkbox.name = "publish_to_facebook";
|
||||||
*
|
checkbox.defaultChecked = true;
|
||||||
*/
|
|
||||||
|
var txt = document.createTextNode("Publish Comment to Facebook");
|
||||||
|
|
||||||
|
var img = document.createElement("img");
|
||||||
|
img.setAttribute("src", "http://static.ak.fbcdn.net/images/icons/favicon.gif");
|
||||||
|
img.setAttribute("alt", "");
|
||||||
|
img.setAttribute("style", "padding-left:5px");
|
||||||
|
|
||||||
|
commentbutton.parentNode.insertBefore(img,commentbutton.nextSibling);
|
||||||
|
img.parentNode.insertBefore(checkbox,img.nextSibling);
|
||||||
|
checkbox.parentNode.insertBefore(txt,checkbox.nextSibling);
|
||||||
|
';
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
/**
|
||||||
elseif(e_PAGE == "signup.php")
|
* if we are in the signup page add the Facebook Connect Button
|
||||||
{
|
*
|
||||||
echo '<script type="text/javascript">
|
*/
|
||||||
document.observe("dom:loaded", function() {
|
|
||||||
$("signupform").insert(
|
}
|
||||||
{"before" : "<center>OR | Login by using Facebook<br /><br /><a href=\"#\" onclick=\"FB.Connect.requireSession(); return false;\" ><img id=\"fb_login_image\" src=\"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_medium_long.gif\" alt=\"Connect\"/></a><fb:login-button size=\"medium\" background=\"light\" length=\"long\" onlogin=\"facebook_onlogin_ready();\"></fb:login-button><br /><br /></center>"})
|
elseif (e_PAGE == "signup.php")
|
||||||
|
{
|
||||||
});
|
echo '<script type="text/javascript">
|
||||||
|
document.observe("dom:loaded", function() {
|
||||||
|
$("signupform").insert(
|
||||||
|
{"before" : "<center>OR | Login by using Facebook<br /><br /><a href=\"#\" onclick=\"FB.Connect.requireSession(); return false;\" ><img id=\"fb_login_image\" src=\"http://static.ak.fbcdn.net/images/fbconnect/login-buttons/connect_light_medium_long.gif\" alt=\"Connect\"/></a><fb:login-button size=\"medium\" background=\"light\" length=\"long\" onlogin=\"facebook_onlogin_ready();\"></fb:login-button><br /><br /></center>"})
|
||||||
|
|
||||||
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@@ -1,15 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
//error_reporting(E_ALL);
|
//error_reporting(E_ALL);
|
||||||
|
|
||||||
e107::getEvent()->register('logout',array('e_facebook','fb_logout'),e_PLUGIN.'facebook/facebook_function.php');
|
|
||||||
global $fb;
|
|
||||||
|
|
||||||
$fb = e107::getSingleton('e_facebook',e_PLUGIN.'facebook/facebook_function.php');
|
|
||||||
|
|
||||||
|
|
||||||
if (USER_AREA)
|
|
||||||
|
if (e_ADMIN_AREA != TRUE)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
e107::getEvent()->register('logout',array('e_facebook','fb_logout'),e_PLUGIN.'facebook/facebook_function.php');
|
||||||
|
global $fb;
|
||||||
|
|
||||||
|
$fb = e107::getSingleton('e_facebook',e_PLUGIN.'facebook/facebook_function.php');
|
||||||
include_once (e_PLUGIN.'facebook/facebook_function.php');
|
include_once (e_PLUGIN.'facebook/facebook_function.php');
|
||||||
|
|
||||||
if (function_exists('prevent_cache_headers'))
|
if (function_exists('prevent_cache_headers'))
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/facebook/facebook_function.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/facebook/facebook_function.php,v $
|
||||||
| $Revision: 1.8 $
|
| $Revision: 1.9 $
|
||||||
| $Date: 2009-11-11 16:00:43 $
|
| $Date: 2009-11-12 09:09:37 $
|
||||||
| $Author: e107coders $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -1109,14 +1109,22 @@ class e_facebook
|
|||||||
if ($this->fb_uid)
|
if ($this->fb_uid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$html .= '<div class="welcome_msg">';
|
/* $html .= '<div class="welcome_msg">';
|
||||||
$html .= 'Welcome, '.$this->fb_getUserData('name');
|
$html .= 'Welcome, '.$this->fb_getUserData('name');
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
$html .= '<div class="user_image">';
|
$html .= '<div class="user_image">';
|
||||||
$html .= '<span class="fbimg">';
|
$html .= '<span class="fbimg">';
|
||||||
$html .= getProfilePic($this->fb_uid, true);
|
$html .= getProfilePic($this->fb_uid, true);
|
||||||
$html .= '</span>';
|
$html .= '</span>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';*/
|
||||||
|
|
||||||
|
$html .= "<table style='width:100%'>
|
||||||
|
<tr>
|
||||||
|
<td>".getProfilePic($this->fb_uid, true)."</td>
|
||||||
|
<td>Welcome ".$this->fb_getUserData('name')."</td>
|
||||||
|
</tr>
|
||||||
|
</table>";
|
||||||
|
|
||||||
|
|
||||||
//check for User Permission
|
//check for User Permission
|
||||||
|
|
||||||
@@ -1140,11 +1148,11 @@ class e_facebook
|
|||||||
$html .= '<a href="' . e_BASE . 'user.php?id . ' . USERID . '">→ Profile</a><br />';
|
$html .= '<a href="' . e_BASE . 'user.php?id . ' . USERID . '">→ Profile</a><br />';
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
$html .= '<div class="facebook_link">';
|
$html .= '<div class="facebook_link">';
|
||||||
$html .= '<a href="#" onclick="FB.Connect.logout ( function() { refresh_page() ; } ) "> Logout </a>';
|
$html .= '<a href="#" onclick="FB.Connect.logout ( function() { refresh_page() ; } ) "> Logout </a>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
*/
|
||||||
$html .= '<div class="facebook_link">';
|
$html .= '<div class="facebook_link">';
|
||||||
$html .= '<a href="'.e_PLUGIN.'facebook/facebook.php"> Invite Friends</a>';
|
$html .= '<a href="'.e_PLUGIN.'facebook/facebook.php"> Invite Friends</a>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
@@ -1368,31 +1376,54 @@ class e_facebook
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render all Facebook User Friends
|
* Render Facebook User Friends who use this website.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
//TODO move to shortcode, and just put shortcode inside the fb_friends Menu.
|
||||||
|
// parms for =online and =offline
|
||||||
function Render_Facebook_Friends_Table()
|
function Render_Facebook_Friends_Table()
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$fb_friends = facebook_client()->api_client->friends_get();
|
$fb_friends = facebook_client()->api_client->friends_get();
|
||||||
$fb_this_site = array();
|
$fb_this_site_online = array();
|
||||||
|
$fb_this_site_offline = array();
|
||||||
|
|
||||||
//TODO Cache
|
//TODO Cache
|
||||||
if($sql->db_Select('facebook','facebook_uid'))
|
if($sql->db_Select('facebook','facebook_connected,facebook_uid'))
|
||||||
{
|
{
|
||||||
while($row = $sql->db_Fetch())
|
while($row = $sql->db_Fetch())
|
||||||
{
|
{
|
||||||
$fb_this_site[] = $row['facebook_uid'];
|
if(intval($row['facebook_connected'])==1)
|
||||||
|
{
|
||||||
|
$fb_this_site_online[] = $row['facebook_uid'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fb_this_site_offline[] = $row['facebook_uid'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$friends = array_intersect($fb_this_site,$fb_friends);
|
$friends_online = array_intersect($fb_this_site_online,$fb_friends);
|
||||||
|
$friends_offline = array_intersect($fb_this_site_offline,$fb_friends);
|
||||||
if (is_array($friends) && ! empty($friends))
|
|
||||||
|
$text = $this->renderFriendImgList($friends_online,'Online');
|
||||||
|
$text .= $this->renderFriendImgList($friends_offline,'Offline');
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function renderFriendImgList($friends,$caption='')
|
||||||
|
{
|
||||||
|
|
||||||
|
if (is_array($friends) && !empty($friends))
|
||||||
{
|
{
|
||||||
|
|
||||||
$html .= '<div>';
|
$html .= "<div>
|
||||||
|
<div class='fcaption'>".$caption."</div>";
|
||||||
|
|
||||||
foreach ($friends as $friend)
|
foreach ($friends as $friend)
|
||||||
{
|
{
|
||||||
@@ -1403,13 +1434,15 @@ class e_facebook
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '</div>';
|
$html .= "<div style='clear:both;margin-bottom:10px'><!-- --></div>
|
||||||
|
</div>";
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ if (($fb_pref['Facebook_Api-Key'] != '') && ($fb_pref['Facebook_Secret-Key'] !=
|
|||||||
|
|
||||||
$html .= $fb->Render_Connect_Invite_Friends();
|
$html .= $fb->Render_Connect_Invite_Friends();
|
||||||
|
|
||||||
$caption = 'Friends';
|
$caption = 'Friends on this site';
|
||||||
// $text = $tp->parseTemplate($html, true, $facebook_shortcodes);
|
// $text = $tp->parseTemplate($html, true, $facebook_shortcodes);
|
||||||
|
|
||||||
$ns->tablerender($caption, $html);
|
$ns->tablerender($caption, $html);
|
||||||
|
Reference in New Issue
Block a user