Example #1
0
function messages_social_links($tid)
{
    $webtag = get_webtag();
    if (forum_get_setting('show_share_links', 'Y') && session::get_value('SHOW_SHARE_LINKS') == 'Y') {
        echo "      <div style=\"display: inline-block; vertical-align: middle; margin-top: 1px\">\n";
        echo "        <g:plusone size=\"small\" count=\"false\" href=\"", htmlentities_array(html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1")), "\"></g:plusone>\n";
        echo "      </div>\n";
        echo "      <div style=\"display: inline-block; width: 48px; vertical-align: middle; margin-top: 2px; overflow: hidden\">\n";
        echo "        <iframe src=\"http://www.facebook.com/plugins/like.php?href=", urlencode(html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1")), "&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:21px;\" allowTransparency=\"true\"></iframe>\n";
        echo "      </div>\n";
        echo "      <div style=\"display: inline-block; width: 58px; vertical-align: middle; overflow: hidden\">\n";
        echo "        <a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-url=\"", htmlentities_array(html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1")), "\" data-count=\"none\">Tweet</a>\n";
        echo "      </div>\n";
    } else {
        echo "&nbsp;";
    }
}
Example #2
0
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'lang.inc.php';
require_once BH_INCLUDE_PATH . 'logon.inc.php';
require_once BH_INCLUDE_PATH . 'messages.inc.php';
require_once BH_INCLUDE_PATH . 'post.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'threads.inc.php';
require_once BH_INCLUDE_PATH . 'user.inc.php';
// Arrays for our cookie data
$username_array = array();
$password_array = array();
$passhash_array = array();
// Get the forum location accounting for forward slashes, multiple slashes, etc.
$forum_location = html_get_forum_uri();
// Get the Forum Name
$forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum');
// Current date
$build_date = gmdate("D, d M Y H:i:s O");
// Check to see if the user wants a custom number of threads.
// Maximum to display is 20. Minimum is 1. Default is 20.
if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
    if ($_GET['limit'] > 20) {
        $limit = 20;
    } else {
        if ($_GET['limit'] < 1) {
            $limit = 1;
        } else {
            $limit = $_GET['limit'];
        }
Example #3
0
function light_html_draw_top(array $options = array())
{
    $title = null;
    $robots = null;
    $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 'robots':
                ${$key} = !isset(${$key}) && isset($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 light_html_draw_top argument %s to be an array of strings', $key));
                }
                ${$key} = $value;
                break;
            default:
                throw new InvalidArgumentException(sprintf('Unknown light_html_draw_top argument "%s"', $key));
                break;
        }
    }
    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"", 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";
    echo "<meta name=\"MobileOptimized\" content=\"0\" />\n";
    echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n";
    if (forum_get_setting('allow_search_spidering', 'N') || 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";
        }
    }
    if (($stylesheet = html_get_style_file('mobile.css')) !== false) {
        echo html_include_css($stylesheet);
    }
    if (($emoticon_stylesheet = html_get_emoticon_style_sheet(true)) !== false) {
        echo html_include_css($emoticon_stylesheet, 'print, screen');
    }
    if (($stylesheet = html_get_style_file('images.css')) !== false) {
        echo html_include_css($stylesheet);
    }
    $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}");
    printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array(gettext("RSS Feed")), $rss_feed_path);
    if (($folders_array = folder_get_available_details()) !== 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")), $rss_feed_path);
        }
    }
    if (($user_style_path = html_get_user_style_path()) !== false) {
        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=\"apple-touch-icon\" sizes=\"144x144\" href=\"%s\" />\n", 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", html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path)));
    }
    echo html_include_javascript(html_get_forum_file_path('js/jquery.min.js'));
    echo html_include_javascript(html_get_forum_file_path('js/jquery.mobile.zoom.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.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'));
    echo html_include_javascript(html_get_forum_file_path('js/light.js'));
    $message_display_pages = get_message_display_files();
    if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) {
        if (isset($_SESSION['USE_MOVER_SPOILER']) && $_SESSION['USE_MOVER_SPOILER'] == 'Y') {
            echo html_include_javascript(html_get_forum_file_path('js/spoiler.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}"));
    echo "</head>\n";
    echo "<body id=\"mobile\">\n";
    if (forum_get_setting('show_share_links', 'Y') && isset($_SESSION['SHOW_SHARE_LINKS']) && $_SESSION['SHOW_SHARE_LINKS'] == 'Y') {
        echo '<div id="fb-root"></div>';
    }
    echo "<a name=\"top\"></a>\n";
}
Example #4
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 #5
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 #6
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 #7
0
function html_get_frame_name($basename)
{
    // Forum URL
    $forum_uri = html_get_forum_uri();
    // Get the webtag
    $webtag = get_webtag();
    // If webtag available add that to the hash.
    if (forum_check_webtag_available($webtag)) {
        $frame_md5_hash = md5(sprintf('%s-%s-%s', $forum_uri, $webtag, $basename));
        return sprintf('bh_frame_%s', preg_replace('/[^a-z]+/iu', '', $frame_md5_hash));
    }
    // No webtag just use forum URL and frame basename.
    $frame_md5_hash = md5(sprintf('%s-%s', $forum_uri, $basename));
    return sprintf('bh_frame_%s', preg_replace('/[^a-z]+/iu', '', $frame_md5_hash));
}
Example #8
0
function sitemap_create_file()
{
    // This can take a long time so we'll stop PHP timing out.
    set_time_limit(0);
    // Header for the sitemap index file
    $sitemap_index_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    $sitemap_index_header .= "<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
    // Sitemap index entry
    $sitemap_index_entry = "<sitemap>\n";
    $sitemap_index_entry .= "<loc>%s/sitemaps/sitemap%s.xml</loc>\n";
    $sitemap_index_entry .= "<lastmod>%s</lastmod>\n";
    $sitemap_index_entry .= "</sitemap>\n";
    // Sitemap index footer.
    $sitemap_index_footer = "</sitemapindex>";
    // Header for the sitemap file
    $sitemap_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    $sitemap_header .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
    // Sitemap URL entry
    $sitemap_url_entry = "<url>\n";
    $sitemap_url_entry .= "<loc>%s/index.php?webtag=%s&amp;msg=%s.1</loc>\n";
    $sitemap_url_entry .= "<lastmod>%s</lastmod>\n";
    $sitemap_url_entry .= "<changefreq>%s</changefreq>\n";
    $sitemap_url_entry .= "</url>\n";
    // Footer for the sitemap file.
    $sitemap_footer = "</urlset>";
    // Sitemap file count
    $sitemap_file_count = 1;
    // Forum URL
    $forum_location = html_get_forum_uri();
    // Check that search engine spidering is enabled
    if (forum_get_setting('allow_search_spidering', 'N')) {
        return false;
    }
    // Check that the sitemap setting is enabled.
    if (forum_get_setting('sitemap_enabled', 'N')) {
        return false;
    }
    // Fetch the sitemap path.
    if (!($sitemap_path = sitemap_get_dir())) {
        return false;
    }
    // Get the sitemap update frequencey (default: 24 hours)
    $sitemap_freq = forum_get_setting('sitemap_freq', null, DAY_IN_SECONDS);
    // Clear the stat cache so we don't get any stale results.
    clearstatcache();
    // Check that the file is older than the update frequency.
    if (@file_exists("{$sitemap_path}/sitemap.xml")) {
        if (@($file_modified = filemtime("{$sitemap_path}/sitemap.xml"))) {
            if (time() - $file_modified < $sitemap_freq) {
                return false;
            }
        }
    }
    // Number of bytes written to file
    $bytes_written = 0;
    // Open the index file for writing.
    if (!@($fp_index = fopen("{$sitemap_path}/sitemap.xml", 'w'))) {
        return false;
    }
    // Write the sitemap index header to the index file
    fwrite($fp_index, $sitemap_index_header);
    // Open the sitemap file for writing.
    if (!@($fp = fopen("{$sitemap_path}/sitemap{$sitemap_file_count}.xml", 'w'))) {
        return false;
    }
    // Write the header to the file
    $bytes_written += fwrite($fp, $sitemap_header);
    // Query the database to find available forums.
    if (!($result_forums = sitemap_get_available_forums())) {
        return false;
    }
    // Iterate over each of the forums.
    while ($forum_data = $result_forums->fetch_assoc()) {
        // Get the MySQL result set for the current forum's threads.
        if (!($result_threads = sitemap_forum_get_threads($forum_data['FID']))) {
            return false;
        }
        // Iterate over the threads and add them to the sitemap file.
        while ($thread_data = $result_threads->fetch_assoc()) {
            $thread_last_modified = date(MYSQL_DATE, $thread_data['MODIFIED']);
            if ($thread_last_modified < time() - 90 * DAY_IN_SECONDS) {
                $change_frequency = "yearly";
            } else {
                if ($thread_last_modified < time() - 30 * DAY_IN_SECONDS) {
                    $change_frequency = "monthly";
                } else {
                    if ($thread_last_modified < time() - 4 * DAY_IN_SECONDS) {
                        $change_frequency = "weekly";
                    } else {
                        $change_frequency = "daily";
                    }
                }
            }
            // Generate the sitemap entry and write it to the file.
            $sitemap_entry = sprintf($sitemap_url_entry, $forum_location, $forum_data['WEBTAG'], $thread_data['TID'], $thread_last_modified, $change_frequency);
            // If the sitemap file is going to be larger than the 10MB max file size
            // We need to close the current file and open the next in sequence.
            if ($bytes_written + (mb_strlen($sitemap_entry) + mb_strlen($sitemap_footer)) >= 10000000) {
                // Write the footer to the file
                fwrite($fp, $sitemap_footer);
                // Close the file
                fclose($fp);
                // Generate an index entry
                $sitemap_index = sprintf($sitemap_index_entry, $forum_location, $sitemap_file_count, date(MYSQL_DATE));
                // Write that to the index file.
                fwrite($fp_index, $sitemap_index);
                // Next sitemap file.
                $sitemap_file_count++;
                // Reset the written byte count
                $bytes_written = 0;
                // Try and open the file. If we fail write the footer to the index file, close and return false.
                if (!@($fp = fopen("{$sitemap_path}/sitemap{$sitemap_file_count}.xml", 'w'))) {
                    fwrite($fp_index, $sitemap_index_footer);
                    fclose($fp_index);
                    return false;
                }
            }
            $bytes_written += fwrite($fp, $sitemap_entry);
        }
    }
    // Write the footer to the file
    fwrite($fp, $sitemap_footer);
    // Close the file
    fclose($fp);
    // Generate an index entry
    $sitemap_index = sprintf($sitemap_index_entry, $forum_location, $sitemap_file_count, date(MYSQL_DATE));
    // Write that to the index file.
    fwrite($fp_index, $sitemap_index);
    // Write the footer
    fwrite($fp_index, $sitemap_index_footer);
    // Close the file.
    fclose($fp_index);
    // Hurrah!
    return true;
}
Example #9
0
 public static function get_http_referer()
 {
     if (!isset($_SERVER['HTTP_REFERER']) || strlen(trim($_SERVER['HTTP_REFERER'])) == 0) {
         return '';
     }
     $http_referer = trim($_SERVER['HTTP_REFERER']);
     $forum_uri_preg = preg_quote(html_get_forum_uri(), '/');
     if (preg_match("/^{$forum_uri_preg}/iu", $http_referer) > 0) {
         $http_referer = '';
     }
     return $http_referer;
 }
Example #10
0
function admin_get_visitor_log($page = 1)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($page) || $page < 1) {
        $page = 0;
    }
    $offset = calculate_page_offset($page, 10);
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    $users_get_recent_array = array();
    $uid = session::get_value('UID');
    $sql = "SELECT SQL_CALC_FOUND_ROWS VISITOR_LOG.UID, USER.LOGON, ";
    $sql .= "USER.NICKNAME, USER_PEER.PEER_NICKNAME, ";
    $sql .= "UNIX_TIMESTAMP(VISITOR_LOG.LAST_LOGON) AS LAST_LOGON, ";
    $sql .= "VISITOR_LOG.IPADDRESS, VISITOR_LOG.REFERER, ";
    $sql .= "SEB.SID, SEB.NAME, SEB.URL FROM VISITOR_LOG VISITOR_LOG ";
    $sql .= "LEFT JOIN USER USER ON (USER.UID = VISITOR_LOG.UID) ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ";
    $sql .= "ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$uid}') ";
    $sql .= "LEFT JOIN SEARCH_ENGINE_BOTS SEB ";
    $sql .= "ON (SEB.SID = VISITOR_LOG.SID) ";
    $sql .= "WHERE VISITOR_LOG.LAST_LOGON IS NOT NULL AND VISITOR_LOG.LAST_LOGON > 0 ";
    $sql .= "AND VISITOR_LOG.FORUM = '{$forum_fid}' ";
    $sql .= "ORDER BY VISITOR_LOG.LAST_LOGON DESC LIMIT {$offset}, 10";
    if (!($result = $db->query($sql))) {
        return false;
    }
    $sql = "SELECT FOUND_ROWS() AS ROW_COUNT";
    if (!($result_count = $db->query($sql))) {
        return false;
    }
    list($users_get_recent_count) = $result_count->fetch_row();
    if ($result->num_rows == 0 && $users_get_recent_count > 0 && $page > 1) {
        return admin_get_visitor_log($page - 1);
    }
    while ($visitor_array = $result->fetch_assoc()) {
        if (isset($visitor_array['LOGON']) && isset($visitor_array['PEER_NICKNAME'])) {
            if (!is_null($visitor_array['PEER_NICKNAME']) && strlen($visitor_array['PEER_NICKNAME']) > 0) {
                $visitor_array['NICKNAME'] = $visitor_array['PEER_NICKNAME'];
            }
        }
        if ($visitor_array['UID'] == 0) {
            $visitor_array['LOGON'] = gettext("Guest");
            $visitor_array['NICKNAME'] = gettext("Guest");
        } else {
            if (!isset($visitor_array['LOGON']) || is_null($visitor_array['LOGON'])) {
                $visitor_array['LOGON'] = gettext("Unknown user");
                $visitor_array['NICKNAME'] = "";
            }
        }
        if (isset($visitor_array['REFERER']) && strlen(trim($visitor_array['REFERER'])) > 0) {
            $forum_uri_preg = preg_quote(html_get_forum_uri(), '/');
            if (preg_match("/^{$forum_uri_preg}/iu", trim($visitor_array['REFERER'])) > 0) {
                $visitor_array['REFERER'] = "";
            }
        } else {
            $visitor_array['REFERER'] = "";
        }
        $users_get_recent_array[] = $visitor_array;
    }
    return array('user_count' => $users_get_recent_count, 'user_array' => $users_get_recent_array);
}
Example #11
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 #12
0
function search_output_opensearch_xml()
{
    $webtag = get_webtag();
    $title = forum_get_setting('forum_name', null, 'A Beehive Forum');
    $forum_opensearch_uri = html_get_forum_uri("search.php?webtag={$webtag}&amp;search_string={searchTerms}");
    header('Content-type: text/xml; charset=UTF-8', true);
    echo "<?xml version=\"1.0\"?>\n";
    echo "<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\">\n";
    echo "<ShortName>{$title}</ShortName>\n";
    echo "<Description>{$title}</Description>\n";
    echo "<InputEncoding>UTF-8</InputEncoding>\n";
    if ($user_style_path = html_get_user_style_path()) {
        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=\"{$forum_opensearch_uri}\"/>\n";
    echo "</OpenSearchDescription>\n";
    exit;
}