summaryrefslogtreecommitdiff
path: root/forum/utils/editor.php
diff options
context:
space:
mode:
Diffstat (limited to 'forum/utils/editor.php')
-rw-r--r--forum/utils/editor.php154
1 files changed, 154 insertions, 0 deletions
diff --git a/forum/utils/editor.php b/forum/utils/editor.php
new file mode 100644
index 0000000..681b98d
--- /dev/null
+++ b/forum/utils/editor.php
@@ -0,0 +1,154 @@
+<script language="JavaScript">
+function addcontent(text) {
+ document.post_form.message.value += text;
+ document.post_form.message.focus();
+}
+</script>
+<?php
+include_once($UTIL_DIR . "/error.php");
+include_once($UTIL_DIR . "/convert.php");
+
+$title = "En titel";
+$message = "Something useful";
+
+if($fid && $tid && $pid) {
+ include_once("posts.php");
+ $posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml");
+ if($pid != -1) $post = $posts->getPost($pid);
+ if($post || $pid == -1) {
+
+ switch($task) {
+ case "new":
+ $title = "Title";
+ $message = "Message";
+ break;
+
+ case "reply":
+ $title = "Re: " . $post->title;
+ $message = "";
+ break;
+
+ case "edit":
+ $title = $post->title;
+ $message = $post->message;
+ break;
+
+ case "quote":
+ $title = "Re: " . $post->title;
+ $user = $users->getUser($post->user);
+ $message = "[quote title=" . $user->name . " wrote on " .date("r", $post->date) ."]" . $post->message . "[/quote]";
+ break;
+
+ default:
+ error("No mode supplied!");
+ break;
+ }
+?>
+<form style="clear: both;" name="post_form" method="post" action="?mode=edit&amp;task=<?php echo $task ?>&amp;fid=<?php echo $fid; ?>&amp;tid=<?php echo $tid; ?>&amp;pid=<?php echo $pid; ?>" onSubmit="javascript: document.post_form.btn_submit.disabled = true;">
+<?php /*
+<a href="javascript: insertTag(document.post_form.message, ';-)', '');"><img border="0" alt=";-)" src="gfx/smileys/wink.gif"/></a>
+<a href="javascript: insertTag(document.post_form.message, ';-D', '');"><img border="0" alt=";-)" src="gfx/smileys/biggrinn.gif"/></a>
+<a href="javascript: insertTag(document.post_form.message, '\\m/', '');"><img border="0" alt=";-)" src="gfx/smileys/headbanger.gif"/></a>
+<a href="javascript: insertTag(document.post_form.message, '>:O', '');"><img border="0" alt=";-)" src="gfx/smileys/growler.gif"/></a>
+<a href="javascript: insertTag(document.post_form.message, '[b]', '[/b]');"><strong>B</strong></a>
+<a href="javascript: insertTag(document.post_form.message, '[i]', '[/i]');"><em>I</em></a>
+<a href="javascript: insertTag(document.post_form.message, '[u]', '[/u]');"><u>U</u></a>
+<a href="javascript: insertTag(document.post_form.message, '[align=left]', '[/align]');">[L&nbsp;&nbsp;]</a>
+<a href="javascript: insertTag(document.post_form.message, '[align=center]', '[/align]');">[&nbsp;C&nbsp;]</a>
+<a href="javascript: insertTag(document.post_form.message, '[align=right]', '[/align]');">[&nbsp;&nbsp;R]</a>
+<a href="javascript: url_insert();">URL</a>
+<a href="javascript: email_insert();">E-Mail</a>
+<a href="javascript: image_insert();">Image</a>
+<a href="javascript: insertTag(document.post_form.message, '[quote]', '[/quote]');">"Q"</a>
+<a href="javascript: insertTag(document.post_form.message, '[code]', '[/code]');">c++</a>
+
+<select name="fnt_size" onchange="javascript:insertTag(document.post_form.message, '[size='+document.post_form.fnt_size.options[this.selectedIndex].value+']', '[/size]'); document.post_form.fnt_size.options[0].selected=true">
+<option value="" selected="selected">Size</option>
+<option value="1">1</option>
+<option value="2">2</option>
+<option value="3">3</option>
+<option value="4">4</option>
+<option value="5">5</option>
+<option value="6">6</option>
+<option value="7">7</option>
+</select>
+
+<select name="fnt_color" onchange="javascript:insertTag(document.post_form.message, '[color='+document.post_form.fnt_color.options[this.selectedIndex].value+']', '[/color]'); document.post_form.fnt_color.options[0].selected=true">
+<option value="">Color</option>
+<option value="skyblue" style="color: skyblue;">Sky Blue</option>
+<option value="royalblue" style="color: royalblue;">Royal Blue</option>
+<option value="blue" style="color: blue;">Blue</option>
+<option value="darkblue" style="color: darkblue;">Dark Blue</option>
+<option value="orange" style="color: orange;">Orange</option>
+<option value="orangered" style="color: orangered;">Orange Red</option>
+<option value="crimson" style="color: crimson;">Crimson</option>
+<option value="red" style="color: red;">Red</option>
+<option value="firebrick" style="color: firebrick;">Firebrick</option>
+<option value="darkred" style="color: darkred;">Dark Red</option>
+<option value="green" style="color: green;">Green</option>
+<option value="limegreen" style="color: limegreen;">Lime Green</option>
+<option value="seagreen" style="color: seagreen;">Sea Green</option>
+<option value="deeppink" style="color: deeppink;">Deep Pink</option>
+<option value="tomato" style="color: tomato;">Tomato</option>
+<option value="coral" style="color: coral;">Coral</option>
+<option value="purple" style="color: purple;">Purple</option>
+<option value="indigo" style="color: indigo;">Indigo</option>
+<option value="burlywood" style="color: burlywood;">Burly Wood</option>
+<option value="sandybrown" style="color: sandybrown;">Sandy Brown</option>
+<option value="sienna" style="color: sienna;">Sienna</option>
+<option value="chocolate" style="color: chocolate;">Chocolate</option>
+<option value="teal" style="color: teal;">Teal</option>
+<option value="silver" style="color: silver;">Silver</option>
+</select>
+
+<select name="fnt_face" onchange="javascript:insertTag(document.post_form.message, '[font='+document.post_form.fnt_face.options[this.selectedIndex].value+']', '[/font]'); document.post_form.fnt_face.options[0].selected=true">
+<option value="">Font</option>
+<option value="Arial" style="font-family: Arial;">Arial</option>
+<option value="Times" style="font-family: Times;">Times</option>
+<option value="Courier" style="font-family: Courier;">Courier</option>
+<option value="Century" style="font-family: Century;">Century</option>
+</select> */ ?>
+ <p>
+ Title:
+ <input name="title" style="width: 300px;" value="<?php echo convert_xml($title);?>"/>
+ </p>
+ <p>
+<?php
+include_once($UTIL_DIR . "/smileys.php");
+global $smileys;
+foreach($smileys as $smiley) {
+ $smile = $smiley[0][0];
+ if($smile == "\\m/") $smile = "\\\\m/";
+ echo " <a href=\"javascript:addcontent('" . $smile . "');\"><img style=\"border: 0px\" alt=\"\" src=\"gfx/smileys/" . $smiley[1] . "\"/></a>";
+}
+?>
+ </p>
+ <p>
+ <textarea rows="20" cols="65" name="message" onkeyup="storeCaret(this);" onclick="storeCaret(this);" onselect="storeCaret(this);"><?php echo convert_xml($message); ?></textarea>
+ </p>
+ <p>
+ <strong>To make a link, simply type the URL, and the system will
+ automagically transform it into an anchor (remember the
+ <em>http://</em> part)</strong>.<br/>
+ Example: http://www.executionroom.com<br/>
+ </p>
+ <p>
+ <strong>To insert an image, simply type the URL to that image, it will
+ automagically be transformed into an image, with a link to the
+ original image (again, remember the <em>http://</em> part).</strong><br/>
+ Example: http://www.executionroom.com/gfx/logos/die_logo_bloody.png
+ </p>
+ <p>
+ <button type="submit">Post</button>
+ </p>
+</form>
+<?php
+ if($pid != -1) $posts->show();
+ } else {
+ error("Message " . $pid . " not found!");
+ }
+} else {
+ error("No message supplied!");
+}
+
+?>