예제 #1
0
    Shield::attach('page-' . $slug);
}, 100);
/**
 * Home Page
 * ---------
 *
 * [1]. /
 *
 */
Route::accept('/', function () use($config, $excludes) {
    Session::kill('search.query');
    Session::kill('search.results');
    $s = Get::articles();
    if ($articles = Mecha::eat($s)->chunk(1, $config->index->per_page)->vomit()) {
        $articles = Mecha::walk($articles, function ($path) use($excludes) {
            return Get::article($path, $excludes);
        });
    } else {
        $articles = false;
    }
    Filter::add('pager:url', function ($url) {
        return Filter::apply('index:url', $url);
    });
    Config::set(array('articles' => $articles, 'pagination' => Navigator::extract($s, 1, $config->index->per_page, $config->index->slug)));
    Shield::attach('page-home');
}, 110);
/**
 * Route Hook: after
 * -----------------
 */
Weapon::fire('routes_after');
예제 #2
0
                }
                Guardian::kick($config->manager->slug . '/article/repair/id:' . Date::format($date, 'U'));
            }
        }
    }
    Weapon::add('SHIPMENT_REGION_BOTTOM', function () {
        echo Asset::javascript('manager/assets/sword/editor.compose.js', "", 'sword/editor.compose.min.js');
    }, 11);
    Shield::lot(array('segment' => 'article', 'default' => $article))->attach('manager', false);
});
/**
 * Article Killer
 * --------------
 */
Route::accept($config->manager->slug . '/article/kill/id:(:num)', function ($id = "") use($config, $speak) {
    if (!($article = Get::article($id, array('comments')))) {
        Shield::abort();
    }
    if (Guardian::get('status') !== 'pilot' && Guardian::get('author') !== $article->author) {
        Shield::abort();
    }
    Config::set(array('page_title' => $speak->deleting . ': ' . $article->title . $config->title_separator . $config->manager->title, 'article' => $article, 'cargo' => DECK . DS . 'workers' . DS . 'kill.article.php'));
    $G = array('data' => Mecha::A($article));
    if ($request = Request::post()) {
        Guardian::checkToken($request['token']);
        File::open($article->path)->delete();
        // Deleting comment(s) ...
        if ($comments = Get::comments($id, 'DESC', 'txt,hold')) {
            foreach ($comments as $comment) {
                File::open($comment)->delete();
            }
예제 #3
0
<?php

/**
 * Create New Comment
 * ------------------
 */
Weapon::add('shield_before', function () use($config, $speak) {
    $comment_id = 'comment-%d';
    // Your comment ID
    $comment_form_id = 'comment-form';
    // Your comment form ID
    $article = isset(Config::get('article')->path) ? Get::article(Config::get('article')->path) : false;
    if ($article && $config->page_type === 'article' && Request::method('post')) {
        $request = Request::post();
        // Check token
        Guardian::checkToken($request['token'], $config->url_current . '#' . $comment_form_id);
        $extension = $config->comment_moderation && !Guardian::happy() ? '.hold' : '.txt';
        // Check name
        if (trim($request['name']) === "") {
            Notify::error(Config::speak('notify_error_empty_field', $speak->comment_name));
        }
        // Check email
        if (trim($request['email']) !== "") {
            if (!Guardian::check($request['email'], '->email')) {
                Notify::error($speak->notify_invalid_email);
            } else {
                // Disallow passenger(s) from entering your email address in the comment email field
                if (!Guardian::happy() && $request['email'] === $config->author_email) {
                    Notify::warning(Config::speak('notify_warning_forbidden_input', '<em>' . $request['email'] . '</em>', strtolower($speak->email)));
                }
            }
예제 #4
0
    Shield::attach('page-' . $slug);
}, 100);
/**
 * Home Page
 * ---------
 *
 * [1]. /
 *
 */
Route::accept('/', function () use($config) {
    Session::kill('search_query');
    Session::kill('search_results');
    if ($files = Mecha::eat(Get::articles())->chunk(1, $config->index->per_page)->vomit()) {
        $articles = array();
        foreach ($files as $file) {
            $articles[] = Get::article($file, array('content', 'tags', 'css', 'js', 'comments'));
        }
        unset($files);
    } else {
        $articles = false;
    }
    Config::set(array('articles' => $articles, 'pagination' => Navigator::extract(Get::articles(), 1, $config->index->per_page, $config->index->slug)));
    Shield::attach('page-home');
}, 110);
/**
 * Do Routing
 * ----------
 */
Route::execute();
/**
 * 404 Page