function attachments_delete_thumbnail($hash)
{
    if (!is_md5($hash)) {
        return false;
    }
    if (!($db = db::get())) {
        return false;
    }
    if (!isset($_SESSION['UID']) || !is_numeric($_SESSION['UID'])) {
        return false;
    }
    if (!($attachment_dir = attachments_check_dir())) {
        return false;
    }
    $sql = "SELECT PAF.AID, PAF.UID, PAF.FILENAME, PAI.TID, ";
    $sql .= "PAI.PID FROM POST_ATTACHMENT_FILES PAF ";
    $sql .= "LEFT JOIN POST_ATTACHMENT_IDS PAI ON (PAI.AID = PAF.AID) ";
    $sql .= "WHERE PAF.HASH = '{$hash}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    $attachment_data = $result->fetch_assoc();
    if (!isset($attachment_data['FID'])) {
        $attachment_data['FID'] = 0;
    }
    if (!($attachment_data['UID'] == $_SESSION['UID'] || session::check_perm(USER_PERM_FOLDER_MODERATE, $attachment_data['FID']))) {
        return false;
    }
    if (isset($attachment_data['TID']) && isset($attachment_data['PID'])) {
        post_add_edit_text($attachment_data['TID'], $attachment_data['PID']);
        if (session::check_perm(USER_PERM_FOLDER_MODERATE, $attachment_data['FID']) && $attachment_data['UID'] != $_SESSION['UID']) {
            $log_data = array($attachment_data['TID'], $attachment_data['PID'], $attachment_data['FILENAME']);
            admin_add_log_entry(ATTACHMENTS_DELETE, $log_data);
        }
    }
    @unlink("{$attachment_dir}/{$hash}.thumb");
    return true;
}
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'lang.inc.php';
require_once BH_INCLUDE_PATH . 'logon.inc.php';
require_once BH_INCLUDE_PATH . 'post.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'sphinx.inc.php';
require_once BH_INCLUDE_PATH . 'styles.inc.php';
require_once BH_INCLUDE_PATH . 'text_captcha.inc.php';
require_once BH_INCLUDE_PATH . 'user.inc.php';
// Check we're logged in correctly
if (!session::logged_in()) {
    html_guest_error();
}
// Check we have Admin / Moderator access
if (!session::check_perm(USER_PERM_FORUM_TOOLS, 0, 0)) {
    html_draw_error(gettext("You do not have permission to use this section."));
}
// Perform additional admin login.
admin_check_credentials();
// Get the user's post page preferences.
$page_prefs = session::get_post_page_prefs();
// Array to hold error messages
$error_msg_array = array();
// Text captcha class
$text_captcha = new captcha(6, 15, 25, 9, 30);
// Array of valid periods for the unread cutoff
$unread_cutoff_periods = array(UNREAD_MESSAGES_DISABLED => gettext("Disable unread messages"), THIRTY_DAYS_IN_SECONDS => gettext("30 Days"), SIXTY_DAYS_IN_SECONDS => gettext("60 Days"), NINETY_DAYS_IN_SECONDS => gettext("90 Days"), HUNDRED_EIGHTY_DAYS_IN_SECONDS => gettext("180 Days"), YEAR_IN_SECONDS => gettext("1 year"));
// Array of valid periods for the sitemap frequency
$sitemap_freq_periods = array(DAY_IN_SECONDS => gettext("Once a day"), WEEK_IN_SECONDS => gettext("Once a Week"));
// Array of valid Google Adsense ad user account types
         $valid = false;
     }
     if (isset($_POST['title']) && strlen(trim($_POST['title'])) > 0) {
         $title = trim($_POST['title']);
     } else {
         $error_msg_array[] = gettext("You must specify a name!");
         $valid = false;
     }
     if (isset($_POST['description']) && strlen(trim($_POST['description'])) > 0) {
         $description = trim($_POST['description']);
     } else {
         $description = "";
     }
     if ($valid) {
         links_update($lid, $fid, $_SESSION['UID'], $title, $uri, $description);
         if (session::check_perm(USER_PERM_FOLDER_MODERATE, 0) && $link['UID'] != $_SESSION['UID']) {
             admin_add_log_entry(DELETE_LINK, array($lid));
         }
         header_redirect("links_detail.php?webtag={$webtag}&lid={$lid}&fid={$fid}");
     }
 }
 if ($user_perm_links_moderate || $link['UID'] == $_SESSION['UID']) {
     if (isset($_POST['hide']) && $_POST['hide'] == "confirm") {
         links_change_visibility($lid, false);
     } else {
         if (!isset($_POST['hide']) || isset($_POST['hide']) && $_POST['hide'] != "confirm") {
             links_change_visibility($lid, true);
         }
     }
     header_redirect("links_detail.php?webtag={$webtag}&lid={$lid}&fid={$fid}");
 }
                $admin_edit = true;
            } else {
                html_draw_error(gettext("No user specified."));
            }
        } else {
            $uid = session::get_value('UID');
        }
    }
    if (isset($_POST['cancel'])) {
        header_redirect("admin_user.php?webtag={$webtag}&uid={$uid}");
        exit;
    }
} else {
    $uid = session::get_value('UID');
}
if (!session::check_perm(USER_PERM_ADMIN_TOOLS, 0) && $uid != session::get_value('UID')) {
    html_draw_error(gettext("You do not have permission to use this section."));
}
// Fetch array of profile items.
$profile_items_array = profile_get_user_values($uid);
// Array to hold error messages
$error_msg_array = array();
// Do updates
if (isset($_POST['save'])) {
    $valid = true;
    if (isset($_POST['t_entry']) && is_array($_POST['t_entry'])) {
        $t_entry_array = $_POST['t_entry'];
        $t_entry_cleaned_array = array_map('strip_tags', $t_entry_array);
        if (sizeof(array_diff_assoc($t_entry_array, $t_entry_cleaned_array)) > 0) {
            $error_msg_array[] = gettext("Profile Entries must not include HTML");
            $valid = false;
Beispiel #5
0
function thread_merge($tida, $tidb, $merge_type, &$error_str)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($tida)) {
        return false;
    }
    if (!is_numeric($tidb)) {
        return false;
    }
    if (!in_array($merge_type, array(THREAD_MERGE_BY_CREATED, THREAD_MERGE_START, THREAD_MERGE_END))) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return thread_merge_error(THREAD_MERGE_FORUM_ERROR, $error_str);
    }
    if (!($forum_fid = get_forum_fid())) {
        return thread_merge_error(THREAD_MERGE_FORUM_ERROR, $error_str);
    }
    // Get Thread A data
    if (!($threada = thread_get($tida))) {
        return thread_merge_error(THREAD_MERGE_THREAD_ERROR, $error_str);
    }
    // Get Thread B data
    if (!($threadb = thread_get($tidb))) {
        return thread_merge_error(THREAD_MERGE_THREAD_ERROR, $error_str);
    }
    // Check the threads aren't polls.
    if ($threada['POLL_FLAG'] == 'Y' || $threadb['POLL_FLAG'] == 'Y') {
        return thread_merge_error(THREAD_MERGE_POLL_ERROR, $error_str);
    }
    // Check thread A permissions
    if (!session::check_perm(USER_PERM_FOLDER_MODERATE, $threada['FID'])) {
        return thread_merge_error(THREAD_MERGE_PERMS_ERROR, $error_str);
    }
    // Check thread B permissions
    if (!session::check_perm(USER_PERM_FOLDER_MODERATE, $threada['FID'])) {
        return thread_merge_error(THREAD_MERGE_PERMS_ERROR, $error_str);
    }
    // Close thread A
    thread_set_closed($tida, true);
    // Close thread B
    thread_set_closed($tidb, true);
    // Create new thread. Mark it as deleted so user's cannot see it.
    if (!($new_tid = post_create_thread($threada['FID'], $threada['BY_UID'], $threada['TITLE'], 'N', 'N', true, true))) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_CREATE_ERROR, $error_str);
    }
    // Construct query to correctly sort the posts in the new thread.
    switch ($merge_type) {
        case THREAD_MERGE_BY_CREATED:
            $sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, ";
            $sql .= "FROM_UID, TO_UID, VIEWED, CREATED, STATUS, APPROVED, APPROVED_BY, ";
            $sql .= "EDITED, EDITED_BY, IPADDRESS, MOVED_TID, MOVED_PID) ";
            $sql .= "SELECT '{$new_tid}', REPLY_TO_PID, FROM_UID, TO_UID, NULL, NOW(), ";
            $sql .= "STATUS, APPROVED, APPROVED_BY, EDITED, EDITED_BY, IPADDRESS, TID, ";
            $sql .= "PID FROM `{$table_prefix}POST` WHERE TID IN ('{$tida}', '{$tidb}') ";
            $sql .= "ORDER BY CREATED";
            break;
        case THREAD_MERGE_START:
            $sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, ";
            $sql .= "FROM_UID, TO_UID, VIEWED, CREATED, STATUS, APPROVED, APPROVED_BY, ";
            $sql .= "EDITED, EDITED_BY, IPADDRESS, MOVED_TID, MOVED_PID) ";
            $sql .= "SELECT '{$new_tid}', REPLY_TO_PID, FROM_UID, TO_UID, NULL, NOW(), ";
            $sql .= "STATUS, APPROVED, APPROVED_BY, EDITED, EDITED_BY, IPADDRESS, TID, ";
            $sql .= "PID FROM `{$table_prefix}POST` WHERE TID IN ('{$tida}', '{$tidb}') ";
            $sql .= "ORDER BY TID = '{$tidb}', CREATED";
            break;
        case THREAD_MERGE_END:
            $sql = "INSERT INTO `{$table_prefix}POST` (TID, REPLY_TO_PID, ";
            $sql .= "FROM_UID, TO_UID, VIEWED, CREATED, STATUS, APPROVED, APPROVED_BY, ";
            $sql .= "EDITED, EDITED_BY, IPADDRESS, MOVED_TID, MOVED_PID) ";
            $sql .= "SELECT '{$new_tid}', REPLY_TO_PID, FROM_UID, TO_UID, NULL, NOW(), ";
            $sql .= "STATUS, APPROVED, APPROVED_BY, EDITED, EDITED_BY, IPADDRESS, TID, ";
            $sql .= "PID FROM `{$table_prefix}POST` WHERE TID IN ('{$tida}', '{$tidb}') ";
            $sql .= "ORDER BY TID = '{$tida}', CREATED";
            break;
    }
    // Execute the query to copy the posts.
    if (!$db->query($sql)) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_QUERY_ERROR, $error_str);
    }
    // Copy the post contents to the new thread
    $sql = "INSERT INTO `{$table_prefix}POST_CONTENT` (TID, PID, CONTENT) ";
    $sql .= "SELECT POST.TID, POST.PID, POST_CONTENT.CONTENT FROM `{$table_prefix}POST` POST ";
    $sql .= "LEFT JOIN `{$table_prefix}POST_CONTENT` POST_CONTENT ";
    $sql .= "ON (POST_CONTENT.TID = POST.MOVED_TID AND POST_CONTENT.PID = MOVED_PID) ";
    $sql .= "WHERE POST.TID = '{$new_tid}'";
    if (!$db->query($sql)) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_QUERY_ERROR, $error_str);
    }
    // Insert the new Sphinx Search IDs.
    $sql = "INSERT INTO `{$table_prefix}POST_SEARCH_ID` (TID, PID) ";
    $sql .= "SELECT {$new_tid}, POST.PID FROM `{$table_prefix}POST` POST ";
    $sql .= "WHERE POST.TID = '{$new_tid}'";
    if (!$db->query($sql)) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_QUERY_ERROR, $error_str);
    }
    // Update the REPLY_TO_PIDs in the new thread
    $sql = "INSERT INTO `{$table_prefix}POST` (TID, PID, REPLY_TO_PID) ";
    $sql .= "SELECT TARGET_POST.TID, TARGET_POST.PID, SOURCE_POST.PID ";
    $sql .= "FROM `{$table_prefix}POST` TARGET_POST ";
    $sql .= "INNER JOIN `{$table_prefix}POST` SOURCE_POST ";
    $sql .= "ON (SOURCE_POST.MOVED_TID = TARGET_POST.MOVED_TID ";
    $sql .= "AND TARGET_POST.REPLY_TO_PID = SOURCE_POST.MOVED_PID) ";
    $sql .= "WHERE TARGET_POST.TID = '{$new_tid}' ";
    $sql .= "ON DUPLICATE KEY UPDATE REPLY_TO_PID = VALUES(REPLY_TO_PID) ";
    if (!$db->query($sql)) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_QUERY_ERROR, $error_str);
    }
    // Link the attachments to the new thread.
    $sql = "INSERT INTO POST_ATTACHMENT_IDS (FID, TID, PID, AID) ";
    $sql .= "SELECT {$forum_fid}, TARGET_POST.TID, TARGET_POST.PID, ";
    $sql .= "SOURCE_POST_ATTACHMENT_IDS.AID ";
    $sql .= "FROM `{$table_prefix}POST` TARGET_POST ";
    $sql .= "INNER JOIN `{$table_prefix}POST` SOURCE_POST ";
    $sql .= "ON (SOURCE_POST.MOVED_TID = TARGET_POST.MOVED_TID ";
    $sql .= "AND TARGET_POST.REPLY_TO_PID = SOURCE_POST.MOVED_PID) ";
    $sql .= "INNER JOIN POST_ATTACHMENT_IDS SOURCE_POST_ATTACHMENT_IDS ";
    $sql .= "ON (SOURCE_POST_ATTACHMENT_IDS.TID = SOURCE_POST.TID ";
    $sql .= "AND SOURCE_POST_ATTACHMENT_IDS.PID = SOURCE_POST.PID) ";
    $sql .= "WHERE TARGET_POST.TID = '{$new_tid}'";
    if (!$db->query($sql)) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_QUERY_ERROR, $error_str);
    }
    // Now we unset the MOVED_TID and MOVED_PIDs for the new thread
    // so the posts appear in the new thread.
    $sql = "UPDATE `{$table_prefix}POST` SET MOVED_TID = NULL, ";
    $sql .= "MOVED_PID = NULL WHERE TID = '{$new_tid}'";
    if (!$db->query($sql)) {
        // Unlock the threads if they weren't originally locked.
        thread_set_closed($tida, $threada['CLOSED'] > 0);
        thread_set_closed($tidb, $threadb['CLOSED'] > 0);
        // Return error message.
        return thread_merge_error(THREAD_MERGE_QUERY_ERROR, $error_str);
    }
    // Update the new thread length
    thread_set_length($new_tid, $threada['LENGTH'] + $threadb['LENGTH']);
    // Set the original threads as moved
    thread_set_moved($tida, $new_tid);
    thread_set_moved($tidb, $new_tid);
    // Update the new thread so it's closed if either
    // of it's source threads were originally closed.
    thread_set_closed($new_tid, $threada['CLOSED'] > 0 | $threadb['CLOSED'] > 0);
    // Undelete the thread.
    thread_undelete($new_tid);
    // Return the admin log data.
    return array($tida, $threada['TITLE'], $tidb, $threadb['TITLE'], $new_tid, $threada['TITLE']);
}
Beispiel #6
0
function post_update($fid, $tid, $pid, $content)
{
    if (!is_numeric($tid)) {
        return false;
    }
    if (!is_numeric($pid)) {
        return false;
    }
    if (!($db = db::get())) {
        return false;
    }
    $content = $db->escape($content);
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $sql = "UPDATE LOW_PRIORITY `{$table_prefix}POST_CONTENT` SET CONTENT = '{$content}' ";
    $sql .= "WHERE TID = '{$tid}' AND PID = '{$pid}' LIMIT 1";
    if (!$db->query($sql)) {
        return false;
    }
    if (session::check_perm(USER_PERM_POST_APPROVAL, $fid) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
        $sql = "UPDATE LOW_PRIORITY `{$table_prefix}POST` SET APPROVED = 0, APPROVED_BY = 0 ";
        $sql .= "WHERE TID = '{$tid}' AND PID = '{$pid}' LIMIT 1";
        if (!$db->query($sql)) {
            return false;
        }
    }
    return true;
}
echo "      <td align=\"left\">&nbsp;</td>\n";
echo "    </tr>\n";
echo "    <tr>\n";
echo "      <td align=\"left\">&nbsp;</td>\n";
echo "      <td class=\"postbody\" align=\"center\" width=\"50%\">", html_page_links("admin_users.php?webtag={$webtag}&sort_by={$sort_by}&sort_dir={$sort_dir}&user_search={$user_search}&filter={$filter}", $page, $admin_user_array['user_count'], 10), "</td>\n";
if (forum_get_setting('require_user_approval', 'Y') && session::check_perm(USER_PERM_ADMIN_TOOLS, 0, 0)) {
    echo "      <td class=\"postbody\" align=\"right\" width=\"25%\" style=\"white-space: nowrap\">", gettext("User filter"), ":&nbsp;", form_dropdown_array("filter", array(ADMIN_USER_FILTER_NONE => gettext("All"), ADMIN_USER_FILTER_ONLINE => gettext("Online users"), ADMIN_USER_FILTER_OFFLINE => gettext("Offline users"), ADMIN_USER_FILTER_BANNED => gettext("Banned users"), ADMIN_USER_FILTER_APPROVAL => gettext("Users awaiting approval")), $filter), "&nbsp;", form_submit("change_filter", gettext("Go")), "</td>\n";
} else {
    echo "      <td class=\"postbody\" align=\"right\" width=\"25%\" style=\"white-space: nowrap\">", gettext("User filter"), ":&nbsp;", form_dropdown_array("filter", array(ADMIN_USER_FILTER_NONE => gettext("All"), ADMIN_USER_FILTER_ONLINE => gettext("Online users"), ADMIN_USER_FILTER_OFFLINE => gettext("Offline users"), ADMIN_USER_FILTER_BANNED => gettext("Banned users")), $filter), "&nbsp;", form_submit("change_filter", gettext("Go")), "</td>\n";
}
echo "    </tr>\n";
echo "    <tr>\n";
echo "      <td align=\"left\">&nbsp;</td>\n";
echo "    </tr>\n";
echo "  </table>\n";
if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0, 0) && sizeof($admin_user_array['user_array']) > 0) {
    echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"86%\">\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 width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td class=\"subhead\" align=\"left\">", gettext("Options"), "</td>\n";
    echo "                </tr>\n";
    echo "                <tr>\n";
    echo "                  <td align=\"center\">\n";
    echo "                    <table class=\"posthead\" width=\"95%\">\n";
    echo "                      <tr>\n";
    if (forum_get_setting('require_user_approval', 'Y')) {
Beispiel #8
0
function light_folder_search_dropdown($selected_folder)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($selected_folder)) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $available_folders = array();
    $access_allowed = USER_PERM_POST_READ;
    $sql = "SELECT FID, TITLE FROM `{$table_prefix}FOLDER` ";
    $sql .= "ORDER BY FID ";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    while (($folder_data = $result->fetch_assoc()) !== null) {
        if (!session::logged_in()) {
            if (session::check_perm(USER_PERM_GUEST_ACCESS, $folder_data['FID'])) {
                $available_folders[$folder_data['FID']] = htmlentities_array($folder_data['TITLE']);
            }
        } else {
            if (session::check_perm($access_allowed, $folder_data['FID'])) {
                $available_folders[$folder_data['FID']] = htmlentities_array($folder_data['TITLE']);
            }
        }
    }
    if (sizeof($available_folders) == 0) {
        return false;
    }
    $available_folders = array(gettext("ALL")) + $available_folders;
    return light_form_dropdown_array("fid", $available_folders, $selected_folder);
}
Beispiel #9
0
// Check links section is enabled
if (!forum_get_setting('show_links', 'Y')) {
    html_draw_error(gettext("You may not access this section."));
}
// Array to hold error messages
$error_msg_array = array();
$name = null;
$uri = null;
$description = null;
// User pressed cancel
if (isset($_POST['cancel'])) {
    header_redirect("links.php?webtag={$webtag}&fid={$_POST['fid']}");
    exit;
}
// Get the Links Folders.
$folders = links_folders_get(!session::check_perm(USER_PERM_LINKS_MODERATE, 0));
// Check the mode.
if (isset($_GET['mode'])) {
    if ($_GET['mode'] == LINKS_ADD_LINK) {
        $mode = LINKS_ADD_LINK;
    } else {
        if ($_GET['mode'] == LINKS_ADD_FOLDER) {
            $mode = LINKS_ADD_FOLDER;
        } else {
            $mode = LINKS_ADD_LINK;
        }
    }
} else {
    if (isset($_POST['mode'])) {
        if ($_POST['mode'] == LINKS_ADD_LINK) {
            $mode = LINKS_ADD_LINK;
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    html_display_error_array($error_msg_array, '700', 'left');
} else {
    if (isset($_GET['updated'])) {
        html_display_success_msg(gettext("Signature Updated"), '700', 'left');
    } else {
        if (isset($_GET['updated_global'])) {
            html_display_success_msg(gettext("Signature Updated For All Forums"), '700', 'left');
        }
    }
}
echo "<br />\n";
if ($admin_edit === true) {
    echo "<div align=\"center\">\n";
}
if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0, 0) && $admin_edit || $sig_uid == $_SESSION['UID'] && $admin_edit === false) {
    $show_set_all = forums_get_available_count() > 1;
} else {
    $show_set_all = false;
}
echo "<form accept-charset=\"utf-8\" name=\"prefs\" action=\"edit_signature.php\" method=\"post\" target=\"_self\">\n";
echo "  ", form_csrf_token_field(), "\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
if ($admin_edit === true) {
    echo "  ", form_input_hidden('sig_uid', htmlentities_array($sig_uid)), "\n";
}
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
Beispiel #11
0
function poll_close($tid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($tid)) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $sql = "SELECT FROM_UID FROM `{$table_prefix}POST` WHERE TID = '{$tid}' AND PID = 1";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if (($t_fid = thread_get_folder($tid, 1)) && $result->num_rows > 0) {
        $poll_data = $result->fetch_assoc();
        if (session::get_value('UID') == $poll_data['FROM_UID'] || session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) {
            $closes_datetime = date(MYSQL_DATETIME_MIDNIGHT, time());
            $sql = "UPDATE LOW_PRIORITY `{$table_prefix}POLL` SET ";
            $sql .= "CLOSES = CAST('{$closes_datetime}' AS DATETIME) ";
            $sql .= "WHERE TID = '{$tid}'";
            if (!$db->query($sql)) {
                return false;
            }
        }
    }
    return true;
}
Beispiel #12
0
    if ($_GET['sort_dir'] == "DESC") {
        $sort_dir = "DESC";
    } else {
        $sort_dir = "ASC";
    }
} else {
    if ($viewmode == LINKS_VIEW_HIERARCHICAL) {
        $sort_dir = "ASC";
    } else {
        $sort_dir = "DESC";
    }
}
if ($viewmode == LINKS_VIEW_HIERARCHICAL) {
    $links = links_get_in_folder($fid, session::check_perm(USER_PERM_LINKS_MODERATE, 0), $sort_by, $sort_dir, $page);
} else {
    $links = links_get_all(session::check_perm(USER_PERM_LINKS_MODERATE, 0), $sort_by, $sort_dir, $page);
}
if (sizeof($links['links_array']) < 1) {
    html_display_warning_msg(gettext("No links in this folder."), '85%', 'center');
}
echo "<div align=\"center\">\n";
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"85%\">\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 width=\"100%\">\n";
echo "                <tr>\n";
if ($sort_by == "TITLE" && $sort_dir == "ASC") {
    echo "                  <td align=\"left\" class=\"subhead\"><a href=\"links.php?webtag={$webtag}&amp;fid={$fid}&amp;viewmode={$viewmode}&amp;page={$page}&amp;sort_by=TITLE&amp;sort_dir=DESC\">", gettext("Name"), "</a>&nbsp;</td>\n";
Beispiel #13
0
 if (isset($_POST['t_to_uid_others']) && strlen(trim($_POST['t_to_uid_others'])) > 0) {
     $t_recipient_array = preg_split("/[;|,]/u", trim($_POST['t_to_uid_others']));
     $t_new_recipient_array['TO_UID'] = array();
     $t_new_recipient_array['LOGON'] = array();
     $t_new_recipient_array['NICK'] = array();
     foreach ($t_recipient_array as $key => $t_recipient) {
         $to_logon = trim($t_recipient);
         if ($to_user = user_get_by_logon($to_logon)) {
             $peer_relationship = user_get_peer_relationship($to_user['UID'], $uid);
             if (!in_array($to_user['UID'], $t_new_recipient_array['TO_UID'])) {
                 $t_new_recipient_array['TO_UID'][] = $to_user['UID'];
                 $t_new_recipient_array['LOGON'][] = $to_user['LOGON'];
                 $t_new_recipient_array['NICK'][] = $to_user['NICKNAME'];
             }
             if ($to_radio == 'others') {
                 if ($peer_relationship ^ USER_BLOCK_PM && user_allow_pm($to_user['UID']) || session::check_perm(USER_PERM_FOLDER_MODERATE, 0)) {
                     pm_user_prune_folders();
                     if (pm_get_free_space($uid) < sizeof($t_new_recipient_array['TO_UID'])) {
                         $error_msg_array[] = gettext("You do not have enough free space to send this message.");
                         $valid = false;
                     }
                 } else {
                     $error_msg_array[] = sprintf(gettext("%s has opted out of receiving personal messages"), $to_logon);
                     $valid = false;
                 }
             }
         } else {
             $error_msg_array[] = sprintf(gettext("User %s not found"), $to_logon);
             $valid = false;
         }
     }
Beispiel #14
0
         echo "            </table>\n";
     }
 } else {
     if ($folder_info[$folder_number]['INTEREST'] != FOLDER_IGNORED) {
         // Only display the additional folder info if the user DOESN'T have the folder on ignore
         echo "            <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
         echo "              <tr>\n";
         echo "                <td class=\"threads_top_left_bottom\" align=\"left\" valign=\"top\" width=\"50%\" style=\"white-space: nowrap\"><a href=\"thread_list.php?webtag={$webtag}&amp;mode={$mode}&amp;folder={$folder_number}\" class=\"folderinfo\" title=\"", gettext("View messages in this folder only"), "\">";
         if (isset($folder_msgs[$folder_number])) {
             echo $folder_msgs[$folder_number];
         } else {
             echo "0";
         }
         echo "&nbsp;", gettext("threads"), "</a></td>\n";
         echo "                <td align=\"left\" class=\"threads_top_right_bottom\" valign=\"top\" width=\"50%\" style=\"white-space: nowrap\">";
         if (session::check_perm(USER_PERM_THREAD_CREATE, $folder_number)) {
             echo "<a href=\"";
             echo $folder_info[$folder_number]['ALLOWED_TYPES'] & FOLDER_ALLOW_NORMAL_THREAD ? "post.php?webtag={$webtag}" : (forum_get_setting('allow_polls', 'Y') ? "create_poll.php?webtag={$webtag}" : "");
             echo "&amp;fid={$folder_number}\" target=\"", html_get_frame_name('main'), "\" class=\"folderpostnew\" title=\"", gettext("Create new discussion in this folder"), "\">", gettext("Post New"), "</a>";
         } else {
             echo "&nbsp;";
         }
         echo "</td>\n";
         echo "              </tr>\n";
         echo "            </table>\n";
     }
 }
 echo "          </td>\n";
 echo "        </tr>\n";
 echo "      </table>\n";
 echo "    </td>\n";
Beispiel #15
0
function folder_is_accessible($fid)
{
    if (!is_numeric($fid)) {
        return false;
    }
    return session::check_perm(USER_PERM_POST_READ, $fid);
}
Beispiel #16
0
echo "              <table class=\"posthead\" width=\"100%\">\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" class=\"subhead\" colspan=\"2\">", gettext("Relationship"), "</td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"center\">\n";
echo "                    <table class=\"posthead\" width=\"95%\">\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\" width=\"150\">", form_radio('peer_user_status', USER_FRIEND, gettext("Friend"), $peer_relationship & USER_FRIEND ? true : false), "</td>\n";
echo "                        <td align=\"left\" width=\"400\">: ", gettext("User's posts marked with a &quot;Friend&quot; icon."), "</td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\" width=\"150\">", form_radio('peer_user_status', USER_NORMAL, gettext("Normal"), !($peer_relationship & USER_IGNORED || $peer_relationship & USER_FRIEND || $peer_relationship & USER_IGNORED_COMPLETELY) ? true : false), "</td>\n";
echo "                        <td align=\"left\" width=\"400\">: ", gettext("User's posts appear as normal."), "</td>\n";
echo "                      </tr>\n";
if ($peer_perms & USER_PERM_FOLDER_MODERATE && session::check_perm(USER_PERM_CAN_IGNORE_ADMIN, 0) || !($peer_perms & USER_PERM_FOLDER_MODERATE)) {
    echo "                      <tr>\n";
    echo "                        <td align=\"left\" width=\"150\">", form_radio('peer_user_status', USER_IGNORED, gettext("Ignored"), $peer_relationship & USER_IGNORED ? true : false), "</td>\n";
    echo "                        <td align=\"left\" width=\"400\">: ", gettext("User's posts are hidden."), "</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\" width=\"150\">", form_radio('peer_user_status', USER_IGNORED_COMPLETELY, gettext("Ignored Completely"), $peer_relationship & USER_IGNORED_COMPLETELY ? true : false), "</td>\n";
    echo "                        <td align=\"left\" width=\"400\">: ", gettext("Threads and posts to or from user will appear deleted."), "</td>\n";
    echo "                      </tr>\n";
}
echo "                    </table>\n";
echo "                  </td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
echo "                </tr>\n";
Beispiel #17
0
function thread_list_available_views()
{
    $unread_cutoff_stamp = forum_get_unread_cutoff();
    if (!session::logged_in()) {
        $available_views = array(ALL_DISCUSSIONS => gettext("All Discussions"), TODAYS_DISCUSSIONS => gettext("Today's Discussions"), TWO_DAYS_BACK => gettext("2 Days Back"), SEVEN_DAYS_BACK => gettext("7 Days Back"));
    } else {
        $available_views = array(ALL_DISCUSSIONS => gettext("All Discussions"), UNREAD_DISCUSSIONS => gettext("Unread Discussions"), UNREAD_DISCUSSIONS_TO_ME => gettext("Unread &quot;To: Me&quot;"), TODAYS_DISCUSSIONS => gettext("Today's Discussions"), UNREAD_TODAY => gettext("Unread today"), TWO_DAYS_BACK => gettext("2 Days Back"), SEVEN_DAYS_BACK => gettext("7 Days Back"), HIGH_INTEREST => gettext("High Interest"), UNREAD_HIGH_INTEREST => gettext("Unread High Interest"), RECENTLY_SEEN => gettext("I've recently seen"), IGNORED_THREADS => gettext("I've ignored"), BY_IGNORED_USERS => gettext("By ignored users"), SUBSCRIBED_TO => gettext("I've subscribed to"), STARTED_BY_FRIEND => gettext("Started by friend"), UNREAD_STARTED_BY_FRIEND => gettext("Unread started by friend"), STARTED_BY_ME => gettext("Started by me"), POLL_THREADS => gettext("Polls"), STICKY_THREADS => gettext("Sticky Threads"), MOST_UNREAD_POSTS => gettext("Most unread posts"), SEARCH_RESULTS => gettext("Search Results"), DELETED_THREADS => gettext("Deleted Threads"));
        if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0)) {
            if ($unread_cutoff_stamp === false) {
                // Remove unread thread options (Unread Discussions, Unread Today,
                // Unread High Interest, Unread Started By Friend, Most Unread Posts).
                unset($available_views[UNREAD_DISCUSSIONS], $available_views[UNREAD_TODAY], $available_views[UNREAD_HIGH_INTEREST]);
                unset($available_views[UNREAD_STARTED_BY_FRIEND], $available_views[MOST_UNREAD_POSTS]);
            }
        } else {
            // Remove Admin Deleted Threads option.
            unset($available_views[DELETED_THREADS]);
            if ($unread_cutoff_stamp === false) {
                // Remove unread thread options (Unread Discussions, Unread Today,
                // Unread High Interest, Unread Started By Friend, Most Unread Posts).
                unset($available_views[UNREAD_DISCUSSIONS], $available_views[UNREAD_TODAY], $available_views[UNREAD_HIGH_INTEREST]);
                unset($available_views[UNREAD_STARTED_BY_FRIEND], $available_views[MOST_UNREAD_POSTS]);
            }
        }
    }
    return $available_views;
}
Beispiel #18
0
    } else {
        if (isset($_POST['profile_uid'])) {
            if (is_numeric($_POST['profile_uid'])) {
                $profile_uid = $_POST['profile_uid'];
                $admin_edit = true;
            } else {
                html_draw_error(gettext("No user specified."));
            }
        }
    }
    if (isset($_POST['cancel'])) {
        header_redirect("admin_user.php?webtag={$webtag}&uid={$profile_uid}");
        exit;
    }
}
if (!session::check_perm(USER_PERM_ADMIN_TOOLS, 0) && $profile_uid != $_SESSION['UID']) {
    html_draw_error(gettext("You do not have permission to use this section."));
}
// Fetch array of profile items.
$profile_items_array = profile_get_user_values($profile_uid);
// Array to hold error messages
$error_msg_array = array();
// Do updates
if (isset($_POST['save'])) {
    $valid = true;
    if (isset($_POST['t_entry']) && is_array($_POST['t_entry'])) {
        $t_entry_array = $_POST['t_entry'];
        $t_entry_cleaned_array = array_map('strip_tags', $t_entry_array);
        if (sizeof(array_diff_assoc($t_entry_array, $t_entry_cleaned_array)) > 0) {
            $error_msg_array[] = gettext("Profile Entries must not include HTML");
            $valid = false;
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'lang.inc.php';
require_once BH_INCLUDE_PATH . 'logon.inc.php';
require_once BH_INCLUDE_PATH . 'perm.inc.php';
require_once BH_INCLUDE_PATH . 'post.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'user.inc.php';
require_once BH_INCLUDE_PATH . 'word_filter.inc.php';
// Check we're logged in correctly
if (!session::logged_in()) {
    html_guest_error();
}
// Check we have Admin / Moderator access
if (!session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || forum_get_setting('access_level', FORUM_DISABLED)) {
    html_draw_error(gettext("You do not have permission to use this section."));
}
// Perform additional admin login.
admin_check_credentials();
$forum_fid = forum_get_setting('fid');
if (isset($_GET['ret']) && strlen(trim($_GET['ret'])) > 0) {
    $ret = rawurldecode(trim($_GET['ret']));
} else {
    if (isset($_POST['ret']) && strlen(trim($_POST['ret'])) > 0) {
        $ret = trim($_POST['ret']);
    } else {
        $ret = "admin_forums.php?webtag={$webtag}";
    }
}
// validate the return to page
Beispiel #20
0
        html_draw_top(sprintf("title=%s", gettext("Error")));
        post_edit_refuse($tid, $pid);
        html_draw_bottom();
        exit;
    }
    if (forum_get_setting('require_post_approval', 'Y') && isset($preview_message['APPROVED']) && $preview_message['APPROVED'] == 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) {
        html_draw_top(sprintf("title=%s", gettext("Error")));
        post_edit_refuse($tid, $pid);
        html_draw_bottom();
        exit;
    }
}
if (isset($_POST['endpoll'])) {
    if (poll_close($tid)) {
        post_add_edit_text($tid, 1);
        if (session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid) && $preview_message['FROM_UID'] != session::get_value('UID')) {
            admin_add_log_entry(EDIT_POST, array($t_fid, $tid, $pid));
        }
    }
    if ($thread_data['LENGTH'] > 1) {
        header_redirect("discussion.php?webtag={$webtag}&msg={$msg}&edit_success={$msg}");
        exit;
    } else {
        header_redirect("discussion.php?webtag={$webtag}&edit_success={$msg}");
        exit;
    }
}
html_draw_top(sprintf("title=%s", gettext("Close Poll")), "post.js", "resize_width=720", "basetarget=_blank", 'class=window_title');
echo "<h1>", gettext("Close Poll"), " {$tid}.{$pid}</h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    html_display_error_array($error_msg_array, '720', 'left');
Beispiel #21
0
echo "                        </td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\">\n";
echo form_submit("post", gettext("Post"), "tabindex=\"2\""), "\n";
echo form_submit("preview", gettext("Preview"), "tabindex=\"3\""), "\n";
if (isset($_POST['t_tid']) && is_numeric($_POST['t_tid']) && isset($_POST['t_rpid']) && is_numeric($_POST['t_rpid'])) {
    echo "<a href=\"discussion.php?webtag={$webtag}&amp;msg={$_POST['t_tid']}.{$_POST['t_rpid']}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
} else {
    if (isset($_GET['replyto']) && validate_msg($_GET['replyto'])) {
        echo "<a href=\"discussion.php?webtag={$webtag}&amp;msg={$_GET['replyto']}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    } else {
        echo "<a href=\"discussion.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    }
}
if (forum_get_setting('attachments_enabled', 'Y') && (session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $t_fid) || $new_thread)) {
    echo "<a href=\"attachments.php?aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
    echo form_input_hidden("aid", htmlentities_array($aid));
}
if ($allow_sig == true) {
    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=\"left\">\n";
    echo "                          <table class=\"messagefoot\" width=\"553\" cellspacing=\"0\">\n";
    echo "                            <tr>\n";
    echo "                              <td align=\"left\" class=\"subhead\">", gettext("Signature"), "</td>\n";
    if (($page_prefs & POST_SIGNATURE_DISPLAY) > 0) {
Beispiel #22
0
 public static function user_banned()
 {
     if (session::check_perm(USER_PERM_BANNED, 0)) {
         return true;
     }
     if (session::check_perm(USER_PERM_BANNED, 0, 0)) {
         return true;
     }
     return false;
 }
Beispiel #23
0
echo "                      <tr>\n";
echo "                        <td align=\"left\"><h2>", gettext("Thread title"), "</h2></td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\">", form_input_text("thread_title", isset($thread_title) ? htmlentities_array($thread_title) : '', 30, 64, false, "thread_title"), "</td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\">&nbsp;</td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\"><h2>", gettext("Thread options"), "</h2></td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\">", form_checkbox("post_interest", "Y", gettext("Set thread to high interest"), $high_interest == "Y"), "</td>\n";
echo "                      </tr>\n";
if (session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">&nbsp;</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\"><h2>", gettext("Admin"), "</h2></td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_checkbox("closed", "Y", gettext("Close for posting"), isset($closed) ? $closed == 'Y' : false), "</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_checkbox("sticky", "Y", gettext("Make sticky"), isset($sticky) ? $sticky == 'Y' : false), "</td>\n";
    echo "                      </tr>\n";
}
echo "                    </table>\n";
if (($user_emoticon_pack = session::get_value('EMOTICONS')) === false) {
function message_get_post_options_html($tid, $pid, $folder_fid)
{
    $webtag = get_webtag();
    if (($message = messages_get($tid, $pid, 1)) === false) {
        return false;
    }
    if (($uid = session::get_value('UID')) === false) {
        return false;
    }
    $perm_is_moderator = session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_fid);
    $perm_has_admin_access = session::check_perm(USER_PERM_ADMIN_TOOLS, 0);
    if (($quick_reply = session::get_value('REPLY_QUICK')) === false) {
        $quick_reply = 'N';
    }
    $html = "<div class=\"post_options_container\">\n";
    $html .= "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
    $html .= "    <tr>\n";
    $html .= "      <td align=\"left\" colspan=\"3\">\n";
    $html .= "        <table class=\"box\" width=\"100%\">\n";
    $html .= "          <tr>\n";
    $html .= "            <td align=\"left\" class=\"posthead\">\n";
    $html .= "              <table class=\"posthead\" width=\"100%\">\n";
    $html .= "                <tr>\n";
    $html .= "                  <td class=\"subhead\" colspan=\"2\">" . gettext("Post Options") . "</td>\n";
    $html .= "                </tr>\n";
    $html .= "                <tr>\n";
    $html .= "                  <td align=\"center\">\n";
    $html .= "                    <table width=\"95%\" class=\"post_options_menu\">\n";
    $html .= "                      <tr>\n";
    if ($quick_reply == 'N') {
        $html .= "                        <td align=\"left\"><a href=\"Javascript:void(0)\" rel=\"{$tid}.{$message['PID']}\" target=\"_self\" class=\"quick_reply_link\"><img src=\"" . html_style_image('quickreply.png') . "\" border=\"0\" alt=\"" . gettext("Quick Reply") . "\" title=\"" . gettext("Quick Reply") . "\" /></a></td>\n";
        $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"Javascript:void(0)\" rel=\"{$tid}.{$message['PID']}\" target=\"_self\" class=\"quick_reply_link\">" . gettext("Quick Reply") . "</a></td>\n";
    } else {
        $html .= "                        <td align=\"left\"><img src=\"" . html_style_image('post.png') . "\" border=\"0\" alt=\"" . gettext("Reply") . "\" title=\"" . gettext("Reply") . "\" /></td>\n";
        $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"post.php?webtag={$webtag}&amp;replyto={$tid}.{$message['PID']}\" target=\"_parent\" id=\"reply_{$message['PID']}\">" . gettext("Reply") . "</a></td>\n";
    }
    $html .= "                      </tr>\n";
    if ($uid == $message['FROM_UID'] && session::check_perm(USER_PERM_POST_DELETE, $folder_fid) && !session::check_perm(USER_PERM_PILLORIED, 0) || $perm_is_moderator) {
        $html .= "                      <tr>\n";
        $html .= "                        <td align=\"left\"><a href=\"delete.php?webtag={$webtag}&amp;msg={$tid}.{$message['PID']}\" target=\"_parent\"><img src=\"" . html_style_image('delete.png') . "\" border=\"0\" alt=\"" . gettext("Delete") . "\" title=\"" . gettext("Delete") . "\" /></a></td>\n";
        $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"delete.php?webtag={$webtag}&amp;msg={$tid}.{$message['PID']}\" target=\"_parent\">" . gettext("Delete") . "</a></td>\n";
        $html .= "                      </tr>\n";
    }
    $html .= "                      <tr>\n";
    $html .= "                        <td align=\"left\"><a href=\"pm_write.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}&amp;msg={$tid}.{$message['PID']}\" target=\"_parent\" title=\"" . gettext("Reply as PM") . "\"><img src=\"" . html_style_image('pmunread.png') . "\" border=\"0\" alt=\"" . gettext("Reply as PM") . "\" title=\"" . gettext("Reply as PM") . "\" /></a></td>\n";
    $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"pm_write.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}&amp;msg={$tid}.{$message['PID']}\" target=\"_parent\" title=\"" . gettext("Reply as PM") . "\">" . gettext("Reply as PM") . "</a></td>\n";
    $html .= "                      </tr>\n";
    $html .= "                      <tr>\n";
    $html .= "                        <td align=\"left\"><a href=\"display.php?webtag={$webtag}&amp;print_msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Print") . "\"><img src=\"" . html_style_image('print.png') . "\" border=\"0\" alt=\"" . gettext("Print") . "\" title=\"" . gettext("Print") . "\" /></a></td>\n";
    $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"display.php?webtag={$webtag}&amp;print_msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Print") . "\">" . gettext("Print") . "</a></td>\n";
    $html .= "                      </tr>\n";
    $html .= "                      <tr>\n";
    $html .= "                        <td align=\"left\"><a href=\"thread_options.php?webtag={$webtag}&amp;msg={$tid}.{$message['PID']}&amp;markasread=" . ($message['PID'] - 1) . "\" target=\"_self\" title=\"" . gettext("Mark as unread") . "\"><img src=\"" . html_style_image('markasunread.png') . "\" border=\"0\" alt=\"" . gettext("Mark as unread") . "\" title=\"" . gettext("Mark as unread") . "\" /></a></td>\n";
    $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"thread_options.php?webtag={$webtag}&amp;msg={$tid}.{$message['PID']}&amp;markasread=" . ($message['PID'] - 1) . "\" target=\"_self\" title=\"" . gettext("Mark as unread") . "\">" . gettext("Mark as unread") . "</a></td>\n";
    $html .= "                      </tr>\n";
    if ($uid != $message['FROM_UID']) {
        $html .= "                      <tr>\n";
        $html .= "                        <td align=\"left\"><a href=\"user_rel.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}&amp;msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Relationship") . "\"><img src=\"" . html_style_image('enemy.png') . "\" border=\"0\" alt=\"" . gettext("Relationship") . "\" title=\"" . gettext("Relationship") . "\" /></a></td>\n";
        $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"user_rel.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}&amp;msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Relationship") . "\">" . gettext("Relationship") . "</a></td>\n";
        $html .= "                      </tr>\n";
    }
    if ($perm_has_admin_access) {
        $html .= "                      <tr>\n";
        $html .= "                        <td align=\"left\"><a href=\"admin_user.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}&amp;msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Privileges") . "\"><img src=\"" . html_style_image('admintool.png') . "\" border=\"0\" alt=\"" . gettext("Privileges") . "\" title=\"" . gettext("Privileges") . "\" /></a></td>\n";
        $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"admin_user.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}&amp;msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Privileges") . "\">" . gettext("Privileges") . "</a></td>\n";
        $html .= "                      </tr>\n";
    }
    if ($perm_is_moderator || $perm_has_admin_access) {
        if ($perm_is_moderator) {
            if (forum_get_setting('require_post_approval', 'Y') && isset($message['APPROVED']) && $message['APPROVED'] == 0) {
                $html .= "                      <tr>\n";
                $html .= "                        <td align=\"left\"><a href=\"admin_post_approve.php?webtag={$webtag}&amp;msg={$tid}.{$message['PID']}&ret=messages.php%3Fwebtag%3D{$webtag}%26msg%3D{$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Approve Post") . "\"><img src=\"" . html_style_image('approved.png') . "\" border=\"0\" alt=\"" . gettext("Approve Post") . "\" title=\"" . gettext("Approve Post") . "\" /></a></td>\n";
                $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"admin_post_approve.php?webtag={$webtag}&amp;msg={$tid}.{$message['PID']}&ret=messages.php%3Fwebtag%3D{$webtag}%26msg%3D{$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Approve Post") . "\">" . gettext("Approve Post") . "</a></td>\n";
                $html .= "                      </tr>\n";
            }
        }
        if (isset($message['IPADDRESS']) && strlen($message['IPADDRESS']) > 0) {
            $html .= "                      <tr>\n";
            $html .= "                        <td align=\"left\"><span class=\"adminipdisplay\"><b>" . gettext("IP") . "</b></span></td>\n";
            $html .= "                        <td align=\"left\" style=\"white-space: nowrap\"><a href=\"admin_banned.php?webtag={$webtag}&amp;ban_ipaddress={$message['IPADDRESS']}&amp;msg={$tid}.{$message['PID']}\" target=\"_self\">" . gettext("Ban IP Address") . "</a></td>\n";
            $html .= "                      </tr>";
        } else {
            $html .= "                      <tr>\n";
            $html .= "                        <td align=\"left\"><span class=\"adminipdisplay\"><b>" . gettext("IP") . "</b></span></td>\n";
            $html .= "                        <td align=\"left\" style=\"white-space: nowrap\">" . gettext("Not Logged") . "</td>\n";
            $html .= "                      </tr>";
        }
    }
    $html .= "                    </table>\n";
    $html .= "                  </td>\n";
    $html .= "                </tr>\n";
    $html .= "              </table>\n";
    $html .= "            </td>\n";
    $html .= "          </tr>\n";
    $html .= "        </table>\n";
    $html .= "      </td>\n";
    $html .= "    </tr>\n";
    $html .= "  </table>\n";
    $html .= "</div>\n";
    return $html;
}
Beispiel #25
0
function links_folder_delete($fid)
{
    if (!is_numeric($fid)) {
        return false;
    }
    $folders = links_folders_get(!session::check_perm(USER_PERM_LINKS_MODERATE, 0));
    if (!($db = db::get())) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $sql = "SELECT MIN(FID) AS FID FROM `{$table_prefix}LINKS`";
    if (!($result = $db->query($sql))) {
        return false;
    }
    $link_array = $result->fetch_assoc();
    if (isset($link_array['FID']) && $link_array['FID'] == $fid) {
        return false;
    }
    $sql = "UPDATE LOW_PRIORITY `{$table_prefix}LINKS` ";
    $sql .= "SET FID = '{$folders[$fid]['PARENT_FID']}' WHERE FID = '{$fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    $sql = "DELETE QUICK FROM `{$table_prefix}LINKS_FOLDERS` ";
    $sql .= "WHERE FID = '{$fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    return $result;
}
Beispiel #26
0
echo "<div class=\"post_to\">", gettext("To"), ":", light_form_input_text("to_logon", isset($to_logon) ? htmlentities_array($to_logon) : "", 30, null, null, gettext("Leave blank for all")), "</div>";
echo "<div class=\"post_content\">", gettext("Content"), ":", light_form_textarea("content", htmlentities_array(strip_paragraphs($content)), 10, 50, null, 'textarea'), "</div>";
echo "<div class=\"post_buttons\">";
echo light_form_submit("post", gettext("Post"));
echo light_form_submit("preview", gettext("Preview"));
if (isset($return_msg)) {
    echo "<a href=\"lmessages.php?webtag={$webtag}&amp;msg={$return_msg}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
} else {
    if (isset($tid) && is_numeric($tid) && isset($reply_to_pid) && is_numeric($reply_to_pid)) {
        echo "<a href=\"lmessages.php?webtag={$webtag}&amp;msg={$tid}.{$reply_to_pid}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    } else {
        echo "<a href=\"lthread_list.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    }
}
echo "</div>";
if (attachments_check_dir() && (session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $fid) || $new_thread)) {
    echo "<div class=\"attachments post_attachments\">", gettext('Attachments'), ":\n";
    echo "  ", attachments_form($_SESSION['UID'], $attachments), "\n";
    echo "</div>\n";
}
echo "</div>";
echo "</div>";
echo "</form>\n";
if (!$new_thread && $reply_to_pid > 0) {
    echo "<h3>", gettext("In reply to"), ":</h3>\n";
    if ($thread_data['POLL_FLAG'] == 'Y' && $reply_message['PID'] == 1) {
        light_poll_display($tid, $thread_data['LENGTH'], $thread_data['FID'], $thread_data['CLOSED'], false, true);
    } else {
        light_message_display($tid, $reply_message, $thread_data['LENGTH'], $reply_to_pid, $thread_data['FID'], false, false, false, false, true);
    }
}
Beispiel #27
0
function forum_get($fid)
{
    if (!is_numeric($fid)) {
        return false;
    }
    if (!session::check_perm(USER_PERM_ADMIN_TOOLS, 0)) {
        return false;
    }
    if (!($db = db::get())) {
        return false;
    }
    $sql = "SELECT FID, WEBTAG, OWNER_UID, DATABASE_NAME, DEFAULT_FORUM, ";
    $sql .= "ACCESS_LEVEL, FORUM_PASSWD FROM FORUMS WHERE FID = '{$fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    $forum_get_array = $result->fetch_assoc();
    $forum_get_array['FORUM_SETTINGS'] = array();
    if (isset($forum_get_array['OWNER_UID']) && $forum_get_array['OWNER_UID'] > 0) {
        if ($forum_leader = user_get_logon($forum_get_array['OWNER_UID'])) {
            $forum_get_array['FORUM_SETTINGS']['forum_leader'] = $forum_leader;
        }
    }
    $sql = "SELECT SNAME, SVALUE FROM FORUM_SETTINGS WHERE FID = '{$fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    while ($forum_data = $result->fetch_assoc()) {
        $forum_get_array['FORUM_SETTINGS'][$forum_data['SNAME']] = $forum_data['SVALUE'];
    }
    return $forum_get_array;
}
Beispiel #28
0
         exit;
     }
     header('Content-Type: application/json');
     $content = json_encode(array('success' => true, 'font_size' => $user_prefs['FONT_SIZE'], 'html' => messages_fontsize_form($tid, $pid, true, $user_prefs['FONT_SIZE'])));
     break;
 case 'post_options':
     if (!session::logged_in()) {
         break;
     }
     cache_disable();
     if (!isset($_GET['msg']) || !validate_msg($_GET['msg'])) {
         header_status(500, 'Internal Server Error');
         exit;
     }
     list($tid, $pid) = explode('.', $_GET['msg']);
     if (!($thread_data = thread_get($tid, session::check_perm(USER_PERM_ADMIN_TOOLS, 0)))) {
         header_status(500, 'Internal Server Error');
         exit;
     }
     if (!($content = message_get_post_options_html($tid, $pid, $thread_data['FID']))) {
         header_status(500, 'Internal Server Error');
         exit;
     }
     break;
 case 'poll_add_question':
     if (!session::logged_in()) {
         break;
     }
     cache_disable();
     if (!isset($_GET['question_number']) || !is_numeric($_GET['question_number'])) {
         header_status(500, 'Internal Server Error');
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'lang.inc.php';
require_once BH_INCLUDE_PATH . 'logon.inc.php';
require_once BH_INCLUDE_PATH . 'profile.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'stats.inc.php';
require_once BH_INCLUDE_PATH . 'user.inc.php';
require_once BH_INCLUDE_PATH . 'user_profile.inc.php';
require_once BH_INCLUDE_PATH . 'word_filter.inc.php';
// Check we're logged in correctly
if (!session::logged_in()) {
    html_guest_error();
}
// Check we have Admin / Moderator access
if (!session::check_perm(USER_PERM_ADMIN_TOOLS, 0)) {
    html_draw_error(gettext("You do not have permission to use this section."));
}
// Perform additional admin login.
admin_check_credentials();
// Array to hold error messages
$error_msg_array = array();
// Empty array for the stats
$user_stats_array = array('user_stats' => array());
// Submit code
if (isset($_POST['update'])) {
    $valid = true;
    if (isset($_POST['from_day']) && is_numeric($_POST['from_day'])) {
        $from_day = $_POST['from_day'];
    } else {
        $error_msg_array[] = gettext("Must choose a start day");
Beispiel #30
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>';
        }
    }
}