diff --git a/functions.php b/functions.php index 72bf211..f2cc480 100644 --- a/functions.php +++ b/functions.php @@ -1,48 +1,48 @@ - +'; - switch($action) { - default: - lecho('access denied',$es_accessdenied); - break; - } - echo '
'; +global $es_accessdenied; +echo '
'; +switch($action) { +default: +lecho('access denied',$es_accessdenied); +break; +} +echo '
';
}
function flecho($orig_text,$trans_text='') {
@@ -67,29 +67,29 @@ function lecho($orig_text,$trans_text) {
}
function incviewed($newsid) {
- global $dbx, $dbxcon, $dbxcon_aut, $edge_database, $edge_database_auth;
- global $edge_id, $edge_logged;
- global $edge_incviewsunreg;
+global $dbx, $dbxcon, $dbxcon_aut, $edge_database, $edge_database_auth;
+global $edge_id, $edge_logged;
+global $edge_incviewsunreg;
- $t = time();
+$t = time();
- if ($newsid) {
- if ($edge_incviewsunreg || ($edge_id && $edge_logged)) {
- $_q = "UPDATE news SET viewed = viewed + 1 WHERE id = '$newsid'";
- dbx_query($dbx,$dbxcon,$_q,$edge_database);
- }
+if ($newsid) {
+if ($edge_incviewsunreg || ($edge_id && $edge_logged)) {
+$_q = "UPDATE news SET viewed = viewed + 1 WHERE id = '$newsid'";
+dbx_query($dbx,$dbxcon,$_q,$edge_database);
+}
- if ($edge_id && $edge_logged) {
- $_q = "SELECT lastviewed FROM people WHERE id = $edge_id";
- $_r = dbx_query($dbx,$dbxcon_aut,$_q,$edge_database_auth);
- $_row = dbx_fetch_object($dbx,$_r);
+if ($edge_id && $edge_logged) {
+$_q = "SELECT lastviewed FROM people WHERE id = $edge_id";
+$_r = dbx_query($dbx,$dbxcon_aut,$_q,$edge_database_auth);
+$_row = dbx_fetch_object($dbx,$_r);
- if ($t > $_row->lastviewed + 60*5) {
- $_q = "UPDATE people SET lastviewed = $t WHERE id = $edge_id";
- dbx_query($dbx,$dbxcon_aut,$_q,$edge_database_auth);
- }
- }
- }
+if ($t > $_row->lastviewed + 60*5) {
+$_q = "UPDATE people SET lastviewed = $t WHERE id = $edge_id";
+dbx_query($dbx,$dbxcon_aut,$_q,$edge_database_auth);
+}
+}
+}
}
/*
@@ -100,10 +100,10 @@ function dbx_check() {
*/
function myaddslashes($st) {
- if (get_magic_quotes_gpc())
- return $st;
- else
- return addslashes($st);
+if (get_magic_quotes_gpc())
+return $st;
+else
+return addslashes($st);
}
# type validity check functions written by caboom ';
- return 0;
- } else {
- echo 'fatal error: bad HTTP_REFERER ';
- return 0;
- }
- }
- }
- return 1;
+global $edge_main_url, $edge_httprefcheck;
+
+if ($edge_httprefcheck) {
+$r = $_SERVER['HTTP_REFERER'];
+if (substr($r,0,strlen($edge_main_url)) == $edge_main_url) {
+return 1;
+} else {
+if ($r=='') {
+echo 'fatal error: no HTTP_REFERER, make sure your browser sends HTTP_REFERER correctly ';
+return 0;
+} else {
+echo 'fatal error: bad HTTP_REFERER ';
+return 0;
+}
+}
+}
+return 1;
}
function codetag($txt, $typ='') {
- global $edge_codetagcolors_off;
-
- $r = '';
-
- if (strpos($txt,'[code]') === FALSE) {
- switch ($typ) {
- case 'board':
- case 'blog':
- return(buildHypertext(safeHTMLboard($txt)));
- break;
- case 'art':
- case 'artprt':
- case 'arttom':
- return(buildHypertext($txt));
- break;
- default:
- case '':
- case 'sms':
- return(buildHypertext(safeHTML($txt)));
- break;
- }
- }
-
- $e = explode('[code]',$txt);
-
- if ($edge_smileys) {do_smileys($e[0]);} # smileys hack by Carl
-
- switch ($typ) {
- case 'board':
- case 'blog':
- $r.=buildHypertext(safeHTMLboard($e[0]));
- break;
- case 'art':
- case 'artprt':
- case 'arttom':
- $r.=buildHypertext($e[0]);
- break;
- default:
- case '':
- case 'sms':
- $r.=buildHypertext(safeHTML($e[0]));
- break;
- }
-
- for ($i = 1; $i ';}
- }
+global $dbx, $dbxcon, $edge_database;
+global $edge_main_url, $es_recentcom;
+
+$q = "SELECT thread,id,dat,subj,meno FROM wb WHERE did = 'edge$id' AND thread = 0 AND hide = 0 ORDER BY dat DESC LIMIT 0,6";
+$result = dbx_query($dbx,$dbxcon,$q,$edge_database);
+$c = dbx_num_rows($dbx,$result);
+
+if ($c > 0) {
+echo " ';}
+}
}
function htmlspecialchars_mb($x) {
- global $edge_multibyte, $edge_charset;
+global $edge_multibyte, $edge_charset;
- if ($edge_multibyte)
- return(htmlspecialchars($x,ENT_COMPAT,$edge_charset));
- else
- return(htmlspecialchars($x));
+if ($edge_multibyte)
+return(htmlspecialchars($x,ENT_COMPAT,$edge_charset));
+else
+return(htmlspecialchars($x));
}
function htmlentities_mb($x) {
- global $edge_multibyte;
+global $edge_multibyte;
- if ($edge_multibyte)
- return($x); # just a quick hack, will code proper routine later
- else
- return(htmlentities($x));
+if ($edge_multibyte)
+return($x); # just a quick hack, will code proper routine later
+else
+return(htmlentities($x));
}
function show_flag($user) {
- global $dbx, $dbxcon, $dbxcon_aut, $edge_database_auth;
- global $edge_countryflags, $edge_main_url, $dir_inc, $dir_cflags;
-
- if ($edge_countryflags) {
- $q = "SELECT ccode,COUNT(*) AS c FROM people_lastlogged WHERE login = '$user' ";
- if ($r = dbx_query($dbx,$dbxcon_aut,$q,$edge_database_auth))
- $o = dbx_fetch_object($dbx,$r);
-
- if ($o->c == 0) {
- $q = "SELECT ccode FROM people WHERE login = '$user' ";
- $r = dbx_query($dbx,$dbxcon_aut,$q,$edge_database_auth);
- $o = dbx_fetch_object($dbx,$r);
- }
- $ccod=$o->ccode;
- switch ($edge_countryflags) {
- case 1:
- if ($ccod)
- if (file_exists($dir_inc.$dir_cflags.strtolower($ccod).'.gif')) {
- echo " u: $edge_tz, s: $edge_servertz, f: $formatstring, d: $dat, dx: $datx ";
- return (date($formatstring,$datx));
+return (date($formatstring,$datx));
}
function datetime_tz($dat) {
- global $edge_tz, $edge_servertz;
+global $edge_tz, $edge_servertz;
if ($dat) {
- $_e = (int)($edge_tz/100);
- $_f = abs($edge_tz/100 - $_e);
- if ($_f == 0) $_f = '';
- if ($_f == 0.5) $_f = ':30';
- if ($_f == 0.75) $_f = ':45';
- if ($_f == 0.25) $_f = ':15';
- if ($_e >= 0)
- $_e = "+$_e";
+$_e = (int)($edge_tz/100);
+$_f = abs($edge_tz/100 - $_e);
+if ($_f == 0) $_f = '';
+if ($_f == 0.5) $_f = ':30';
+if ($_f == 0.75) $_f = ':45';
+if ($_f == 0.25) $_f = ':15';
+if ($_e >= 0)
+$_e = "+$_e";
# $datx=date_tz("M d Y",$dat).' '.date_tz("H:i",$dat)." (UTC$_e$_f)";
$datx=date_tz("d M Y",$dat).' '.date_tz("H:i",$dat);
} else {
@@ -701,50 +701,50 @@ function datetime_tz($dat) {
}
function fthumb($o) {
- $o = substr($o,4);
- if (substr($o,-4)=='.jpg' || substr($o,-4)=='.png') {
- $o = substr($o,0,strlen($o)-3).'jpg';
- }
- return $o;
+$o = substr($o,4);
+if (substr($o,-4)=='.jpg' || substr($o,-4)=='.png') {
+$o = substr($o,0,strlen($o)-3).'jpg';
+}
+return $o;
}
# display a thumnbail for userpic or avatar
function thpic($nam,$clicky=0,$w=-1,$h=-1) {
- global $edge_main_url, $edge_uploaddir, $edge_uploadwww;
-
- $nam1 = substr($nam,4);
- if (substr($nam,-4)=='.jpg' || substr($nam,-4)=='.png') {
- $nam1 = substr($nam1,0,strlen($nam1)-3).'jpg';
- } else {
- $nam1 = $nam;
- }
- $_size = getimagesize($edge_uploaddir.'/'.$nam);
- if ($clicky)
- echo "";
- if ($w!=-1) {$w1=' width="'.$w.'" ';}
- if ($h!=-1) {$h1=' heigth="'.$h.'" ';}
- echo "", "$msgtxt");
- $msgtxt = str_replace(":boss", "
", "$msgtxt");
-
- $msgtxt = preg_replace("/^:\(([[:space:]]*)/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/^:-\(([[:space:]]*)/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/^:P([[:space:]]*)/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/^:p([[:space:]]*)/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/^:D([[:space:]]*)/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/^:\)([[:space:]]*)/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/^:-\)([[:space:]]*)/", "
\\1", "$msgtxt");
-
- $msgtxt = preg_replace("/([[:space:]]):\($/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):-\($/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):P$/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):p$/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):D$/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):\)$/", "
\\1", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):-\)$/", "
\\1", "$msgtxt");
-
- $msgtxt = preg_replace("/([[:space:]]):P([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):p([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):\(([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):-\(([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]);\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]);-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]])8-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]])8\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]])R-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]])R\)([[:space:]])/", "\\1
\\2", "$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):D([[:space:]])/", "\\1
\\2","$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]):-D([[:space:]])/", "\\1
\\2","$msgtxt");
- $msgtxt = preg_replace("/([[:space:]]);D([[:space:]])/", "\\1
\\2","$msgtxt");
-
- $msgtxt = str_replace(":argh", "
", "$msgtxt");
- $msgtxt = str_replace(":banghead", "
", "$msgtxt");
- $msgtxt = str_replace(":beamup", "
", "$msgtxt");
- $msgtxt = str_replace(":blowup", "
", "$msgtxt");
- $msgtxt = str_replace(":bow", "
", "$msgtxt");
- $msgtxt = str_replace(":flameon", "
", "$msgtxt");
- $msgtxt = str_replace(":flamer", "
", "$msgtxt");
- $msgtxt = str_replace(":flowers", "
", "$msgtxt");
- $msgtxt = str_replace(":hug", "
", "$msgtxt");
- $msgtxt = str_replace(":kick", "
", "$msgtxt");
- $msgtxt = str_replace(":ninja", "
", "$msgtxt");
- $msgtxt = str_replace(":onthecan", "
", "$msgtxt");
- $msgtxt = str_replace(":stick", "
", "$msgtxt");
- $msgtxt = str_replace(":rotfl", "
", "$msgtxt");
- $msgtxt = str_replace(":shakehands", "
", "$msgtxt");
- $msgtxt = str_replace(":surrender", "
", "$msgtxt");
- $msgtxt = str_replace(":thankyou", "
", "$msgtxt");
- $msgtxt = str_replace(":thewave", "
", "$msgtxt");
- $msgtxt = str_replace(":wave", "
", "$msgtxt");
- $msgtxt = str_replace(":withstupid", "
", "$msgtxt");
- $msgtxt = str_replace(":yawn", "
", "$msgtxt");
- $msgtxt = str_replace(":buzzer", "
", "$msgtxt");
- $msgtxt = str_replace(":chuckball", "
", "$msgtxt");
- $msgtxt = str_replace(":claphands", "
", "$msgtxt");
- $msgtxt = str_replace(":dj", "
", "$msgtxt");
- $msgtxt = str_replace(":dropjaw", "
", "$msgtxt");
+# this code has been crafted by Carl - carl@smmb.org ; new smileys (emoticons) added by Elf Qrin (www.ElfQrin.com)
+
+$msgtxt = str_replace(":pimp", "
", "$msgtxt");
+$msgtxt = str_replace(":boss", "
", "$msgtxt");
+
+$msgtxt = preg_replace("/^:\(([[:space:]]*)/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/^:-\(([[:space:]]*)/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/^:P([[:space:]]*)/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/^:p([[:space:]]*)/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/^:D([[:space:]]*)/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/^:\)([[:space:]]*)/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/^:-\)([[:space:]]*)/", "
\\1", "$msgtxt");
+
+$msgtxt = preg_replace("/([[:space:]]):\($/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):-\($/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):P$/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):p$/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):D$/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):\)$/", "
\\1", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):-\)$/", "
\\1", "$msgtxt");
+
+$msgtxt = preg_replace("/([[:space:]]):P([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):p([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):\(([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):-\(([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]);\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]);-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]])8-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]])8\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]])R-\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]])R\)([[:space:]])/", "\\1
\\2", "$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):D([[:space:]])/", "\\1
\\2","$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):-D([[:space:]])/", "\\1
\\2","$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]);D([[:space:]])/", "\\1
\\2","$msgtxt");
+
+$msgtxt = str_replace(":argh", "
", "$msgtxt");
+$msgtxt = str_replace(":banghead", "
", "$msgtxt");
+$msgtxt = str_replace(":beamup", "
", "$msgtxt");
+$msgtxt = str_replace(":blowup", "
", "$msgtxt");
+$msgtxt = str_replace(":bow", "
", "$msgtxt");
+$msgtxt = str_replace(":flameon", "
", "$msgtxt");
+$msgtxt = str_replace(":flamer", "
", "$msgtxt");
+$msgtxt = str_replace(":flowers", "
", "$msgtxt");
+$msgtxt = str_replace(":hug", "
", "$msgtxt");
+$msgtxt = str_replace(":kick", "
", "$msgtxt");
+$msgtxt = str_replace(":ninja", "
", "$msgtxt");
+$msgtxt = str_replace(":onthecan", "
", "$msgtxt");
+$msgtxt = str_replace(":stick", "
", "$msgtxt");
+$msgtxt = str_replace(":rotfl", "
", "$msgtxt");
+$msgtxt = str_replace(":shakehands", "
", "$msgtxt");
+$msgtxt = str_replace(":surrender", "
", "$msgtxt");
+$msgtxt = str_replace(":thankyou", "
", "$msgtxt");
+$msgtxt = str_replace(":thewave", "
", "$msgtxt");
+$msgtxt = str_replace(":wave", "
", "$msgtxt");
+$msgtxt = str_replace(":withstupid", "
", "$msgtxt");
+$msgtxt = str_replace(":yawn", "
", "$msgtxt");
+$msgtxt = str_replace(":buzzer", "
", "$msgtxt");
+$msgtxt = str_replace(":chuckball", "
", "$msgtxt");
+$msgtxt = str_replace(":claphands", "
", "$msgtxt");
+$msgtxt = str_replace(":dj", "
", "$msgtxt");
+$msgtxt = str_replace(":dropjaw", "
", "$msgtxt");
# added by Joris
- $msgtxt = str_replace(":haha", "
","$msgtxt");
- $msgtxt = str_replace(":nono", "
","$msgtxt");
- $msgtxt = str_replace(":wave", "
","$msgtxt");
- $msgtxt = str_replace("???", "
","$msgtxt");
- $msgtxt = str_replace(':-S', "
","$msgtxt");
- $msgtxt = str_replace(":tup", "
","$msgtxt");
- $msgtxt = str_replace(":tdown", "
","$msgtxt");
- $msgtxt = str_replace(":grr", "
","$msgtxt");
- $msgtxt = str_replace(':-|', "
","$msgtxt");
- $msgtxt = str_replace(':|', "
","$msgtxt");
+$msgtxt = str_replace(":haha", "
","$msgtxt");
+$msgtxt = str_replace(":nono", "
","$msgtxt");
+$msgtxt = str_replace(":wave", "
","$msgtxt");
+$msgtxt = str_replace("???", "
","$msgtxt");
+$msgtxt = str_replace(':-S', "
","$msgtxt");
+$msgtxt = str_replace(":tup", "
","$msgtxt");
+$msgtxt = str_replace(":tdown", "
","$msgtxt");
+$msgtxt = str_replace(":grr", "
","$msgtxt");
+$msgtxt = str_replace(':-|', "
","$msgtxt");
+$msgtxt = str_replace(':|', "
","$msgtxt");
# added by ElfQrin (22oct2003)
- $msgtxt = str_replace('8O', "
","$msgtxt");
- $msgtxt = str_replace('8-O', "
","$msgtxt");
- $msgtxt = str_replace(':-\\', "
","$msgtxt");
- $msgtxt = str_replace(':-/', "
","$msgtxt");
- $msgtxt = str_replace(":bounce", "
", "$msgtxt");
- $msgtxt = str_replace(":chat", "
", "$msgtxt");
- $msgtxt = str_replace(":coffeine", "
", "$msgtxt");
- $msgtxt = str_replace(":embarassed", "
", "$msgtxt");
- $msgtxt = str_replace(":evil", "
", "$msgtxt");
- $msgtxt = str_replace(":eviltwist", "
", "$msgtxt");
- $msgtxt = str_replace(":scary", "
", "$msgtxt");
- $msgtxt = str_replace(":zzz", "
", "$msgtxt");
- $msgtxt = str_replace(":shot", "
", "$msgtxt");
- $msgtxt = str_replace(":spineyes", "
", "$msgtxt");
- $msgtxt = str_replace(" S-|", "
", "$msgtxt");
+$msgtxt = str_replace('8O', "
","$msgtxt");
+$msgtxt = str_replace('8-O', "
","$msgtxt");
+$msgtxt = str_replace(':-\\', "
","$msgtxt");
+$msgtxt = str_replace(':-/', "
","$msgtxt");
+$msgtxt = str_replace(":bounce", "
", "$msgtxt");
+$msgtxt = str_replace(":chat", "
", "$msgtxt");
+$msgtxt = str_replace(":coffeine", "
", "$msgtxt");
+$msgtxt = str_replace(":embarassed", "
", "$msgtxt");
+$msgtxt = str_replace(":evil", "
", "$msgtxt");
+$msgtxt = str_replace(":eviltwist", "
", "$msgtxt");
+$msgtxt = str_replace(":scary", "
", "$msgtxt");
+$msgtxt = str_replace(":zzz", "
", "$msgtxt");
+$msgtxt = str_replace(":shot", "
", "$msgtxt");
+$msgtxt = str_replace(":spineyes", "
", "$msgtxt");
+$msgtxt = str_replace(" S-|", "
", "$msgtxt");
# added by ElfQrin (20jun2004)
- $msgtxt = str_replace(':cop', "
","$msgtxt");
- $msgtxt = str_replace(':king', "
","$msgtxt");
- $msgtxt = str_replace(':read', "
","$msgtxt");
- $msgtxt = str_replace(':type', "
","$msgtxt");
+$msgtxt = str_replace(':cop', "
","$msgtxt");
+$msgtxt = str_replace(':king', "
","$msgtxt");
+$msgtxt = str_replace(':read', "
","$msgtxt");
+$msgtxt = str_replace(':type', "
","$msgtxt");
# added by ElfQrin (01mar2008)
- $msgtxt = preg_replace("/([[:space:]]):s([[:space:]])/", "\\1
\\2","$msgtxt");
- $msgtxt = str_replace(':bloo', "
","$msgtxt");
+$msgtxt = preg_replace("/([[:space:]]):s([[:space:]])/", "\\1
\\2","$msgtxt");
+$msgtxt = str_replace(':bloo', "
","$msgtxt");
- return($msgtxt);
+return($msgtxt);
}
function safeXSS(&$text) {
- $text = strip_tags($text, '
');
+$text = strip_tags($text, '
');
}
function safeHTML($text,$smiles=TRUE) {
- global $edge_smileys;
- $text = strip_tags($text, '');
- if ($edge_smileys && $smiles) $text = do_smileys($text);
- return $text;
+global $edge_smileys;
+$text = strip_tags($text, '
');
+if ($edge_smileys && $smiles) $text = do_smileys($text);
+return $text;
}
function safeHTMLboard($text,$smiles=TRUE) {
- global $edge_smileys;
- $text = strip_tags($text, '
');
- if ($edge_smileys && $smiles) $text = do_smileys($text);
- return $text;
+global $edge_smileys;
+$text = strip_tags($text, '
');
+if ($edge_smileys && $smiles) $text = do_smileys($text);
+return $text;
}
function buildHypertext($text) {
# return $text;
- $parts = explode('
', $text);
- for($i = 0; $i < sizeof($parts); $i++)
- $parts[$i] = buildHyperlinks($parts[$i]);
- $_r = join('
', $parts);
- return $_r;
+$parts = explode('
', $text);
+for($i = 0; $i < sizeof($parts); $i++)
+$parts[$i] = buildHyperlinks($parts[$i]);
+$_r = join('
', $parts);
+return $_r;
}
# Linkify URLs
# many thanks to Aztek, aztek@box.sk for supplying this neat function
# RegExps updated by ElfQrin
function buildHyperlinks($string) {
- $httpurl = "(^((f|ht){1}tp(s){0,1}://)[-\/a-zA-Z0-9/@:%_.~#\?&;=]+[\/a-zA-Z0-9@:%_~#\?&;=])";
+$httpurl = "(^((f|ht){1}tp(s){0,1}://)[-\/a-zA-Z0-9/@:%_.~#\?&;=]+[\/a-zA-Z0-9@:%_~#\?&;=])";
# $wwwsurl = "(www[.][a-zA-Z0-9@:%_.~#-\?&]+[a-zA-Z0-9@:%_~#\?&]))";
- $mailurl = "([_\\.0-9a-z-]+@([_\\.0-9a-z-]+)+[a-z]{2,4})";
+$mailurl = "([_\\.0-9a-z-]+@([_\\.0-9a-z-]+)+[a-z]{2,4})";
- $parts = split("[[:space:]]", $string);
+$parts = split("[[:space:]]", $string);
# $parts = explode(' ', $string);
- for ($i = 0; $i < sizeof($parts); $i++) {
- if (preg_match('/'.$httpurl.'/i', $parts[$i])) {
- $temp = $parts[$i];
- $parts[$i] = preg_replace('/'.$httpurl.'/i', "", $parts[$i]);
- $parts[$i] .= "$temp";
- }
+for ($i = 0; $i < sizeof($parts); $i++) {
+if (preg_match('/'.$httpurl.'/i', $parts[$i])) {
+$temp = $parts[$i];
+$parts[$i] = preg_replace('/'.$httpurl.'/i', "", $parts[$i]);
+$parts[$i] .= "$temp";
+}
# if (preg_match('/'.$wwwsurl.'/i', $parts[$i])) {
# $temp = $parts[$i];
@@ -301,13 +301,13 @@ function buildHyperlinks($string) {
# $parts[$i] .= "$temp";
# }
- if (preg_match('/'.$mailurl.'/i', $parts[$i])) {
- $temp = $parts[$i];
- $parts[$i] = preg_replace('/'.$mailurl.'/i', "", $parts[$i]);
- $parts[$i] .= "$temp";
- }
- }
- return join(' ', $parts);
+if (preg_match('/'.$mailurl.'/i', $parts[$i])) {
+$temp = $parts[$i];
+$parts[$i] = preg_replace('/'.$mailurl.'/i', "", $parts[$i]);
+$parts[$i] .= "$temp";
+}
+}
+return join(' ', $parts);
}
function pw_enc($w,$pwd,$enctyp) {
@@ -371,222 +371,222 @@ function cryptp($v1,$v2=null) {
# from PHP man, by mimec at wp dot pl r26-Jun-2003-09:40
function crypt_md5($str, $salt=null) {
- if (!$salt) {$salt=md5(uniqid(mt_rand(),1));}
- $salt=substr($salt, 0, 8);
- return $salt.':'.md5($salt.$str);
+if (!$salt) {$salt=md5(uniqid(mt_rand(),1));}
+$salt=substr($salt, 0, 8);
+return $salt.':'.md5($salt.$str);
}
# returns correct protection hashed value to be filled into the form
function prot() {
- global $edge_hashedpassword;
- global $edge_mcrypt_password;
- return (cryptp($edge_hashedpassword.$edge_prot_password));
+global $edge_hashedpassword;
+global $edge_mcrypt_password;
+return (cryptp($edge_hashedpassword.$edge_prot_password));
}
# checks if proper protection hashed value was sent by form
function chprot($prot) {
- global $edge_hashedpassword;
- global $edge_mcrypt_password;
- if ($prot == cryptp($edge_hashedpassword.$edge_prot_password,$prot))
- return 1;
- return 0;
+global $edge_hashedpassword;
+global $edge_mcrypt_password;
+if ($prot == cryptp($edge_hashedpassword.$edge_prot_password,$prot))
+return 1;
+return 0;
}
# checks HTTP_REFERER against $edge_main_url
function chref() {
- global $edge_main_url, $edge_httprefcheck;
-
- if ($edge_httprefcheck) {
- $r = $_SERVER['HTTP_REFERER'];
- if (substr($r,0,strlen($edge_main_url)) == $edge_main_url) {
- return 1;
- } else {
- if ($r=='') {
- echo 'fatal error: no HTTP_REFERER, make sure your browser sends HTTP_REFERER correctly
";
- $i = 0;
- echo '';
- while (($o=dbx_fetch_object($dbx,$result)) && $i<5) {
- echo "
';
- if ($c > 5) {echo "...";}
- if (!$short) {echo ' ";
- $i++;
- }
- echo 'id&did=".rawurlencode("edge$id")."&disp=$o->id\">".$o->subj." "; # htmlentities_mb($o->subj) is not needed because forum message subjects are already rawurlencoded
- if (!$short) {
- echo " - meno)."\">$o->meno ";
- echo "".date_tz("d M Y H:i",$o->dat)." ";
- }
- echo "
";
+$i = 0;
+echo '';
+while (($o=dbx_fetch_object($dbx,$result)) && $i<5) {
+echo "
';
+if ($c > 5) {echo "...";}
+if (!$short) {echo ' ";
+$i++;
+}
+echo 'id&did=".rawurlencode("edge$id")."&disp=$o->id\">".$o->subj." "; # htmlentities_mb($o->subj) is not needed because forum message subjects are already rawurlencoded
+if (!$short) {
+echo " - meno)."\">$o->meno ";
+echo "".date_tz("d M Y H:i",$o->dat)." ";
+}
+echo " ";
- } else {echo $ccod.' ';}
- else
- echo "
";
- break;
- case 2:
- default:
- if ($ccod)
- echo $ccod.' ';
- else
- echo '-- ';
- break;
-}
-}
+global $dbx, $dbxcon, $dbxcon_aut, $edge_database_auth;
+global $edge_countryflags, $edge_main_url, $dir_inc, $dir_cflags;
+
+if ($edge_countryflags) {
+$q = "SELECT ccode,COUNT(*) AS c FROM people_lastlogged WHERE login = '$user' ";
+if ($r = dbx_query($dbx,$dbxcon_aut,$q,$edge_database_auth))
+$o = dbx_fetch_object($dbx,$r);
+
+if ($o->c == 0) {
+$q = "SELECT ccode FROM people WHERE login = '$user' ";
+$r = dbx_query($dbx,$dbxcon_aut,$q,$edge_database_auth);
+$o = dbx_fetch_object($dbx,$r);
+}
+$ccod=$o->ccode;
+switch ($edge_countryflags) {
+case 1:
+if ($ccod)
+if (file_exists($dir_inc.$dir_cflags.strtolower($ccod).'.gif')) {
+echo "
";
+} else {echo $ccod.' ';}
+else
+echo "
";
+break;
+case 2:
+default:
+if ($ccod)
+echo $ccod.' ';
+else
+echo '-- ';
+break;
+}
+}
}
function show_gender($user) {
@@ -669,29 +669,29 @@ function showuser($nick,$mask='&NK',$lnkprf=1,$lnktgt='',$gend=true,$cflg=true,$
}
function date_tz($formatstring,$dat) {
- global $edge_tz, $edge_servertz;
+global $edge_tz, $edge_servertz;
- if ($edge_tz=='' || $edge_tz==-1) {
- $edge_tz = (int)$_COOKIE['boxtz'];
- if ($edge_tz=='' || $edge_tz==-1) {$edge_tz=0;}
- }
- $datx = $dat - $edge_servertz*60*60 + $edge_tz*60*60/100;
+if ($edge_tz=='' || $edge_tz==-1) {
+$edge_tz = (int)$_COOKIE['boxtz'];
+if ($edge_tz=='' || $edge_tz==-1) {$edge_tz=0;}
+}
+$datx = $dat - $edge_servertz*60*60 + $edge_tz*60*60/100;
# echo "
";
- if ($clicky)
- echo "";
+global $edge_main_url, $edge_uploaddir, $edge_uploadwww;
+
+$nam1 = substr($nam,4);
+if (substr($nam,-4)=='.jpg' || substr($nam,-4)=='.png') {
+$nam1 = substr($nam1,0,strlen($nam1)-3).'jpg';
+} else {
+$nam1 = $nam;
+}
+$_size = getimagesize($edge_uploaddir.'/'.$nam);
+if ($clicky)
+echo "";
+if ($w!=-1) {$w1=' width="'.$w.'" ';}
+if ($h!=-1) {$h1=' heigth="'.$h.'" ';}
+echo "
";
+if ($clicky)
+echo "";
}
# deletes given uploaded image file with its thumbnail as well
function delupload($_realname,$typ=-1) {
- global $dbx, $dbxcon, $edge_database;
- global $edge_uploaddir, $logthis, $edge_log;
+global $dbx, $dbxcon, $edge_database;
+global $edge_uploaddir, $logthis, $edge_log;
- # we assume substr($_realname,0,4) == 'orig'
- $_realorigname = $_realname;
- $_realname = fthumb($_realname);
+# we assume substr($_realname,0,4) == 'orig'
+$_realorigname = $_realname;
+$_realname = fthumb($_realname);
- $_un = $edge_uploaddir.'/'.$_realname;
- if (file_exists($_un)) {chmod ($_un, 0775); unlink($_un);}
+$_un = $edge_uploaddir.'/'.$_realname;
+if (file_exists($_un)) {chmod ($_un, 0775); unlink($_un);}
- $_unorig = $edge_uploaddir.'/'.$_realorigname;
- if (file_exists($_unorig)) {chmod ($_unorig, 0775); unlink($_unorig);}
+$_unorig = $edge_uploaddir.'/'.$_realorigname;
+if (file_exists($_unorig)) {chmod ($_unorig, 0775); unlink($_unorig);}
- $_qd = "DELETE FROM uploads WHERE realname = '$_realorigname'";
- $_resd = dbx_query($dbx,$dbxcon,$_qd,$edge_database);
+$_qd = "DELETE FROM uploads WHERE realname = '$_realorigname'";
+$_resd = dbx_query($dbx,$dbxcon,$_qd,$edge_database);
if ($logthis['PIX']) {
switch ($typ) {
case 0:
@@ -1054,7 +1054,7 @@ function bbcode($txt='',$bbcodes=array()) {
}
# Big Brother is censoring you
-function censor($txt,$rev,$x='-',$px='',$sx='',$forb1,$md1,$forb2=array(),$md2='') {
+function censor($txt,$rev,$x='-',$px='',$sx='',$forb1=array(),$md1='',$forb2=array(),$md2='') {
if ($txt) {
if ($md2) {$mxf=2;} else {$mxf=1;}
for ($i=1;$i<=$mxf;$i++) {
@@ -1111,10 +1111,10 @@ function iptocountry($ip) {
$c='00';
- $q = "SELECT code FROM ccip WHERE ipf<=inet_aton('$ip') AND ipt>=inet_aton('$ip') ";
- $r = dbx_query($dbx,$dbxcon,$q,$edge_database);
- $cc = dbx_fetch_array($dbx,$r);
- if ($cc['code']) {$c=$cc['code'];}
+$q = "SELECT code FROM ccip WHERE ipf<=inet_aton('$ip') AND ipt>=inet_aton('$ip') ";
+$r = dbx_query($dbx,$dbxcon,$q,$edge_database);
+$cc = dbx_fetch_array($dbx,$r);
+if ($cc['code']) {$c=$cc['code'];}
return $c;
}
@@ -1131,31 +1131,31 @@ function isemail($email) {
# $st = string to "U" = upper, "L" = lower, null=casesensitive
# example: $pw=pwgen(8,true,null);
function pwgen($digits,$c=false,$st=null) {
- if (!preg_match("/^([4-9]|((1|2){1}[0-9]{1}))$/",$digits)) # 4-29 chars allowed
- $digits=4;
- for(;;) {
- $pwd=null; $o=null;
- # Generates the password
- for ($x=0;$x<$digits;) {
- $y = mt_rand(1,1000);
- if($y>350 && $y<601) $d=chr(mt_rand(48,57));
- if($y<351) $d=chr(mt_rand(65,90));
- if($y>600) $d=chr(mt_rand(97,122));
- if($d!=$o) {
- $o=$d; $pwd.=$d; $x++;
- }
- }
- # if you want that the user will not be confused by O or 0 ("Oh" or "Null") or 1 or l ("One" or "L"), set $c=true;
- if($c) {
- $pwd=preg_replace("/(l|i)/i",'1',$pwd);
- $pwd=preg_replace("/(o)/i",'0',$pwd);
- }
- # If the PW fits your purpose (e.g. this regexpression) return it, else make a new one (You can change this regular-expression how you want ....)
- if(preg_match("/^[a-zA-Z]{1}([a-zA-Z]+[0-9][a-zA-Z]+)+/",$pwd))
- break;
- }
- if ($st=="L") {$pwd=strtolower($pwd);} elseif ($st=="U") {$pwd=strtoupper($pwd);}
- return $pwd;
+if (!preg_match("/^([4-9]|((1|2){1}[0-9]{1}))$/",$digits)) # 4-29 chars allowed
+$digits=4;
+for(;;) {
+$pwd=null; $o=null;
+# Generates the password
+for ($x=0;$x<$digits;) {
+$y = mt_rand(1,1000);
+if($y>350 && $y<601) $d=chr(mt_rand(48,57));
+if($y<351) $d=chr(mt_rand(65,90));
+if($y>600) $d=chr(mt_rand(97,122));
+if($d!=$o) {
+$o=$d; $pwd.=$d; $x++;
+}
+}
+# if you want that the user will not be confused by O or 0 ("Oh" or "Null") or 1 or l ("One" or "L"), set $c=true;
+if($c) {
+$pwd=preg_replace("/(l|i)/i",'1',$pwd);
+$pwd=preg_replace("/(o)/i",'0',$pwd);
+}
+# If the PW fits your purpose (e.g. this regexpression) return it, else make a new one (You can change this regular-expression how you want ....)
+if(preg_match("/^[a-zA-Z]{1}([a-zA-Z]+[0-9][a-zA-Z]+)+/",$pwd))
+break;
+}
+if ($st=="L") {$pwd=strtolower($pwd);} elseif ($st=="U") {$pwd=strtoupper($pwd);}
+return $pwd;
}
function richtextarea($nam,$param='cols=75 rows=5',$v='',$riche='1') {
diff --git a/functions_db.php b/functions_db.php
index 1bc6a02..b83ae56 100644
--- a/functions_db.php
+++ b/functions_db.php
@@ -1,7 +1,7 @@
-
+
\ No newline at end of file