1: <?php
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32: 33: 34: 35:
36: function xoopsCodeTarea($textarea_id, $cols=60, $rows=15, $suffix=null)
37: {
38: $hiddentext = isset($suffix) ? 'xoopsHiddenText'.trim($suffix) : 'xoopsHiddenText';
39:
40: echo "<a name='moresmiley'></a><img src='".XOOPS_URL."/images/url.gif' alt='url' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeUrl(\"$textarea_id\", \"".htmlspecialchars(_ENTERURL, ENT_QUOTES)."\", \"".htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES)."\");'/> <img src='".XOOPS_URL."/images/email.gif' alt='email' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeEmail(\"$textarea_id\", \"".htmlspecialchars(_ENTEREMAIL, ENT_QUOTES)."\");' /> <img src='".XOOPS_URL."/images/imgsrc.gif' alt='imgsrc' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeImg(\"$textarea_id\", \"".htmlspecialchars(_ENTERIMGURL, ENT_QUOTES)."\", \"".htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES)."\", \"".htmlspecialchars(_IMGPOSRORL, ENT_QUOTES)."\", \"".htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES)."\");' /> <img src='".XOOPS_URL."/images/image.gif' alt='image' onmouseover='style.cursor=\"hand\"' onclick='openWithSelfMain(\"".XOOPS_URL."/imagemanager.php?target=".$textarea_id."\",\"imgmanager\",400,430);' /> <img src='".XOOPS_URL."/images/code.gif' alt='code' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeCode(\"$textarea_id\", \"".htmlspecialchars(_ENTERCODE, ENT_QUOTES)."\");' /> <img src='".XOOPS_URL."/images/quote.gif' alt='quote' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeQuote(\"$textarea_id\");'/><br />\n";
41:
42: $sizearray = array("xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large");
43: echo "<select id='".$textarea_id."Size' onchange='setVisible(\"xoopsHiddenText\");setElementSize(\"".$hiddentext."\",this.options[this.selectedIndex].value);'>\n";
44: echo "<option value='SIZE'>"._SIZE."</option>\n";
45: foreach ( $sizearray as $size ) {
46: echo "<option value='$size'>$size</option>\n";
47: }
48: echo "</select>\n";
49:
50: $fontarray = array("Arial", "Courier", "Georgia", "Helvetica", "Impact", "Verdana");
51: echo "<select id='".$textarea_id."Font' onchange='setVisible(\"xoopsHiddenText\");setElementFont(\"".$hiddentext."\",this.options[this.selectedIndex].value);'>\n";
52: echo "<option value='FONT'>"._FONT."</option>\n";
53: foreach ( $fontarray as $font ) {
54: echo "<option value='$font'>$font</option>\n";
55: }
56: echo "</select>\n";
57:
58: $colorarray = array("00", "33", "66", "99", "CC", "FF");
59: echo "<select id='".$textarea_id."Color' onchange='setVisible(\"xoopsHiddenText\");setElementColor(\"".$hiddentext."\",this.options[this.selectedIndex].value);'>\n";
60: echo "<option value='COLOR'>"._COLOR."</option>\n";
61: foreach ( $colorarray as $color1 ) {
62: foreach ( $colorarray as $color2 ) {
63: foreach ( $colorarray as $color3 ) {
64: echo "<option value='".$color1.$color2.$color3."' style='background-color:#".$color1.$color2.$color3.";color:#".$color1.$color2.$color3.";'>#".$color1.$color2.$color3."</option>\n";
65: }
66: }
67: }
68: echo "</select><span id='".$hiddentext."'>"._EXAMPLE."</span>\n";
69:
70: echo "<br />\n";
71:
72: $areacontent = isset( $GLOBALS[$textarea_id] ) ? $GLOBALS[$textarea_id] : '';
73: echo "<img src='".XOOPS_URL."/images/bold.gif' alt='bold' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"".$hiddentext."\");makeBold(\"".$hiddentext."\");' /> <img src='".XOOPS_URL."/images/italic.gif' alt='italic' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"".$hiddentext."\");makeItalic(\"".$hiddentext."\");' /> <img src='".XOOPS_URL."/images/underline.gif' alt='underline' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"".$hiddentext."\");makeUnderline(\"".$hiddentext."\");'/> <img src='".XOOPS_URL."/images/linethrough.gif' alt='linethrough' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"".$hiddentext."\");makeLineThrough(\"".$hiddentext."\");' /> <input type='text' id='".$textarea_id."Addtext' size='20' /> <input type='button' onclick='xoopsCodeText(\"$textarea_id\", \"".$hiddentext."\", \"".htmlspecialchars(_ENTERTEXTBOX, ENT_QUOTES)."\")' value='"._ADD."' /><br /><br /><textarea id='".$textarea_id."' name='".$textarea_id."' cols='$cols' rows='$rows'>".$areacontent."</textarea><br />\n";
74:
75: }
76:
77: 78: 79: 80:
81: function xoopsSmilies($textarea_id)
82: {
83: $myts =& MyTextSanitizer::getInstance();
84: $smiles = $myts->getSmileys();
85: if (empty($smiles)) {
86: $db =& Database::getInstance();
87: if ($result = $db->query('SELECT * FROM '.$db->prefix('smiles').' WHERE display=1')) {
88: while ($smile = $db->fetchArray($result)) {
89:
90: echo "<img src='".XOOPS_UPLOAD_URL."/".htmlspecialchars($smile['smile_url'])."' border='0' onmouseover='style.cursor=\"hand\"' alt='' onclick='xoopsCodeSmilie(\"".$textarea_id."\", \" ".$smile['code']." \");' />";
91:
92: }
93: }
94: } else {
95: $count = count($smiles);
96: for ($i = 0; $i < $count; $i++) {
97: if ($smiles[$i]['display'] == 1) {
98:
99: echo "<img src='".XOOPS_UPLOAD_URL."/".htmlspecialchars($smiles[$i]['smile_url'])."' border='0' onmouseover='style.cursor=\"hand\"' alt='' onclick='xoopsCodeSmilie(\"".$textarea_id."\", \" ".$smiles[$i]['code']." \");' />";
100:
101: }
102: }
103: }
104:
105: echo " [<a href='#moresmiley' onmouseover='style.cursor=\"hand\"' alt='' onclick='openWithSelfMain(\"".XOOPS_URL."/misc.php?action=showpopups&type=smilies&target=".$textarea_id."\",\"smilies\",300,475);'>"._MORE."</a>]";
106: }
107: ?>