[ Index ] |
|
Code source de PHP NUKE 7.9 |
1 <?php 2 3 /************************************************************************/ 4 /* PHP-NUKE: Web Portal System */ 5 /* =========================== */ 6 /* */ 7 /* Copyright (c) 2005 by Francisco Burzi */ 8 /* http://phpnuke.org */ 9 /* */ 10 /* This program is free software. You can redistribute it and/or modify */ 11 /* it under the terms of the GNU General Public License as published by */ 12 /* the Free Software Foundation; either version 2 of the License. */ 13 /************************************************************************/ 14 15 if (!defined('MODULE_FILE')) { 16 die ("You can't access this file directly..."); 17 } 18 require_once ("mainfile.php"); 19 $module_name = basename(dirname(__FILE__)); 20 get_lang($module_name); 21 $pagetitle = "- "._SUBMITNEWS.""; 22 23 function defaultDisplay() { 24 global $AllowableHTML, $prefix, $user, $cookie, $anonymous, $currentlang, $multilingual, $db, $module_name, $nuke_editor; 25 include ("header.php"); 26 OpenTable(); 27 echo "<center><font class=\"title\"><b>"._SUBMITNEWS."</b></font><br><br>"; 28 echo "<font class=\"content\"><i>"._SUBMITADVICE."</i></font></center><br>"; 29 CloseTable(); 30 echo "<br>"; 31 OpenTable(); 32 if (is_user($user)) getusrinfo($user); 33 echo "<p><form action=\"modules.php?name=$module_name\" method=\"post\">" 34 ."<b>"._YOURNAME.":</b> "; 35 if (is_user($user)) { 36 cookiedecode($user); 37 echo "<a href=\"modules.php?name=Your_Account\">$cookie[1]</a> <font class=\"content\">[ <a href=\"modules.php?name=Your_Account&op=logout\">"._LOGOUT."</a> ]</font>"; 38 } else { 39 echo "$anonymous <font class=\"content\">[ <a href=\"modules.php?name=Your_Account\">"._NEWUSER."</a> ]</font>"; 40 } 41 echo "<br><br>" 42 ."<b>"._SUBTITLE."</b> " 43 ."("._BEDESCRIPTIVE.")<br>" 44 ."<input type=\"text\" name=\"subject\" size=\"50\" maxlength=\"80\"><br><font class=\"content\">("._BADTITLES.")</font>" 45 ."<br><br>" 46 ."<b>"._TOPIC.":</b> <select name=\"topic\">"; 47 $result = $db->sql_query("SELECT topicid, topictext FROM ".$prefix."_topics ORDER BY topictext"); 48 echo "<option value=\"\">"._SELECTTOPIC."</option>\n"; 49 while ($row = $db->sql_fetchrow($result)) { 50 $topicid = intval($row['topicid']); 51 $topics = filter($row['topictext'], "nohtml"); 52 if ($topicid == $topic) { 53 $sel = "selected "; 54 } 55 echo "<option $sel value=\"$topicid\">$topics</option>\n"; 56 $sel = ""; 57 } 58 echo "</select>"; 59 if ($multilingual == 1) { 60 echo "<br><br><b>"._LANGUAGE.": </b>" 61 ."<select name=\"alanguage\">"; 62 $handle=opendir('language'); 63 while ($file = readdir($handle)) { 64 if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) { 65 $langFound = $matches[1]; 66 $languageslist .= "$langFound "; 67 } 68 } 69 closedir($handle); 70 $languageslist = explode(" ", $languageslist); 71 sort($languageslist); 72 for ($i=0; $i < sizeof($languageslist); $i++) { 73 if(!empty($languageslist[$i])) { 74 echo "<option value=\"$languageslist[$i]\" "; 75 if($languageslist[$i]==$currentlang) echo "selected"; 76 echo ">".ucfirst($languageslist[$i])."</option>\n"; 77 } 78 } 79 echo "</select>"; 80 } else { 81 echo "<input type=\"hidden\" name=\"alanguage\" value=\"$language\">"; 82 } 83 echo "<br><br>" 84 ."<b>"._STORYTEXT.":</b><br>" 85 ."<textarea cols=\"70\" rows=\"15\" name=\"story\"></textarea><br>" 86 ."<br><br><b>"._EXTENDEDTEXT.":</b><br>" 87 ."<textarea cols=\"70\" rows=\"15\" name=\"storyext\"></textarea><br>" 88 ."<font class=\"content\">("._AREYOUSURE.")<br><br>"; 89 if ($nuke_editor == 0) { 90 echo "<font class=\"content\">"._ALLOWEDHTML."<br>"; 91 while (list($key,) = each($AllowableHTML)) echo " <".$key.">"; 92 echo "</font><br><br>"; 93 } else { 94 echo ""._HTMLNOTALLOWED."</font><br><br>"; 95 } 96 echo "<input type=\"submit\" name=\"op\" value=\""._PREVIEW."\"><br>("._SUBPREVIEW.")</font></form>"; 97 CloseTable(); 98 include ('footer.php'); 99 } 100 101 function PreviewStory($name, $address, $subject, $story, $storyext, $topic, $alanguage) { 102 global $user, $cookie, $bgcolor1, $bgcolor2, $anonymous, $prefix, $multilingual, $AllowableHTML, $db, $module_name, $nuke_editor; 103 include ("header.php"); 104 $f_story = filter($story); 105 $f_storyext = filter($storyext); 106 $subject = filter($subject, "nohtml", 0, preview); 107 $story2 = "$f_story<br><br>$f_storyext"; 108 OpenTable(); 109 echo "<center><font class=\"title\"><b>"._NEWSUBPREVIEW."</b></font>"; 110 CloseTable(); 111 echo "<br>"; 112 OpenTable(); 113 echo "<center><i>"._STORYLOOK."</i></center><br><br>"; 114 echo "<table width=\"70%\" bgcolor=\"$bgcolor2\" cellpadding=\"0\" cellspacing=\"1\" border=\"0\"align=\"center\"><tr><td>" 115 ."<table width=\"100%\" bgcolor=\"$bgcolor1\" cellpadding=\"8\" cellspacing=\"1\" border=\"0\"><tr><td>"; 116 if (empty($topic)) { 117 $topicimage="AllTopics.gif"; 118 $warning = "<center><blink><b>"._SELECTTOPIC."</b></blink></center>"; 119 } else { 120 $warning = ""; 121 $row = $db->sql_fetchrow($db->sql_query("SELECT topictext, topicimage FROM ".$prefix."_topics WHERE topicid='$topic'")); 122 $topicimage = filter($row['topicimage'], "nohtml"); 123 } 124 echo "<img src=\"images/topics/$topicimage\" border=\"0\" align=\"right\" alt=\"".$row['topictext']."\" title=\"".$row['topictext']."\">"; 125 themepreview($subject, $story2); 126 echo "$warning" 127 ."</td></tr></table></td></tr></table>" 128 ."<br><br><center><font class=\"tiny\">"._CHECKSTORY."</font></center>"; 129 CloseTable(); 130 echo "<br>"; 131 OpenTable(); 132 echo "<p><form action=\"modules.php?name=$module_name\" method=\"post\">" 133 ."<b>"._YOURNAME.":</b> "; 134 if (is_user($user)) { 135 cookiedecode($user); 136 echo "<a href=\"modules.php?name=Your_Account\">$cookie[1]</a> <font class=\"content\">[ <a href=\"modules.php?name=Your_Account&op=logout\">"._LOGOUT."</a> ]</font>"; 137 } else { 138 echo "$anonymous"; 139 } 140 echo "<br><br><b>"._SUBTITLE.":</b><br>" 141 ."<input type=\"text\" name=\"subject\" size=\"50\" maxlength=\"80\" value=\"$subject\">" 142 ."<br><br><b>"._TOPIC.": </b><select name=\"topic\">"; 143 $result2 = $db->sql_query("SELECT topicid, topictext FROM ".$prefix."_topics ORDER BY topictext"); 144 echo "<OPTION VALUE=\"\">"._SELECTTOPIC."</option>\n"; 145 while ($row2 = $db->sql_fetchrow($result2)) { 146 $topicid = intval($row2['topicid']); 147 $topics = filter($row2['topictext'], "nohtml"); 148 if ($topicid == $topic) { 149 $sel = "selected "; 150 } 151 echo "<option $sel value=\"$topicid\">$topics</option>\n"; 152 $sel = ""; 153 } 154 echo "</select>"; 155 if ($multilingual == 1) { 156 echo "<br><br><b>"._LANGUAGE.": </b>" 157 ."<select name=\"alanguage\">"; 158 $handle=opendir('language'); 159 while ($file = readdir($handle)) { 160 if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) { 161 $langFound = $matches[1]; 162 $languageslist .= "$langFound "; 163 } 164 } 165 closedir($handle); 166 $languageslist = explode(" ", $languageslist); 167 sort($languageslist); 168 for ($i=0; $i < sizeof($languageslist); $i++) { 169 if(!empty($languageslist[$i])) { 170 echo "<option value=\"$languageslist[$i]\" "; 171 if($languageslist[$i]==$alanguage) echo "selected"; 172 echo ">".ucfirst($languageslist[$i])."</option>\n"; 173 } 174 } 175 echo "</select>"; 176 } 177 echo "<br><br><b>"._STORYTEXT.":</b><br>" 178 ."<textarea cols=\"70\" rows=\"15\" name=\"story\">$f_story</textarea><br>" 179 ."<br><b>"._EXTENDEDTEXT.":</b><br>" 180 ."<textarea cols=\"70\" rows=\"15\" name=\"storyext\">$f_storyext</textarea><br>" 181 ."<font class=\"content\">("._AREYOUSURE.")</font><br><br>"; 182 if ($nuke_editor == 0) { 183 echo "<font class=\"content\">"._ALLOWEDHTML."<br>"; 184 while (list($key,) = each($AllowableHTML)) echo " <".$key.">"; 185 echo "</font><br><br>"; 186 } else { 187 echo ""._HTMLNOTALLOWED."</font><br><br>"; 188 } 189 echo "<input type=\"submit\" name=\"op\" value=\""._PREVIEW."\"> " 190 ."<input type=\"submit\" name=\"op\" value=\""._OK."\"></form>"; 191 CloseTable(); 192 include ("footer.php"); 193 } 194 195 function submitStory($name, $address, $subject, $story, $storyext, $topic, $alanguage) { 196 global $user, $EditedMessage, $cookie, $anonymous, $notify, $notify_email, $notify_subject, $notify_message, $notify_from, $prefix, $db; 197 if (is_user($user)) { 198 cookiedecode($user); 199 $uid = $cookie[0]; 200 $name = $cookie[1]; 201 } else { 202 $uid = 1; 203 $name = "$anonymous"; 204 } 205 $subject = filter($subject, "nohtml", 1); 206 $story = filter($story, "", 1); 207 $storyext = filter($storyext, "", 1); 208 $result = $db->sql_query("INSERT INTO ".$prefix."_queue VALUES (NULL, '$uid', '$name', '$subject', '$story', '$storyext', now(), '$topic', '$alanguage')"); 209 if(!$result) { 210 echo ""._ERROR."<br>"; 211 exit(); 212 } 213 if($notify) { 214 $notify_message = "$notify_message\n\n\n========================================================\n$subject\n\n\n$story\n\n$storyext\n\n$name"; 215 mail($notify_email, $notify_subject, $notify_message, "From: $notify_from\nX-Mailer: PHP/" . phpversion()); 216 } 217 include ("header.php"); 218 OpenTable(); 219 $waiting = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_queue")); 220 echo "<center><font class=\"title\">"._SUBSENT."</font><br><br>" 221 ."<font class=\"content\"><b>"._THANKSSUB."</b><br><br>" 222 .""._SUBTEXT."" 223 ."<br>"._WEHAVESUB." $waiting "._WAITING.""; 224 CloseTable(); 225 include ("footer.php"); 226 } 227 228 if (!isset($address)) { $address = ""; } 229 if (!isset($alanguage)) { $alanguage = ""; } 230 231 switch($op) { 232 233 case ""._PREVIEW."": 234 PreviewStory($name, $address, $subject, $story, $storyext, $topic, $alanguage); 235 break; 236 237 case ""._OK."": 238 SubmitStory($name, $address, $subject, $story, $storyext, $topic, $alanguage); 239 break; 240 241 default: 242 defaultDisplay(); 243 break; 244 245 } 246 247 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 11:11:59 2007 | par Balluche grâce à PHPXref 0.7 |