// 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(); } $post = $post[0]; render('add-page', array('head_contents' => head_contents('Add page - ' . blog_title(), blog_description(), site_url()), 'bodyclass' => 'addpage', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . $post->url . '">' . $post->title . '</a> Add page')); } else {
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> » 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> » 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> » Categories')); } else { $login = site_url() . 'login'; header("location: {$login}"); } die;
<?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); }