Exemplo n.º 1
0
// Edit user groups.
require_once dirname(dirname(__FILE__)) . '/config.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/errors.php';
require_once Config::ABS_PATH . '/lib/logging.php';
require_once Config::ABS_PATH . '/lib/exceptions.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/logging.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Check permission and write message to log file.
    if (!is_admin()) {
        // Cleanup.
        DataExchange::releaseResources();
        display_error_page($smarty, new NotAdminError());
Exemplo n.º 2
0
 * See license.txt for more info.*
 *********************************/
// Shi exit callback.
require_once dirname(dirname(__FILE__)) . '/config.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/errors.php';
require_once Config::ABS_PATH . '/lib/exceptions.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Check parameters.
    if (!isset($_GET['file']) || !ctype_digit($_GET['file'])) {
        throw new Exception('Bad file passed.');
    }
    if (!isset($_GET['time']) || !ctype_digit($_GET['time'])) {
Exemplo n.º 3
0
 **********************************/
/*
 * Script of imageboard main page.
 */
require_once dirname(__FILE__) . '/config.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/exceptions.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Generate main page html-code and display it.
    $smarty->assign('ib_name', Config::IB_NAME);
    $smarty->display('index.tpl');
    // Cleanup.
    DataExchange::releaseResources();
Exemplo n.º 4
0
/**
 * Get attachments of post.
 * @param SmartyKotobaSetup $smarty Template engine.
 * @param array $board Board.
 * @param array $post Post.
 * @param array $posts_attachments Posts attachemnts relations.
 * @param array $attachments Attachemnts.
 * @return array
 * attachments.
 */
function wrappers_attachments_get_by_post($smarty, $board, &$post, $posts_attachments, $attachments)
{
    $desired_attachments = array();
    $post['with_attachments'] = false;
    foreach ($posts_attachments as $pa) {
        if ($pa['post'] == $post['id']) {
            foreach ($attachments as $a) {
                if ($a['attachment_type'] == $pa['attachment_type']) {
                    switch ($a['attachment_type']) {
                        case Config::ATTACHMENT_TYPE_FILE:
                            if ($a['id'] == $pa['file']) {
                                $a['file_link'] = Config::DIR_PATH . "/{$board['name']}/other/{$a['name']}";
                                $a['thumbnail_link'] = Config::DIR_PATH . "/img/{$a['thumbnail']}";
                                $a['deleted'] = $pa['deleted'];
                                $post['with_attachments'] = true;
                                array_push($desired_attachments, $a);
                            }
                            break;
                        case Config::ATTACHMENT_TYPE_IMAGE:
                            if ($a['id'] == $pa['image']) {
                                $a['image_link'] = Config::DIR_PATH . "/{$board['name']}/img/{$a['name']}";
                                $a['thumbnail_link'] = Config::DIR_PATH . "/{$board['name']}/thumb/{$a['thumbnail']}";
                                $a['deleted'] = $pa['deleted'];
                                $post['with_attachments'] = true;
                                array_push($desired_attachments, $a);
                            }
                            break;
                        case Config::ATTACHMENT_TYPE_LINK:
                            if ($a['id'] == $pa['link']) {
                                $a['deleted'] = $pa['deleted'];
                                $post['with_attachments'] = true;
                                array_push($desired_attachments, $a);
                            }
                            break;
                        case Config::ATTACHMENT_TYPE_VIDEO:
                            if ($a['id'] == $pa['video']) {
                                $a['deleted'] = $pa['deleted'];
                                $smarty->assign('code', $a['code']);
                                $a['video_link'] = $smarty->fetch('youtube.tpl');
                                $post['with_attachments'] = true;
                                array_push($desired_attachments, $a);
                            }
                            break;
                        default:
                            throw new Exception('Not supported.');
                            break;
                    }
                }
            }
        }
    }
    return $desired_attachments;
}
Exemplo n.º 5
0
require_once Config::ABS_PATH . '/lib/exceptions.php';
require_once Config::ABS_PATH . '/lib/errors.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/wrappers.php';
require_once Config::ABS_PATH . '/lib/popdown_handlers.php';
require_once Config::ABS_PATH . '/lib/events.php';
require_once Config::ABS_PATH . '/lib/wrappers.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Fix for Firefox.
    header("Cache-Control: private");
    // Check for requied parameters.
    foreach (array('board') as $param) {
        if (!isset($_REQUEST[$param])) {
Exemplo n.º 6
0
 *
 * Prameters:
 * no parameters.
 */
require_once dirname(__FILE__) . '/config.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/exceptions.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Get boards and categories and make tree for navbar.
    $categories = categories_get_all();
    $boards = boards_get_visible($_SESSION['user']);
    make_category_boards_tree($categories, $boards);
    // Конгломерат. Разкомментируйте и отредактируйте.
Exemplo n.º 7
0
/*
 * Script of news page.
 */
require_once dirname(__FILE__) . '/config.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/wrappers.php';
require_once Config::ABS_PATH . '/lib/exceptions.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Get boards and categories and make tree for navbar.
    $categories = categories_get_all();
    $boards = boards_get_visible($_SESSION['user']);
    make_category_boards_tree($categories, $boards);
    // Generate news html-code.
Exemplo n.º 8
0
 *********************************/
/*
 * Script shows user id and groups.
 */
require_once dirname(__FILE__) . '/config.php';
require_once Config::ABS_PATH . '/lib/misc.php';
require_once Config::ABS_PATH . '/lib/db.php';
require_once Config::ABS_PATH . '/lib/exceptions.php';
try {
    // Initialization.
    kotoba_session_start();
    if (Config::LANGUAGE != $_SESSION['language']) {
        require Config::ABS_PATH . "/locale/{$_SESSION['language']}/messages.php";
    }
    locale_setup();
    $smarty = new SmartyKotobaSetup();
    // Check if client banned.
    if (($ban = bans_check(get_remote_addr())) !== FALSE) {
        // Cleanup.
        DataExchange::releaseResources();
        $smarty->assign('ip', $_SERVER['REMOTE_ADDR']);
        $smarty->assign('reason', $ban['reason']);
        $smarty->display('banned.tpl');
        session_destroy();
        exit(1);
    }
    // Generate my id page html-code and display it.
    $smarty->assign('show_control', is_admin() || is_mod());
    $smarty->assign('boards', boards_get_visible($_SESSION['user']));
    $smarty->assign('id', $_SESSION['user']);
    $smarty->assign('groups', $_SESSION['groups']);