Beehive PHP Cross Reference Discussion Forums

Source: /admin_prof_items.php - 663 lines - 27495 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 . 'admin.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'form.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'format.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 . 'profile.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  36  require_once  BH_INCLUDE_PATH . 'word_filter.inc.php';
  37  // End Required includes
  38  
  39  // Check we're logged in correctly
  40  if (!session::logged_in()) {
  41      html_guest_error();
  42  }
  43  
  44  // Check we have Admin / Moderator access
  45  if (!(session::check_perm(USER_PERM_ADMIN_TOOLS, 0))) {
  46      html_draw_error(gettext("You do not have permission to use this section."));
  47  }
  48  
  49  // Perform additional admin login.
  50  admin_check_credentials();
  51  
  52  if (isset($_GET['sect_page']) && is_numeric($_GET['sect_page'])) {
  53      $sect_page = ($_GET['sect_page'] > 0) ? $_GET['sect_page'] : 1;
  54  } else if (isset($_POST['sect_page']) && is_numeric($_POST['sect_page'])) {
  55      $sect_page = ($_POST['sect_page'] > 0) ? $_POST['sect_page'] : 1;
  56  } else {
  57      $sect_page = 1;
  58  }
  59  
  60  if (isset($_GET['page']) && is_numeric($_GET['page'])) {
  61      $page = ($_GET['page'] > 0) ? $_GET['page'] : 1;
  62  } else if (isset($_POST['page']) && is_numeric($_POST['page'])) {
  63      $page = ($_POST['page'] > 0) ? $_POST['page'] : 1;
  64  } else {
  65      $page = 1;
  66  }
  67  
  68  if (isset($_GET['psid']) && is_numeric($_GET['psid'])) {
  69  
  70      $psid = $_GET['psid'];
  71  
  72  } else if (isset($_POST['psid']) && is_numeric($_POST['psid'])) {
  73  
  74      $psid = $_POST['psid'];
  75  
  76  } else {
  77  
  78      html_draw_error(gettext("No Profile section specified."), 'admin_prof_sect.php', 'get', array('back' => gettext("Back")));
  79  }
  80  
  81  // Array to hold error messages
  82  $error_msg_array = array();
  83  
  84  $t_type_new = null;
  85  $t_new_name = null;
  86  $t_options_new = null;
  87  $t_section_new = null;
  88  $t_name_new = null;
  89  
  90  // Array of valid profile item types
  91  $profile_item_valid_types = array(
  92      PROFILE_ITEM_LARGE_TEXT,
  93      PROFILE_ITEM_MEDIUM_TEXT,
  94      PROFILE_ITEM_SMALL_TEXT,
  95      PROFILE_ITEM_MULTI_TEXT,
  96      PROFILE_ITEM_RADIO,
  97      PROFILE_ITEM_DROPDOWN,
  98      PROFILE_ITEM_HYPERLINK
  99  );
 100  
 101  // Array of profile item type descriptions.
 102  $item_types_array = array(
 103      PROFILE_ITEM_LARGE_TEXT => gettext("Text Field"),
 104      PROFILE_ITEM_MULTI_TEXT => gettext("Multi-line Text Field"),
 105      PROFILE_ITEM_RADIO => gettext("Radio Buttons"),
 106      PROFILE_ITEM_DROPDOWN => gettext("Drop Down List"),
 107      PROFILE_ITEM_HYPERLINK => gettext("Clickable Hyperlink")
 108  );
 109  
 110  // View type
 111  if (isset($_GET['viewitems'])) {
 112      $viewitems = "yes";
 113  } else if (isset($_POST['viewitems'])) {
 114      $viewitems = "yes";
 115  }
 116  
 117  if (isset($_POST['delete'])) {
 118  
 119      $valid = true;
 120  
 121      if (isset($_POST['delete_item']) && is_array($_POST['delete_item'])) {
 122  
 123          foreach ($_POST['delete_item'] as $piid => $delete_item) {
 124  
 125              if ($valid && $delete_item == "Y" && $profile_item_name = profile_item_get_name($piid)) {
 126  
 127                  if (($section_name = profile_section_get_name($_POST['psid'])) !== false) {
 128  
 129                      if (profile_item_delete($piid)) {
 130  
 131                          admin_add_log_entry(DELETE_PROFILE_ITEM, array($section_name, $profile_item_name));
 132  
 133                      } else {
 134  
 135                          $error_msg_array[] = gettext("Failed to remove profile items");
 136                          $valid = false;
 137                      }
 138                  }
 139              }
 140          }
 141  
 142          if ($valid) {
 143  
 144              header_redirect("admin_prof_items.php?webtag=$webtag&psid=$psid&deleted=true");
 145              exit;
 146          }
 147      }
 148  }
 149  
 150  if (isset($_POST['cancel'])) {
 151  
 152      header_redirect("admin_prof_items.php?webtag=$webtag&psid=$psid");
 153      exit;
 154  }
 155  
 156  if (isset($_POST['back'])) {
 157  
 158      if (isset($viewitems)) {
 159  
 160          $redirect = "admin_prof_sect.php?webtag=$webtag&page=$sect_page";
 161          header_redirect($redirect);
 162  
 163      } else {
 164  
 165          $redirect = "admin_prof_sect.php?webtag=$webtag&psid=$psid&page=$sect_page";
 166          header_redirect($redirect);
 167      }
 168  }
 169  
 170  if (isset($_POST['additemsubmit'])) {
 171  
 172      $valid = true;
 173  
 174      if (isset($_POST['t_name_new']) && strlen(trim($_POST['t_name_new'])) > 0) {
 175  
 176          $t_new_name = trim($_POST['t_name_new']);
 177  
 178      } else {
 179  
 180          $error_msg_array[] = gettext("You must enter a profile item name");
 181          $valid = false;
 182      }
 183  
 184      if (isset($_POST['t_type_new']) && in_array($_POST['t_type_new'], $profile_item_valid_types)) {
 185  
 186          $t_type_new = $_POST['t_type_new'];
 187  
 188      } else {
 189  
 190          $error_msg_array[] = gettext("Invalid profile item type selected");
 191          $valid = false;
 192      }
 193  
 194      if (isset($_POST['t_options_new']) && strlen(trim($_POST['t_options_new'])) > 0) {
 195  
 196          $t_options_new = trim($_POST['t_options_new']);
 197  
 198          if ($valid && ($t_type_new == PROFILE_ITEM_RADIO || $t_type_new == PROFILE_ITEM_DROPDOWN)) {
 199  
 200              if (sizeof(explode("\n", $t_options_new)) < 1) {
 201  
 202                  $error_msg_array[] = gettext("You must enter more than one option for selected profile item type");
 203                  $valid = false;
 204              }
 205  
 206          } else if ($valid && $t_type_new == PROFILE_ITEM_HYPERLINK) {
 207  
 208              $check_url = parse_url($t_options_new);
 209  
 210              if (!isset($check_url['scheme']) || $check_url['scheme'] != "http") {
 211  
 212                  $valid = false;
 213                  $error_msg_array[] = gettext("Profile item hyperlinks support HTTP URLs only");
 214              }
 215  
 216              if ($valid && (!isset($check_url['host']) || strlen(trim($check_url['host'])) < 1)) {
 217  
 218                  $valid = false;
 219                  $error_msg_array[] = gettext("Profile item hyperlink format invalid");
 220              }
 221  
 222              if (preg_match('/\[ProfileEntry\]/iu', $t_options_new) < 1) {
 223  
 224                  $error_msg_array[] = sprintf(gettext("You must include <i>%s</i> in the URL of clickable hyperlinks"), '[ProfileEntry]');
 225                  $valid = false;
 226              }
 227          }
 228  
 229      } else if ($valid && ($t_type_new == PROFILE_ITEM_RADIO || $t_type_new == PROFILE_ITEM_DROPDOWN || $t_type_new == PROFILE_ITEM_HYPERLINK)) {
 230  
 231          $error_msg_array[] = gettext("You must enter some options for selected profile item type");
 232          $valid = false;
 233  
 234      } else {
 235  
 236          $t_options_new = "";
 237      }
 238  
 239      if ($valid) {
 240  
 241          if (($new_piid = profile_item_create($psid, $t_new_name, $t_type_new, $t_options_new)) !== false) {
 242  
 243              $t_section_name = profile_section_get_name($psid);
 244  
 245              admin_add_log_entry(ADDED_PROFILE_ITEM, array($t_section_name, $t_new_name));
 246              header_redirect("admin_prof_items.php?webtag=$webtag&psid=$psid&added=true");
 247              exit;
 248  
 249          } else {
 250  
 251              $error_msg_error[] = gettext("Failed to create new profile item");
 252              $valid = false;
 253          }
 254      }
 255  
 256  } else if (isset($_POST['edititemsubmit'])) {
 257  
 258      $valid = true;
 259  
 260      if (isset($_POST['piid']) && is_numeric($_POST['piid'])) {
 261  
 262          $piid = $_POST['piid'];
 263  
 264      } else {
 265  
 266          $error_msg_array[] = gettext("Invalid profile item ID or item not found");
 267          $valid = false;
 268      }
 269  
 270      if (isset($_POST['t_name_new']) && strlen(trim($_POST['t_name_new'])) > 0) {
 271  
 272          $t_name_new = trim($_POST['t_name_new']);
 273  
 274      } else {
 275  
 276          $error_msg_array[] = gettext("You must enter a profile item name");
 277          $valid = false;
 278      }
 279  
 280      if (isset($_POST['t_type_new']) && in_array($_POST['t_type_new'], $profile_item_valid_types)) {
 281  
 282          $t_type_new = $_POST['t_type_new'];
 283  
 284      } else {
 285  
 286          $error_msg_array[] = gettext("Invalid profile item type selected");
 287          $valid = false;
 288      }
 289  
 290      if (isset($_POST['t_options_new']) && strlen(trim($_POST['t_options_new'])) > 0) {
 291  
 292          $t_options_new = trim($_POST['t_options_new']);
 293  
 294          if ($valid && ($t_type_new == PROFILE_ITEM_RADIO || $t_type_new == PROFILE_ITEM_DROPDOWN)) {
 295  
 296              if (sizeof(explode("\n", $t_options_new)) < 1) {
 297  
 298                  $error_msg_array[] = gettext("You must enter more than one option for selected profile item type");
 299                  $valid = false;
 300              }
 301  
 302          } else if ($valid && $t_type_new == PROFILE_ITEM_HYPERLINK) {
 303  
 304              $check_url = parse_url($t_options_new);
 305  
 306              if (!isset($check_url['scheme']) || $check_url['scheme'] != "http") {
 307  
 308                  $valid = false;
 309                  $error_msg_array[] = gettext("Profile item hyperlinks support HTTP URLs only");
 310              }
 311  
 312              if ($valid && (!isset($check_url['host']) || strlen(trim($check_url['host'])) < 1)) {
 313  
 314                  $valid = false;
 315                  $error_msg_array[] = gettext("Profile item hyperlink format invalid");
 316              }
 317  
 318              if (preg_match('/\[ProfileEntry\]/iu', $t_options_new) < 1) {
 319  
 320                  $error_msg_array[] = sprintf(gettext("You must include <i>%s</i> in the URL of clickable hyperlinks"), '[ProfileEntry]');
 321                  $valid = false;
 322              }
 323          }
 324  
 325      } else if ($valid && ($t_type_new == PROFILE_ITEM_RADIO || $t_type_new == PROFILE_ITEM_DROPDOWN || $t_type_new == PROFILE_ITEM_HYPERLINK)) {
 326  
 327          $error_msg_array[] = gettext("You must enter some options for selected profile item type");
 328          $valid = false;
 329  
 330      } else {
 331  
 332          $t_options_new = "";
 333      }
 334  
 335      if (isset($_POST['t_section_new']) && is_numeric($_POST['t_section_new'])) {
 336  
 337          $t_section_new = $_POST['t_section_new'];
 338  
 339      } else {
 340  
 341          $error_msg_array[] = gettext("Invalid profile section ID or section not found");
 342          $valid = false;
 343      }
 344  
 345      if ($valid) {
 346  
 347          if (profile_item_update($piid, $t_section_new, $t_type_new, $t_name_new, $t_options_new)) {
 348  
 349              $profile_item = profile_get_item($piid);
 350  
 351              if (($t_name_new != $profile_item['NAME']) || ($t_type_new != $profile_item['TYPE']) || ($t_section_new != $psid) || ($t_options_new != $profile_item['OPTIONS'])) {
 352  
 353                  $log_data = array(
 354                      $t_name_new,
 355                      $profile_item['NAME'],
 356                      $t_type_new,
 357                      $profile_item['TYPE'],
 358                      $t_section_new, $psid
 359                  );
 360  
 361                  admin_add_log_entry(CHANGE_PROFILE_ITEM, $log_data);
 362              }
 363  
 364              header_redirect("admin_prof_items.php?webtag=$webtag&psid=$psid&edited=true");
 365              exit;
 366  
 367          } else {
 368  
 369              $error_msg_array[] = gettext("Failed to update profile item");
 370              $valid = false;
 371          }
 372      }
 373  
 374  } else if (isset($_POST['additem'])) {
 375  
 376      $redirect = "admin_prof_items.php?webtag=$webtag&psid=$psid&additem=true&sect_page=$sect_page";
 377      header_redirect($redirect);
 378      exit;
 379  }
 380  
 381  if (isset($_POST['move_up']) && is_array($_POST['move_up'])) {
 382  
 383      list($piid) = array_keys($_POST['move_up']);
 384      profile_item_move_up($psid, $piid);
 385  }
 386  
 387  if (isset($_POST['move_down']) && is_array($_POST['move_down'])) {
 388  
 389      list($piid) = array_keys($_POST['move_down']);
 390      profile_item_move_down($psid, $piid);
 391  }
 392  
 393  if (isset($_GET['additem']) || isset($_POST['additem'])) {
 394  
 395      html_draw_top(sprintf('title=%s', sprintf(gettext("Admin - Manage Profile Sections - %s - Add New Item"), profile_section_get_name($psid))), 'class=window_title', 'main_css=admin.css');
 396  
 397      echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Manage Profile Sections"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", profile_section_get_name($psid), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Add new item"), "</h1>\n";
 398  
 399      if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 400          html_display_error_array($error_msg_array, '700', 'center');
 401      }
 402  
 403      echo "<br />\n";
 404      echo "<div align=\"center\">\n";
 405      echo "<form accept-charset=\"utf-8\" name=\"f_sections\" action=\"admin_prof_items.php\" method=\"post\">\n";
 406      echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 407      echo "  ", form_input_hidden("psid", htmlentities_array($psid)), "\n";
 408      echo "  ", form_input_hidden("sect_page", htmlentities_array($sect_page)), "\n";
 409  
 410      if (isset($viewitems)) echo "  ", form_input_hidden("viewitems", "yes"), "\n";
 411  
 412      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
 413      echo "    <tr>\n";
 414      echo "      <td align=\"left\">\n";
 415      echo "        <table class=\"box\" width=\"100%\">\n";
 416      echo "          <tr>\n";
 417      echo "            <td align=\"left\" class=\"posthead\">\n";
 418      echo "              <table class=\"posthead\" width=\"100%\">\n";
 419      echo "                <tr>\n";
 420      echo "                  <td class=\"subhead\" align=\"left\" colspan=\"2\">", gettext("Add new item"), "</td>\n";
 421      echo "                </tr>\n";
 422      echo "                <tr>\n";
 423      echo "                  <td align=\"center\">\n";
 424      echo "                    <table class=\"posthead\" width=\"95%\">\n";
 425      echo "                      <tr>\n";
 426      echo "                        <td align=\"left\" width=\"150\">", gettext("Type"), ":</td>\n";
 427      echo "                        <td align=\"left\">", form_dropdown_array("t_type_new", $item_types_array), "</td>\n";
 428      echo "                      </tr>\n";
 429      echo "                      <tr>\n";
 430      echo "                        <td align=\"left\" width=\"150\">", gettext("Item Name"), ":</td>\n";
 431      echo "                        <td align=\"left\">", form_input_text("t_name_new", (isset($_POST['t_name_new']) ? htmlentities_array($_POST['t_name_new']) : ""), 52, 64), "</td>\n";
 432      echo "                      </tr>\n";
 433      echo "                      <tr>\n";
 434      echo "                        <td align=\"left\" width=\"150\" valign=\"top\">", gettext("Options"), ":</td>\n";
 435      echo "                        <td align=\"left\">", form_textarea("t_options_new", (isset($_POST['t_options_new']) ? htmlentities_array($_POST['t_options_new']) : ""), 6, 50), "</td>\n";
 436      echo "                      </tr>\n";
 437      echo "                      <tr>\n";
 438      echo "                        <td align=\"left\" colspan=\"4\">&nbsp;</td>\n";
 439      echo "                      </tr>\n";
 440      echo "                    </table>\n";
 441      echo "                  </td>\n";
 442      echo "                </tr>\n";
 443      echo "              </table>\n";
 444      echo "            </td>\n";
 445      echo "          </tr>\n";
 446      echo "        </table>\n";
 447      echo "      </td>\n";
 448      echo "    </tr>\n";
 449      echo "    <tr>\n";
 450      echo "      <td align=\"left\">&nbsp;</td>\n";
 451      echo "    </tr>\n";
 452      echo "    <tr>\n";
 453      echo "      <td align=\"center\">", form_submit("additemsubmit", gettext("Add")), "&nbsp;", form_submit("cancel", gettext("Cancel")), "</td>\n";
 454      echo "    </tr>\n";
 455      echo "  </table>\n";
 456  
 457      html_display_warning_msg(gettext("To create Radio Buttons or a Drop Down List you need to enter each individual value on a separate line in the Options field."), '700', 'center');
 458  
 459      html_display_warning_msg(gettext("To create clickable links enter the URL in the Options field and use <i>[ProfileEntry]</i> where the entry from the user's profile should appear. Examples: <p>MySpace: <i>http://www.myspace.com/[ProfileEntry]</i><br />Xbox LIVE: <i>http://profile.mygamercard.net/[ProfileEntry]</i></p>"), '700', 'center');
 460  
 461      echo "</form>\n";
 462      echo "</div>\n";
 463  
 464      html_draw_bottom();
 465  
 466  } else if (isset($_GET['piid']) || isset($_POST['piid'])) {
 467  
 468      if (isset($_POST['piid']) && is_numeric($_POST['piid'])) {
 469  
 470          $piid = $_POST['piid'];
 471  
 472      } else if (isset($_GET['piid']) && is_numeric($_GET['piid'])) {
 473  
 474          $piid = $_GET['piid'];
 475  
 476      } else {
 477  
 478          html_draw_error(gettext("Invalid profile item ID or item not found"), 'admin_prof_sect.php', 'get', array('back' => gettext("Back")));
 479      }
 480  
 481      if (!$profile_item = profile_get_item($piid)) {
 482          html_draw_error(gettext("Invalid profile item ID or item not found"), 'admin_prof_sect.php', 'get', array('back' => gettext("Back")));
 483      }
 484  
 485      html_draw_top(sprintf('title=%s', sprintf(gettext("Admin - Manage Profile Sections - %s - Edit Item - %s"), profile_section_get_name($psid), $profile_item['NAME'])), 'class=window_title', 'main_css=admin.css');
 486  
 487      echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Manage Profile Sections"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", profile_section_get_name($psid), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Edit item"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", word_filter_add_ob_tags($profile_item['NAME'], true), "</h1>\n";
 488  
 489      if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 490          html_display_error_array($error_msg_array, '700', 'center');
 491      }
 492  
 493      echo "<br />\n";
 494      echo "<div align=\"center\">\n";
 495      echo "<form accept-charset=\"utf-8\" name=\"f_sections\" action=\"admin_prof_items.php\" method=\"post\">\n";
 496      echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 497      echo "  ", form_input_hidden("psid", htmlentities_array($psid)), "\n";
 498      echo "  ", form_input_hidden("piid", htmlentities_array($piid)), "\n";
 499      echo "  ", form_input_hidden("sect_page", htmlentities_array($sect_page)), "\n";
 500      echo "  ", form_input_hidden("delete_item[$piid]", "Y"), "\n";
 501  
 502      if (isset($viewitems)) echo "  ", form_input_hidden("viewitems", "yes"), "\n";
 503  
 504      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
 505      echo "    <tr>\n";
 506      echo "      <td align=\"left\">\n";
 507      echo "        <table class=\"box\" width=\"100%\">\n";
 508      echo "          <tr>\n";
 509      echo "            <td align=\"left\" class=\"posthead\">\n";
 510      echo "              <table class=\"posthead\" width=\"100%\">\n";
 511      echo "                <tr>\n";
 512      echo "                  <td class=\"subhead\" align=\"left\" colspan=\"2\">", gettext("Edit item"), "</td>\n";
 513      echo "                </tr>\n";
 514      echo "                <tr>\n";
 515      echo "                  <td align=\"center\">\n";
 516      echo "                    <table class=\"posthead\" width=\"95%\">\n";
 517      echo "                      <tr>\n";
 518      echo "                        <td align=\"left\" width=\"150\">", gettext("Type"), ":</td>\n";
 519      echo "                        <td align=\"left\">", form_dropdown_array("t_type_new", $item_types_array, (isset($_POST['t_type_new']) && is_numeric($_POST['t_type_new']) ? $_POST['t_type_new'] : $profile_item['TYPE'])), "</td>\n";
 520      echo "                      </tr>\n";
 521      echo "                      <tr>\n";
 522      echo "                        <td align=\"left\" width=\"150\">", gettext("Section Name"), ":</td>\n";
 523      echo "                        <td align=\"left\">", profile_section_dropdown($psid, "t_section_new"), "</td>\n";
 524      echo "                      </tr>\n";
 525      echo "                      <tr>\n";
 526      echo "                        <td align=\"left\" width=\"150\">", gettext("Item Name"), ":</td>\n";
 527      echo "                        <td align=\"left\">", form_input_text("t_name_new", (isset($_POST['t_name_new']) ? htmlentities_array($_POST['t_name_new']) : htmlentities_array($profile_item['NAME'])), 52, 64), "</td>\n";
 528      echo "                      </tr>\n";
 529      echo "                      <tr>\n";
 530      echo "                        <td align=\"left\" width=\"150\" valign=\"top\">", gettext("Options"), ":</td>\n";
 531      echo "                        <td align=\"left\">", form_textarea("t_options_new", (isset($_POST['t_options_new']) ? htmlentities_array($_POST['t_options_new']) : htmlentities_array($profile_item['OPTIONS'])), 6, 50), "</td>\n";
 532      echo "                      </tr>\n";
 533      echo "                      <tr>\n";
 534      echo "                        <td align=\"left\" colspan=\"4\">&nbsp;</td>\n";
 535      echo "                      </tr>\n";
 536      echo "                    </table>\n";
 537      echo "                  </td>\n";
 538      echo "                </tr>\n";
 539      echo "              </table>\n";
 540      echo "            </td>\n";
 541      echo "          </tr>\n";
 542      echo "        </table>\n";
 543      echo "      </td>\n";
 544      echo "    </tr>\n";
 545      echo "    <tr>\n";
 546      echo "      <td align=\"left\">&nbsp;</td>\n";
 547      echo "    </tr>\n";
 548      echo "    <tr>\n";
 549      echo "      <td align=\"center\">", form_submit("edititemsubmit", gettext("Save")), "&nbsp;", form_submit("delete", gettext("Delete")), "&nbsp;", form_submit("cancel", gettext("Cancel")), "</td>\n";
 550      echo "    </tr>\n";
 551      echo "  </table>\n";
 552  
 553      html_display_warning_msg(gettext("To create Radio Buttons or a Drop Down List you need to enter each individual value on a separate line in the Options field."), '700', 'center');
 554  
 555      html_display_warning_msg(gettext("To create clickable links enter the URL in the Options field and use <i>[ProfileEntry]</i> where the entry from the user's profile should appear. Examples: <p>MySpace: <i>http://www.myspace.com/[ProfileEntry]</i><br />Xbox LIVE: <i>http://profile.mygamercard.net/[ProfileEntry]</i></p>"), '700', 'center');
 556  
 557      echo "</form>\n";
 558      echo "</div>\n";
 559  
 560      html_draw_bottom();
 561  
 562  } else {
 563  
 564      html_draw_top(sprintf('title=%s', sprintf(gettext("Admin - Manage Profile Sections - %s - View Items"), profile_section_get_name($psid))), 'class=window_title', 'main_css=admin.css');
 565  
 566      $profile_items = profile_items_get_by_page($psid, $page);
 567  
 568      echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Manage Profile Sections"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", profile_section_get_name($psid), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("View items"), "</h1>\n";
 569  
 570      if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 571  
 572          html_display_error_array($error_msg_array, '86%', 'center');
 573  
 574      } else if (isset($_GET['added'])) {
 575  
 576          html_display_success_msg(gettext("Successfully added new profile item"), '86%', 'center');
 577  
 578      } else if (isset($_GET['edited'])) {
 579  
 580          html_display_success_msg(gettext("Successfully edited profile item"), '86%', 'center');
 581  
 582      } else if (isset($_GET['deleted'])) {
 583  
 584          html_display_success_msg(gettext("Successfully removed selected profile items"), '86%', 'center');
 585  
 586      } else if (sizeof($profile_items['profile_items_array']) < 1) {
 587  
 588          html_display_warning_msg(gettext("There are no existing profile items in this section. To add an item click the 'Add New' button below."), '86%', 'center');
 589      }
 590  
 591      echo "<br />\n";
 592      echo "<div align=\"center\">\n";
 593      echo "<form accept-charset=\"utf-8\" name=\"f_sections\" action=\"admin_prof_items.php\" method=\"post\">\n";
 594      echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 595      echo "  ", form_input_hidden("psid", htmlentities_array($psid)), "\n";
 596      echo "  ", form_input_hidden("sect_page", htmlentities_array($sect_page)), "\n";
 597  
 598      if (isset($viewitems)) echo "  ", form_input_hidden("viewitems", "yes"), "\n";
 599  
 600      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"86%\">\n";
 601      echo "    <tr>\n";
 602      echo "      <td align=\"left\">\n";
 603      echo "        <table class=\"box\" width=\"100%\">\n";
 604      echo "          <tr>\n";
 605      echo "            <td align=\"left\" class=\"posthead\">\n";
 606      echo "              <table class=\"posthead\" width=\"100%\">\n";
 607      echo "                <tr>\n";
 608      echo "                  <td class=\"subhead\" align=\"left\" width=\"25\">&nbsp;</td>\n";
 609      echo "                  <td class=\"subhead\" align=\"left\">", gettext("Item Name"), "</td>\n";
 610      echo "                  <td class=\"subhead\" align=\"left\" width=\"50\">&nbsp;</td>\n";
 611      echo "                  <td class=\"subhead\" align=\"left\" width=\"150\">", gettext("Type"), "</td>\n";
 612      echo "                </tr>\n";
 613  
 614      if (sizeof($profile_items['profile_items_array']) > 0) {
 615  
 616          foreach ($profile_items['profile_items_array'] as $profile_item) {
 617  
 618              echo "                <tr>\n";
 619              echo "                  <td valign=\"top\" align=\"center\" width=\"25\">", form_checkbox("delete_item[{$profile_item['PIID']}]", "Y"), "</td>\n";
 620              echo "                  <td valign=\"top\" align=\"left\"><a href=\"admin_prof_items.php?webtag=$webtag&amp;psid=$psid&amp;piid={$profile_item['PIID']}&amp;sect_page=$sect_page\">", word_filter_add_ob_tags($profile_item['NAME'], true), "</a></td>\n";
 621              echo "                  <td align=\"center\" width=\"50\" style=\"white-space: nowrap\">", form_submit_image('move_up.png', "move_up[{$profile_item['PIID']}]", "Move Up", "title=\"Move Up\"", "move_up_ctrl"), form_submit_image('move_down.png', "move_down[{$profile_item['PIID']}]", "Move Down", "title=\"Move Down\"", "move_down_ctrl"), "</td>\n";
 622  
 623              if (isset($item_types_array[$profile_item['TYPE']])) {
 624                  echo "                  <td valign=\"top\" align=\"left\" width=\"100\">{$item_types_array[$profile_item['TYPE']]}</td>\n";
 625              } else {
 626                  echo "                  <td valign=\"top\" align=\"left\" width=\"100\">", gettext("Text Field"), "</td>\n";
 627              }
 628  
 629              echo "                </tr>\n";
 630          }
 631      }
 632  
 633      echo "                <tr>\n";
 634      echo "                  <td align=\"left\" colspan=\"4\">&nbsp;</td>\n";
 635      echo "                </tr>\n";
 636      echo "              </table>\n";
 637      echo "            </td>\n";
 638      echo "          </tr>\n";
 639      echo "        </table>\n";
 640      echo "      </td>\n";
 641      echo "    </tr>\n";
 642      echo "    <tr>\n";
 643      echo "      <td align=\"left\">&nbsp;</td>\n";
 644      echo "    </tr>\n";
 645      echo "    <tr>\n";
 646      echo "      <td class=\"postbody\" align=\"center\">";
 647  
 648      html_page_links("admin_prof_items.php?webtag=$webtag&psid=$psid&sect_page=$sect_page", $page, $profile_items['profile_items_count'], 10);
 649  
 650      echo "      </td>\n";
 651      echo "    </tr>\n";
 652      echo "    <tr>\n";
 653      echo "      <td align=\"left\">&nbsp;</td>\n";
 654      echo "    </tr>\n";
 655      echo "    <tr>\n";
 656      echo "      <td align=\"center\">", form_submit("additem", gettext("Add New")), "&nbsp;", form_submit("delete", gettext("Delete Selected")), "&nbsp;", form_submit("back", gettext("Back")), "</td>\n";
 657      echo "    </tr>\n";
 658      echo "  </table>\n";
 659      echo "</form>\n";
 660      echo "</div>\n";
 661  
 662      html_draw_bottom();
 663  }

title

Description

title

Description

title

Description

title

title

Body