Example #1
0
});
// Show the RSS feed
get('/feed/rss', function () {
    header('Content-Type: application/rss+xml');
    // Show an RSS feed with the 30 latest posts
    echo generate_rss(get_posts(null, 1, config('rss.count')));
});
// Generate OPML file
get('/feed/opml', function () {
    header('Content-Type: text/xml');
    // Generate OPML file for the RSS
    echo generate_opml();
});
get('/admin/update/now/:csrf', function ($CSRF) {
    $proper = is_csrf_proper($CSRF);
    $updater = new \Kanti\HubUpdater(array('name' => 'danpros/htmly', 'prerelease' => !!config("prerelease")));
    if (login() && $proper && $updater->able()) {
        $updater->update();
        config('views.root', 'system/admin/views');
        render('updated-to', array('head_contents' => head_contents('Updated - ' . blog_title(), blog_description(), site_url()), 'info' => $updater->getCurrentInfo()));
    } else {
        $login = site_url() . 'login';
        header("location: {$login}");
    }
});
get('/:static/add', function ($static) {
    if (login()) {
        config('views.root', 'system/admin/views');
        $post = get_static_post($static);
        if (!$post) {
            not_found();
Example #2
0
});
// Show Update page
get('/admin/update', function () {
    if (login()) {
        config('views.root', 'system/admin/views');
        render('update', array('title' => 'Check for Update - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'bodyclass' => 'updatepage', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Update HTMLy'));
    } else {
        $login = site_url() . 'login';
        header("location: {$login}");
    }
    die;
});
// Show the update now link
get('/admin/update/now/:csrf', function ($CSRF) {
    $proper = is_csrf_proper($CSRF);
    $updater = new \Kanti\HubUpdater(array('name' => 'danpros/htmly', 'prerelease' => !!config("prerelease")));
    if (login() && $proper && $updater->able()) {
        $updater->update();
        config('views.root', 'system/admin/views');
        render('updated-to', array('title' => 'Updated - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'info' => $updater->getCurrentInfo(), 'bodyclass' => 'updatepage', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Update HTMLy'));
    } else {
        $login = site_url() . 'login';
        header("location: {$login}");
    }
});
// Show category page
get('/admin/categories', function () {
    if (login()) {
        config('views.root', 'system/admin/views');
        render('categories', array('title' => 'Categories - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'bodyclass' => 'categoriespage', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Categories'));
    } else {
Example #3
0
<?php

config('source', 'config/config.ini');
$updater = new Kanti\HubUpdater("danpros/htmly");
$info = $updater->getCurrentInfo();
$versionNumber = substr($info['tag_name'], 1);
function isGraterThan($string)
{
    global $versionNumber;
    return version_compare($versionNumber, $string) > 0;
}
// http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
function rrmdir($dir)
{
    if (is_dir($dir)) {
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir . "/" . $object) == "dir") {
                    rrmdir($dir . "/" . $object);
                } else {
                    unlink($dir . "/" . $object);
                }
            }
        }
        reset($objects);
        rmdir($dir);
    } else {
        if (is_file($dir)) {
            unlink($dir);
        }