home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / private_messages / read.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  7.4 KB  |  139 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Advanced Content Management System                         */
  5. /* ============================================                         */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* =========================                                            */
  11. /* Part of phpBB integration                                            */
  12. /* Copyright (c) 2001 by                                                */
  13. /*    Richard Tirtadji AKA King Richard (rtirtadji@hotmail.com)         */
  14. /*    Hutdik Hermawan AKA hotFix (hutdik76@hotmail.com)                 */
  15. /* http://www.phpnuke.web.id                                            */
  16. /*                                                                      */
  17. /* This program is free software. You can redistribute it and/or modify */
  18. /* it under the terms of the GNU General Public License as published by */
  19. /* the Free Software Foundation; either version 2 of the License.       */
  20. /************************************************************************/
  21.  
  22. require_once("mainfile.php");
  23. $module_name = basename(dirname(__FILE__));
  24. get_lang($module_name);
  25.  
  26. include("modules/".$module_name."/functions.php");
  27. include("modules/".$module_name."/auth.php");
  28.  
  29. if (!is_user($user)) {
  30.     Header("Location: modules.php?name=Your_Account");
  31. } else {    
  32. /*
  33.     if (isset($reply)) {
  34.     global $msg_id;
  35.     Header("Location: modules.php?name=$module_name&file=reply&reply=1&msg_id=$myrow[msg_id]");
  36.     exit();
  37.     }
  38.  
  39.     if (isset($delete)) {
  40.     Header("Location: modules.php?name=$module_name&file=reply&delete=1&msg_id=$myrow[msg_id]");
  41.     exit();
  42.     }
  43. */
  44.     include('header.php');
  45.     $user2 = base64_decode($user);
  46.     $userdata = explode(":", $user2);
  47.     if (!$result = check_user_pw($userdata[1],$userdata[2],$db,$system))
  48.     $userdata = get_userdata($userdata[1], $db);
  49.     $sql = "SELECT * FROM ".$prefix."_priv_msgs WHERE to_userid = '$userdata[uid]' LIMIT $start,1";
  50.     $resultID = sql_query($sql, $dbi);
  51.     if (!$resultID) {
  52.     forumerror(0005);
  53.     } else {
  54.     $myrow = sql_fetch_array($resultID, $dbi);
  55.     $sql = "UPDATE ".$prefix."_priv_msgs SET read_msg='1' WHERE msg_id='$myrow[msg_id]'";
  56.     $result = sql_query($sql, $dbi);
  57.         if (!$result) {
  58.             forumerror(0005);
  59.         }
  60.     }
  61.     OpenTable();
  62.     echo "<center><font class=\"title\"><b>"._PRIVATEMESSAGE."</b></font><br><br><font class=\"content\">[ <a href=\"modules.php?name=$module_name\">"._INDEX."</a> | <i>$myrow[subject]</i> ]</font></center>";
  63.     CloseTable();
  64.     echo "<br>";
  65.  
  66.     if (is_user($user)) {
  67.     include("modules/Your_Account/navbar.php");
  68.     OpenTable();
  69.     nav();
  70.     CloseTable();
  71.     echo "<br>";
  72.     }
  73.  
  74.     OpenTable();
  75.     echo "<table border=\"0\" cellpadding=\"1\" cellpadding=\"0\" valign=\"top\" width=\"100%\"><tr><td>"
  76.     ."<table border=\"0\" cellpadding=\"3\" cellpadding=\"1\" width=\"100%\">"
  77.     ."<tr bgcolor=\"$bgcolor3\" align=\"left\">"
  78.     ."<td width=\"20%\" colspan=\"2\" align=\"center\"><font class=\"tiny\" color=\"$textcolor2\"><b>"._FROM."</b></font></td>"
  79.     ."</tr>";
  80.     if (!sql_num_rows($resultID, $dbi)) {
  81.     echo "<td bgcolor=\"$bgcolor1\" colspan=\"2\" align=\"center\">"._DONTHAVEMESSAGES."</td></tr>\n";
  82.     } else {
  83.     echo "<tr bgcolor=\"$bgcolor2\" align=\"left\">\n";
  84.     $posterdata = get_userdata_from_id($myrow[from_userid], $db);
  85.     echo "<td valign=\"top\"><b>$posterdata[uname]</b><br><br>\n";
  86.     if ($posterdata[user_from] != "") {
  87.         echo "<font class=\"content\">"._FROM.": $posterdata[user_from]</font><br><br>\n";
  88.     }
  89.     if ($posterdata[user_avatar] != "")
  90.     echo "<img src='images/forum/avatar/$posterdata[user_avatar]' alt=\"\">\n"
  91.         ."</td><td><img src=\"images/forum/subject/$myrow[msg_image]\" alt=\"\"> <b>$myrow[subject]</b> <i>("._SENT.": $myrow[msg_time])</i>"
  92.         ."<br><img src=\"images/blackpixel.gif\" width=\"100%\" height=\"1\"><br><br><br>\n";
  93.     $message = stripslashes($myrow[msg_text]);
  94.     $message = eregi_replace("\[addsig]", "<br>-----------------<br>".$posterdata[user_attachsig], bbencode_priv($message));
  95.     $message = strip_tags($message, '<br><b><u><i><a><li><strong><blockquote><ul><ol><img>');
  96.     echo $message . "<br><br><br>"
  97.         ."<img src=\"images/blackpixel.gif\" width=\"100%\" height=\"1\">\n"
  98.         ." <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$posterdata[uname]\"><img src=\"images/forum/icons/profile.gif\" border=\"0\" alt=\"\"></a><font class=\"tiny\">"._PROFILE."</font>\n";
  99.     if($posterdata["femail"] != 0) 
  100.         echo "  <a href=\"mailto:$posterdata[femail]\"><IMG SRC=\"images/forum/icons/email.gif\" border=\"0\" alt=\"\"></a><font class=\"tiny\">"._EMAIL."</font>\n";
  101.     if($posterdata["url"] != '' AND $posterdata[url] != "http://") {
  102.         echo "  <a href=\"$posterdata[url]\" TARGET=\"_blank\"><IMG SRC=\"images/forum/icons/www_icon.gif\" border=0 Alt=\"\"></a><font class=tiny>www</font>\n";
  103.     }
  104.     if($posterdata["user_icq"] != '')
  105.         echo "  <a href=\"http://wwp.mirabilis.com/$posterdata[icq]\" TARGET=\"_blank\"><IMG SRC=\"http://wwp.icq.com/scripts/online.dll?icq=$posterdata[user_icq]&img=5\" border=0\" Alt=\"\"></a>";
  106.     if($posterdata["user_aim"] != '')
  107.              echo " <a href=\"aim:goim?screenname=$posterdata[user_aim]&message=Hi+$posterdata[user_aim].+Are+you+there?\"><img src=\"images/forum/icons/aim.gif\" border=\"0\" Alt=\"\"></a><font class=tiny>aim</font>";
  108.     if($posterdata["user_yim"] != '')
  109.              echo " <a href=\"http://edit.yahoo.com/config/send_webmesg?.target=$posterdata[user_yim]&.src=pg\"><img src=\"images/forum/icons/yim.gif\" border=\"0\" Alt=\"\"></a>";
  110.     if($posterdata["user_msnm"] != '')
  111.              echo " <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$posterdata[uname]\"><img src=\"images/forum/icons/msnm.gif\" border=\"0\" Alt=\"\"></a>";
  112.     echo "</td></tr></table></td></tr></table>"
  113.         ."<table border=\"0\" width=\"99%\" cellspacing=\"0\" cellpaddin=\"0\" align=\"center\"><tr><td>"
  114.         ."<table border=\"0\">"
  115.         ."<tr align=\"left\"><td align=\"left\">"
  116.         ."<form action=\"modules.php?name=$module_name&file=reply\" method=\"post\"><input type=\"hidden\" name=\"msg_id\" value=\"$myrow[msg_id]\"><input type=\"submit\" name=\"reply\" value=\""._REPLY."\"></form>\n"
  117.         ."</td><td>"
  118.         ."<form action=\"modules.php?name=$module_name&file=reply\" method=\"post\"><input type=\"hidden\" name=\"msg_id\" value=\"$myrow[msg_id]\"><input type=\"submit\" name=\"delete\" value=\""._DELETE."\"></form>\n"
  119.         ."</td></tr></table>"
  120.         ."</td><td align=\"right\">";
  121.     $previous = $start-1;
  122.     $next = $start+1;
  123.     if ($previous >= 0) {
  124.         echo "<a href=\"modules.php?name=$module_name&file=read&start=$previous&total_messages=$total_messages\">"._PREVIOUSMESSAGE."</a> | ";
  125.     } else {
  126.         echo ""._PREVIOUSMESSAGE." | ";
  127.     }
  128.     if ($next < $total_messages) {
  129.         echo "<a href=\"modules.php?name=$module_name&file=read&start=$next&total_messages=$total_messages\">"._NEXTMESSAGE."</a></font> ";
  130.     } else {
  131.         echo ""._NEXTMESSAGE."</font> ";
  132.     }
  133.     }
  134.     echo "</font></td></tr></table>";
  135.     CloseTable();
  136. }
  137. include('footer.php');
  138.  
  139. ?>