login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > UBB & Smilies > UBB script

UBB script

Auteur: cowbeast - 04 september 2004 - 15:07 - Gekeurd door: Dennisvb - Hits: 16025 - Aantal punten: 3.26 (17 stemmen)




Hellooow

Ik weer!!! Ik heb een ubb scriptje gemaakt dat overal toepasbaar is!! Het bestaat uit een extern ubb paginatje en een uitgebrijd java script stukje!
Het is zeer eenvoudig aan te passen!!
Hier kan je de smilys downloaden!!

http://cowbeast...mileys.zip

Veel suc6
Greetz Mathieu!!

EDIT: Sorry ik ben iets vergeten zeggen je formulier moet ook een bepaalde naam hebben! name="frmPost" tenzij je een andere wilt dan moet je dat aanpassen in het deeltje javascript!

Code:
ubb.php
--------------------

  1. <?
  2. $bericht = htmlspecialchars($bericht);
  3. $bericht = str_replace("\n","<br>",$bericht);
  4.  
  5. //smilies
  6.  
  7. $bericht = str_replace(":d", "<img src=\"smileys/emotie1.gif\">", $bericht);
  8. $bericht = str_replace(":|", "<img src=\"smileys/emotie3.gif\">", $bericht);
  9. $bericht = str_replace("(h)", "<img src=\"smileys/emotie5.gif\">", $bericht);
  10. $bericht = str_replace("(6)", "<img src=\"smileys/emotie7.gif\">", $bericht);
  11. $bericht = str_replace("(h2)", "<img src=\"smileys/emotie9.gif\">", $bericht);
  12. $bericht = str_replace(":X", "<img src=\"smileys/emotie11.gif\">", $bericht);
  13. $bericht = str_replace(",)", "<img src=\"smileys/emotie13.gif\">", $bericht);
  14. $bericht = str_replace(":/", "<img src=\"smileys/emotie15.gif\">", $bericht);
  15. $bericht = str_replace(":!s", "<img src=\"smileys/emotie17.gif\">", $bericht);
  16. $bericht = str_replace(":!/", "<img src=\"smileys/emotie28.gif\">", $bericht);
  17. $bericht = str_replace("<)", "<img src=\"smileys/happy.gif.gif\">", $bericht);
  18. $bericht = str_replace(":!|", "<img src=\"smileys/icon9.gif\">", $bericht);
  19. $bericht = str_replace("<d", "<img src=\"smileys/laugh.gif\">", $bericht);
  20. $bericht = str_replace(":-|", "<img src=\"smileys/mellow.gif\">", $bericht);
  21. $bericht = str_replace(":o", "<img src=\"smileys/ohmy.gif\">", $bericht);
  22. $bericht = str_replace(":!)", "<img src=\"smileys/rolleyes.gif\">", $bericht);
  23. $bericht = str_replace(">|", "<img src=\"smileys/sleep.gif\">", $bericht);
  24. $bericht = str_replace("8-)", "<img src=\"smileys/unsure.gif\">", $bericht);
  25. $bericht = str_replace(";)", "<img src=\"smileys/wink.gif\">", $bericht);
  26. $bericht = str_replace("(?)", "<img src=\"smileys/vraag.gif\">", $bericht);
  27. $bericht = str_replace("(off)", "<img src=\"smileys/offtopic.gif\">", $bericht);
  28. $bericht = str_replace("(8)", "<img src=\"smileys/emotie2.gif\">", $bericht);
  29. $bericht = str_replace("8!|", "<img src=\"smileys/emotie4.gif\">", $bericht);
  30. $bericht = str_replace(";!s", "<img src=\"smileys/emotie6.gif\">", $bericht);
  31. $bericht = str_replace("0)", "<img src=\"smileys/emotie8.gif\">", $bericht);
  32. $bericht = str_replace(":!!/", "<img src=\"smileys/emotie10.gif\">", $bericht);
  33. $bericht = str_replace(":°", "<img src=\"smileys/emotie12.gif\">", $bericht);
  34. $bericht = str_replace("x)", "<img src=\"smileys/emotie14.gif\">", $bericht);
  35. $bericht = str_replace("x'", "<img src=\"smileys/emotie16.gif\">", $bericht);
  36. $bericht = str_replace(":-0", "<img src=\"smileys/emotie18.gif\">", $bericht);
  37. $bericht = str_replace(":p", "<img src=\"smileys/emotie38.gif\">", $bericht);
  38. $bericht = str_replace("(n)", "<img src=\"smileys/huh.gif\">", $bericht);
  39. $bericht = str_replace("(!)", "<img src=\"smileys/icon13.gif\">", $bericht);
  40. $bericht = str_replace(":(", "<img src=\"smileys/mad.gif\">", $bericht);
  41. $bericht = str_replace("(f)", "<img src=\"smileys/middelv2.gif\">", $bericht);
  42. $bericht = str_replace("(-)", "<img src=\"smileys/ph34r.gif\">", $bericht);
  43. $bericht = str_replace("*(", "<img src=\"smileys/sad.gif\">", $bericht);
  44. $bericht = str_replace(":)", "<img src=\"smileys/smile.gif\">", $bericht);
  45. $bericht = str_replace(":s", "<img src=\"smileys/wacko.gif\">", $bericht);
  46. $bericht = str_replace("(l)", "<img src=\"smileys/wub.gif\">", $bericht);
  47. $bericht = str_replace("(lh)", "<img src=\"smileys/hard.gif\">", $bericht);
  48.  
  49. //opmaak
  50. $bericht = eregi_replace("\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]","<font color=\"\\1\">\\2</font>",$bericht);
  51. $bericht = eregi_replace("\\[size=([^\\[]*)\\]([^\\[]*)\\[/size\\]","<font size=\"\\1\">\\2</font>",$bericht);
  52. $bericht = eregi_replace("\\[align=([^\\[]*)\\]([^\\[]*)\\[/align\\]","<div align=\"\\1\">\\2</div>",$bericht);
  53. $bericht = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\2</a>",$bericht);
  54. $bericht = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\\1 target=_blank>\\2</a>",$bericht);
  55. $bericht = eregi_replace("\[quote\]","<b style='font-size: 8pt'>Quote:</b><hr>",$bericht);
  56. $bericht = eregi_replace('\[quote=([[:alnum:]]+)\]', "<b style='font-size: 8pt'>Quote (\\1):</b><hr>",$bericht);
  57. $bericht = eregi_replace("\[/quote\]","<br /><hr>",$bericht);
  58. $bericht = preg_replace("_\[code\](.*?)\[/code\]_ise", "colorcoding('\\1')", $bericht);
  59.  
  60. $bericht = str_replace("[b]","<b>",$bericht);
  61. $bericht = str_replace("[/b]","</b>",$bericht);
  62. $bericht = str_replace("[i]","<i>",$bericht);
  63. $bericht = str_replace("[/i]","</i>",$bericht);
  64. $bericht = str_replace("[u]","<u>",$bericht);
  65. $bericht = str_replace("[/u]","</u>",$bericht);
  66. $bericht = str_replace("[left]","<div align=\"left\">",$bericht);
  67. $bericht = str_replace("[/left]","<div>",$bericht);
  68. $bericht = str_replace("[center]","<center>",$bericht);
  69. $bericht = str_replace("[/center]","</center>",$bericht);
  70. $bericht = str_replace("[right]","<div align=\"right\">",$bericht);
  71. $bericht = str_replace("[/right]","<div>",$bericht);
  72.  
  73. //woordfilter
  74. $bericht = str_replace("fuck","<font color=\"#FF0000\">***</font>",$bericht);
  75. $bericht = str_replace("shit","<font color=\"#FF0000\">***</font>",$bericht);
  76. $bericht = str_replace("dick","<font color=\"#FF0000\">***</font>",$bericht);
  77. $bericht = str_replace("suck","<font color=\"#FF0000\">***</font>",$bericht);
  78. $bericht = str_replace("cum","<font color=\"#FF0000\">***</font>",$bericht);
  79. $bericht = str_replace("blowjob","<font color=\"#FF0000\">***</font>",$bericht);
  80. $bericht = str_replace("pik","<font color=\"#FF0000\">***</font>",$bericht);
  81. $bericht = str_replace("kut","<font color=\"#FF0000\">***</font>",$bericht);
  82. $bericht = str_replace("lul","<font color=\"#FF0000\">***</font>",$bericht);
  83. $bericht = str_replace("eikel","<font color=\"#FF0000\">***</font>",$bericht);
  84. $bericht = str_replace("klootzak","<font color=\"#FF0000\">***</font>",$bericht);
  85. $bericht = str_replace("dyke","<font color=\"#FF0000\">***</font>",$bericht);
  86. $bericht = str_replace("asshole","<font color=\"#FF0000\">***</font>",$bericht);
  87. $bericht = str_replace("hoer","<font color=\"#FF0000\">***</font>",$bericht);
  88. $bericht = str_replace("slet","<font color=\"#FF0000\">***</font>",$bericht);
  89. $bericht = str_replace("teef","<font color=\"#FF0000\">***</font>",$bericht);
  90. $bericht = str_replace("bitch","<font color=\"#FF0000\">***</font>",$bericht);
  91.  
  92. ?>


Het gedeelte dat in de pagina komt!
---------------------------------------------

Stukje java script:
  1. <script language="javascript">
  2. function setCursor()
  3. {
  4. if(document.frmPost.bericht.createTextRange)
  5. {
  6. document.frmPost.bericht.caretPos = document.selection.createRange().duplicate();
  7. }
  8. }
  9.  
  10. function ubb(begin,eind,opmaak)
  11. {
  12. if(!eind && !opmaak)
  13. {
  14. if(document.frmPost.bericht.createTextRange && document.frmPost.bericht.caretPos)
  15. {
  16. document.frmPost.bericht.caretPos.text = begin;
  17. }
  18. }
  19.  
  20. else if(opmaak == "dubbel")
  21. {
  22. var selectie = document.selection.createRange().text;
  23. if(!selectie)
  24. {
  25. var url_deel = prompt("Typ hier de/het "+ begin +" die/dat geplaatst moet worden:","");
  26. var tekst_deel = prompt("Typ hier de tekst die geplaatst moet worden:","");
  27. if(url_deel && tekst_deel)
  28. {
  29. document.frmPost.bericht.caretPos.text = "["+begin+"="+url_deel+"]" + tekst_deel + "[/"+eind+"]";
  30. }
  31. }
  32.  
  33. if(selectie)
  34. {
  35. var url_deel = prompt("Typ hier de url die geplaatst moet worden:","");
  36. if(url_deel)
  37. {
  38. document.selection.createRange().text = "["+begin+"="+url_deel+"]" + selectie + "[/"+eind+"]";
  39. }
  40. }
  41. }
  42.  
  43. else
  44. {
  45. if(opmaak != "geen")
  46. {
  47. var selectie = document.selection.createRange().text;
  48. if(!selectie)
  49. {
  50. var new_inhoud = prompt("Typ hier de tekst in waarrond "+begin+" & "+eind+" geplaatst moet worden:","");
  51. if(new_inhoud)
  52. {
  53. document.frmPost.bericht.caretPos.text = begin + new_inhoud + eind;
  54. }
  55. }
  56.  
  57. if(selectie)
  58. {
  59. document.selection.createRange().text = begin + selectie + eind;
  60. }
  61. }
  62. }
  63.  
  64. document.frmPost.bericht.focus();
  65. return;
  66. }
  67. </script>


Voor het invoegen van de smilys:
  1. <table width="466" border="0" cellpadding="1" cellspacing="0">
  2. <tr>
  3. <td colspan="21" align="center">
  4. <img src='smileys/left.gif' width="20" height="20" onclick="ubb('[left]','[/left]','URL invoegen');">
  5. <img src='smileys/center.gif' width="20" height="20" onclick="ubb('[center]','[/center]','URL invoegen');">
  6. <img src='smileys/right.gif' width="20" height="20" onclick="ubb('[right]','[/right]','URL invoegen');">
  7. <img src='smileys/b.gif' width="20" height="20" onclick="ubb('[b]','[/b]','URL invoegen');"><img src='smileys/i.gif' width="20" height="20" onclick="ubb('[i]','[/i]','URL invoegen');"><img src='smileys/u.gif' width="20" height="20" onclick="ubb('[u]','[/u]','URL invoegen');">
  8. </td>
  9. </tr>
  10. <tr>
  11. <td width="20" height="31"><img src="smileys/emotie1.gif" width="20" height="20" onclick="ubb(':d');"></td>
  12. <td width="20"><img src="smileys/emotie3.gif" width="20" height="20" onclick="ubb(':|');"></td>
  13. <td width="20"><img src="smileys/emotie5.gif" width="20" height="20" onclick="ubb('(h)');"></td>
  14. <td width="20"><img src="smileys/emotie7.gif" width="19" height="19" onclick="ubb('(6)');"></td>
  15. <td width="20"><img src="smileys/emotie9.gif" width="20" height="20" onclick="ubb('(h2)');"></td>
  16. <td width="20"><img src="smileys/emotie11.gif" width="20" height="20" onclick="ubb(':X');"></td>
  17. <td width="20"><img src="smileys/emotie13.gif" width="20" height="20" onclick="ubb(',)');"></td>
  18. <td width="20"><img src="smileys/emotie15.gif" width="20" height="20" onclick="ubb(':/');"></td>
  19. <td width="20"><img src="smileys/emotie17.gif" width="18" height="18" onclick="ubb(':!s');"></td>
  20. <td width="16"><img src="smileys/emotie28.gif" width="20" height="20" onclick="ubb(':!/');"></td>
  21. <td width="22"><img src="smileys/happy.gif" width="20" height="20" onclick="ubb('<)');"></td>
  22. <td width="14"><img src="smileys/icon9.gif" width="19" height="19" onclick="ubb(':!|');"></td>
  23. <td width="14"><img src="smileys/laugh.gif" width="20" height="20" onclick="ubb('<d');"></td>
  24. <td width="14"><img src="smileys/mellow.gif" width="20" height="20" onclick="ubb(':-|');"></td>
  25. <td width="14"><img src="smileys/ohmy.gif" width="20" height="20" onclick="ubb(':o');"></td>
  26. <td width="14"><img src="smileys/rolleyes.gif" width="20" height="20" onclick="ubb(':!)');"></td>
  27. <td width="14"><img src="smileys/sleep.gif" width="20" height="20" onclick="ubb('>|');"></td>
  28. <td width="14"><img src="smileys/unsure.gif" width="20" height="20" onclick="ubb('8-)');"></td>
  29. <td width="14"><img src="smileys/wink.gif" width="20" height="20" onclick="ubb(';)');"></td>
  30. <td><img src="smileys/vraag.gif" width="20" height="20" onclick="ubb('(?)');"></td>
  31. <td width="82" rowspan="2"><img src="smileys/offtopic.gif" width="47" height="51" onclick="ubb('(off)');"></td>
  32. </tr>
  33. <tr>
  34. <td height="31"><img src="smileys/emotie2.gif" width="18" height="18" onclick="ubb('(8)');"></td>
  35. <td><img src="smileys/emotie4.gif" width="20" height="20" onclick="ubb('8'|');"></td>
  36. <td><img src="smileys/emotie6.gif" width="18" height="18" onclick="ubb(';!s');"></td>
  37. <td><img src="smileys/emotie8.gif" width="20" height="20" onclick="ubb('0)');"></td>
  38. <td><img src="smileys/emotie10.gif" width="20" height="20" onclick="ubb(':!!/');"></td>
  39. <td><img src="smileys/emotie12.gif" width="20" height="20" onclick="ubb(':°');"></td>
  40. <td><img src="smileys/emotie14.gif" width="20" height="20" onclick="ubb('x)');"></td>
  41. <td><img src="smileys/emotie16.gif" width="20" height="20" onclick="ubb('x!');"></td>
  42. <td><img src="smileys/emotie18.gif" width="20" height="20" onclick="ubb(':-0');"></td>
  43. <td><img src="smileys/emotie38.gif" width="20" height="20" onclick="ubb(':p');"></td>
  44. <td><img src="smileys/huh.gif" width="20" height="20" onclick="ubb('(n)');"></td>
  45. <td><img src="smileys/icon13.gif" width="19" height="19" onclick="ubb('(!)');"></td>
  46. <td><img src="smileys/mad.gif" width="20" height="20" onclick="ubb(':(');"></td>
  47. <td><img src="smileys/middelv2.gif" width="40" height="18" onclick="ubb('(f)');"></td>
  48. <td><img src="smileys/ph34r.gif" width="20" height="20" onclick="ubb('(-)');"></td>
  49. <td><img src="smileys/sad.gif" width="20" height="20" onclick="ubb('*(');"></td>
  50. <td><img src="smileys/smile.gif" width="20" height="20" onclick="ubb(':)');"></td>
  51. <td><img src="smileys/wacko.gif" width="20" height="20" onclick="ubb(':s');"></td>
  52. <td><img src="smileys/wub.gif" width="22" height="29" onclick="ubb('(l)');"></td>
  53. <td><img src="smileys/hard.gif" width="20" height="20" onclick="ubb('(lh)');"></td>
  54. </tr>
  55. </table>


Code van je tekstveld:

  1. <textarea rows="9" cols="90" name="bericht" onkeyup="setCursor();" onkeydown="setCursor();" onfocus="setCursor();" onclick="setCursor();">Tik hier je tekst...</textarea>
Download code! Download code (.txt)

 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (25)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.094s