echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_password.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Change Password"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\"><hr /></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_email.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", htmlentities_array(gettext("Email & Privacy")), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"forum_options.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Forum Options"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"pm_options.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Private Message Options"), "</a></td>\n"; echo " </tr>\n"; if (forum_check_webtag_available($webtag, false)) { echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_attachments.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Attachments"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_signature.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Signature"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_relations.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Relationships"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_wordfilter.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Word Filter"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('bullet'), " <a href=\"edit_subscriptions.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Thread Subscriptions"), "</a></td>\n"; echo " </tr>\n";
/** * @return string */ function stats_get_html() { // Get webtag $webtag = get_webtag(); // Validate the webtag forum_check_webtag_available($webtag); // Number of active users $session_count = stats_get_active_session_count(); // Number of recent posts. $recent_post_count = stats_get_recent_post_count(); // Update the stats records. stats_update($session_count, $recent_post_count); // User Profile link $user_profile_link = '%s <a href="user_profile.php?webtag=%s&uid=%s" target="_blank" class="popup 650x500"><span class="%s" title="%s">%s</span></a>'; // Newest user Profile link $new_user_profile_link = '<a href="user_profile.php?webtag=%s&uid=%s" target="_blank" class="popup 650x500">%s</a>'; // Search Engine Bot link $search_engine_bot_link = '<a href="%s" target="_blank"><span class="user_stats_normal">%s</span></a>'; $html = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n"; $html .= " <tr>\n"; $html .= " <td rowspan=\"19\" width=\"35\"> </td>\n"; $html .= " <td> </td>\n"; $html .= " <td rowspan=\"19\" width=\"35\"> </td>\n"; $html .= " </tr>\n"; // Output the HTML. if (($user_stats = stats_get_active_user_list()) !== false) { $user_list_array = array(); $html .= " <tr>\n"; $html .= " <td>"; if (forum_get_setting('guest_show_recent', 'Y') && user_guest_enabled()) { if ($user_stats['GUESTS'] != 1) { $user_list_array[] = sprintf(gettext("<b>%s</b> guests"), format_number($user_stats['GUESTS'])); } else { $user_list_array[] = gettext("<b>1</b> guest"); } } if ($user_stats['USER_COUNT'] != 1) { $user_list_array[] = sprintf(gettext("<b>%s</b> members"), format_number($user_stats['USER_COUNT'])); } else { $user_list_array[] = gettext("<b>1</b> member"); } if ($user_stats['ANON_USERS'] != 1) { $user_list_array[] = sprintf(gettext("<b>%s</b> anonymous members"), format_number($user_stats['ANON_USERS'])); } else { $user_list_array[] = gettext("<b>1</b> anonymous member"); } $user_list = implode(", ", $user_list_array); $user_time = format_time_display(ini_get('session.gc_maxlifetime'), false); $html .= sprintf(gettext("%s active in the past %s."), $user_list, $user_time); $html .= " <a href=\"start.php?webtag={$webtag}&show=visitors\" target=\"" . html_get_frame_name('main') . "\">" . gettext("View More Visitors") . "</a>\n"; $html .= " </td>\n"; $html .= " </tr>\n"; if (sizeof($user_stats['USERS']) > 0) { $users_array = array(); foreach ($user_stats['USERS'] as $user) { $user_avatar = ''; if (isset($user['BOT_NAME']) && isset($user['BOT_URL'])) { $user_display = word_filter_add_ob_tags($user['BOT_NAME'], true); $user_display = sprintf($search_engine_bot_link, $user['BOT_URL'], $user_display); $users_array[] = $user_display; } else { $user_logon = format_user_name($user['LOGON'], $user['NICKNAME']); $user_display = str_replace(" ", " ", word_filter_add_ob_tags($user_logon, true)); if ($user['UID'] == $_SESSION['UID']) { if (isset($user['ANON_LOGON']) && $user['ANON_LOGON'] > USER_ANON_DISABLED) { $user_title = gettext("You (Invisible)"); $user_class = 'user_stats_curuser'; } else { $user_title = gettext("You"); $user_class = 'user_stats_curuser'; } } else { if (($user['RELATIONSHIP'] & USER_FRIEND) > 0) { $user_title = gettext("Friend"); $user_class = 'user_stats_friend'; } else { $user_class = 'user_stats_normal'; $user_title = ''; } } if (isset($user['AVATAR_URL']) && filter_var($user['AVATAR_URL'], FILTER_VALIDATE_URL)) { $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s')", $user['AVATAR_URL']))); } else { if (isset($user['AVATAR_AID']) && is_numeric($user['AVATAR_AID'])) { $attachment = attachments_get_by_aid($user['AVATAR_AID']); if (($user_avatar_picture = attachments_make_link($attachment, false, false, false, false)) !== false) { $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s&profile_picture')", $user_avatar_picture))); } } } $users_array[] = sprintf($user_profile_link, $user_avatar, $webtag, $user['UID'], $user_class, $user_title, $user_display); } } $html .= " <tr>"; $html .= " <td class=\"activeusers\">\n"; $html .= " " . implode(", ", $users_array) . "\n"; $html .= " </td>\n"; $html .= " </tr>\n"; } $html .= " <tr>\n"; $html .= " <td> </td>\n"; $html .= " </tr>\n"; } if (($users_birthdays_array = user_get_todays_birthdays()) !== false) { $html .= " <tr>\n"; $html .= " <td>"; if (count($users_birthdays_array) == 1) { $html .= gettext("<b>1</b> member is celebrating their birthday today:"); } else { $html .= sprintf(gettext("<b>%d</b> members are celebrating their birthdays today:"), format_number(count($users_birthdays_array))); } $html .= "</td>\n"; $html .= " </tr>\n"; $users_array = array(); foreach ($users_birthdays_array as $user) { $user_avatar = ''; $user_logon = format_user_name($user['LOGON'], $user['NICKNAME']); $user_display = str_replace(" ", " ", word_filter_add_ob_tags($user_logon, true)); if ($user['UID'] == $_SESSION['UID']) { $user_title = gettext("You"); $user_class = 'user_stats_curuser'; } else { if (($user['RELATIONSHIP'] & USER_FRIEND) > 0) { $user_title = gettext("Friend"); $user_class = 'user_stats_friend'; } else { $user_class = 'user_stats_normal'; $user_title = ''; } } if (isset($user['AVATAR_URL']) && filter_var($user['AVATAR_URL'], FILTER_VALIDATE_URL)) { $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s')", $user['AVATAR_URL']))); } else { if (isset($user['AVATAR_AID']) && is_numeric($user['AVATAR_AID'])) { $attachment = attachments_get_by_aid($user['AVATAR_AID']); if (($user_avatar_picture = attachments_make_link($attachment, false, false, false, false)) !== false) { $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s&profile_picture')", $user_avatar_picture))); } } } $users_array[] = sprintf($user_profile_link, $user_avatar, $webtag, $user['UID'], $user_class, $user_title, $user_display); } $html .= " <tr>\n"; $html .= " <td class=\"birthdayusers\">\n"; $html .= " " . implode(", ", $users_array) . "\n"; $html .= " </td>\n"; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td> </td>\n"; $html .= " </tr>\n"; } $thread_count = stats_get_thread_count(); $post_count = stats_get_post_count(); $html .= " <tr>\n"; $html .= " <td>"; if ($thread_count != 1) { $num_threads_display = sprintf(gettext("<b>%s</b> threads"), format_number($thread_count)); } else { $num_threads_display = gettext("<b>1</b> thread"); } if ($post_count != 1) { $num_posts_display = sprintf(gettext("<b>%s</b> posts"), format_number($post_count)); } else { $num_posts_display = gettext("<b>1</b> post"); } $html .= sprintf(gettext("Our members have made a total of %s and %s."), $num_threads_display, $num_posts_display) . '<br />'; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td> </td>\n"; $html .= " </tr>\n"; if (($longest_thread = stats_get_longest_thread()) !== false) { $html .= " <tr>\n"; $html .= " <td>"; $longest_thread_title = word_filter_add_ob_tags($longest_thread['TITLE'], true); $longest_thread_link = sprintf("<a href=\"index.php?webtag={$webtag}&msg=%d.1\">%s</a>", $longest_thread['TID'], $longest_thread_title); $longest_thread_post_count = $longest_thread['LENGTH'] != 1 ? sprintf(gettext("<b>%s</b> posts"), format_number($longest_thread['LENGTH'])) : gettext("<b>1</b> post"); $html .= sprintf(gettext("Longest thread is <b>%s</b> with %s."), $longest_thread_link, $longest_thread_post_count); $html .= " </td>\n"; $html .= " </tr>\n"; } if (($most_read_thread = stats_get_most_read_thread()) !== false) { $html .= " <tr>\n"; $html .= " <td>"; $most_read_thread_title = word_filter_add_ob_tags($most_read_thread['TITLE'], true); $most_read_thread_link = sprintf("<a href=\"index.php?webtag={$webtag}&msg=%d.1\">%s</a>", $most_read_thread['TID'], $most_read_thread_title); $most_read_thread_view_count = $most_read_thread['VIEWCOUNT'] != 1 ? sprintf(gettext("<b>%s</b> views"), format_number($most_read_thread['VIEWCOUNT'])) : gettext("<b>1</b> view"); $html .= sprintf(gettext("Most read thread is <b>%s</b> with %s."), $most_read_thread_link, $most_read_thread_view_count); $html .= " </td>\n"; $html .= " </tr>\n"; } $html .= " <tr>\n"; $html .= " <td> </td>\n"; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td>"; if ($recent_post_count != 1) { $html .= sprintf(gettext("There have been <b>%s</b> posts made in the last 60 minutes."), format_number($recent_post_count)); } else { $html .= gettext("There has been <b>1</b> post made in the last 60 minutes."); } $html .= " </td>\n"; $html .= " </tr>\n"; if (($most_posts = stats_get_most_posts()) !== false) { if ($most_posts['MOST_POSTS_COUNT'] > 0 && $most_posts['MOST_POSTS_DATE'] > 0) { $html .= " <tr>\n"; $html .= " <td>"; $html .= sprintf(gettext("Most posts ever made in a single 60 minute period is <b>%s</b> on %s."), format_number($most_posts['MOST_POSTS_COUNT']), format_date_time($most_posts['MOST_POSTS_DATE'])); $html .= " </td>\n"; $html .= " </tr>\n"; } } if (($user_count = user_count()) !== false) { $html .= " <tr>\n"; $html .= " <td> </td>\n"; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td>"; if ($user_count != 1) { if (($newest_member = stats_get_newest_user()) !== false) { $user_newest_display = word_filter_add_ob_tags(format_user_name($newest_member['LOGON'], $newest_member['NICKNAME']), true); $user_newest_profile_link = sprintf($new_user_profile_link, $webtag, $newest_member['UID'], $user_newest_display); $html .= sprintf(gettext("We have <b>%s</b> registered members and the newest member is <b>%s</b>."), format_number($user_count), $user_newest_profile_link); } else { $html .= sprintf(gettext("We have %s registered members."), $user_count); } } else { $html .= gettext("We have one registered member."); } $html .= " </td>\n"; $html .= " </tr>\n"; } if (($most_users = stats_get_most_users()) !== false) { if ($most_users['MOST_USERS_COUNT'] > 0 && $most_users['MOST_USERS_DATE'] > 0) { $html .= " <tr>\n"; $html .= " <td>"; $most_users_date = format_date_time($most_users['MOST_USERS_DATE']); $html .= sprintf(gettext("Most users ever online was <b>%s</b> on %s."), format_number($most_users['MOST_USERS_COUNT']), $most_users_date); $html .= " </td>\n"; $html .= " </tr>\n"; } } $html .= " <tr>\n"; $html .= " <td> </td>\n"; $html .= " </tr>\n"; $html .= "</table>\n"; // Return the output buffer contents. return $html; }
function attachments_make_link($attachment, $show_thumbs = true, $limit_filename = false, $local_path = false, $img_tag = true) { if (!is_array($attachment)) { return false; } if (!is_bool($show_thumbs)) { $show_thumbs = true; } if (!is_bool($limit_filename)) { $limit_filename = false; } if (!is_bool($local_path)) { $local_path = false; } if (!is_bool($img_tag)) { $img_tag = true; } if (!($attachment_dir = attachments_check_dir())) { return false; } if (!isset($attachment['hash'])) { return false; } if (!isset($attachment['filename'])) { return false; } if (!isset($attachment['downloads'])) { return false; } if (!is_md5($attachment['hash'])) { return false; } $thumbnail_max_size = 100; $webtag = get_webtag(); forum_check_webtag_available($webtag); if (isset($_SESSION['SHOW_THUMBS']) && is_numeric($_SESSION['SHOW_THUMBS'])) { $user_show_thumbs = $_SESSION['SHOW_THUMBS']; } else { $user_show_thumbs = 100; } if ($show_thumbs && forum_get_setting('attachment_thumbnails', 'Y') && ($user_show_thumbs > 0 || !session::logged_in())) { $thumbnail_size = array(1 => 50, 2 => 100, 3 => 150); $thumbnail_max_size = isset($thumbnail_size[$user_show_thumbs]) ? $thumbnail_size[$user_show_thumbs] : 100; } else { $show_thumbs = false; } if ($local_path) { $attachment_href = "attachments/{$attachment['filename']}"; } else { $attachment_href = "get_attachment.php?webtag={$webtag}&hash={$attachment['hash']}"; $attachment_href .= "&filename={$attachment['filename']}"; } if ($img_tag) { $title_array = array(); if (mb_strlen($attachment['filename']) > 16 && $limit_filename) { $title_array[] = sprintf(gettext("Filename: %s"), $attachment['filename']); $attachment['filename'] = format_file_name($attachment['filename']); } if (isset($attachment['filesize']) && is_numeric($attachment['filesize']) && $attachment['filesize'] > 0) { $title_array[] = sprintf(gettext("Size: %s"), format_file_size($attachment['filesize'])); } if ($attachment['downloads'] == 1) { $title_array[] = gettext("Downloaded: 1 time"); } else { $title_array[] = sprintf(gettext("Downloaded: %d times"), $attachment['downloads']); } if (isset($attachment['width'], $attachment['height'])) { $title_array[] = sprintf(gettext("Dimensions %dx%dpx"), $attachment['width'], $attachment['height']); } $title = implode(", ", $title_array); if ($show_thumbs && isset($attachment['thumbnail']) && $attachment['thumbnail'] == 'Y') { $thumbnail_width = 150; $thumbnail_height = 150; while ($thumbnail_width > $thumbnail_max_size) { $thumbnail_width--; $thumbnail_height--; } $attachment_link = "<a href=\"{$attachment_href}\" target=\"_blank\"><span class=\"attachment_thumb\" "; $attachment_link .= "style=\"background-image: url('{$attachment_href}&thumb=1'); "; $attachment_link .= "width: {$thumbnail_width}px; height: {$thumbnail_height}px\" "; $attachment_link .= "title=\"{$title}\"></span></a>"; } else { $attachment_link = html_style_image('attach', gettext("Attachment")); $attachment_link .= "<a href=\"{$attachment_href}\" title=\"{$title}\" "; $attachment_link .= "target=\"_blank\">{$attachment['filename']}</a>"; } return $attachment_link; } return $attachment_href; }
function thread_list_draw_top($mode, $folder = false) { $webtag = get_webtag(); forum_check_webtag_available($webtag); echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('post', gettext("New Discussion")), " <a href=\"post.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("New Discussion"), "</a></td>\n"; echo " </tr>\n"; if (forum_get_setting('allow_polls', 'Y')) { echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('poll', gettext("Create Poll")), " <a href=\"create_poll.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Create Poll"), "</a></td>\n"; echo " </tr>\n"; } echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('search', gettext("Search")), " <a href=\"search.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Search"), "</a></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">", html_style_image('pm_unread', gettext("Inbox")), " <a href=\"pm.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Inbox"), "</a> <span class=\"pmnewcount\" id=\"pm_message_count\"></span></td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<br />\n"; $available_views = thread_list_available_views(); echo "<form accept-charset=\"utf-8\" name=\"f_mode\" method=\"get\" action=\"thread_list.php\">\n"; echo " ", form_input_hidden("webtag", htmlentities_array($webtag)), "\n"; echo " <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">\n"; echo " ", form_dropdown_array("mode", $available_views, htmlentities_array($mode)), " ", form_submit("go", gettext("Go!")), "\n"; if (is_numeric($folder) && in_array($folder, folder_get_available_array())) { echo " ", form_input_hidden("folder", htmlentities_array($folder)), "\n"; } echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; }
function links_get_folder_path_links($fid, $folders, $html = true, $link_last_too = false, $link_base = false) { $webtag = get_webtag(); forum_check_webtag_available($webtag); if (!is_numeric($fid)) { return false; } if (!is_array($folders)) { return false; } if (!isset($folders[$fid])) { return false; } $tree_fid = $fid; $tree_array = array(); list($key) = array_keys($folders); while ($tree_fid != $key) { $tree_array[] = $tree_fid; $tree_fid = $folders[$tree_fid]['PARENT_FID']; } $link_base = $link_base ? $link_base : "links.php?webtag={$webtag}"; if (strstr($link_base, "?")) { $result = $html ? "<a href=\"{$link_base}&fid={$key}\">" . word_filter_add_ob_tags($folders[$key]['NAME'], true) . "</a>" : word_filter_add_ob_tags($folders[$key]['NAME'], true); } else { $result = $html ? "<a href=\"{$link_base}&fid={$key}\">" . word_filter_add_ob_tags($folders[$key]['NAME'], true) . "</a>" : word_filter_add_ob_tags($folders[$key]['NAME'], true); } if (is_array($tree_array) && sizeof($tree_array) > 0) { while (($val = array_pop($tree_array)) !== null) { if ($val != $fid && $html || $link_last_too) { $result .= $html ? html_style_image('separator') . "<a href=\"{$link_base}&fid={$val}\">" . word_filter_add_ob_tags($folders[$val]['NAME'], true) . "</a>" : " > " . word_filter_add_ob_tags($folders[$val]['NAME'], true); } else { $result .= $html ? html_style_image('separator') . word_filter_add_ob_tags($folders[$val]['NAME'], true) : " > " . word_filter_add_ob_tags($folders[$val]['NAME'], true); } } } return $result; }
function sphinx_search_execute($search_arguments, &$error) { if (!isset($_SESSION['UID']) || !is_numeric($_SESSION['UID'])) { return false; } if (!($table_prefix = get_table_prefix())) { return false; } if (!($forum_fid = get_forum_fid())) { return false; } /** @var mysqli $sphinx */ if (!($sphinx = sphinx_search_connect())) { $error = SEARCH_SPHINX_UNAVAILABLE; return false; } // Sphinx Search index name is the forum's webtag. if (!($sphinx_search_index = get_webtag())) { $error = SEARCH_SPHINX_UNAVAILABLE; return false; } // Validate the webtag if (!forum_check_webtag_available($sphinx_search_index)) { $error = SEARCH_SPHINX_UNAVAILABLE; return false; } // Regular Database connection. if (!($db = db::get())) { return false; } // If the user has specified a folder within their viewable scope limit them // to that folder, otherwise limit them to their available folders. $where_sql = "WHERE forum = {$forum_fid} AND fid IN ({$search_arguments['fid']}) "; // Where query needs to limit the search results to the user specified date range. $where_sql .= sphinx_search_date_range($search_arguments['date_from'], $search_arguments['date_to']); // Username based search. if (isset($search_arguments['user_uid_array']) && sizeof($search_arguments['user_uid_array']) > 0) { // Save the sort by and sort dir. search_save_arguments($search_arguments); // Combine the user UIDs into a comma-seperated list. $user_uids = implode(',', array_filter($search_arguments['user_uid_array'], 'is_numeric')); // Check if we're searching for threads or posts started by these users. if (isset($search_arguments['user_include']) && is_numeric($search_arguments['user_include'])) { if ($search_arguments['user_include'] == SEARCH_FILTER_USER_THREADS) { $where_sql .= "AND by_uid IN ({$user_uids}) AND pid = 1 "; } else { if ($search_arguments['user_include'] == SEARCH_FILTER_USER_POSTS) { $where_sql .= "AND from_uid IN ({$user_uids}) "; } } } } /// Keyword based search. if (isset($search_arguments['search_string']) && strlen(trim($search_arguments['search_string'])) > 0) { // Sphinx doesn't like -- in MATCH. Don't know if it's because it // thinks it is a MySQL-style comment or a bug. We have no choice // but to strip it out. $search_string = $sphinx->real_escape_string(str_replace('--', '', $search_arguments['search_string'])); search_save_arguments($search_arguments); $where_sql .= "AND MATCH('{$search_string}')"; } else { if (!isset($search_arguments['user_uid_array']) || sizeof($search_arguments['user_uid_array']) < 1) { $error = SEARCH_NO_MATCHES; return false; } } // If the user wants results grouped by thread (TID) then do so. if (isset($search_arguments['group_by_thread']) && $search_arguments['group_by_thread'] == SEARCH_GROUP_THREADS) { $group_sql = "GROUP BY tid"; } else { $group_sql = ""; } // Get the correct sort dir $sort_dir = $search_arguments['sort_dir'] == SEARCH_SORT_DESC ? 'DESC' : 'ASC'; // Construct the order by clause. switch ($search_arguments['sort_by']) { case SEARCH_SORT_NUM_REPLIES: $order_sql = "ORDER BY length {$sort_dir}"; break; case SEARCH_SORT_FOLDER_NAME: $order_sql = "ORDER BY fid {$sort_dir}"; break; case SEARCH_SORT_AUTHOR_NAME: $order_sql = "ORDER BY from_uid {$sort_dir}"; break; default: $order_sql = "ORDER BY created {$sort_dir}"; break; } // Prepend _DELTA to the end of the index name. $sphinx_search_index_delta = sprintf('%s_DELTA', $sphinx_search_index); // Build query including main and delta indexes. $sql = "SELECT *, WEIGHT() FROM {$sphinx_search_index}, {$sphinx_search_index_delta} "; $sql .= "{$where_sql} {$group_sql} {$order_sql} LIMIT 1000"; // Execute the query if (!($result = $sphinx->query($sql))) { return false; } // Check if we have any results if ($result->num_rows == 0) { // No results from search. $error = SEARCH_NO_MATCHES; return false; } while (($search_result = $result->fetch_assoc()) !== null) { if (isset($search_result['weight()'])) { $weight = $search_result['weight()']; } else { if (isset($search_result['weight'])) { $weight = $search_result['weight']; } else { $weight = 0; } } $sql = "INSERT INTO SEARCH_RESULTS (UID, FORUM, TID, PID, RELEVANCE) "; $sql .= "SELECT '{$_SESSION['UID']}' AS UID, '{$forum_fid}' AS FORUM, THREAD.TID, POST.PID, "; $sql .= "{$weight} AS RELEVANCE FROM `{$table_prefix}POST` "; $sql .= "POST INNER JOIN `{$table_prefix}THREAD` THREAD ON (THREAD.TID = POST.TID) "; $sql .= "WHERE THREAD.TID = '{$search_result['tid']}' AND POST.PID = '{$search_result['pid']}' "; $sql .= "AND THREAD.LENGTH > 0 AND THREAD.DELETED = 'N' AND (THREAD.APPROVED IS NOT NULL "; $sql .= "OR THREAD.BY_UID = '{$_SESSION['UID']}') "; if (!$db->query($sql)) { return false; } } return true; }
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"; } }
function form_quick_button($href, $button_label, $var_array = null, $target = '_self', $button_custom_html = null, $button_class = 'button', $button_id = null) { $webtag = get_webtag(); forum_check_webtag_available($webtag); $html = "<form accept-charset=\"utf-8\" method=\"get\" action=\"{$href}\" target=\"{$target}\">"; $html .= form_input_hidden("webtag", htmlentities_array($webtag)); if (is_array($var_array)) { foreach ($var_array as $var_name => $var_value) { if (!is_array($var_value)) { $html .= form_input_hidden($var_name, htmlentities_array($var_value)); } } } $html .= form_submit(form_unique_id('submit'), $button_label, $button_custom_html, $button_class, $button_id); return $html . "</form>"; }
function get_request_uri($include_webtag = true, $encode_uri_query = true) { if (!is_bool($include_webtag)) { $include_webtag = true; } if (!is_bool($encode_uri_query)) { $encode_uri_query = true; } $webtag = get_webtag(); forum_check_webtag_available($webtag); $request_uri = basename($_SERVER['PHP_SELF']); $query_string_array = $_GET; unset($query_string_array['webtag']); if ($include_webtag && $webtag) { $query_string_array['webtag'] = $webtag; } $query_string = http_build_query($query_string_array, null, $encode_uri_query ? '&' : '&'); return strlen($query_string) > 0 ? sprintf('%s?%s', $request_uri, $query_string) : $request_uri; }
function light_html_draw_top() { static $called = false; if ($called) { return; } $called = true; $arg_array = func_get_args(); $title = null; $robots = null; $webtag = get_webtag(); $link_array = array(); $func_matches = array(); $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum'); foreach ($arg_array as $key => $func_args) { if (preg_match('/^title=(.+)?$/Disu', $func_args, $func_matches) > 0) { $title = !isset($title) && isset($func_matches[1]) ? $func_matches[1] : $title; unset($arg_array[$key]); } if (preg_match('/^robots=(.+)?$/Disu', $func_args, $func_matches) > 0) { $robots = !isset($robots) && isset($func_matches[1]) ? $func_matches[1] : $robots; unset($arg_array[$key]); } if (preg_match('/^link=([^:]+):(.+)$/Disu', $func_args, $func_matches) > 0) { $link_array[] = array('rel' => $func_matches[1], 'href' => $func_matches[2]); unset($arg_array[$key]); } } // Default Meta keywords and description. $meta_keywords = html_get_forum_keywords(); $meta_description = html_get_forum_description(); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"", gettext("ltr"), "\">\n"; echo "<head>\n"; if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { message_get_meta_content($_GET['msg'], $meta_keywords, $meta_description); list($tid, $pid) = explode('.', $_GET['msg']); if ($thread_data = thread_get($tid)) { $prev_page = $pid - 10 > 0 ? $pid - 10 : 1; $next_page = $pid + 10 < $thread_data['LENGTH'] ? $pid + 10 : $thread_data['LENGTH']; echo "<link rel=\"first\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; echo "<link rel=\"previous\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$thread_data['LENGTH']}"), "\" />\n"; echo "<link rel=\"next\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$next_page}"), "\" />\n"; echo "<link rel=\"last\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$prev_page}"), "\" />\n"; echo "<title>", word_filter_add_ob_tags($thread_data['TITLE'], true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { echo "<title>", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", htmlentities_array($forum_name), "</title>\n"; } else { echo "<title>", htmlentities_array($forum_name), "</title>\n"; } } echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; echo "<meta name=\"generator\" content=\"Beehive Forum ", BEEHIVE_VERSION, "\" />\n"; echo "<meta name=\"keywords\" content=\"", word_filter_add_ob_tags($meta_keywords, true), "\" />\n"; echo "<meta name=\"description\" content=\"", word_filter_add_ob_tags($meta_description, true), "\" />\n"; echo "<meta name=\"MobileOptimized\" content=\"0\" />\n"; echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n"; if (forum_get_setting('allow_search_spidering', 'N')) { echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n"; } else { if (isset($robots)) { echo "<meta name=\"robots\" content=\"{$robots}\" />\n"; } } if ($stylesheet = html_get_style_sheet('mobile.css')) { echo "<link rel=\"stylesheet\" href=\"{$stylesheet}\" type=\"text/css\" media=\"screen\" />\n"; } if ($emoticon_stylesheet = html_get_emoticon_style_sheet(true)) { echo "<link rel=\"stylesheet\" href=\"{$emoticon_stylesheet}\" type=\"text/css\" media=\"screen\" />\n"; } $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array(gettext("RSS Feed")), $rss_feed_path); if ($folders_array = folder_get_available_details()) { foreach ($folders_array as $folder) { $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}&fid={$folder['FID']}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($folder['TITLE']), htmlentities_array(gettext("RSS Feed")), $rss_feed_path); } } if ($user_style_path = html_get_user_style_path()) { printf("<link rel=\"apple-touch-icon\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-57x57.png', $user_style_path))); printf("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-72x72.png', $user_style_path))); printf("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-114x114.png', $user_style_path))); printf("<link rel=\"shortcut icon\" type=\"image/ico\"href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path))); } echo "<script type=\"text/javascript\" src=\"js/jquery-1.7.1.min.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"js/jquery.sprintf.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"js/general.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"js/light.js\"></script>\n"; $message_display_pages = array('admin_post_approve.php', 'create_poll.php', 'delete.php', 'display.php', 'edit.php', 'edit_poll.php', 'edit_signature.php', 'ldisplay.php', 'lmessages.php', 'lpost.php', 'messages.php', 'post.php'); if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) { if (session::get_value('USE_MOVER_SPOILER') == "Y") { echo "<script type=\"text/javascript\" src=\"js/spoiler.js\"></script>\n"; } } echo "<script type=\"text/javascript\" src=\"ckeditor/ckeditor.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"ckeditor/adapters/jquery.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"json.php?webtag={$webtag}\"></script>\n"; echo "</head>\n"; echo "<body id=\"mobile\">\n"; echo "<a name=\"top\"></a>\n"; echo "<div id=\"header\">\n"; echo " <img src=\"", html_style_image('mobile_logo.png'), "\" alt=\"", gettext("Beehive Forum Logo"), "\" />\n"; echo " <div id=\"nav\">", gettext("Menu"), "</div>\n"; echo "</div>\n"; echo "<div id=\"menu\">\n"; echo " <ul>\n"; if (forums_get_available_count() > 1 || !forum_check_webtag_available($webtag)) { echo " <li class=\"menu_item\"><a href=\"lforums.php?webtag={$webtag}\">", gettext("My Forums"), "</a></li>\n"; } echo " <li class=\"menu_item\"><a href=\"lthread_list.php?webtag={$webtag}\">", gettext("Messages"), "</a></li>\n"; echo " <li class=\"menu_item\"><a href=\"lpm.php?webtag={$webtag}\">", gettext("Inbox"), "</a></li>\n"; if (!session::logged_in()) { echo " <li class=\"menu_item\"><a href=\"llogon.php?webtag={$webtag}\">", gettext("Login"), "</a></li>\n"; } else { echo " <li class=\"menu_item\"><a href=\"llogout.php?webtag={$webtag}\">", gettext("Logout"), "</a></li>\n"; } echo " </ul>\n"; echo "</div>\n"; echo "<div id=\"content\">\n"; light_pm_check_messages(); if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) { adsense_output_html(); } }
function pm_display($message_data, $preview = false, $export_html = false) { $webtag = get_webtag(); forum_check_webtag_available($webtag); echo "<div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\" cellpadding=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table width=\"100%\" class=\"posthead\" cellspacing=\"1\" cellpadding=\"0\">\n"; echo " <tr>\n"; if ($export_html === true) { echo " <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\"> ", gettext("From"), ": </span></td>\n"; echo " <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", word_filter_add_ob_tags(format_user_name($message_data['FROM_LOGON'], $message_data['FROM_NICKNAME']), true), "</span></td>\n"; } else { echo " <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\"> ", gettext("From"), ": </span></td>\n"; echo " <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\"><a href=\"user_profile.php?webtag={$webtag}&uid={$message_data['FROM_UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($message_data['FROM_LOGON'], $message_data['FROM_NICKNAME']), true), "</a></span></td>\n"; } if (isset($message_data['TYPE']) && $message_data['TYPE'] & PM_SAVED_DRAFT) { echo " <td align=\"right\" style=\"white-space: nowrap\"><span class=\"postinfo\"><i>", gettext("Not Sent"), "</i> </span></td>\n"; } else { echo " <td align=\"right\" style=\"white-space: nowrap\"><span class=\"postinfo\">", format_date_time($message_data['CREATED']), " </span></td>\n"; } echo " </tr>\n"; echo " <tr>\n"; echo " <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\"> ", gettext("Subject"), ": </span></td>\n"; if (strlen(trim($message_data['SUBJECT'])) > 0) { echo " <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", word_filter_add_ob_tags($message_data['SUBJECT'], true), "</span></td>\n"; } else { echo " <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\"><i>", gettext("No Subject"), "</i></span></td>\n"; } echo " </tr>\n"; echo " <tr>\n"; echo " <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\"> ", gettext("To"), ": </span></td>\n"; if (isset($message_data['RECIPIENTS']) && sizeof($message_data['RECIPIENTS']) > 0) { echo " <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">"; foreach ($message_data['RECIPIENTS'] as $recipient) { echo " <a href=\"user_profile.php?webtag={$webtag}&uid={$recipient['UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($recipient['LOGON'], $recipient['NICKNAME']), true), "</a>"; } echo " </td>\n"; } else { echo " <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", gettext('Unknown User'), "</td>\n"; } $message_data['CONTENT'] = message_apply_formatting($message_data['CONTENT']); $message_data['CONTENT'] = word_filter_add_ob_tags($message_data['CONTENT']); echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table width=\"100%\">\n"; echo " <tr>\n"; echo " <td colspan=\"3\" align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td class=\"postbody overflow_content\" align=\"left\">{$message_data['CONTENT']}</td>\n"; echo " </tr>\n"; if (isset($message_data['ATTACHMENTS']) && sizeof($message_data['ATTACHMENTS']) > 0) { if (($attachments_array = attachments_get($message_data['FROM_UID'], $message_data['ATTACHMENTS'])) !== false) { echo " <tr>\n"; echo " <td class=\"postbody\" align=\"left\">\n"; echo " <p><b>", gettext("Attachments"), ":</b><br />\n"; foreach ($attachments_array as $attachment) { echo attachments_make_link($attachment), $attachment['thumbnail'] == 'N' ? "<br />\n" : "\n"; } echo " </p>\n"; echo " </td>\n"; echo " </tr>\n"; } } echo " </table>\n"; echo " <table width=\"100%\" class=\"postresponse\" cellspacing=\"1\" cellpadding=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; if ($preview === false) { if ($message_data['TYPE'] & PM_INBOX_ITEMS) { echo "", html_style_image('post', "Reply"), " <a href=\"pm_write.php?webtag={$webtag}&reply_to={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Reply"), "</a> \n"; if (isset($message_data['RECIPIENTS']) && sizeof($message_data['RECIPIENTS']) > 1) { echo "", html_style_image('reply_all', "Reply All"), " <a href=\"pm_write.php?webtag={$webtag}&replyall={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Reply All"), "</a> \n"; } echo "", html_style_image('forward', "Forward"), " <a href=\"pm_write.php?webtag={$webtag}&fwdmsg={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a> \n"; } else { if ($message_data['TYPE'] & PM_DRAFT_ITEMS) { echo "", html_style_image('edit', "Edit"), " <a href=\"pm_write.php?webtag={$webtag}&editmsg={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Edit"), "</a> \n"; } else { if ($message_data['EDITABLE'] == 1) { echo "", html_style_image('post', "Edit"), " <a href=\"pm_edit.php?webtag={$webtag}&mid={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Edit"), "</a> \n"; } echo "", html_style_image('forward', "Forward"), " <a href=\"pm_write.php?webtag={$webtag}&fwdmsg={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a> \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 " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</div>\n"; }
function search_output_opensearch_xml() { $webtag = get_webtag(); forum_check_webtag_available($webtag); $forum_title = forum_get_setting('forum_name', null, 'A Beehive Forum'); $forum_description = html_get_forum_description(); $forum_opensearch_uri = html_get_forum_uri("search.php?webtag={$webtag}&search_string={searchTerms}"); header('Content-type: text/xml; charset=UTF-8', true); echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"; echo "<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\">\n"; echo " <ShortName>", htmlentities_array($forum_title), "</ShortName>\n"; echo " <Description>", htmlentities_array($forum_description), "</Description>\n"; echo " <InputEncoding>UTF-8</InputEncoding>\n"; if (($user_style_path = html_get_user_style_path()) !== false) { printf(" <Image height=\"16\" width=\"16\" type=\"image/x-icon\">%s</Image>\n", html_get_forum_uri(sprintf('styles/%s/images/favicon.ico', $user_style_path))); } echo " <Url type=\"text/html\" method=\"get\" template=\"", htmlentities_array($forum_opensearch_uri), "\"></Url>\n"; echo "</OpenSearchDescription>\n"; exit; }
function messages_forum_stats($tid, $pid) { $webtag = get_webtag(); forum_check_webtag_available($webtag); if (forum_get_setting('show_stats', 'Y')) { echo "<br />\n"; echo "<div align=\"center\" class=\"messages_forum_stats\">\n"; echo " <form action=\"user_stats.php\" method=\"get\" target=\"_self\">\n"; echo " ", form_input_hidden('webtag', $webtag), "\n"; echo " ", form_input_hidden('msg', "{$tid}.{$pid}"), "\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"96%\">\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\" cellspacing=\"0\">\n"; echo " <tr>\n"; echo " <td>\n"; echo " <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\">", gettext("Forum Stats"), "</td>\n"; echo " <td align=\"right\" class=\"subhead\">\n"; if (!session::logged_in()) { echo " "; } else { if (isset($_SESSION['SHOW_STATS']) && $_SESSION['SHOW_STATS'] == 'Y') { echo " ", form_submit_image('hide', 'forum_stats_toggle', 'hide', null, 'button_image toggle_button'), "\n"; } else { echo " ", form_submit_image('show', 'forum_stats_toggle', 'show', null, 'button_image toggle_button'), "\n"; } } echo " </td>\n"; echo " </tr>"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>\n"; if (!session::logged_in() || isset($_SESSION['SHOW_STATS']) && $_SESSION['SHOW_STATS'] == 'Y') { echo " <div id=\"forum_stats\" class=\"forum_stats_toggle\">\n"; } else { echo " <div id=\"forum_stats\" class=\"forum_stats_toggle\" style=\"display: none\">\n"; } echo " <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n"; echo " <tr>\n"; echo " <td rowspan=\"19\" width=\"35\"> </td>\n"; echo " <td> </td>\n"; echo " <td rowspan=\"19\" width=\"35\"> </td>\n"; echo " </tr>\n"; for ($i = 0; $i < 18; $i++) { echo " <tr>\n"; echo " <td> </td>\n"; echo " </tr>\n"; } echo " </table>\n"; echo " </div>\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 " </table>\n"; echo " </form>\n"; echo "</div>\n"; } }
function admin_check_credentials() { $webtag = get_webtag(); forum_check_webtag_available($webtag); if (isset($_SESSION['ADMIN_TIMEOUT']) && is_numeric($_SESSION['ADMIN_TIMEOUT']) && $_SESSION['ADMIN_TIMEOUT'] > time()) { $_SESSION['ADMIN_TIMEOUT'] = time() + HOUR_IN_SECONDS; return true; } if (isset($_POST['admin_logon']) && isset($_POST['admin_password'])) { $admin_logon = $_POST['admin_logon']; $admin_password = $_POST['admin_password']; if (($admin_uid = user_logon($admin_logon, $admin_password)) && $admin_uid == $_SESSION['UID']) { $_SESSION['ADMIN_TIMEOUT'] = time() + HOUR_IN_SECONDS; return true; } else { html_display_error_msg(gettext("The username or password you supplied are not valid."), '500', 'center'); } } html_draw_top(array('main_css' => 'admin.css')); if (isset($_POST) && is_array($_POST) && sizeof($_POST) > 0) { html_display_warning_msg(gettext('To save any changes you must re-authenticate yourself'), '500', 'center'); } else { html_display_warning_msg(gettext('To access the Admin area you must re-authenticate yourself'), '500', 'center'); } echo "<div align=\"center\">\n"; echo " <form accept-charset=\"utf-8\" name=\"logonform\" method=\"post\" action=\"", get_request_uri(), "\" target=\"", html_get_frame_name('main'), "\" autocomplete=\"off\">\n"; echo " ", form_csrf_token_field(), "\n"; 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("Please enter your password"), "</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('admin_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('admin_password', null, 24, 32, null, 'bhinputlogon'), "</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 "</div>\n"; html_draw_bottom(); exit; }
function email_send_link_approval_notification($to_uid) { if (!is_numeric($to_uid)) { return false; } if (!($to_user = user_get($to_uid))) { return false; } if (!($transport = Swift_TransportFactory::get())) { return false; } $mailer = Swift_Mailer::newInstance($transport); $message = Swift_MessageBeehive::newInstance(); $webtag = get_webtag(); forum_check_webtag_available($webtag); if (!email_address_valid($to_user['EMAIL'])) { return false; } $forum_name = word_filter_apply(forum_get_setting('forum_name', null, 'A Beehive Forum'), $to_uid, true); $subject = word_filter_apply(sprintf(gettext("Link Approval Notification for %1\$s"), $forum_name), $to_uid, true); $recipient = word_filter_apply(format_user_name($to_user['LOGON'], $to_user['NICKNAME']), $to_uid, true); $admin_post_approval_link = rawurlencode("admin_link_approve.php?webtag={$webtag}"); $admin_post_approval_link = html_get_forum_uri("index.php?webtag={$webtag}&final_uri={$admin_post_approval_link}"); $message->setTo($to_user['EMAIL'], $recipient); $message->setSubject($subject); $message->setBody(wordwrap(sprintf(gettext("Hello %1\$s,\n\nA new link has been created on %2\$s.\n\nAs you are a Link Moderator on this forum you are required to approve this link before it can be read by other users.\n\nYou can approve this link by going to:\n%3\$s\n\nNote: Other Moderators on this forum will also receive this notification and may have already acted upon this request."), $recipient, $forum_name, $admin_post_approval_link))); $message->addPart(wordwrap_html(sprintf(gettext("<p>Hello %1\$s,</p><p>A new link has been created on %2\$s.</p><p>As you are a Link Moderator on this forum you are required to approve this link before it can be read by other users.</p><p>You can approve this link by going to:<br /><a href=\"%3\$s\">%3\$s</a></p><p>Note: Other Moderators on this forum will also receive this notification and may have already acted upon this request.</p>"), $recipient, $forum_name, $admin_post_approval_link)), 'text/html'); return $mailer->send($message); }
function user_profile_popup_callback($logon) { $webtag = get_webtag(); forum_check_webtag_available($webtag); return "<a href=\"user_profile.php?webtag={$webtag}&logon={$logon}\" class=\"popup 650x500\" target=\"_blank\">{$logon}</a>"; }
function poll_public_ballot_user_callback($user_data) { $webtag = get_webtag(); forum_check_webtag_available($webtag); if (isset($user_data['UID']) && $user_data['UID'] > 0) { $user_profile_link_html = "<a href=\"user_profile.php?webtag={$webtag}&uid=%1\$s\" target=\"_blank\" class=\"popup 650x500\" style=\"white-space: nowrap\">%2\$s</a>"; return sprintf($user_profile_link_html, $user_data['UID'], word_filter_add_ob_tags(format_user_name($user_data['LOGON'], $user_data['NICKNAME']), true), $webtag); } else { if (isset($user_data['LOGON'])) { return $user_data['LOGON']; } else { if (is_string($user_data)) { return $user_data; } } } return gettext("Unknown user"); }
function adsense_output_html() { static $adsense_displayed = false; $webtag = get_webtag(); forum_check_webtag_available($webtag); if ($adsense_displayed === false) { if (adsense_publisher_id()) { $adsense_display_users = adsense_display_users(); $ad_type = 'medium'; $ad_width = 468; $ad_height = 60; adsense_get_banner_type($ad_type, $ad_width, $ad_height); echo "<div class=\"google_adsense_container\" style=\"width: 100%; text-align: center\">\n"; echo " <div style=\"width: {$ad_width}px; margin: auto\">\n"; echo " <script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></script>\n"; if (!session::logged_in() && $adsense_display_users == ADSENSE_DISPLAY_GUESTS) { echo " <div class=\"google_adsense_register_note\"><a href=\"index.php?webtag={$webtag}&final_uri=register.php%3Fwebtag%3D{$webtag}\" target=\"", html_get_top_frame_name(), "\">", gettext("Register to remove these adverts."), "</a></div>\n"; } echo " </div>\n"; echo "</div>\n"; $adsense_displayed = true; } } }
function light_pm_check_messages() { // Check if this function has be called multiple times in one request. static $light_pm_check_messages_done = false; // Check if we've already displayed the notification once. if ($light_pm_check_messages_done === true) { return; } // Get the webtag $webtag = get_webtag(); forum_check_webtag_available($webtag); // Default the variables to return 0 even on error. $new_count = 0; $outbox_count = 0; $unread_count = 0; // Get the number of messages. pm_get_message_count($new_count, $outbox_count, $unread_count); // Format the message sent to the client. if ($new_count == 1 && $outbox_count == 0) { $notification = gettext("You have 1 new message. Would you like to go to your Inbox now?"); } else { if ($new_count == 1 && $outbox_count == 1) { $notification = gettext("You have 1 new message.\n\nYou also have 1 message awaiting delivery. To receive this message please clear some space in your Inbox.\n\nWould you like to go to your Inbox now?"); } else { if ($new_count == 0 && $outbox_count == 1) { $notification = gettext("You have 1 message awaiting delivery. To receive this message please clear some space in your Inbox.\n\nWould you like to go to your Inbox now?"); } else { if ($new_count > 1 && $outbox_count == 0) { $notification = sprintf(gettext("You have %d new messages. Would you like to go to your Inbox now?"), $new_count); } else { if ($new_count > 1 && $outbox_count == 1) { $notification = sprintf(gettext("You have %d new messages.\n\nYou also have 1 message awaiting delivery. To receive this message please clear some space in your Inbox.\n\nWould you like to go to your Inbox now?"), $new_count); } else { if ($new_count > 1 && $outbox_count > 1) { $notification = sprintf(gettext("You have %d new messages.\n\nYou also have %d messages awaiting delivery. To receive these message please clear some space in your Inbox.\n\nWould you like to go to your Inbox now?"), $new_count, $outbox_count); } else { if ($new_count == 1 && $outbox_count > 1) { $notification = sprintf(gettext("You have 1 new message.\n\nYou also have %d messages awaiting delivery. To receive these messages please clear some space in your Inbox.\n\nWould you like to go to your Inbox now?"), $outbox_count); } else { if ($new_count == 0 && $outbox_count > 1) { $notification = sprintf(gettext("You have %d messages awaiting delivery. To receive these messages please clear some space in your Inbox.\n\nWould you like to go to your Inbox now?"), $outbox_count); } } } } } } } } if (isset($notification) && strlen(trim($notification)) > 0) { // Wrap the notification in a hyperlink. $notification = sprintf("<a href=\"lpm.php?webtag={$webtag}\">%s</a>\n", $notification); // Display the notification light_html_display_success_msg($notification); } // Prevent checking again. $light_pm_check_messages_done = true; }
function html_draw_top(array $options = array()) { $title = null; $class = null; $base_target = null; $robots = null; $main_css = null; $images_css = null; $inline_css = null; $emoticons = null; $frame_set_html = false; $pm_popup_disabled = false; $js = array(); $css = array(); $webtag = get_webtag(); forum_check_webtag_available($webtag); $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum'); foreach ($options as $key => $value) { switch ($key) { case 'title': case 'class': case 'base_target': case 'robots': case 'main_css': case 'images_css': case 'inline_css': case 'emoticons': ${$key} = !isset(${$key}) && isset($value) ? $value : ${$key}; break; case 'frame_set_html': case 'pm_popup_disabled': ${$key} = is_bool($value) ? $value : ${$key}; break; case 'js': case 'css': if (!is_array($value) || count(array_filter($value, 'is_string')) != count($value)) { throw new InvalidArgumentException(sprintf('Expecting html_draw_top argument %s to be an array of strings', $key)); } ${$key} = $value; break; default: throw new InvalidArgumentException(sprintf('Unknown html_draw_top argument "%s"', $key)); break; } } if (!isset($main_css)) { $main_css = 'style.css'; } if (!isset($images_css)) { $images_css = 'images.css'; } if ($frame_set_html === false) { echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; } else { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; } echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"", gettext('en-gb'), "\" lang=\"", gettext('en-gb'), "\" dir=\"", gettext('ltr'), "\">\n"; echo "<head>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; // Default Meta keywords and description. $meta_keywords = html_get_forum_keywords(); $meta_description = html_get_forum_description(); if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { list($tid, $pid) = explode('.', $_GET['msg']); message_get_meta_content($_GET['msg'], $meta_keywords, $meta_description); if (isset($_SESSION['POSTS_PER_PAGE']) && is_numeric($_SESSION['POSTS_PER_PAGE'])) { $posts_per_page = max(min($_SESSION['POSTS_PER_PAGE'], 30), 10); } else { $posts_per_page = 20; } if (($thread_data = thread_get($tid)) !== false) { echo "<title>", word_filter_add_ob_tags($thread_data['TITLE'], true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; echo "<link rel=\"canonical\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; if ($thread_data['LENGTH'] > $posts_per_page) { $prev_page = $pid - $posts_per_page > 0 ? $pid - $posts_per_page : 1; $next_page = $pid + $posts_per_page < $thread_data['LENGTH'] ? $pid + $posts_per_page : $thread_data['LENGTH']; $last_page = floor($thread_data['LENGTH'] / $posts_per_page) * $posts_per_page + 1; echo "<link rel=\"first\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; echo "<link rel=\"last\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.{$last_page}"), "\" />\n"; if ($pid + $posts_per_page < $thread_data['LENGTH']) { echo "<link rel=\"next\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.{$next_page}"), "\" />\n"; } if ($pid > 1) { echo "<link rel=\"prev\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.{$prev_page}"), "\" />\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { echo "<title>", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", htmlentities_array($forum_name), "</title>\n"; } else { echo "<title>", htmlentities_array($forum_name), "</title>\n"; } } $forum_content_rating = html_get_forum_content_rating(); echo "<meta name=\"generator\" content=\"Beehive Forum ", BEEHIVE_VERSION, "\" />\n"; echo "<meta name=\"keywords\" content=\"", word_filter_add_ob_tags($meta_keywords, true), "\" />\n"; echo "<meta name=\"description\" content=\"", word_filter_add_ob_tags($meta_description, true), "\" />\n"; echo "<meta name=\"rating\" content=\"{$forum_content_rating}\" />\n"; if (forum_get_setting('allow_search_spidering', 'N') || isset($pid) && $pid > 1) { echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n"; } else { if (isset($robots)) { echo "<meta name=\"robots\" content=\"", htmlentities_array($robots), "\" />\n"; } } printf("<meta name=\"application-name\" content=\"%s\" />\n", htmlentities_array(word_filter_add_ob_tags($forum_name, true))); printf("<meta name=\"msapplication-tooltip\" content=\"%s\" />\n", htmlentities_array(word_filter_add_ob_tags($meta_description, true))); if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Messages'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=discussion.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/unread_thread.ico', true)); if (forum_get_setting('show_links', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Links'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=links.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/link.ico', true)); } } if (forum_get_setting('show_pms', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Inbox'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=pm.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/pm_unread.ico', true)); } if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('My Controls'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=user.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/user_controls.ico', true)); } if (session::logged_in() && (session::check_perm(USER_PERM_FORUM_TOOLS, 0) || session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::get_folders_by_perm(USER_PERM_FOLDER_MODERATE))) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Admin'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=admin.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/admin_tool.ico', true)); } printf("<meta name=\"msapplication-starturl\" content=\"%s\" />\n", htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}"))); $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array(gettext('RSS Feed')), htmlentities_array($rss_feed_path)); if (($folders_array = folder_get_available_details()) !== false) { foreach ($folders_array as $folder) { $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}&fid={$folder['FID']}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($folder['TITLE']), htmlentities_array(gettext('RSS Feed')), htmlentities_array($rss_feed_path)); } } if (($user_style_path = html_get_user_style_path()) !== false) { printf("<link rel=\"apple-touch-icon\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-57x57.png', $user_style_path)))); printf("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-72x72.png', $user_style_path)))); printf("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-114x114.png', $user_style_path)))); printf("<link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-144x144.png', $user_style_path)))); printf("<link rel=\"shortcut icon\" type=\"image/ico\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path)))); } $opensearch_path = html_get_forum_uri(sprintf('search.php?webtag=%s&opensearch', $webtag)); printf("<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"%s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($opensearch_path)); if (($style_sheet = html_get_style_file($main_css)) !== false) { echo html_include_css($style_sheet); } if (($emoticon_style_sheet = html_get_emoticon_style_sheet($emoticons)) !== false) { echo html_include_css($emoticon_style_sheet, 'print, screen'); } if (($images_style_sheet = html_get_style_file($images_css)) !== false) { echo html_include_css($images_style_sheet); } if (isset($inline_css)) { echo "<style type=\"text/css\">\n"; echo "<!--\n\n", $inline_css, "\n\n//-->\n"; echo "</style>\n"; } // Font size (not for Guests) if (session::logged_in()) { echo html_include_css(html_get_forum_file_path(sprintf('font_size.php?webtag=%s', $webtag)), 'screen', 'user_font'); } if ($base_target) { echo "<base target=\"", htmlentities_array($base_target), "\" />\n"; } echo html_include_javascript(html_get_forum_file_path('js/jquery.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.placeholder.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.ui.autocomplete.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.parsequery.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.sprintf.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.url.min.js')); echo html_include_javascript(html_get_forum_file_path('js/general.js')); if ($frame_set_html === false) { // Check for any new PMs. if (session::logged_in()) { // Check to see if the PM popup is disabled on the current page. if ($pm_popup_disabled === false) { // Pages we don't want the popup to appear on $pm_popup_disabled_pages = get_pm_popup_disabled_files(); // Check that we're not on one of the pages. if (!in_array(basename($_SERVER['PHP_SELF']), $pm_popup_disabled_pages)) { echo html_include_javascript(html_get_forum_file_path('js/pm.js')); } } // Overflow auto-resize functionality. $resize_images_page = get_image_resize_files(); if (in_array(basename($_SERVER['PHP_SELF']), $resize_images_page)) { if (isset($_SESSION['USE_OVERFLOW_RESIZE']) && $_SESSION['USE_OVERFLOW_RESIZE'] == 'Y') { echo html_include_javascript(html_get_forum_file_path('js/overflow.js')); } } // Mouseover spoiler pages $message_display_pages = get_message_display_files(); if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) { echo html_include_javascript(html_get_forum_file_path('js/spoiler.js')); } } // Stats Display pages $stats_display_pages = array('messages.php'); if (in_array(basename($_SERVER['PHP_SELF']), $stats_display_pages)) { echo html_include_javascript(html_get_forum_file_path('js/stats.js')); } } foreach ($css as $css_file) { echo html_include_css(html_get_forum_file_path($css_file)); } foreach ($js as $js_file) { echo html_include_javascript(html_get_forum_file_path($js_file)); } echo html_include_javascript(html_get_forum_file_path("json.php?webtag={$webtag}")); if ($frame_set_html === true && ($google_analytics_code = html_get_google_analytics_code())) { echo "<script type=\"text/javascript\">\n\n"; echo " var _gaq = _gaq || [];\n"; echo " _gaq.push(['_setAccount', '{$google_analytics_code}']);\n"; echo " _gaq.push(['_trackPageview']);\n\n"; echo " (function() {\n"; echo " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; echo " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; echo " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; echo " })();\n\n"; echo "</script>\n"; } echo "</head>\n\n"; if ($frame_set_html === false) { $classes = array(basename($_SERVER['PHP_SELF'], '.php')); if ($class) { $classes[] = $class; } printf("<body class=\"%s\">\n", implode(' ', htmlentities_array($classes))); if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) { adsense_output_html(); echo "<br />\n"; } echo '<div id="fb-root"></div>'; } }
// Correctly set server protocol set_server_protocol(); // Disable caching if on AOL cache_disable_aol(); // Disable caching if proxy server detected. cache_disable_proxy(); // Check that Beehive is installed correctly check_install(); // Multiple forum support require_once BH_INCLUDE_PATH . 'forum.inc.php'; // Initialise the session session::init(); // Perform ban check ban_check($_SESSION); // Check to see if user account has been banned. if (session::user_banned()) { light_html_user_banned(); exit; } // Check to see if the user has been approved. if (!session::user_approved()) { light_html_user_require_approval(); exit; } // Get the webtag for the current forum $webtag = get_webtag(); // Check we have a webtag and have access to the specified forum if (!forum_check_webtag_available($webtag) || !forum_check_access_level()) { $request_uri = rawurlencode(get_request_uri(false)); header_redirect("lforums.php?webtag_error"); }
function html_draw_top() { $arg_array = func_get_args(); $title = null; $body_class = null; $base_target = null; $stylesheet_array = array(); $meta_refresh = array('delay' => null, 'url' => null); $robots = null; $frame_set_html = false; $pm_popup_disabled = false; $inline_css = null; $emoticons = null; $webtag = get_webtag(); $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum'); $func_matches = array(); foreach ($arg_array as $key => $func_args) { if (preg_match('/^title=(.+)?$/Disu', $func_args, $func_matches) > 0) { $title = !isset($title) && isset($func_matches[1]) ? $func_matches[1] : $title; unset($arg_array[$key]); } if (preg_match('/^class=(.+)?$/Disu', $func_args, $func_matches) > 0) { $body_class = !isset($body_class) && isset($func_matches[1]) ? $func_matches[1] : $body_class; unset($arg_array[$key]); } if (preg_match('/^basetarget=(.+)?$/Disu', $func_args, $func_matches) > 0) { $base_target = !isset($base_target) && isset($func_matches[1]) ? $func_matches[1] : $base_target; unset($arg_array[$key]); } if (preg_match('/^stylesheet=([^:]+)(:(.+))?$/Disu', $func_args, $func_matches) > 0) { $stylesheet_array[] = array('filename' => $func_matches[1], 'media' => isset($func_matches[3]) ? $func_matches[3] : 'screen'); unset($arg_array[$key]); } if (preg_match('/^refresh=([^:]+):(.+)$/Disu', $func_args, $func_matches) > 0) { $meta_refresh['delay'] = isset($func_matches[1]) ? $func_matches[1] : null; $meta_refresh['url'] = isset($func_matches[2]) ? $func_matches[2] : null; unset($arg_array[$key]); } if (preg_match('/^robots=(.+)?$/Disu', $func_args, $func_matches) > 0) { $robots = !isset($robots) && isset($func_matches[1]) ? $func_matches[1] : $robots; unset($arg_array[$key]); } if (preg_match('/^frame_set_html$/Disu', $func_args, $func_matches) > 0) { $frame_set_html = true; unset($arg_array[$key]); } if (preg_match('/^pm_popup_disabled$/Disu', $func_args, $func_matches) > 0) { $pm_popup_disabled = true; unset($arg_array[$key]); } if (preg_match('/^inline_css=(.+)/Disu', $func_args, $func_matches) > 0) { $inline_css = !isset($inline_css) && isset($func_matches[1]) ? $func_matches[1] : $inline_css; unset($arg_array[$key]); } if (preg_match('/^emoticons=(.+)?$/Disu', $func_args, $func_matches) > 0) { $emoticons = !isset($emoticons) && isset($func_matches[1]) ? $func_matches[1] : $emoticons; unset($arg_array[$key]); } } echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; if ($frame_set_html === false) { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; } else { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; } echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"", _('en-gb'), "\" lang=\"", _('en-gb'), "\" dir=\"", _('ltr'), "\">\n"; echo "<head>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; // Default Meta keywords and description. $meta_keywords = html_get_forum_keywords(); $meta_description = html_get_forum_description(); if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { message_get_meta_content($_GET['msg'], $meta_keywords, $meta_description); list($tid, $pid) = explode('.', $_GET['msg']); if ($thread_data = thread_get($tid)) { $prev_page = $pid - 10 > 0 ? $pid - 10 : 1; $next_page = $pid + 10 < $thread_data['LENGTH'] ? $pid + 10 : $thread_data['LENGTH']; echo "<link rel=\"first\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; echo "<link rel=\"previous\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$thread_data['LENGTH']}"), "\" />\n"; echo "<link rel=\"next\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$next_page}"), "\" />\n"; echo "<link rel=\"last\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$prev_page}"), "\" />\n"; echo "<title>", word_filter_add_ob_tags($thread_data['TITLE'], true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { echo "<title>", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", htmlentities_array($forum_name), "</title>\n"; } else { echo "<title>", htmlentities_array($forum_name), "</title>\n"; } } $forum_content_rating = html_get_forum_content_rating(); echo "<meta name=\"generator\" content=\"Beehive Forum ", BEEHIVE_VERSION, "\" />\n"; echo "<meta name=\"keywords\" content=\"", word_filter_add_ob_tags($meta_keywords, true), "\" />\n"; echo "<meta name=\"description\" content=\"", word_filter_add_ob_tags($meta_description, true), "\" />\n"; echo "<meta name=\"rating\" content=\"{$forum_content_rating}\" />\n"; if (forum_get_setting('allow_search_spidering', 'N')) { echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n"; } else { if (isset($robots)) { echo "<meta name=\"robots\" content=\"{$robots}\" />\n"; } } if (isset($meta_refresh['url'], $meta_refresh['delay'])) { echo "<meta http-equiv=\"refresh\" content=\"{$meta_refresh['delay']}; url={$meta_refresh['url']}\" />\n"; } printf("<meta name=\"application-name\" content=\"%s\" />\n", word_filter_add_ob_tags($forum_name, true)); printf("<meta name=\"msapplication-tooltip\" content=\"%s\" />\n", word_filter_add_ob_tags($meta_description, true)); if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Messages'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=discussion.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/unread_thread.ico', true, true)); if (forum_get_setting('show_links', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Links'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=links.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/link.ico', true, true)); } } if (forum_get_setting('show_pms', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Inbox'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=pm.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/pmunread.ico', true, true)); } if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('My Controls'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=user.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/user_controls.ico', true, true)); } if (session::logged_in() && (session::check_perm(USER_PERM_FORUM_TOOLS, 0) || session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::get_folders_by_perm(USER_PERM_FOLDER_MODERATE))) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Admin'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=admin.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/admintool.ico', true, true)); } printf("<meta name=\"msapplication-starturl\" content=\"%s\" />\n", html_get_forum_file_path("index.php?webtag={$webtag}")); $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array(_('RSS Feed')), $rss_feed_path); if ($folders_array = folder_get_available_details()) { foreach ($folders_array as $folder) { $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}&fid={$folder['FID']}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($folder['TITLE']), htmlentities_array(_('RSS Feed')), $rss_feed_path); } } if ($user_style_path = html_get_user_style_path()) { printf("<link rel=\"apple-touch-icon\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-57x57.png', $user_style_path))); printf("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-72x72.png', $user_style_path))); printf("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-114x114.png', $user_style_path))); printf("<link rel=\"shortcut icon\" type=\"image/ico\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path))); } $opensearch_path = html_get_forum_file_path(sprintf('search.php?webtag=%s&opensearch', $webtag)); printf("<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"%s\" href=\"%s\" />\n", $forum_name, $opensearch_path); if ($style_sheet = html_get_style_sheet()) { html_include_css($style_sheet); } if ($script_style_sheet = html_get_script_style_sheet()) { html_include_css($script_style_sheet); } if ($emoticon_style_sheet = html_get_emoticon_style_sheet($emoticons)) { html_include_css($emoticon_style_sheet, 'print, screen'); } if (isset($stylesheet_array) && is_array($stylesheet_array)) { foreach ($stylesheet_array as $stylesheet) { if (isset($stylesheet['filename']) && isset($stylesheet['media'])) { html_include_css($stylesheet['filename'], $stylesheet['media']); } } } if ($style_path_ie6 = html_get_style_sheet('style_ie6.css')) { echo "<!--[if IE 6]>\n"; html_include_css($style_path_ie6); echo "<![endif]-->\n"; } if (isset($inline_css)) { echo "<style type=\"text/css\">\n"; echo "<!--\n\n", $inline_css, "\n\n//-->\n"; echo "</style>\n"; } // Font size (not for Guests) if (session::logged_in()) { html_include_css(html_get_forum_file_path(sprintf('font_size.php?webtag=%s', $webtag)), 'screen', 'user_font'); } if ($base_target) { echo "<base target=\"{$base_target}\" />\n"; } html_include_javascript(html_get_forum_file_path('js/jquery-1.7.1.min.js')); html_include_javascript(html_get_forum_file_path('js/jquery-ui-1.8.22.autocomplete.min.js')); html_include_javascript(html_get_forum_file_path('js/jquery.parsequery.js')); html_include_javascript(html_get_forum_file_path('js/jquery.sprintf.js')); html_include_javascript(html_get_forum_file_path('js/jquery.url.js')); html_include_javascript(html_get_forum_file_path('js/general.js')); if ($frame_set_html === false) { // Check for any new PMs. if (session::logged_in()) { // Check to see if the PM popup is disabled on the current page. if ($pm_popup_disabled === false) { // Pages we don't want the popup to appear on $pm_popup_disabled_pages = array('admin.php', 'attachments.php', 'change_pw.php', 'confirm_email.php', 'dictionary.php', 'discussion.php', 'display_emoticons.php', 'edit_attachments.php', 'email.php', 'font_size.php', 'forgot_pw.php', 'get_attachment.php', 'index.php', 'mods_list.php', 'nav.php', 'pm.php', 'pm_edit.php', 'pm_folders.php', 'pm_messages.php', 'pm_options.php', 'poll_results.php', 'start.php', 'search_popup.php', 'threads_rss.php', 'user.php', 'user_font.php', 'user_profile.php', 'user_stats.php'); // Check that we're not on one of the pages. if (!in_array(basename($_SERVER['PHP_SELF']), $pm_popup_disabled_pages)) { html_include_javascript(html_get_forum_file_path('js/pm.js')); } } // Overflow auto-resize functionality. $resize_images_page = array('admin_post_approve.php', 'create_poll.php', 'delete.php', 'display.php', 'edit.php', 'edit_poll.php', 'edit_signature.php', 'messages.php', 'post.php', 'pm_write.php', 'pm_edit.php', 'pm_messages.php'); if (in_array(basename($_SERVER['PHP_SELF']), $resize_images_page)) { if (session::get_value('USE_OVERFLOW_RESIZE') == 'Y') { html_include_javascript(html_get_forum_file_path('js/overflow.js')); } } // Mouseover spoiler pages $message_display_pages = array('admin_post_approve.php', 'create_poll.php', 'delete.php', 'display.php', 'edit.php', 'edit_poll.php', 'edit_signature.php', 'ldisplay.php', 'lmessages.php', 'lpost.php', 'messages.php', 'post.php'); if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) { html_include_javascript(html_get_forum_file_path('js/spoiler.js')); } } // Stats Display pages $stats_display_pages = array('messages.php'); if (in_array(basename($_SERVER['PHP_SELF']), $stats_display_pages)) { html_include_javascript(html_get_forum_file_path('js/stats.js')); } } reset($arg_array); foreach ($arg_array as $func_args) { html_include_javascript(html_get_forum_file_path("js/{$func_args}")); } html_include_javascript(html_get_forum_file_path("ckeditor/ckeditor.js")); html_include_javascript(html_get_forum_file_path("ckeditor/adapters/jquery.js")); html_include_javascript(html_get_forum_file_path("json.php?webtag={$webtag}")); if ($frame_set_html === true && ($google_analytics_code = html_get_google_analytics_code())) { echo "<script type=\"text/javascript\">\n\n"; echo " var _gaq = _gaq || [];\n"; echo " _gaq.push(['_setAccount', '{$google_analytics_code}']);\n"; echo " _gaq.push(['_trackPageview']);\n\n"; echo " (function() {\n"; echo " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; echo " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; echo " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; echo " })();\n\n"; echo "</script>\n"; } if ($frame_set_html === false && forum_get_setting('show_share_links', 'Y') && session::get_value('SHOW_SHARE_LINKS') == 'Y') { echo "<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\">\n"; echo "{lang: 'en-GB'}\n"; echo "</script>\n"; echo "<script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script>\n"; } echo "</head>\n\n"; if ($frame_set_html === false) { echo "<body", $body_class ? " class=\"{$body_class}\">\n" : ">\n"; if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) { adsense_output_html(); echo "<br />\n"; } if (forum_get_setting('show_share_links', 'Y') && session::get_value('SHOW_SHARE_LINKS') == 'Y') { echo '<div id="fb-root"></div>'; } } }
echo " </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 " <br />\n"; } } if (forum_check_webtag_available($webtag)) { if ($folder_array = perm_user_get_folders($uid)) { echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\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 class=\"subhead\" align=\"left\">", gettext("Folder Access"), "</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n";
echo " <tr>\n"; echo " <td align=\"left\">", form_radio("to_radio", "others", gettext("Others"), isset($to_radio) && $to_radio == "others" ? true : !isset($to_radio)), "</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" style=\"white-space: nowrap\">", form_input_text_search("t_to_uid_others", isset($t_to_uid_others) ? htmlentities_array($t_to_uid_others) : "", false, false, SEARCH_LOGON, true, sprintf('title="%s"', gettext("Separate recipients by semi-colon or comma")), "post_to_others"), "</td>\n"; echo " </tr>\n"; } else { if (isset($_GET['uid']) && is_numeric($_GET['uid'])) { $to_user = user_get($_GET['uid']); $t_to_uid_others = $to_user['LOGON']; } echo " <tr>\n"; echo " <td align=\"left\" style=\"white-space: nowrap\">", form_input_text_search("t_to_uid_others", isset($t_to_uid_others) ? htmlentities_array($t_to_uid_others) : "", false, false, SEARCH_LOGON, true, sprintf('title="%s"', gettext("Separate recipients by semi-colon or comma")), "post_to_others"), "</td>\n"; echo " </tr>\n"; } if (!is_array($friends_array) && forum_check_webtag_available($webtag)) { echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"><h2>", gettext("Hint"), "</h2><span class=\"smalltext\">", gettext("Add users to your friends list to have them appear in a drop down on the PM Write Message Page."), "</span></td>\n"; echo " </tr>\n"; } echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; if (($user_emoticon_pack = session::get_value('EMOTICONS')) === false) { $user_emoticon_pack = forum_get_setting('default_emoticons', null, 'default'); } if ($emoticon_preview_html = emoticons_preview($user_emoticon_pack)) { echo " <tr>\n";
function forum_check_password($forum_fid) { if (!is_numeric($forum_fid)) { return; } $webtag = get_webtag(); if (!forum_check_webtag_available($webtag)) { return; } if (!($forum_passhash = forum_get_password($forum_fid))) { return; } if (isset($_SESSION["{$webtag}_PASSWORD"]) && is_md5($_SESSION["{$webtag}_PASSWORD"])) { $forum_passhash_check = $_SESSION["{$webtag}_PASSWORD"]; } else { $forum_passhash_check = null; } if (isset($_POST['forum_password']) && strlen($_POST['forum_password']) > 0) { $forum_passhash_check = md5($_POST['forum_password']); } if ($forum_passhash == $forum_passhash_check) { $_SESSION["{$webtag}_PASSWORD"] = $forum_passhash_check; return; } cache_disable(); html_draw_top(array('title' => gettext("Password Protected Forum"))); echo "<h1>", gettext("Password Protected Forum"), "</h1>\n"; if (isset($_SESSION["{$webtag}_PASSWORD"]) && is_md5($_SESSION["{$webtag}_PASSWORD"])) { html_display_error_msg(gettext("The username or password you supplied is not valid."), '550', 'center'); } if (($password_protected_message = forum_get_setting('password_protected_message')) !== false) { echo fix_html($password_protected_message); } else { html_display_warning_msg(gettext("This forum is password protected. To gain access enter the password below."), '400', 'center'); } echo "<br />\n"; echo "<div align=\"center\">\n"; echo " <form accept-charset=\"utf-8\" method=\"post\" action=\"", get_request_uri(), "\" target=\"_self\" autocomplete=\"off\">\n"; echo " ", form_csrf_token_field(), "\n"; 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 " <table cellpadding=\"0\" cellspacing=\"0\" width=\"400\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"400\">\n"; echo " <tr>\n"; echo " <td class=\"posthead\" align=\"center\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">", gettext("Enter Password"), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " <table class=\"posthead\" width=\"90%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">", gettext("Password"), ":</td>\n"; echo " <td align=\"left\">", form_input_password('forum_password', null, 40), "</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" colspan=\"2\"> </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\">", form_submit("logon", gettext("Logon")), " ", form_submit("cancel", gettext("Cancel")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::check_perm(USER_PERM_FORUM_TOOLS, 0)) { html_display_warning_msg(gettext("If you want to change some settings on your forum click the Admin link in the navigation bar above."), '400', 'center'); } echo " </form>\n"; echo "</div>\n"; html_draw_bottom(); exit; }
echo "<a href=\"start.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Start"), "</a> | \n"; echo "<a href=\"discussion.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Messages"), "</a> | \n"; if (forum_get_setting('ajax_chat_enabled', 'Y')) { echo "<a href=\"chat/index.php\" target=\"", html_get_frame_name('main'), "\">", gettext("Chat"), "</a> | \n"; } if (forum_get_setting('show_links', 'Y')) { echo "<a href=\"links.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Links"), "</a> | \n"; } } if (forum_get_setting('show_pms', 'Y')) { echo "<a href=\"pm.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Inbox"), "</a> | \n"; } if (forum_check_webtag_available($webtag)) { echo "<a href=\"user.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("My Controls"), "</a> | \n"; } if (forums_get_available_count() > 1 || !forum_check_webtag_available($webtag)) { echo "<a href=\"forums.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("My Forums"), "</a> | \n"; } if (session::check_perm(USER_PERM_FORUM_TOOLS, 0) || session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::get_folders_by_perm(USER_PERM_FOLDER_MODERATE)) { echo "<a href=\"admin.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Admin"), "</a> | \n"; } if (!session::logged_in()) { echo "<a href=\"index.php?webtag={$webtag}&final_uri=logon.php%3Fwebtag%3D{$webtag}\" target=\"", html_get_top_frame_name(), "\">", gettext("Login"), "</a> | \n"; echo "<a href=\"register.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Register"), "</a>\n"; } else { echo "<a href=\"logout.php?webtag={$webtag}\" target=\"", html_get_top_frame_name(), "\">", gettext("Logout"), " : ", session::get_value('LOGON'), "</a>\n"; } echo "</div>\n"; echo "<div class=\"navright\">\n"; echo forum_links_draw_dropdown('openForumLink'); echo "</div>\n";