diff --git a/cache/installedVersion.json b/cache/installedVersion.json
new file mode 100644
index 0000000..54985e8
--- /dev/null
+++ b/cache/installedVersion.json
@@ -0,0 +1,4 @@
+{
+ "id": 397789,
+ "tag_name": "v2.1"
+}
\ No newline at end of file
diff --git a/system/admin/views/updated-to.html.php b/system/admin/views/updated-to.html.php
new file mode 100644
index 0000000..c11dc91
--- /dev/null
+++ b/system/admin/views/updated-to.html.php
@@ -0,0 +1,5 @@
+printOne();
+
+?>
\ No newline at end of file
diff --git a/system/htmly.php b/system/htmly.php
index 9720f68..0c29618 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -6,6 +6,7 @@ date_default_timezone_set('Asia/Jakarta');
// Explicitly including the dispatch framework,
// and our functions.php file
require 'system/includes/dispatch.php';
+require 'system/includes/updater.php';
require 'system/includes/functions.php';
require 'system/admin/admin.php';
require 'system/includes/session.php';
@@ -1109,6 +1110,26 @@ get('/feed/opml',function(){
});
+get('/admin/update/now/:csrf',function($CSRF){
+
+ $proper = is_csrf_proper($CSRF);
+ $updater = new Updater;
+ if( login() && $proper && $updater->updateAble())
+ {
+ $updater->update();
+ config('views.root', 'system/admin/views');
+ render('updated-to', array(
+ 'head_contents' => head_contents('Updated - ' . blog_title(), blog_description(), site_url()),
+ 'updater' => $updater,
+ ));
+ }
+ else
+ {
+ $login = site_url() . 'login';
+ header("location: $login");
+ }
+});
+
// If we get here, it means that
// nothing has been matched above
diff --git a/system/includes/dispatch.php b/system/includes/dispatch.php
index 81df1d4..9b269c5 100644
--- a/system/includes/dispatch.php
+++ b/system/includes/dispatch.php
@@ -272,53 +272,51 @@ function content($value = null) {
}
function render($view, $locals = null, $layout = null) {
+ $login = login();
+ if(!$login) {
+ $c = str_replace('/', '#', str_replace('?', '~', $_SERVER['REQUEST_URI']));
+ $dir = 'cache/page';
+ $cachefile = $dir. '/' . $c . '.cache';
+ if(is_dir($dir) === false) {
+ mkdir($dir, 0777, true);
+ }
+ }
- if(!login()) {
- $c = str_replace('/', '#', str_replace('?', '~', $_SERVER['REQUEST_URI']));
- $dir = 'cache/page';
- $cachefile = $dir. '/' . $c . '.cache';
- if(is_dir($dir) === false) {
- mkdir($dir, 0777, true);
- }
- }
+ if (is_array($locals) && count($locals)) {
+ extract($locals, EXTR_SKIP);
+ }
- if (is_array($locals) && count($locals)) {
- extract($locals, EXTR_SKIP);
- }
+ if (($view_root = config('views.root')) == null)
+ error(500, "[views.root] is not set");
- if (($view_root = config('views.root')) == null)
- error(500, "[views.root] is not set");
+ ob_start();
+ include "{$view_root}/{$view}.html.php";
+ content(trim(ob_get_clean()));
- ob_start();
- include "{$view_root}/{$view}.html.php";
- content(trim(ob_get_clean()));
+ if ($layout !== false) {
- if ($layout !== false) {
+ if ($layout == null) {
+ $layout = config('views.layout');
+ $layout = ($layout == null) ? 'layout' : $layout;
+ }
- if ($layout == null) {
- $layout = config('views.layout');
- $layout = ($layout == null) ? 'layout' : $layout;
- }
+ $layout = "{$view_root}/{$layout}.html.php";
- $layout = "{$view_root}/{$layout}.html.php";
+ header('Content-type: text/html; charset=utf-8');
- header('Content-type: text/html; charset=utf-8');
+ ob_start();
+ require $layout;
- ob_start();
- require $layout;
-
- if(!login()) {
- if (!file_exists($cachefile)) {
- file_put_contents($cachefile, ob_get_contents());
- }
+ if(!$login) {
+ if (!file_exists($cachefile)) {
+ file_put_contents($cachefile, ob_get_contents());
+ }
}
- echo trim(ob_get_clean());
-
- } else {
- echo content();
- }
-
+ echo trim(ob_get_clean());
+ } else {
+ echo content();
+ }
}
function json($obj, $code = 200) {
diff --git a/system/includes/functions.php b/system/includes/functions.php
index 1644e78..23f9aad 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -1673,6 +1673,10 @@ function toolbar() {
$role = user('role', $user);
$base = site_url();
+ $CSRF = get_csrf();
+
+ $updater = new Updater;
+
echo <<
" . $releases[0]['body'] . "
\n"; + return $string; + } + + public function getName() + { + return $this->infos[0]['tag_name']; + } +} \ No newline at end of file