aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-03-31 00:57:59 -0700
committerfriendica <info@friendica.com>2012-03-31 00:57:59 -0700
commitb4b1055b502c317513bf5c57794c004ced43a0de (patch)
tree7981c4db1897e0d9f5d316d9503c3e7b2f7122ea
parent8c928e67ba9f122343f53400cf0f4dae8104ffd7 (diff)
downloadvolse-hubzilla-b4b1055b502c317513bf5c57794c004ced43a0de.tar.gz
volse-hubzilla-b4b1055b502c317513bf5c57794c004ced43a0de.tar.bz2
volse-hubzilla-b4b1055b502c317513bf5c57794c004ced43a0de.zip
settings for unknown private mail acceptance
-rwxr-xr-xboot.php2
-rwxr-xr-xdatabase.sql10
-rwxr-xr-xmod/settings.php40
-rwxr-xr-xupdate.php7
-rwxr-xr-xview/settings.tpl4
5 files changed, 45 insertions, 18 deletions
diff --git a/boot.php b/boot.php
index 2a8dc3d04..ec1ffbbf4 100755
--- a/boot.php
+++ b/boot.php
@@ -11,7 +11,7 @@ require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1297' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
-define ( 'DB_UPDATE_VERSION', 1133 );
+define ( 'DB_UPDATE_VERSION', 1134 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index 327b482c0..a271e5491 100755
--- a/database.sql
+++ b/database.sql
@@ -289,9 +289,10 @@ CREATE TABLE IF NOT EXISTS `mail` (
`convid` int(10) unsigned NOT NULL,
`title` char(255) NOT NULL,
`body` mediumtext NOT NULL,
- `seen` tinyint(1) NOT NULL,
+ `seen` tinyint(1) NOT NULL DEFAULT '0',
`reply` tinyint(1) NOT NULL DEFAULT '0',
- `replied` tinyint(1) NOT NULL,
+ `replied` tinyint(1) NOT NULL DEFAULT '0',
+ `unknown` tinyint(1) NOT NULL DEFAULT '0',
`uri` char(255) NOT NULL,
`parent-uri` char(255) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -300,6 +301,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
KEY `guid` (`guid`),
KEY `convid` (`convid`),
KEY `reply` (`reply`),
+ KEY `unknown` (`unknown`),
KEY `uri` (`uri`),
KEY `parent-uri` (`parent-uri`),
KEY `created` (`created`)
@@ -453,6 +455,8 @@ CREATE TABLE IF NOT EXISTS `user` (
`blockwall` tinyint(1) unsigned NOT NULL DEFAULT '0',
`hidewall` tinyint(1) unsigned NOT NULL DEFAULT '0',
`blocktags` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `unkmail` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `cntunkmail` int(11) unsigned NOT NULL DEFAULT '10',
`notify-flags` int(11) unsigned NOT NULL DEFAULT '65535',
`page-flags` int(11) unsigned NOT NULL DEFAULT '0',
`prvnets` tinyint(1) NOT NULL DEFAULT '0',
@@ -472,6 +476,8 @@ CREATE TABLE IF NOT EXISTS `user` (
KEY `account_expired` (`account_expired`),
KEY `hidewall` (`hidewall`),
KEY `blockwall` (`blockwall`),
+ KEY `unkmail` (`unkmail`),
+ KEY `cntunkmail` (`cntunkmail`),
KEY `blocked` (`blocked`),
KEY `verified` (`verified`),
KEY `login_date` (`login_date`)
diff --git a/mod/settings.php b/mod/settings.php
index ce5ceea82..ce2d64851 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -303,7 +303,8 @@ function settings_post(&$a) {
$page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0);
$blockwall = (((x($_POST,'blockwall')) && (intval($_POST['blockwall']) == 1)) ? 0: 1); // this setting is inverted!
$blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted!
-
+ $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
+ $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
$suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
$hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
@@ -391,7 +392,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'system','suggestme', $suggestme);
- $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1",
+ $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d, `unkmail` = %d, `cntunkmail` = %d WHERE `uid` = %d LIMIT 1",
dbesc($username),
dbesc($email),
dbesc($openid),
@@ -410,6 +411,8 @@ function settings_post(&$a) {
intval($blockwall),
intval($hidewall),
intval($blocktags),
+ intval($unkmail),
+ intval($cntunkmail),
intval(local_user())
);
if($r)
@@ -760,17 +763,19 @@ function settings_content(&$a) {
if(count($p))
$profile = $p[0];
- $username = $a->user['username'];
- $email = $a->user['email'];
- $nickname = $a->user['nickname'];
- $timezone = $a->user['timezone'];
- $notify = $a->user['notify-flags'];
- $defloc = $a->user['default-location'];
- $openid = $a->user['openid'];
- $maxreq = $a->user['maxreq'];
- $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
- $blockwall = $a->user['blockwall'];
- $blocktags = $a->user['blocktags'];
+ $username = $a->user['username'];
+ $email = $a->user['email'];
+ $nickname = $a->user['nickname'];
+ $timezone = $a->user['timezone'];
+ $notify = $a->user['notify-flags'];
+ $defloc = $a->user['default-location'];
+ $openid = $a->user['openid'];
+ $maxreq = $a->user['maxreq'];
+ $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
+ $blockwall = $a->user['blockwall'];
+ $blocktags = $a->user['blocktags'];
+ $unkmail = $a->user['unkmail'];
+ $cntunkmail = $a->user['cntunkmail'];
$expire_items = get_pconfig(local_user(), 'expire','items');
$expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1
@@ -870,6 +875,12 @@ function settings_content(&$a) {
));
+ $unkmail = replace_macros($opt_tpl,array(
+ '$field' => array('unkmail', t('Permit unknown people to send you private messages?'), $unkmail, '', array(t('No'),t('Yes'))),
+
+ ));
+
+
$invisible = (((! $profile['publish']) && (! $profile['net-publish']))
? true : false);
@@ -946,7 +957,8 @@ function settings_content(&$a) {
'$profile_in_net_dir' => $profile_in_net_dir,
'$hide_friends' => $hide_friends,
'$hide_wall' => $hide_wall,
-
+ '$unkmail' => $unkmail,
+ '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail ,t("\x28to prevent spam abuse\x29")),
'$h_not' => t('Notification Settings'),
diff --git a/update.php b/update.php
index a69742a94..d38e39f8b 100755
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1133 );
+define( 'UPDATE_VERSION' , 1134 );
/**
*
@@ -1136,3 +1136,8 @@ INDEX ( `username` )
}
+function update_1133() {
+ q("ALTER TABLE `user` ADD `unkmail` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `blocktags` , ADD INDEX ( `unkmail` ) ");
+ q("ALTER TABLE `user` ADD `cntunkmail` INT NOT NULL DEFAULT '10' AFTER `unkmail` , ADD INDEX ( `cntunkmail` ) ");
+ q("ALTER TABLE `mail` ADD `unknown` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `replied` , ADD INDEX ( `unknown` ) ");
+}
diff --git a/view/settings.tpl b/view/settings.tpl
index f0fd70921..8753474af 100755
--- a/view/settings.tpl
+++ b/view/settings.tpl
@@ -56,6 +56,10 @@ $blocktags
$suggestme
+$unkmail
+
+{{inc field_input.tpl with $field=$cntunkmail }}{{endinc}}
+
{{inc field_input.tpl with $field=$expire.days }}{{endinc}}
<div class="field input">
<span class="field_help"><a href="#advanced-expire-popup" id="advanced-expire" class='popupbox' title="$expire.advanced">$expire.label</a></span>