Beehive PHP Cross Reference Discussion Forums

Source: /pm_messages.php - 563 lines - 24943 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  Copyright Project Beehive Forum 2002
   5  
   6  This file is part of Beehive Forum.
   7  
   8  Beehive Forum 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 3 of the License, or
  11  (at your option) any later version.
  12  
  13  Beehive Forum is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with Beehive; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  21  USA
  22  ======================================================================*/
  23  
  24  // Bootstrap
  25  require_once  'boot.php';
  26  
  27  // Required includes
  28  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'form.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'forum.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'header.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'pm.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'search.inc.php';
  36  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  37  require_once  BH_INCLUDE_PATH . 'word_filter.inc.php';
  38  // End Required includes
  39  
  40  // Check we're logged in correctly
  41  if (!session::logged_in()) {
  42      html_guest_error();
  43  }
  44  
  45  // Check that PM system is enabled
  46  pm_enabled();
  47  
  48  $new_count = 0;
  49  $outbox_count = 0;
  50  $unread_count = 0;
  51  
  52  $current_folder = PM_FOLDER_INBOX;
  53  
  54  pm_get_message_count($new_count, $outbox_count, $unread_count);
  55  
  56  $error_msg_array = array();
  57  
  58  if (!($folder_names_array = pm_get_folder_names())) {
  59  
  60      $folder_names_array = array(
  61          PM_FOLDER_INBOX => gettext("Inbox"),
  62          PM_FOLDER_SENT => gettext("Sent Items"),
  63          PM_FOLDER_OUTBOX => gettext("Outbox"),
  64          PM_FOLDER_SAVED => gettext("Saved Items"),
  65          PM_FOLDER_DRAFTS => gettext("Drafts"),
  66          PM_SEARCH_RESULTS => gettext("Search Results")
  67      );
  68  }
  69  
  70  if (isset($_GET['sort_by'])) {
  71      if ($_GET['sort_by'] == "SUBJECT") {
  72          $sort_by = "PM.SUBJECT";
  73      } else if ($_GET['sort_by'] == "TYPE") {
  74          $sort_by = "TYPE";
  75      } else if ($_GET['sort_by'] == "FROM_UID") {
  76          $sort_by = "PM.FROM_UID";
  77      } else if ($_GET['sort_by'] == "TO_UID") {
  78          $sort_by = "PM.TO_UID";
  79      } else {
  80          $sort_by = "CREATED";
  81      }
  82  } else {
  83      $sort_by = "CREATED";
  84  }
  85  
  86  if (isset($_GET['sort_dir'])) {
  87      if ($_GET['sort_dir'] == "DESC") {
  88          $sort_dir = "DESC";
  89      } else {
  90          $sort_dir = "ASC";
  91      }
  92  } else {
  93      $sort_dir = "DESC";
  94  }
  95  
  96  if (isset($_GET['page']) && is_numeric($_GET['page'])) {
  97      $page = ($_GET['page'] > 0) ? $_GET['page'] : 1;
  98  } else if (isset($_POST['page']) && is_numeric($_POST['page'])) {
  99      $page = ($_POST['page'] > 0) ? $_POST['page'] : 1;
 100  } else {
 101      $page = 1;
 102  }
 103  
 104  if (isset($_GET['mid']) && is_numeric($_GET['mid'])) {
 105  
 106      $mid = ($_GET['mid'] > 0) ? $_GET['mid'] : 0;
 107  
 108  } else if (isset($_POST['mid']) && is_numeric($_POST['mid'])) {
 109  
 110      $mid = ($_POST['mid'] > 0) ? $_POST['mid'] : 0;
 111  
 112  } else {
 113  
 114      $mid = 0;
 115  }
 116  
 117  if (isset($_GET['folder'])) {
 118  
 119      if ($_GET['folder'] == PM_FOLDER_INBOX) {
 120          $current_folder = PM_FOLDER_INBOX;
 121      } else if ($_GET['folder'] == PM_FOLDER_SENT) {
 122          $current_folder = PM_FOLDER_SENT;
 123      } else if ($_GET['folder'] == PM_FOLDER_OUTBOX) {
 124          $current_folder = PM_FOLDER_OUTBOX;
 125      } else if ($_GET['folder'] == PM_FOLDER_SAVED) {
 126          $current_folder = PM_FOLDER_SAVED;
 127      } else if ($_GET['folder'] == PM_FOLDER_DRAFTS) {
 128          $current_folder = PM_FOLDER_DRAFTS;
 129      } else if ($_GET['folder'] == PM_SEARCH_RESULTS) {
 130          $current_folder = PM_SEARCH_RESULTS;
 131      }
 132  
 133  } else if (isset($_POST['folder'])) {
 134  
 135      if ($_POST['folder'] == PM_FOLDER_INBOX) {
 136          $current_folder = PM_FOLDER_INBOX;
 137      } else if ($_POST['folder'] == PM_FOLDER_SENT) {
 138          $current_folder = PM_FOLDER_SENT;
 139      } else if ($_POST['folder'] == PM_FOLDER_OUTBOX) {
 140          $current_folder = PM_FOLDER_OUTBOX;
 141      } else if ($_POST['folder'] == PM_FOLDER_SAVED) {
 142          $current_folder = PM_FOLDER_SAVED;
 143      } else if ($_POST['folder'] == PM_FOLDER_DRAFTS) {
 144          $current_folder = PM_FOLDER_DRAFTS;
 145      } else if ($_POST['folder'] == PM_SEARCH_RESULTS) {
 146          $current_folder = PM_SEARCH_RESULTS;
 147      }
 148  }
 149  
 150  if (isset($mid) && is_numeric($mid) && $mid > 0) {
 151  
 152      if (!($message_data = pm_message_get($mid))) {
 153          html_draw_error(gettext("Message not found. Check that it hasn't been deleted."));
 154      }
 155  
 156      if (!pm_get_folder_type($current_folder)) {
 157          html_draw_error(gettext("Message not found. Check that it hasn't been deleted."));
 158      }
 159  }
 160  
 161  if (isset($_POST['pm_delete_messages'])) {
 162  
 163      $valid = true;
 164  
 165      if (isset($_POST['process']) && is_array($_POST['process'])) {
 166          $process_messages = array_filter($_POST['process'], 'is_numeric');
 167      } else {
 168          $process_messages = array();
 169      }
 170  
 171      if (sizeof($process_messages) > 0) {
 172  
 173          if (isset($_POST['pm_delete_confirm']) && $_POST['pm_delete_confirm'] == 'Y') {
 174  
 175              if (pm_delete_messages($process_messages)) {
 176  
 177                  if (in_array($mid, $process_messages)) {
 178  
 179                      header_redirect("pm_messages.php?webtag=$webtag&folder=$current_folder&page=$page&deleted=true#message");
 180                      exit;
 181  
 182                  } else {
 183  
 184                      header_redirect("pm_messages.php?webtag=$webtag&mid=$mid&folder=$current_folder&page=$page&deleted=true#message");
 185                      exit;
 186                  }
 187  
 188              } else {
 189  
 190                  $error_msg_array[] = gettext("Failed to delete selected messages");
 191                  $valid = false;
 192              }
 193  
 194          } else {
 195  
 196              html_draw_top(sprintf("title=%s", gettext("Delete Message")), 'class=window_title');
 197              html_display_msg(gettext("Delete"), gettext("Are you sure you want to delete all of the selected messages?"), "pm_messages.php", 'post', array(
 198                  'pm_option_submit' => gettext("Yes"),
 199                  'back' => gettext("No")
 200              ), array(
 201                  'folder' => $current_folder,
 202                  'page' => $page,
 203                  'process' => $process_messages,
 204                  'pm_delete_messages' => gettext("Delete"),
 205                  'pm_delete_confirm' => 'Y'
 206              ), '_self', 'center');
 207              html_draw_bottom();
 208              exit;
 209          }
 210  
 211      } else {
 212  
 213          $error_msg_array[] = gettext("You must select some messages to delete");
 214          $valid = false;
 215      }
 216  
 217  } else if (isset($_POST['pm_save_messages'])) {
 218  
 219      $valid = true;
 220  
 221      if (isset($_POST['process']) && is_array($_POST['process'])) {
 222          $process_messages = array_filter($_POST['process'], 'is_numeric');
 223      } else {
 224          $process_messages = array();
 225      }
 226  
 227      if (sizeof($process_messages) > 0) {
 228  
 229          if (pm_archive_messages($process_messages, $current_folder)) {
 230  
 231              header_redirect("pm_messages.php?webtag=$webtag&mid=$mid&folder=$current_folder&page=$page&archived=true#message");
 232              exit;
 233  
 234          } else {
 235  
 236              $error_msg_array[] = gettext("Failed to archive selected messages");
 237              $valid = false;
 238          }
 239  
 240      } else {
 241  
 242          $error_msg_array[] = gettext("You must select some messages to archive");
 243          $valid = false;
 244      }
 245  }
 246  
 247  if (isset($_POST['search'])) {
 248  
 249      if (isset($_POST['search_string']) && strlen(trim($_POST['search_string'])) > 0) {
 250          $search_string = trim($_POST['search_string']);
 251      } else {
 252          $search_string = '';
 253      }
 254  
 255      $error = SEARCH_NO_ERROR;
 256  
 257      if (!pm_search_execute($search_string, $error)) {
 258  
 259          switch ($error) {
 260  
 261              case SEARCH_NO_MATCHES:
 262  
 263                  header_redirect("pm_messages.php?webtag=$webtag&folder=6&search_no_results=true");
 264                  exit;
 265  
 266              case SEARCH_FREQUENCY_TOO_GREAT:
 267  
 268                  header_redirect("pm_messages.php?webtag=$webtag&folder=6&search_frequency_error=true");
 269                  exit;
 270          }
 271      }
 272  }
 273  
 274  pm_user_prune_folders($_SESSION['UID']);
 275  
 276  html_draw_top(sprintf('title=%s', sprintf(gettext("Private Messages - %s"), $folder_names_array[$current_folder])), "basetarget=_blank", "js/search.js", "js/pm.js", 'pm_popup_disabled', 'class=window_title');
 277  
 278  if ($current_folder == PM_FOLDER_INBOX) {
 279  
 280      $messages_array = pm_get_inbox($sort_by, $sort_dir, $page, 10);
 281  
 282  } else if ($current_folder == PM_FOLDER_SENT) {
 283  
 284      $messages_array = pm_get_sent($sort_by, $sort_dir, $page, 10);
 285  
 286  } else if ($current_folder == PM_FOLDER_OUTBOX) {
 287  
 288      $messages_array = pm_get_outbox($sort_by, $sort_dir, $page, 10);
 289  
 290  } else if ($current_folder == PM_FOLDER_SAVED) {
 291  
 292      $messages_array = pm_get_saved_items($sort_by, $sort_dir, $page, 10);
 293  
 294  } else if ($current_folder == PM_FOLDER_DRAFTS) {
 295  
 296      $messages_array = pm_get_drafts($sort_by, $sort_dir, $page, 10);
 297  
 298  } else if ($current_folder == PM_SEARCH_RESULTS) {
 299  
 300      $messages_array = pm_fetch_search_results($sort_by, $sort_dir, $page, 10);
 301  }
 302  
 303  echo "<h1>", gettext("Private Messages"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />{$folder_names_array[$current_folder]}</h1>\n";
 304  
 305  if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 306  
 307      html_display_error_array($error_msg_array, '96%', 'center');
 308  
 309  } else if (isset($_GET['message_sent'])) {
 310  
 311      html_display_success_msg(gettext("Message sent successfully."), '96%', 'center');
 312  
 313  } else if (isset($_GET['message_saved'])) {
 314  
 315      html_display_success_msg(gettext("Message was successfully saved to 'Drafts' folder"), '96%', 'center');
 316  
 317  } else if (isset($_GET['deleted'])) {
 318  
 319      html_display_success_msg(gettext("Successfully deleted selected messages"), '96%', 'center', 'pm_delete_success');
 320  
 321  } else if (isset($_GET['archived'])) {
 322  
 323      html_display_success_msg(gettext("Successfully archived selected messages"), '96%', 'center', 'pm_archive_success');
 324  
 325  } else if (isset($_GET['search_no_results'])) {
 326  
 327      html_display_warning_msg(gettext("Search Returned No Results"), '96%', 'center');
 328  
 329  } else if (isset($_GET['search_frequency_error'])) {
 330  
 331      $search_limit_count = forum_get_setting('search_limit_count', 'is_numeric', 1);
 332      $search_limit_time = forum_get_setting('search_limit_time', 'is_numeric', 30);
 333      html_display_error_msg(sprintf(gettext("You can only perform %d search(es) every %s seconds."), $search_limit_count, $search_limit_time), '96%', 'center');
 334  
 335  } else if (isset($messages_array['message_array']) && sizeof($messages_array['message_array']) < 1) {
 336  
 337      html_display_warning_msg(sprintf(gettext("Your %s folder is empty"), htmlentities_array($folder_names_array[$current_folder])), '96%', 'center');
 338  }
 339  
 340  echo "<br />\n";
 341  echo "<div align=\"center\">\n";
 342  echo "<form accept-charset=\"utf-8\" name=\"pm\" action=\"pm_messages.php\" method=\"post\" target=\"_self\">\n";
 343  echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 344  echo "  ", form_input_hidden('mid', htmlentities_array($mid)), "\n";
 345  echo "  ", form_input_hidden('folder', htmlentities_array($current_folder)), "\n";
 346  echo "  ", form_input_hidden('page', htmlentities_array($page)), "\n";
 347  echo "  ", form_input_hidden('pm_delete_confirm', 'N'), "\n";
 348  echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"96%\">\n";
 349  echo "    <tr>\n";
 350  echo "      <td align=\"left\" colspan=\"3\">\n";
 351  echo "        <table class=\"box\" width=\"100%\">\n";
 352  echo "          <tr>\n";
 353  echo "            <td align=\"left\" class=\"posthead\">\n";
 354  echo "              <table width=\"100%\" border=\"0\">\n";
 355  echo "                <tr>\n";
 356  
 357  if (isset($messages_array['message_array']) && sizeof($messages_array['message_array']) > 0) {
 358      echo "                  <td class=\"subhead_checkbox\" align=\"center\" width=\"1%\">", form_checkbox("toggle_all", "toggle_all"), "</td>\n";
 359  } else {
 360      echo "                  <td align=\"left\" class=\"subhead\" width=\"1%\">&nbsp;</td>\n";
 361  }
 362  
 363  $col_width = ($current_folder == PM_FOLDER_SAVED || $current_folder == PM_SEARCH_RESULTS) ? '35%' : '50%';
 364  
 365  if ($sort_by == 'PM.SUBJECT' && $sort_dir == 'ASC') {
 366      echo "                   <td class=\"subhead_sort_asc\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\" colspan=\"2\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=SUBJECT&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Subject"), "</a></td>\n";
 367  } else if ($sort_by == 'PM.SUBJECT' && $sort_dir == 'DESC') {
 368      echo "                   <td class=\"subhead_sort_desc\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\" colspan=\"2\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=SUBJECT&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Subject"), "</a></td>\n";
 369  } else if ($sort_dir == 'ASC') {
 370      echo "                   <td class=\"subhead\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\" colspan=\"2\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=SUBJECT&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Subject"), "</a></td>\n";
 371  } else {
 372      echo "                   <td class=\"subhead\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\" colspan=\"2\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=SUBJECT&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Subject"), "</a></td>\n";
 373  }
 374  
 375  if ($current_folder == PM_FOLDER_INBOX || $current_folder == PM_FOLDER_SAVED || $current_folder == PM_SEARCH_RESULTS) {
 376  
 377      $col_width = ($current_folder == PM_FOLDER_SAVED || $current_folder == PM_SEARCH_RESULTS) ? '15%' : '30%';
 378  
 379      if ($sort_by == 'PM.FROM_UID' && $sort_dir == 'ASC') {
 380          echo "                   <td class=\"subhead_sort_asc\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=FROM_UID&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("From"), "</a></td>\n";
 381      } else if ($sort_by == 'PM.FROM_UID' && $sort_dir == 'DESC') {
 382          echo "                   <td class=\"subhead_sort_desc\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=FROM_UID&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("From"), "</a></td>\n";
 383      } else if ($sort_dir == 'ASC') {
 384          echo "                   <td class=\"subhead\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=FROM_UID&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("From"), "</a></td>\n";
 385      } else {
 386          echo "                   <td class=\"subhead\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=FROM_UID&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("From"), "</a></td>\n";
 387      }
 388  }
 389  
 390  if ($current_folder == PM_FOLDER_SENT || $current_folder == PM_FOLDER_OUTBOX || $current_folder == PM_FOLDER_DRAFTS || $current_folder == PM_FOLDER_SAVED || $current_folder == PM_SEARCH_RESULTS) {
 391  
 392      $col_width = ($current_folder == PM_FOLDER_SAVED || $current_folder == PM_SEARCH_RESULTS) ? '15%' : '30%';
 393  
 394      if ($sort_by == 'PM.TO_UID' && $sort_dir == 'ASC') {
 395          echo "                   <td class=\"subhead_sort_asc\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=TO_UID&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("To"), "</a></td>\n";
 396      } else if ($sort_by == 'PM.TO_UID' && $sort_dir == 'DESC') {
 397          echo "                   <td class=\"subhead_sort_desc\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=TO_UID&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("To"), "</a></td>\n";
 398      } else if ($sort_dir == 'ASC') {
 399          echo "                   <td class=\"subhead\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=TO_UID&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("To"), "</a></td>\n";
 400      } else {
 401          echo "                   <td class=\"subhead\" align=\"left\" width=\"$col_width\" style=\"white-space: nowrap\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=TO_UID&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("To"), "</a></td>\n";
 402      }
 403  }
 404  
 405  if ($sort_by == 'CREATED' && $sort_dir == 'ASC') {
 406      echo "                   <td class=\"subhead_sort_asc\" align=\"left\" style=\"white-space: nowrap\" width=\"20%\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=CREATED&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Time Sent"), "</a></td>\n";
 407  } else if ($sort_by == 'CREATED' && $sort_dir == 'DESC') {
 408      echo "                   <td class=\"subhead_sort_desc\" align=\"left\" style=\"white-space: nowrap\" width=\"20%\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=CREATED&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Time Sent"), "</a></td>\n";
 409  } else if ($sort_dir == 'ASC') {
 410      echo "                   <td class=\"subhead\" align=\"left\" style=\"white-space: nowrap\" width=\"20%\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=CREATED&amp;sort_dir=ASC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Time Sent"), "</a></td>\n";
 411  } else {
 412      echo "                   <td class=\"subhead\" align=\"left\" style=\"white-space: nowrap\" width=\"20%\"><a href=\"pm_messages.php?webtag=$webtag&amp;mid=$mid&amp;sort_by=CREATED&amp;sort_dir=DESC&amp;page=$page&amp;folder=$current_folder\" target=\"_self\">", gettext("Time Sent"), "</a></td>\n";
 413  }
 414  
 415  echo "                </tr>\n";
 416  
 417  if (isset($messages_array['message_array']) && sizeof($messages_array['message_array']) > 0) {
 418  
 419      foreach ($messages_array['message_array'] as $message) {
 420  
 421          echo "                <tr>\n";
 422          echo "                  <td class=\"postbody\" align=\"center\" valign=\"top\" width=\"1%\">", form_checkbox("process[]", $message['MID']), "</td>\n";
 423  
 424          if ($mid == $message['MID']) {
 425  
 426              echo "                  <td class=\"postbody\" align=\"center\" valign=\"top\" width=\"1%\"><img src=\"", html_style_image('current_thread.png'), "\" title=\"", gettext("Current Message"), "\" alt=\"", gettext("Current Message"), "\" /></td>";
 427  
 428          } else if (($current_folder == PM_FOLDER_INBOX) && ($message['TYPE'] == PM_UNREAD)) {
 429  
 430              echo "                  <td class=\"postbody\" align=\"center\" valign=\"top\" width=\"1%\"><img src=\"", html_style_image('pmunread.png'), "\" title=\"", gettext("Unread Message"), "\" alt=\"", gettext("Unread Message"), "\" /></td>";
 431  
 432          } else {
 433  
 434              echo "                  <td class=\"postbody\" align=\"center\" valign=\"top\" width=\"1%\"><img src=\"", html_style_image('pmread.png'), "\" title=\"", gettext("Read Message"), "\" alt=\"", gettext("Read Message"), "\" /></td>";
 435          }
 436  
 437          echo "                  <td align=\"left\" class=\"postbody\" width=\"50%\" valign=\"top\">";
 438  
 439          if (strlen(trim($message['SUBJECT'])) > 0) {
 440  
 441              echo "                    <a href=\"pm_messages.php?webtag=$webtag&amp;folder=$current_folder&amp;mid={$message['MID']}&amp;page=$page#message\" target=\"_self\">", word_filter_add_ob_tags($message['SUBJECT'], true), "</a>";
 442  
 443          } else {
 444  
 445              echo "                    <a href=\"pm_messages.php?webtag=$webtag&amp;folder=$current_folder&amp;mid={$message['MID']}&amp;page=$page#message\" target=\"_self\"><i>", gettext("No Subject"), "</i></a>";
 446          }
 447  
 448          if (isset($message['ATTACHMENT_COUNT']) && $message['ATTACHMENT_COUNT'] > 0) {
 449              echo "                    &nbsp;&nbsp;<img src=\"", html_style_image('attach.png'), "\" border=\"0\" alt=\"", gettext("Attachment"), "\" title=\"", gettext("Attachment"), "\" />";
 450          }
 451  
 452          echo "                  </td>\n";
 453  
 454          if ($current_folder == PM_FOLDER_SAVED || $current_folder == PM_FOLDER_INBOX || $current_folder == PM_SEARCH_RESULTS) {
 455  
 456              echo "                  <td align=\"left\" class=\"postbody\" valign=\"top\">\n";
 457              echo "                    <a href=\"user_profile.php?webtag=$webtag&amp;uid={$message['FROM_UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($message['FROM_LOGON'], $message['FROM_NICKNAME']), true), "</a>\n";
 458              echo "                  </td>\n";
 459          }
 460  
 461          if (in_array($current_folder, array(PM_FOLDER_SENT, PM_FOLDER_OUTBOX, PM_FOLDER_SAVED, PM_FOLDER_DRAFTS, PM_SEARCH_RESULTS))) {
 462  
 463              if (isset($message['RECIPIENTS']) && sizeof($message['RECIPIENTS']) > 0) {
 464  
 465                  $recipients_display = array_slice($message['RECIPIENTS'], 0, 2);
 466  
 467                  echo "                  <td align=\"left\" class=\"postbody\" valign=\"top\">";
 468  
 469                  foreach ($recipients_display as $recipient) {
 470                      echo "                    <a href=\"user_profile.php?webtag=$webtag&amp;uid={$recipient['UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($recipient['LOGON'], $recipient['NICKNAME']), true), "</a>\n";
 471                  }
 472  
 473                  if (sizeof($message['RECIPIENTS']) - 2 > 0) {
 474                      echo "&nbsp;", sprintf(gettext("and %d others"), sizeof($message['RECIPIENTS']) - 2);
 475                  }
 476  
 477                  echo "                  </td>\n";
 478  
 479              } else {
 480  
 481                  echo "                  <td align=\"left\" class=\"postbody\" valign=\"top\">", gettext('Unknown User'), "</td>\n";
 482              }
 483          }
 484  
 485          echo "                  <td align=\"left\" class=\"postbody\" valign=\"top\">", format_time($message['CREATED']), "</td>\n";
 486          echo "                </tr>\n";
 487      }
 488  }
 489  
 490  echo "                <tr>\n";
 491  echo "                  <td class=\"postbody\">&nbsp;</td>\n";
 492  echo "                </tr>\n";
 493  echo "              </table>\n";
 494  echo "            </td>\n";
 495  echo "          </tr>\n";
 496  echo "        </table>\n";
 497  echo "      </td>\n";
 498  echo "    </tr>\n";
 499  echo "    <tr>\n";
 500  echo "      <td align=\"left\">&nbsp;</td>\n";
 501  echo "    </tr>\n";
 502  echo "    <tr>\n";
 503  echo "      <td align=\"left\" width=\"33%\">&nbsp;</td>\n";
 504  echo "      <td class=\"postbody\" align=\"center\" width=\"33%\">";
 505  
 506  html_page_links("pm_messages.php?webtag=$webtag&mid=$mid&folder=$current_folder&sort_by=$sort_by&sort_dir=$sort_dir", $page, $messages_array['message_count'], 10);
 507  
 508  echo "      </td>\n";
 509  
 510  if (isset($messages_array['message_array']) && sizeof($messages_array['message_array']) > 0) {
 511  
 512      echo "      <td align=\"right\" width=\"33%\" valign=\"top\" style=\"white-space: nowrap\">";
 513  
 514      if (($current_folder == PM_FOLDER_INBOX) || ($current_folder == PM_FOLDER_SENT)) {
 515          echo form_submit('pm_save_messages', gettext("Save"), sprintf('title="%s"', gettext("Save Selected Messages"))), "&nbsp;";
 516      }
 517  
 518      echo form_submit('pm_delete_messages', gettext("Delete")), "&nbsp;";
 519  
 520      echo "</span></td>\n";
 521  
 522  } else {
 523  
 524      echo "      <td align=\"left\">&nbsp;</td>\n";
 525  }
 526  
 527  echo "    </tr>\n";
 528  echo "    <tr>\n";
 529  echo "      <td align=\"left\">&nbsp;</td>\n";
 530  echo "    </tr>\n";
 531  echo "  </table>\n";
 532  
 533  if (isset($message_data) && is_array($message_data)) {
 534  
 535      $message_data['CONTENT'] = pm_get_content($mid);
 536  
 537      if (($current_folder == PM_FOLDER_INBOX) && ($message_data['TYPE'] == PM_UNREAD)) {
 538          pm_mark_as_read($mid);
 539      }
 540  
 541      echo "  <a name=\"message\"></a>\n";
 542      echo "  <br />\n";
 543      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"96%\">\n";
 544      echo "    <tr>\n";
 545      echo "      <td>\n";
 546      echo "        <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
 547      echo "          <tr>\n";
 548      echo "            <td align=\"left\">";
 549  
 550      pm_display($message_data);
 551  
 552      echo "            </td>\n";
 553      echo "          </tr>\n";
 554      echo "        </table>\n";
 555      echo "      </td>\n";
 556      echo "    </tr>\n";
 557      echo "  </table>\n";
 558  }
 559  
 560  echo "</form>\n";
 561  echo "</div>\n";
 562  
 563  html_draw_bottom();

title

Description

title

Description

title

Description

title

title

Body