]> git.wh0rd.org Git - tt-rss.git/commitdiff
prevent default admin user from being removed; properly fail on startup if single...
authorAndrew Dolgov <fox@bah.org.ru>
Thu, 10 Jun 2010 10:29:55 +0000 (14:29 +0400)
committerAndrew Dolgov <fox@bah.org.ru>
Thu, 10 Jun 2010 10:29:55 +0000 (14:29 +0400)
modules/pref-users.php
prefs.js
sanity_check.php

index a57178d6c0253f4a873925abb6ef44780fe21aea..aa0da88e1cc33121f27fd864220cb3989323d131 100644 (file)
                                $ids = split(",", db_escape_string($_REQUEST["ids"]));
 
                                foreach ($ids as $id) {
-                                       if ($id != $_SESSION["uid"]) {
+                                       if ($id != $_SESSION["uid"] && $id != 1) {
                                                db_query($link, "DELETE FROM ttrss_tags WHERE owner_uid = '$id'");
                                                db_query($link, "DELETE FROM ttrss_feeds WHERE owner_uid = '$id'");
                                                db_query($link, "DELETE FROM ttrss_users WHERE id = '$id'");
index 6d5e5a90cd66d25423f858b817a6b53953e6cfea..43e6b28bd49bf126ef79883e790ff3253f2f3ab6 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -465,7 +465,7 @@ function removeSelectedUsers() {
        
                if (sel_rows.length > 0) {
        
-                       var ok = confirm(__("Remove selected users?"));
+                       var ok = confirm(__("Remove selected users? Neither default admin nor your account will be removed."));
        
                        if (ok) {
                                notify_progress("Removing selected users...");
index d112896e0a5d71f34dd6430111981da54f7b6551..d2f0e31778862e8b41e7c21d7397ba2ddcc7bfd7 100644 (file)
                $err_msg = "config: DATABASE_BACKED_SESSIONS are currently broken with MySQL";
        }
 
+       if (SINGLE_USER_MODE) {
+               $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+               if ($link) {
+                       $result = db_query($link, "SELECT id FROM ttrss_users WHERE id = 1");
+
+                       if (db_num_rows($result) != 1) {        
+                               $err_msg = "config: SINGLE_USER_MODE is enabled but default admin account (UID=1) is not found.";
+                       }
+               }
+       }
+
        if (defined('MAIL_FROM')) {
                $err_msg = "config: MAIL_FROM has been split into DIGEST_FROM_NAME and DIGEST_FROM_ADDRESS";
        }