Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $countries = array(
- ".UNKNOW" => "unknow.gif",
- ".LOCALHOST" => "jollyroger.gif",
- ".NET" => "jollyroger.gif",
- ".ORG" => "jollyroger.gif",
- ".CO"=>"uk.gif",
- ".CO.UK"=>"uk.gif",
- ".GB"=>"uk.gif",
- ".US"=>"usa.gif",
- ".BM"=>"bermuda.gif",
- ".SE"=>"sweden.gif",
- ".IT"=>"italy.gif",
- ".CA"=>"canada.gif",
- ".IN"=>"india.gif",
- ".CR"=>"costarica.gif",
- ".BO"=>"bolivia.gif",
- ".NL"=>"netherlands.gif",
- ".DE"=>"germany.gif",
- ".CH"=>"switzerland.gif",
- ".FR"=>"france.gif",
- ".IL"=>"israel.gif",
- ".ES"=>"spain.gif",
- ".CL"=>"chile.gif",
- ".BS"=>"bahamas.gif",
- ".AR"=>"argentina.gif",
- ".DM"=>"dominica.gif",
- ".BZ"=>"belize.gif",
- ".BR"=>"brazil.gif",
- ".JP"=>"japan.gif",
- ".AU"=>"australia.gif",
- ".KR"=>"southkorea.gif",
- ".CN"=>"china.gif",
- ".TW"=>"taiwan.gif",
- ".HK"=>"hongkong.gif",
- ".BD"=>"bangladesh.gif",
- ".SG"=>"singapore.gif",
- ".MY"=>"malaysia.gif",
- ".NZ"=>"newzealand.gif",
- ".ID"=>"indonesia.gif",
- ".PK"=>"pakistan.gif",
- ".BN"=>"brunei.gif",
- ".TH"=>"thailand.gif",
- ".PH"=>"philippines.gif",
- ".GR"=>"greece.gif",
- ".SA"=>"saudiarabia.gif",
- ".PL"=>"poland.gif",
- ".AT"=>"austria.gif",
- ".BE"=>"belgium.gif",
- ".IE"=>"ireland.gif",
- ".CZ"=>"czechrep.gif",
- ".RU"=>"russia.gif",
- ".KE"=>"kenya.gif",
- ".DK"=>"denmark.gif",
- ".EG"=>"egypt.gif",
- ".NO"=>"norway.gif",
- ".UA"=>"ukraine.gif",
- ".TJ"=>"tajikistan.gif",
- ".TR"=>"turkey.gif",
- ".IR"=>"iran.gif",
- ".GE"=>"georgia.gif",
- ".BY"=>"belarus.gif",
- ".AZ"=>"azerbaijan.gif",
- ".MA"=>"morocco.gif",
- ".IQ"=>"iraq.gif",
- ".AM"=>"armenia.gif",
- ".LB"=>"lebanon.gif",
- ".MD"=>"moldova.gif",
- ".BG"=>"bulgaria.gif",
- ".FI"=>"finland.gif",
- ".PT"=>"portugal.gif",
- ".CM"=>"cameroon.gif",
- ".GH"=>"ghana.gif",
- ".ZW"=>"zimbabwe.gif",
- ".CD"=>"demrepcongo.gif",
- ".MG"=>"madagascar.gif",
- ".CI"=>"ivorycoast.gif",
- ".BJ"=>"benin.gif",
- ".RW"=>"rwanda.gif",
- ".TG"=>"togo.gif",
- ".MZ"=>"mozambique.gif",
- ".GN"=>"guinea.gif",
- ".ZM"=>"zambia.gif",
- ".TZ"=>"tanzania.gif",
- ".NG"=>"nigeria.gif",
- ".SN"=>"senegal.gif",
- ".AO"=>"angola.gif",
- ".OM"=>"oman.gif",
- ".DZ"=>"algeria.gif",
- ".EE"=>"estonia.gif",
- ".SK"=>"slovakia.gif",
- ".LY"=>"libya.gif",
- ".JO"=>"jordan.gif",
- ".HU"=>"hungary.gif",
- ".KW"=>"kuwait.gif",
- ".LT"=>"lithuania.gif",
- ".LV"=>"latvia.gif",
- ".SZ"=>"swaziland.gif",
- ".SM"=>"sanmarino.gif",
- ".CS"=>"serbia.gif",
- ".KZ"=>"kazakhstan.gif",
- ".LU"=>"luxembourg.gif",
- ".AF"=>"afghanistan.gif",
- ".IS"=>"iceland.gif",
- ".CY"=>"cyprus.gif",
- ".MK"=>"macadonia.gif",
- ".MT"=>"malta.gif",
- ".ZA"=>"southafrica.gif",
- ".RO"=>"romania.gif",
- ".MW"=>"malawi.gif",
- ".SI"=>"slovenia.gif",
- ".MC"=>"monaco.gif",
- ".HT"=>"haiti.gif",
- ".SV"=>"elsalvado.gif",
- ".GU"=>"guam.gif",
- ".PR"=>"puertorico.gif",
- ".FM"=>"micronesia.gif",
- ".CO"=>"colombia.gif",
- ".UG"=>"uganda.gif",
- ".LR"=>"liberia.gif",
- ".EC"=>"ecuador.gif",
- ".MX"=>"mexico.gif",
- ".KY"=>"caymanislands.gif",
- ".PE"=>"peru.gif",
- ".GP"=>"guadeloupe.gif",
- ".AN"=>"nethantilles.gif",
- ".HN"=>"honduras.gif",
- ".SL"=>"sierraleone.gif",
- ".LC"=>"stlucia.gif",
- ".DO"=>"dominicanrep.gif",
- ".NI"=>"nicaragua.gif",
- ".GT"=>"guatemala.gif",
- ".TT"=>"trinidadandtobago.gif",
- ".AS"=>"westernsamoa.gif",
- ".LS"=>"lesotho.gif",
- ".JM"=>"jamaica.gif",
- ".VE"=>"venezuela.gif",
- ".BB"=>"barbados.gif",
- ".PA"=>"panama.gif",
- ".AG"=>"antiguabarbuda.gif",
- ".VI"=>"virginislands.gif",
- ".BA"=>"bosniaherzegovina.gif",
- ".MH"=>"marshallislands.gif",
- ".AE"=>"uae.gif",
- ".CU"=>"cuba.gif",
- ".CG"=>"congo.gif",
- ".PY"=>"paraguay.gif",
- ".SR"=>"suriname.gif",
- ".KN"=>"stkitts_nevis.gif",
- ".VG"=>"virginislands.gif",
- ".GI"=>"gibraltar.gif",
- ".UY"=>"uruguay.gif",
- ".MP"=>"northernmarianaislands.gif",
- ".MU"=>"mauritius.gif",
- ".TD"=>"chad.gif",
- ".LI"=>"liechtenstein.gif",
- ".FO"=>"faroeislands.gif",
- ".AL"=>"albania.gif",
- ".UZ"=>"uzbekistan.gif",
- ".SO"=>"somalia.gif",
- ".YE"=>"yemen.gif",
- ".MR"=>"mauritania.gif",
- ".GW"=>"guinea-bissau.gif",
- ".QA"=>"qatar.gif",
- ".KM"=>"comoros.gif",
- ".MN"=>"mongolia.gif",
- ".GA"=>"gabon.gif",
- ".HR"=>"croatia.gif",
- ".LA"=>"laos.gif",
- ".LK"=>"srilanka.gif",
- ".ML"=>"mali.gif",
- ".BI"=>"burundi.gif",
- ".SY"=>"syria.gif",
- ".TN"=>"tunisia.gif",
- ".NA"=>"namibia.gif",
- ".MQ"=>"martinique.gif",
- ".KG"=>"kyrgyzstan.gif",
- ".BH"=>"bahrain.gif",
- ".VA"=>"holysee(vaticancitystate.gif",
- ".PS"=>"palestinianterritory.gif",
- ".ET"=>"ethiopia.gif",
- ".FJ"=>"fiji.gif",
- ".MO"=>"macao.gif",
- ".BF"=>"burkinafaso.gif",
- ".NE"=>"niger.gif",
- ".PF"=>"frenchpolynesia.gif",
- ".PG"=>"papuanewguinea.gif",
- ".BW"=>"botswana.gif",
- ".SD"=>"sudan.gif",
- ".CF"=>"centralafricanrep.gif",
- ".DJ"=>"djibouti.gif",
- ".GQ"=>"eq_guinea.gif",
- ".TM"=>"turkmenistan.gif",
- ".RE"=>"reunion.gif",
- ".AD"=>"andorra.gif",
- ".GL"=>"greenland.gif",
- ".CV"=>"capeverde.gif",
- ".ST"=>"sao_tome.gif",
- ".FK"=>"falklandislands(malvinas.gif",
- ".VC"=>"grenadines.gif",
- ".GD"=>"grenada.gif",
- ".ER"=>"eritrea.gif",
- ".AW"=>"aruba.gif",
- ".GY"=>"guyana.gif",
- ".NC"=>"newcaledonia.gif",
- ".SB"=>"solomon_islands.gif",
- ".MV"=>"maldives.gif",
- ".TV"=>"tuvalu.gif",
- ".WS"=>"samoa.gif",
- ".VN"=>"vietnam.gif",
- ".KI"=>"kiribati.gif",
- ".IO"=>"britishindianoceanterritory.gif",
- ".KH"=>"cambodia.gif",
- ".NP"=>"nepal.gif",
- ".TO"=>"tonga.gif",
- ".CK"=>"cookislands.gif",
- ".SC"=>"seychelles.gif",
- ".NR"=>"nauru.gif",
- ".TL"=>"timor-leste.gif",
- ".TK"=>"tokelau.gif",
- ".VU"=>"vanuatu.gif",
- ".PW"=>"palau.gif",
- ".BT"=>"bhutan.gif",
- ".MM"=>"myanmar.gif",
- ".GM"=>"gambia.gif",
- ".GF"=>"frenchguiana.gif",
- ".TF"=>"frenchsouthernterritories.gif",
- );
- $smilies = array(
- ":-)" => "smile1.gif",
- ":smile:" => "smile2.gif",
- ":-D" => "grin.gif",
- ":lol:" => "laugh.gif",
- ":w00t:" => "w00t.gif",
- ":-P" => "tongue.gif",
- ";-)" => "wink.gif",
- ":-|" => "noexpression.gif",
- ":-/" => "confused.gif",
- ":-(" => "sad.gif",
- ":'-(" => "cry.gif",
- ":weep:" => "weep.gif",
- ":-O" => "ohmy.gif",
- ":o)" => "clown.gif",
- "8-)" => "cool1.gif",
- "|-)" => "sleeping.gif",
- ":innocent:" => "innocent.gif",
- ":whistle:" => "whistle.gif",
- ":unsure:" => "unsure.gif",
- ":closedeyes:" => "closedeyes.gif",
- ":cool:" => "cool2.gif",
- ":fun:" => "fun.gif",
- ":thumbsup:" => "thumbsup.gif",
- ":thumbsdown:" => "thumbsdown.gif",
- ":blush:" => "blush.gif",
- ":unsure:" => "unsure.gif",
- ":yes:" => "yes.gif",
- ":no:" => "no.gif",
- ":love:" => "love.gif",
- ":?:" => "question.gif",
- ":!:" => "excl.gif",
- ":idea:" => "idea.gif",
- ":arrow:" => "arrow.gif",
- ":arrow2:" => "arrow2.gif",
- ":hmm:" => "hmm.gif",
- ":hmmm:" => "hmmm.gif",
- ":huh:" => "huh.gif",
- ":geek:" => "geek.gif",
- ":look:" => "look.gif",
- ":rolleyes:" => "rolleyes.gif",
- ":kiss:" => "kiss.gif",
- ":shifty:" => "shifty.gif",
- ":blink:" => "blink.gif",
- ":smartass:" => "smartass.gif",
- ":sick:" => "sick.gif",
- ":crazy:" => "crazy.gif",
- ":wacko:" => "wacko.gif",
- ":alien:" => "alien.gif",
- ":wizard:" => "wizard.gif",
- ":wave:" => "wave.gif",
- ":wavecry:" => "wavecry.gif",
- ":baby:" => "baby.gif",
- ":angry:" => "angry.gif",
- ":ras:" => "ras.gif",
- ":sly:" => "sly.gif",
- ":devil:" => "devil.gif",
- ":evil:" => "evil.gif",
- ":evilmad:" => "evilmad.gif",
- ":sneaky:" => "sneaky.gif",
- ":axe:" => "axe.gif",
- ":slap:" => "slap.gif",
- ":wall:" => "wall.gif",
- ":rant:" => "rant.gif",
- ":jump:" => "jump.gif",
- ":yucky:" => "yucky.gif",
- ":nugget:" => "nugget.gif",
- ":smart:" => "smart.gif",
- ":shutup:" => "shutup.gif",
- ":shutup2:" => "shutup2.gif",
- ":crockett:" => "crockett.gif",
- ":zorro:" => "zorro.gif",
- ":snap:" => "snap.gif",
- ":beer:" => "beer.gif",
- ":beer2:" => "beer2.gif",
- ":drunk:" => "drunk.gif",
- ":strongbench:" => "strongbench.gif",
- ":weakbench:" => "weakbench.gif",
- ":dumbells:" => "dumbells.gif",
- ":music:" => "music.gif",
- ":stupid:" => "stupid.gif",
- ":dots:" => "dots.gif",
- ":offtopic:" => "offtopic.gif",
- ":spam:" => "spam.gif",
- ":oops:" => "oops.gif",
- ":lttd:" => "lttd.gif",
- ":please:" => "please.gif",
- ":sorry:" => "sorry.gif",
- ":hi:" => "hi.gif",
- ":yay:" => "yay.gif",
- ":cake:" => "cake.gif",
- ":hbd:" => "hbd.gif",
- ":band:" => "band.gif",
- ":punk:" => "punk.gif",
- ":rofl:" => "rofl.gif",
- ":bounce:" => "bounce.gif",
- ":mbounce:" => "mbounce.gif",
- ":thankyou:" => "thankyou.gif",
- ":gathering:" => "gathering.gif",
- ":hang:" => "hang.gif",
- ":chop:" => "chop.gif",
- ":rip:" => "rip.gif",
- ":whip:" => "whip.gif",
- ":judge:" => "judge.gif",
- ":chair:" => "chair.gif",
- ":tease:" => "tease.gif",
- ":box:" => "box.gif",
- ":boxing:" => "boxing.gif",
- ":guns:" => "guns.gif",
- ":shoot:" => "shoot.gif",
- ":shoot2:" => "shoot2.gif",
- ":flowers:" => "flowers.gif",
- ":wub:" => "wub.gif",
- ":lovers:" => "lovers.gif",
- ":kissing:" => "kissing.gif",
- ":kissing2:" => "kissing2.gif",
- ":console:" => "console.gif",
- ":group:" => "group.gif",
- ":hump:" => "hump.gif",
- ":hooray:" => "hooray.gif",
- ":happy2:" => "happy2.gif",
- ":clap:" => "clap.gif",
- ":clap2:" => "clap2.gif",
- ":weirdo:" => "weirdo.gif",
- ":yawn:" => "yawn.gif",
- ":bow:" => "bow.gif",
- ":dawgie:" => "dawgie.gif",
- ":cylon:" => "cylon.gif",
- ":book:" => "book.gif",
- ":fish:" => "fish.gif",
- ":mama:" => "mama.gif",
- ":pepsi:" => "pepsi.gif",
- ":medieval:" => "medieval.gif",
- ":rambo:" => "rambo.gif",
- ":ninja:" => "ninja.gif",
- ":hannibal:" => "hannibal.gif",
- ":party:" => "party.gif",
- ":snorkle:" => "snorkle.gif",
- ":evo:" => "evo.gif",
- ":king:" => "king.gif",
- ":chef:" => "chef.gif",
- ":mario:" => "mario.gif",
- ":pope:" => "pope.gif",
- ":fez:" => "fez.gif",
- ":cap:" => "cap.gif",
- ":cowboy:" => "cowboy.gif",
- ":pirate:" => "pirate.gif",
- ":pirate2:" => "pirate2.gif",
- ":rock:" => "rock.gif",
- ":cigar:" => "cigar.gif",
- ":icecream:" => "icecream.gif",
- ":oldtimer:" => "oldtimer.gif",
- ":trampoline:" => "trampoline.gif",
- ":banana:" => "bananadance.gif",
- ":smurf:" => "smurf.gif",
- ":yikes:" => "yikes.gif",
- ":osama:" => "osama.gif",
- ":saddam:" => "saddam.gif",
- ":santa:" => "santa.gif",
- ":indian:" => "indian.gif",
- ":pimp:" => "pimp.gif",
- ":nuke:" => "nuke.gif",
- ":jacko:" => "jacko.gif",
- ":ike:" => "ike.gif",
- ":greedy:" => "greedy.gif",
- ":super:" => "super.gif",
- ":wolverine:" => "wolverine.gif",
- ":spidey:" => "spidey.gif",
- ":spider:" => "spider.gif",
- ":bandana:" => "bandana.gif",
- ":construction:" => "construction.gif",
- ":sheep:" => "sheep.gif",
- ":police:" => "police.gif",
- ":detective:" => "detective.gif",
- ":bike:" => "bike.gif",
- ":fishing:" => "fishing.gif",
- ":clover:" => "clover.gif",
- ":horse:" => "horse.gif",
- ":shit:" => "shit.gif",
- ":soldiers:" => "soldiers.gif",
- );
- $privatesmilies = array(
- ":)" => "smile1.gif",
- // ";)" => "wink.gif",
- ":wink:" => "wink.gif",
- ":D" => "grin.gif",
- ":P" => "tongue.gif",
- ":(" => "sad.gif",
- ":'(" => "cry.gif",
- ":|" => "noexpression.gif",
- // "8)" => "cool1.gif", we don't want this as a smilie...
- ":Boozer:" => "alcoholic.gif",
- ":deadhorse:" => "deadhorse.gif",
- ":spank:" => "spank.gif",
- ":yoji:" => "yoji.gif",
- ":locked:" => "locked.gif",
- ":grrr:" => "angry.gif", // legacy
- "O:-" => "innocent.gif", // legacy
- ":sleeping:" => "sleeping.gif", // legacy
- "-_-" => "unsure.gif", // legacy
- ":clown:" => "clown.gif",
- ":mml:" => "mml.gif",
- ":rtf:" => "rtf.gif",
- ":morepics:" => "morepics.gif",
- ":rb:" => "rb.gif",
- ":rblocked:" => "rblocked.gif",
- ":maxlocked:" => "maxlocked.gif",
- ":hslocked:" => "hslocked.gif",
- );
- function get_user_class_image($class)
- {
- switch ($class)
- {
- case UC_USER: return "pic/class/user.gif";
- case UC_POWER_USER: return "pic/class/power.gif";
- case UC_VIP: return "pic/class/vip.gif";
- case UC_UPLOADER: return "pic/class/uploader.gif";
- case UC_MODERATOR: return "pic/class/mod.gif";
- case UC_SUPERVISOR: return "pic/class/supervisor.gif";
- case UC_ADMINISTRATOR: return "pic/class/admin.gif";
- case UC_CODER: return "pic/class/coder.gif";
- case UC_SYSOP: return "pic/class/sysop.gif";
- case UC_STAFFLEADER: return "pic/class/staffleader.gif";
- }
- return "";
- }
- function get_percent_completed_image($p) {
- $maxpx = "100"; // Maximum amount of pixels for the progress bar
- if ($p == 0) $progress = "<img src=\"/pic/progbar-rest.gif\" height=9 width=" . ($maxpx) . " />";
- if ($p == 100) $progress = "<img src=\"/pic/progbar-green.gif\" height=9 width=" . ($maxpx) . " />";
- if ($p >= 1 && $p <= 30) $progress = "<img src=\"/pic/progbar-red.gif\" height=9 width=" . ($p*($maxpx/100)) . " /><img src=\"/pic/progbar-rest.gif\" height=9 width=" . ((100-$p)*($maxpx/100)) . " />";
- if ($p >= 31 && $p <= 65) $progress = "<img src=\"/pic/progbar-yellow.gif\" height=9 width=" . ($p*($maxpx/100)) . " /><img src=\"/pic/progbar-rest.gif\" height=9 width=" . ((100-$p)*($maxpx/100)) . " />";
- if ($p >= 66 && $p <= 99) $progress = "<img src=\"/pic/progbar-green.gif\" height=9 width=" . ($p*($maxpx/100)) . " /><img src=\"/pic/progbar-rest.gif\" height=9 width=" . ((100-$p)*($maxpx/100)) . " />";
- return "<img src=\"/pic/bar_left.gif\" />" . $progress ."<img src=\"/pic/bar_right.gif\" />";
- }
- //-------- Bad Word Filter
- //////////////////// BAD WORD FUNCTION ////////////////////////
- function word_fliter($content) {
- global $badwords, $wordreplace;
- $count = count($badwords);
- $countfilter = count($wordreplace);
- // Loop through the badwords array
- for ($n = 0; $n < $count; ++$n, next ($badwords)) {
- //Create random replace characters
- $x = 2;
- $y = rand(3,5);
- $filter = "";
- while ($x<="$y") {
- $f = rand(0,$countfilter-1);
- $filter .="$wordreplace[$f]";
- $x++;
- }
- //Search for badwords in content
- $search = "$badwords[$n]";
- $content = preg_replace("'$search'i","$filter",$content);
- }
- return $content;
- }
- ////////////////// END BAD WORD FUNCTION
- ///////////////// DEFINE BAD WORDS ARRAY ////////////////
- $badwords = array (
- "asshole",
- "ass",
- "bitch",
- "bastard",
- "cunt",
- "dick",
- "dike",
- "dildo",
- "fuck",
- "gay",
- "hoe",
- "nigger",
- "pussy",
- "slut",
- "whore",
- "god damn",
- "goddamn"
- );
- /////////////// CHARACTER ARRAY REPLACEMENT ///////////////
- $wordreplace = array (
- ".."
- );
- ///////////// END DEFINE ARRAYS /////////////////////////
- // Set this to the line break character sequence of your system
- $linebreak = "\r\n";
- 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)
- {
- print("<table class=main width=750 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)
- {
- stdhead();
- stdmsg($heading, $text);
- stdfoot();
- 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)
- {
- if ($timestamp)
- return date("Y-m-d H:i:s", $timestamp);
- else
- return gmdate("Y-m-d H:i:s");
- }
- function auto_enter_cheater($userid, $rate, $upthis, $diff, $torrentid, $client, $ip, $last_up)
- {
- mysql_query("INSERT INTO cheaters (added, userid, client, rate, beforeup, upthis, timediff, userip, torrentid) VALUES('" . get_date_time() . "', $userid, '$client', '$rate', '$last_up', '$upthis', '$diff', '$ip', '$torrentid')") or sqlerr(__FILE__, __LINE__);
- }
- 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 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\.)?torrentbits\.(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]","<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>",$s);
- $s = preg_replace("/\\[quote=(.+?)\\]/", "<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>", $s);
- $s = str_replace("[/quote]","</td></tr></table><br>",$s);
- return $s;
- }
- function format_comment($text, $strip_html = true, $xssclean = false)
- {
- global $smilies, $privatesmilies, $CURUSER;
- $s = $text;
- $s = str_replace(";)", ":wink:", $s);
- if ($strip_html)
- $s = htmlspecialchars($s);
- // [you]
- $s = str_replace ("[you]", "$CURUSER[username]", $s);
- // [*]
- $s = preg_replace("/\[\*\]/", "<li>", $s);
- // [center]
- $s = preg_replace("/\[center\]((\s|.)+?)\[\/center\]/i", "<div align='center'><tt><nobr><font face='Verdana' style='font-size: 8pt; line-height: " .
- "8pt'>\\1</font></nobr></tt></div>", $s);
- // villogу
- $s = preg_replace("/\[blink\]((\s|.)+?)\[\/blink\]/", "<blink>\\1</blink>", $s);
- //[warning]Text[/warning]
- $s = preg_replace(
- "/\[warning\]\s*((\s|.)+?)\s*\[\/warning\]\s*/i",
- "<table style='margin:0;width:550px;min-height:50px;border:0px dashed #740000;'><tr><td align='middle' bgcolor='#ff0000' valign='center' width='1%'><br /><FONT color='#ffffff' size='+7'><b> ! </b></font><br /></td><td valign='top' cellpadding='5' style='background:#F2DDDD' >\\1</td></tr></table>", $s);
- //[align=(center|left|right|justify)]text[/align]
- $s = preg_replace("/\[align=([a-zA-Z]+)\]((\s|.)+?)\[\/align\]/i","<div style=\"text-align:\\1\">\\2</div>", $s);
- //[s]strike[/s]
- $s = preg_replace("/\[s\]((\s|.)+?)\[\/s\]/i", "<s>\\1</s>", $s);
- //[mail]mail[/mail]
- $s = preg_replace("/\[mail\]((\s|.)+?)\[\/mail\]/i","<a href=\"mailto:\\1\" targe=\"_blank\">\\1</a>", $s);
- // [strike]бthъzott[/strike]
- $s = preg_replace("/\[strike\]((\s|.)+?)\[\/strike\]/", "<strike>\\1</strike>", $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);
- //[spoiler]TEXT[/spoiler]
- $s = preg_replace("/\[spoiler\]((\s|.)+?)\[\/spoiler\]/", "<div style=\"padding: 3px; \"><div style=\"margin-bottom: 3px; display: block; \"><span onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b>Spoiler!</b> - <a href=\'#\' onclick=\'return false;\'>[Elrejtйs]</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Spoiler!</b> - <a href=\'#\' onclick=\'return false;\'>[Megjelenнtйs]</a>'; }\" /><b>Spoiler!</b> - <a href=\"#\" onclick=\"return false;\">[Megjelenнtйs]</a></span></div><div class=\"quotecontent\"><div style=\"display: none;border: 1px black dotted; padding: 10px;\">\\1</div></div></div>", $s);
- /*
- // [img]http://www/image.gif[/img]
- $s = preg_replace("/\[img\]([^\s'\"<>]+?)\[\/img\]/i", "<img border=0 src=\"\\1\">", $s);
- // [img=http://www/image.gif]
- $s = preg_replace("/\[img=([^\s'\"<>]+?)\]/i", "<img border=0 src=\"\\1\">", $s);
- */
- // [img]http://www/image.gif[/img]
- $s = preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "<img border=\"0\" src=\"\\1\" alt=\"\" onload=\"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=\"\" onload=\"NcodeImageResizer.createOn(this);\">", $s);
- // [imgw]http://www/image.gif[/imgw]
- $s = preg_replace("/\[imgw\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png|jpeg|bmp)))\\[\/imgw\]/i","<img width=\"495\" src=\"\\1\" alt=\"\" /><br /><font size=1>Ez egy бtmйretezett kйp. A teljes kйp megtekintйsйhez kattints <a class=\"light\" target=\"_blank\" href=\"\\1 \"><b>ide</b></a>.</font><br />", $s);
- // [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 target=_blank href=\"\\1\">\\2</a>", $s);
- // [url]http://www.example.com[/url]
- $s = preg_replace(
- "/\[url\]([^()<>\s]+?)\[\/url\]/i",
- "<a target=_blank href=\"\\1\">\\1</a>", $s);
- // YouTube Vids
- $s = preg_replace("/\[video=[^\s'\"<>]*youtube.com.*v=([^\s'\"<>]+)\]/ims", "<object width=\"500\" height=\"410\"><param name=\"movie\" value=\"http://www.youtube.com/v/\\1\"></param><embed src=\"http://www.youtube.com/v/\\1\" type=\"application/x-shockwave-flash\" width=\"500\" height=\"410\"></embed></object>", $s);
- //[spoiler]Text[/spoiler]
- $ab = 5000; // tуl
- $cd = 104857600; // ig
- $random = mt_rand($cd, $ab);
- $s = preg_replace("/\[spoiler\]\s*((\s|.)+?)\s*\[\/spoiler\]\s*/i",
- "<center><input type=button onClick='hirek($random)' value='Spoiler'></center>
- <div id='$random' style='display:none'>
- <table border=1 cellspacing=0 cellpadding=3>
- <td style='border: 1px black solid'><font color=#bbd7f3>\\1</font></td></table></div>
- ",$s);
- // [size=4]Text[/size]
- $s = preg_replace(
- "/\[size=([1-7])\]((\s|.)+?)\[\/size\]/i",
- "<font size=\\1>\\2</font>", $s);
- // [font=Arial]Text[/font]
- $s = preg_replace(
- "/\[font=([a-zA-Z ,]+)\]((\s|.)+?)\[\/font\]/i",
- "<font face=\"\\1\">\\2</font>", $s);
- // //[quote]Text[/quote]
- // $s = preg_replace(
- // "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
- // "<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br>", $s);
- // //[quote=Author]Text[/quote]
- // $s = preg_replace(
- // "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
- // "<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br>", $s);
- // Quotes
- $s = format_quotes($s);
- // URLs
- $s = format_urls($s);
- // $s = format_local_urls($s);
- // Linebreaks
- $s = nl2br($s);
- // [pre]Preformatted[/pre]
- $s = preg_replace("/\[pre\]((\s|.)+?)\[\/pre\]/i", "<tt><nobr>\\1</nobr></tt>", $s);
- // [nfo]NFO-preformatted[/nfo]
- $s = preg_replace("/\[nfo\]((\s|.)+?)\[\/nfo\]/i", "<tt><nobr><font face='MS Linedraw' size=2 style='font-size: 10pt; line-height: " .
- "10pt'>\\1</font></nobr></tt>", $s);
- // Maintain spacing
- $s = str_replace(" ", " ", $s);
- reset($smilies);
- while (list($code, $url) = each($smilies))
- $s = str_replace($code, "<img border=0 src=\"/pic/smilies/$url\" alt=\"" . htmlspecialchars($code) . "\">", $s);
- //reset($countries);
- //while (list($code, $url) = each($countries))
- //$s = str_replace($code, "<img src=/pic/flag/$url>", $s);
- reset($privatesmilies);
- while (list($code, $url) = each($privatesmilies))
- $s = str_replace($code, "<img border=0 src=\"/pic/smilies/$url\">", $s);
- return $s;
- }
- define ('UC_USER', 0);
- define ('UC_POWER_USER', 1);
- define ('UC_VIP', 2);
- define ('UC_UPLOADER', 3);
- define ('UC_MODERATOR', 4);
- define ('UC_ADMINISTRATOR', 5);
- define ('UC_SUPERVISOR', 6);
- define ('UC_CODER', 7);
- define ('UC_SYSOP', 8);
- define ('UC_STAFFLEADER', 9);
- 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_SUPERVISOR: return "Supervisor";
- case UC_ADMINISTRATOR: return "Administrator";
- case UC_CODER: return "Coder";
- 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 <= UC_SYSOP;
- }
- function is_valid_id($id)
- {
- return is_numeric($id) && ($id > 0) && (floor($id) == $id);
- }
- function textbbcode($form,$text,$content="") {
- ?>
- <script type="text/javascript">
- function wrap(v,r,e)
- {
- var r = r ? r : "";
- var v = v ? v : "";
- var e = e ? e : "";
- var obj = document.getElementById("<?=$text?>");
- if (document.selection)
- {
- var str = document.selection.createRange().text;
- obj.focus();
- var sel = document.selection.createRange();
- sel.text = "["+v+(e ? "="+e : "")+"]" + (r ? r : str) + "[/"+v+"]";
- }
- else
- {
- var len = obj.value.length;
- var start = obj.selectionStart;
- var end = obj.selectionEnd;
- var sel = obj.value.substring(start, end);
- obj.value = obj.value.substring(0,start) + "[" + v +(e ? "="+e : "")+"]" + (r ? r : sel) + "[/" + v + "]" + obj.value.substring(end,len);
- obj.selectionEnd = start + v.length+e.length+sel.length+r.length+v.length+5;
- }
- obj.focus();
- }
- function clink()
- {
- var linkTitle;
- var linkAddr;
- linkAddr = prompt("Kйrlek mбsold be a teljes URL cнmet.","http://");
- if(linkAddr && linkAddr != "http://")
- linkTitle = prompt("Please enter the title", " ");
- if(linkAddr && linkTitle)
- wrap('url',linkTitle,linkAddr);
- }
- function cimage()
- {
- var link;
- link = prompt("Kйrlek mбsold be a kйp teljes URL cнmйt.\nHasznбlhatу kйpformбtumok .png, .jpg, .gif","http://");
- var re_text = /\.jpg|\.gif|\.png|\.jpeg/i;
- if(re_text.test(link) == false && link != "http://" && link) {
- alert("Image not allowed only .jpg .gif .png .jpeg");
- link = prompt("Please enter the full URL for your image\nOnly .png, .jpg, .gif images","http://");
- }
- if(link != "http://" && link)
- wrap('img',link,'');
- }
- function colorpicker()
- {
- var link;
- link = prompt("Kйrlek mбsold be a kйp teljes URL cнmйt.\nHasznбlhatу kйpformбtumok .png, .jpg, .gif","http://");
- var re_text = /\.jpg|\.gif|\.png|\.jpeg/i;
- if(re_text.test(link) == false && link != "http://" && link) {
- alert("Image not allowed only .jpg .gif .png .jpeg");
- link = prompt("Please enter the full URL for your image\nOnly .png, .jpg, .gif images","http://");
- }
- if(link != "http://" && link)
- wrap('img',link,'');
- }
- function tag(v)
- {
- wrap(v,'','');
- }
- function mail()
- {
- var email = "";
- email = prompt("Plese enter the email addres"," ");
- var filter = /^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/i;
- if (!filter.test(email) && email.length > 1) {
- alert("Please provide a valid email address");
- email = prompt("Plese enter the email addres"," ");
- }
- if(email.length > 1)
- wrap('mail',email,'');
- }
- function text(to)
- {
- var obj = document.getElementById("<?=$text?>");
- if (document.selection)
- {
- var str = document.selection.createRange().text;
- obj.focus();
- var sel = document.selection.createRange();
- sel.text = (to == 'up' ? str.toUpperCase() : str.toLowerCase())
- }
- else
- {
- var len = obj.value.length;
- var start = obj.selectionStart;
- var end = obj.selectionEnd;
- var sel = obj.value.substring(start, end);
- obj.value = obj.value.substring(0,start) + (to == 'up' ? sel.toUpperCase() : sel.toLowerCase()) + obj.value.substring(end,len);
- }
- obj.focus();
- }
- function fonts(w)
- {
- var fmin = 12; var fmax = 24;
- var obj = document.getElementById("<?=$text?>");
- var size = obj.style.fontSize;
- size = (parseInt(size));
- var nsize ;
- if(w == 'up' && (size+1 < fmax))
- nsize = (size+1)+"px";
- if(w == 'down' && (size-1 > fmin))
- nsize = (size-1)+"px";
- obj.style.fontSize = nsize;
- obj.focus();
- }
- function font(w,f)
- {
- if(w == 'color')
- f = "#"+f;
- var obj = document.getElementById("<?=$text?>");
- if (document.selection)
- {
- var str = document.selection.createRange().text;
- obj.focus();
- var sel = document.selection.createRange();
- sel.text = "["+w+"="+f +"]" + str + "[/"+w+"]";
- }
- else
- {
- var len = obj.value.length;
- var start = obj.selectionStart;
- var end = obj.selectionEnd;
- var sel = obj.value.substring(start, end);
- obj.value = obj.value.substring(0,start) + "[" + w +"="+f+"]" + sel + "[/" + w + "]" + obj.value.substring(end,len);
- obj.selectionEnd = start + w.length+(1+f.length)+sel.length+w.length+5;
- }
- document.getElementById("font"+w).selectedIndex = 0;
- obj.focus();
- }
- function em(f)
- {
- var obj = document.getElementById("<?=$text?>");
- if (document.selection)
- {
- var str = document.selection.createRange().text;
- obj.focus();
- var sel = document.selection.createRange();
- sel.text = f;
- }
- else
- {
- var len = obj.value.length;
- var start = obj.selectionStart;
- var end = obj.selectionEnd;
- var sel = obj.value.substring(start, end);
- obj.value = obj.value.substring(0,start) +f+ obj.value.substring(end,len);
- obj.selectionEnd = start + f.length;
- }
- obj.focus();
- }
- function winop()
- {
- windop = window.open("moresmiles1.php?form=<?=$form?>&text=<?=$text?>","mywin","height=400,width=450,resizable=yes,scrollbars=yes");
- }
- </script>
- <table width="0" cellpadding="2" class="bbcode" cellspacing="2">
- <tr>
- <td align="center"><input style="width:60;font-weight:bold" type=button class=btn onclick="tag('b')" value="B" title='Bold text' alt="B" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60;font-style:italic" type=button class=btn onclick="tag('i')" value="I" title='Italic text' alt="I" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60; text-decoration: underline" type=button class=btn onclick="tag('u')" value="U" title='Underline text' alt="U" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60; text-decoration: line-through" type=button class=btn onclick="tag('s')" value="S" title='Strike out' alt="S" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="clink()" value="URL" alt="Link" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="cimage()" value="IMG" alt="Image" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="colorpicker()" value="Nagy kйp" alt="Colors" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('spoiler')" value="Spoiler" alt="S" /></td>
- </tr>
- </table>
- <td><textarea id="<?=$text?>" name="<?=$text?>" style="width:310px; height:226px;font-size:12px;"><?=$content?></textarea></td>
- <td align="center" valign="top">
- <table width="0" cellpadding="2" class="bbcode" cellspacing="2" border="0">
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('b')" value="Fйlkцvйr" title='Vastag betы' alt="B" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('i')" value="Dхlt" alt="I" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('u')" value="Alбhъzбs" alt="U" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('s')" value="Бthъzott" alt="S" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="clink()" value="URL" alt="Link" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('img')" value="Kйp" alt="Image" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('imgw')" value="Nagy kйp" alt="Bid Image" /></td>
- </tr>
- <tr>
- <td align="center"><input style="width:60" style="20px; width: 60px;font-size:8px;" type=button class=btn onclick="tag('spoiler')" value="Spoiler" alt="S" /></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <?
- }
- //-------- Begins a main frame
- function begin_main_frame()
- {
- print("<table class=main width=750 border=0 cellspacing=0 cellpadding=0>" .
- "<tr><td class=embedded>\n");
- }
- //-------- Ends a main frame
- function end_main_frame()
- {
- print("</td></tr></table>\n");
- }
- function begin_frame($caption = "", $center = false, $padding = 10)
- {
- $tdextra = "";
- if ($caption)
- print("<h2>$caption</h2>\n");
- if ($center)
- $tdextra .= " align=center";
- print("<table width=100% border=1 cellspacing=0 cellpadding=$padding><tr><td$tdextra>\n");
- }
- function attach_frame($padding = 10)
- {
- print("</td></tr><tr><td style='border-top: 0px'>\n");
- }
- function end_frame()
- {
- print("</td></tr></table>\n");
- }
- function begin_table($fullwidth = false, $padding = 5)
- {
- $width = "";
- if ($fullwidth)
- $width .= " width=100%";
- print("<table class=main$width border=1 cellspacing=0 cellpadding=$padding>\n");
- }
- function end_table()
- {
- print("</td></tr></table>\n");
- }
- //-------- Inserts a smilies frame
- // (move to globals)
- function insert_smilies_frame()
- {
- global $smilies, $BASEURL;
- begin_frame("Smilies", true);
- begin_table(false, 5);
- print("<tr><td class=colhead>Type...</td><td class=colhead>To make a...</td></tr>\n");
- while (list($code, $url) = each($smilies))
- print("<tr><td>$code</td><td><img src=$BASEURL/pic/smilies/$url></td>\n");
- end_table();
- end_frame();
- }
- function insert_countries_frame()
- {
- global $countries, $BASEURL;
- print("<legend>Countries</legend>\n");
- begin_table(false, 5);
- print("<tr><td class=colhead>Type...</td><td class=colhead>To make a...</td></tr>\n");
- while (list($code, $url) = each($countries))
- print("<tr><td>$code</td><td><img src=$BASEURL/pic/flag/$url></td>\n");
- end_table();
- }
- 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";
- if (($ratio >= 1.0) && ($ratio < 2.0)) return "#006600";
- if (($ratio >= 2.0) && ($ratio < 3.0)) return "#007700";
- if (($ratio >= 3.0) && ($ratio < 4.0)) return "#008800";
- if (($ratio >= 4.0) && ($ratio < 5.0)) return "#009900";
- if (($ratio >= 5.0) && ($ratio < 6.0)) return "#00aa00";
- if (($ratio >= 6.0) && ($ratio < 7.0)) return "#00bb00";
- if (($ratio >= 7.0) && ($ratio < 8.0)) return "#00cc00";
- if (($ratio >= 8.0) && ($ratio < 9.0)) return "#00dd00";
- if (($ratio >= 9.0) && ($ratio < 10.0)) return "#00ee00";
- if ($ratio >= 10) return "#00ff00";
- 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";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment