Beehive PHP Cross Reference Discussion Forums

Source: /admin_rss_feeds.php - 767 lines - 33391 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 . 'folder.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'form.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'header.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'rss_feed.inc.php';
  36  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  37  require_once  BH_INCLUDE_PATH . 'user.inc.php';
  38  require_once  BH_INCLUDE_PATH . 'word_filter.inc.php';
  39  // End Required includes
  40  
  41  // Check we're logged in correctly
  42  if (!session::logged_in()) {
  43      html_guest_error();
  44  }
  45  
  46  // Check we have Admin / Moderator access
  47  if (!(session::check_perm(USER_PERM_ADMIN_TOOLS, 0))) {
  48      html_draw_error(gettext("You do not have permission to use this section."));
  49  }
  50  
  51  // Perform additional admin login.
  52  admin_check_credentials();
  53  
  54  // Array to hold error messages
  55  $error_msg_array = array();
  56  
  57  $t_name_new = null;
  58  $t_new_name = null;
  59  $t_user_uid = null;
  60  $t_fid_new = null;
  61  $t_new_fid = null;
  62  $t_url_new = null;
  63  $t_new_url = null;
  64  $t_user_new = null;
  65  $t_new_user = null;
  66  $t_frequency_new = null;
  67  $t_new_frequency = null;
  68  $t_max_item_count_new = null;
  69  $t_max_item_count = null;
  70  $t_url = null;
  71  
  72  if (isset($_GET['page']) && is_numeric($_GET['page'])) {
  73      $page = ($_GET['page'] > 0) ? $_GET['page'] : 1;
  74  } else if (isset($_POST['page']) && is_numeric($_POST['page'])) {
  75      $page = ($_POST['page'] > 0) ? $_POST['page'] : 1;
  76  } else {
  77      $page = 1;
  78  }
  79  
  80  $update_frequencies_array = array(
  81      RSS_FEED_UPDATE_NEVER => gettext("Never"),
  82      RSS_FEED_UPDATE_THIRTY_MINS => gettext("Every 30 minutes"),
  83      RSS_FEED_UPDATE_ONE_HOUR => gettext("Once an hour"),
  84      RSS_FEED_UPDATE_SIX_HOURS => gettext("Every 6 hours"),
  85      RSS_FEED_UPDATE_TWELVE_HOURS => gettext("Every 12 hours"),
  86      RSS_FEED_UPDATE_ONCE_A_DAY => gettext("Once a day"),
  87      RSS_FEED_UPDATE_ONCE_A_WEEK => gettext("Once a Week")
  88  );
  89  
  90  // Cancel clicked.
  91  if (isset($_POST['cancel'])) {
  92  
  93      header_redirect("admin_rss_feeds.php?webtag=$webtag");
  94      exit;
  95  }
  96  
  97  if (isset($_POST['delete'])) {
  98  
  99      $valid = true;
 100  
 101      if (isset($_POST['t_delete']) && is_array($_POST['t_delete'])) {
 102  
 103          foreach ($_POST['t_delete'] as $feed_id => $delete_feed) {
 104  
 105              if ($valid && $delete_feed == "Y" && $rss_feed = rss_feed_get($feed_id)) {
 106  
 107                  if (rss_feed_remove($feed_id)) {
 108  
 109                      admin_add_log_entry(DELETED_RSS_FEED, array($rss_feed['NAME']));
 110  
 111                  } else {
 112  
 113                      $error_msg_array[] = gettext("Failed to remove some or all of the selected feeds");
 114                      $valid = false;
 115                  }
 116              }
 117          }
 118  
 119          if ($valid) {
 120  
 121              header_redirect("admin_rss_feeds.php?webtag=$webtag&deleted=true");
 122              exit;
 123          }
 124      }
 125  
 126  } else if (isset($_POST['checkfeedsubmit'])) {
 127  
 128      $valid = true;
 129  
 130      if (isset($_POST['t_url']) && strlen(trim($_POST['t_url'])) > 0) {
 131  
 132          $t_url = trim($_POST['t_url']);
 133  
 134      } else if (isset($_POST['t_url_new']) && strlen(trim($_POST['t_url_new'])) > 0) {
 135  
 136          $t_url = trim($_POST['t_url_new']);
 137  
 138      } else {
 139  
 140          $error_msg_array[] = gettext("Must specify RSS Feed URL");
 141          $valid = false;
 142      }
 143  
 144      if ($valid) {
 145  
 146          if (($rss_feed_items = rss_feed_read_database($t_url)) !== false) {
 147  
 148              if (is_array($rss_feed_items) && sizeof($rss_feed_items) > 0) {
 149  
 150                  $rss_stream_success = gettext("RSS stream appears to be working correctly");
 151  
 152              } else {
 153  
 154                  $error_msg_array[] = gettext("RSS stream was empty or could not be found");
 155              }
 156  
 157          } else {
 158  
 159              $error_msg_array[] = gettext("RSS stream was empty or could not be found");
 160          }
 161      }
 162  
 163      unset($t_url);
 164  
 165  } else if (isset($_POST['addfeedsubmit'])) {
 166  
 167      $valid = true;
 168  
 169      if (isset($_POST['t_name_new']) && strlen(trim($_POST['t_name_new'])) > 0) {
 170          $t_name_new = trim($_POST['t_name_new']);
 171      } else {
 172          $valid = false;
 173          $error_msg_array[] = gettext("Must specify RSS Feed Name");
 174      }
 175  
 176      if (isset($_POST['t_user_new']) && strlen(trim($_POST['t_user_new'])) > 0) {
 177  
 178          $t_user_new = trim($_POST['t_user_new']);
 179  
 180          if (($t_user_array = user_get_by_logon($t_user_new)) !== false) {
 181  
 182              $t_user_uid = $t_user_array['UID'];
 183  
 184          } else {
 185  
 186              $valid = false;
 187              $error_msg_array[] = gettext("Unknown RSS User Account");
 188          }
 189  
 190      } else {
 191  
 192          $valid = false;
 193          $error_msg_array[] = gettext("Must specify RSS Feed User Account");
 194      }
 195  
 196      if (isset($_POST['t_fid_new']) && is_numeric($_POST['t_fid_new'])) {
 197  
 198          $t_fid_new = $_POST['t_fid_new'];
 199  
 200      } else {
 201  
 202          $valid = false;
 203          $error_msg_array[] = gettext("Must specify RSS Feed Folder");
 204      }
 205  
 206      if (isset($_POST['t_url_new']) && strlen(trim($_POST['t_url_new'])) > 0) {
 207  
 208          $t_url_new = trim($_POST['t_url_new']);
 209  
 210          $check_url = parse_url($t_url_new);
 211  
 212          if (!isset($check_url['scheme']) || $check_url['scheme'] != "http") {
 213  
 214              $valid = false;
 215              $error_msg_array[] = gettext("RSS Feed supports HTTP URLs only. Secure feeds (https://) are not supported.");
 216          }
 217  
 218          if (!isset($check_url['host']) || strlen(trim($check_url['host'])) < 1) {
 219  
 220              $valid = false;
 221              $error_msg_array[] = gettext("RSS Feed URL format is invalid. URL must include scheme (e.g. http://) and a hostname (e.g. www.hostname.com).");
 222          }
 223  
 224          if (isset($check_url['user']) || isset($check_url['pass'])) {
 225  
 226              $valid = false;
 227              $error_msg_array[] = gettext("RSS Feed does not support HTTP user authentication");
 228          }
 229  
 230      } else {
 231  
 232          $valid = false;
 233          $error_msg_array[] = gettext("Must specify RSS Feed URL");
 234      }
 235  
 236      if (isset($_POST['t_prefix_new']) && strlen(trim($_POST['t_prefix_new'])) > 0) {
 237          $t_prefix_new = trim($_POST['t_prefix_new']);
 238      } else {
 239          $t_prefix_new = "";
 240      }
 241  
 242      if (isset($_POST['t_frequency_new']) && is_numeric($_POST['t_frequency_new'])) {
 243  
 244          $t_frequency_new = $_POST['t_frequency_new'];
 245  
 246      } else {
 247  
 248          $valid = false;
 249          $error_msg_array[] = gettext("Must specify RSS Feed Update Frequency");
 250      }
 251  
 252      if (isset($_POST['t_max_item_count_new']) && in_array($_POST['t_max_item_count_new'], range(1, 10))) {
 253  
 254          $t_max_item_count_new = $_POST['t_max_item_count_new'];
 255  
 256      } else {
 257  
 258          $valid = false;
 259          $error_msg_array[] = gettext("Max Item Count must be between 1 and 10");
 260      }
 261  
 262      if ($valid) {
 263  
 264          if (rss_feed_add($t_name_new, $t_user_uid, $t_fid_new, $t_url_new, $t_prefix_new, $t_frequency_new, $t_max_item_count_new)) {
 265  
 266              admin_add_log_entry(ADDED_RSS_FEED, array($t_name_new, $t_url_new));
 267              header_redirect("admin_rss_feeds.php?webtag=$webtag&added=true");
 268              exit;
 269  
 270          } else {
 271  
 272              $error_msg_array[] = gettext("Failed to add new RSS Feed");
 273          }
 274      }
 275  
 276  } else if (isset($_POST['updatefeedsubmit'])) {
 277  
 278      $valid = true;
 279  
 280      if (isset($_POST['feed_id']) && is_numeric($_POST['feed_id'])) {
 281  
 282          $feed_id = $_POST['feed_id'];
 283  
 284          if (isset($_POST['t_name']) && strlen(trim($_POST['t_name'])) > 0) {
 285  
 286              $t_new_name = trim($_POST['t_name']);
 287  
 288          } else {
 289  
 290              $valid = false;
 291              $error_msg_array[] = gettext("Must specify RSS Feed Name");
 292          }
 293  
 294          if (isset($_POST['t_old_name']) && strlen(trim($_POST['t_old_name'])) > 0) {
 295              $t_old_name = trim($_POST['t_old_name']);
 296          } else {
 297              $t_old_name = "";
 298          }
 299  
 300          if (isset($_POST['t_user']) && strlen(trim($_POST['t_user'])) > 0) {
 301  
 302              $t_new_user = trim($_POST['t_user']);
 303  
 304          } else {
 305  
 306              $valid = false;
 307              $error_msg_array[] = gettext("Must specify RSS Feed User Account");
 308          }
 309  
 310          if (isset($_POST['t_old_user']) && strlen(trim($_POST['t_old_user'])) > 0) {
 311              $t_old_user = trim($_POST['t_old_user']);
 312          } else {
 313              $t_old_user = "";
 314          }
 315  
 316          if (isset($_POST['t_fid']) && is_numeric($_POST['t_fid'])) {
 317  
 318              $t_new_fid = $_POST['t_fid'];
 319  
 320          } else {
 321  
 322              $valid = false;
 323              $error_msg_array[] = gettext("Must specify RSS Feed Folder");
 324          }
 325  
 326          if (isset($_POST['t_old_fid']) && is_numeric($_POST['t_old_fid'])) {
 327              $t_old_fid = $_POST['t_old_fid'];
 328          } else {
 329              $t_old_fid = "";
 330          }
 331  
 332          if (isset($_POST['t_url']) && strlen(trim($_POST['t_url'])) > 0) {
 333              $t_new_url = $_POST['t_url'];
 334          } else {
 335              $valid = false;
 336              $error_msg_array[] = gettext("Must specify RSS Feed URL");
 337          }
 338  
 339          if (isset($_POST['t_old_url']) && strlen(trim($_POST['t_old_url'])) > 0) {
 340              $t_old_url = $_POST['t_old_url'];
 341          } else {
 342              $t_old_url = "";
 343          }
 344  
 345          if (isset($_POST['t_prefix']) && strlen(trim($_POST['t_prefix'])) > 0) {
 346              $t_new_prefix = $_POST['t_prefix'];
 347          } else {
 348              $t_new_prefix = "";
 349          }
 350  
 351          if (isset($_POST['t_old_prefix']) && strlen(trim($_POST['t_old_prefix'])) > 0) {
 352              $t_old_prefix = $_POST['t_old_prefix'];
 353          } else {
 354              $t_old_prefix = "";
 355          }
 356  
 357          if (isset($_POST['t_frequency']) && is_numeric($_POST['t_frequency'])) {
 358  
 359              $t_new_frequency = $_POST['t_frequency'];
 360  
 361          } else {
 362  
 363              $valid = false;
 364              $error_msg_array[] = gettext("Must specify RSS Feed Update Frequency");
 365          }
 366  
 367          if (isset($_POST['t_old_frequency']) && is_numeric($_POST['t_old_frequency'])) {
 368              $t_old_frequency = $_POST['t_old_frequency'];
 369          } else {
 370              $t_old_frequency = "";
 371          }
 372  
 373          if (isset($_POST['t_max_item_count']) && in_array($_POST['t_max_item_count'], range(1, 10))) {
 374  
 375              $t_max_item_count = $_POST['t_max_item_count'];
 376  
 377          } else {
 378  
 379              $valid = false;
 380              $error_msg_array[] = gettext("Max Item Count must be between 1 and 10");
 381          }
 382  
 383          if (isset($_POST['t_old_max_item_count']) && is_numeric($_POST['t_old_max_item_count'])) {
 384              $t_old_max_item_count = $_POST['t_old_max_item_count'];
 385          } else {
 386              $t_old_max_item_count = 0;
 387          }
 388  
 389          if ($valid && (($t_new_name != $t_old_name) || ($t_new_user != $t_old_user) || ($t_new_fid != $t_old_fid) || ($t_new_url != $t_old_url) || ($t_new_prefix != $t_old_prefix) || ($t_new_frequency != $t_old_frequency) || ($t_max_item_count != $t_old_max_item_count))) {
 390  
 391              if (($t_user_array = user_get_by_logon($t_new_user)) !== false) {
 392  
 393                  $t_new_uid = $t_user_array['UID'];
 394  
 395                  if (rss_feed_update($feed_id, $t_new_name, $t_new_uid, $t_new_fid, $t_new_url, $t_new_prefix, $t_new_frequency, $t_max_item_count)) {
 396  
 397                      $log_data = array(
 398                          $t_new_name,
 399                          $t_old_name,
 400                          $t_new_user,
 401                          $t_old_user,
 402                          $t_new_fid,
 403                          $t_old_fid,
 404                          $t_new_url,
 405                          $t_old_url,
 406                          $t_new_prefix,
 407                          $t_old_prefix,
 408                          $t_new_frequency,
 409                          $t_old_frequency
 410                      );
 411  
 412                      admin_add_log_entry(EDITED_RSS_FEED, $log_data);
 413                      header_redirect("admin_rss_feeds.php?webtag=$webtag&edited=true");
 414                      exit;
 415  
 416                  } else {
 417  
 418                      $error_msg_array[] = gettext("Failed to update RSS Feed");
 419                  }
 420  
 421              } else {
 422  
 423                  $error_msg_array[] = gettext("Unknown RSS User Account");
 424              }
 425          }
 426      }
 427  
 428  } else if (isset($_POST['addfeed'])) {
 429  
 430      $redirect = "admin_rss_feeds.php?webtag=$webtag&page=$page&addfeed=true";
 431      header_redirect($redirect);
 432      exit;
 433  }
 434  
 435  if (isset($_GET['addfeed']) || isset($_POST['addfeed'])) {
 436  
 437      html_draw_top(sprintf('title=%s', gettext("Admin - RSS Feeds - Add New Feed")), 'class=window_title', "js/search_popup.js", 'main_css=admin.css');
 438  
 439      echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("RSS Feeds"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Add New Feed"), "</h1>\n";
 440  
 441      if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 442  
 443          html_display_error_array($error_msg_array, '700', 'center');
 444  
 445      } else if (isset($rss_stream_success)) {
 446  
 447          html_display_success_msg($rss_stream_success, '700', 'center');
 448      }
 449  
 450      echo "<br />\n";
 451      echo "<div align=\"center\">\n";
 452      echo "  <form accept-charset=\"utf-8\" name=\"thread_options\" action=\"admin_rss_feeds.php\" method=\"post\" target=\"_self\">\n";
 453      echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 454      echo "  ", form_input_hidden('addfeed', 'true'), "\n";
 455      echo "  ", form_input_hidden('page', htmlentities_array($page)), "\n";
 456      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
 457      echo "    <tr>\n";
 458      echo "      <td align=\"left\">\n";
 459      echo "        <table class=\"box\" width=\"100%\">\n";
 460      echo "          <tr>\n";
 461      echo "            <td align=\"left\" class=\"posthead\">\n";
 462      echo "              <table class=\"posthead\" width=\"100%\">\n";
 463      echo "                <tr>\n";
 464      echo "                  <td align=\"left\" class=\"subhead\">", gettext("Feed Name and Location"), "</td>\n";
 465      echo "                </tr>\n";
 466      echo "                <tr>\n";
 467      echo "                  <td align=\"center\">\n";
 468      echo "                    <table class=\"posthead\" width=\"95%\">\n";
 469      echo "                      <tr>\n";
 470      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed Name"), ":</td>\n";
 471      echo "                        <td align=\"left\">", form_input_text("t_name_new", (isset($_POST['t_name_new']) ? htmlentities_array($_POST['t_name_new']) : ""), 40, 32), "</td>\n";
 472      echo "                      </tr>\n";
 473      echo "                      <tr>\n";
 474      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed Location"), ":</td>\n";
 475      echo "                        <td align=\"left\" style=\"white-space: nowrap\">", form_input_text("t_url_new", (isset($_POST['t_url_new']) ? htmlentities_array($_POST['t_url_new']) : ""), 30, 255), "&nbsp;", form_submit("checkfeedsubmit", 'Test'), "</td>\n";
 476      echo "                      </tr>\n";
 477      echo "                      <tr>\n";
 478      echo "                        <td align=\"left\">&nbsp;</td>\n";
 479      echo "                        <td align=\"left\">&nbsp;</td>\n";
 480      echo "                      </tr>\n";
 481      echo "                    </table>\n";
 482      echo "                  </td>\n";
 483      echo "                </tr>\n";
 484      echo "              </table>\n";
 485      echo "            </td>\n";
 486      echo "          </tr>\n";
 487      echo "        </table>\n";
 488      echo "        <br />\n";
 489      echo "        <table class=\"box\" width=\"100%\">\n";
 490      echo "          <tr>\n";
 491      echo "            <td align=\"left\" class=\"posthead\">\n";
 492      echo "              <table class=\"posthead\" width=\"100%\">\n";
 493      echo "                <tr>\n";
 494      echo "                  <td align=\"left\" class=\"subhead\">", gettext("Feed Settings"), "</td>\n";
 495      echo "                </tr>\n";
 496      echo "                <tr>\n";
 497      echo "                  <td align=\"center\">\n";
 498      echo "                    <table class=\"posthead\" width=\"95%\">\n";
 499      echo "                      <tr>\n";
 500      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed User Account"), ":</td>\n";
 501      echo "                        <td align=\"left\">", form_input_text_search("t_user_new", (isset($_POST['t_user_new']) ? htmlentities_array($_POST['t_user_new']) : ""), 30, 15), "</td>\n";
 502      echo "                      </tr>\n";
 503      echo "                      <tr>\n";
 504      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Thread Title Prefix"), ":</td>\n";
 505      echo "                        <td align=\"left\">", form_input_text("t_prefix_new", (isset($_POST['t_prefix_new']) ? htmlentities_array($_POST['t_prefix_new']) : ""), 20, 16), "</td>\n";
 506      echo "                      </tr>\n";
 507      echo "                      <tr>\n";
 508      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed Folder Name"), ":</td>\n";
 509      echo "                        <td align=\"left\">", folder_draw_dropdown_all((isset($_POST['t_fid_new']) ? htmlentities_array($_POST['t_fid_new']) : 0), "t_fid_new", "", "", "post_folder_dropdown"), "</td>\n";
 510      echo "                      </tr>\n";
 511      echo "                      <tr>\n";
 512      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Update Frequency"), ":</td>\n";
 513      echo "                        <td align=\"left\">", form_dropdown_array("t_frequency_new", $update_frequencies_array, (isset($_POST['t_frequency_new']) ? htmlentities_array($_POST['t_frequency_new']) : 1440)), "</td>\n";
 514      echo "                      </tr>\n";
 515      echo "                      <tr>\n";
 516      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Max Item Count"), ":</td>\n";
 517      echo "                        <td align=\"left\">", form_input_text("t_max_item_count_new", (isset($_POST['t_max_item_count_new']) ? htmlentities_array($_POST['t_max_item_count_new']) : 10), 6, 4), "&nbsp;<span class=\"smalltext\">", gettext("Min: 1, Max: 10"), "</span></td>\n";
 518      echo "                      </tr>\n";
 519      echo "                      <tr>\n";
 520      echo "                        <td align=\"left\">&nbsp;</td>\n";
 521      echo "                        <td align=\"left\">&nbsp;</td>\n";
 522      echo "                      </tr>\n";
 523      echo "                    </table>\n";
 524      echo "                  </td>\n";
 525      echo "                </tr>\n";
 526      echo "              </table>\n";
 527      echo "            </td>\n";
 528      echo "          </tr>\n";
 529      echo "        </table>\n";
 530      echo "      </td>\n";
 531      echo "    </tr>\n";
 532      echo "    <tr>\n";
 533      echo "      <td align=\"left\">&nbsp;</td>\n";
 534      echo "    </tr>\n";
 535      echo "    <tr>\n";
 536      echo "      <td align=\"center\">", form_submit("addfeedsubmit", gettext("Add")), "&nbsp;", form_submit("cancel", gettext("Cancel")), "</td>\n";
 537      echo "    </tr>\n";
 538      echo "  </table>\n";
 539      echo "  </form>\n";
 540      echo "</div>\n";
 541  
 542      html_draw_bottom();
 543  
 544  } else if (isset($_POST['feed_id']) || isset($_GET['feed_id'])) {
 545  
 546      if (isset($_POST['feed_id']) && is_numeric($_POST['feed_id'])) {
 547  
 548          $feed_id = $_POST['feed_id'];
 549  
 550      } else if (isset($_GET['feed_id']) && is_numeric($_GET['feed_id'])) {
 551  
 552          $feed_id = $_GET['feed_id'];
 553  
 554      } else {
 555  
 556          html_draw_error(gettext("Invalid feed id or feed not found"), 'admin_rss_feeds.php', 'get', array('back' => gettext("Back")));
 557      }
 558  
 559      if (!$rss_feed = rss_feed_get($feed_id)) {
 560          html_draw_error(gettext("Invalid feed id or feed not found"), 'admin_rss_feeds.php', 'get', array('back' => gettext("Back")));
 561      }
 562  
 563      html_draw_top(sprintf('title=%s', sprintf(gettext("Admin - RSS Feeds - Edit Feed - %s"), $rss_feed['NAME'])), "js/search_popup.js", 'class=window_title', 'main_css=admin.css');
 564  
 565      echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("RSS Feeds"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Edit Feed"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", word_filter_add_ob_tags($rss_feed['NAME'], true), "</h1>\n";
 566  
 567      if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 568  
 569          html_display_error_array($error_msg_array, '700', 'center');
 570  
 571      } else if (isset($rss_stream_success)) {
 572  
 573          html_display_success_msg($rss_stream_success, '700', 'center');
 574      }
 575  
 576      echo "<br />\n";
 577      echo "<div align=\"center\">\n";
 578      echo "  <form accept-charset=\"utf-8\" name=\"thread_options\" action=\"admin_rss_feeds.php\" method=\"post\" target=\"_self\">\n";
 579      echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 580      echo "  ", form_input_hidden('feed_id', htmlentities_array($feed_id)), "\n";
 581      echo "  ", form_input_hidden("t_delete[$feed_id]", "Y"), "\n";
 582      echo "  ", form_input_hidden('page', htmlentities_array($page)), "\n";
 583      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
 584      echo "    <tr>\n";
 585      echo "      <td align=\"left\">\n";
 586      echo "        <table class=\"box\" width=\"100%\">\n";
 587      echo "          <tr>\n";
 588      echo "            <td align=\"left\" class=\"posthead\">\n";
 589      echo "              <table class=\"posthead\" width=\"100%\">\n";
 590      echo "                <tr>\n";
 591      echo "                  <td align=\"left\" class=\"subhead\">", gettext("Feed Name and Location"), "</td>\n";
 592      echo "                </tr>\n";
 593      echo "                <tr>\n";
 594      echo "                  <td align=\"center\">\n";
 595      echo "                    <table class=\"posthead\" width=\"95%\">\n";
 596      echo "                      <tr>\n";
 597      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed Name"), ":</td>\n";
 598      echo "                        <td align=\"left\">", form_input_text("t_name", (isset($_POST['t_name']) ? htmlentities_array($_POST['t_name']) : (isset($rss_feed['NAME']) ? htmlentities_array($rss_feed['NAME']) : "")), 40, 32), form_input_hidden("t_name_old", (isset($rss_feed['NAME']) ? htmlentities_array($rss_feed['NAME']) : "")), "</td>\n";
 599      echo "                      </tr>\n";
 600      echo "                      <tr>\n";
 601      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed Location"), ":</td>\n";
 602      echo "                        <td align=\"left\">", form_input_text("t_url", (isset($_POST['t_url']) ? htmlentities_array($_POST['t_url']) : (isset($rss_feed['URL']) ? htmlentities_array($rss_feed['URL']) : "")), 30, 255), form_input_hidden("t_url_old", (isset($rss_feed['URL']) ? htmlentities_array($rss_feed['URL']) : "")), "&nbsp;", form_submit('checkfeedsubmit', "Test"), "</td>\n";
 603      echo "                      </tr>\n";
 604      echo "                      <tr>\n";
 605      echo "                        <td align=\"left\">&nbsp;</td>\n";
 606      echo "                        <td align=\"left\">&nbsp;</td>\n";
 607      echo "                      </tr>\n";
 608      echo "                    </table>\n";
 609      echo "                  </td>\n";
 610      echo "                </tr>\n";
 611      echo "              </table>\n";
 612      echo "            </td>\n";
 613      echo "          </tr>\n";
 614      echo "        </table>\n";
 615      echo "        <br />\n";
 616      echo "        <table class=\"box\" width=\"100%\">\n";
 617      echo "          <tr>\n";
 618      echo "            <td align=\"left\" class=\"posthead\">\n";
 619      echo "              <table class=\"posthead\" width=\"100%\">\n";
 620      echo "                <tr>\n";
 621      echo "                  <td align=\"left\" class=\"subhead\">", gettext("Feed Settings"), "</td>\n";
 622      echo "                </tr>\n";
 623      echo "                <tr>\n";
 624      echo "                  <td align=\"center\">\n";
 625      echo "                    <table class=\"posthead\" width=\"95%\">\n";
 626      echo "                      <tr>\n";
 627      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed User Account"), ":</td>\n";
 628      echo "                        <td align=\"left\">", form_input_text_search("t_user", (isset($_POST['t_user']) ? htmlentities_array($_POST['t_user']) : (isset($rss_feed['LOGON']) ? htmlentities_array($rss_feed['LOGON']) : "")), 26, 15), "</td>\n";
 629      echo "                      </tr>\n";
 630      echo "                      <tr>\n";
 631      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Thread Title Prefix"), ":</td>\n";
 632      echo "                        <td align=\"left\">", form_input_text("t_prefix", (isset($_POST['t_prefix']) ? htmlentities_array($_POST['t_prefix']) : (isset($rss_feed['PREFIX']) ? htmlentities_array($rss_feed['PREFIX']) : "")), 29, 16), form_input_hidden("t_prefix_old", (isset($rss_feed['PREFIX']) ? htmlentities_array($rss_feed['PREFIX']) : "")), "</td>\n";
 633      echo "                      </tr>\n";
 634      echo "                      <tr>\n";
 635      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Feed Folder Name"), ":</td>\n";
 636      echo "                        <td align=\"left\">", folder_draw_dropdown_all((isset($_POST['t_fid']) ? htmlentities_array($_POST['t_fid']) : (isset($rss_feed['FID']) ? $rss_feed['FID'] : 0)), "t_fid", "", "", "post_folder_dropdown"), form_input_hidden("t_fid_old", (isset($rss_feed['FID']) ? htmlentities_array($rss_feed['FID']) : "")), "</td>\n";
 637      echo "                      </tr>\n";
 638      echo "                      <tr>\n";
 639      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Update Frequency"), ":</td>\n";
 640      echo "                        <td align=\"left\">", form_dropdown_array("t_frequency", $update_frequencies_array, (isset($_POST['t_frequency']) ? htmlentities_array($_POST['t_frequency']) : (isset($rss_feed['FREQUENCY']) ? $rss_feed['FREQUENCY'] : 1440)), null, "post_folder_dropdown"), form_input_hidden("t_frequency_old", (isset($rss_feed['FREQUENCY']) ? htmlentities_array($rss_feed['FREQUENCY']) : "")), "</td>\n";
 641      echo "                      </tr>\n";
 642      echo "                      <tr>\n";
 643      echo "                        <td align=\"left\" width=\"200\" class=\"posthead\">", gettext("Max Item Count"), ":</td>\n";
 644      echo "                        <td align=\"left\">", form_input_text("t_max_item_count", (isset($_POST['t_max_item_count']) ? htmlentities_array($_POST['t_max_item_count']) : (isset($rss_feed['MAX_ITEM_COUNT']) ? $rss_feed['MAX_ITEM_COUNT'] : 10)), 6, 4), form_input_hidden("t_max_item_count_old", (isset($rss_feed['MAX_ITEM_COUNT']) ? htmlentities_array($rss_feed['MAX_ITEM_COUNT']) : 10)), "&nbsp;<span class=\"smalltext\">", gettext("Min: 1, Max: 10"), "</span></td>\n";
 645      echo "                      </tr>\n";
 646      echo "                      <tr>\n";
 647      echo "                        <td align=\"left\">&nbsp;</td>\n";
 648      echo "                        <td align=\"left\">&nbsp;</td>\n";
 649      echo "                      </tr>\n";
 650      echo "                    </table>\n";
 651      echo "                  </td>\n";
 652      echo "                </tr>\n";
 653      echo "              </table>\n";
 654      echo "            </td>\n";
 655      echo "          </tr>\n";
 656      echo "        </table>\n";
 657      echo "      </td>\n";
 658      echo "    </tr>\n";
 659      echo "    <tr>\n";
 660      echo "      <td align=\"left\">&nbsp;</td>\n";
 661      echo "    </tr>\n";
 662      echo "    <tr>\n";
 663      echo "      <td align=\"center\">", form_submit("updatefeedsubmit", gettext("Save")), "&nbsp;", form_submit("delete", gettext("Delete")), "&nbsp;", form_submit("cancel", gettext("Cancel")), "</td>\n";
 664      echo "    </tr>\n";
 665      echo "  </table>\n";
 666      echo "  </form>\n";
 667      echo "</div>\n";
 668  
 669      html_draw_bottom();
 670  
 671  } else {
 672  
 673      html_draw_top(sprintf('title=%s', gettext("Admin - RSS Feeds")), "js/search.js", 'class=window_title', 'main_css=admin.css');
 674  
 675      $rss_feeds = rss_feed_get_feeds($page);
 676  
 677      echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("RSS Feeds"), "</h1>\n";
 678  
 679      if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 680  
 681          html_display_error_array($error_msg_array, '86%', 'center');
 682  
 683      } else if (isset($_GET['added'])) {
 684  
 685          html_display_success_msg(gettext("Successfully added new feed"), '86%', 'center');
 686  
 687      } else if (isset($_GET['edited'])) {
 688  
 689          html_display_success_msg(gettext("Successfully edited feed"), '86%', 'center');
 690  
 691      } else if (isset($_GET['deleted'])) {
 692  
 693          html_display_success_msg(gettext("Successfully removed selected feeds"), '86%', 'center');
 694  
 695      } else if (sizeof($rss_feeds['rss_feed_array']) < 1) {
 696  
 697          html_display_warning_msg(gettext("No existing RSS Feeds found. To add a feed click the 'Add New' button below"), '86%', 'center');
 698      }
 699  
 700      echo "<br />\n";
 701      echo "<div align=\"center\">\n";
 702      echo "<form accept-charset=\"utf-8\" name=\"rss\" action=\"admin_rss_feeds.php\" method=\"post\">\n";
 703      echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 704      echo "  ", form_input_hidden('page', htmlentities_array($page)), "\n";
 705      echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"86%\">\n";
 706      echo "    <tr>\n";
 707      echo "      <td align=\"left\">\n";
 708      echo "        <table class=\"box\" width=\"100%\">\n";
 709      echo "          <tr>\n";
 710      echo "            <td align=\"left\" class=\"posthead\">\n";
 711      echo "              <table class=\"posthead\" width=\"100%\">\n";
 712      echo "                <tr>\n";
 713      echo "                  <td class=\"subhead\" align=\"center\" width=\"20\">&nbsp;</td>\n";
 714      echo "                  <td class=\"subhead\" align=\"left\">", gettext("Name"), "</td>\n";
 715      echo "                  <td class=\"subhead\" align=\"left\">", gettext("Feed Location"), "</td>\n";
 716      echo "                  <td class=\"subhead\" align=\"left\" width=\"20%\">", gettext("Update Frequency"), "&nbsp;</td>\n";
 717      echo "                </tr>\n";
 718  
 719      if (sizeof($rss_feeds['rss_feed_array']) > 0) {
 720  
 721          foreach ($rss_feeds['rss_feed_array'] as $rss_feed) {
 722  
 723              echo "                <tr>\n";
 724              echo "                  <td valign=\"top\" align=\"center\" width=\"1%\">", form_checkbox("t_delete[{$rss_feed['RSSID']}]", "Y"), "</td>\n";
 725              echo "                  <td valign=\"top\" align=\"left\" width=\"35%\"><a href=\"admin_rss_feeds.php?webtag=$webtag&amp;page=$page&amp;feed_id={$rss_feed['RSSID']}\">", word_filter_add_ob_tags($rss_feed['NAME'], true), "</a></td>\n";
 726              echo "                  <td valign=\"top\" align=\"left\" width=\"45%\">{$rss_feed['URL']}</td>\n";
 727              echo "                  <td valign=\"top\" align=\"left\" width=\"20%\">", (in_array($rss_feed['FREQUENCY'], array_keys($update_frequencies_array))) ? $update_frequencies_array[$rss_feed['FREQUENCY']] : gettext("Unknown"), "</td>\n";
 728              echo "                </tr>\n";
 729          }
 730      }
 731  
 732      echo "                <tr>\n";
 733      echo "                  <td align=\"left\">&nbsp;</td>\n";
 734      echo "                </tr>\n";
 735      echo "              </table>\n";
 736      echo "            </td>\n";
 737      echo "          </tr>\n";
 738      echo "        </table>\n";
 739      echo "      </td>\n";
 740      echo "    </tr>\n";
 741      echo "    <tr>\n";
 742      echo "      <td align=\"left\">&nbsp;</td>\n";
 743      echo "    </tr>\n";
 744      echo "    <tr>\n";
 745      echo "      <td class=\"postbody\" align=\"center\">";
 746  
 747      html_page_links("admin_rss_feeds.php?webtag=$webtag", $page, $rss_feeds['rss_feed_count'], 10);
 748  
 749      echo "      </td>\n";
 750      echo "    </tr>\n";
 751      echo "    <tr>\n";
 752      echo "      <td align=\"left\">&nbsp;</td>\n";
 753      echo "    </tr>\n";
 754      echo "    <tr>\n";
 755      echo "      <td align=\"center\">", form_submit("addfeed", gettext("Add New")), "&nbsp;", form_submit("delete", gettext("Delete Selected")), "</td>\n";
 756      echo "    </tr>\n";
 757      echo "    <tr>\n";
 758      echo "      <td align=\"left\">&nbsp;</td>\n";
 759      echo "    </tr>\n";
 760      echo "  </table>\n";
 761      echo "</form>\n";
 762      echo "</div>\n";
 763  
 764      html_display_warning_msg(gettext("Here you can setup some RSS feeds for automatic propagation into your forum. The items from the RSS feeds you add will be created as threads which users can reply to as if they were normal posts. The RSS feed must be accessible via HTTP or it will not work."), '86%', 'center');
 765  
 766      html_draw_bottom();
 767  }

title

Description

title

Description

title

Description

title

title

Body