summaryrefslogtreecommitdiff
path: root/forum/utils/editor.php
blob: 681b98d3653cd702e4cf1e365e1df6f1d05a6ca4 (plain)
1
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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!");
}

?>