예제 #1
0
/**
 * Configuration Manager
 * ---------------------
 */
Route::accept($config->manager->slug . '/config', function () use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    Config::set(array('page_title' => $speak->configs . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.config.php'));
    if ($request = Request::post()) {
        Guardian::checkToken($request['token']);
        $bools = array('comments.allow' => false, 'comments.moderation' => false, 'widget_include_css' => false, 'widget_include_js' => false, 'html_parser.active' => Request::post('html_parser.active', false));
        $pages = array('index' => 'article', 'tag' => 'tag', 'archive' => 'archive', 'search' => 'search', 'manager' => 'manager');
        $slugs = array();
        if ($files = Get::pages()) {
            foreach ($files as $file) {
                list($_time, $_kind, $_slug) = explode('_', File::N($file), 3);
                $slugs[$_slug] = 1;
            }
            unset($files);
        }
        foreach ($bools as $bool => $fallback) {
            // Fix(es) for checkbox input(s)
            Mecha::SVR($request, $bool, Request::post($bool, $fallback));
        }
        foreach ($pages as $page => $default) {
            // Fix(es) for slug pattern input(s)
            $request[$page]['slug'] = Text::parse(Request::post($page . '.slug', $default), '->slug');
            if (Request::post($page . '.per_page') < 1 || floor(Request::post($page . '.per_page')) != Request::post($page . '.per_page')) {
                Notify::error($speak->notify_invalid_per_page_number);
예제 #2
0
<?php

$bucket = array();
if ($config->total_pages > 0) {
    foreach (Get::pages() as $page) {
        list($time, $kind, $slug) = explode('_', File::N($page), 3);
        $bucket[] = (object) array('url' => $config->url . '/' . $slug, 'date' => Date::format($time, 'c'), 'changefreq' => 'weekly', 'priority' => (string) '0.5');
    }
}
if ($config->total_articles > 0) {
    foreach (Get::articles() as $article) {
        list($time, $kind, $slug) = explode('_', File::N($article), 3);
        $bucket[] = (object) array('url' => $config->url . '/' . $config->index->slug . '/' . $slug, 'date' => Date::format($time, 'c'), 'changefreq' => 'weekly', 'priority' => (string) '1.0');
    }
}
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
if (!empty($bucket)) {
    foreach ($bucket as $i => $item) {
        echo '<url>';
        echo '<loc>' . $item->url . '</loc>';
        echo '<lastmod>' . $item->date . '</lastmod>';
        echo '<changefreq>' . $item->changefreq . '</changefreq>';
        echo '<priority>' . $item->priority . '</priority>';
        Weapon::fire('sitemap_item', array($item, $i));
        echo '</url>';
    }
}
echo '</urlset>';
예제 #3
0
     }
     $page = Mecha::O(array('id' => "", 'path' => "", 'state' => 'draft', 'date' => array('W3C' => ""), 'title' => $config->defaults->page_title, 'slug' => "", 'content_raw' => $config->defaults->page_content, 'content_type' => $config->html_parser, 'description' => "", 'author' => Guardian::get('author'), 'css_raw' => $config->defaults->page_custom_css, 'js_raw' => $config->defaults->page_custom_js, 'fields' => array()));
     Config::set(array('page_title' => Config::speak('manager.title_new_', $speak->page) . $config->title_separator . $config->manager->title, 'page' => Mecha::A($page)));
 }
 $G = array('data' => Mecha::A($page));
 Config::set('html_parser', $page->content_type);
 if ($request = Request::post()) {
     Guardian::checkToken($request['token']);
     $task_connect = $page;
     include DECK . DS . 'workers' . DS . 'task.field.5.php';
     include DECK . DS . 'workers' . DS . 'task.field.6.php';
     $extension = $request['action'] === 'publish' ? '.txt' : '.draft';
     // Check for duplicate slug, except for the current old slug.
     // Allow user(s) to change their post slug, but make sure they
     // do not type the slug of another post.
     if (trim($slug) !== "" && $slug !== $page->slug && ($files = Get::pages('DESC', "", 'txt,draft,archive'))) {
         foreach ($files as $file) {
             if (strpos(File::B($file), '_' . $slug . '.') !== false) {
                 Notify::error(Config::speak('notify_error_slug_exist', $slug));
                 Guardian::memorize($request);
                 break;
             }
         }
         unset($files);
     }
     // Slug must contains at least one letter or one `-`
     if (!preg_match('#[a-z\\-]#i', $slug)) {
         Notify::error($speak->notify_error_slug_missing_letter);
         Guardian::memorize($request);
     }
     // Check for empty post content