Beehive PHP Cross Reference Discussion Forums

Source: /pm_options.php - 223 lines - 10137 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 . 'header.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'pm.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'user.inc.php';
  36  // End Required includes
  37  
  38  // Check we're logged in correctly
  39  if (!session::logged_in()) {
  40      html_guest_error();
  41  }
  42  
  43  // Array to hold error messages.
  44  $error_msg_array = array();
  45  
  46  // Get User Prefs
  47  $user_prefs = user_get_prefs($_SESSION['UID']);
  48  
  49  // Submit code starts here.
  50  if (isset($_POST['save'])) {
  51  
  52      if (isset($_POST['pm_notify']) && $_POST['pm_notify'] == "Y") {
  53          $user_prefs['PM_NOTIFY'] = "Y";
  54      } else {
  55          $user_prefs['PM_NOTIFY'] = "N";
  56      }
  57  
  58      if (isset($_POST['pm_save_sent_items']) && $_POST['pm_save_sent_items'] == "Y") {
  59          $user_prefs['PM_SAVE_SENT_ITEM'] = "Y";
  60      } else {
  61          $user_prefs['PM_SAVE_SENT_ITEM'] = "N";
  62      }
  63  
  64      if (isset($_POST['pm_include_reply']) && $_POST['pm_include_reply'] == "Y") {
  65          $user_prefs['PM_INCLUDE_REPLY'] = "Y";
  66      } else {
  67          $user_prefs['PM_INCLUDE_REPLY'] = "N";
  68      }
  69  
  70      if (isset($_POST['pm_auto_prune_enabled']) && $_POST['pm_auto_prune_enabled'] == "Y") {
  71  
  72          if (isset($_POST['pm_auto_prune']) && is_numeric($_POST['pm_auto_prune'])) {
  73  
  74              $user_prefs['PM_AUTO_PRUNE'] = $_POST['pm_auto_prune'];
  75  
  76          } else {
  77  
  78              $user_prefs['PM_AUTO_PRUNE'] = "-60";
  79          }
  80  
  81      } else {
  82  
  83          if (isset($_POST['pm_auto_prune']) && is_numeric($_POST['pm_auto_prune'])) {
  84  
  85              $user_prefs['PM_AUTO_PRUNE'] = $_POST['pm_auto_prune'] * -1;
  86  
  87          } else {
  88  
  89              $user_prefs['PM_AUTO_PRUNE'] = "-60";
  90          }
  91      }
  92  
  93      if (isset($_POST['pm_export_file']) && is_numeric($_POST['pm_export_file'])) {
  94          $user_prefs['PM_EXPORT_FILE'] = $_POST['pm_export_file'];
  95      } else {
  96          $user_prefs['PM_EXPORT_FILE'] = 0;
  97      }
  98  
  99      if (isset($_POST['pm_export_type']) && is_numeric($_POST['pm_export_type'])) {
 100          $user_prefs['PM_EXPORT_TYPE'] = $_POST['pm_export_type'];
 101      } else {
 102          $user_prefs['PM_EXPORT_TYPE'] = 0;
 103      }
 104  
 105      if (isset($_POST['pm_export_attachments']) && $_POST['pm_export_attachments'] == "Y") {
 106          $user_prefs['PM_EXPORT_ATTACHMENTS'] = "Y";
 107      } else {
 108          $user_prefs['PM_EXPORT_ATTACHMENTS'] = "N";
 109      }
 110  
 111      if (isset($_POST['pm_export_wordfilter']) && $_POST['pm_export_wordfilter'] == "Y") {
 112          $user_prefs['PM_EXPORT_WORDFILTER'] = "Y";
 113      } else {
 114          $user_prefs['PM_EXPORT_WORDFILTER'] = "N";
 115      }
 116  
 117      // Update USER_PREFS
 118      if (user_update_prefs($_SESSION['UID'], $user_prefs)) {
 119  
 120          // Redirect back to the page so we correctly reload the user's preferences.
 121          header_redirect("pm_options.php?webtag=$webtag&updated=true", gettext("Preferences were successfully updated."));
 122          exit;
 123  
 124      } else {
 125  
 126          $error_msg_array[] = gettext("Some or all of your user account details could not be updated. Please try again later.");
 127          $valid = false;
 128      }
 129  }
 130  
 131  // Start output here
 132  html_draw_top(sprintf("title=%s", gettext("Private Message Options")), "js/emoticons.js", 'class=window_title');
 133  
 134  echo "<h1>", gettext("Private Message Options"), "</h1>\n";
 135  
 136  if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 137  
 138      html_display_error_array($error_msg_array, '700', 'left');
 139  
 140  } else if (isset($_GET['updated'])) {
 141  
 142      html_display_success_msg(gettext("Preferences were successfully updated."), '700', 'left');
 143  }
 144  
 145  echo "<br />\n";
 146  echo "<form accept-charset=\"utf-8\" name=\"prefs\" action=\"pm_options.php\" method=\"post\" target=\"_self\">\n";
 147  echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 148  echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
 149  echo "    <tr>\n";
 150  echo "      <td align=\"left\">\n";
 151  echo "        <table class=\"box\" width=\"100%\">\n";
 152  echo "          <tr>\n";
 153  echo "            <td align=\"left\" class=\"posthead\">\n";
 154  echo "              <table class=\"posthead\" width=\"100%\">\n";
 155  echo "                <tr>\n";
 156  echo "                  <td align=\"left\" colspan=\"2\" class=\"subhead\">", gettext("Private Message Options"), "</td>\n";
 157  echo "                </tr>\n";
 158  echo "                <tr>\n";
 159  echo "                  <td align=\"left\" rowspan=\"6\" width=\"1%\">&nbsp;</td>\n";
 160  echo "                </tr>\n";
 161  echo "                <tr>\n";
 162  echo "                  <td align=\"left\" style=\"white-space: nowrap\">", form_checkbox("pm_notify", "Y", gettext("Notify by popup of new PM messages to me"), (isset($user_prefs['PM_NOTIFY']) && $user_prefs['PM_NOTIFY'] == "Y") ? true : false), "</td>\n";
 163  echo "                </tr>\n";
 164  echo "                <tr>\n";
 165  echo "                  <td align=\"left\" style=\"white-space: nowrap\">", form_checkbox("pm_save_sent_items", "Y", gettext("Save a copy of each PM I send in my Sent Items folder"), (isset($user_prefs['PM_SAVE_SENT_ITEM']) && $user_prefs['PM_SAVE_SENT_ITEM'] == "Y") ? true : false), "</td>\n";
 166  echo "                </tr>\n";
 167  echo "                <tr>\n";
 168  echo "                  <td align=\"left\" style=\"white-space: nowrap\">", form_checkbox("pm_include_reply", "Y", gettext("Include message body when replying to PM"), (isset($user_prefs['PM_INCLUDE_REPLY']) && $user_prefs['PM_INCLUDE_REPLY'] == "Y") ? true : false), "</td>\n";
 169  echo "                </tr>\n";
 170  echo "                <tr>\n";
 171  echo "                  <td align=\"left\" style=\"white-space: nowrap\">", form_checkbox("pm_auto_prune_enabled", "Y", gettext("Auto prune my PM folders every:"), (isset($user_prefs['PM_AUTO_PRUNE']) && $user_prefs['PM_AUTO_PRUNE'] > 0) ? true : false), "&nbsp;", form_dropdown_array('pm_auto_prune', array(1 => 10, 2 => 15, 3 => 30, 4 => 60), (isset($user_prefs['PM_AUTO_PRUNE']) ? ($user_prefs['PM_AUTO_PRUNE'] > 0 ? $user_prefs['PM_AUTO_PRUNE'] : $user_prefs['PM_AUTO_PRUNE'] * -1) : 60)), " ", gettext("days"), "</td>\n";
 172  echo "                </tr>\n";
 173  echo "                <tr>\n";
 174  echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
 175  echo "                </tr>\n";
 176  echo "              </table>\n";
 177  echo "            </td>\n";
 178  echo "          </tr>\n";
 179  echo "        </table>\n";
 180  echo "        <br />\n";
 181  echo "        <table class=\"box\" width=\"100%\">\n";
 182  echo "          <tr>\n";
 183  echo "            <td align=\"left\" class=\"posthead\">\n";
 184  echo "              <table class=\"posthead\" width=\"100%\">\n";
 185  echo "                <tr>\n";
 186  echo "                  <td align=\"left\" colspan=\"3\" class=\"subhead\">", gettext("Private Message Export Options"), "</td>\n";
 187  echo "                </tr>\n";
 188  echo "                <tr>\n";
 189  echo "                  <td align=\"left\" rowspan=\"7\" width=\"1%\">&nbsp;</td>\n";
 190  echo "                </tr>\n";
 191  echo "                <tr>\n";
 192  echo "                  <td align=\"left\" width=\"250\" style=\"white-space: nowrap\">", gettext("Export as type"), ":</td>\n";
 193  echo "                  <td align=\"left\">", form_dropdown_array("pm_export_type", array(gettext("HTML"), gettext("XML"), gettext("CSV")), (isset($user_prefs['PM_EXPORT_TYPE']) && is_numeric($user_prefs['PM_EXPORT_TYPE'])) ? $user_prefs['PM_EXPORT_TYPE'] : 0), "</td>\n";
 194  echo "                </tr>\n";
 195  echo "                <tr>\n";
 196  echo "                  <td align=\"left\" width=\"250\" style=\"white-space: nowrap\">", gettext("Export messages as"), ":</td>\n";
 197  echo "                  <td align=\"left\">", form_dropdown_array("pm_export_file", array(gettext("One file for all messages"), gettext("One file per message")), (isset($user_prefs['PM_EXPORT_FILE']) && is_numeric($user_prefs['PM_EXPORT_FILE'])) ? $user_prefs['PM_EXPORT_FILE'] : 0), "</td>\n";
 198  echo "                </tr>\n";
 199  echo "                <tr>\n";
 200  echo "                  <td align=\"left\" colspan=\"2\" style=\"white-space: nowrap\">", form_checkbox("pm_export_attachments", "Y", gettext("Export attachments"), (isset($user_prefs['PM_EXPORT_ATTACHMENTS']) && $user_prefs['PM_EXPORT_ATTACHMENTS'] == "Y") ? true : false), "</td>\n";
 201  echo "                </tr>\n";
 202  echo "                <tr>\n";
 203  echo "                  <td align=\"left\" colspan=\"2\" style=\"white-space: nowrap\">", form_checkbox("pm_export_wordfilter", "Y", gettext("Apply word filter to messages"), (isset($user_prefs['PM_EXPORT_WORDFILTER']) && $user_prefs['PM_EXPORT_WORDFILTER'] == "Y") ? true : false), "</td>\n";
 204  echo "                </tr>\n";
 205  echo "                <tr>\n";
 206  echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
 207  echo "                </tr>\n";
 208  echo "              </table>\n";
 209  echo "            </td>\n";
 210  echo "          </tr>\n";
 211  echo "        </table>\n";
 212  echo "      </td>\n";
 213  echo "    </tr>\n";
 214  echo "    <tr>\n";
 215  echo "      <td align=\"left\">&nbsp;</td>\n";
 216  echo "    </tr>\n";
 217  echo "    <tr>\n";
 218  echo "      <td align=\"center\">", form_submit("save", gettext("Save")), "</td>\n";
 219  echo "    </tr>\n";
 220  echo "  </table>\n";
 221  echo "</form>\n";
 222  
 223  html_draw_bottom();

title

Description

title

Description

title

Description

title

title

Body