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,5 +1,8 @@
|
||||
<?php
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* we need a full wide page, no sidebar,
|
||||
@@ -8,25 +11,26 @@ if (!defined('e107_INIT')) { exit; }
|
||||
*
|
||||
* 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');
|
||||
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" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>';
|
||||
include_once (e_PLUGIN.'facebook/facebook_function.php');
|
||||
|
||||
echo '<link rel="stylesheet" href="'.e_PLUGIN.'facebook/facebook.css" type="text/css" />';
|
||||
//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 ) ) ) && (is_fb()))
|
||||
{
|
||||
|
||||
|
||||
if (((e_PAGE == "comment.php") || (eregi('extend', e_QUERY))) && ($fb->fb_uid))
|
||||
{
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
document.observe("dom:loaded", function() {
|
||||
@@ -70,9 +74,9 @@ if( ( ( e_PAGE == "comment.php") || ( eregi( 'extend' , e_QUERY ) ) ) && (is_fb(
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
elseif(e_PAGE == "signup.php")
|
||||
{
|
||||
}
|
||||
elseif (e_PAGE == "signup.php")
|
||||
{
|
||||
echo '<script type="text/javascript">
|
||||
document.observe("dom:loaded", function() {
|
||||
$("signupform").insert(
|
||||
@@ -80,6 +84,7 @@ elseif(e_PAGE == "signup.php")
|
||||
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
//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');
|
||||
|
||||
if (function_exists('prevent_cache_headers'))
|
||||
|
@@ -10,8 +10,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/facebook/facebook_function.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2009-11-11 16:00:43 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2009-11-12 09:09:37 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -1109,14 +1109,22 @@ class e_facebook
|
||||
if ($this->fb_uid)
|
||||
{
|
||||
|
||||
$html .= '<div class="welcome_msg">';
|
||||
/* $html .= '<div class="welcome_msg">';
|
||||
$html .= 'Welcome, '.$this->fb_getUserData('name');
|
||||
$html .= '</div>';
|
||||
$html .= '<div class="user_image">';
|
||||
$html .= '<span class="fbimg">';
|
||||
$html .= getProfilePic($this->fb_uid, true);
|
||||
$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
|
||||
|
||||
@@ -1140,11 +1148,11 @@ class e_facebook
|
||||
$html .= '<a href="' . e_BASE . 'user.php?id . ' . USERID . '">→ Profile</a><br />';
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
$html .= '<div class="facebook_link">';
|
||||
$html .= '<a href="#" onclick="FB.Connect.logout ( function() { refresh_page() ; } ) "> Logout </a>';
|
||||
$html .= '</div>';
|
||||
|
||||
*/
|
||||
$html .= '<div class="facebook_link">';
|
||||
$html .= '<a href="'.e_PLUGIN.'facebook/facebook.php"> Invite Friends</a>';
|
||||
$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()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$fb_friends = facebook_client()->api_client->friends_get();
|
||||
$fb_this_site = array();
|
||||
$fb_this_site_online = array();
|
||||
$fb_this_site_offline = array();
|
||||
|
||||
//TODO Cache
|
||||
if($sql->db_Select('facebook','facebook_uid'))
|
||||
if($sql->db_Select('facebook','facebook_connected,facebook_uid'))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (is_array($friends) && ! empty($friends))
|
||||
}
|
||||
|
||||
$friends_online = array_intersect($fb_this_site_online,$fb_friends);
|
||||
$friends_offline = array_intersect($fb_this_site_offline,$fb_friends);
|
||||
|
||||
$text = $this->renderFriendImgList($friends_online,'Online');
|
||||
$text .= $this->renderFriendImgList($friends_offline,'Offline');
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function renderFriendImgList($friends,$caption='')
|
||||
{
|
||||
|
||||
$html .= '<div>';
|
||||
if (is_array($friends) && !empty($friends))
|
||||
{
|
||||
|
||||
$html .= "<div>
|
||||
<div class='fcaption'>".$caption."</div>";
|
||||
|
||||
foreach ($friends as $friend)
|
||||
{
|
||||
@@ -1403,7 +1434,9 @@ class e_facebook
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
$html .= "<div style='clear:both;margin-bottom:10px'><!-- --></div>
|
||||
</div>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
else
|
||||
|
@@ -56,7 +56,7 @@ if (($fb_pref['Facebook_Api-Key'] != '') && ($fb_pref['Facebook_Secret-Key'] !=
|
||||
|
||||
$html .= $fb->Render_Connect_Invite_Friends();
|
||||
|
||||
$caption = 'Friends';
|
||||
$caption = 'Friends on this site';
|
||||
// $text = $tp->parseTemplate($html, true, $facebook_shortcodes);
|
||||
|
||||
$ns->tablerender($caption, $html);
|
||||
|
Reference in New Issue
Block a user