mirror of
https://github.com/e107inc/e107.git
synced 2025-01-29 18:47:54 +01:00
Some cleanup
This commit is contained in:
parent
d5ff425a49
commit
4a87276f12
@ -1,85 +1,90 @@
|
||||
<?php
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* we need a full wide page, no sidebar,
|
||||
* where place the Facebook Invite Friends Flash Object,
|
||||
* 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
|
||||
* where place the Facebook Invite Friends Flash Object,
|
||||
* this Object can't be styled so... put it in CUSTOMPAGES
|
||||
*
|
||||
*/
|
||||
* but we can use a popup page instead ?
|
||||
*/
|
||||
|
||||
if( ( ( e_PAGE == "comment.php") || ( eregi( 'extend' , e_QUERY ) ) ) && (is_fb()))
|
||||
if (USER_AREA == TRUE)
|
||||
{
|
||||
|
||||
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
//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');
|
||||
|
||||
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() {
|
||||
|
||||
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>';
|
||||
|
||||
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");
|
||||
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);
|
||||
';
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* if we are in the signup page add the Facebook Connect Button
|
||||
*
|
||||
*/
|
||||
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");
|
||||
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")
|
||||
{
|
||||
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>"})
|
||||
|
||||
});
|
||||
/**
|
||||
* if we are in the signup page add the Facebook Connect Button
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
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>';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -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();
|
||||
$sql = e107::getDb();
|
||||
$fb_friends = facebook_client()->api_client->friends_get();
|
||||
$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='')
|
||||
{
|
||||
|
||||
if (is_array($friends) && !empty($friends))
|
||||
{
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= "<div>
|
||||
<div class='fcaption'>".$caption."</div>";
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user