add ttrss_users.full_name; bump schema

This commit is contained in:
Andrew Dolgov 2010-11-08 16:34:49 +03:00
parent ed28d0fd45
commit 73fe13afd4
8 changed files with 40 additions and 13 deletions

View File

@ -654,11 +654,13 @@
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;

View File

@ -123,12 +123,14 @@
} 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;
@ -197,10 +199,19 @@
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\"
@ -226,7 +237,7 @@
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\">";

View File

@ -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,

View 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

View 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,

View 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,

View File

@ -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;

View File

@ -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;