1 |
<?PHP |
2 |
|
3 |
###################################################################### |
4 |
# PHP-NUKE: Web Portal System |
5 |
# =========================== |
6 |
# |
7 |
# Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve) |
8 |
# http://www.ncc.org.ve/php-nuke.php |
9 |
# |
10 |
# This modules is to manage your visitor's news submissions |
11 |
# |
12 |
# This program is free software. You can redistribute it and/or modify |
13 |
# it under the terms of the GNU General Public License as published by |
14 |
# the Free Software Foundation; either version 2 of the License. |
15 |
###################################################################### |
16 |
|
17 |
if (!isset($mainfile)) { include("mainfile.php"); } |
18 |
|
19 |
function defaultDisplay() { |
20 |
include ('header.php'); |
21 |
global $user, $cookie; |
22 |
echo "<table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor=000000><tr><td>"; |
23 |
echo "<table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor=FFFFFF><tr><td>"; |
24 |
echo "<font size=4>".translate("Submit News")."<font size=3>"; |
25 |
if (isset($user)) getusrinfo($user); |
26 |
echo "<p><FORM action=\"submit.php\" method=post><font face=Arial,Helvetica>" |
27 |
."<b>".translate("Your Name")."</b> "; |
28 |
if ($user) { |
29 |
cookiedecode($user); |
30 |
echo "<a href=\"user.php\">$cookie[1]</a> <font size=2>[ <a href=\"user.php?op=logout\">".translate("Logout")."</a> ]</font>"; |
31 |
} else { |
32 |
echo "$anonymous <font size=2>[ <a href=\"user.php\">".translate("New User")."</a> ]</font>"; |
33 |
} ?> |
34 |
<P><B><?php echo translate("Title"); ?></B> |
35 |
(<?php echo translate ("Be Descriptive, Clear and Simple"); ?>)<BR> |
36 |
<INPUT TYPE="text" NAME="subject" SIZE=70 maxlength=80><BR><FONT size=2>(<?php echo translate("bad titles='Check This Out!' or 'An Article'."); ?>)</FONT> |
37 |
<BR> |
38 |
<p><b><?php echo translate("Topic"); ?></b><SELECT NAME=topic> |
39 |
<?PHP |
40 |
$toplist = mysql_query("select topicid, topictext from topics order by topictext"); |
41 |
echo "<OPTION VALUE=\"\">".translate("Select Topic")."</option>\n"; |
42 |
while(list($topicid, $topics) = mysql_fetch_row($toplist)) { |
43 |
if ($topicid==$topic) { $sel = "selected "; } |
44 |
echo "<option $sel value=\"$topicid\">$topics</option>\n"; |
45 |
$sel = ""; |
46 |
} |
47 |
?> |
48 |
</select> |
49 |
<P><B><?php echo translate("The Scoop"); ?></B> |
50 |
(<?php echo translate("HTML is fine, but double check those URLs and HTML tags!"); ?>)<BR> |
51 |
<TEXTAREA wrap=virtual cols=70 rows=12 name=story></TEXTAREA><BR> |
52 |
<FONT size=2>(<?php echo translate("Are you sure you included a URL? Did you test them for typos?"); ?>)</FONT><P> |
53 |
<INPUT type=submit name=op value="Preview"> (<?php echo translate("You must preview once before you can submit"); ?>)</FORM> |
54 |
</td></tr></table></td></tr></table> |
55 |
<?PHP |
56 |
include ('footer.php'); |
57 |
} |
58 |
|
59 |
function PreviewStory($name, $address, $subject, $story, $topic) { |
60 |
global $user, $cookie; |
61 |
include ('header.php'); |
62 |
$subject = stripslashes($subject); |
63 |
$story = stripslashes($story); |
64 |
echo "<table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor=000000><tr><td>"; |
65 |
echo "<table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor=FFFFFF><tr><td>"; |
66 |
echo "<p><font face=Arial,Helvetica><FORM action=\"submit.php\" method=post>" |
67 |
."<b>".translate("Your Name")."</b> "; |
68 |
if ($user) { |
69 |
cookiedecode($user); |
70 |
echo "<a href=\"user.php\">$cookie[1]</a> <font size=2>[ <a href=\"user.php?op=logout\">".translate("Logout")."</a> ]</font>"; |
71 |
} else { |
72 |
echo "$anonymous"; |
73 |
} ?> |
74 |
<p><b><center><?php echo translate("Title"); ?></b><br> |
75 |
<INPUT TYPE="text" NAME="subject" SIZE=70 maxlength=80 value="<?PHP echo"$subject"; ?>"> |
76 |
<?PHP |
77 |
|
78 |
echo "<br><br><table border=0 width=80% cellpadding=0 cellspacing=0 bgcolor=000000><tr><td>"; |
79 |
echo "<table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor=FFFFFF><tr><td>"; |
80 |
echo "<font face=Arial,Helvetica>"; |
81 |
if ($topic=="") { |
82 |
$topicimage="AllTopics.gif"; |
83 |
$warning = "<center><blink><b>".translate("Select Topic")."</b></blink></center>"; |
84 |
} else { |
85 |
$warning = ""; |
86 |
$result = mysql_query("select topicimage from topics where topicid='$topic'"); |
87 |
list($topicimage) = mysql_fetch_row($result); |
88 |
} |
89 |
echo "<img src=$tipath$topicimage border=0 align=right>"; |
90 |
themepreview($subject, $story); |
91 |
echo "$warning"; |
92 |
echo "</td></tr></table></td></tr></table>"; |
93 |
|
94 |
?> |
95 |
<p><b><?php echo translate("Topic"); ?></b><select name=topic> |
96 |
<?PHP |
97 |
$toplist = mysql_query("select topicid, topictext from topics order by topictext"); |
98 |
echo "<OPTION VALUE=\"\">".translate("Select Topic")."</option>\n"; |
99 |
while(list($topicid, $topics) = mysql_fetch_row($toplist)) { |
100 |
if ($topicid==$topic) { $sel = "selected "; } |
101 |
echo "<option $sel value=\"$topicid\">$topics</option>\n"; |
102 |
$sel = ""; |
103 |
} |
104 |
?> |
105 |
</select> |
106 |
<P><B><?php echo translate("The Scoop"); ?></B> |
107 |
(<?php echo translate("HTML is fine, but double check those URLs and HTML tags!"); ?>)<BR> |
108 |
<TEXTAREA wrap=virtual cols=70 rows=12 name=story><?PHP echo"$story"; ?></TEXTAREA><BR> |
109 |
<FONT size=2>(<?php echo translate("Are you sure you included a URL? Did you test them for typos?"); ?>)</FONT><P> |
110 |
<INPUT type=submit name=op value="Preview"> <INPUT type=submit name=op value="Ok!"> |
111 |
</td></tr></table></td></tr></table></FORM> |
112 |
|
113 |
<?PHP |
114 |
include ('footer.php'); |
115 |
} |
116 |
|
117 |
function submitStory($name, $address, $subject, $story, $topic) { |
118 |
global $user, $EditedMessage, $cookie; |
119 |
include ('header.php'); |
120 |
echo translate("Thanks for your submission."); |
121 |
include ('footer.php'); |
122 |
dbconnect(); |
123 |
if ($user) { |
124 |
cookiedecode($user); |
125 |
$uid = $cookie[0]; |
126 |
$name = $cookie[1]; |
127 |
} else { |
128 |
$uid = -1; |
129 |
$name = "Anonymous"; |
130 |
} |
131 |
$subject = stripslashes(FixQuotes(check_html($subject, "nohtml"))); |
132 |
$story = stripslashes(FixQuotes($story)); |
133 |
$result = mysql_query("insert into queue values (NULL, '$uid', '$name', '$subject', '$story', now(), '$topic')"); |
134 |
if(!$result) { |
135 |
echo mysql_errno(). ": ".mysql_error(). "<br>"; |
136 |
exit(); |
137 |
} |
138 |
if($notify) { |
139 |
mail($notify_email, $notify_subject, $notify_message, "From: $notify_from\nX-Mailer: PHP/" . phpversion()); |
140 |
} |
141 |
} |
142 |
|
143 |
switch($op) |
144 |
{ |
145 |
case "Preview": |
146 |
PreviewStory($name, $address, $subject, $story, $topic); |
147 |
break; |
148 |
|
149 |
case "Ok!": |
150 |
SubmitStory($name, $address, $subject, $story, $topic); |
151 |
break; |
152 |
|
153 |
default: |
154 |
defaultDisplay(); |
155 |
break; |
156 |
|
157 |
} |
158 |
|
159 |
?> |