english 
Thread Options  Search this Thread  
Post: #1
21-12-2006 19:23 PM
stan


Joined: 17-11-2006
Posts: 245
Country: Isla de Muerte
Male stan is Offline now
Redirecting
Hi,

i hv made changes in global.php to so tht all my links open in new window and get redirected.All the links in shoutbox and others open in new window but the forum link doesnt open in new window.How to mk links in forum to open in new window.

THANKS.

Post: #2
21-12-2006 20:34 PM
lasha12345


Joined: 14-11-2006
Posts: 89
Country: Burkina Faso
Male lasha12345 is Offline now
Redirecting
target=blank

Post: #3
21-12-2006 20:43 PM
stan


Joined: 17-11-2006
Posts: 245
Country: Isla de Muerte
Male stan is Offline now
Redirecting
Originally Posted by lasha12345

target=blank

yes i know tht lasha, but i guess i m putting it on wrong place.

Post: #4
21-12-2006 20:46 PM
xam
Team Leader


Joined: 01-02-2006
Posts: 11,515
Country: Belgium
Awards:  
Male xam is Offline now
Redirecting
post your globalfunctions.php

Post: #5
22-12-2006 07:38 AM
stan


Joined: 17-11-2006
Posts: 245
Country: Isla de Muerte
Male stan is Offline now
Redirecting
Originally Posted by xam

post your globalfunctions.php

here is my globalfunction.php
CODE:
<?php
# IMPORTANT: Do not edit below unless you know what you are doing!
if(!defined('IN_TRACKER'))
  die('Hacking attempt!');

function display_date_time($timestamp = 0)
{
if ($timestamp)
   return date("Y-m-d H:i:s", $timestamp);
else
   return gmdate("Y-m-d H:i:s");
}

function get_user_timezone($id = '') {	

if(!isset($id) || empty($id) || !is_valid_id($id))
	return "0"; //Default timezone
	
$query = mysql_query("SELECT * FROM users WHERE id=".sqlesc($id)." LIMIT 1");
if (mysql_num_rows($query) != "0")
	{
		$kasutaja = mysql_fetch_array($query);
		return "$kasutaja[tzoffset]";
	}else
		return "0"; //Default timezone
}

function get_row_count($table, $suffix = "")
{
  if ($suffix)
    $suffix = " $suffix";
  ($r = mysql_query("SELECT COUNT(*) FROM $table$suffix")) or die(mysql_error());
  ($a = mysql_fetch_row($r)) or die(mysql_error());
  return $a[0];
}
function stdmsg($heading, $text, $htmlstrip = TRUE)
{
    if ($htmlstrip) {
        $heading = htmlspecialchars(trim($heading));
        $text = htmlspecialchars(trim($text));
    }
    print("<table class=main width=737 border=0 cellpadding=0 cellspacing=0><tr><td class=embedded>\n");
        if ($heading)
            print("<h2>$heading</h2>\n");
    print("<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>\n");
    print($text . "</td></tr></table></td></tr></table>\n");
}

function stderr($heading, $text, $htmlstrip = TRUE, $head = true, $foot = true, $die = true)
{
	if ($head) stdhead();
	
	stdmsg($heading, $text, $htmlstrip);
	
	if ($foot) stdfoot();
	
	if ($die) die;
}

function sqlerr($file = '', $line = '')
{
  print("<table border=0 bgcolor=blue align=left cellspacing=0 cellpadding=10 style='background: blue'>" .
    "<tr><td class=embedded><font color=white><h1>SQL Error</h1>\n" .
  "<b>" . mysql_error() . ($file != '' && $line != '' ? "<p>in $file, line $line</p>" : "") . "</b></font></td></tr></table>");
  die;
}

// Returns the current time in GMT in MySQL compatible format.
function get_date_time($timestamp = 0)
{
	global $_COOKIE,$_SESSION;
if ($timestamp)
	return date("Y-m-d H:i:s", $timestamp);
else {
   $idcookie = base64($_COOKIE["c_secure_uid"],false);
   if (!$idcookie)
   	$idcookie = base64($_SESSION["s_secure_uid"],false);
   return gmdate("Y-m-d H:i:s", time() + (60 * get_user_timezone($idcookie)));
	}
}

function encodehtml($s, $linebreaks = true)
{
  $s = str_replace("<", "<", str_replace("&", "&", $s));
  if ($linebreaks)
    $s = nl2br($s);
  return $s;
}

function get_dt_num()
{
  return gmdate("YmdHis");
}

function format_urls($s)
{
	return preg_replace(
    	"/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^()<>\s]+)/i",
	    "\1<a target=_blank href=redir.php?url=\2>\2</a>", $s);
}

/*

// Removed this fn, I've decided we should drop the redir script...
// it's pretty useless since ppl can still link to pics...
// -Rb

function format_local_urls($s)
{
	return preg_replace(
    "/(<a href=redir\.php\?url=)((http|ftp|https|ftps|irc):\/\/(www\.)?sitename\.(net|org|com)(:8[0-3])?([^<>\s]*))>([^<]+)<\/a>/i",
    "<a href=\2>\8</a>", $s);
}
*/

//Finds last occurrence of needle in haystack
//in PHP5 use strripos() instead of this
function _strlastpos ($haystack, $needle, $offset = 0)
{
	$addLen = strlen ($needle);
	$endPos = $offset - $addLen;
	while (true)
	{
		if (($newPos = strpos ($haystack, $needle, $endPos + $addLen)) === false) break;
		$endPos = $newPos;
	}
	return ($endPos >= 0) ? $endPos : false;
}

function format_quotes($s)
{
	preg_match_all('/\[quote.*?\]/', $s, $result, PREG_PATTERN_ORDER);
$openquotecount = count($openquote = $result[0]);
   preg_match_all('/\[\/quote\]/', $s, $result, PREG_PATTERN_ORDER);
$closequotecount = count($closequote = $result[0]);

   if ($openquotecount != $closequotecount) return $s; // quote mismatch. Return raw string...

   // Get position of opening quotes
$openval = array();
   $pos = -1;

   foreach($openquote as $val)
 $openval[] = $pos = strpos($s,$val,$pos+1);

   // Get position of closing quotes
   $closeval = array();
   $pos = -1;

   foreach($closequote as $val)
    $closeval[] = $pos = strpos($s,$val,$pos+1);


   for ($i=0; $i < count($openval); $i++)
 if ($openval[$i] > $closeval[$i]) return $s; // Cannot close before opening. Return raw string...


	$s = str_replace("[quote]","<fieldset><legend> Quote </legend><br>",$s);
   $s = preg_replace("/\[quote=(.+?)\]/", "<fieldset><legend> Quote: \1 </legend><br>", $s);
   $s = str_replace("[/quote]","</fieldset><br>",$s);
   return $s;
}

function format_comment($text, $strip_html = true, $xssclean = false)
{
	global $smilies, $privatesmilies, $CURUSER;

	$s = $text;

  // This fixes the extraneous ;) smilies problem. When there was an html escaped
  // char before a closing bracket - like >), "), ... - this would be encoded
  // to &xxx;), hence all the extra smilies. I created a new :wink: label, removed
  // the ;) one, and replace all genuine ;) by :wink: before escaping the body.
  // (What took us so long? :blush:)- wyz

	$s = str_replace(";)", ":wink:", $s);

	if ($strip_html)
		$s = htmlspecialchars($s);

	if ($xssclean)
	$s = xss_clean($s);
	
	// [*]
	$s = preg_replace("/\[\*\]/", "<img src=\"".$GLOBALS['pic_base_url']."/list.gif\" class=\"listitem\" />", $s);

	// [b]Bold[/b]
	$s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\1</b>", $s);

	// [i]Italic[/i]
	$s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\1</i>", $s);

	// [u]Underline[/u]
	$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\1</u>", $s);

	// [u]Underline[/u]
	$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/i", "<u>\1</u>", $s);

//---------------------------------
//---- Image Resizer v0.1 by xam
//---------------------------------

	// [img]http://www/image.gif[/img]
	$s = preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "<img border=\"0\" src=\"\1\" alt=\"\" o<strong></strong>nload=\"NcodeImageResizer.createOn(this);\">", $s);

	// [img=http://www/image.gif]
	$s = preg_replace("/\[img=(http:\/\/[^\s'\"<>]+(\.(gif|jpg|png)))\]/i", "<img border=\"0\" src=\"\1\" alt=\"\"  o<strong></strong>nload=\"NcodeImageResizer.createOn(this);\">", $s);

//---------------------------------
//---- Image Resizer v0.1 by xam
//---------------------------------

	// [color=blue]Text[/color]
	$s = preg_replace(
		"/\[color=([a-zA-Z]+)\]((\s|.)+?)\[\/color\]/i",
		"<font color=\1>\2</font>", $s);

	// [color=#ffcc99]Text[/color]
	$s = preg_replace(
		"/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/i",
		"<font color=\1>\2</font>", $s);

	// [url=http://www.example.com]Text[/url]
	$s = preg_replace(
		"/\[url=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
		"<a href=\"\1\">\2</a>", $s);

	// [url]http://www.example.com[/url]
	$s = preg_replace(
		"/\[url\]([^()<>\s]+?)\[\/url\]/i",
		"<a href=\"\1\">\1</a>", $s);
		
	// [code]php code

$s = preg_replace(
"/\[code\]\s*((\s|.)+?)\s*\[\/code\]\s*/i",
"CODE\\1", $s);

// Text
$s = preg_replace(
"/\[size=([1-7])\]((\s|.)+?)\[\/size\]/i",
"\\2", $s);

// Text
$s = preg_replace(
"/\[font=([a-zA-Z ,]+)\]((\s|.)+?)\[\/font\]/i",
"\\2", $s);

// //
Text
// $s = preg_replace(
// "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
// "Quote:\\1", $s);

// //
Originally Posted by Author
Text
// $s = preg_replace(
// "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
// "\\1 wrote:\\2", $s);

// Quotes
$s = format_quotes($s);

// URLs
$s = format_urls($s);
// $s = format_local_urls($s);

// Linebreaks
$s = nl2br($s);

//
Preformatted

$s = preg_replace("/\[pre\](.*?)\[\/pre\]/is", "".htmlentities('\\1'."", $s);

//
NFO-preformatted

$s = preg_replace("/\[nfo\]((\s|.)+?)\[\/nfo\]/i", "\\1", $s);

// Guest
$s = str_replace ("Guest", "$CURUSER[username]", $s);

// Maintain spacing
$s = str_replace(" ", "  ", $s);

reset($smilies);
while (list($code, $url) = each($smilies))
$s = str_replace($code, "", $s);

reset($privatesmilies);
while (list($code, $url) = each($privatesmilies))
$s = str_replace($code, "", $s);

return $s;
}

//---------------------------------
//---- Search Highlight v0.1 by xam
//---------------------------------

function highlight($search,$subject,$hlstart="",$hlend=""
) {

$srchlen=strlen($search); // lenght of searched string
if ($srchlen==0) return $subject;
$find = $subject;
while ($find = stristr($find,$search)) { // find $search text in $subject -case insensitiv
$srchtxt = substr($find,0,$srchlen); // get new search text
$find=substr($find,$srchlen);
$subject = str_replace($srchtxt,"$hlstart$srchtxt$hlend",$subject); // highlight founded case insensitive search text
}
return $subject;
}

//---------------------------------
//---- Search Highlight v0.1 by xam
//---------------------------------

function get_user_class()
{
global $CURUSER;
return $CURUSER["class"];
}

function get_user_class_name($class)
{
switch ($class)
{
case UC_USER: return "User";

case UC_POWER_USER: return "Power User";

case UC_VIP: return "VIP";

case UC_UPLOADER: return "Uploader";

case UC_MODERATOR: return "Moderator";

case UC_ADMINISTRATOR: return "Administrator";

case UC_SYSOP: return "SysOp";

case UC_STAFFLEADER: return "Staff Leader";

}
return "";
}

function is_valid_user_class($class)
{
return is_numeric($class) && floor($class) == $class && $class >= UC_USER && $class 0) && (floor($id) == $id);
}

//-------- Begins a main frame

function begin_main_frame()
{
print("" .
"\n";
}

//-------- Ends a main frame

function end_main_frame()
{
print("\n";
}

function begin_frame($caption = "", $center = false, $padding = 10)
{
$tdextra = "";

if ($caption)
print("$caption\n";

if ($center)
$tdextra .= " align=center";

print("\n";

}

function attach_frame($padding = 10)
{
print("\n";
}

function end_frame()
{
print("\n";
}

function begin_table($fullwidth = false, $padding = 5)
{
$width = "";

if ($fullwidth)
$width .= " width=100%";
print("\n";
}

function end_table()
{
print("\n";
}

//-------- Inserts a smilies frame
// (move to globals)

function insert_smilies_frame()
{
global $smilies, $BASEURL;

begin_frame("Smilies", true);

begin_table(false, 5);

print("Type...To make a...\n";

while (list($code, $url) = each($smilies))
print("$code\n";

end_table();

end_frame();
}

function sql_timestamp_to_unix_timestamp($s)
{
return mktime(substr($s, 11, 2), substr($s, 14, 2), substr($s, 17, 2), substr($s, 5, 2), substr($s, 8, 2), substr($s, 0, 4));
}

function get_ratio_color($ratio)
{
if ($ratio < 0.1) return "#ff0000";
if ($ratio < 0.2) return "#ee0000";
if ($ratio < 0.3) return "#dd0000";
if ($ratio < 0.4) return "#cc0000";
if ($ratio < 0.5) return "#bb0000";
if ($ratio < 0.6) return "#aa0000";
if ($ratio < 0.7) return "#990000";
if ($ratio < 0.8) return "#880000";
if ($ratio < 0.9) return "#770000";
if ($ratio < 1) return "#660000";
return "#000000";
}

function get_slr_color($ratio)
{
if ($ratio < 0.025) return "#ff0000";
if ($ratio < 0.05) return "#ee0000";
if ($ratio < 0.075) return "#dd0000";
if ($ratio < 0.1) return "#cc0000";
if ($ratio < 0.125) return "#bb0000";
if ($ratio < 0.15) return "#aa0000";
if ($ratio < 0.175) return "#990000";
if ($ratio < 0.2) return "#880000";
if ($ratio < 0.225) return "#770000";
if ($ratio < 0.25) return "#660000";
if ($ratio < 0.275) return "#550000";
if ($ratio < 0.3) return "#440000";
if ($ratio < 0.325) return "#330000";
if ($ratio < 0.35) return "#220000";
if ($ratio < 0.375) return "#110000";
return "#000000";
}

function write_log($text)
{
$text = sqlesc($text);
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO sitelog (added, txt) VALUES($added, $text)" or sqlerr(__FILE__, __LINE__);
}

function get_elapsed_time($ts)
{
$mins = floor((gmtime() - $ts) / 60);
$hours = floor($mins / 60);
$mins -= $hours * 60;
$days = floor($hours / 24);
$hours -= $days * 24;
$weeks = floor($days / 7);
$days -= $weeks * 7;
$t = "";
if ($weeks > 0)
return "$weeks week" . ($weeks > 1 ? "s" : "";
if ($days > 0)
return "$days day" . ($days > 1 ? "s" : "";
if ($hours > 0)
return "$hours hour" . ($hours > 1 ? "s" : "";
if ($mins > 0)
return "$mins min" . ($mins > 1 ? "s" : "";
return "< 1 min";
}

function textbbcode($form,$text,$content="",$message=false) {
global $subject;
?>

var b_open = 0;
var i_open = 0;
var u_open = 0;
var color_open = 0;
var list_open = 0;
var quote_open = 0;
var html_open = 0;

var myAgent = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);

var is_ie = ((myAgent.indexOf("msie" != -1) && (myAgent.indexOf("opera" == -1));
var is_nav = ((myAgent.indexOf('mozilla'!=-1) && (myAgent.indexOf('spoofer'==-1)
&& (myAgent.indexOf('compatible' == -1) && (myAgent.indexOf('opera'==-1)
&& (myAgent.indexOf('webtv' ==-1) && (myAgent.indexOf('hotjava'==-1));

var is_win = ((myAgent.indexOf("win"!=-1) || (myAgent.indexOf("16bit"!=-1));
var is_mac = (myAgent.indexOf("mac"!=-1);
var bbtags = new Array();
function cstat() {
var c = stacksize(bbtags);
if ( (c < 1) || (c == null) ) {c = 0;}
if ( ! bbtags[0] ) {c = 0;}
document..tagcount.value = "Close last, Open tags "+c;
}
function stacksize(thearray) {
for (i = 0; i < thearray.length; i++ ) {
if ( (thearray[i] == "" || (thearray[i] == null) || (thearray == 'undefined' ) {return i;}
}
return thearray.length;
}
function pushstack(thearray, newval) {
arraysize = stacksize(thearray);
thearray[arraysize] = newval;
}
function popstackd(thearray) {
arraysize = stacksize(thearray);
theval = thearray[arraysize - 1];
return theval;
}
function popstack(thearray) {
arraysize = stacksize(thearray);
theval = thearray[arraysize - 1];
delete thearray[arraysize - 1];
return theval;
}
function closeall() {
if (bbtags[0]) {
while (bbtags[0]) {
tagRemove = popstack(bbtags)
if ( (tagRemove != 'color' ) {
doInsert("[/"+tagRemove+"]", "", false);
eval("document.." + tagRemove + ".value = ' " + tagRemove + " '";
eval(tagRemove + "_open = 0";
} else {
doInsert("[/"+tagRemove+"]", "", false);
}
cstat();
return;
}
}
document..tagcount.value = "Close last, Open tags 0";
bbtags = new Array();
document...focus();
}
function add_code(NewCode) {
document...value += NewCode;
document...focus();
}
function alterfont(theval, thetag) {
if (theval == 0) return;
if(doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true)) pushstack(bbtags, thetag);
document..color.selectedIndex = 0;
cstat();
}
function tag_url() {
var FoundErrors = '';
var enterURL = prompt("You must enter a URL", "http://";
var enterTITLE = prompt("You must enter a title", "";
if (!enterURL || enterURL=="" {FoundErrors += " " + "You must enter a URL,";}
if (!enterTITLE) {FoundErrors += " " + "You must enter a title";}
if (FoundErrors) {alert("Error!"+FoundErrors);return;}
doInsert("[url="+enterURL+"]"+enterTITLE+"[/url]", "", false);
}
function tag_list() {
var FoundErrors = '';
var enterTITLE = prompt("Enter item of the list. For end of the list, press 'cancel' or leave the next field empty ", "";
if (!enterTITLE) {FoundErrors += " " + "Enter item of the list. For end of the list, press 'cancel' or leave the next field empty";}
if (FoundErrors) {alert("Error!"+FoundErrors);return;}
doInsert("[*]"+enterTITLE+"", "", false);

}
function tag_image() {
var FoundErrors = '';
var enterURL = prompt("You must enter a full image URL", "http://";
if (!enterURL || enterURL=="http://" {
alert("Error!"+"You must enter a full image URL";
return;
}
doInsert("[img]"+enterURL+"[/img]", "", false);
}
function tag_email() {
var emailAddress = prompt("You must enter a E-mail", "";
if (!emailAddress) {
alert("Error!"+"You must enter a E-mail";
return;
}
doInsert(""+emailAddress+"", "", false);
}
function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = document..;
if ( (myVersion >= 4) && is_ie && is_win) {
if(obj_ta.isTextEdit){
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None" && rng != null){
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle) isClose = true;
rng.text = ibTag;
}
}
else{
if(isSingle) isClose = true;
obj_ta.value += ibTag;
}
} else {
if(isSingle) isClose = true;
obj_ta.value += ibTag;
}
obj_ta.focus();
// obj_ta.value = obj_ta.value.replace(/ /, " ";
return isClose;
}
function em(theSmilie)
{
doInsert(" " + theSmilie + " ", "", false);
}

function winop()
{
windop = window.open("moresmiles.php?form=&text=","mywin","height=500,width=450,resizable=no,scrollbars=yes";
}

function simpletag(thetag)
{
var tagOpen = eval(thetag + "_open";
if (tagOpen == 0) {
if(doInsert("[" + thetag + "]", "[/" + thetag + "]", true))
{
eval(thetag + "_open = 1";
eval("document.." + thetag + ".value += '*'";
pushstack(bbtags, thetag);
cstat();
}
}
else {
lastindex = 0;
for (i = 0; i < bbtags.length; i++ ) {
if ( bbtags[i] == thetag ) {
lastindex = i;
}
}

while (bbtags[lastindex]) {
tagRemove = popstack(bbtags);
doInsert("[/" + tagRemove + "]", "", false)
if ((tagRemove != 'COLOR' ){
eval("document.." + tagRemove + ".value = ' " + tagRemove + " '";
eval(tagRemove + "_open = 0";
}
}
cstat();
}
}

-------- Color --------
Black

Sienna

Dark Olive Green

Dark Green

Dark Slate Blue
Navy

Indigo

Dark Slate Gray

Dark Red

Dark Orange
Olive

Green

Teal

Blue

Slate Gray

Dim Gray
Red

Sandy Brown

Yellow Green

Sea Green

Medium Turquoise

Royal Blue

Purple
Gray

Magenta

Orange

Yellow
Lime

Cyan

Deep Sky Blue

Dark Orchid

Silver
Pink

Wheat

Lemon Chiffon

Pale Green

Pale Turquoise

Light Blue
Plum

White

-------- Font --------
Arial
Arial Black
Arial Narrow
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Fixedsys
Franklin Gothic
Medium
Garamond
Georgia
Impact
Lucida Console
Lucida Sans Unicode

Microsoft Sans Serif

Palatino Linotype
System
Tahoma
Times New Roman
Trebuchet MS
Verdana

-------- Size --------
1
2
3
4
5
6
7

Subject:  

Quick Reply
Decrease Size
Increase Size
Insert bold text Insert italic text Insert underlined text Align text to the left Align text to the centerr Align text to the right Justify text Insert quoted text Code Insert formatted PHP code Insert formatted SQL code
Colors
Insert hyperlink Insert image Insert email address
Smilies
Insert hidden text



Forum Jump: