fortressforever/", "\"gh-repo\">", $act_link_text);
echo "
$act_link_text ".ElapsedTime($act_date)."";
echo "$act_nested_list";
echo "";
}
}
// also borrowed from webfroot.co.nz's shoutbox
// *BOB* --- Rewritten by Bob - sorry, I like this coding better! ;)
function ParseEmoticons ($text) {
$emoticons = array();
$emoticons[] = array(":EEK:", "");
$emoticons[] = array(":ROLLEYES:", "");
$emoticons[] = array(":MAD:", "");
$emoticons[] = array(":CONFUSED:", "");
$emoticons[] = array(":SIGH:", "");
$emoticons[] = array(":YES:", "");
$emoticons[] = array(":NO:", "");
$emoticons[] = array(":SLEEP:", "");
$emoticons[] = array(":UPSET:", "");
$emoticons[] = array(":SHY:", "");
$emoticons[] = array(":NONE:", "");
$emoticons[] = array(":LAUGH:", "");
$emoticons[] = array(":DEAD:", "");
$emoticons[] = array(":CRY:", "");
$emoticons[] = array(":eek:", "");
$emoticons[] = array(":rolleyes:", "");
$emoticons[] = array(":mad:", "");
$emoticons[] = array(":confused:", "");
$emoticons[] = array(":sigh:", "");
$emoticons[] = array(":yes:", "");
$emoticons[] = array(":no:", "");
$emoticons[] = array(":sleep:", "");
$emoticons[] = array(":upset:", "");
$emoticons[] = array(":shy:", "");
$emoticons[] = array(":laugh:", "");
$emoticons[] = array(":dead:", "");
$emoticons[] = array(":cry:", "");
$emoticons[] = array(":)", "");
$emoticons[] = array(":(", "");
$emoticons[] = array(";)", "");
$emoticons[] = array(":|", "");
$emoticons[] = array(":-)", "");
$emoticons[] = array(":-(", "");
$emoticons[] = array(";-)", "");
$emoticons[] = array(":-|", "");
$emoticons[] = array(":0", "");
$emoticons[] = array("B)", "");
$emoticons[] = array(":D", "");
$emoticons[] = array(":P", "");
$emoticons[] = array(":B", "");
$emoticons[] = array("B-)", "");
$emoticons[] = array(":-D", "");
$emoticons[] = array(":-P", "");
$emoticons[] = array(":O", "");
$emoticons[] = array("b)", "");
$emoticons[] = array(":d", "");
$emoticons[] = array(":p", "");
$emoticons[] = array(":b", "");
$emoticons[] = array("b-)", "");
$emoticons[] = array(":-d", "");
$emoticons[] = array(":-p", "");
$emoticons[] = array(":-b", "");
$emoticons[] = array(":o", "");
$emoticons[] = array("o_O", "");
$emoticons[] = array("O_o", "");
$emoticons[] = array("o_o", "");
$emoticons[] = array("O_O", "");
foreach ($emoticons as $emoticon) {
$text = str_replace($emoticon[0],$emoticon[1],$text);
}
return $text;
}
function ParseBBCode($text){
$text = str_ireplace('<', '<', $text);
$text = str_ireplace('>', '>', $text);
$text = mb_eregi_replace("\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]","\\2",$text);
$text = mb_eregi_replace("\\[size=([^\\[]*)\\]([^\\[]*)\\[/size\\]","\\2",$text);
$text = mb_eregi_replace("\\[font=([^\\[]*)\\]([^\\[]*)\\[/font\\]","\\2",$text);
$text = mb_eregi_replace("\\[img]([^\\[]*)\\[/img\\]","",$text);
$text = mb_eregi_replace("\\[imgb]([^\\[]*)\\[/imgb\\]","",$text);
$text = mb_eregi_replace("\\[align=([^\\[]*)\\]([^\\[]*)\\[/align\\]","\\2
",$text);
$text = str_ireplace("[center]", "", $text);
$text = str_ireplace("[/center]", "", $text);
$text = str_ireplace("[left]", "", $text); // replace these with floats
$text = str_ireplace("[/left]", "
", $text);
$text = str_ireplace("[right]", "", $text);
$text = str_ireplace("[/right]", "
", $text);
$text = str_ireplace("[hr]", "
", $text);
$text = str_ireplace("[sub]", "", $text);
$text = str_ireplace("[/sub]", "", $text);
$text = str_ireplace("[sup]", "", $text);
$text = str_ireplace("[/sup]", "", $text);
$text = str_ireplace("[s]", "", $text);
$text = str_ireplace("[/s]", "", $text);
$text = str_ireplace("[b]", "", $text);
$text = str_ireplace("[/b]", "", $text);
$text = str_ireplace("[i]", "", $text);
$text = str_ireplace("[/i]", "", $text);
$text = str_ireplace("[u]", "", $text);
$text = str_ireplace("[/u]", "", $text);
$text = str_ireplace("[*]", "", $text);
$text = str_ireplace("[olist]", "", $text);
$text = str_ireplace("[/olist]", "
", $text);
$text = str_ireplace("[list]", "", $text);
$text = str_ireplace("[/list]", "
", $text);
//$text = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]", "\\1",$text);
//$text = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "\\2",$text);
$text = str_ireplace("[code]","",$text);
$text = str_ireplace("[/code]","
",$text);
$text = mb_eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "\\1",$text);
$text = mb_eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","\\1",$text);
$text = mb_eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","\\2",$text);
$text = mb_eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1\\2://\\3\\4\\5", $text);
$text = mb_eregi_replace("\\[youtube]([^\\[]*)\\[/youtube\\]","",$text);
$text = mb_eregi_replace("\\[vimeo]([^\\[]*)\\[/vimeo\\]","
vimeo.com/\\1",$text);
$text = mb_eregi_replace("\\[vimeohd]([^\\[]*)\\[/vimeohd\\]","
vimeo.com/\\1",$text);
$text = mb_eregi_replace("\\[gamevee]([^\\[]*)\\[/gamevee\\]","",$text);
$text = mb_eregi_replace("\\[gameveehd]([^\\[]*)\\[/gameveehd\\]","",$text);
$text = mb_eregi_replace("\\[veoh]([^\\[]*)\\[/veoh\\]","",$text);
$text = mb_eregi_replace("\\[veohhd]([^\\[]*)\\[/veohhd\\]","",$text);
$text = mb_eregi_replace("\\[digg]([^\\[]*)\\[/digg\\]","",$text);
$text = ParseBBCode_Quotes($text);
return $text;
}
function ParseBBCode_Quotes( $text )
{
$tablo=explode("[quote",$text);
$text="";
$text.=$tablo[0];
foreach($tablo as $cle=>$valeur)
{
$tablo1=explode("[/quote]",$valeur);
if(isset($tablo1[1]))
{
foreach($tablo1 as $cle1=>$valeur1)
{
if($cle1==0)
{
$postedby = "";
if ($valeur1[0] == "=")
{
$user = substr($valeur1, 1, strpos($valeur1, "]")-1);
$postedby = "Originally posted by $user";
$valeur1 = substr($valeur1, strpos($valeur1, "]")+1);
}
elseif ($valeur1[0] == "]")
{
$valeur1 = substr($valeur1, 1);
}
$valeur1="$postedby".$valeur1."
";
}
$text.=$valeur1;
}
}
}
return $text;
}
function ElapsedTime($timestamp, $precision = 1) {
if (!$timestamp) { return 'just now'; }
if (ctype_digit($timestamp)) { $time = (int)$timestamp; }
elseif (is_string($timestamp)) { $time = strtotime($timestamp); }
$time = time() - $time;
if ($time <= 0) return 'just now';
$a = array('decade' => 315576000, 'year' => 31557600, 'month' => 2629800, 'week' => 604800, 'day' => 86400, 'hour' => 3600, 'min' => 60, 'sec' => 1);
$i = 0;
foreach($a as $k => $v) {
$$k = floor($time/$v);
if ($$k) $i++;
$time = $i >= $precision ? 0 : $time - $$k * $v;
$s = $$k > 1 ? 's' : '';
$$k = $$k ? $$k.' '.$k.$s.($time ? ',' : '').' ' : '';
@$result .= $$k;
}
return $result ? $result.'ago' : 'just now';
}