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
|
<?php
function editor()
{
global $UTIL_DIR, $FORUMS_DIR, $users, $fid, $tid, $pid, $smileys, $task;
include_once($UTIL_DIR . "/error.php");
include_once($UTIL_DIR . "/convert.php");
$str = "";
$str .= "<script language=\"JavaScript\">\n";
$str .= "function addcontent(text) {\n";
$str .= " document.post_form.message.value += text;\n";
$str .= " document.post_form.message.focus();\n";
$str .= "}\n";
$str .= "</script>\n";
$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) {
$title = "";
$message = "";
switch($task) {
case "new":
$title = "Title";
$message = "Message";
break;
case "reply":
if(substr($post->title, 0, 4) != "Re: ")
$title = "Re: " . $post->title;
else $title = $post->title;
$message = "";
break;
case "edit":
$title = $post->title;
$message = $post->message;
break;
case "quote":
if(substr($post->title, 0, 4) != "Re: ")
$title = "Re: " . $post->title;
else $title = $post->title;
$user = $users->getUser($post->user);
$message = "[quote title=" . $user->name . " wrote on " .
date("r", $post->date) ."]" . $post->message . "[/quote]";
break;
default:
$str .= error("No mode supplied!");
return $str;
break;
}
$str .= "<form style=\"clear: both;\" name=\"post_form\" method=\"post\" action=\"?mode=edit&task=" .
$task . "&fid=" . $fid . "&tid=" . $tid . "&pid=" . $pid .
"\" onSubmit=\"javascript: document.post_form.btn_submit.disabled = true;\">\n";
$str .= " <p> Title: <input name=\"title\" style=\"width: 300px;\" value=\"" .
convert_xml($title) . "\"/></p>\n";
$str .= " <p>\n";
include_once($UTIL_DIR . "/smileys.php");
foreach($smileys as $smiley) {
$smile = $smiley[0][0];
if($smile == "\\m/") $smile = "\\\\m/";
$str .= " <a href=\"javascript:addcontent('" . $smile .
"');\"><img style=\"border: 0px\" alt=\"\" src=\"gfx/smileys/" .
$smiley[1] . "\"/></a>";
}
$str .= " </p>\n";
$str .= " <p>\n";
$str .= " <textarea rows=\"20\" cols=\"65\" name=\"message\" onkeyup=\"storeCaret(this);\"".
" onclick=\"storeCaret(this);\" onselect=\"storeCaret(this);\">".
convert_xml($message) . "</textarea>\n";
$str .= " </p>\n";
$str .= " <p>\n";
$str .= " <strong>To make a link, simply type the URL, and the system will\n";
$str .= " automagically transform it into an anchor (remember the\n";
$str .= " <em>http://</em> part)</strong>.<br/>\n";
$str .= " Example: http://www.example.com<br/>\n";
$str .= " </p>\n";
$str .= " <p>\n";
$str .= " <strong>To insert an image, simply type the URL to that image, it will\n";
$str .= " automagically be transformed into an image, with a link to the\n";
$str .= " original image (again, remember the <em>http://</em> part).</strong><br/>\n";
$str .= " Example: http://www.example.com/image.jpg\n";
$str .= " </p>\n";
$str .= " <p>\n";
$str .= " <button type=\"submit\">Post</button>\n";
$str .= " </p>\n";
$str .= "</form>\n";
if($pid != -1) $str .= $posts->show();
} else {
$str .= error("Message " . $pid . " not found!");
}
} else {
$str .= error("No message supplied!");
}
return $str;
}
?>
|