[ Index ]
 

Code source de XOOPS 2.0.17.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/htdocs/ -> viewpmsg.php (source)

   1  <?php
   2  // $Id: viewpmsg.php 506 2006-05-26 23:10:37Z skalpa $

   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";
  29  include_once  "mainfile.php";
  30  
  31  if (!is_object($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          if (!$GLOBALS['xoopsSecurity']->check()) {
  38              echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors());
  39              exit();
  40          }
  41          $size = count($_POST['msg_id']);
  42          $msg =& $_POST['msg_id'];
  43              for ( $i = 0; $i < $size; $i++ ) {
  44              $pm =& $pm_handler->get($msg[$i]);
  45              if ($pm->getVar('to_userid') == $xoopsUser->getVar('uid')) {
  46                  $pm_handler->delete($pm);
  47              }
  48              unset($pm);
  49          }
  50          redirect_header("viewpmsg.php",1,_PM_DELETED);
  51          exit();
  52      }
  53      include  XOOPS_ROOT_PATH.'/header.php';
  54      $criteria = new Criteria('to_userid', $xoopsUser->getVar('uid'));
  55      $criteria->setOrder('DESC');
  56      $pm_arr =& $pm_handler->getObjects($criteria);
  57      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";
  58      echo "<form name='prvmsg' method='post' action='viewpmsg.php'>";
  59      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";
  60      $total_messages = count($pm_arr);
  61      if ( $total_messages == 0 ) {
  62          echo "<tr><td class='even' colspan='6' align='center'>"._PM_YOUDONTHAVE."</td></tr> ";
  63          $display= 0;
  64      } else {
  65  
  66          $display = 1;
  67      }
  68      for ($i = 0; $i < $total_messages; $i++) {
  69          $class = ($i % 2 == 0) ? 'even' : 'odd';
  70          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";
  71          if ($pm_arr[$i]->getVar('read_msg') == 1) {
  72              echo "<td valign='top' width='5%' align='center'>&nbsp;</td>\n";
  73          } else {
  74              echo "<td valign='top' width='5%' align='center'><img src='images/read.gif' alt='"._PM_NOTREAD."' /></td>\n";
  75          }
  76          echo "<td valign='top' width='5%' align='center'><img src='images/subject/".$pm_arr[$i]->getVar("msg_image", "E")."' alt='' /></td>\n";
  77          $postername = XoopsUser::getUnameFromId($pm_arr[$i]->getVar("from_userid"));
  78          echo "<td valign='middle' width='10%'>";
  79          // no need to show deleted users

  80          if ($postername) {
  81              echo "<a href='userinfo.php?uid=".$pm_arr[$i]->getVar("from_userid")."'>".$postername."</a>";
  82          } else {
  83              echo $xoopsConfig['anonymous'];
  84          }
  85          echo "</td>\n";
  86          echo "<td valign='middle'><a href='readpmsg.php?start=".($total_messages-$i-1),"&amp;total_messages=$total_messages'>".$pm_arr[$i]->getVar("subject")."</a></td>";
  87          echo "<td valign='middle' align='center' width='20%'>".formatTimestamp($pm_arr[$i]->getVar("msg_time"))."</td></tr>";
  88      }
  89  
  90      if ( $display == 1 ) {
  91          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."' />".$GLOBALS['xoopsSecurity']->getTokenHTML()."</td></tr></form>";
  92      } else {
  93          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>";
  94      }
  95      echo "</table>";
  96      include  "footer.php";
  97  }
  98  ?>


Généré le : Sun Nov 25 11:44:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics