View file share.php

File size: 1.71Kb
<?php
// define correct link
function selfURL()
{ $s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }

// store this for backup if selfURL dont work
//$l = $_SERVER['QUERY_STRING'];

function twitter()
{
$l = selfURL();
$social = "<a href=\"http://twitter.com/home?status=$l\"/><img src=\"$url/images/twitter.png\" align =\"middle\" border =\"0\" width =\"20\" height =\"20\" alt =\"twitter\" /></a>";
return $social;
}

function facebook()
{
$l = selfURL();

$social = "<a href=\"http://www.facebook.com/share.php?u=$l\"/><img src=\"$url/images/facebook.png\" align =\"middle\" border =\"0\" width =\"20\" height =\"20\" alt =\"facebook\" /></a>";
return $social;
}
// how to call facebook on your page?
// place echo facebook(); below your post in forum,site index,forum zone,chat,etc...

function digg()
{
$l = selfURL();
$t = "File Link";

$social = "<a href=\"http://digg.com/submit?phase=2&url=$l/&title=$t\"/><img src=\"$url/images/digg.png\" align =\"middle\" border =\"0\" width =\"20\" height =\"20\" alt =\"digg\" /></a>";
return $social;
}

function delicious()
{
$l = selfURL();
$social = "<a href=\"http://del.icio.us/save?url=$l\"/><img src=\"$url/images/delicious.png\" align =\"middle\" border =\"0\" width =\"20\" height =\"20\" alt =\"delicious\" /></a>";
return $social;
}

include_once('includes/lang.php');
echo $lang["share-on"].': ';
echo digg();
echo facebook();
echo twitter();
echo delicious();
 ?>