]> git.wh0rd.org Git - tt-rss.git/commitdiff
add ttrss_users.full_name; bump schema
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 8 Nov 2010 13:34:49 +0000 (16:34 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 8 Nov 2010 13:34:49 +0000 (16:34 +0300)
modules/popup-dialog.php
modules/pref-prefs.php
prefs.js
sanity_check.php
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/versions/mysql/70.sql [new file with mode: 0644]
schema/versions/pgsql/70.sql [new file with mode: 0644]

index 61efd4c991717bce5f5859451c6ad9dad2c2e1ef..4c8c92b5435b7f90b152c1b5bcf9da03534ac5e2 100644 (file)
                        print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
                        print "<input type=\"hidden\" name=\"subop\" value=\"sendEmail\">"; 
 
-                       $result = db_query($link, "SELECT email FROM ttrss_users WHERE
+                       $result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE
                                id = " . $_SESSION["uid"]);
 
                        $user_email = htmlspecialchars(db_fetch_result($result, 0, "email"));
-                       $user_name = htmlspecialchars($_SESSION["name"]);
+                       $user_name = htmlspecialchars(db_fetch_result($result, 0, "full_name"));
+
+                       if (!$user_name) $user_name = $_SESSION['name'];
 
                        $_SESSION['email_replyto'] = $user_email;
                        $_SESSION['email_fromname'] = $user_name;
index dc658956b69ac12ab8d34f08b52eed8e84cd6d2e..5fcb931151a30759b4ddf43e99d5d06c2541b3bf 100644 (file)
                } else if ($subop == "change-email") {
 
                        $email = db_escape_string($_POST["email"]);
+                       $full_name = db_escape_string($_POST["full_name"]);
+
                        $active_uid = $_SESSION["uid"];
 
-                       db_query($link, "UPDATE ttrss_users SET email = '$email' 
-                               WHERE id = '$active_uid'");                             
+                       db_query($link, "UPDATE ttrss_users SET email = '$email',
+                               full_name = '$full_name' WHERE id = '$active_uid'");                            
                
-                       print __("E-mail has been changed.");
+                       print __("Your personal data has been saved.");
                
                        return;
 
                                print "<table width=\"100%\" class=\"prefPrefsList\">";
                                print "<tr><td colspan='3'><h3>".__("Personal data")."</h3></tr></td>";
 
-                               $result = db_query($link, "SELECT email,access_level FROM ttrss_users
+                               $result = db_query($link, "SELECT email,full_name,
+                                       access_level FROM ttrss_users
                                        WHERE id = ".$_SESSION["uid"]);
                                        
-                               $email = db_fetch_result($result, 0, "email");
-       
+                               $email = htmlspecialchars(db_fetch_result($result, 0, "email"));
+                               $full_name = htmlspecialchars(db_fetch_result($result, 0, "full_name"));
+
+                               print "<tr><td width=\"40%\">".__('Full name')."</td>";
+                               print "<td class=\"prefValue\"><input class=\"editbox\" name=\"full_name\" 
+                                       onfocus=\"javascript:disableHotkeys();\" 
+                                       onblur=\"javascript:enableHotkeys();\"
+                                       onkeypress=\"return filterCR(event, changeUserEmail)\"
+                                       value=\"$full_name\"></td></tr>";
+
                                print "<tr><td width=\"40%\">".__('E-mail')."</td>";
                                print "<td class=\"prefValue\"><input class=\"editbox\" name=\"email\" 
                                        onfocus=\"javascript:disableHotkeys();\" 
                                print "</form>";
 
                                print "<p><button onclick=\"return changeUserEmail()\">".
-                                       __("Change e-mail")."</button>";
+                                       __("Save data")."</button>";
 
                                print "<form onsubmit=\"return false\" 
                                        name=\"change_pass_form\" id=\"change_pass_form\">";
index 33ed8fd767ebb2b9829b22ff0e759ef74a61133e..c590c61f8fee0787187c3d7dc765ed49f194f2cf 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1548,7 +1548,7 @@ function changeUserEmail() {
 
                var query = Form.serialize("change_email_form");
        
-               notify_progress("Trying to change e-mail...");
+               notify_progress("Saving...");
        
                new Ajax.Request("backend.php", {
                        parameters: query,
index 437ac0a03f92162040858818d754858eca037b5c..0f539bde9adb13fd1314c12e4454f522c3bb9f44 100644 (file)
@@ -2,7 +2,7 @@
        require_once "functions.php";
 
        define('EXPECTED_CONFIG_VERSION', 19);
-       define('SCHEMA_VERSION', 69);
+       define('SCHEMA_VERSION', 70);
 
        if (!file_exists("config.php")) {
                print "<b>Fatal Error</b>: You forgot to copy 
index 33c1f3d9592c5ac7efdce5642a114f9b6c951dc9..03ea5e610ef7f0af90bbfa1691f442034dc5e58f 100644 (file)
@@ -48,6 +48,7 @@ create table ttrss_users (id integer primary key not null auto_increment,
        access_level integer not null default 0,
        theme_id integer default null,
        email varchar(250) not null default '',
+       full_name varchar(250) not null default '',
        email_digest bool not null default false,
        last_digest_sent datetime default null,
        created datetime default null,
@@ -242,7 +243,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) TYPE=InnoDB DEFAULT CHARSET=UTF8;
 
-insert into ttrss_version values (69);
+insert into ttrss_version values (70);
 
 create table ttrss_enclosures (id integer primary key auto_increment,
        content_url text not null,
index 69753aa3c20b054c5f61132a9fe0aab2d4c8dbd1..2d1f33c6fdd3b328def246c1fbec84d87558cbb5 100644 (file)
@@ -45,6 +45,7 @@ create table ttrss_users (id serial not null primary key,
        last_login timestamp default null,
        access_level integer not null default 0,
        email varchar(250) not null default '',
+       full_name varchar(250) not null default '',
        email_digest boolean not null default false,
        last_digest_sent timestamp default null,
        created timestamp default null,
@@ -214,7 +215,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
 
 create table ttrss_version (schema_version int not null);
 
-insert into ttrss_version values (69);
+insert into ttrss_version values (70);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
diff --git a/schema/versions/mysql/70.sql b/schema/versions/mysql/70.sql
new file mode 100644 (file)
index 0000000..0c64336
--- /dev/null
@@ -0,0 +1,6 @@
+alter table ttrss_users add column full_name varchar(250);
+update ttrss_users set full_name = '';
+alter table ttrss_users change full_name full_name varchar(250) not null;
+alter table ttrss_users alter column full_name set default '';
+
+update ttrss_version set schema_version = 70;
diff --git a/schema/versions/pgsql/70.sql b/schema/versions/pgsql/70.sql
new file mode 100644 (file)
index 0000000..b970a86
--- /dev/null
@@ -0,0 +1,6 @@
+alter table ttrss_users add column full_name varchar(250);
+update ttrss_users set full_name = '';
+alter table ttrss_users alter column full_name set not null;
+alter table ttrss_users alter column full_name set default '';
+
+update ttrss_version set schema_version = 70;