function forum_links_get_links() { if (!($db = db::get())) { return false; } if (!($table_prefix = get_table_prefix())) { return false; } $forum_links_top_link = forum_get_setting('forum_links_top_link', null, gettext("Forum Links")); $sql = "SELECT LID, TITLE, URI FROM `{$table_prefix}FORUM_LINKS` "; $sql .= "ORDER BY POS ASC"; if (!($result = $db->query($sql))) { return false; } if ($result->num_rows == 0) { return false; } $links_array = array($forum_links_top_link); while ($forum_links_data = $result->fetch_assoc()) { if (!isset($forum_links_data['TITLE']) || strlen(trim($forum_links_data['TITLE'])) < 1) { $forum_links_data['TITLE'] = '-'; } if (!isset($forum_links_data['URI']) || strlen(trim($forum_links_data['URI'])) < 1) { $links_array[$forum_links_data['LID']] = $forum_links_data['TITLE']; } else { $forum_links_data['URI'] = href_cleanup_query_keys($forum_links_data['URI']); $links_array[$forum_links_data['URI']] = $forum_links_data['TITLE']; } } return $links_array; }
require_once BH_INCLUDE_PATH . 'html.inc.php'; require_once BH_INCLUDE_PATH . 'ip.inc.php'; require_once BH_INCLUDE_PATH . 'lang.inc.php'; require_once BH_INCLUDE_PATH . 'perm.inc.php'; require_once BH_INCLUDE_PATH . 'server.inc.php'; require_once BH_INCLUDE_PATH . 'session.inc.php'; require_once BH_INCLUDE_PATH . 'styles.inc.php'; require_once BH_INCLUDE_PATH . 'text_captcha.inc.php'; require_once BH_INCLUDE_PATH . 'timezone.inc.php'; require_once BH_INCLUDE_PATH . 'user.inc.php'; // End Required includes // Where are we going after we've logged on? if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) { $available_files_preg = implode("|^", array_map('preg_quote_callback', get_light_mode_files())); if (preg_match("/^{$available_files_preg}/u", trim($_GET['final_uri'])) > 0) { $final_uri = href_cleanup_query_keys($_GET['final_uri']); } } // check to see if user registration is available if (forum_get_setting('allow_new_registrations', 'N')) { light_html_draw_error(gettext("Sorry, new user registrations are not allowed right now. Please check back later.")); } // Get an array of available emoticon sets $available_emoticons = emoticons_get_available(); // Get an array of available languages $available_langs = lang_get_available(); // Get an array of available timezones. $available_timezones = get_available_timezones(); // Initialise the text captcha $text_captcha = new captcha(6, 15, 25, 9, 30); // Array to hold error messages
function logon_draw_form($logon_options) { $webtag = get_webtag(); forum_check_webtag_available($webtag); // Make sure logon form argument is valid. if (!is_numeric($logon_options)) { $logon_options = LOGON_FORM_DEFAULT; } // Check for previously failed logon. if (isset($_GET['logout_success']) && $_GET['logout_success'] == 'true') { html_display_success_msg(gettext("You have successfully logged out."), '500', 'center'); } else { if (isset($_GET['logon_failed']) && !($logon_options & LOGON_FORM_SESSION_EXPIRED)) { html_display_error_msg(gettext("The username or password you supplied is not valid."), '500', 'center'); } } // Get the original requested page url. $request_uri = get_request_uri(); // If the request is for logon.php then we are performing // a normal login, otherwise potentially a failed session. if (stristr($request_uri, 'logon.php')) { echo " <form accept-charset=\"utf-8\" name=\"logonform\" method=\"post\" action=\"{$request_uri}\" target=\"", html_get_top_frame_name(), "\">\n"; echo " ", form_csrf_token_field(), "\n"; } else { echo " <form accept-charset=\"utf-8\" name=\"logonform\" method=\"post\" action=\"{$request_uri}\" target=\"_self\">\n"; echo " ", form_csrf_token_field(), "\n"; } // Check for any post data that we need to include in the form. unset($_POST['user_logon'], $_POST['user_password'], $_POST['logon'], $_POST['webtag'], $_POST['register']); // Add any post data into the form. if (isset($_POST) && is_array($_POST) && sizeof($_POST) > 0) { echo form_input_hidden_array($_POST); } echo " ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n"; echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"325\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\">", gettext("Logon"), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"95%\">\n"; echo " <tr>\n"; echo " <td align=\"right\" width=\"90\">", gettext("Username"), ":</td>\n"; echo " <td align=\"left\">", form_input_text('user_logon', null, 24, 32, null, 'bhinputlogon'), "</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"right\" width=\"90\">", gettext("Password"), ":</td>\n"; echo " <td align=\"left\">", form_input_password('user_password', null, 24, 32, null, 'bhinputlogon'), "</td>\n"; echo " </tr>\n"; if (!($logon_options & LOGON_FORM_HIDE_TICKBOX) && !($logon_options & LOGON_FORM_SESSION_EXPIRED)) { echo " <tr>\n"; echo " <td align=\"left\" colspan=\"2\"><hr class=\"bhseparatorlogon\" /></td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " <table class=\"posthead\" width=\"95%\">\n"; echo " <tr>\n"; echo " <td align=\"right\" width=\"90\">", form_checkbox('user_remember', 'Y', null, html_get_cookie('user_logon') && html_get_cookie('user_token')), "</td>\n"; echo " <td align=\"left\"><label for=\"user_remember\">", gettext("Remember me"), "</label></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " <td align=\"left\"><span class=\"bhinputlogon_warning\">", gettext("Not recommended for shared computers"), "</span></td>\n"; echo " </tr>\n"; } echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\" colspan=\"2\">", form_submit('logon', gettext("Logon")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; echo "<br />\n"; if (!($logon_options & LOGON_FORM_HIDE_LINKS)) { echo "<hr class=\"bhlogonseparator\" />\n"; if (user_guest_enabled()) { echo "<form accept-charset=\"utf-8\" name=\"guest\" action=\"logon.php?webtag={$webtag}\" method=\"post\" target=\"", html_get_top_frame_name(), "\">\n"; echo " ", form_csrf_token_field(), "\n"; echo " <p>", sprintf(gettext("Enter as a %s"), form_submit('guest_logon', gettext("Guest"))), "</p>\n"; echo "</form>\n"; } if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) { $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files())); if (preg_match("/^{$available_files_preg}/u", trim($_GET['final_uri'])) > 0) { $final_uri = href_cleanup_query_keys($_GET['final_uri']); } } if (isset($final_uri)) { $final_uri = rawurlencode($final_uri); $register_link = rawurlencode("register.php?webtag={$webtag}&final_uri={$final_uri}"); $forgot_pw_link = rawurlencode("forgot_pw.php?webtag={$webtag}&final_uri={$final_uri}"); echo "<p>", sprintf(gettext("Don't have an account? %s"), "<a href=\"index.php?webtag={$webtag}&final_uri={$register_link}\" target=\"" . html_get_top_frame_name() . "\">" . gettext("Register now") . "</a>") . "</p>\n"; echo "<hr class=\"bhlogonseparator\" />\n"; echo "<h2>", gettext("Problems logging on?"), "</h2>\n"; echo "<p><a href=\"logon.php?webtag={$webtag}&delete_cookie=yes&final_uri={$final_uri}\" target=\"", html_get_top_frame_name(), "\">", gettext("Delete Cookies"), "</a></p>\n"; echo "<p><a href=\"index.php?webtag={$webtag}&final_uri={$forgot_pw_link}\" target=\"", html_get_top_frame_name(), "\">", gettext("Forgotten your password?"), "</a></p>\n"; } else { echo "<p>", sprintf(gettext("Don't have an account? %s"), "<a href=\"index.php?webtag={$webtag}&final_uri=register.php%3Fwebtag%3D{$webtag}\" target=\"" . html_get_top_frame_name() . "\">" . gettext("Register now") . "</a>"), "</p>\n"; echo "<hr class=\"bhlogonseparator\" />\n"; echo "<h2>", gettext("Problems logging on?"), "</h2>\n"; echo "<p><a href=\"logon.php?webtag={$webtag}&delete_cookie=yes\" target=\"", html_get_top_frame_name(), "\">", gettext("Delete Cookies"), "</a></p>\n"; echo "<p><a href=\"index.php?webtag={$webtag}&final_uri=forgot_pw.php%3Fwebtag%3D{$webtag}\" target=\"", html_get_top_frame_name(), "\">", gettext("Forgotten your password?"), "</a></p>\n"; } echo "<hr class=\"bhlogonseparator\" />\n"; echo "<h2>", gettext("Using a mobile device?"), "</h2>\n"; echo "<p><a href=\"index.php?webtag={$webtag}&view=mobile\" target=\"", html_get_top_frame_name(), "\">", gettext("Mobile version"), "</a></p>\n"; } }
html_draw_error(gettext("You do not have permission to use this section.")); } // Perform additional admin login. admin_check_credentials(); // Get the user's saved left frame width. if (($left_frame_width = session::get_value('LEFT_FRAME_WIDTH')) === false) { $left_frame_width = 280; } // Output starts here html_draw_top('frame_set_html', 'pm_popup_disabled'); $frameset = new html_frameset_cols('admin', "{$left_frame_width},*"); if (isset($_GET['page']) && strlen(trim($_GET['page'])) > 0) { $requested_page = trim($_GET['page']); $available_pages_preg = implode("|^", array_map('preg_quote_callback', get_available_admin_files())); if (preg_match("/^{$available_pages_preg}/u", basename($requested_page)) > 0) { $requested_page = href_cleanup_query_keys($requested_page); $frameset->html_frame("admin_menu.php?webtag={$webtag}", html_get_frame_name('left')); $frameset->html_frame($requested_page, html_get_frame_name('right')); $frameset->output_html(); html_draw_bottom(true); exit; } } $frameset->html_frame("admin_menu.php?webtag={$webtag}", html_get_frame_name('left')); if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0)) { $frameset->html_frame("admin_users.php?webtag={$webtag}", html_get_frame_name('right')); } else { $frameset->html_frame("admin_forums.php?webtag={$webtag}", html_get_frame_name('right')); } $frameset->output_html(); html_draw_bottom(true);
function html_page_links($uri, $page, $record_count, $rows_per_page, $page_var = "page") { $uri = href_cleanup_query_keys($uri, $page_var); $page_count = ceil($record_count / $rows_per_page); $sep = strstr($uri, '?') ? "&" : "?"; if ($page_count > 1) { echo "<span class=\"pagenum_text\">", gettext("Pages"), " ({$page_count}): "; } else { echo "<span class=\"pagenum_text\">", gettext("Pages"), ": "; } if ($page_count > 1) { if ($page == 1) { $end_page = $page + 2 <= $page_count ? $page + 2 : $page_count; $start_page = $page; } else { if ($page == $page_count) { $start_page = $page - 2 > 0 ? $page - 2 : 1; $end_page = $page_count; } else { $start_page = $page - 2 > 0 ? $page - 2 : 1; $end_page = $page + 2 <= $page_count ? $page + 2 : $page_count; if ($end_page - $start_page < 2) { if ($start_page - 2 < 1) { $end_page = $start_page + 2 <= $page_count ? $start_page + 2 : $page_count; } else { if ($end_page + 1 > $page_count) { $start_page = $end_page - 4 > 0 ? $end_page - 4 : 1; } } } } } if ($start_page > 1) { if ($start_page - 1 > 1) { echo "<a href=\"{$uri}{$sep}{$page_var}=1\" target=\"_self\">1</a> … "; } else { echo "<a href=\"{$uri}{$sep}{$page_var}=1\" target=\"_self\">1</a> "; } } for ($next_page = $start_page; $next_page <= $end_page; $next_page++) { if ($next_page == $page) { echo "<a href=\"{$uri}{$sep}{$page_var}={$next_page}\" target=\"_self\"><span class=\"pagenum_current\">{$next_page}</span></a> "; } else { echo "<a href=\"{$uri}{$sep}{$page_var}={$next_page}\" target=\"_self\">{$next_page}</a> "; } } if ($end_page < $page_count) { if ($end_page + 1 < $page_count) { echo "… <a href=\"{$uri}{$sep}{$page_var}={$page_count}\" target=\"_self\">{$page_count}</a>"; } else { echo "<a href=\"{$uri}{$sep}{$page_var}={$page_count}\" target=\"_self\">{$page_count}</a>"; } } } else { echo "<a href=\"{$uri}{$sep}{$page_var}=1\" target=\"_self\"><b>[1]</b></a> "; } echo "</span>"; }
along with Beehive; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ======================================================================*/ // Bootstrap require_once 'boot.php'; // Includes required by this page. require_once BH_INCLUDE_PATH . 'constants.inc.php'; require_once BH_INCLUDE_PATH . 'form.inc.php'; require_once BH_INCLUDE_PATH . 'format.inc.php'; require_once BH_INCLUDE_PATH . 'header.inc.php'; require_once BH_INCLUDE_PATH . 'html.inc.php'; require_once BH_INCLUDE_PATH . 'session.inc.php'; require_once BH_INCLUDE_PATH . 'user.inc.php'; require_once BH_INCLUDE_PATH . 'word_filter.inc.php'; // Default final URI if one isn't specified. $final_uri = '&final_uri=logon.php%3Fwebtag%3D$webtag%26logout_success%3Dtrue'; if (isset($_REQUEST['final_uri']) && strlen(trim($_REQUEST['final_uri'])) > 0) { $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files())); if (preg_match("/^{$available_files_preg}/u", trim($_REQUEST['final_uri'])) > 0) { $final_uri = sprintf('&final_uri=%s', rawurlencode(href_cleanup_query_keys($_REQUEST['final_uri']))); } } session::end(); if (isset($_REQUEST['register'])) { $final_uri = rawurlencode("register.php?webtag={$webtag}{$final_uri}"); header_redirect("index.php?webtag={$webtag}&final_uri={$final_uri}"); exit; } html_set_cookie("user_logon", "", time() - YEAR_IN_SECONDS); header_redirect("index.php?webtag={$webtag}{$final_uri}");
// Perform additional admin login. admin_check_credentials(); // Array to hold error messages $error_msg_array = array(); // Page number if (isset($_GET['page']) && is_numeric($_GET['page'])) { $page = $_GET['page'] > 0 ? $_GET['page'] : 1; } else { $page = 1; } // Are we returning somewhere? if (isset($_GET['ret']) && strlen(trim($_GET['ret'])) > 0) { $ret = href_cleanup_query_keys($_GET['ret']); } else { if (isset($_POST['ret']) && strlen(trim($_POST['ret'])) > 0) { $ret = href_cleanup_query_keys($_POST['ret']); } else { $ret = "admin_link_approve.php?webtag={$webtag}"; } } // validate the return to page if (isset($ret) && strlen(trim($ret)) > 0) { $available_files = array('admin_link_approve.php', 'links_detail.php', 'links.php'); $available_files_preg = implode("|^", array_map('preg_quote_callback', $available_files)); if (!preg_match("/^{$available_files_preg}/u", $ret)) { $ret = "admin_link_approve.php?webtag={$webtag}"; } } if (isset($_POST['cancel'])) { header_redirect($ret); }
if (!browser_mobile() && !session::is_search_engine()) { if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) { $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files())); $available_admin_files_preg = implode("|^", array_map('preg_quote_callback', get_available_admin_files())); $my_controls_preg = implode("|^", array_map('preg_quote_callback', get_available_user_files())); if (preg_match("/^{$available_files_preg}/u", trim($_GET['final_uri'])) > 0) { $final_uri = href_cleanup_query_keys($_GET['final_uri']); if (preg_match("/^logon.php/u", $final_uri) > 0) { $hide_navigation = true; } else { if (preg_match("/^{$available_admin_files_preg}/u", $final_uri) > 0) { $final_uri = rawurlencode($final_uri); $final_uri = "admin.php?webtag={$webtag}&page={$final_uri}"; } else { if (preg_match("/^{$my_controls_preg}/u", $final_uri) > 0) { $final_uri = rawurlencode(href_cleanup_query_keys($final_uri)); $final_uri = "user.php?webtag={$webtag}&page={$final_uri}"; } } } } } html_draw_top(array('frame_set_html' => true, 'pm_popup_disabled' => true, 'robots' => 'index,follow')); if (isset($_SESSION['FONT_SIZE']) && is_numeric($_SESSION['FONT_SIZE'])) { $navsize = max(max(min($_SESSION['FONT_SIZE'], 15), 5) * 2, 22); } else { $navsize = 22; } if (!isset($final_uri)) { if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { $final_uri = "discussion.php?webtag={$webtag}&msg={$_GET['msg']}";
if (session::logged_in()) { $view_type = $_GET['view_type']; if (!in_array($view_type, $available_forum_views)) { $view_type = FORUMS_SHOW_FAVS; } } } } } } // Are we being redirected somewhere? $final_uri = ""; if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) { $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files())); if (preg_match("/^{$available_files_preg}/u", trim($_GET['final_uri'])) > 0) { $final_uri = href_cleanup_query_keys($_GET['final_uri'], 'webtag'); } } // Handle adding and removing of favourites if (isset($_POST['add_fav']) && is_array($_POST['add_fav'])) { if (!session::logged_in()) { html_guest_error(); exit; } list($forum_fid_add_fav) = array_keys($_POST['add_fav']); if (user_set_forum_interest($forum_fid_add_fav, FORUM_FAVOURITE)) { $webtag_search = rawurlencode($webtag_search); header_redirect("forums.php?webtag={$webtag}&final_uri={$final_uri}&view_type={$view_type}&page={$page}&added=true"); exit; } else { $error_msg_array[] = gettext("Failed to update forum interest level");