settings for unknown private mail acceptance

This commit is contained in:
friendica 2012-03-31 00:57:59 -07:00
parent 8c928e67ba
commit b4b1055b50
5 changed files with 45 additions and 18 deletions

View File

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

View File

@ -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`)

View File

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

View File

@ -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` ) ");
}

View File

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