XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
xoopscodes.php
1<?php
15
16function xoopsCodeTarea($textarea_id, $cols=60, $rows=15, $suffix=null)
17{
18 $hiddentext = isset($suffix) ? 'xoopsHiddenText'.trim($suffix) : 'xoopsHiddenText';
19 //Hack for url, email ...., the anchor is for having a link on [_More...]
20 echo "<a name='moresmiley'></a><img src='".XOOPS_URL."/images/icons/url.svg' width='1em' height='1em' alt='url' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeUrl(\"$textarea_id\", \"".htmlspecialchars(_ENTERURL, ENT_QUOTES) . '", "'
21 . htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES) . "\");'/>
22 &nbsp;<img src='".XOOPS_URL."/images/icons/mail.svg' width='1em' height='1em' alt='email' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeEmail(\"$textarea_id\", \"".htmlspecialchars(_ENTEREMAIL, ENT_QUOTES)."\");'>
23 &nbsp;<img src='".XOOPS_URL."/images/icons/imgsrc.svg' width='1em' height='1em' alt='imgsrc' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeImg(\"$textarea_id\", \"".htmlspecialchars(_ENTERIMGURL, ENT_QUOTES) . '", "'
24 . htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES) . '", "'
25 . htmlspecialchars(_IMGPOSRORL, ENT_QUOTES) . '", "'
26 . htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES) . "\");' />
27 &nbsp;<img src='".XOOPS_URL."/images/icons/image.svg' width='1em' height='1em' alt='image' onmouseover='style.cursor=\"hand\"' onclick='openWithSelfMain(\"".XOOPS_URL . '/imagemanager.php?target='
28 . $textarea_id . "\",\"imgmanager\",400,430);' />
29 &nbsp;<img src='".XOOPS_URL."/images/icons/code.svg' width='1em' height='1em' alt='code' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeCode(\"$textarea_id\", \"".htmlspecialchars(_ENTERCODE, ENT_QUOTES)."\");'>
30 &nbsp;<img src='".XOOPS_URL."/images/icons/quote.svg' width='1em' height='1em' alt='quote' onmouseover='style.cursor=\"hand\"' onclick='xoopsCodeQuote(\"$textarea_id\");'/><br>\n";
31
32 $sizearray = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
33 echo "<select id='".$textarea_id."Size' onchange='setVisible(\"xoopsHiddenText\");setElementSize(\"".$hiddentext."\",this.options[this.selectedIndex].value);'>\n";
34 echo "<option value='SIZE'>"._SIZE."</option>\n";
35 foreach ($sizearray as $size) {
36 echo "<option value='$size'>$size</option>\n";
37 }
38 echo "</select>\n";
39
40 $fontarray = ['Arial', 'Courier', 'Georgia', 'Helvetica', 'Impact', 'Verdana'];
41 echo "<select id='".$textarea_id."Font' onchange='setVisible(\"xoopsHiddenText\");setElementFont(\"".$hiddentext."\",this.options[this.selectedIndex].value);'>\n";
42 echo "<option value='FONT'>"._FONT."</option>\n";
43 foreach ($fontarray as $font) {
44 echo "<option value='$font'>$font</option>\n";
45 }
46 echo "</select>\n";
47
48 $colorarray = ['00', '33', '66', '99', 'CC', 'FF'];
49 echo "<select id='".$textarea_id."Color' onchange='setVisible(\"xoopsHiddenText\");setElementColor(\"".$hiddentext."\",this.options[this.selectedIndex].value);'>\n";
50 echo "<option value='COLOR'>"._COLOR."</option>\n";
51 foreach ($colorarray as $color1) {
52 foreach ($colorarray as $color2) {
53 foreach ($colorarray as $color3) {
54 echo "<option value='".$color1.$color2.$color3."' style='background-color:#".$color1.$color2.$color3 . ';color:#' . $color1 . $color2 . $color3 . ";'>#" . $color1 . $color2 . $color3 . "</option>\n";
55 }
56 }
57 }
58 echo "</select><span id='".$hiddentext."'>"._EXAMPLE."</span>\n";
59
60 echo "<br>\n";
61 //Hack smilies move for bold, italic ...
62 $areacontent = $GLOBALS[$textarea_id] ?? '';
63 echo "<img src='".XOOPS_URL."/images/icons/bold.svg' width='1em' height='1em' alt='bold' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"".$hiddentext . '");makeBold("'
64 . $hiddentext . "\");' />&nbsp;<img src='" . XOOPS_URL . "/images/icons/italic.svg' width='1em' height='1em' alt='italic' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"" . $hiddentext . '");makeItalic("'
65 . $hiddentext . "\");' />&nbsp;<img src='" . XOOPS_URL . "/images/icons/underline.svg' width='1em' height='1em' alt='underline' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"" . $hiddentext . '");makeUnderline("'
66 . $hiddentext . "\");'/>&nbsp;<img src='" . XOOPS_URL . "/images/icons/linethrough.svg' width='1em' height='1em' alt='linethrough' onmouseover='style.cursor=\"hand\"' onclick='setVisible(\"" . $hiddentext . '");makeLineThrough("'
67 . $hiddentext . "\");' />&nbsp;<input type='text' id='" . $textarea_id . "Addtext' size='20'>&nbsp;<input type='button' onclick='xoopsCodeText(\"$textarea_id\", \"" . $hiddentext . '", "'
68 . htmlspecialchars(_ENTERTEXTBOX, ENT_QUOTES) . "\")' value='" . _ADD . "'><br><br><textarea id='" . $textarea_id . "' name='" . $textarea_id . "' cols='$cols' rows='$rows'>" . $areacontent . "</textarea><br>\n";
69 //Fin du hack
70}
71
72/*
73* Displays smilie image buttons used to insert smilie codes to a target textarea in a form
74* $textarea_id is a unique of the target textarea
75*/
76function xoopsSmilies($textarea_id)
77{
79 $smiles = $myts->getSmileys();
80 if (empty($smiles)) {
81 $db =& Database::getInstance();
82 if ($result = $db->query('SELECT * FROM '.$db->prefix('smiles').' WHERE display=1')) {
83 while ($smile = $db->fetchArray($result)) {
84 //hack smilies move for the smilies !!
85 echo "<img src='".XOOPS_UPLOAD_URL . '/' . htmlspecialchars($smile['smile_url']) . "' border='0' onmouseover='style.cursor=\"hand\"' alt='' onclick='xoopsCodeSmilie(\"" . $textarea_id . '", " ' . $smile['code'] . " \");' />";
86 //fin du hack
87 }
88 }
89 } else {
90 foreach ($smiles as $iValue) {
91 if (1 == $iValue['display']) {
92 //hack bis
93 echo "<img src='".XOOPS_UPLOAD_URL . '/' . htmlspecialchars($iValue['smile_url']) . "' border='0' onmouseover='style.cursor=\"hand\"' alt='' onclick='xoopsCodeSmilie(\"" . $textarea_id . '", " ' . $iValue['code'] . " \");' />";
94 //fin du hack
95 }
96 }
97 }
98 //hack for more
99 echo "&nbsp;[<a href='#moresmiley' onmouseover='style.cursor=\"hand\"' onclick='openWithSelfMain(\"".XOOPS_URL . '/misc.php?action=showpopups&amp;type=smilies&amp;target=' . $textarea_id . "\",\"smilies\",300,475);'>" . _MORE . '</a>]';
100} //fin du hack
101;