Example #1
0
// Includes required by this page.
require_once BH_INCLUDE_PATH . 'constants.inc.php';
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'lang.inc.php';
require_once BH_INCLUDE_PATH . 'logon.inc.php';
require_once BH_INCLUDE_PATH . 'messages.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'user.inc.php';
// Get the start page
if ($start_page = forum_get_setting('start_page')) {
    // Get the start page CSS
    if ($start_page_css = forum_get_setting('start_page_css')) {
        // Check for cached page.
        cache_check_etag(md5($start_page . $start_page_css));
        html_draw_top("inline_css={$start_page_css}");
        echo message_apply_formatting($start_page);
        html_draw_bottom();
    } else {
        // Check for cached page.
        cache_check_etag(md5($start_page));
        html_draw_top();
        echo message_apply_formatting($start_page);
        html_draw_bottom();
    }
} else {
    html_draw_top();
    echo "<h1>", gettext("You can edit this page from the admin interface"), "</h1>\n";
    html_draw_bottom();
}
Example #2
0
require_once BH_INCLUDE_PATH . 'logon.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
// Guests can't do different font sizes.
if (!session::logged_in()) {
    exit;
}
// User's UID
$uid = session::get_value('UID');
// User's font size.
if (($font_size = session::get_value('FONT_SIZE')) === false) {
    $font_size = 10;
}
// Make sure the font size is positive and an integer.
$font_size = floor(abs($font_size));
// Output in text/css.
header("Content-Type: text/css");
// Check the cache
cache_check_etag(md5(sprintf("%s-%s-%s", session_id(), $font_size, $uid)));
// Check the user's font size.
if ($font_size < 5) {
    $font_size = 5;
}
if ($font_size > 15) {
    $font_size = 15;
}
// Array of different font sizes
$css_selectors = array('body' => 0.8, '.navpage' => 0.65);
// Output the CSS
foreach ($css_selectors as $css_selector => $css_font_ratio) {
    printf("%s {\n    font-size: %d%%;\n}\n\n", $css_selector, $font_size * $css_font_ratio * 10);
}
Example #3
0
if (($left_frame_width = session::get_value('LEFT_FRAME_WIDTH')) === false) {
    $left_frame_width = 280;
}
// Construct the Javascript / JSON array
$json_data = array('webtag' => $webtag, 'uid' => session::get_value('UID'), 'lang' => array('imageresized' => gettext("This image has been resized (original size %dx%d). To view the full-size image click here."), 'deletemessagesconfirmation' => gettext("Are you sure you want to delete all of the selected messages?"), 'unquote' => gettext("Unquote"), 'quote' => gettext("Quote"), 'searchsuccessfullycompleted' => gettext("Search successfully completed."), 'confirmmarkasread' => gettext("Are you sure you want to mark the selected threads as read?"), 'waitdotdotdot' => gettext("Wait..."), 'more' => gettext("More"), 'pollquestion' => gettext("Poll Question"), 'deletequestion' => gettext("Delete question"), 'allowmultipleoptions' => gettext("Allow multiple options to be selected"), 'addnewoption' => gettext("Add new option"), 'deleteoption' => gettext("Delete option"), 'code' => gettext('code'), 'quote' => gettext('quote')), 'images' => array(), 'font_size' => $font_size, 'user_style' => $user_style, 'emoticons' => $user_emoticons, 'top_frame' => html_get_top_page(), 'left_frame_width' => $left_frame_width, 'forum_path' => server_get_forum_path(), 'use_mover_spoiler' => session::get_value('USE_MOVER_SPOILER'), 'frames' => array('index' => html_get_frame_name('index'), 'admin' => html_get_frame_name('admin'), 'start' => html_get_frame_name('start'), 'discussion' => html_get_frame_name('discussion'), 'user' => html_get_frame_name('user'), 'pm' => html_get_frame_name('pm'), 'main' => html_get_frame_name('main'), 'ftop' => html_get_frame_name('ftop'), 'fnav' => html_get_frame_name('fnav'), 'left' => html_get_frame_name('left'), 'right' => html_get_frame_name('right'), 'pm_folders' => html_get_frame_name('pm_folders'), 'pm_messages' => html_get_frame_name('pm_messages')));
if ($images_array = glob("styles/{$user_style}/images/*.png")) {
    foreach ($images_array as $image_filename) {
        $image_filename = basename($image_filename);
        $json_data['images'][$image_filename] = html_style_image($image_filename);
    }
}
// Decide on the correct Content-Type and encoding
// of the content. This allows Beehive to reload the
// JSON data via the same script, either for use
// in a <script> tag or via AJAX.
if (isset($_GET['json'])) {
    $content_type = 'application/json';
    $content = json_encode($json_data);
} else {
    $content_type = 'text/javascript';
    $content = sprintf('var beehive = $.extend({}, beehive, %s);
                        $(document).ready(function() {
                          $(beehive).trigger("init");
                        });', json_encode($json_data));
}
// Send correct Content-Type header
header(sprintf('Content-type: %s; charset=UTF-8', $content_type), true);
// Check the cache of the file.
cache_check_etag(md5($content_type . $content));
// Output the content
echo $content;