示例#1
0
function catalog_build($action, $settings, $board)
{
    global $config;
    $b = new Catalog($settings);
    $boards = explode(' ', $settings['boards']);
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a reply has been made)
    //	- post-thread (a thread has been made)
    if ($action === 'all') {
        foreach ($boards as $board) {
            if ($config['smart_build']) {
                file_unlink($config['dir']['home'] . $board . '/catalog.html');
            } else {
                $b->build($board);
            }
        }
    } elseif (in_array($board, $boards) && $action == 'post-thread' || $settings['update_on_posts'] && $action == 'post' || $settings['update_on_posts'] && $action == 'post-delete') {
        if ($config['smart_build']) {
            file_unlink($config['dir']['home'] . $board . '/catalog.html');
        } else {
            $b->build($board);
        }
    }
    // FIXME: Check that Ukko is actually enabled
    if ($settings['enable_ukko'] && ($action === 'all' || $action === 'post' || $action === 'post-thread' || $action === 'post-delete')) {
        $b->buildUkko();
    }
}
示例#2
0
function catalog_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a reply has been made)
    //	- post-thread (a thread has been made)
    if ($settings['all']) {
        $boards = listBoards(TRUE);
    } else {
        $boards = explode(' ', $settings['boards']);
    }
    if ($action == 'all') {
        foreach ($boards as $board) {
            $b = new Catalog();
            if ($config['smart_build']) {
                file_unlink($config['dir']['home'] . $board . '/catalog.html');
            } else {
                $b->build($settings, $board);
            }
            if (php_sapi_name() === "cli") {
                echo "Rebuilding {$board} catalog...\n";
            }
        }
    } elseif ($action == 'post-thread' || $settings['update_on_posts'] && $action == 'post' || $settings['update_on_posts'] && $action == 'post-delete' && in_array($board, $boards) | $settings['all']) {
        $b = new Catalog();
        if ($config['smart_build']) {
            file_unlink($config['dir']['home'] . $board . '/catalog.html');
        } else {
            $b->build($settings, $board);
        }
    }
}
示例#3
0
文件: theme.php 项目: vicentil/vichan
function catalog_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a reply has been made)
    //	- post-thread (a thread has been made)
    $boards = explode(' ', $settings['boards']);
    if ($action == 'all') {
        foreach ($boards as $board) {
            $b = new Catalog();
            $b->build($settings, $board);
        }
    } elseif ($action == 'post-thread' || $settings['update_on_posts'] && $action == 'post' || $settings['update_on_posts'] && $action == 'post-delete' && in_array($board, $boards)) {
        $b = new Catalog();
        $b->build($settings, $board);
    }
}