Example #1
0
                                 if ($start_page == START_PAGE_THREAD_LIST) {
                                     $final_uri = "start.php?webtag={$webtag}&left=threadlist";
                                 } else {
                                     $final_uri = "start.php?webtag={$webtag}";
                                 }
                             }
                         }
                     } else {
                         $final_uri = "start.php?webtag={$webtag}";
                     }
                 }
             }
         }
     }
 } else {
     if (get_webtag()) {
         if (isset($final_uri) && strlen(trim($final_uri)) > 0) {
             $final_uri = sprintf("forums.php?webtag={$webtag}&webtag_error=true&final_uri=%s", rawurlencode($final_uri));
         } else {
             if (isset($_GET['msg']) && validate_msg($_GET['msg'])) {
                 $final_uri = "forums.php?webtag={$webtag}&webtag_error=true&final_uri=discussion.php%3Fmsg%3D{$_GET['msg']}";
             } else {
                 if (isset($_GET['folder']) && is_numeric($_GET['folder'])) {
                     $final_uri = "forums.php?webtag={$webtag}&webtag_error=true&final_uri=discussion.php%3Ffolder%3D{$_GET['folder']}";
                 } else {
                     if (isset($_GET['pmid']) && is_numeric($_GET['pmid'])) {
                         $final_uri = "forums.php?webtag={$webtag}&webtag_error=true&final_uri=pm.php%3Fmid%3D{$_GET['pmid']}";
                     } else {
                         $final_uri = "forums.php?webtag={$webtag}&webtag_error=true";
                     }
                 }
Example #2
0
function stats_get_html()
{
    // Get webtag
    $webtag = get_webtag();
    // Current active user UID
    $uid = session::get_value('UID');
    // 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&amp;uid=%s" target="_blank" class="popup 650x500"><span class="%s" title="%s">%s</span></a>';
    // Newest ser Profile link
    $new_user_profile_link = '<a href="user_profile.php?webtag=%s&amp;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>';
    // Output the HTML.
    if ($user_stats = stats_get_active_user_list()) {
        $active_user_list_array = array();
        $html = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "  <tr>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "    <td>";
        if (forum_get_setting('guest_show_recent', 'Y') && user_guest_enabled()) {
            if ($user_stats['GUESTS'] != 1) {
                $active_user_list_array[] = sprintf(gettext("<b>%s</b> guests"), $user_stats['GUESTS']);
            } else {
                $active_user_list_array[] = gettext("<b>1</b> guest");
            }
        }
        if ($user_stats['USER_COUNT'] != 1) {
            $active_user_list_array[] = sprintf(gettext("<b>%s</b> members"), $user_stats['USER_COUNT']);
        } else {
            $active_user_list_array[] = gettext("<b>1</b> member");
        }
        if ($user_stats['ANON_USERS'] != 1) {
            $active_user_list_array[] = sprintf(gettext("<b>%s</b> anonymous members"), $user_stats['ANON_USERS']);
        } else {
            $active_user_list_array[] = gettext("<b>1</b> anonymous member");
        }
        $active_user_list = implode(", ", $active_user_list_array);
        $active_user_time = format_time_display(ini_get('session.gc_maxlifetime'), false);
        $html .= sprintf(gettext("%s active in the past %s."), $active_user_list, $active_user_time);
        $html .= " [ <a href=\"start.php?webtag={$webtag}&amp;show=visitors\" target=\"" . html_get_frame_name('main') . "\">" . gettext("View Complete List") . "</a> ]\n";
        $html .= "    </td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        if (sizeof($user_stats['USERS']) > 0) {
            $active_users_array = array();
            foreach ($user_stats['USERS'] as $user) {
                $active_user_title = '';
                $active_user_class = '';
                $active_user_avatar = '';
                if (isset($user['BOT_NAME']) && isset($user['BOT_URL'])) {
                    $active_user_display = word_filter_add_ob_tags($user['BOT_NAME'], true);
                    $active_user_display = sprintf($search_engine_bot_link, $user['BOT_URL'], $active_user_display);
                    $active_users_array[] = $active_user_display;
                } else {
                    $active_user_logon = format_user_name($user['LOGON'], $user['NICKNAME']);
                    $active_user_display = str_replace(" ", "&nbsp;", word_filter_add_ob_tags($active_user_logon, true));
                    if ($user['UID'] == $uid) {
                        if (isset($user['ANON_LOGON']) && $user['ANON_LOGON'] > USER_ANON_DISABLED) {
                            $active_user_title = gettext("You (Invisible)");
                            $active_user_class = 'user_stats_curuser';
                        } else {
                            $active_user_title = gettext("You");
                            $active_user_class = 'user_stats_curuser';
                        }
                    } else {
                        if (($user['RELATIONSHIP'] & USER_FRIEND) > 0) {
                            $active_user_title = gettext("Friend");
                            $active_user_class = 'user_stats_friend';
                        } else {
                            $active_user_class = 'user_stats_normal';
                        }
                    }
                    if (isset($user['AVATAR_URL']) && strlen($user['AVATAR_URL']) > 0) {
                        $active_user_avatar = sprintf('<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500">
                                                         <img src="%s" title="%s" alt="" border="0" width="16" height="16" />
                                                       </a>', $webtag, $user['UID'], $user['AVATAR_URL'], htmlentities_array($active_user_title));
                    } else {
                        if (isset($user['AVATAR_AID']) && is_md5($user['AVATAR_AID'])) {
                            $attachment = attachments_get_by_hash($user['AVATAR_AID']);
                            if (!($user_avatar_picture = attachments_make_link($attachment, false, false, false, false))) {
                                $active_user_avatar = sprintf('<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500">
                                                             <img src="%s&amp;avatar_picture" title="%s" alt="" border="0" width="16" height="16" />
                                                           </a>', $webtag, $user['UID'], $user_avatar_picture, htmlentities_array($active_user_title));
                            }
                        }
                    }
                    $active_users_array[] = sprintf($user_profile_link, $active_user_avatar, $webtag, $user['UID'], $active_user_class, $active_user_title, $active_user_display);
                }
            }
            $html .= "  <tr>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "    <td>&nbsp;</td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
            $html .= "  <tr>";
            $html .= "    <td>&nbsp;</td>\n";
            $html .= "    <td class=\"activeusers\">\n";
            $html .= "      " . implode(", ", $active_users_array) . "\n";
            $html .= "    </td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
        }
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "</table>\n";
    }
    $thread_count = stats_get_thread_count();
    $post_count = stats_get_post_count();
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>";
    if ($thread_count != 1) {
        $num_threads_display = sprintf(gettext("<b>%s</b> threads"), number_format($thread_count, 0, ".", ","));
    } else {
        $num_threads_display = gettext("<b>1</b> thread");
    }
    if ($post_count != 1) {
        $num_posts_display = sprintf(gettext("<b>%s</b> posts"), number_format($post_count, 0, ".", ","));
    } 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 .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    if ($longest_thread = stats_get_longest_thread()) {
        $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\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}&amp;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"), $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 .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "</table>\n";
    }
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>";
    if ($recent_post_count != 1) {
        $recent_post_count = number_format($recent_post_count, 0, ",", ",");
        $html .= sprintf(gettext("There have been <b>%s</b> posts made in the last 60 minutes."), $recent_post_count);
    } else {
        $html .= gettext("There has been <b>1</b> post made in the last 60 minutes.");
    }
    $html .= "    </td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    if ($most_posts = stats_get_most_posts()) {
        if ($most_posts['MOST_POSTS_COUNT'] > 0 && $most_posts['MOST_POSTS_DATE'] > 0) {
            $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
            $html .= "  <tr>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "    <td>";
            $post_stats_record_date = format_time($most_posts['MOST_POSTS_DATE']);
            $html .= sprintf(gettext("Most posts ever made in a single 60 minute period is <b>%s</b> on %s."), $most_posts['MOST_POSTS_COUNT'], $post_stats_record_date);
            $html .= "    </td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
            $html .= "</table>\n";
        }
    }
    if ($user_count = user_count()) {
        $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>";
        if ($user_count != 1) {
            if ($newest_member = stats_get_newest_user()) {
                $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>."), $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 .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "</table>\n";
    }
    if ($most_users = stats_get_most_users()) {
        if ($most_users['MOST_USERS_COUNT'] > 0 && $most_users['MOST_USERS_DATE'] > 0) {
            $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
            $html .= "  <tr>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "    <td>";
            $most_users_count = number_format($most_users['MOST_USERS_COUNT'], 0, ",", ",");
            $most_users_date = format_time($most_users['MOST_USERS_DATE']);
            $html .= sprintf(gettext("Most users ever online was <b>%s</b> on %s."), $most_users_count, $most_users_date);
            $html .= "    </td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
            $html .= "</table>\n";
        }
    }
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    // Return the output buffer contents.
    return $html;
}
Example #3
0
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();
    $request_uri = basename($_SERVER['PHP_SELF']);
    $query_string_array = array();
    unset($_GET['webtag']);
    if ($include_webtag) {
        $query_string_array['webtag'] = $webtag;
    }
    $query_string_array += array_diff($_GET, $query_string_array);
    $query_string = http_build_query($query_string_array, null, $encode_uri_query ? '&amp;' : '&');
    return sprintf('%s?%s', $request_uri, $query_string);
}
Example #4
0
// 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");
}
Example #5
0
function form_quick_button($href, $label, $var_array = false, $target = "_self")
{
    $webtag = get_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'), $label);
    $html .= "</form>";
    return $html;
}
Example #6
0
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;
}
Example #7
0
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;
}
Example #8
0
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>";
}
Example #9
0
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 ? '&amp;' : '&');
    return strlen($query_string) > 0 ? sprintf('%s?%s', $request_uri, $query_string) : $request_uri;
}
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 = forum_get_setting('attachment_dir'))) {
        return false;
    }
    if (!isset($attachment['aid'])) {
        return false;
    }
    if (!isset($attachment['hash'])) {
        return false;
    }
    if (!isset($attachment['filename'])) {
        return false;
    }
    if (!isset($attachment['downloads'])) {
        return false;
    }
    if (!is_md5($attachment['aid'])) {
        return false;
    }
    if (!is_md5($attachment['hash'])) {
        return false;
    }
    $webtag = get_webtag();
    if (forum_get_setting('attachment_thumbnails', 'Y') && (($user_show_thumbs = session::get_value('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 {
        $thumbnail_max_size = 100;
        $show_thumbs = false;
    }
    if ($local_path) {
        $attachment_href = "attachments/{$attachment['filename']}";
    } else {
        $attachment_href = "get_attachment.php?webtag={$webtag}&amp;hash={$attachment['hash']}";
        $attachment_href .= "&amp;filename={$attachment['filename']}";
    }
    if ($img_tag === true) {
        $title_array = array();
        if (mb_strlen($attachment['filename']) > 16 && $limit_filename) {
            $title_array[] = gettext("Filename") . ": {$attachment['filename']}";
            $attachment['filename'] = mb_substr($attachment['filename'], 0, 16);
            $attachment['filename'] .= "&hellip;";
        }
        if (isset($attachment['filesize']) && is_numeric($attachment['filesize'])) {
            $title_array[] = gettext("Size") . ": " . 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 (@file_exists("{$attachment_dir}/{$attachment['hash']}.thumb") && $show_thumbs) {
            if (@($image_info = getimagesize("{$attachment_dir}/{$attachment['hash']}"))) {
                $title_array[] = gettext("Dimensions") . ": {$image_info[0]}x{$image_info[1]}px";
                $thumbnail_width = $image_info[0];
                $thumbnail_height = $image_info[1];
                while ($thumbnail_width > $thumbnail_max_size || $thumbnail_height > $thumbnail_max_size) {
                    $thumbnail_width--;
                    $thumbnail_height = floor($thumbnail_width * ($image_info[1] / $image_info[0]));
                }
                $title = implode(", ", $title_array);
                $attachment_link = "<span class=\"attachment_thumb\"><a href=\"{$attachment_href}\" title=\"{$title}\" ";
                $attachment_link .= "target=\"_blank\"><img src=\"{$attachment_href}&amp;thumb=1\"";
                $attachment_link .= "border=\"0\" width=\"{$thumbnail_width}\" height=\"{$thumbnail_height}\"";
                $attachment_link .= "alt=\"{$title}\" title=\"{$title}\" /></a></span>";
                return $attachment_link;
            }
        }
        $title = implode(", ", $title_array);
        $attachment_link = "<img src=\"";
        $attachment_link .= html_style_image('attach.png');
        $attachment_link .= "\" width=\"14\" height=\"14\" border=\"0\" ";
        $attachment_link .= "alt=\"" . gettext("Attachment") . "\" ";
        $attachment_link .= "title=\"" . gettext("Attachment") . "\" />";
        $attachment_link .= "<a href=\"{$attachment_href}\" title=\"{$title}\" ";
        $attachment_link .= "target=\"_blank\">{$attachment['filename']}</a>\n";
        return $attachment_link;
    }
    return $attachment_href;
}
Example #11
0
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\">&nbsp;", gettext("From"), ":&nbsp;</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\">&nbsp;", gettext("From"), ":&nbsp;</span></td>\n";
        echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\"><a href=\"user_profile.php?webtag={$webtag}&amp;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>&nbsp;</span></td>\n";
    } else {
        echo "                        <td align=\"right\" style=\"white-space: nowrap\"><span class=\"postinfo\">", format_date_time($message_data['CREATED']), "&nbsp;</span></td>\n";
    }
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("Subject"), ":&nbsp;</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\">&nbsp;", gettext("To"), ":&nbsp;</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}&amp;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\">&nbsp;</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"), "&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;reply_to={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Reply"), "</a>&nbsp;\n";
            if (isset($message_data['RECIPIENTS']) && sizeof($message_data['RECIPIENTS']) > 1) {
                echo "", html_style_image('reply_all', "Reply All"), "&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;replyall={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Reply All"), "</a>&nbsp;\n";
            }
            echo "", html_style_image('forward', "Forward"), "&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;fwdmsg={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a>&nbsp;\n";
        } else {
            if ($message_data['TYPE'] & PM_DRAFT_ITEMS) {
                echo "", html_style_image('edit', "Edit"), "&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;editmsg={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Edit"), "</a>&nbsp;\n";
            } else {
                if ($message_data['EDITABLE'] == 1) {
                    echo "", html_style_image('post', "Edit"), "&nbsp;<a href=\"pm_edit.php?webtag={$webtag}&amp;mid={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Edit"), "</a>&nbsp;\n";
                }
                echo "", html_style_image('forward', "Forward"), "&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;fwdmsg={$message_data['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a>&nbsp;\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";
}
Example #12
0
function pm_display($pm_message_array, $folder, $preview = false, $export_html = false)
{
    $webtag = get_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 ($folder == PM_FOLDER_INBOX) {
        if ($export_html === true) {
            echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("From"), ":&nbsp;</span></td>\n";
            echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", word_filter_add_ob_tags(format_user_name($pm_message_array['FLOGON'], $pm_message_array['FNICK']), true), "</span></td>\n";
        } else {
            echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("From"), ":&nbsp;</span></td>\n";
            echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\"><a href=\"user_profile.php?webtag={$webtag}&amp;uid={$pm_message_array['FROM_UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($pm_message_array['FLOGON'], $pm_message_array['FNICK']), true), "</a></span></td>\n";
        }
    } else {
        if (isset($pm_message_array['RECIPIENTS']) && strlen(trim($pm_message_array['RECIPIENTS'])) > 0) {
            $recipient_array = preg_split("/[;|,]/u", trim($pm_message_array['RECIPIENTS']));
            if ($pm_message_array['TO_UID'] > 0) {
                $recipient_array = array_unique(array_merge($recipient_array, array($pm_message_array['TLOGON'])));
            }
            if ($export_html === false) {
                $recipient_array = array_map('user_profile_popup_callback', $recipient_array);
            }
            echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("To"), ":&nbsp;</span></td>\n";
            echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", word_filter_add_ob_tags(implode('; ', $recipient_array)), "</span></td>\n";
        } else {
            if (is_array($pm_message_array['TLOGON'])) {
                $recipient_array = array_unique($pm_message_array['TLOGON']);
                if ($export_html === false) {
                    $recipient_array = array_map('user_profile_popup_callback', $recipient_array);
                }
                echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("To"), ":&nbsp;</span></td>\n";
                echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", word_filter_add_ob_tags(implode('; ', $recipient_array)), "</span></td>\n";
            } else {
                if (isset($pm_message_array['TO_UID']) && is_numeric($pm_message_array['TO_UID'])) {
                    if ($export_html === true) {
                        echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("To"), ":&nbsp;</span></td>\n";
                        echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofromlabel\">", word_filter_add_ob_tags(format_user_name($pm_message_array['TLOGON'], $pm_message_array['TNICK']), true), "</span></td>\n";
                    } else {
                        echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("To"), ":&nbsp;</span></td>\n";
                        echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofromlabel\"><a href=\"user_profile.php?webtag={$webtag}&amp;uid={$pm_message_array['TO_UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($pm_message_array['TLOGON'], $pm_message_array['TNICK']), true), "</a></span></td>\n";
                    }
                } else {
                    echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("To"), ":&nbsp;</span></td>\n";
                    echo "                        <td align=\"left\" class=\"postbody\"><i>", gettext("No Recipients"), "</i></td>\n";
                }
            }
        }
    }
    // Add emoticons/wikilinks and word filter tags
    $pm_message_array['CONTENT'] = message_apply_formatting($pm_message_array['CONTENT']);
    $pm_message_array['CONTENT'] = word_filter_add_ob_tags($pm_message_array['CONTENT']);
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("Subject"), ":&nbsp;</span></td>\n";
    if (strlen(trim($pm_message_array['SUBJECT'])) > 0) {
        echo "                        <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">", word_filter_add_ob_tags($pm_message_array['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";
    }
    if (isset($pm_message_array['TYPE']) && ($pm_message_array['TYPE'] & PM_SAVED_DRAFT) > 0) {
        echo "                        <td align=\"right\" style=\"white-space: nowrap\"><span class=\"postinfo\"><i>", gettext("Not Sent"), "</i>&nbsp;</span></td>\n";
    } else {
        echo "                        <td align=\"right\" style=\"white-space: nowrap\"><span class=\"postinfo\">", format_time($pm_message_array['CREATED']), "&nbsp;</span></td>\n";
    }
    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\">&nbsp;</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td class=\"postbody\" align=\"left\">{$pm_message_array['CONTENT']}</td>\n";
    echo "                      </tr>\n";
    if (isset($pm_message_array['AID'])) {
        $aid = $pm_message_array['AID'];
        $attachments_array = array();
        $image_attachments_array = array();
        if (attachments_get($pm_message_array['FROM_UID'], $aid, $attachments_array, $image_attachments_array)) {
            // Draw the attachment header at the bottom of the post
            echo "                      <tr>\n";
            echo "                        <td class=\"postbody\" align=\"left\">\n";
            if (is_array($attachments_array) && sizeof($attachments_array) > 0) {
                echo "                              <p><b>", gettext("Attachments"), ":</b><br />\n";
                foreach ($attachments_array as $attachment) {
                    echo "                              ", attachments_make_link($attachment, true, false, $export_html), "<br />\n";
                }
                echo "                              </p>\n";
            }
            if (is_array($image_attachments_array) && sizeof($image_attachments_array) > 0) {
                echo "                              <p><b>", gettext("Image Attachments"), ":</b><br />\n";
                foreach ($image_attachments_array as $attachment) {
                    echo "                              ", attachments_make_link($attachment, true, false, $export_html), "\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";
    if ($preview === false) {
        if ($folder == PM_FOLDER_INBOX) {
            echo "                        <td align=\"center\"><img src=\"", html_style_image('post.png'), "\" border=\"0\" alt=\"", gettext("Reply"), "\" title=\"", gettext("Reply"), "\" />&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;replyto={$pm_message_array['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Reply"), "</a>&nbsp;&nbsp;<img src=\"", html_style_image('forward.png'), "\" border=\"0\" alt=\"", gettext("Forward"), "\" title=\"", gettext("Forward"), "\" />&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;fwdmsg={$pm_message_array['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a></td>\n";
        } else {
            if ($folder == PM_FOLDER_OUTBOX) {
                echo "                        <td align=\"center\"><img src=\"", html_style_image('post.png'), "\" border=\"0\" alt=\"", gettext("Edit"), "\" title=\"", gettext("Edit"), "\" />&nbsp;<a href=\"pm_edit.php?webtag={$webtag}&amp;mid={$pm_message_array['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Edit"), "</a>&nbsp;&nbsp;<img src=\"", html_style_image('forward.png'), "\" border=\"0\" alt=\"", gettext("Forward"), "\" title=\"", gettext("Forward"), "\" />&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;fwdmsg={$pm_message_array['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a></td>\n";
            } else {
                if ($folder == PM_FOLDER_DRAFTS) {
                    echo "                        <td align=\"center\"><img src=\"", html_style_image('edit.png'), "\" border=\"0\" alt=\"", gettext("Edit"), "\" title=\"", gettext("Edit"), "\" />&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;editmsg={$pm_message_array['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Edit"), "</a></td>\n";
                } else {
                    echo "                        <td align=\"center\"><img src=\"", html_style_image('forward.png'), "\" border=\"0\" alt=\"", gettext("Forward"), "\" title=\"", gettext("Forward"), "\" />&nbsp;<a href=\"pm_write.php?webtag={$webtag}&amp;fwdmsg={$pm_message_array['MID']}\" target=\"", html_get_frame_name('main'), "\">", gettext("Forward"), "</a></td>\n";
                }
            }
        }
    } else {
        echo "                        <td align=\"center\">&nbsp;</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";
}
Example #13
0
function admin_check_credentials()
{
    $webtag = get_webtag();
    if (($admin_timeout = session::get_value('ADMIN_TIMEOUT')) && $admin_timeout > time()) {
        session::set_value('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::get_value('UID')) {
            session::set_value('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();
    if (isset($error_message) && strlen(trim($error_message)) > 0) {
        html_display_error_msg($error_message, '500', 'center');
    }
    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=\"_self\" autocomplete=\"off\">\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', '', 24, 32, '', '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', '', 24, 32, '', 'bhinputlogon'), "</td>\n";
    echo "                        </tr>\n";
    echo "                        <tr>\n";
    echo "                          <td align=\"left\">&nbsp;</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\">&nbsp;</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;
}
Example #14
0
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;
}
Example #15
0
function email_send_link_approval_notification($tuid)
{
    // Validate function arguments
    if (!is_numeric($tuid)) {
        return false;
    }
    // Get the to user details
    if (!($to_user = user_get($tuid))) {
        return false;
    }
    // Get the Swift Mailer Transport
    if (!($transport = Swift_TransportFactory::get())) {
        return false;
    }
    //Create the Mailer using the returned Transport
    $mailer = Swift_Mailer::newInstance($transport);
    // Create a new message
    $message = Swift_MessageBeehive::newInstance();
    // Get Forum Webtag
    $webtag = get_webtag();
    // Validate the email address before we continue.
    if (!email_address_valid($to_user['EMAIL'])) {
        return false;
    }
    // Get the forum name, subject, recipient. Pass all of them through the recipient's word filter.
    $forum_name = word_filter_apply(forum_get_setting('forum_name', null, 'A Beehive Forum'), $tuid, true);
    $subject = word_filter_apply(sprintf(gettext("Link Approval Notification for %s"), $forum_name), $tuid, true);
    $recipient = word_filter_apply(format_user_name($to_user['LOGON'], $to_user['NICKNAME']), $tuid, true);
    // Generate the confirmation link.
    $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}");
    // Generate the message body.
    $message_body = wordwrap(sprintf(gettext("Hello %s,\r\n\r\nA new link has been created on %s.\r\n\r\nAs you are a Link Moderator on this forum you are required to approve this link before it can be read by other users.\r\n\r\nYou can approve this link and any others pending approval by visiting the Admin Link Approval section of your forum or by clicking the link below:\r\n\r\n%s\r\n\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nNote: Other Administrators on this forum will also receive this notification and may have already acted upon this request."), $recipient, $forum_name, $admin_post_approval_link));
    // Add the recipient
    $message->setTo($to_user['EMAIL'], $recipient);
    // Set the subject
    $message->setSubject($subject);
    // Set the message body
    $message->setBody($message_body);
    // Send the email
    return $mailer->send($message) > 0;
}
Example #16
0
function emoticons_preview($emoticon_set, $width = 190, $height = 100)
{
    $webtag = get_webtag();
    // Make sure the emoticon set has no path info.
    $emoticon_set = basename($emoticon_set);
    // Check the emoticon set exists.
    if (!emoticons_set_exists($emoticon_set)) {
        $emoticon_set = basename(forum_get_setting('default_emoticons', null, 'default'));
    }
    // No previews for text / no emoticons
    if ($emoticon_set == 'text' || $emoticon_set == 'none') {
        return false;
    }
    // Array to hold text to emoticon lookups.
    $emoticon = array();
    // Include the emoticon pack.
    if (@file_exists("emoticons/{$emoticon_set}/definitions.php")) {
        include "emoticons/{$emoticon_set}/definitions.php";
    }
    // Check it has some emoticons in it!
    if (sizeof($emoticon) == 0) {
        return false;
    }
    // Remove duplicate matches
    $emoticon = array_unique($emoticon);
    // HTML container
    $html = "<div style=\"width: {$width}px; height: {$height}px\" class=\"emoticon_preview\">";
    // Array to hold emoticon preview images
    $emoticon_preview = array();
    // Iterate over the emoticons and generate HTML
    foreach ($emoticon as $emot_text => $emot_class) {
        $emoticon_preview[] = sprintf('<span class="emoticon e_%1$s" title="%2$s"><span class="e__">%2$s</span></span>', $emot_class, $emot_text);
    }
    // Add the emoticons to the HTML.
    $html .= implode(' ', $emoticon_preview);
    // Close the container.
    $html .= "</div>";
    // Return the HTML.
    return $html;
}
Example #17
0
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);
}
Example #18
0
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}&amp;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;
        }
    }
}
Example #19
0
function poll_public_ballot_user_callback($user_data)
{
    $webtag = get_webtag();
    if (isset($user_data['UID']) && $user_data['UID'] > 0) {
        $user_profile_link_html = "<a href=\"user_profile.php?webtag={$webtag}&amp;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");
}
Example #20
0
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}&amp;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}&amp;msg={$tid}.1"), "\" />\n";
                echo "<link rel=\"last\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&amp;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}&amp;msg={$tid}.{$next_page}"), "\" />\n";
                }
                if ($pid > 1) {
                    echo "<link rel=\"prev\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&amp;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}&amp;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>';
    }
}
Example #21
0
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\">&nbsp;</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\">&nbsp;</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\">&nbsp;</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}&amp;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}&amp;delete_cookie=yes&amp;final_uri={$final_uri}\" target=\"", html_get_top_frame_name(), "\">", gettext("Delete Cookies"), "</a></p>\n";
            echo "<p><a href=\"index.php?webtag={$webtag}&amp;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}&amp;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}&amp;delete_cookie=yes\" target=\"", html_get_top_frame_name(), "\">", gettext("Delete Cookies"), "</a></p>\n";
            echo "<p><a href=\"index.php?webtag={$webtag}&amp;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}&amp;view=mobile\" target=\"", html_get_top_frame_name(), "\">", gettext("Mobile version"), "</a></p>\n";
    }
}
function user_profile_popup_callback($logon)
{
    $webtag = get_webtag();
    return "<a href=\"user_profile.php?webtag={$webtag}&amp;logon={$logon}\" class=\"popup 650x500\" target=\"_blank\">{$logon}</a>";
}
Example #23
0
function messages_forum_stats($tid, $pid)
{
    $webtag = get_webtag();
    if (forum_get_setting('show_stats', 'Y')) {
        echo "<br />\n";
        echo "<div align=\"center\">\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 "                            &nbsp;";
        } else {
            if (session::get_value("SHOW_STATS") == "Y") {
                echo "                            ", form_submit_image('hide.png', 'forum_stats_toggle', 'hide', '', 'button_image toggle_button'), "\n";
            } else {
                echo "                            ", form_submit_image('show.png', 'forum_stats_toggle', 'show', '', '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() || session::get_value("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 align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"active_user_counts\"></td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" class=\"activeusers\" id=\"active_user_list\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"thread_stats\">&nbsp;<br />&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"post_stats\">&nbsp;<br />&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"user_stats\">&nbsp;<br />&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</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";
    }
}
Example #24
0
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}&amp;msg={$tid}.1"), "\" />\n";
            echo "<link rel=\"previous\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;msg={$tid}.{$thread_data['LENGTH']}"), "\" />\n";
            echo "<link rel=\"next\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;msg={$tid}.{$next_page}"), "\" />\n";
            echo "<link rel=\"last\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;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}&amp;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&amp;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>';
        }
    }
}
Example #25
0
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")), "&nbsp;<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")), "&nbsp;<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")), "&nbsp;<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")), "&nbsp;<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)), "&nbsp;", 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 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}&amp;hash={$attachment['hash']}";
        $attachment_href .= "&amp;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}&amp;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;
}
Example #27
0
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}&amp;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}&amp;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}&amp;fid={$val}\">" . word_filter_add_ob_tags($folders[$val]['NAME'], true) . "</a>" : " &gt; " . 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) : " &gt; " . word_filter_add_ob_tags($folders[$val]['NAME'], true);
            }
        }
    }
    return $result;
}
Example #28
0
function forum_save_start_page($content)
{
    $webtag = get_webtag($webtag_search);
    if (@(!is_dir("forums"))) {
        @mkdir("forums", 0755);
    }
    if (@(!is_dir("forums/{$webtag}"))) {
        @mkdir("forums/{$webtag}", 0755);
    }
    $content = forum_start_page_get_html($content);
    if (@($fp = fopen("forums/{$webtag}/start_main.php", "w"))) {
        fwrite($fp, $content);
        fclose($fp);
        return true;
    }
    return false;
}
Example #29
0
function forum_check_password($forum_fid)
{
    if (!is_numeric($forum_fid)) {
        return false;
    }
    $webtag = get_webtag();
    if (!($forum_passhash = forum_get_password($forum_fid))) {
        return true;
    }
    $forum_passhash_check = session::get_value("{$webtag}_PASSWORD");
    if (isset($_POST['forum_password']) && strlen($_POST['forum_password']) > 0) {
        $forum_passhash_check = md5($_POST['forum_password']);
    }
    if ($forum_passhash == $forum_passhash_check) {
        session::set_value("{$webtag}_PASSWORD", $forum_passhash_check);
        return true;
    }
    html_draw_top(sprintf("title=%s", gettext("Password Protected Forum")));
    echo "<h1>", gettext("Password Protected Forum"), "</h1>\n";
    if (session::get_value("{$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')) {
        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";
    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', '', 40, false, ''), "</td>\n";
    echo "                  </tr>\n";
    echo "                  <tr>\n";
    echo "                    <td align=\"left\" colspan=\"2\">&nbsp;</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\">&nbsp;</td>\n";
    echo "      </tr>\n";
    echo "      <tr>\n";
    echo "        <td align=\"center\">", form_submit("logon", gettext("Logon")), "&nbsp;", 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;
}
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 "                            &nbsp;";
        } 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\">&nbsp;</td>\n";
        echo "                            <td>&nbsp;</td>\n";
        echo "                            <td rowspan=\"19\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        for ($i = 0; $i < 18; $i++) {
            echo "                          <tr>\n";
            echo "                            <td>&nbsp;</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";
    }
}