Ejemplo n.º 1
0
function nel_settings_control($dataforce, $authorize, $dbh)
{
    $mode = $dataforce['mode_action'];
    if (!$authorize->get_user_perm($_SESSION['username'], 'perm_config')) {
        nel_derp(102, array('origin' => 'ADMIN'));
    }
    require_once INCLUDE_PATH . 'output/admin-panel-generation.php';
    $update = FALSE;
    if ($mode === 'update') {
        // Apply settings from admin panel
        $dbh->query('UPDATE ' . CONFIGTABLE . ' SET setting=""');
        while ($item = each($_POST)) {
            if ($item[0] !== 'mode' && $item[0] !== 'username' && $item[0] !== 'super_sekrit') {
                if ($item[0] === 'jpeg_quality' && $item[1] > 100) {
                    $item[0] = 100;
                }
                if ($item[0] === 'page_limit') {
                    $dataforce['max_pages'] = (int) $item[1];
                }
                $dbh->query('UPDATE ' . CONFIGTABLE . ' SET setting="' . $item[1] . '" WHERE config_name="' . $item[0] . '"');
            }
        }
        nel_cache_rules($dbh);
        nel_cache_settings($dbh);
        nel_regen($dataforce, NULL, 'full', FALSE, $dbh);
    }
    nel_render_admin_panel($dataforce, $dbh);
}
Ejemplo n.º 2
0
function nel_regen(&$dataforce, $id, $mode, $modmode, $dbh)
{
    global $link_resno, $link_updates;
    require_once INCLUDE_PATH . 'output-filter.php';
    if (!empty($_SESSION) && !$modmode) {
        $temp = $_SESSION['ignore_login'];
        $_SESSION['ignore_login'] = TRUE;
    }
    if ($mode === 'full') {
        $result = $dbh->query('SELECT post_number FROM ' . POSTTABLE . ' WHERE response_to=0 AND archive_status=0');
        $ids = $result->fetchAll(PDO::FETCH_COLUMN);
    }
    if ($mode === 'thread') {
        if (is_array($id)) {
            $ids = $id;
        } else {
            $ids[0] = $id;
        }
    }
    if ($mode === 'main' || $mode === 'full') {
        require_once INCLUDE_PATH . 'output/main-generation.php';
        nel_update_archive_status($dataforce, $dbh);
        $dataforce['response_id'] = 0;
        $link_resno = 0;
        nel_main_nel_thread_generator($dataforce, $dbh);
    }
    if ($mode === 'thread' || $mode === 'full') {
        require_once INCLUDE_PATH . 'output/thread-generation.php';
        $threads = count($ids);
        $i = 0;
        while ($i < $threads) {
            $dataforce['response_id'] = $ids[$i];
            nel_thread_generator($dataforce, $dbh);
            ++$i;
        }
    }
    if ($mode === 'cache') {
        $dataforce['rules_list'] = nel_cache_rules($dbh);
        nel_cache_settings($dbh);
        $dataforce['post_links'] = $link_updates;
        nel_regen_template_cache();
    }
    if (!empty($_SESSION) && !$modmode) {
        $_SESSION['ignore_login'] = $temp;
    }
    $dataforce['post_links'] = $link_updates;
}