[ Index ]
 

Code source de XOOPS 2.0.17.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/htdocs/ -> readpmsg.php (source)

   1  <?php
   2  // $Id: readpmsg.php 2 2005-11-02 18:23:29Z 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      redirect_header("user.php",0);
  33      exit();
  34  } else {
  35      $pm_handler =& xoops_gethandler('privmessage');
  36      if ( !empty($_POST['delete']) ) {
  37          if (!$GLOBALS['xoopsSecurity']->check()) {
  38              echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors());
  39              exit();
  40          }
  41          $pm =& $pm_handler->get(intval($_POST['msg_id']));
  42          if (!is_object($pm) || $pm->getVar('to_userid') != $xoopsUser->getVar('uid') || !$pm_handler->delete($pm)) {
  43              exit();
  44          } else {
  45              redirect_header("viewpmsg.php",1,_PM_DELETED);
  46              exit();
  47          }
  48      }
  49      $start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
  50      $total_messages = !empty($_GET['total_messages']) ? intval($_GET['total_messages']) : 0;
  51      include  XOOPS_ROOT_PATH.'/header.php';
  52      $criteria = new Criteria('to_userid', $xoopsUser->getVar('uid'));
  53      $criteria->setLimit(1);
  54      $criteria->setStart($start);
  55      $criteria->setSort('msg_time');
  56      $pm_arr =& $pm_handler->getObjects($criteria);
  57      echo "<div><h4>". _PM_PRIVATEMESSAGE."</h4></div><br /><a href='userinfo.php?uid=". $xoopsUser->getVar("uid") ."'>". _PM_PROFILE ."</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;<a href='viewpmsg.php'>". _PM_INBOX ."</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;\n";
  58      if (empty($pm_arr)) {
  59          echo '<br /><br />'._PM_YOUDONTHAVE;
  60      } else {
  61          if (!$pm_handler->setRead($pm_arr[0])) {
  62              //echo "failed";

  63          }
  64          echo $pm_arr[0]->getVar("subject")."<br /><form action='readpmsg.php' method='post' name='delete".$pm_arr[0]->getVar("msg_id")."'><table border='0' cellpadding='4' cellspacing='1' class='outer' width='100%'><tr><th colspan='2'>". _PM_FROM ."</th></tr><tr class='even'>\n";
  65          $poster = new XoopsUser($pm_arr[0]->getVar("from_userid"));
  66          if ( !$poster->isActive() ) {
  67              $poster = false;
  68          }
  69          echo "<td valign='top'>";
  70          if ( $poster != false ) { // we need to do this for deleted users
  71                  echo "<a href='userinfo.php?uid=".$poster->getVar("uid")."'>".$poster->getVar("uname")."</a><br />\n";
  72              if ( $poster->getVar("user_avatar") != "" ) {
  73                  echo "<img src='uploads/".$poster->getVar("user_avatar")."' alt='' /><br />\n";
  74              }
  75              if ( $poster->getVar("user_from") != "" ) {
  76                  echo _PM_FROMC."".$poster->getVar("user_from")."<br /><br />\n";
  77              }
  78              if ( $poster->isOnline() ) {
  79              echo "<span style='color:#ee0000;font-weight:bold;'>"._PM_ONLINE."</span><br /><br />\n";
  80              }
  81          } else {
  82              echo $xoopsConfig['anonymous']; // we need to do this for deleted users

  83          }
  84          echo "</td><td><img src='images/subject/".$pm_arr[0]->getVar("msg_image", "E")."' alt='' />&nbsp;"._PM_SENTC."".formatTimestamp($pm_arr[0]->getVar("msg_time"));
  85          echo "<hr /><b>".$pm_arr[0]->getVar("subject")."</b><br /><br />\n";
  86          echo $pm_arr[0]->getVar("msg_text") . "<br /><br /></td></tr><tr class='foot'><td width='20%' colspan='2' align='left'>";
  87          // we dont want to reply to a deleted user!

  88          if ( $poster != false ) {
  89              echo "<a href='#' onclick='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?reply=1&amp;msg_id=".$pm_arr[0]->getVar("msg_id")."\",\"pmlite\",450,380);'><img src='".XOOPS_URL."/images/icons/reply.gif' alt='"._PM_REPLY."' /></a>\n";
  90          }
  91          echo "<input type='hidden' name='delete' value='1' />";
  92          echo $GLOBALS['xoopsSecurity']->getTokenHTML();
  93          echo "<input type='hidden' name='msg_id' value='".$pm_arr[0]->getVar("msg_id")."' />";
  94          echo "<a href='#".$pm_arr[0]->getVar("msg_id")."' onclick='javascript:document.delete".$pm_arr[0]->getVar("msg_id").".submit();'><img src='".XOOPS_URL."/images/icons/delete.gif' alt='"._PM_DELETE."' /></a>";
  95          echo "</td></tr><tr><td colspan='2' align='right'>";
  96          $previous = $start - 1;
  97              $next = $start + 1;
  98              if ( $previous >= 0 ) {
  99              echo "<a href='readpmsg.php?start=".$previous."&amp;total_messages=".$total_messages."'>"._PM_PREVIOUS."</a> | ";
 100          } else {
 101              echo _PM_PREVIOUS." | ";
 102          }
 103          if ( $next < $total_messages ) {
 104              echo "<a href='readpmsg.php?start=".$next."&amp;total_messages=".$total_messages."'>"._PM_NEXT."</a>";
 105          } else {
 106              echo _PM_NEXT;
 107          }
 108          echo "</td></tr></table></form>\n";
 109      }
 110      include  "footer.php";
 111  }
 112  ?>


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