function nel_render_ban_panel_modify($dataforce, $dbh)
{
    $render = new nel_render();
    nel_render_header($dataforce, $render, array());
    $result = $dbh->query('SELECT * FROM ' . BANTABLE . ' WHERE id=' . $dataforce['banid'] . '');
    $baninfo = $result->fetch(PDO::FETCH_ASSOC);
    unset($result);
    $render->add_data('appeal_check', '');
    $render->add_data('ban_expire', date("D F jS Y  H:i:s", $bandinfo['length'] + $baninfo['ban_time']));
    $render->add_data('ban_time', date("D F jS Y  H:i:s", $baninfo['ban_time']));
    $length2 = $baninfo['length'] / 3600;
    $render->add_data('ban_length_hours', 0);
    $render->add_data('ban_length_days', 0);
    if ($length2 >= 24) {
        $length2 = $length2 / 24;
        $render->add_data('ban_length_days', floor($length2));
        $length2 = $length2 - $render->retrieve_data('ban_length_days');
        $render->add_data('ban_length_hours', $length2 * 24);
    }
    if ($baninfo['appeal_status'] > 1) {
        $render->add_data('appeal_check', 'checked');
    }
    $render->parse('bans_panel_modify_ban.tpl', 'management');
    nel_render_basic_footer($render);
    $render->output(TRUE);
}
function nel_render_derp($diagnostic)
{
    $render = new nel_render();
    nel_render_header(array(), $render, array());
    $render->parse('derp.tpl', '');
    nel_render_basic_footer($render);
    $render->output(TRUE);
}
Esempio n. 3
0
function about_screen()
{
    $render = new nel_render();
    $render->add_data('header_type', 'ABOUT');
    nel_render_header(array(), $render, array());
    $render->output(TRUE);
    echo '
    <div class="text-center">
        <p>
            <span style="font-weight: bold; font-size: 1.25em; color: blue;">Nelliel Imageboard</span><br>
            Version: ' . NELLIEL_VERSION . '
        </p>
        <p class="text-center">
            Copyright (c) 2010-2015, <a href="http://www.nelliel.com">Nelliel Project</a><br>
            All rights reserved.
        </p>
		<div class="nelliel-license-div">
            <p style="max-width: 40em;">
                Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
            </p>
            <p>
                1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
            </p>
            <p>
                2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
                and/or other materials provided with the distribution.
            </p>
            <p>
                3) Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without
                specific prior written permission.
            </p>
            <img src="board_files/imagez/luna_canterlot_disclaimer.png" alt="Canterlot Voice Disclaimer" width="320" height="180" style="float: left; padding-right: 8px;">
            <p style="margin-left: 330px;">
                THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
                THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
                FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
                LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
                NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
            </p>
            <br>
            <hr class="clear">
            <p>
                Default filetype icons are from the Soft Scraps pack made by <a href="http://deleket.deviantart.com/" title="Deleket">Deleket</a>
            </p>
            <p>
                <a href="http://pageconfig.com/post/portable-utf8" title="Portable UTF-8">Portable UTF-8</a> library created by <a href="http://pageconfig.com">Hamid Sarfraz</a>.
            </p>
            <p class="text-center">
                <a href="' . PHP_SELF2 . PHP_EXT . '">' . nel_stext('LINK_RETURN') . '</a>
            </p>
        </div>
	</div>
    <hr>
</body>
</html>';
}
function nel_render_staff_panel_edit($dataforce, $auth)
{
    $render = new nel_render();
    array_walk($auth['perms'], create_function('&$item1', '$item1 = is_bool($item1) ? $item1 === TRUE ? "checked" : "" : $item1;'));
    $render->add_multiple_data($auth['perms']);
    nel_render_header($dataforce, $render, array());
    $render->parse('staff_panel_edit.tpl', 'management');
    nel_render_footer($render, FALSE, FALSE, FALSE, FALSE, FALSE);
    $render->output(TRUE);
}
Esempio n. 5
0
function nel_login($dataforce, $authorize)
{
    $render = new nel_render();
    $render->add_data('dotdot', '');
    nel_render_header($dataforce, $render, array());
    if (!empty($_SESSION)) {
        $user_auth = $authorize->get_user_auth($_SESSION['username']);
        $render->add_multiple_data($user_auth['perms']);
        $render->parse('manage_options.tpl', 'management');
    } else {
        $render->parse('manage_login.tpl', 'management');
    }
    nel_render_basic_footer($render);
    $render->output(TRUE);
}
function nel_render_admin_panel($dataforce, $dbh)
{
    $render = new nel_render();
    $render->input(nel_render_header($dataforce, $render, array()));
    $result = $dbh->query('SELECT * FROM ' . CONFIGTABLE . '');
    $rows = $result->fetchAll(PDO::FETCH_ASSOC);
    unset($result);
    $board_settings = array('iso' => '', 'com' => '', 'us' => '', 'archive' => '', 'prune' => '', 'nothing' => '');
    foreach ($rows as $config_line) {
        if ($config_line['config_type'] !== 'board_setting') {
            if ($config_line['setting'] === '1') {
                $board_settings[$config_line['config_name']] = 'checked';
            } else {
                $board_settings[$config_line['config_name']] = '';
            }
        } else {
            if ($config_line['config_type'] === 'board_setting') {
                switch ($config_line['setting']) {
                    case 'ISO':
                        $board_settings['iso'] = 'checked';
                        break;
                    case 'COM':
                        $board_settings['com'] = 'checked';
                        break;
                    case 'US':
                        $board_settings['us'] = 'checked';
                        break;
                    case 'ARCHIVE':
                        $board_settings['archive'] = 'checked';
                        break;
                    case 'PRUNE':
                        $board_settings['prune'] = 'checked';
                        break;
                    case 'NOTHING':
                        $board_settings['nothing'] = 'checked';
                        break;
                    default:
                        $board_settings[$config_line['config_name']] = $config_line['setting'];
                }
            }
        }
    }
    $render->add_multiple_data($board_settings);
    $render->parse('admin_panel.tpl', 'management');
    $render->input(nel_render_basic_footer($render));
    $render->output(TRUE);
}
function nel_render_thread_panel($dataforce, $expand, $dbh)
{
    $render = new nel_render();
    nel_render_header($dataforce, $render, array());
    nel_render_thread_panel_form($dataforce, $render);
    if ($expand) {
        $render->add_data('expand_thread', TRUE);
        $thread_id = utf8_str_replace('Expand ', '', $_POST['expand_thread']);
        $prepared = $dbh->prepare('SELECT * FROM ' . POSTTABLE . ' WHERE response_to=:threadid OR post_number=:threadid2 ORDER BY post_number ASC');
        $prepared->bindParam(':threadid', $thread_id, PDO::PARAM_INT);
        $prepared->bindParam(':threadid2', $thread_id, PDO::PARAM_INT);
        // This really shouldn't be necessary :|
        $prepared->execute();
    } else {
        $render->add_data('expand_thread', FALSE);
        $prepared = $dbh->query('SELECT * FROM ' . POSTTABLE . ' WHERE response_to=0 ORDER BY post_number DESC');
    }
    $j = 0;
    $all = 0;
    $thread_data = $prepared->fetchAll(PDO::FETCH_ASSOC);
    unset($prepared);
    foreach ($thread_data as $thread) {
        if ($thread['has_file'] === '1') {
            $result = $dbh->query('SELECT * FROM ' . FILETABLE . ' WHERE post_ref=' . $thread['post_number'] . ' ORDER BY file_order asc');
            $thread['files'] = $result->fetchALL(PDO::FETCH_ASSOC);
            unset($result);
            foreach ($thread['files'] as $file) {
                $all += $file['filesize'];
            }
        }
        $dataforce['j_increment'] = $j;
        nel_render_thread_panel_thread($dataforce, $render, $thread);
        $j++;
    }
    $dataforce['all_filesize'] = (int) ($all / 1024);
    nel_render_thread_panel_bottom($dataforce, $render, $thread_data);
    nel_render_basic_footer($render);
    $render->output(TRUE);
}
Esempio n. 8
0
function nel_main_nel_thread_generator($dataforce, $dbh)
{
    $gen_data = array();
    $gen_data['insert_hr'] = FALSE;
    $dataforce['dotdot'] = '';
    $result = $dbh->query('SELECT post_number FROM ' . POSTTABLE . ' WHERE response_to=0 AND archive_status=0 ORDER BY sticky desc,last_update desc');
    $front_page_list = $result->fetchALL(PDO::FETCH_COLUMN);
    unset($result);
    $treeline = array(0);
    // Finding the last entry number
    $result = $dbh->query('SELECT COUNT(post_number) FROM ' . POSTTABLE . ' WHERE response_to=0');
    $row = $result->fetch();
    unset($result);
    $counttree = count($front_page_list);
    // Special handling when there's no content
    if ($counttree === 0) {
        $render = new nel_render();
        $render->add_data('header_type', 'NORMAL');
        nel_render_header($dataforce, $render, $treeline);
        nel_render_posting_form($dataforce, $render);
        $render->add_data('prev_nav', '');
        $render->add_data('next_nav', '');
        $render->add_data('page_nav', '');
        nel_render_footer($render, FALSE, TRUE, TRUE, FALSE, TRUE);
        if (empty($_SESSION) || $_SESSION['ignore_login']) {
            nel_write_file(PHP_SELF2 . PHP_EXT, $render->output(FALSE), 0644);
        } else {
            $render->output(TRUE);
        }
        return;
    }
    $thread_counter = 0;
    $page = 1;
    $gen_data['post_counter'] = -1;
    while ($thread_counter < $counttree) {
        $render = new nel_render();
        $dataforce['omitted_done'] = TRUE;
        $render->add_data('header_type', 'NORMAL');
        nel_render_header($dataforce, $render, $treeline);
        nel_render_posting_form($dataforce, $render);
        $end_of_thread = FALSE;
        $sub_page_thread_counter = 0;
        $gen_data['first100'] = FALSE;
        while ($sub_page_thread_counter < BS_THREADS_PER_PAGE) {
            if ($gen_data['post_counter'] === -1) {
                $result = $dbh->query('SELECT * FROM ' . POSTTABLE . ' WHERE post_number=' . $front_page_list[$thread_counter] . '');
                $tree_op = $result->fetchALL(PDO::FETCH_ASSOC);
                unset($result);
                $result = $dbh->query('SELECT * FROM ' . POSTTABLE . ' WHERE response_to=' . $front_page_list[$thread_counter] . ' ORDER BY post_number desc LIMIT ' . (BS_ABBREVIATE_THREAD - 1) . '');
                $tree_replies = $result->fetchALL(PDO::FETCH_ASSOC);
                unset($result);
                $treeline = array_merge($tree_op, array_reverse($tree_replies));
                $gen_data['post_count'] = $treeline[0]['post_count'];
                $gen_data['expand_post'] = $gen_data['post_count'] > BS_ABBREVIATE_THREAD ? TRUE : FALSE;
                $gen_data['first100'] = $gen_data['post_count'] > 100 ? TRUE : FALSE;
            }
            if (!empty($treeline[$gen_data['post_counter']]) && !empty($treeline[$gen_data['post_counter'] + 1])) {
                ++$gen_data['post_counter'];
            } else {
                if ($gen_data['post_counter'] === -1) {
                    $gen_data['post_counter'] = 0;
                } else {
                    $end_of_thread = TRUE;
                    $sub_page_thread_counter = $thread_counter == $counttree - 1 ? BS_THREADS_PER_PAGE : ++$sub_page_thread_counter;
                    ++$thread_counter;
                    $gen_data['insert_hr'] = TRUE;
                    nel_render_post($dataforce, $render, FALSE, FALSE, $gen_data, $treeline, $dbh);
                    $gen_data['insert_hr'] = FALSE;
                }
            }
            if (!$end_of_thread) {
                $gen_data['has_file'] = FALSE;
                if ($treeline[$gen_data['post_counter']]['has_file'] == 1) {
                    $gen_data['has_file'] = TRUE;
                    $result = $dbh->query('SELECT * FROM ' . FILETABLE . ' WHERE post_ref=' . $treeline[$gen_data['post_counter']]['post_number'] . ' ORDER BY file_order asc');
                    $gen_data['files'] = $result->fetchALL(PDO::FETCH_ASSOC);
                    unset($result);
                }
                if ($treeline[$gen_data['post_counter']]['response_to'] > 0) {
                    if (!$treeline[$gen_data['post_counter']]['post_number']) {
                        break;
                    }
                    if ($gen_data['post_count'] > BS_ABBREVIATE_THREAD && $gen_data['post_counter'] === 1) {
                        $dataforce['omitted_done'] = FALSE;
                        nel_render_post($dataforce, $render, TRUE, TRUE, $gen_data, $treeline, $dbh);
                        $dataforce['omitted_done'] = TRUE;
                    } else {
                        nel_render_post($dataforce, $render, TRUE, TRUE, $gen_data, $treeline, $dbh);
                    }
                } else {
                    nel_render_post($dataforce, $render, FALSE, FALSE, $gen_data, $treeline, $dbh);
                }
            } else {
                $end_of_thread = FALSE;
                $gen_data['post_counter'] = -1;
            }
        }
        // if not in res display mode
        $prev = $page - 1;
        $next = $page + 1;
        $render->add_data('page_nav', ' ');
        $page_count = (int) ceil($counttree / BS_THREADS_PER_PAGE);
        $render->add_data('main_page', TRUE);
        if ($page === 1) {
            $render->add_data('prev_nav', 'Previous');
        } else {
            if ($page === 2) {
                $render->add_data('prev_nav', '<a href="' . PHP_SELF2 . PHP_EXT . '">Previous</a> ');
            } else {
                $render->add_data('prev_nav', '<a href="' . PHP_SELF2 . ($page - 2) . PHP_EXT . '">Previous</a>');
            }
        }
        $render->add_data('next_nav', $page === $page_count || $dataforce['max_pages'] === 1 ? 'Next' : '<a href="' . PHP_SELF2 . $page . PHP_EXT . '">Next</a>');
        $i = 0;
        while ($i < $page_count) {
            if ($i === 0) {
                $render->add_data('page_nav', $render->retrieve_data('page_nav') . ($page > 1 ? '[<a href="' . PHP_SELF2 . PHP_EXT . '">0</a>] ' : '[0] '));
            } else {
                if ($i === $page - 1 || $dataforce['max_pages'] === 1) {
                    $render->add_data('page_nav', $render->retrieve_data('page_nav') . '[' . $i . '] ');
                } else {
                    $render->add_data('page_nav', $render->retrieve_data('page_nav') . '[<a href="' . PHP_SELF2 . $i . PHP_EXT . '">' . $i . '</a>] ');
                }
            }
            ++$i;
        }
        nel_render_footer($render, FALSE, TRUE, TRUE, FALSE, TRUE);
        if (!empty($_SESSION) && !$_SESSION['ignore_login']) {
            if ($page >= $dataforce['current_page']) {
                $page = $counttree;
            }
            $render->output(TRUE);
            die;
        } else {
            $logfilename = $page === 1 ? PHP_SELF2 . PHP_EXT : PHP_SELF2 . ($page - 1) . PHP_EXT;
            nel_write_file($logfilename, $render->output(FALSE), 0644);
        }
        ++$page;
        unset($render);
    }
}
Esempio n. 9
0
function nel_thread_generator($dataforce, $dbh)
{
    $render = new nel_render();
    $render_expand = new nel_render();
    $render_collapse = new nel_render();
    $gen_data['insert_hr'] = FALSE;
    $dataforce['dotdot'] = '';
    $write_id = $dataforce['response_to'] === 0 || is_null($dataforce['response_to']) ? $dataforce['response_id'] : $dataforce['response_to'];
    $result = $dbh->query('SELECT * FROM ' . POSTTABLE . ' WHERE post_number=' . $write_id . ' UNION SELECT * FROM ' . POSTTABLE . ' WHERE response_to=' . $write_id . ' ORDER BY post_number asc');
    $treeline = $result->fetchAll(PDO::FETCH_ASSOC);
    unset($result);
    if (empty($treeline)) {
        return;
    }
    if (empty($_SESSION) || $_SESSION['ignore_login']) {
        $dataforce['dotdot'] = '../../';
    }
    $gen_data['post_count'] = $treeline[0]['post_count'];
    $page = 1;
    $gen_data['post_counter'] = 0;
    $gen_data['expand_post'] = FALSE;
    $dataforce['omitted_done'] = TRUE;
    $partlimit = 1;
    $gen_data['first100'] = FALSE;
    while ($gen_data['post_counter'] < $gen_data['post_count']) {
        if ($treeline[$gen_data['post_counter']]['has_file'] == 1) {
            $gen_data['has_file'] = TRUE;
            $result = $dbh->query('SELECT * FROM ' . FILETABLE . ' WHERE post_ref=' . $treeline[$gen_data['post_counter']]['post_number'] . ' ORDER BY file_order asc');
            $gen_data['files'] = $result->fetchALL(PDO::FETCH_ASSOC);
            unset($result);
        } else {
            $gen_data['has_file'] = FALSE;
        }
        if ($gen_data['post_counter'] === 0) {
            $render->add_data('header_type', 'NORMAL');
            nel_render_header($dataforce, $render, $treeline);
            nel_render_posting_form($dataforce, $render);
        }
        if ($partlimit === 100) {
            $render_temp = clone $render;
            $gen_data['insert_hr'] = TRUE;
            nel_render_post($dataforce, $render_temp, FALSE, FALSE, $gen_data, $treeline, $dbh);
            $gen_data['insert_hr'] = FALSE;
            nel_render_footer($render_temp, FALSE, TRUE, TRUE, TRUE, FALSE);
            nel_write_file(PAGE_PATH . $write_id . '/' . $dataforce['response_id'] . '-0-100.html', $render_temp->output(), 0644);
            unset($render_temp);
        }
        if ($treeline[$gen_data['post_counter']]['response_to'] > 0) {
            if (!$treeline[$gen_data['post_counter']]['post_number']) {
                break;
            }
            $resid = $dataforce['response_id'];
            $render_temp = new nel_render();
            $render_temp2 = new nel_render();
            $render_temp3 = new nel_render();
            nel_render_post($dataforce, $render_temp, TRUE, FALSE, $gen_data, $treeline, $dbh);
            // for thread
            $dataforce['response_id'] = 0;
            nel_render_post($dataforce, $render_temp2, TRUE, TRUE, $gen_data, $treeline, $dbh);
            // for collapse
            nel_render_post($dataforce, $render_temp3, TRUE, TRUE, $gen_data, $treeline, $dbh);
            // for expand
            $dataforce['response_id'] = $resid;
            if ($gen_data['post_count'] > BS_ABBREVIATE_THREAD) {
                if ($render_collapse->output() === '') {
                    $dataforce['omitted_done'] = FALSE;
                    nel_render_post($dataforce, $render_temp2, TRUE, TRUE, $gen_data, $treeline, $dbh);
                    // for collapse
                    $dataforce['omitted_done'] = TRUE;
                }
                if ($gen_data['post_counter'] > $gen_data['post_count'] - BS_ABBREVIATE_THREAD) {
                    $render_collapse->input($render_temp2->output());
                }
            }
            $render->input($render_temp->output());
            $render_expand->input($render_temp3->output());
        } else {
            nel_render_post($dataforce, $render, FALSE, FALSE, $gen_data, $treeline, $dbh);
        }
        ++$partlimit;
        ++$gen_data['post_counter'];
        unset($render_temp);
        unset($render_temp2);
        unset($render_temp3);
    }
    nel_render_footer($render, FALSE, TRUE, TRUE, TRUE, FALSE);
    if (!empty($_SESSION) && !$_SESSION['ignore_login']) {
        if ($dataforce['expand']) {
            $render_expand->output(TRUE);
        } else {
            if ($dataforce['collapse']) {
                $render_collapse->output(TRUE);
            } else {
                $render->output(TRUE);
            }
        }
        die;
    } else {
        nel_write_file(PAGE_PATH . $write_id . '/' . $dataforce['response_id'] . '.html', $render->output(FALSE), 0644);
        nel_write_file(PAGE_PATH . $write_id . '/' . $dataforce['response_id'] . '-expand.html', $render_expand->output(FALSE), 0644);
        nel_write_file(PAGE_PATH . $write_id . '/' . $dataforce['response_id'] . '-collapse.html', $render_collapse->output(FALSE), 0644);
    }
}
Esempio n. 10
0
function nel_render_ban_page($dataforce, $bandata)
{
    $render = new nel_render();
    $render->add_multiple_data($bandata);
    $render->add_data('appeal_status', (int) $bandata['appeal_status']);
    $render->add_data('format_length', date("D F jS Y  H:i", $bandata['length_base']));
    $render->add_data('format_time', date("D F jS Y  H:i", $bandata['ban_time']));
    $render->add_data('host', @inet_ntop($bandata['host']) ? inet_ntop($bandata['host']) : 'Unknown');
    nel_render_header($dataforce, $render, array());
    $render->parse('ban_page.tpl', '');
    nel_render_basic_footer($render);
    $render->output(TRUE);
}