[ 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('ADMIN_FILE')) { 16 die ("Access Denied"); 17 } 18 19 global $prefix, $db, $admin_file; 20 $aid = substr("$aid", 0,25); 21 $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'")); 22 if ($row['radminsuper'] == 1) { 23 24 /*********************************************************/ 25 /* Messages Functions */ 26 /*********************************************************/ 27 28 function MsgDeactive($mid) { 29 global $prefix, $db, $admin_file; 30 $mid = intval($mid); 31 $db->sql_query("update " . $prefix . "_message set active='0' WHERE mid='$mid'"); 32 Header("Location: ".$admin_file.".php?op=messages"); 33 } 34 35 function messages() { 36 global $admin, $admlanguage, $language, $bgcolor1, $bgcolor2, $prefix, $db, $multilingual, $admin_file; 37 include ("header.php"); 38 GraphicAdmin(); 39 OpenTable(); 40 echo "<center><font class=\"title\"><b>" . _MESSAGESADMIN . "</b></font></center>"; 41 CloseTable(); 42 echo "<br>"; 43 if (empty($admlanguage)) { 44 $admlanguage = $language; /* This to make sure some language is pre-selected */ 45 } 46 OpenTable(); 47 echo "<center><font class=\"title\"><b>" . _ALLMESSAGES . "</b></font><br><br><table border=\"1\" width=\"100%\" bgcolor=\"$bgcolor1\">" 48 ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _ID . "</b></td>" 49 ."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _TITLE . "</b></td>" 50 ."<td bgcolor=\"$bgcolor2\" align=\"center\"> <b>" . _LANGUAGE . "</b> </td>" 51 ."<td bgcolor=\"$bgcolor2\" align=\"center\" nowrap> <b>" . _VIEW . "</b> </td>" 52 ."<td bgcolor=\"$bgcolor2\" align=\"center\"> <b>" . _STATUS . "</b> </td>" 53 ."<td bgcolor=\"$bgcolor2\" align=\"center\"> <b>" . _FUNCTIONS . "</b> </td></tr>"; 54 $result = $db->sql_query("SELECT mid, title, content, date, expire, active, view, mlanguage from " . $prefix . "_message"); 55 while ($row = $db->sql_fetchrow($result)) { 56 $mid = intval($row['mid']); 57 $title = filter($row['title'], "nohtml"); 58 $content = filter($row['content']); 59 $mdate = $row['date']; 60 $expire = intval($row['expire']); 61 $active = intval($row['active']); 62 $view = intval($row['view']); 63 $mlanguage = $row['mlanguage']; 64 if ($active == 1) { 65 $mactive = "<img src=\"images/active.gif\" alt=\""._ACTIVE."\" title=\""._ACTIVE."\" border=\"0\" width=\"16\" height=\"16\">"; 66 } elseif ($active == 0) { 67 $mactive = "<img src=\"images/inactive.gif\" alt=\""._INACTIVE."\" title=\""._INACTIVE."\" border=\"0\" width=\"16\" height=\"16\">"; 68 } 69 if ($view == 1) { 70 $mview = "" . _MVALL . ""; 71 } elseif ($view == 2) { 72 $mview = "" . _MVANON . ""; 73 } elseif ($view == 3) { 74 $mview = "" . _MVUSERS . ""; 75 } elseif ($view == 4) { 76 $mview = "" . _MVADMIN . ""; 77 } elseif ($view == 5) { 78 $mview = ""._SUBUSERS.""; 79 } 80 if (empty($mlanguage)) { 81 $mlanguage = "" . _ALL . ""; 82 } 83 echo "<tr><td align=\"right\"><b>$mid</b>" 84 ."</td><td align=\"left\" width=\"100%\"><b>$title</b>" 85 ."</td><td align=\"center\">$mlanguage" 86 ."</td><td align=\"center\" nowrap>$mview" 87 ."</td><td align=\"center\">$mactive" 88 ."</td><td align=\"center\"> <a href=\"".$admin_file.".php?op=editmsg&mid=$mid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a> <a href=\"".$admin_file.".php?op=deletemsg&mid=$mid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a> " 89 ."</td></tr>"; 90 91 } 92 echo "</table></center><br>"; 93 CloseTable(); 94 echo "<br>"; 95 OpenTable(); 96 echo "<center><font class=\"title\"><b>" . _ADDMSG . "</b></font></center><br>"; 97 echo "<form action=\"".$admin_file.".php\" method=\"post\">" 98 ."<br><b>" . _MESSAGETITLE . ":</b><br>" 99 ."<input type=\"text\" name=\"add_title\" value=\"\" size=\"50\" maxlength=\"100\"><br><br>" 100 ."<b>" . _MESSAGECONTENT . ":</b><br>" 101 ."<textarea name=\"add_content\" rows=\"15\" wrap=\"virtual\" cols=\"70\"></textarea><br><br>"; 102 if ($multilingual == 1) { 103 echo "<b>" . _LANGUAGE . ": </b>" 104 ."<select name=\"add_mlanguage\">"; 105 $handle=opendir('language'); 106 while ($file = readdir($handle)) { 107 if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) { 108 $langFound = $matches[1]; 109 $languageslist .= "$langFound "; 110 } 111 } 112 closedir($handle); 113 $languageslist = explode(" ", $languageslist); 114 sort($languageslist); 115 for ($i=0; $i < sizeof($languageslist); $i++) { 116 if($languageslist[$i]!="") { 117 echo "<option value=\"$languageslist[$i]\" "; 118 if($languageslist[$i]==$language) echo "selected"; 119 echo ">".ucfirst($languageslist[$i])."</option>\n"; 120 } 121 } 122 echo "<option value=\"\">" . _ALL . "</option></select><br><br>"; 123 } else { 124 echo "<input type=\"hidden\" name=\"add_mlanguage\" value=\"\">"; 125 } 126 $now = time(); 127 echo "<b>" . _EXPIRATION . ":</b> <select name=\"add_expire\">" 128 ."<option value=\"86400\" >1 " . _DAY . "</option>" 129 ."<option value=\"172800\" >2 " . _DAYS . "</option>" 130 ."<option value=\"432000\" >5 " . _DAYS . "</option>" 131 ."<option value=\"1296000\" >15 " . _DAYS . "</option>" 132 ."<option value=\"2592000\" >30 " . _DAYS . "</option>" 133 ."<option value=\"0\" >" . _UNLIMITED . "</option>" 134 ."</select><br><br>" 135 ."<b>Active?</b> <input type=\"radio\" name=\"add_active\" value=\"1\" checked>" . _YES . " " 136 ."<input type=\"radio\" name=\"add_active\" value=\"0\" >" . _NO . ""; 137 echo "<br><br><b>" . _VIEWPRIV . "</b> <select name=\"add_view\">" 138 ."<option value=\"1\" >" . _MVALL . "</option>" 139 ."<option value=\"2\" >" . _MVANON . "</option>" 140 ."<option value=\"3\" >" . _MVUSERS . "</option>" 141 ."<option value=\"4\" >" . _MVADMIN . "</option>" 142 ."<option value=\"5\" >" . _SUBUSERS . "</option>" 143 ."</select><br><br>" 144 ."<input type=\"hidden\" name=\"op\" value=\"addmsg\">" 145 ."<input type=\"hidden\" name=\"add_mdate\" value=\"$now\">" 146 ."<input type=\"submit\" value=\"" . _ADDMSG . "\">" 147 ."</form>"; 148 CloseTable(); 149 include ("footer.php"); 150 } 151 152 function editmsg($mid) { 153 global $admin, $prefix, $db, $multilingual, $admin_file; 154 include ("header.php"); 155 $mid = intval($mid); 156 GraphicAdmin(); 157 OpenTable(); 158 echo "<center><font class=\"title\"><b>" . _MESSAGESADMIN . "</b></font></center>"; 159 CloseTable(); 160 echo "<br>"; 161 $row = $db->sql_fetchrow($db->sql_query("SELECT title, content, date, expire, active, view, mlanguage from " . $prefix . "_message WHERE mid='$mid'")); 162 $title = filter($row['title'], "nohtml"); 163 $content = filter($row['content']); 164 $mdate = $row['date']; 165 $expire = intval($row['expire']); 166 $active = intval($row['active']); 167 $view = intval($row['view']); 168 $mlanguage = $row['mlanguage']; 169 OpenTable(); 170 echo "<center><font class=\"title\"><b>" . _EDITMSG . "</b></font></center>"; 171 if ($active == 1) { 172 $asel1 = "checked"; 173 $asel2 = ""; 174 } elseif ($active == 0) { 175 $asel1 = ""; 176 $asel2 = "checked"; 177 } 178 $sel1 = $sel2 = $sel3 = $sel4 = $sel5 = ""; 179 if ($view == 1) { 180 $sel1 = "selected"; 181 } elseif ($view == 2) { 182 $sel2 = "selected"; 183 } elseif ($view == 3) { 184 $sel3 = "selected"; 185 } elseif ($view == 4) { 186 $sel4 = "selected"; 187 } elseif ($view == 5) { 188 $sel5 = "selected"; 189 } 190 $esel1 = $esel2 = $esel3 = $esel4 = $esel5 = $esel6 = ""; 191 if ($expire == 86400) { 192 $esel1 = "selected"; 193 } elseif ($expire == 172800) { 194 $esel2 = "selected"; 195 } elseif ($expire == 432000) { 196 $esel3 = "selected"; 197 } elseif ($expire == 1296000) { 198 $esel4 = "selected"; 199 } elseif ($expire == 2592000) { 200 $esel5 = "selected"; 201 } elseif ($expire == 0) { 202 $esel6 = "selected"; 203 } 204 echo "<form action=\"".$admin_file.".php\" method=\"post\">" 205 ."<br><b>" . _MESSAGETITLE . ":</b><br>" 206 ."<input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br><br>" 207 ."<b>" . _MESSAGECONTENT . ":</b><br>" 208 ."<textarea name=\"content\" rows=\"15\" wrap=\"virtual\" cols=\"70\">$content</textarea><br><br>"; 209 if ($multilingual == 1) { 210 echo "<b>" . _LANGUAGE . ": </b>" 211 ."<select name=\"mlanguage\">"; 212 $handle=opendir('language'); 213 while ($file = readdir($handle)) { 214 if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) { 215 $langFound = $matches[1]; 216 $languageslist .= "$langFound "; 217 } 218 } 219 closedir($handle); 220 $languageslist = explode(" ", $languageslist); 221 sort($languageslist); 222 for ($i=0; $i < sizeof($languageslist); $i++) { 223 if(!empty($languageslist[$i])) { 224 echo "<option value=\"$languageslist[$i]\" "; 225 if($languageslist[$i]==$mlanguage) echo "selected"; 226 echo ">".ucfirst($languageslist[$i])."</option>\n"; 227 } 228 } 229 if (empty($mlanguage)) { 230 $sellang = "selected"; 231 } else { 232 $sellang = ""; 233 } 234 echo "<option value=\"\" $sellang>" . _ALL . "</option></select><br><br>"; 235 } else { 236 echo "<input type=\"hidden\" name=\"mlanguage\" value=\"\">"; 237 } 238 echo "<b>" . _EXPIRATION . ":</b> <select name=\"expire\">" 239 ."<option name=\"expire\" value=\"86400\" $esel1>1 " . _DAY . "</option>" 240 ."<option name=\"expire\" value=\"172800\" $esel2>2 " . _DAYS . "</option>" 241 ."<option name=\"expire\" value=\"432000\" $esel3>5 " . _DAYS . "</option>" 242 ."<option name=\"expire\" value=\"1296000\" $esel4>15 " . _DAYS . "</option>" 243 ."<option name=\"expire\" value=\"2592000\" $esel5>30 " . _DAYS . "</option>" 244 ."<option name=\"expire\" value=\"0\" $esel6>" . _UNLIMITED . "</option>" 245 ."</select><br><br>" 246 ."<b>Active?</b> <input type=\"radio\" name=\"active\" value=\"1\" $asel1>" . _YES . " " 247 ."<input type=\"radio\" name=\"active\" value=\"0\" $asel2>" . _NO . ""; 248 if ($active == 1) { 249 echo "<br><br><b>" . _CHANGEDATE . "</b>" 250 ."<input type=\"radio\" name=\"chng_date\" value=\"1\">" . _YES . " " 251 ."<input type=\"radio\" name=\"chng_date\" value=\"0\" checked>" . _NO . "<br><br>"; 252 } elseif ($active == 0) { 253 echo "<br><font class=\"tiny\">" . _IFYOUACTIVE . "</font><br><br>" 254 ."<input type=\"hidden\" name=\"chng_date\" value=\"1\">"; 255 } 256 echo "<b>" . _VIEWPRIV . "</b> <select name=\"view\">" 257 ."<option name=\"view\" value=\"1\" $sel1>" . _MVALL . "</option>" 258 ."<option name=\"view\" value=\"2\" $sel2>" . _MVANON . "</option>" 259 ."<option name=\"view\" value=\"3\" $sel3>" . _MVUSERS . "</option>" 260 ."<option name=\"view\" value=\"4\" $sel4>" . _MVADMIN . "</option>" 261 ."<option name=\"view\" value=\"5\" $sel5>" . _SUBUSERS . "</option>" 262 ."</select><br><br>" 263 ."<input type=\"hidden\" name=\"mdate\" value=\"$mdate\">" 264 ."<input type=\"hidden\" name=\"mid\" value=\"$mid\">" 265 ."<input type=\"hidden\" name=\"op\" value=\"savemsg\">" 266 ."<input type=\"submit\" value=\"" . _SAVECHANGES . "\">" 267 ."</form>"; 268 CloseTable(); 269 include ("footer.php"); 270 } 271 272 function savemsg($mid, $title, $content, $mdate, $expire, $active, $view, $chng_date, $mlanguage) { 273 global $prefix, $db, $admin_file; 274 $mid = intval($mid); 275 $title = filter($title, "nohtml", 1); 276 $content = filter($content, "", 1); 277 if ($chng_date == 1) { 278 $newdate = time(); 279 } elseif ($chng_date == 0) { 280 $newdate = $mdate; 281 } 282 $result = $db->sql_query("update " . $prefix . "_message set title='$title', content='$content', date='$newdate', expire='$expire', active='$active', view='$view', mlanguage='$mlanguage' WHERE mid='$mid'"); 283 Header("Location: ".$admin_file.".php?op=messages"); 284 } 285 286 function addmsg($add_title, $add_content, $add_mdate, $add_expire, $add_active, $add_view, $add_mlanguage) { 287 global $prefix, $db, $admin_file; 288 $title = filter($add_title, "nohtml", 1); 289 $content = filter($add_content, "", 1); 290 $result = $db->sql_query("insert into " . $prefix . "_message values (NULL, '$add_title', '$add_content', '$add_mdate', '$add_expire', '$add_active', '$add_view', '$add_mlanguage')"); 291 if (!$result) { 292 exit(); 293 } 294 Header("Location: ".$admin_file.".php?op=messages"); 295 } 296 297 function deletemsg($mid, $ok=0) { 298 global $prefix, $db, $admin_file; 299 $mid = intval($mid); 300 if($ok) { 301 $result = $db->sql_query("delete from " . $prefix . "_message where mid='$mid'"); 302 if (!$result) { 303 return; 304 } 305 Header("Location: ".$admin_file.".php?op=messages"); 306 } else { 307 include ("header.php"); 308 GraphicAdmin(); 309 OpenTable(); 310 echo "<center><font size=\"4\"><b>" . _MESSAGESADMIN . "</b></font></center>"; 311 CloseTable(); 312 echo "<br>"; 313 OpenTable(); 314 echo "<center>" . _REMOVEMSG . ""; 315 echo "<br><br>[ <a href=\"".$admin_file.".php?op=messages\">" . _NO . "</a> | <a href=\"".$admin_file.".php?op=deletemsg&mid=$mid&ok=1\">" . _YES . "</a> ]</center>"; 316 CloseTable(); 317 include ("footer.php"); 318 } 319 } 320 321 if (!isset($title)) { $title = ""; } 322 if (!isset($content)) { $content = ""; } 323 if (!isset($mdate)) { $mdate = ""; } 324 if (!isset($expire)) { $expire = ""; } 325 if (!isset($active)) { $active = ""; } 326 if (!isset($view)) { $view = ""; } 327 if (!isset($chng_date)) { $chng_date = ""; } 328 if (!isset($mlanguage)) { $mlanguage = ""; } 329 if (!isset($ok)) { $ok = ""; } 330 331 switch ($op){ 332 333 case "messages": 334 messages(); 335 break; 336 337 case "editmsg": 338 editmsg($mid, $title, $content, $mdate, $expire, $active, $view, $chng_date, $mlanguage); 339 break; 340 341 case "addmsg": 342 addmsg($add_title, $add_content, $add_mdate, $add_expire, $add_active, $add_view, $add_mlanguage); 343 break; 344 345 case "deletemsg": 346 deletemsg($mid, $ok); 347 break; 348 349 case "savemsg": 350 savemsg($mid, $title, $content, $mdate, $expire, $active, $view, $chng_date, $mlanguage); 351 break; 352 353 } 354 355 } else { 356 echo "Access Denied"; 357 } 358 359 ?>
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 |