[ Index ]

PHP Cross Reference of Xoops v2.3.1

[Global whois Lookup]    [Ranchi, Jharkhand, India website]     [Hindi Magazine]     [Desi Community website in tristate area]    [B 4 Bollywood]    [Internet nation of India]

title

Body

[close]

/ -> readpmsg.php (source)

   1  <?php
   2  // $Id: readpmsg.php 1983 2008-08-24 13:41:15Z phppp $

   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  $module_handler = xoops_gethandler('module');
  31  $pm_module = $module_handler->getByDirname('pm');
  32  if ($pm_module && $pm_module->getVar('isactive')) {
  33      header( "location: ./modules/pm/readpmsg.php" . (empty($_SERVER['QUERY_STRING']) ? "" : "?" . $_SERVER['QUERY_STRING']) );
  34      exit();
  35  }
  36  xoops_loadLanguage('pmsg');
  37  
  38  if ( !is_object($xoopsUser) ) {
  39      redirect_header("user.php",0);
  40      exit();
  41  } else {
  42      $pm_handler =& xoops_gethandler('privmessage');
  43      if ( !empty($_POST['delete']) ) {
  44          if (!$GLOBALS['xoopsSecurity']->check()) {
  45              echo implode('<br />', $GLOBALS['xoopsSecurity']->getErrors());
  46              exit();
  47          }
  48          $pm =& $pm_handler->get(intval($_POST['msg_id']));
  49          if (!is_object($pm) || $pm->getVar('to_userid') != $xoopsUser->getVar('uid') || !$pm_handler->delete($pm)) {
  50              exit();
  51          } else {
  52              redirect_header("viewpmsg.php",1,_PM_DELETED);
  53              exit();
  54          }
  55      }
  56      $start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
  57      $total_messages = !empty($_GET['total_messages']) ? intval($_GET['total_messages']) : 0;
  58      include  XOOPS_ROOT_PATH.'/header.php';
  59      $criteria = new Criteria('to_userid', $xoopsUser->getVar('uid'));
  60      $criteria->setLimit(1);
  61      $criteria->setStart($start);
  62      $criteria->setSort('msg_time');
  63      $pm_arr = $pm_handler->getObjects($criteria);
  64      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";
  65      if (empty($pm_arr)) {
  66          echo '<br /><br />'._PM_YOUDONTHAVE;
  67      } else {
  68          if (!$pm_handler->setRead($pm_arr[0])) {
  69              //echo "failed";

  70          }
  71          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";
  72          $poster = new XoopsUser($pm_arr[0]->getVar("from_userid"));
  73          if ( !$poster->isActive() ) {
  74              $poster = false;
  75          }
  76          echo "<td valign='top'>";
  77          if ( $poster != false ) { // we need to do this for deleted users
  78                  echo "<a href='userinfo.php?uid=".$poster->getVar("uid")."'>".$poster->getVar("uname")."</a><br />\n";
  79              if ( $poster->getVar("user_avatar") != "" ) {
  80                  echo "<img src='uploads/".$poster->getVar("user_avatar")."' alt='' /><br />\n";
  81              }
  82              if ( $poster->getVar("user_from") != "" ) {
  83                  echo _PM_FROMC."".$poster->getVar("user_from")."<br /><br />\n";
  84              }
  85              if ( $poster->isOnline() ) {
  86              echo "<span style='color:#ee0000;font-weight:bold;'>"._PM_ONLINE."</span><br /><br />\n";
  87              }
  88          } else {
  89              echo $xoopsConfig['anonymous']; // we need to do this for deleted users

  90          }
  91          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"));
  92          echo "<hr /><strong>".$pm_arr[0]->getVar("subject")."</strong><br /><br />\n";
  93          echo $pm_arr[0]->getVar("msg_text") . "<br /><br /></td></tr><tr class='foot'><td width='20%' colspan='2' align='left'>";
  94          // we dont want to reply to a deleted user!

  95          if ( $poster != false ) {
  96              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";
  97          }
  98          echo "<input type='hidden' name='delete' value='1' />";
  99          echo $GLOBALS['xoopsSecurity']->getTokenHTML();
 100          echo "<input type='hidden' name='msg_id' value='".$pm_arr[0]->getVar("msg_id")."' />";
 101          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>";
 102          echo "</td></tr><tr><td colspan='2' align='right'>";
 103          $previous = $start - 1;
 104              $next = $start + 1;
 105              if ( $previous >= 0 ) {
 106              echo "<a href='readpmsg.php?start=".$previous."&amp;total_messages=".$total_messages."'>"._PM_PREVIOUS."</a> | ";
 107          } else {
 108              echo _PM_PREVIOUS." | ";
 109          }
 110          if ( $next < $total_messages ) {
 111              echo "<a href='readpmsg.php?start=".$next."&amp;total_messages=".$total_messages."'>"._PM_NEXT."</a>";
 112          } else {
 113              echo _PM_NEXT;
 114          }
 115          echo "</td></tr></table></form>\n";
 116      }
 117      include  "footer.php";
 118  }
 119  ?>


[ Xoops]     [PhpNuke]     [PostNuke]     [Joomla]    [Drupal]    [E107]    [NucleusCms]
[Php-Fusion]     [PhpBB]     [WordPress]     [Typo3]
Generated: Mon Oct 27 11:51:45 2008
Open Source related documentation for developers.