Location: PHPKode > projects > ProNuke. Postnuke To Oracle > postnuke/html/modules/Messages/Messages/index.php
<?php // File: $Id: index.php,v 1.24 2001/12/04 13:07:45 jgm Exp $ $Name:  $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Francisco Burzi
// Purpose of file: 
// ----------------------------------------------------------------------

if (!defined("LOADED_AS_MODULE")) {
    die ("You can't access this file directly...");
}

$ModName = $GLOBALS['name'];

include 'mainfile.php';
include 'modules/'.$ModName.'/functions.php';

modules_get_language();
global $display;

$forumpage = 1;

// Post-Nuke: turn off icon here as well...should match setting in replypmsg. 1 = off / 0 = on
$smilies = 1 ;

//FTO : Remove Warning
if (!isset($db)) $db="";

if (!is_user($user)) {
    pnRedirect('user.php');
} else {
    include('header.php');
    $user = base64_decode($user);
    $userdata = explode(":", $user);
    if (!$result = check_user_pw($userdata[1],$userdata[2],$db,$system))
        $userdata = get_userdata($userdata[1],$db);
    $column = &$pntable['priv_msgs_column'];
    $sql = getSelectAllColumnsFrom ('priv_msgs', "$column[to_userid]=$userdata[uid]");
    //    $sql = "SELECT $column[msg_id] AS msg_id, $column[msg_image] AS msg_image, 
    //              $column[subject] AS subject, $column[from_userid] AS from_userid, 
    //              $column[to_userid] AS to_userid, $column[msg_time] AS msg_time, 
    //              $column[msg_text] AS msg_text, $column[read_msg] AS read_msg 
    //            FROM $pntable[priv_msgs] 
    //            WHERE $column[to_userid]=$userdata[uid]";
    $resultID = $dbconn->Execute($sql); 
    if($dbconn->ErrorNo()<>0) {
        error_log("DB Error: " . $dbconn->ErrorMsg());
        echo  $dbconn->ErrorMsg() . "<br>";
        forumerror(0005);
    }
    OpenTable();
    echo "<center><font class=\"pn-pagetitle\">"._PRIVATEMESSAGES."</font></center>";
    CloseTable();
    echo "<br>";
    echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\" valign=\"top\" width=\"100%\"><tr><td>"
        ."<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">"
        ."<form name=\"prvmsg\" action=\"modules.php\" method=\"post\">"
        ."<input type=\"hidden\" name=\"op\" value=\"modload\">"
        ."<input type=\"hidden\" name=\"name\" value=\"$ModName\">"
        ."<input type=\"hidden\" name=\"file\" value=\"replypmsg\">"
        ."<tr bgcolor=\"$bgcolor2\" align=\"left\">"
        ."<td bgcolor=\"$bgcolor2\" align=\"center\" valign=\"middle\" width=\"5%\"><input name=\"allbox\" onclick=\"CheckAll();\" type=\"checkbox\" value=\""._CHECKALL."\"></td>"
        ."<td bgcolor=\"$bgcolor2\" align=\"center\" valign=\"middle\" width=\"5%\"><img src=\"images/global/download.gif\" border=\"0\" alt=\""._MSGSTATUS."\"></td>"
        ."<td bgcolor=\"$bgcolor2\" align=\"center\" valign=\"middle\" width=\"5%\">&nbsp;</td>"
        ."<td width=\"15%\"><font class=\"pn-normal\">"._FROM."</font></td>"
        ."<td width=\"55%\" ><font class=\"pn-normal\" >"._SUBJECT."</font></td>"
        ."<td width=\"15%\"><font class=\"pn-normal\">"._DATE."</font></td>"
        ."</tr>";
//FTO do not use Recordcount() to stay portable

//    if (!$total_messages = $resultID->PO_RecordCount()) {
    if ($resultID->EOF) {
        echo "<td bgcolor=\"$bgcolor3\" colspan=\"6\" align=\"center\"><font class=\"pn-normal\">"._DONTHAVEMESSAGES."</font></td></tr>\n";
    } else {
        $display=1;
    }
    $count=0;
//FTO To handle next and previous nav. -1 means nothing before of after

    $msgid=-1;

    while(!$resultID->EOF) {

        $msgprevid=$msgid;

        $myrow = $resultID->GetRowAssoc(false);
        $resultID->MoveNext();

        $msgid=$myrow['msg_id'];
        
        // get a Unix timestamp for this date/time  -- Alarion :: 08/21/2001
        $myrow['msg_time'] = mktime( substr($myrow['msg_time'], 11, 2),     // hour
                                     substr($myrow['msg_time'], 14, 2),    // minute
                                     '0',                                // second
                                     substr($myrow['msg_time'], 5, 2),     // month
                                     substr($myrow['msg_time'], 8, 2),     // day
                                     substr($myrow['msg_time'], 0, 4));    // year                                    
        //FTO Do not use Recordcount
        if ($count == 0) $total_messages = get_pmsg_count($myrow['from_userid'],$db);
        
        echo "<tr align=\"left\">";
        echo "<td bgcolor=\"$bgcolor1\" valign=\"top\" width=\"2%\" align=\"center\"><input type=\"checkbox\" onclick=\"CheckCheckAll();\" name=\"msg_id[$count]\" value=\"$myrow[msg_id]\"></td>";
        if ($myrow['read_msg'] == "1") {
            echo "<td valign=\"top\" width=\"5%\" align=\"center\" bgcolor=\"$bgcolor1\">&nbsp;</td>";
        } else {
            echo "<td valign=\"top\" width=\"5%\" align=\"center\" bgcolor=\"$bgcolor1\"><img src=\"images/global/read.gif\" border=\"0\" alt=\""._NOTREAD."\"></td>";
        }
        echo "<td bgcolor=\"$bgcolor3\" valign=\"top\" width=\"5%\" align=\"center\">";

        // Post-Nuke: to tie into replypmsg removal of icons/smilies ..cleans up look.

        if($smilies==1) {
            echo "";
        }
        else {
            echo "<img src=\" images/smilies/$myrow[msg_image]\" border=\"0\">";

        } // Post-Nuke: end

        echo "</td>";

        $posterdata = get_userdata_from_id($myrow['from_userid'],$db);
//FTO Added msgid msgnextid msgprevid on the url

        echo      "<td bgcolor=\"$bgcolor1\" valign=\"middle\" width=\"10%\"><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=$ModName&amp;file=readpmsg&amp;msgprevid=$msgprevid&amp;start=$count&amp;total_messages=$total_messages\">$posterdata[uname]</a></td>"
                 ."<td bgcolor=\"$bgcolor3\" valign=\"middle\"><font class=\"pn-normal\">$myrow[subject]</font></td>"
                 ."<td bgcolor=\"$bgcolor1\" valign=\"middle\" align=\"center\" width=\"25%\"><font class=\"pn-normal\">".ml_ftime(_DATETIMEBRIEF, GetUserTime($myrow['msg_time']))."</font></td></tr>";

        $count++;
    }



    if ($display) {
        echo "<tr bgcolor=\"$bgcolor2\" align=\"left\">";
        echo "<td colspan=6 align='left'>";
        echo "<INPUT TYPE=\"submit\" NAME='send' VALUE=\"Send\">   ";
        echo "<INPUT TYPE=\"submit\" NAME='delete' VALUE=\"Delete\">";
        echo "</td></tr>";
    
        echo "<input type='hidden' name='total_messages' value='$total_messages'>";
        echo "</form>";
    }
    else {
        echo "<tr bgcolor=\"$bgcolor2\" align=\"left\">";
        echo "<td colspan=6 align='left'><a class=\"pn-normal\" href='modules.php?op=modload&amp;name=$ModName&amp;file=replypmsg&amp;send=1'><IMG SRC='images/global/send.gif' border=0></a></td></tr>";
        echo "</form>";
    }
    echo "</table></td></tr></table>
    <script type=\"text/javascript\">\n\n
    <!--\n\n
    function CheckAll() {\n
      for (var i=0;i<document.prvmsg.elements.length;i++) {\n
        var e = document.prvmsg.elements[i];\n
        if ((e.name != 'allbox') && (e.type=='checkbox'))\n
        e.checked = document.prvmsg.allbox.checked;\n
      }\n
    }\n\n

    function CheckCheckAll() {\n
      var TotalBoxes = 0;\n
      var TotalOn = 0;\n
      for (var i=0;i<document.prvmsg.elements.length;i++) {\n
        var e = document.prvmsg.elements[i];\n
        if ((e.name != 'allbox') && (e.type=='checkbox')) {\n
          TotalBoxes++;\n
          if (e.checked) {\n
            TotalOn++;\n
          }\n
        }\n
      }\n
      if (TotalBoxes==TotalOn) {\n
        document.prvmsg.allbox.checked=true;\n
      } else {\n
        document.prvmsg.allbox.checked=false;\n
      }\n
    }\n\n

    -->\n
    </script>\n\n";
}

include 'footer.php';

?>
Return current item: ProNuke. Postnuke To Oracle