user pref -> block remote wall posting

This commit is contained in:
Friendika 2011-03-20 17:54:50 -07:00
parent 2b0af1456c
commit b7292bc673
12 changed files with 55 additions and 3 deletions

View file

@ -4,7 +4,7 @@ set_time_limit(0);
define ( 'FRIENDIKA_VERSION', '2.1.924' ); define ( 'FRIENDIKA_VERSION', '2.1.924' );
define ( 'DFRN_PROTOCOL_VERSION', '2.1' ); define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
define ( 'DB_UPDATE_VERSION', 1043 ); define ( 'DB_UPDATE_VERSION', 1044 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -375,6 +375,7 @@ CREATE TABLE IF NOT EXISTS `user` (
`sprvkey` text NOT NULL, `sprvkey` text NOT NULL,
`verified` tinyint(1) unsigned NOT NULL DEFAULT '0', `verified` tinyint(1) unsigned NOT NULL DEFAULT '0',
`blocked` tinyint(1) unsigned NOT NULL DEFAULT '0', `blocked` tinyint(1) unsigned NOT NULL DEFAULT '0',
`blockwall` tinyint(1) unsigned NOT NULL DEFAULT '0',
`notify-flags` int(11) unsigned NOT NULL DEFAULT '65535', `notify-flags` int(11) unsigned NOT NULL DEFAULT '65535',
`page-flags` int(11) unsigned NOT NULL DEFAULT '0', `page-flags` int(11) unsigned NOT NULL DEFAULT '0',
`pwdreset` char(255) NOT NULL, `pwdreset` char(255) NOT NULL,

View file

@ -25,7 +25,7 @@ function can_write_wall(&$a,$owner) {
else { else {
$r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `user`.`uid` = `contact`.`uid` $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` LEFT JOIN `user` on `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `readonly` = 0 AND ( `contact`.`rel` IN ( %d , %d ) OR `user`.`page-flags` = %d ) LIMIT 1", AND `user`.`blockwall` = 0 AND `readonly` = 0 AND ( `contact`.`rel` IN ( %d , %d ) OR `user`.`page-flags` = %d ) LIMIT 1",
intval($owner), intval($owner),
intval(remote_user()), intval(remote_user()),
intval(REL_VIP), intval(REL_VIP),

View file

@ -70,6 +70,7 @@ function settings_post(&$a) {
$net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0); $net_publish = (((x($_POST,'profile_in_netdirectory')) && (intval($_POST['profile_in_netdirectory']) == 1)) ? 1: 0);
$old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0); $old_visibility = (((x($_POST,'visibility')) && (intval($_POST['visibility']) == 1)) ? 1 : 0);
$page_flags = (((x($_POST,'page-flags')) && (intval($_POST['page-flags']))) ? intval($_POST['page-flags']) : 0); $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!
$notify = 0; $notify = 0;
@ -140,7 +141,7 @@ function settings_post(&$a) {
$openidserver = ''; $openidserver = '';
} }
$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, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s' 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, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d WHERE `uid` = %d LIMIT 1",
dbesc($username), dbesc($username),
dbesc($email), dbesc($email),
dbesc($openid), dbesc($openid),
@ -157,6 +158,7 @@ function settings_post(&$a) {
intval($maxreq), intval($maxreq),
intval($expire), intval($expire),
dbesc($openidserver), dbesc($openidserver),
intval($blockwall),
intval(local_user()) intval(local_user())
); );
if($r) if($r)
@ -241,6 +243,7 @@ function settings_content(&$a) {
$openid = $a->user['openid']; $openid = $a->user['openid'];
$maxreq = $a->user['maxreq']; $maxreq = $a->user['maxreq'];
$expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : '');
$blockwall = $a->user['blockwall'];
if(! strlen($a->user['timezone'])) if(! strlen($a->user['timezone']))
$timezone = date_default_timezone_get(); $timezone = date_default_timezone_get();
@ -362,6 +365,7 @@ function settings_content(&$a) {
'$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''), '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''),
'$maxreq' => $maxreq, '$maxreq' => $maxreq,
'$expire' => $expire, '$expire' => $expire,
'$blockw_checked' => (($blockwall) ? '' : ' checked="checked" ' ),
'$theme' => $theme_selector, '$theme' => $theme_selector,
'$pagetype' => $pagetype '$pagetype' => $pagetype
)); ));

View file

@ -407,3 +407,6 @@ function update_1042() {
} }
function update_1043() {
q("ALTER TABLE `user` ADD `blockwall` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `blocked` ");
}

View file

@ -89,6 +89,14 @@ $profile_in_net_dir
</div> </div>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>
<div id="settings-blockw-wrapper" >
<label id="settings-blockw-label" for="settings-blockw" >Allow friends to post to your profile: </label>
<input type="checkbox" name="blockwall" id="settings-blockw" value="1" $blockw_checked />
</div>
<div id="settings-blockw-end" ></div>
<div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div> <div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div>
<div id="settings-expire-end"></div> <div id="settings-expire-end"></div>

View file

@ -88,6 +88,14 @@ $profile_in_net_dir
</div> </div>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>
<div id="settings-blockw-wrapper" >
<label id="settings-blockw-label" for="settings-blockw" >Allow friends to post to your profile: </label>
<input type="checkbox" name="blockwall" id="settings-blockw" value="1" $blockw_checked />
</div>
<div id="settings-blockw-end" ></div>
<div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div> <div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div>
<div id="settings-expire-end"></div> <div id="settings-expire-end"></div>

View file

@ -89,6 +89,13 @@ $profile_in_net_dir
</div> </div>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>
<div id="settings-blockw-wrapper" >
<label id="settings-blockw-label" for="settings-blockw" >Allow friends to post to your profile: </label>
<input type="checkbox" name="blockwall" id="settings-blockw" value="1" $blockw_checked />
</div>
<div id="settings-blockw-end" ></div>
<div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div> <div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div>
<div id="settings-expire-end"></div> <div id="settings-expire-end"></div>

View file

@ -90,6 +90,13 @@ $profile_in_net_dir
</div> </div>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>
<div id="settings-blockw-wrapper" >
<label id="settings-blockw-label" for="settings-blockw" >Allow friends to post to your profile: </label>
<input type="checkbox" name="blockwall" id="settings-blockw" value="1" $blockw_checked />
</div>
<div id="settings-blockw-end" ></div>
<div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div> <div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div>
<div id="settings-expire-end"></div> <div id="settings-expire-end"></div>

View file

@ -89,6 +89,14 @@ $profile_in_net_dir
</div> </div>
<div id="settings-default-perms-end"></div> <div id="settings-default-perms-end"></div>
<div id="settings-blockw-wrapper" >
<label id="settings-blockw-label" for="settings-blockw" >Allow friends to post to your profile: </label>
<input type="checkbox" name="blockwall" id="settings-blockw" value="1" $blockw_checked />
</div>
<div id="settings-blockw-end" ></div>
<div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div> <div id="settings-expire-desc">Automatically expire (delete) posts older than <input type="text" size="3" name="expire" value="$expire" /> days</div>
<div id="settings-expire-end"></div> <div id="settings-expire-end"></div>

View file

@ -384,6 +384,7 @@ input#dfrn-url {
#settings-nick-end, #settings-nick-end,
#settings-defloc-end, #settings-defloc-end,
#settings-allowloc-end, #settings-allowloc-end,
#settings-blockw-end,
#settings-timezone-end, #settings-timezone-end,
#settings-theme-end, #settings-theme-end,
#settings-password-end, #settings-password-end,
@ -404,6 +405,7 @@ input#dfrn-url {
#settings-nick-label, #settings-nick-label,
#settings-defloc-label, #settings-defloc-label,
#settings-allowloc-label, #settings-allowloc-label,
#settings-blockw-label,
#settings-timezone-label, #settings-timezone-label,
#settings-theme-label, #settings-theme-label,
#settings-password-label, #settings-password-label,
@ -424,6 +426,7 @@ input#dfrn-url {
#settings-nick, #settings-nick,
#settings-defloc, #settings-defloc,
#settings-allowloc, #settings-allowloc,
#settings-blockw,
#timezone-select, #timezone-select,
#theme-select, #theme-select,
#settings-password, #settings-password,

View file

@ -517,6 +517,7 @@ input#dfrn-url {
#settings-nick-end, #settings-nick-end,
#settings-defloc-end, #settings-defloc-end,
#settings-allowloc-end, #settings-allowloc-end,
#settings-blockw-end,
#settings-timezone-end, #settings-timezone-end,
#settings-theme-end, #settings-theme-end,
#settings-password-end, #settings-password-end,
@ -537,6 +538,7 @@ input#dfrn-url {
#settings-nick-label, #settings-nick-label,
#settings-defloc-label, #settings-defloc-label,
#settings-allowloc-label, #settings-allowloc-label,
#settings-blockw-label,
#settings-timezone-label, #settings-timezone-label,
#settings-theme-label, #settings-theme-label,
#settings-password-label, #settings-password-label,
@ -557,6 +559,7 @@ input#dfrn-url {
#settings-nick, #settings-nick,
#settings-defloc, #settings-defloc,
#settings-allowloc, #settings-allowloc,
#settings-blockw,
#timezone-select, #timezone-select,
#theme-select, #theme-select,
#settings-password, #settings-password,