diff --git a/backend.php b/backend.php
index 60399e31c..14eccf944 100644
--- a/backend.php
+++ b/backend.php
@@ -1040,6 +1040,10 @@
print "
Tags: $f_tags_str
";
}
+ if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW')) {
+ $line["content"] = preg_replace("/href=/i", "target=\"_new\" href=", $line["content"]);
+ }
+
print $line["content"] . "";
print "";
diff --git a/config.php-dist b/config.php-dist
index c8d33b4c1..76c7052bd 100644
--- a/config.php-dist
+++ b/config.php-dist
@@ -113,6 +113,6 @@
define('SESSION_COOKIE_LIFETIME_REMEMBER', 86400);
// Session cookie lifetime if "remember me" is checked on login.
-
+
// vim:ft=php
?>
diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql
index b9e1a08eb..c2357f5b5 100644
--- a/schema/ttrss_schema_mysql.sql
+++ b/schema/ttrss_schema_mysql.sql
@@ -240,6 +240,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
+
create table ttrss_user_prefs (
owner_uid integer not null,
pref_name varchar(250),
diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql
index 8db25bd61..2ac43fd6d 100644
--- a/schema/ttrss_schema_pgsql.sql
+++ b/schema/ttrss_schema_pgsql.sql
@@ -218,6 +218,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
+
create table ttrss_user_prefs (
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
diff --git a/schema/upgrade-1.1.3-1.1.4-mysql.sql b/schema/upgrade-1.1.3-1.1.4-mysql.sql
index 12df2044a..1018bcf4d 100644
--- a/schema/upgrade-1.1.3-1.1.4-mysql.sql
+++ b/schema/upgrade-1.1.3-1.1.4-mysql.sql
@@ -14,5 +14,7 @@ create table ttrss_sessions (id varchar(250) not null primary key,
delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
+
update ttrss_version set schema_version = 6;
diff --git a/schema/upgrade-1.1.3-1.1.4-pgsql.sql b/schema/upgrade-1.1.3-1.1.4-pgsql.sql
index da4267678..6c406495d 100644
--- a/schema/upgrade-1.1.3-1.1.4-pgsql.sql
+++ b/schema/upgrade-1.1.3-1.1.4-pgsql.sql
@@ -17,6 +17,8 @@ create index ttrss_sessions_expire_index on ttrss_sessions(expire);
delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
+
update ttrss_version set schema_version = 6;
commit;