Просмотр файла inc/funcs.php

Размер файла: 4.3Kb
  1. <?
  2. function bbcodex($text){
  3. $text=preg_replace('#\[url\=http://(.*)\](.*)\[/url\]#Ui','<a href="http://\\1">\\2</a>',$text);//для ссылок
  4. $text=preg_replace('#\[u](.*)\[\/u\]#Ui','<u>\\1</u>',$text);//Подчеркнутый текст
  5. $text=preg_replace('#\[i](.*)\[\/i\]#Ui','<i>\\1</i>',$text);
  6. $text=preg_replace('#\[b](.*)\[\/b\]#Ui','<b>\\1</b>',$text);
  7. $text=preg_replace('#\[big](.*)\[\/big\]#Ui','<big>\\1</big>',$text);//Большой
  8. $text=preg_replace('#\[col\=(\#[0-9A-F]{3,6}|[a-z\-]+)\](.*)\[/col\]#Ui', '<font color="\\1">\\2</font>', $text);//для цветов
  9. return($text);
  10. }
  11. function smilex($text){
  12. $text=str_replace(':acute:', '<img src="/smile/acute.gif" alt=":acute:">',$text);
  13. $text=str_replace(':blush2:', '<img src="/smile/blush2.gif" alt=":blush2:">',$text);
  14. $text=str_replace(':aggressive:', '<img src="/smile/aggressive.gif" alt=":agressive:">',$text);
  15. $text=str_replace(':agree:', '<img src="/smile/agree.gif" alt=":agree:">',$text);
  16. $text=str_replace(':air_kiss:', '<img src="/smile/air_kiss.gif" alt=":air_kiss:">',$text);
  17. $text=str_replace(':beee:', '<img src="/smile/beee.gif" alt=":beee:">',$text);
  18. $text=str_replace(':black_eye:', '<img src="/smile/black_eye.gif" alt=":black_eye:">',$text);
  19. $text=str_replace(':blum2:', '<img src="/smile/blum2.gif" alt=":blum2:">',$text);
  20. $text=str_replace(':blum3:', '<img src="/smile/blum3.gif" alt=":blum3:">',$text);
  21. $text=str_replace(':blush2:', '<img src="/smile/blush2.gif" alt=":blush2:">',$text);
  22. $text=str_replace(':blush:', '<img src="/smile/blush.gif" alt=":blush:">',$text);
  23. $text=str_replace(':boast:', '<img src="/smile/boast.gif" alt=":boast:">',$text);
  24. $text=str_replace(':boredom:', '<img src="/smile/boredom.gif" alt=":boredom:">',$text);
  25. $text=str_replace(':censored:', '<img src="/smile/censored.gif" alt=":censored:">',$text);
  26. $text=str_replace(':clapping:', '<img src="/smile/clapping.gif" alt=":clapping:">',$text);
  27. $text=str_replace(':cray:', '<img src="/smile/cray.gif" alt=":cray:">',$text);
  28. $text=str_replace(':clapping:', '<img src="/smile/clapping.gif" alt=":clapping:">',$text);
  29. $text=str_replace(':dance2:', '<img src="/smile/dance2.gif" alt=":dance2:">',$text);
  30. $text=str_replace(':dance3:', '<img src="/smile/dance3.gif" alt=":dance3:">',$text);
  31. $text=str_replace(':dance4:', '<img src="/smile/dance4.gif" alt=":dance4:">',$text);
  32. $text=str_replace(':dance:', '<img src="/smile/dance.gif" alt=":dance:">',$text);
  33. $text=str_replace(':declare:', '<img src="/smile/declare.gif" alt=":declare:">',$text);
  34. $text=str_replace(':derisive:', '<img src="/smile/derisive.gif" alt=":derisive:">',$text);
  35. $text=str_replace(':dirol:', '<img src="/smile/dirol.gif" alt=":dirol:">',$text);
  36. $text=str_replace(':dntknw:', '<img src="/smile/dntknw.gif" alt=":dntknw:">',$text);
  37. $text=str_replace(':don-t_mention:', '<img src="/smile/don-t_mention.gif" alt=":don-t_mention:">',$text);
  38. $text=str_replace(':drinks.gif:', '<img src="/smile/drinks.gif" alt=":drinks:">',$text);
  39. $text=str_replace(':fool:', '<img src="/smile/fool.gif" alt=":fool:">',$text);
  40. $text=str_replace(':friends:', '<img src="/smile/friends.gif" alt=":friends:">',$text);
  41. $text=str_replace(':good2:', '<img src="/smile/good2.gif" alt=":good2:">',$text);
  42. $text=str_replace(':good3:', '<img src="/smile/good3.gif" alt=":good3.:">',$text);
  43. $text=str_replace(':good:', '<img src="/smile/good.gif" alt=":good:">',$text);
  44. $text=str_replace(':grin:', '<img src="/smile/grin.gif" alt=":grin:">',$text);
  45. $text=str_replace(':heat:', '<img src="/smile/heat.gif" alt=":heat:">',$text);
  46. $text=str_replace(':help:', '<img src="/smile/help.gif" alt=":help:">',$text);
  47. $text=str_replace(':i-m_so_happy:', '<img src="/smile/i-m_so_happy.gif" alt=":i-m_so_happy:">',$text);
  48. $text=str_replace(':ireful1:', '<img src="/smile/ireful1.gif" alt=":ireful1:">',$text);
  49. $text=str_replace(':ireful2:', '<img src="/smile/ireful2.gif" alt=":ireful2:">',$text);
  50. $text=str_replace(':laugh1:', '<img src="/smile/laugh1.gif" alt=":laugh1:">',$text);
  51. $text=str_replace(':bad:', '<img src="/smile/bad.gif" alt=":bad:">',$text);
  52. return($text);
  53. }
  54. function filtrx($text){
  55. $text=htmlspecialchars(trim($text));
  56. $text=stripslashes($text);
  57. $text=str_replace("alert","_",$text);
  58. $text=str_replace("%","pr",$text);
  59. $text=str_replace("<","",$text);
  60. $text=str_replace(">","",$text);
  61. $text=str_replace("script","",$text);
  62. $text=mysql_real_escape_string($text);
  63. return($text);
  64. }
  65. ?>