source: temp/test-xoops.ec-cube.net/html/viewpmsg.php @ 405

Revision 405, 5.5 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: viewpmsg.php,v 1.2 2005/03/18 12:51:55 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28$xoopsOption['pagetype'] = "pmsg";
29include_once "mainfile.php";
30
31if ( !$xoopsUser ) {
32    $errormessage = _PM_SORRY."<br />"._PM_PLZREG."";
33    redirect_header("user.php",2,$errormessage);
34} else {
35    $pm_handler =& xoops_gethandler('privmessage');
36    if (isset($_POST['delete_messages']) && isset($_POST['msg_id'])) {
37        $size = count($_POST['msg_id']);
38        $msg =& $_POST['msg_id'];
39            for ( $i = 0; $i < $size; $i++ ) {
40            $pm =& $pm_handler->get($msg[$i]);
41            if ($pm->getVar('to_userid') == $xoopsUser->getVar('uid')) {
42                $pm_handler->delete($pm);
43            }
44            unset($pm);
45        }
46        redirect_header("viewpmsg.php",1,_PM_DELETED);
47        exit();
48    }
49    include XOOPS_ROOT_PATH.'/header.php';
50    $pm_arr =& $pm_handler->getObjects(new Criteria('to_userid', $xoopsUser->getVar('uid')));
51    echo "<h4 style='text-align:center;'>". _PM_PRIVATEMESSAGE ."</h4><br /><a href='userinfo.php?uid=". $xoopsUser->getVar("uid")."'>". _PM_PROFILE ."</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;". _PM_INBOX ."<br /><br /><table border='0' cellspacing='1' cellpadding='4' width='100%' class='outer'>\n";
52    echo "<form name='prvmsg' method='post' action='viewpmsg.php'>";
53    echo "<tr align='center' valign='middle'><th><input name='allbox' id='allbox' onclick='xoopsCheckAll(\"prvmsg\", \"allbox\");' type='checkbox' value='Check All' /></th><th><img src='images/download.gif' alt='' border='0' /></th><th>&nbsp;</th><th>". _PM_FROM ."</th><th>". _PM_SUBJECT ."</th><th align='center'>". _PM_DATE ."</th></tr>\n";
54    $total_messages = count($pm_arr);
55    if ( $total_messages == 0 ) {
56        echo "<tr><td class='even' colspan='6' align='center'>"._PM_YOUDONTHAVE."</td></tr> ";
57        $display= 0;
58    } else {
59
60        $display = 1;
61    }
62    for ($i = 0; $i < $total_messages; $i++) {
63        $class = ($i % 2 == 0) ? 'even' : 'odd';
64        echo "<tr align='left' class='$class'><td valign='top' width='2%' align='center'><input type='checkbox' id='msg_id[]' name='msg_id[]' value='".$pm_arr[$i]->getVar("msg_id")."' /></td>\n";
65        if ($pm_arr[$i]->getVar('read_msg') == 1) {
66            echo "<td valign='top' width='5%' align='center'>&nbsp;</td>\n";
67        } else {
68            echo "<td valign='top' width='5%' align='center'><img src='images/read.gif' alt='"._PM_NOTREAD."' /></td>\n";
69        }
70        echo "<td valign='top' width='5%' align='center'><img src='images/subject/".$pm_arr[$i]->getVar("msg_image", "E")."' alt='' /></td>\n";
71        $postername = XoopsUser::getUnameFromId($pm_arr[$i]->getVar("from_userid"));
72        echo "<td valign='middle' width='10%'>";
73        // no need to show deleted users
74        if ($postername) {
75            echo "<a href='userinfo.php?uid=".$pm_arr[$i]->getVar("from_userid")."'>".$postername."</a>";
76        } else {
77            echo $xoopsConfig['anonymous'];
78        }
79        echo "</td>\n";
80        echo "<td valign='middle'><a href='readpmsg.php?start=$i&amp;total_messages=$total_messages'>".$pm_arr[$i]->getVar("subject")."</a></td>";
81        echo "<td valign='middle' align='center' width='20%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
82    }
83
84    if ( $display == 1 ) {
85        echo "<tr class='foot' align='left'><td colspan='6' align='left'><input type='button' class='formButton' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send=1\",\"pmlite\",450,380);' value='"._PM_SEND."' />&nbsp;<input type='submit' class='formButton' name='delete_messages' value='"._PM_DELETE."' /></td></tr></form>";
86    } else {
87        echo "<tr class='bg2' align='left'><td colspan='6' align='left'><input type='button' class='formButton' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send=1\",\"pmlite\",450,380);' value='"._PM_SEND."' /></td></tr></form>";
88    }
89    echo "</table>";
90    include "footer.php";
91}
92?>
Note: See TracBrowser for help on using the repository browser.