summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-04 19:45:26 +0400
committerAndrew Dolgov <[email protected]>2013-04-04 19:45:26 +0400
commitf240d26e46f028f0b80d8a19760533ce722c84c4 (patch)
tree9b03b06da3b3241239e97c3f6c87fa29514ca3db
parentb4c47f7e7b4c8220e07115f27c373df20503d576 (diff)
move db-updater functionality to public, remove db-updater.php
-rwxr-xr-x[-rw-r--r--]cache/.htaccess0
-rwxr-xr-x[-rw-r--r--]cache/images/.empty0
-rwxr-xr-x[-rw-r--r--]cache/js/.empty0
-rwxr-xr-x[-rw-r--r--]cache/simplepie/.empty0
-rw-r--r--classes/handler/public.php103
-rwxr-xr-x[-rw-r--r--]feed-icons/.empty0
-rw-r--r--js/functions.js2
-rwxr-xr-x[-rw-r--r--]lock/.empty0
-rwxr-xr-x[-rw-r--r--]lock/.htaccess0
-rw-r--r--plugins/digest/digest.js2
-rw-r--r--utility.css4
11 files changed, 109 insertions, 2 deletions
diff --git a/cache/.htaccess b/cache/.htaccess
index 93169e4eb..93169e4eb 100644..100755
--- a/cache/.htaccess
+++ b/cache/.htaccess
diff --git a/cache/images/.empty b/cache/images/.empty
index e69de29bb..e69de29bb 100644..100755
--- a/cache/images/.empty
+++ b/cache/images/.empty
diff --git a/cache/js/.empty b/cache/js/.empty
index e69de29bb..e69de29bb 100644..100755
--- a/cache/js/.empty
+++ b/cache/js/.empty
diff --git a/cache/simplepie/.empty b/cache/simplepie/.empty
index e69de29bb..e69de29bb 100644..100755
--- a/cache/simplepie/.empty
+++ b/cache/simplepie/.empty
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 3d3d6727d..e95f118bb 100644
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -838,12 +838,115 @@ class Handler_Public extends Handler {
}
function dbupdate() {
+ if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) {
+ $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
+ render_login_form($link);
+ exit;
+ }
+
+ ?><html>
+ <head>
+ <title>Database Updater</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <link rel="stylesheet" type="text/css" href="utility.css"/>
+ </head>
+ <style type="text/css">
+ span.ok { color : #009000; font-weight : bold; }
+ span.err { color : #ff0000; font-weight : bold; }
+ </style>
+ <body>
+ <script type='text/javascript'>
+ function confirmOP() {
+ return confirm("Update the database?");
+ }
+ </script>
+
+ <div class="floatingLogo"><img src="images/logo_small.png"></div>
+
+ <h1><?php echo __("Database Updater") ?></h1>
+
+ <div class="content">
+
+ <?php
+ @$op = $_REQUEST["subop"];
+ $updater = new DbUpdater($this->link, DB_TYPE, SCHEMA_VERSION);
+
+ if ($op == "performupdate") {
+ if ($updater->isUpdateRequired()) {
+
+ print "<h2>Performing updates</h2>";
+
+ print "<h3>Updating to schema version " . SCHEMA_VERSION . "</h3>";
+
+ print "<ul>";
+
+ for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) {
+ print "<li>Performing update up to version $i...";
+
+ $result = $updater->performUpdateTo($i);
+
+ if (!$result) {
+ print "<span class='err'>FAILED!</span></li></ul>";
+
+ print_warning("One of the updates failed. Either retry the process or perform updates manually.");
+ print "<p><form method=\"GET\" action=\"index.php\">
+ <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+ </form>";
+
+ break;
+ } else {
+ print "<span class='ok'>OK!</span></li>";
+ }
+ }
+
+ print "</ul>";
+ print_notice("Your Tiny Tiny RSS database is now updated to the latest version.");
+ print "<p><form method=\"GET\" action=\"index.php\">
+ <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+ </form>";
+
+ } else {
+ print "<h2>Your database is up to date.</h2>";
+
+ print "<p><form method=\"GET\" action=\"index.php\">
+ <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+ </form>";
+ }
+ } else {
+ if ($updater->isUpdateRequired()) {
+
+ print "<h2>Database update required</h2>";
+ print "<h3>";
+ printf("Your Tiny Tiny RSS database needs update to the latest version: %d to %d.",
+ $updater->getSchemaVersion(), SCHEMA_VERSION);
+ print "</h3>";
+ print_warning("Please backup your database before proceeding.");
+ print "<form method='POST'>
+ <input type='hidden' name='subop' value='performupdate'>
+ <input type='submit' onclick='return confirmOP()' value='".__("Perform updates")."'>
+ </form>";
+
+ } else {
+
+ print "<h2>" . "Tiny Tiny RSS database is up to date." . "</h2>";
+
+ print "<p><form method=\"GET\" action=\"index.php\">
+ <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+ </form>";
+
+ }
+ }
+ ?>
+ </div>
+ </body>
+ </html>
+ <?php
}
}
diff --git a/feed-icons/.empty b/feed-icons/.empty
index e69de29bb..e69de29bb 100644..100755
--- a/feed-icons/.empty
+++ b/feed-icons/.empty
diff --git a/js/functions.js b/js/functions.js
index 4e4d03557..82cfa9054 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -508,7 +508,7 @@ function fatalError(code, msg, ext_info) {
if (code == 6) {
window.location.href = "index.php";
} else if (code == 5) {
- window.location.href = "db-updater.php";
+ window.location.href = "public.php?op=dbupdate";
} else {
if (msg == "") msg = "Unknown error";
diff --git a/lock/.empty b/lock/.empty
index e69de29bb..e69de29bb 100644..100755
--- a/lock/.empty
+++ b/lock/.empty
diff --git a/lock/.htaccess b/lock/.htaccess
index 93169e4eb..93169e4eb 100644..100755
--- a/lock/.htaccess
+++ b/lock/.htaccess
diff --git a/plugins/digest/digest.js b/plugins/digest/digest.js
index 5815e60e5..e3cb1e299 100644
--- a/plugins/digest/digest.js
+++ b/plugins/digest/digest.js
@@ -772,7 +772,7 @@ function fatal_error(code, msg) {
if (code == 6) {
window.location.href = "digest.php";
} else if (code == 5) {
- window.location.href = "db-updater.php";
+ window.location.href = "public.php?op=dbupdate";
} else {
if (msg == "") msg = "Unknown error";
diff --git a/utility.css b/utility.css
index dd39cb32b..308b71fd0 100644
--- a/utility.css
+++ b/utility.css
@@ -93,6 +93,10 @@ h2 {
border-style : solid;
}
+div.content > h2 {
+ margin-top : 0px;
+}
+
div.rss h1 {
border-width : 0px 0px 1px 0px;
border-color : gray;