las7h0p3

global

Aug 5th, 2013
1,128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.35 KB | None | 0 0
  1. <?
  2.  
  3. $countries = array(
  4. ".UNKNOW" => "unknow.gif",
  5. ".LOCALHOST" => "jollyroger.gif",
  6. ".NET" => "jollyroger.gif",
  7. ".ORG" => "jollyroger.gif",
  8. ".CO"=>"uk.gif",
  9. ".CO.UK"=>"uk.gif",
  10. ".GB"=>"uk.gif",
  11. ".US"=>"usa.gif",
  12. ".BM"=>"bermuda.gif",
  13. ".SE"=>"sweden.gif",
  14. ".IT"=>"italy.gif",
  15. ".CA"=>"canada.gif",
  16. ".IN"=>"india.gif",
  17. ".CR"=>"costarica.gif",
  18. ".BO"=>"bolivia.gif",
  19. ".NL"=>"netherlands.gif",
  20. ".DE"=>"germany.gif",
  21. ".CH"=>"switzerland.gif",
  22. ".FR"=>"france.gif",
  23. ".IL"=>"israel.gif",
  24. ".ES"=>"spain.gif",
  25. ".CL"=>"chile.gif",
  26. ".BS"=>"bahamas.gif",
  27. ".AR"=>"argentina.gif",
  28. ".DM"=>"dominica.gif",
  29. ".BZ"=>"belize.gif",
  30. ".BR"=>"brazil.gif",
  31. ".JP"=>"japan.gif",
  32. ".AU"=>"australia.gif",
  33. ".KR"=>"southkorea.gif",
  34. ".CN"=>"china.gif",
  35. ".TW"=>"taiwan.gif",
  36. ".HK"=>"hongkong.gif",
  37. ".BD"=>"bangladesh.gif",
  38. ".SG"=>"singapore.gif",
  39. ".MY"=>"malaysia.gif",
  40. ".NZ"=>"newzealand.gif",
  41. ".ID"=>"indonesia.gif",
  42. ".PK"=>"pakistan.gif",
  43. ".BN"=>"brunei.gif",
  44. ".TH"=>"thailand.gif",
  45. ".PH"=>"philippines.gif",
  46. ".GR"=>"greece.gif",
  47. ".SA"=>"saudiarabia.gif",
  48. ".PL"=>"poland.gif",
  49. ".AT"=>"austria.gif",
  50. ".BE"=>"belgium.gif",
  51. ".IE"=>"ireland.gif",
  52. ".CZ"=>"czechrep.gif",
  53. ".RU"=>"russia.gif",
  54. ".KE"=>"kenya.gif",
  55. ".DK"=>"denmark.gif",
  56. ".EG"=>"egypt.gif",
  57. ".NO"=>"norway.gif",
  58. ".UA"=>"ukraine.gif",
  59. ".TJ"=>"tajikistan.gif",
  60. ".TR"=>"turkey.gif",
  61. ".IR"=>"iran.gif",
  62. ".GE"=>"georgia.gif",
  63. ".BY"=>"belarus.gif",
  64. ".AZ"=>"azerbaijan.gif",
  65. ".MA"=>"morocco.gif",
  66. ".IQ"=>"iraq.gif",
  67. ".AM"=>"armenia.gif",
  68. ".LB"=>"lebanon.gif",
  69. ".MD"=>"moldova.gif",
  70. ".BG"=>"bulgaria.gif",
  71. ".FI"=>"finland.gif",
  72. ".PT"=>"portugal.gif",
  73. ".CM"=>"cameroon.gif",
  74. ".GH"=>"ghana.gif",
  75. ".ZW"=>"zimbabwe.gif",
  76. ".CD"=>"demrepcongo.gif",
  77. ".MG"=>"madagascar.gif",
  78. ".CI"=>"ivorycoast.gif",
  79. ".BJ"=>"benin.gif",
  80. ".RW"=>"rwanda.gif",
  81. ".TG"=>"togo.gif",
  82. ".MZ"=>"mozambique.gif",
  83. ".GN"=>"guinea.gif",
  84. ".ZM"=>"zambia.gif",
  85. ".TZ"=>"tanzania.gif",
  86. ".NG"=>"nigeria.gif",
  87. ".SN"=>"senegal.gif",
  88. ".AO"=>"angola.gif",
  89. ".OM"=>"oman.gif",
  90. ".DZ"=>"algeria.gif",
  91. ".EE"=>"estonia.gif",
  92. ".SK"=>"slovakia.gif",
  93. ".LY"=>"libya.gif",
  94. ".JO"=>"jordan.gif",
  95. ".HU"=>"hungary.gif",
  96. ".KW"=>"kuwait.gif",
  97. ".LT"=>"lithuania.gif",
  98. ".LV"=>"latvia.gif",
  99. ".SZ"=>"swaziland.gif",
  100. ".SM"=>"sanmarino.gif",
  101. ".CS"=>"serbia.gif",
  102. ".KZ"=>"kazakhstan.gif",
  103. ".LU"=>"luxembourg.gif",
  104. ".AF"=>"afghanistan.gif",
  105. ".IS"=>"iceland.gif",
  106. ".CY"=>"cyprus.gif",
  107. ".MK"=>"macadonia.gif",
  108. ".MT"=>"malta.gif",
  109. ".ZA"=>"southafrica.gif",
  110. ".RO"=>"romania.gif",
  111. ".MW"=>"malawi.gif",
  112. ".SI"=>"slovenia.gif",
  113. ".MC"=>"monaco.gif",
  114. ".HT"=>"haiti.gif",
  115. ".SV"=>"elsalvado.gif",
  116. ".GU"=>"guam.gif",
  117. ".PR"=>"puertorico.gif",
  118. ".FM"=>"micronesia.gif",
  119. ".CO"=>"colombia.gif",
  120. ".UG"=>"uganda.gif",
  121. ".LR"=>"liberia.gif",
  122. ".EC"=>"ecuador.gif",
  123. ".MX"=>"mexico.gif",
  124. ".KY"=>"caymanislands.gif",
  125. ".PE"=>"peru.gif",
  126. ".GP"=>"guadeloupe.gif",
  127. ".AN"=>"nethantilles.gif",
  128. ".HN"=>"honduras.gif",
  129. ".SL"=>"sierraleone.gif",
  130. ".LC"=>"stlucia.gif",
  131. ".DO"=>"dominicanrep.gif",
  132. ".NI"=>"nicaragua.gif",
  133. ".GT"=>"guatemala.gif",
  134. ".TT"=>"trinidadandtobago.gif",
  135. ".AS"=>"westernsamoa.gif",
  136. ".LS"=>"lesotho.gif",
  137. ".JM"=>"jamaica.gif",
  138. ".VE"=>"venezuela.gif",
  139. ".BB"=>"barbados.gif",
  140. ".PA"=>"panama.gif",
  141. ".AG"=>"antiguabarbuda.gif",
  142. ".VI"=>"virginislands.gif",
  143. ".BA"=>"bosniaherzegovina.gif",
  144. ".MH"=>"marshallislands.gif",
  145. ".AE"=>"uae.gif",
  146. ".CU"=>"cuba.gif",
  147. ".CG"=>"congo.gif",
  148. ".PY"=>"paraguay.gif",
  149. ".SR"=>"suriname.gif",
  150. ".KN"=>"stkitts_nevis.gif",
  151. ".VG"=>"virginislands.gif",
  152. ".GI"=>"gibraltar.gif",
  153. ".UY"=>"uruguay.gif",
  154. ".MP"=>"northernmarianaislands.gif",
  155. ".MU"=>"mauritius.gif",
  156. ".TD"=>"chad.gif",
  157. ".LI"=>"liechtenstein.gif",
  158. ".FO"=>"faroeislands.gif",
  159. ".AL"=>"albania.gif",
  160. ".UZ"=>"uzbekistan.gif",
  161. ".SO"=>"somalia.gif",
  162. ".YE"=>"yemen.gif",
  163. ".MR"=>"mauritania.gif",
  164. ".GW"=>"guinea-bissau.gif",
  165. ".QA"=>"qatar.gif",
  166. ".KM"=>"comoros.gif",
  167. ".MN"=>"mongolia.gif",
  168. ".GA"=>"gabon.gif",
  169. ".HR"=>"croatia.gif",
  170. ".LA"=>"laos.gif",
  171. ".LK"=>"srilanka.gif",
  172. ".ML"=>"mali.gif",
  173. ".BI"=>"burundi.gif",
  174. ".SY"=>"syria.gif",
  175. ".TN"=>"tunisia.gif",
  176. ".NA"=>"namibia.gif",
  177. ".MQ"=>"martinique.gif",
  178. ".KG"=>"kyrgyzstan.gif",
  179. ".BH"=>"bahrain.gif",
  180. ".VA"=>"holysee(vaticancitystate.gif",
  181. ".PS"=>"palestinianterritory.gif",
  182. ".ET"=>"ethiopia.gif",
  183. ".FJ"=>"fiji.gif",
  184. ".MO"=>"macao.gif",
  185. ".BF"=>"burkinafaso.gif",
  186. ".NE"=>"niger.gif",
  187. ".PF"=>"frenchpolynesia.gif",
  188. ".PG"=>"papuanewguinea.gif",
  189. ".BW"=>"botswana.gif",
  190. ".SD"=>"sudan.gif",
  191. ".CF"=>"centralafricanrep.gif",
  192. ".DJ"=>"djibouti.gif",
  193. ".GQ"=>"eq_guinea.gif",
  194. ".TM"=>"turkmenistan.gif",
  195. ".RE"=>"reunion.gif",
  196. ".AD"=>"andorra.gif",
  197. ".GL"=>"greenland.gif",
  198. ".CV"=>"capeverde.gif",
  199. ".ST"=>"sao_tome.gif",
  200. ".FK"=>"falklandislands(malvinas.gif",
  201. ".VC"=>"grenadines.gif",
  202. ".GD"=>"grenada.gif",
  203. ".ER"=>"eritrea.gif",
  204. ".AW"=>"aruba.gif",
  205. ".GY"=>"guyana.gif",
  206. ".NC"=>"newcaledonia.gif",
  207. ".SB"=>"solomon_islands.gif",
  208. ".MV"=>"maldives.gif",
  209. ".TV"=>"tuvalu.gif",
  210. ".WS"=>"samoa.gif",
  211. ".VN"=>"vietnam.gif",
  212. ".KI"=>"kiribati.gif",
  213. ".IO"=>"britishindianoceanterritory.gif",
  214. ".KH"=>"cambodia.gif",
  215. ".NP"=>"nepal.gif",
  216. ".TO"=>"tonga.gif",
  217. ".CK"=>"cookislands.gif",
  218. ".SC"=>"seychelles.gif",
  219. ".NR"=>"nauru.gif",
  220. ".TL"=>"timor-leste.gif",
  221. ".TK"=>"tokelau.gif",
  222. ".VU"=>"vanuatu.gif",
  223. ".PW"=>"palau.gif",
  224. ".BT"=>"bhutan.gif",
  225. ".MM"=>"myanmar.gif",
  226. ".GM"=>"gambia.gif",
  227. ".GF"=>"frenchguiana.gif",
  228. ".TF"=>"frenchsouthernterritories.gif",
  229. );
  230.  
  231. $smilies = array(
  232. ":-)" => "smile1.gif",
  233. ":smile:" => "smile2.gif",
  234. ":-D" => "grin.gif",
  235. ":lol:" => "laugh.gif",
  236. ":w00t:" => "w00t.gif",
  237. ":-P" => "tongue.gif",
  238. ";-)" => "wink.gif",
  239. ":-|" => "noexpression.gif",
  240. ":-/" => "confused.gif",
  241. ":-(" => "sad.gif",
  242. ":'-(" => "cry.gif",
  243. ":weep:" => "weep.gif",
  244. ":-O" => "ohmy.gif",
  245. ":o)" => "clown.gif",
  246. "8-)" => "cool1.gif",
  247. "|-)" => "sleeping.gif",
  248. ":innocent:" => "innocent.gif",
  249. ":whistle:" => "whistle.gif",
  250. ":unsure:" => "unsure.gif",
  251. ":closedeyes:" => "closedeyes.gif",
  252. ":cool:" => "cool2.gif",
  253. ":fun:" => "fun.gif",
  254. ":thumbsup:" => "thumbsup.gif",
  255. ":thumbsdown:" => "thumbsdown.gif",
  256. ":blush:" => "blush.gif",
  257. ":unsure:" => "unsure.gif",
  258. ":yes:" => "yes.gif",
  259. ":no:" => "no.gif",
  260. ":love:" => "love.gif",
  261. ":?:" => "question.gif",
  262. ":!:" => "excl.gif",
  263. ":idea:" => "idea.gif",
  264. ":arrow:" => "arrow.gif",
  265. ":arrow2:" => "arrow2.gif",
  266. ":hmm:" => "hmm.gif",
  267. ":hmmm:" => "hmmm.gif",
  268. ":huh:" => "huh.gif",
  269. ":geek:" => "geek.gif",
  270. ":look:" => "look.gif",
  271. ":rolleyes:" => "rolleyes.gif",
  272. ":kiss:" => "kiss.gif",
  273. ":shifty:" => "shifty.gif",
  274. ":blink:" => "blink.gif",
  275. ":smartass:" => "smartass.gif",
  276. ":sick:" => "sick.gif",
  277. ":crazy:" => "crazy.gif",
  278. ":wacko:" => "wacko.gif",
  279. ":alien:" => "alien.gif",
  280. ":wizard:" => "wizard.gif",
  281. ":wave:" => "wave.gif",
  282. ":wavecry:" => "wavecry.gif",
  283. ":baby:" => "baby.gif",
  284. ":angry:" => "angry.gif",
  285. ":ras:" => "ras.gif",
  286. ":sly:" => "sly.gif",
  287. ":devil:" => "devil.gif",
  288. ":evil:" => "evil.gif",
  289. ":evilmad:" => "evilmad.gif",
  290. ":sneaky:" => "sneaky.gif",
  291. ":axe:" => "axe.gif",
  292. ":slap:" => "slap.gif",
  293. ":wall:" => "wall.gif",
  294. ":rant:" => "rant.gif",
  295. ":jump:" => "jump.gif",
  296. ":yucky:" => "yucky.gif",
  297. ":nugget:" => "nugget.gif",
  298. ":smart:" => "smart.gif",
  299. ":shutup:" => "shutup.gif",
  300. ":shutup2:" => "shutup2.gif",
  301. ":crockett:" => "crockett.gif",
  302. ":zorro:" => "zorro.gif",
  303. ":snap:" => "snap.gif",
  304. ":beer:" => "beer.gif",
  305. ":beer2:" => "beer2.gif",
  306. ":drunk:" => "drunk.gif",
  307. ":strongbench:" => "strongbench.gif",
  308. ":weakbench:" => "weakbench.gif",
  309. ":dumbells:" => "dumbells.gif",
  310. ":music:" => "music.gif",
  311. ":stupid:" => "stupid.gif",
  312. ":dots:" => "dots.gif",
  313. ":offtopic:" => "offtopic.gif",
  314. ":spam:" => "spam.gif",
  315. ":oops:" => "oops.gif",
  316. ":lttd:" => "lttd.gif",
  317. ":please:" => "please.gif",
  318. ":sorry:" => "sorry.gif",
  319. ":hi:" => "hi.gif",
  320. ":yay:" => "yay.gif",
  321. ":cake:" => "cake.gif",
  322. ":hbd:" => "hbd.gif",
  323. ":band:" => "band.gif",
  324. ":punk:" => "punk.gif",
  325. ":rofl:" => "rofl.gif",
  326. ":bounce:" => "bounce.gif",
  327. ":mbounce:" => "mbounce.gif",
  328. ":thankyou:" => "thankyou.gif",
  329. ":gathering:" => "gathering.gif",
  330. ":hang:" => "hang.gif",
  331. ":chop:" => "chop.gif",
  332. ":rip:" => "rip.gif",
  333. ":whip:" => "whip.gif",
  334. ":judge:" => "judge.gif",
  335. ":chair:" => "chair.gif",
  336. ":tease:" => "tease.gif",
  337. ":box:" => "box.gif",
  338. ":boxing:" => "boxing.gif",
  339. ":guns:" => "guns.gif",
  340. ":shoot:" => "shoot.gif",
  341. ":shoot2:" => "shoot2.gif",
  342. ":flowers:" => "flowers.gif",
  343. ":wub:" => "wub.gif",
  344. ":lovers:" => "lovers.gif",
  345. ":kissing:" => "kissing.gif",
  346. ":kissing2:" => "kissing2.gif",
  347. ":console:" => "console.gif",
  348. ":group:" => "group.gif",
  349. ":hump:" => "hump.gif",
  350. ":hooray:" => "hooray.gif",
  351. ":happy2:" => "happy2.gif",
  352. ":clap:" => "clap.gif",
  353. ":clap2:" => "clap2.gif",
  354. ":weirdo:" => "weirdo.gif",
  355. ":yawn:" => "yawn.gif",
  356. ":bow:" => "bow.gif",
  357. ":dawgie:" => "dawgie.gif",
  358. ":cylon:" => "cylon.gif",
  359. ":book:" => "book.gif",
  360. ":fish:" => "fish.gif",
  361. ":mama:" => "mama.gif",
  362. ":pepsi:" => "pepsi.gif",
  363. ":medieval:" => "medieval.gif",
  364. ":rambo:" => "rambo.gif",
  365. ":ninja:" => "ninja.gif",
  366. ":hannibal:" => "hannibal.gif",
  367. ":party:" => "party.gif",
  368. ":snorkle:" => "snorkle.gif",
  369. ":evo:" => "evo.gif",
  370. ":king:" => "king.gif",
  371. ":chef:" => "chef.gif",
  372. ":mario:" => "mario.gif",
  373. ":pope:" => "pope.gif",
  374. ":fez:" => "fez.gif",
  375. ":cap:" => "cap.gif",
  376. ":cowboy:" => "cowboy.gif",
  377. ":pirate:" => "pirate.gif",
  378. ":pirate2:" => "pirate2.gif",
  379. ":rock:" => "rock.gif",
  380. ":cigar:" => "cigar.gif",
  381. ":icecream:" => "icecream.gif",
  382. ":oldtimer:" => "oldtimer.gif",
  383. ":trampoline:" => "trampoline.gif",
  384. ":banana:" => "bananadance.gif",
  385. ":smurf:" => "smurf.gif",
  386. ":yikes:" => "yikes.gif",
  387. ":osama:" => "osama.gif",
  388. ":saddam:" => "saddam.gif",
  389. ":santa:" => "santa.gif",
  390. ":indian:" => "indian.gif",
  391. ":pimp:" => "pimp.gif",
  392. ":nuke:" => "nuke.gif",
  393. ":jacko:" => "jacko.gif",
  394. ":ike:" => "ike.gif",
  395. ":greedy:" => "greedy.gif",
  396. ":super:" => "super.gif",
  397. ":wolverine:" => "wolverine.gif",
  398. ":spidey:" => "spidey.gif",
  399. ":spider:" => "spider.gif",
  400. ":bandana:" => "bandana.gif",
  401. ":construction:" => "construction.gif",
  402. ":sheep:" => "sheep.gif",
  403. ":police:" => "police.gif",
  404. ":detective:" => "detective.gif",
  405. ":bike:" => "bike.gif",
  406. ":fishing:" => "fishing.gif",
  407. ":clover:" => "clover.gif",
  408. ":horse:" => "horse.gif",
  409. ":shit:" => "shit.gif",
  410. ":soldiers:" => "soldiers.gif",
  411. );
  412.  
  413. $privatesmilies = array(
  414. ":)" => "smile1.gif",
  415. // ";)" => "wink.gif",
  416. ":wink:" => "wink.gif",
  417. ":D" => "grin.gif",
  418. ":P" => "tongue.gif",
  419. ":(" => "sad.gif",
  420. ":'(" => "cry.gif",
  421. ":|" => "noexpression.gif",
  422. // "8)" => "cool1.gif", we don't want this as a smilie...
  423. ":Boozer:" => "alcoholic.gif",
  424. ":deadhorse:" => "deadhorse.gif",
  425. ":spank:" => "spank.gif",
  426. ":yoji:" => "yoji.gif",
  427. ":locked:" => "locked.gif",
  428. ":grrr:" => "angry.gif", // legacy
  429. "O:-" => "innocent.gif", // legacy
  430. ":sleeping:" => "sleeping.gif", // legacy
  431. "-_-" => "unsure.gif", // legacy
  432. ":clown:" => "clown.gif",
  433. ":mml:" => "mml.gif",
  434. ":rtf:" => "rtf.gif",
  435. ":morepics:" => "morepics.gif",
  436. ":rb:" => "rb.gif",
  437. ":rblocked:" => "rblocked.gif",
  438. ":maxlocked:" => "maxlocked.gif",
  439. ":hslocked:" => "hslocked.gif",
  440. );
  441.  
  442. function get_user_class_image($class)
  443. {
  444. switch ($class)
  445. {
  446. case UC_USER: return "pic/class/user.gif";
  447.  
  448. case UC_POWER_USER: return "pic/class/power.gif";
  449.  
  450. case UC_VIP: return "pic/class/vip.gif";
  451.  
  452. case UC_UPLOADER: return "pic/class/uploader.gif";
  453.  
  454. case UC_MODERATOR: return "pic/class/mod.gif";
  455.  
  456. case UC_SUPERVISOR: return "pic/class/supervisor.gif";
  457.  
  458. case UC_ADMINISTRATOR: return "pic/class/admin.gif";
  459.  
  460. case UC_CODER: return "pic/class/coder.gif";
  461.  
  462. case UC_SYSOP: return "pic/class/sysop.gif";
  463.  
  464. case UC_STAFFLEADER: return "pic/class/staffleader.gif";
  465. }
  466. return "";
  467. }
  468.  
  469. function get_percent_completed_image($p) {
  470. $maxpx = "100"; // Maximum amount of pixels for the progress bar
  471.  
  472. if ($p == 0) $progress = "<img src=\"/pic/progbar-rest.gif\" height=9 width=" . ($maxpx) . " />";
  473. if ($p == 100) $progress = "<img src=\"/pic/progbar-green.gif\" height=9 width=" . ($maxpx) . " />";
  474. 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)) . " />";
  475. 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)) . " />";
  476. 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)) . " />";
  477. return "<img src=\"/pic/bar_left.gif\" />" . $progress ."<img src=\"/pic/bar_right.gif\" />";
  478. }
  479.  
  480. //-------- Bad Word Filter
  481.  
  482. //////////////////// BAD WORD FUNCTION ////////////////////////
  483.  
  484. function word_fliter($content) {
  485. global $badwords, $wordreplace;
  486. $count = count($badwords);
  487. $countfilter = count($wordreplace);
  488. // Loop through the badwords array
  489. for ($n = 0; $n < $count; ++$n, next ($badwords)) {
  490. //Create random replace characters
  491. $x = 2;
  492. $y = rand(3,5);
  493. $filter = "";
  494. while ($x<="$y") {
  495. $f = rand(0,$countfilter-1);
  496. $filter .="$wordreplace[$f]";
  497. $x++;
  498. }
  499.  
  500. //Search for badwords in content
  501. $search = "$badwords[$n]";
  502. $content = preg_replace("'$search'i","$filter",$content);
  503.  
  504. }
  505. return $content;
  506. }
  507.  
  508. ////////////////// END BAD WORD FUNCTION
  509.  
  510. ///////////////// DEFINE BAD WORDS ARRAY ////////////////
  511.  
  512. $badwords = array (
  513. "asshole",
  514. "ass",
  515. "bitch",
  516. "bastard",
  517. "cunt",
  518. "dick",
  519. "dike",
  520. "dildo",
  521. "fuck",
  522. "gay",
  523. "hoe",
  524. "nigger",
  525. "pussy",
  526. "slut",
  527. "whore",
  528. "god damn",
  529. "goddamn"
  530. );
  531.  
  532. /////////////// CHARACTER ARRAY REPLACEMENT ///////////////
  533. $wordreplace = array (
  534. ".."
  535. );
  536.  
  537. ///////////// END DEFINE ARRAYS /////////////////////////
  538.  
  539. // Set this to the line break character sequence of your system
  540. $linebreak = "\r\n";
  541.  
  542. function get_row_count($table, $suffix = "")
  543. {
  544. if ($suffix)
  545. $suffix = " $suffix";
  546. ($r = mysql_query("SELECT COUNT(*) FROM $table$suffix")) or die(mysql_error());
  547. ($a = mysql_fetch_row($r)) or die(mysql_error());
  548. return $a[0];
  549. }
  550.  
  551. function stdmsg($heading, $text)
  552. {
  553. print("<table class=main width=750 border=0 cellpadding=0 cellspacing=0><tr><td class=embedded>\n");
  554. if ($heading)
  555. print("<h2>$heading</h2>\n");
  556. print("<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>\n");
  557. print($text . "</td></tr></table></td></tr></table>\n");
  558. }
  559.  
  560. function stderr($heading, $text)
  561. {
  562. stdhead();
  563. stdmsg($heading, $text);
  564. stdfoot();
  565. die;
  566. }
  567.  
  568. function sqlerr($file = '', $line = '')
  569. {
  570. print("<table border=0 bgcolor=blue align=left cellspacing=0 cellpadding=10 style='background: blue'>" .
  571. "<tr><td class=embedded><font color=white><h1>SQL Error</h1>\n" .
  572. "<b>" . mysql_error() . ($file != '' && $line != '' ? "<p>in $file, line $line</p>" : "") . "</b></font></td></tr></table>");
  573. die;
  574. }
  575.  
  576. // Returns the current time in GMT in MySQL compatible format.
  577. function get_date_time($timestamp = 0)
  578. {
  579. if ($timestamp)
  580. return date("Y-m-d H:i:s", $timestamp);
  581. else
  582. return gmdate("Y-m-d H:i:s");
  583. }
  584.  
  585. function auto_enter_cheater($userid, $rate, $upthis, $diff, $torrentid, $client, $ip, $last_up)
  586. {
  587. 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__);
  588. }
  589.  
  590. function encodehtml($s, $linebreaks = true)
  591. {
  592. $s = str_replace("<", "&lt;", str_replace("&", "&amp;", $s));
  593. if ($linebreaks)
  594. $s = nl2br($s);
  595. return $s;
  596. }
  597.  
  598. function get_dt_num()
  599. {
  600. return gmdate("YmdHis");
  601. }
  602.  
  603. function format_urls($s)
  604. {
  605. return preg_replace(
  606. "/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^<>\s]+)/i",
  607. "\\1<a href=redir.php?url=\\2>\\2</a>", $s);
  608. }
  609.  
  610. /*
  611.  
  612. // Removed this fn, I've decided we should drop the redir script...
  613. // it's pretty useless since ppl can still link to pics...
  614. // -Rb
  615.  
  616. function format_local_urls($s)
  617. {
  618. return preg_replace(
  619. "/(<a href=redir\.php\?url=)((http|ftp|https|ftps|irc):\/\/(www\.)?torrentbits\.(net|org|com)(:8[0-3])?([^<>\s]*))>([^<]+)<\/a>/i",
  620. "<a href=\\2>\\8</a>", $s);
  621. }
  622. */
  623.  
  624. //Finds last occurrence of needle in haystack
  625. //in PHP5 use strripos() instead of this
  626. function _strlastpos ($haystack, $needle, $offset = 0)
  627. {
  628. $addLen = strlen ($needle);
  629. $endPos = $offset - $addLen;
  630. while (true)
  631. {
  632. if (($newPos = strpos ($haystack, $needle, $endPos + $addLen)) === false) break;
  633. $endPos = $newPos;
  634. }
  635. return ($endPos >= 0) ? $endPos : false;
  636. }
  637.  
  638. function format_quotes($s)
  639. {
  640. preg_match_all('/\\[quote.*?\\]/', $s, $result, PREG_PATTERN_ORDER);
  641. $openquotecount = count($openquote = $result[0]);
  642. preg_match_all('/\\[\/quote\\]/', $s, $result, PREG_PATTERN_ORDER);
  643. $closequotecount = count($closequote = $result[0]);
  644.  
  645. if ($openquotecount != $closequotecount) return $s; // quote mismatch. Return raw string...
  646.  
  647. // Get position of opening quotes
  648. $openval = array();
  649. $pos = -1;
  650.  
  651. foreach($openquote as $val)
  652. $openval[] = $pos = strpos($s,$val,$pos+1);
  653.  
  654. // Get position of closing quotes
  655. $closeval = array();
  656. $pos = -1;
  657.  
  658. foreach($closequote as $val)
  659. $closeval[] = $pos = strpos($s,$val,$pos+1);
  660.  
  661.  
  662. for ($i=0; $i < count($openval); $i++)
  663. if ($openval[$i] > $closeval[$i]) return $s; // Cannot close before opening. Return raw string...
  664.  
  665.  
  666. $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);
  667. $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);
  668. $s = str_replace("[/quote]","</td></tr></table><br>",$s);
  669. return $s;
  670. }
  671.  
  672. function format_comment($text, $strip_html = true, $xssclean = false)
  673. {
  674. global $smilies, $privatesmilies, $CURUSER;
  675.  
  676. $s = $text;
  677.  
  678.  
  679. $s = str_replace(";)", ":wink:", $s);
  680.  
  681. if ($strip_html)
  682. $s = htmlspecialchars($s);
  683.  
  684.  
  685. // [you]
  686. $s = str_replace ("[you]", "$CURUSER[username]", $s);
  687.  
  688. // [*]
  689. $s = preg_replace("/\[\*\]/", "<li>", $s);
  690.  
  691. // [center]
  692. $s = preg_replace("/\[center\]((\s|.)+?)\[\/center\]/i", "<div align='center'><tt><nobr><font face='Verdana' style='font-size: 8pt; line-height: " .
  693. "8pt'>\\1</font></nobr></tt></div>", $s);
  694.  
  695. // villogу
  696. $s = preg_replace("/\[blink\]((\s|.)+?)\[\/blink\]/", "<blink>\\1</blink>", $s);
  697.  
  698. //[warning]Text[/warning]
  699. $s = preg_replace(
  700. "/\[warning\]\s*((\s|.)+?)\s*\[\/warning\]\s*/i",
  701. "<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);
  702.  
  703. //[align=(center|left|right|justify)]text[/align]
  704. $s = preg_replace("/\[align=([a-zA-Z]+)\]((\s|.)+?)\[\/align\]/i","<div style=\"text-align:\\1\">\\2</div>", $s);
  705.  
  706. //[s]strike[/s]
  707. $s = preg_replace("/\[s\]((\s|.)+?)\[\/s\]/i", "<s>\\1</s>", $s);
  708.  
  709. //[mail]mail[/mail]
  710. $s = preg_replace("/\[mail\]((\s|.)+?)\[\/mail\]/i","<a href=\"mailto:\\1\" targe=\"_blank\">\\1</a>", $s);
  711.  
  712. // [strike]бthъzott[/strike]
  713. $s = preg_replace("/\[strike\]((\s|.)+?)\[\/strike\]/", "<strike>\\1</strike>", $s);
  714.  
  715. // [b]Bold[/b]
  716. $s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\\1</b>", $s);
  717.  
  718. // [i]Italic[/i]
  719. $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\\1</i>", $s);
  720.  
  721. // [u]Underline[/u]
  722. $s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\\1</u>", $s);
  723.  
  724. //[spoiler]TEXT[/spoiler]
  725. $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);
  726. /*
  727. // [img]http://www/image.gif[/img]
  728. $s = preg_replace("/\[img\]([^\s'\"<>]+?)\[\/img\]/i", "<img border=0 src=\"\\1\">", $s);
  729.  
  730. // [img=http://www/image.gif]
  731. $s = preg_replace("/\[img=([^\s'\"<>]+?)\]/i", "<img border=0 src=\"\\1\">", $s);
  732. */
  733. // [img]http://www/image.gif[/img]
  734. $s = preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/i", "<img border=\"0\" src=\"\\1\" alt=\"\" onload=\"NcodeImageResizer.createOn(this);\">", $s);
  735.  
  736.  
  737. // [img=http://www/image.gif]
  738. $s = preg_replace("/\[img=(http:\/\/[^\s'\"<>]+(\.(gif|jpg|png)))\]/i", "<img border=\"0\" src=\"\\1\" alt=\"\" onload=\"NcodeImageResizer.createOn(this);\">", $s);
  739.  
  740. // [imgw]http://www/image.gif[/imgw]
  741. $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);
  742.  
  743. // [color=blue]Text[/color]
  744. $s = preg_replace(
  745. "/\[color=([a-zA-Z]+)\]((\s|.)+?)\[\/color\]/i",
  746. "<font color=\\1>\\2</font>", $s);
  747.  
  748. // [color=#ffcc99]Text[/color]
  749. $s = preg_replace(
  750. "/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/i",
  751. "<font color=\\1>\\2</font>", $s);
  752.  
  753. // [url=http://www.example.com]Text[/url]
  754. $s = preg_replace(
  755. "/\[url=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
  756. "<a target=_blank href=\"\\1\">\\2</a>", $s);
  757.  
  758. // [url]http://www.example.com[/url]
  759. $s = preg_replace(
  760. "/\[url\]([^()<>\s]+?)\[\/url\]/i",
  761. "<a target=_blank href=\"\\1\">\\1</a>", $s);
  762.  
  763.  
  764.  
  765.  
  766. // YouTube Vids
  767.  
  768. $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);
  769.  
  770.  
  771. //[spoiler]Text[/spoiler]
  772. $ab = 5000; // tуl
  773. $cd = 104857600; // ig
  774. $random = mt_rand($cd, $ab);
  775. $s = preg_replace("/\[spoiler\]\s*((\s|.)+?)\s*\[\/spoiler\]\s*/i",
  776. "<center><input type=button onClick='hirek($random)' value='Spoiler'></center>
  777. <div id='$random' style='display:none'>
  778. <table border=1 cellspacing=0 cellpadding=3>
  779. <td style='border: 1px black solid'><font color=#bbd7f3>\\1</font></td></table></div>
  780. ",$s);
  781.  
  782.  
  783.  
  784.  
  785. // [size=4]Text[/size]
  786. $s = preg_replace(
  787. "/\[size=([1-7])\]((\s|.)+?)\[\/size\]/i",
  788. "<font size=\\1>\\2</font>", $s);
  789.  
  790. // [font=Arial]Text[/font]
  791. $s = preg_replace(
  792. "/\[font=([a-zA-Z ,]+)\]((\s|.)+?)\[\/font\]/i",
  793. "<font face=\"\\1\">\\2</font>", $s);
  794.  
  795. // //[quote]Text[/quote]
  796. // $s = preg_replace(
  797. // "/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
  798. // "<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);
  799.  
  800. // //[quote=Author]Text[/quote]
  801. // $s = preg_replace(
  802. // "/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
  803. // "<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);
  804.  
  805. // Quotes
  806. $s = format_quotes($s);
  807.  
  808. // URLs
  809. $s = format_urls($s);
  810. // $s = format_local_urls($s);
  811.  
  812. // Linebreaks
  813. $s = nl2br($s);
  814.  
  815. // [pre]Preformatted[/pre]
  816. $s = preg_replace("/\[pre\]((\s|.)+?)\[\/pre\]/i", "<tt><nobr>\\1</nobr></tt>", $s);
  817.  
  818. // [nfo]NFO-preformatted[/nfo]
  819. $s = preg_replace("/\[nfo\]((\s|.)+?)\[\/nfo\]/i", "<tt><nobr><font face='MS Linedraw' size=2 style='font-size: 10pt; line-height: " .
  820. "10pt'>\\1</font></nobr></tt>", $s);
  821.  
  822. // Maintain spacing
  823. $s = str_replace(" ", " &nbsp;", $s);
  824.  
  825.  
  826. reset($smilies);
  827. while (list($code, $url) = each($smilies))
  828. $s = str_replace($code, "<img border=0 src=\"/pic/smilies/$url\" alt=\"" . htmlspecialchars($code) . "\">", $s);
  829.  
  830. //reset($countries);
  831. //while (list($code, $url) = each($countries))
  832. //$s = str_replace($code, "<img src=/pic/flag/$url>", $s);
  833.  
  834. reset($privatesmilies);
  835. while (list($code, $url) = each($privatesmilies))
  836. $s = str_replace($code, "<img border=0 src=\"/pic/smilies/$url\">", $s);
  837.  
  838. return $s;
  839. }
  840.  
  841. define ('UC_USER', 0);
  842. define ('UC_POWER_USER', 1);
  843. define ('UC_VIP', 2);
  844. define ('UC_UPLOADER', 3);
  845. define ('UC_MODERATOR', 4);
  846. define ('UC_ADMINISTRATOR', 5);
  847. define ('UC_SUPERVISOR', 6);
  848. define ('UC_CODER', 7);
  849. define ('UC_SYSOP', 8);
  850. define ('UC_STAFFLEADER', 9);
  851.  
  852. function get_user_class()
  853. {
  854. global $CURUSER;
  855. return $CURUSER["class"];
  856. }
  857.  
  858. function get_user_class_name($class)
  859. {
  860. switch ($class)
  861. {
  862. case UC_USER: return "User";
  863.  
  864. case UC_POWER_USER: return "Power User";
  865.  
  866. case UC_VIP: return "VIP";
  867.  
  868. case UC_UPLOADER: return "Uploader";
  869.  
  870. case UC_MODERATOR: return "Moderator";
  871.  
  872. case UC_SUPERVISOR: return "Supervisor";
  873.  
  874. case UC_ADMINISTRATOR: return "Administrator";
  875.  
  876. case UC_CODER: return "Coder";
  877.  
  878. case UC_SYSOP: return "SysOp";
  879.  
  880. case UC_STAFFLEADER: return "Staff Leader";
  881. }
  882. return "";
  883. }
  884.  
  885. function is_valid_user_class($class)
  886. {
  887. return is_numeric($class) && floor($class) == $class && $class >= UC_USER && $class <= UC_SYSOP;
  888. }
  889.  
  890. function is_valid_id($id)
  891. {
  892. return is_numeric($id) && ($id > 0) && (floor($id) == $id);
  893. }
  894.  
  895. function textbbcode($form,$text,$content="") {
  896. ?>
  897. <script type="text/javascript">
  898. function wrap(v,r,e)
  899. {
  900. var r = r ? r : "";
  901. var v = v ? v : "";
  902. var e = e ? e : "";
  903.  
  904. var obj = document.getElementById("<?=$text?>");
  905.  
  906. if (document.selection)
  907. {
  908. var str = document.selection.createRange().text;
  909. obj.focus();
  910. var sel = document.selection.createRange();
  911. sel.text = "["+v+(e ? "="+e : "")+"]" + (r ? r : str) + "[/"+v+"]";
  912. }
  913. else
  914. {
  915. var len = obj.value.length;
  916. var start = obj.selectionStart;
  917. var end = obj.selectionEnd;
  918. var sel = obj.value.substring(start, end);
  919. obj.value = obj.value.substring(0,start) + "[" + v +(e ? "="+e : "")+"]" + (r ? r : sel) + "[/" + v + "]" + obj.value.substring(end,len);
  920. obj.selectionEnd = start + v.length+e.length+sel.length+r.length+v.length+5;
  921.  
  922. }
  923. obj.focus();
  924. }
  925. function clink()
  926. {
  927. var linkTitle;
  928. var linkAddr;
  929.  
  930. linkAddr = prompt("Kйrlek mбsold be a teljes URL cнmet.","http://");
  931. if(linkAddr && linkAddr != "http://")
  932. linkTitle = prompt("Please enter the title", " ");
  933.  
  934. if(linkAddr && linkTitle)
  935. wrap('url',linkTitle,linkAddr);
  936.  
  937. }
  938. function cimage()
  939. {
  940. var link;
  941. link = prompt("Kйrlek mбsold be a kйp teljes URL cнmйt.\nHasznбlhatу kйpformбtumok .png, .jpg, .gif","http://");
  942. var re_text = /\.jpg|\.gif|\.png|\.jpeg/i;
  943. if(re_text.test(link) == false && link != "http://" && link) {
  944. alert("Image not allowed only .jpg .gif .png .jpeg");
  945. link = prompt("Please enter the full URL for your image\nOnly .png, .jpg, .gif images","http://");
  946. }
  947. if(link != "http://" && link)
  948. wrap('img',link,'');
  949.  
  950. }
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957. function colorpicker()
  958. {
  959. var link;
  960. link = prompt("Kйrlek mбsold be a kйp teljes URL cнmйt.\nHasznбlhatу kйpformбtumok .png, .jpg, .gif","http://");
  961. var re_text = /\.jpg|\.gif|\.png|\.jpeg/i;
  962. if(re_text.test(link) == false && link != "http://" && link) {
  963. alert("Image not allowed only .jpg .gif .png .jpeg");
  964. link = prompt("Please enter the full URL for your image\nOnly .png, .jpg, .gif images","http://");
  965. }
  966. if(link != "http://" && link)
  967. wrap('img',link,'');
  968.  
  969. }
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977. function tag(v)
  978. {
  979. wrap(v,'','');
  980. }
  981.  
  982.  
  983. function mail()
  984. {
  985. var email = "";
  986. email = prompt("Plese enter the email addres"," ");
  987. var filter = /^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/i;
  988. if (!filter.test(email) && email.length > 1) {
  989. alert("Please provide a valid email address");
  990. email = prompt("Plese enter the email addres"," ");
  991. }
  992. if(email.length > 1)
  993. wrap('mail',email,'');
  994. }
  995. function text(to)
  996. {
  997. var obj = document.getElementById("<?=$text?>");
  998.  
  999. if (document.selection)
  1000. {
  1001. var str = document.selection.createRange().text;
  1002. obj.focus();
  1003. var sel = document.selection.createRange();
  1004. sel.text = (to == 'up' ? str.toUpperCase() : str.toLowerCase())
  1005. }
  1006. else
  1007. {
  1008. var len = obj.value.length;
  1009. var start = obj.selectionStart;
  1010. var end = obj.selectionEnd;
  1011. var sel = obj.value.substring(start, end);
  1012. obj.value = obj.value.substring(0,start) + (to == 'up' ? sel.toUpperCase() : sel.toLowerCase()) + obj.value.substring(end,len);
  1013. }
  1014. obj.focus();
  1015.  
  1016. }
  1017. function fonts(w)
  1018. {
  1019. var fmin = 12; var fmax = 24;
  1020. var obj = document.getElementById("<?=$text?>");
  1021. var size = obj.style.fontSize;
  1022. size = (parseInt(size));
  1023. var nsize ;
  1024. if(w == 'up' && (size+1 < fmax))
  1025. nsize = (size+1)+"px";
  1026. if(w == 'down' && (size-1 > fmin))
  1027. nsize = (size-1)+"px";
  1028.  
  1029. obj.style.fontSize = nsize;
  1030. obj.focus();
  1031. }
  1032. function font(w,f)
  1033. {
  1034. if(w == 'color')
  1035. f = "#"+f;
  1036.  
  1037. var obj = document.getElementById("<?=$text?>");
  1038.  
  1039. if (document.selection)
  1040. {
  1041. var str = document.selection.createRange().text;
  1042. obj.focus();
  1043. var sel = document.selection.createRange();
  1044. sel.text = "["+w+"="+f +"]" + str + "[/"+w+"]";
  1045. }
  1046. else
  1047. {
  1048. var len = obj.value.length;
  1049. var start = obj.selectionStart;
  1050. var end = obj.selectionEnd;
  1051. var sel = obj.value.substring(start, end);
  1052. obj.value = obj.value.substring(0,start) + "[" + w +"="+f+"]" + sel + "[/" + w + "]" + obj.value.substring(end,len);
  1053. obj.selectionEnd = start + w.length+(1+f.length)+sel.length+w.length+5;
  1054. }
  1055. document.getElementById("font"+w).selectedIndex = 0;
  1056. obj.focus();
  1057. }
  1058. function em(f)
  1059. {
  1060. var obj = document.getElementById("<?=$text?>");
  1061.  
  1062. if (document.selection)
  1063. {
  1064. var str = document.selection.createRange().text;
  1065. obj.focus();
  1066. var sel = document.selection.createRange();
  1067. sel.text = f;
  1068. }
  1069. else
  1070. {
  1071. var len = obj.value.length;
  1072. var start = obj.selectionStart;
  1073. var end = obj.selectionEnd;
  1074. var sel = obj.value.substring(start, end);
  1075. obj.value = obj.value.substring(0,start) +f+ obj.value.substring(end,len);
  1076. obj.selectionEnd = start + f.length;
  1077. }
  1078. obj.focus();
  1079. }
  1080. function winop()
  1081. {
  1082. windop = window.open("moresmiles1.php?form=<?=$form?>&text=<?=$text?>","mywin","height=400,width=450,resizable=yes,scrollbars=yes");
  1083. }
  1084.  
  1085.  
  1086.  
  1087. </script>
  1088.  
  1089. <table width="0" cellpadding="2" class="bbcode" cellspacing="2">
  1090.  
  1091.  
  1092.  
  1093. <tr>
  1094. <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>
  1095. </tr>
  1096. <tr>
  1097. <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>
  1098. </tr>
  1099. <tr>
  1100. <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>
  1101. </tr>
  1102. <tr>
  1103. <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>
  1104. </tr>
  1105. <tr>
  1106. <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>
  1107. </tr>
  1108. <tr>
  1109. <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>
  1110. </tr>
  1111. <tr>
  1112. <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>
  1113. </tr>
  1114. <tr>
  1115. <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>
  1116. </tr>
  1117.  
  1118. </table>
  1119.  
  1120.  
  1121.  
  1122. <td><textarea id="<?=$text?>" name="<?=$text?>" style="width:310px; height:226px;font-size:12px;"><?=$content?></textarea></td>
  1123. <td align="center" valign="top">
  1124.  
  1125.  
  1126.  
  1127.  
  1128. <table width="0" cellpadding="2" class="bbcode" cellspacing="2" border="0">
  1129.  
  1130.  
  1131.  
  1132. <tr>
  1133. <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>
  1134. </tr>
  1135. <tr>
  1136. <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>
  1137. </tr>
  1138. <tr>
  1139. <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>
  1140. </tr>
  1141. <tr>
  1142. <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>
  1143. </tr>
  1144. <tr>
  1145. <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>
  1146. </tr>
  1147. <tr>
  1148. <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>
  1149. </tr>
  1150. <tr>
  1151. <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>
  1152. </tr>
  1153. <tr>
  1154. <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>
  1155. </tr>
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169. </table>
  1170. </td>
  1171.  
  1172.  
  1173. </tr>
  1174. </table>
  1175.  
  1176. <?
  1177. }
  1178.  
  1179. //-------- Begins a main frame
  1180.  
  1181. function begin_main_frame()
  1182. {
  1183. print("<table class=main width=750 border=0 cellspacing=0 cellpadding=0>" .
  1184. "<tr><td class=embedded>\n");
  1185. }
  1186.  
  1187. //-------- Ends a main frame
  1188.  
  1189. function end_main_frame()
  1190. {
  1191. print("</td></tr></table>\n");
  1192. }
  1193.  
  1194. function begin_frame($caption = "", $center = false, $padding = 10)
  1195. {
  1196. $tdextra = "";
  1197.  
  1198. if ($caption)
  1199. print("<h2>$caption</h2>\n");
  1200.  
  1201. if ($center)
  1202. $tdextra .= " align=center";
  1203.  
  1204. print("<table width=100% border=1 cellspacing=0 cellpadding=$padding><tr><td$tdextra>\n");
  1205.  
  1206. }
  1207.  
  1208. function attach_frame($padding = 10)
  1209. {
  1210. print("</td></tr><tr><td style='border-top: 0px'>\n");
  1211. }
  1212.  
  1213. function end_frame()
  1214. {
  1215. print("</td></tr></table>\n");
  1216. }
  1217.  
  1218. function begin_table($fullwidth = false, $padding = 5)
  1219. {
  1220. $width = "";
  1221.  
  1222. if ($fullwidth)
  1223. $width .= " width=100%";
  1224. print("<table class=main$width border=1 cellspacing=0 cellpadding=$padding>\n");
  1225. }
  1226.  
  1227. function end_table()
  1228. {
  1229. print("</td></tr></table>\n");
  1230. }
  1231.  
  1232. //-------- Inserts a smilies frame
  1233. // (move to globals)
  1234.  
  1235. function insert_smilies_frame()
  1236. {
  1237. global $smilies, $BASEURL;
  1238.  
  1239. begin_frame("Smilies", true);
  1240.  
  1241. begin_table(false, 5);
  1242.  
  1243. print("<tr><td class=colhead>Type...</td><td class=colhead>To make a...</td></tr>\n");
  1244.  
  1245. while (list($code, $url) = each($smilies))
  1246. print("<tr><td>$code</td><td><img src=$BASEURL/pic/smilies/$url></td>\n");
  1247.  
  1248. end_table();
  1249.  
  1250. end_frame();
  1251. }
  1252.  
  1253. function insert_countries_frame()
  1254. {
  1255. global $countries, $BASEURL;
  1256.  
  1257. print("<legend>Countries</legend>\n");
  1258.  
  1259. begin_table(false, 5);
  1260.  
  1261. print("<tr><td class=colhead>Type...</td><td class=colhead>To make a...</td></tr>\n");
  1262.  
  1263. while (list($code, $url) = each($countries))
  1264. print("<tr><td>$code</td><td><img src=$BASEURL/pic/flag/$url></td>\n");
  1265.  
  1266. end_table();
  1267.  
  1268.  
  1269. }
  1270.  
  1271.  
  1272. function sql_timestamp_to_unix_timestamp($s)
  1273. {
  1274. 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));
  1275. }
  1276.  
  1277. function get_ratio_color($ratio)
  1278. {
  1279. if ($ratio < 0.1) return "#ff0000";
  1280. if ($ratio < 0.2) return "#ee0000";
  1281. if ($ratio < 0.3) return "#dd0000";
  1282. if ($ratio < 0.4) return "#cc0000";
  1283. if ($ratio < 0.5) return "#bb0000";
  1284. if ($ratio < 0.6) return "#aa0000";
  1285. if ($ratio < 0.7) return "#990000";
  1286. if ($ratio < 0.8) return "#880000";
  1287. if ($ratio < 0.9) return "#770000";
  1288. if ($ratio < 1) return "#660000";
  1289. if (($ratio >= 1.0) && ($ratio < 2.0)) return "#006600";
  1290. if (($ratio >= 2.0) && ($ratio < 3.0)) return "#007700";
  1291. if (($ratio >= 3.0) && ($ratio < 4.0)) return "#008800";
  1292. if (($ratio >= 4.0) && ($ratio < 5.0)) return "#009900";
  1293. if (($ratio >= 5.0) && ($ratio < 6.0)) return "#00aa00";
  1294. if (($ratio >= 6.0) && ($ratio < 7.0)) return "#00bb00";
  1295. if (($ratio >= 7.0) && ($ratio < 8.0)) return "#00cc00";
  1296. if (($ratio >= 8.0) && ($ratio < 9.0)) return "#00dd00";
  1297. if (($ratio >= 9.0) && ($ratio < 10.0)) return "#00ee00";
  1298. if ($ratio >= 10) return "#00ff00";
  1299. return "#000000";
  1300. }
  1301.  
  1302. function get_slr_color($ratio)
  1303. {
  1304. if ($ratio < 0.025) return "#ff0000";
  1305. if ($ratio < 0.05) return "#ee0000";
  1306. if ($ratio < 0.075) return "#dd0000";
  1307. if ($ratio < 0.1) return "#cc0000";
  1308. if ($ratio < 0.125) return "#bb0000";
  1309. if ($ratio < 0.15) return "#aa0000";
  1310. if ($ratio < 0.175) return "#990000";
  1311. if ($ratio < 0.2) return "#880000";
  1312. if ($ratio < 0.225) return "#770000";
  1313. if ($ratio < 0.25) return "#660000";
  1314. if ($ratio < 0.275) return "#550000";
  1315. if ($ratio < 0.3) return "#440000";
  1316. if ($ratio < 0.325) return "#330000";
  1317. if ($ratio < 0.35) return "#220000";
  1318. if ($ratio < 0.375) return "#110000";
  1319. return "#000000";
  1320. }
  1321.  
  1322. function write_log($text)
  1323. {
  1324. $text = sqlesc($text);
  1325. $added = sqlesc(get_date_time());
  1326. mysql_query("INSERT INTO sitelog (added, txt) VALUES($added, $text)") or sqlerr(__FILE__, __LINE__);
  1327. }
  1328.  
  1329. function get_elapsed_time($ts)
  1330. {
  1331. $mins = floor((gmtime() - $ts) / 60);
  1332. $hours = floor($mins / 60);
  1333. $mins -= $hours * 60;
  1334. $days = floor($hours / 24);
  1335. $hours -= $days * 24;
  1336. $weeks = floor($days / 7);
  1337. $days -= $weeks * 7;
  1338. $t = "";
  1339. if ($weeks > 0)
  1340. return "$weeks week" . ($weeks > 1 ? "s" : "");
  1341. if ($days > 0)
  1342. return "$days day" . ($days > 1 ? "s" : "");
  1343. if ($hours > 0)
  1344. return "$hours hour" . ($hours > 1 ? "s" : "");
  1345. if ($mins > 0)
  1346. return "$mins min" . ($mins > 1 ? "s" : "");
  1347. return "< 1 min";
  1348. }
  1349.  
  1350. ?>
Advertisement
Add Comment
Please, Sign In to add comment