[6] | 1 | <?php |
---|
| 2 | /*********************************************************************** |
---|
| 3 | |
---|
| 4 | Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) |
---|
| 5 | |
---|
| 6 | This file is part of PunBB. |
---|
| 7 | |
---|
| 8 | PunBB is free software; you can redistribute it and/or modify it |
---|
| 9 | under the terms of the GNU General Public License as published |
---|
| 10 | by the Free Software Foundation; either version 2 of the License, |
---|
| 11 | or (at your option) any later version. |
---|
| 12 | |
---|
| 13 | PunBB is distributed in the hope that it will be useful, but |
---|
| 14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | GNU General Public License for more details. |
---|
| 17 | |
---|
| 18 | You should have received a copy of the GNU General Public License |
---|
| 19 | along with this program; if not, write to the Free Software |
---|
| 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
| 21 | MA 02111-1307 USA |
---|
| 22 | |
---|
| 23 | ************************************************************************/ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | if (!isset($bbcode_form)) |
---|
| 27 | $bbcode_form = 'post'; |
---|
| 28 | if (!isset($bbcode_field)) |
---|
| 29 | $bbcode_field = 'req_message'; |
---|
| 30 | |
---|
| 31 | function isNotIE_option($balise) { |
---|
| 32 | $browser = $_SERVER['HTTP_USER_AGENT']; |
---|
| 33 | if ((eregi("opera", $browser)) || (eregi("firefox", $browser)) || (eregi("netscape", $browser)) ) |
---|
| 34 | echo "onClick=".'"'."insert_text('[$balise='+(this.value)+']','[/$balise]', 'false')".'"'; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | function isIE_select($balise) { |
---|
| 38 | $browser = $_SERVER['HTTP_USER_AGENT']; |
---|
| 39 | if ((eregi("msie", $browser)) && (!eregi("opera", $browser)) && (!eregi("firefox", $browser)) && (!eregi("netscape", $browser)) ) |
---|
| 40 | echo "onchange=".'"'."insert_text('[$balise='+(this.options[this.selectedIndex].value)+']','[/$balise]')".'"'; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | ?> |
---|
| 44 | <script type="text/javascript"> |
---|
| 45 | <!-- |
---|
| 46 | function fonction() { |
---|
| 47 | element.onclick = insert_text('[font='+(this.value)+']','[/font]', 'false'); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | function insert_text(open, close, isSmiley) |
---|
| 51 | { |
---|
| 52 | msgfield = (document.all) ? document.all.req_message : document.forms['<?php echo $bbcode_form ?>']['<?php echo $bbcode_field ?>']; |
---|
| 53 | |
---|
| 54 | // IE support |
---|
| 55 | if (document.selection && document.selection.createRange) |
---|
| 56 | { |
---|
| 57 | msgfield.focus(); |
---|
| 58 | sel = document.selection.createRange(); |
---|
| 59 | sel.text = open + sel.text + close; |
---|
| 60 | msgfield.focus(); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | // Moz support |
---|
| 64 | else if (msgfield.selectionStart || msgfield.selectionStart == '0') |
---|
| 65 | { |
---|
| 66 | var startPos = msgfield.selectionStart; |
---|
| 67 | var endPos = msgfield.selectionEnd; |
---|
| 68 | |
---|
| 69 | msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length); |
---|
| 70 | if (isSmiley == 'true') { |
---|
| 71 | msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length; |
---|
| 72 | } |
---|
| 73 | else { |
---|
| 74 | msgfield.selectionStart = startPos; |
---|
| 75 | msgfield.selectionEnd = endPos + open.length + close.length; |
---|
| 76 | } |
---|
| 77 | msgfield.focus(); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | // Fallback support for other browsers |
---|
| 81 | else |
---|
| 82 | { |
---|
| 83 | msgfield.value += open + close; |
---|
| 84 | msgfield.focus(); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | return; |
---|
| 88 | } |
---|
| 89 | --> |
---|
| 90 | </script> |
---|
| 91 | <div style="padding-top: 4px"> |
---|
| 92 | <select name='ffont' class='codebuttons' <?php isIE_select("font"); ?> > |
---|
| 93 | <option value='0'>Police</option> |
---|
| 94 | <option value='Arial' style='font-family:Arial' <?php isNotIE_option("font"); ?> >Arial</option> |
---|
| 95 | <option value='Times' style='font-family:Times' <?php isNotIE_option("font"); ?> >Times</option> |
---|
| 96 | <option value='Courier' style='font-family:Courier' <?php isNotIE_option("font"); ?> >Courier</option> |
---|
| 97 | <option value='Impact' style='font-family:Impact' <?php isNotIE_option("font"); ?> >Impact</option> |
---|
| 98 | <option value='Geneva' style='font-family:Geneva' <?php isNotIE_option("font"); ?> >Geneva</option> |
---|
| 99 | <option value='Optima' style='font-family:Optima' <?php isNotIE_option("font"); ?> >Optima</option> |
---|
| 100 | </select> |
---|
| 101 | <select name='fcolor' class='codebuttons' <?php isIE_select("color"); ?> > |
---|
| 102 | <option value='0'>Couleur</option> |
---|
| 103 | <option value='blue' style='color:blue' <?php isNotIE_option("color"); ?> >Bleu</option> |
---|
| 104 | <option value='red' style='color:red' <?php isNotIE_option("color"); ?> >Rouge</option> |
---|
| 105 | <option value='purple' style='color:purple' <?php isNotIE_option("color"); ?> >Violet</option> |
---|
| 106 | <option value='orange' style='color:orange' <?php isNotIE_option("color"); ?> >Orange</option> |
---|
| 107 | <option value='yellow' style='color:yellow' <?php isNotIE_option("color"); ?> >Jaune</option> |
---|
| 108 | <option value='gray' style='color:gray' <?php isNotIE_option("color"); ?> >Gris</option> |
---|
| 109 | <option value='green' style='color:green' <?php isNotIE_option("color"); ?> >Vert</option> |
---|
| 110 | </select> |
---|
| 111 | <select name='fsize' class='codebuttons' <?php isIE_select("align"); ?> > |
---|
| 112 | <option value='0'>Alignement</option> |
---|
| 113 | <option value='left' <?php isNotIE_option("align"); ?> >Gauche</option> |
---|
| 114 | <option value='center' <?php isNotIE_option("align"); ?> >Centre</option> |
---|
| 115 | <option value='right' <?php isNotIE_option("align"); ?> >Droite</option> |
---|
| 116 | </select> |
---|
| 117 | <select name='fsize' class='codebuttons' <?php isIE_select("size"); ?> > |
---|
| 118 | <option value='0'>Taille</option> |
---|
| 119 | <option value='5' <?php isNotIE_option("size"); ?> >Petit</option> |
---|
| 120 | <option value='15' <?php isNotIE_option("size"); ?> >Large</option> |
---|
| 121 | <option value='25' <?php isNotIE_option("size"); ?> >Plus large</option> |
---|
| 122 | </select><br /> |
---|
| 123 | <input type="button" value=" B " name="B" onClick="insert_text('[b]','[/b]', 'false')" /> |
---|
| 124 | <input type="button" value=" I " name="I" onClick="insert_text('[i]','[/i]', 'false')" /> |
---|
| 125 | <input type="button" value=" U " name="U" onClick="insert_text('[u]','[/u]', 'false')" /> |
---|
| 126 | <input type="button" value="Barré" name="S" onClick="insert_text('[s]','[/s]', 'false')" /> |
---|
| 127 | <input type="button" value="Surligné" name="H" onClick="insert_text('[h]','[/h]', 'false')" /> |
---|
| 128 | <input type="button" value="Tracer Ligne" name="HR" onClick="insert_text('[hr /]','', 'false')" /><br /> |
---|
| 129 | <input type="button" value="http://" name="Url" onClick="insert_text('[url]','[/url]', 'false')" /> |
---|
| 130 | <input type="button" value="mailto:" name="EMAIL" onClick="insert_text('[email]','[/email]', 'false')" /> |
---|
| 131 | <input type="button" value="Img" name="Img" onClick="insert_text('[img]','[/img]', 'false')" /> |
---|
| 132 | <input type="button" value="Code" name="Code" onClick="insert_text('[code]','[/code]', 'false')" /> |
---|
| 133 | <input type="button" value="Quote" name="Quote" onClick="insert_text('[quote]','[/quote]', 'false')" /> |
---|
| 134 | </div> |
---|
| 135 | <div style="padding-top: 4px"> |
---|
| 136 | <?php |
---|
| 137 | |
---|
| 138 | // Display the smiley set |
---|
| 139 | require_once PUN_ROOT.'include/parser.php'; |
---|
| 140 | |
---|
| 141 | $smiley_dups = array(); |
---|
| 142 | $num_smilies = count($smiley_text); |
---|
| 143 | for ($i = 0; $i < $num_smilies; ++$i) |
---|
| 144 | { |
---|
| 145 | // Is there a smiley at the current index? |
---|
| 146 | if (!isset($smiley_text[$i])) |
---|
| 147 | continue; |
---|
| 148 | |
---|
| 149 | if (!in_array($smiley_img[$i], $smiley_dups)) |
---|
| 150 | echo "\t\t\t\t\t\t\t".'<a href="javascript:insert_text(\''.$smiley_text[$i].'\', \'\', \'true\');"><img src="img/smilies/'.$smiley_img[$i].'" width="15" height="15" alt="'.$smiley_text[$i].'" /></a>'."\n"; |
---|
| 151 | |
---|
| 152 | $smiley_dups[] = $smiley_img[$i]; |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | ?> |
---|
| 156 | </div> |
---|