From b7292bc673bc7983b1fd933070bc9d6a0a155dbb Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 20 Mar 2011 17:54:50 -0700 Subject: [PATCH] user pref -> block remote wall posting --- boot.php | 2 +- database.sql | 1 + include/security.php | 2 +- mod/settings.php | 6 +++++- update.php | 3 +++ view/de/settings.tpl | 8 ++++++++ view/en/settings.tpl | 8 ++++++++ view/fr/settings.tpl | 7 +++++++ view/it/settings.tpl | 7 +++++++ view/sv/settings.tpl | 8 ++++++++ view/theme/duepuntozero/style.css | 3 +++ view/theme/loozah/style.css | 3 +++ 12 files changed, 55 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index e28d009466..81794af91e 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); define ( 'FRIENDIKA_VERSION', '2.1.924' ); define ( 'DFRN_PROTOCOL_VERSION', '2.1' ); -define ( 'DB_UPDATE_VERSION', 1043 ); +define ( 'DB_UPDATE_VERSION', 1044 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 0ecf0ea200..0a718c8c22 100644 --- a/database.sql +++ b/database.sql @@ -375,6 +375,7 @@ CREATE TABLE IF NOT EXISTS `user` ( `sprvkey` text NOT NULL, `verified` 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', `page-flags` int(11) unsigned NOT NULL DEFAULT '0', `pwdreset` char(255) NOT NULL, diff --git a/include/security.php b/include/security.php index 5e79e1edd5..c74a9b4a3c 100644 --- a/include/security.php +++ b/include/security.php @@ -25,7 +25,7 @@ function can_write_wall(&$a,$owner) { else { $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 - 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(remote_user()), intval(REL_VIP), diff --git a/mod/settings.php b/mod/settings.php index 85029b3d72..6a2733d7c9 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -70,6 +70,7 @@ function settings_post(&$a) { $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); $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; @@ -140,7 +141,7 @@ function settings_post(&$a) { $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($email), dbesc($openid), @@ -157,6 +158,7 @@ function settings_post(&$a) { intval($maxreq), intval($expire), dbesc($openidserver), + intval($blockwall), intval(local_user()) ); if($r) @@ -241,6 +243,7 @@ function settings_content(&$a) { $openid = $a->user['openid']; $maxreq = $a->user['maxreq']; $expire = ((intval($a->user['expire'])) ? $a->user['expire'] : ''); + $blockwall = $a->user['blockwall']; if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); @@ -362,6 +365,7 @@ function settings_content(&$a) { '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''), '$maxreq' => $maxreq, '$expire' => $expire, + '$blockw_checked' => (($blockwall) ? '' : ' checked="checked" ' ), '$theme' => $theme_selector, '$pagetype' => $pagetype )); diff --git a/update.php b/update.php index 0be919f3f1..9f94cd511b 100644 --- a/update.php +++ b/update.php @@ -407,3 +407,6 @@ function update_1042() { } +function update_1043() { + q("ALTER TABLE `user` ADD `blockwall` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `blocked` "); +} diff --git a/view/de/settings.tpl b/view/de/settings.tpl index 675ef675f5..5f700ff8bd 100644 --- a/view/de/settings.tpl +++ b/view/de/settings.tpl @@ -89,6 +89,14 @@ $profile_in_net_dir
+
+ + +
+
+ + +
Automatically expire (delete) posts older than days
diff --git a/view/en/settings.tpl b/view/en/settings.tpl index 39b18c1262..45060e1c47 100644 --- a/view/en/settings.tpl +++ b/view/en/settings.tpl @@ -88,6 +88,14 @@ $profile_in_net_dir
+
+ + +
+
+ + +
Automatically expire (delete) posts older than days
diff --git a/view/fr/settings.tpl b/view/fr/settings.tpl index eb386579f0..e0334842a2 100644 --- a/view/fr/settings.tpl +++ b/view/fr/settings.tpl @@ -89,6 +89,13 @@ $profile_in_net_dir
+
+ + +
+
+ +
Automatically expire (delete) posts older than days
diff --git a/view/it/settings.tpl b/view/it/settings.tpl index 87f40f26fc..d1e25da81c 100644 --- a/view/it/settings.tpl +++ b/view/it/settings.tpl @@ -90,6 +90,13 @@ $profile_in_net_dir
+
+ + +
+
+ +
Automatically expire (delete) posts older than days
diff --git a/view/sv/settings.tpl b/view/sv/settings.tpl index ea4e2e52c8..d5b8d5b3f1 100644 --- a/view/sv/settings.tpl +++ b/view/sv/settings.tpl @@ -89,6 +89,14 @@ $profile_in_net_dir
+
+ + +
+
+ + +
Automatically expire (delete) posts older than days
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 5db45921ad..e4fa1f9d7e 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -384,6 +384,7 @@ input#dfrn-url { #settings-nick-end, #settings-defloc-end, #settings-allowloc-end, +#settings-blockw-end, #settings-timezone-end, #settings-theme-end, #settings-password-end, @@ -404,6 +405,7 @@ input#dfrn-url { #settings-nick-label, #settings-defloc-label, #settings-allowloc-label, +#settings-blockw-label, #settings-timezone-label, #settings-theme-label, #settings-password-label, @@ -424,6 +426,7 @@ input#dfrn-url { #settings-nick, #settings-defloc, #settings-allowloc, +#settings-blockw, #timezone-select, #theme-select, #settings-password, diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index 0284bdcf86..030b878bfe 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -517,6 +517,7 @@ input#dfrn-url { #settings-nick-end, #settings-defloc-end, #settings-allowloc-end, +#settings-blockw-end, #settings-timezone-end, #settings-theme-end, #settings-password-end, @@ -537,6 +538,7 @@ input#dfrn-url { #settings-nick-label, #settings-defloc-label, #settings-allowloc-label, +#settings-blockw-label, #settings-timezone-label, #settings-theme-label, #settings-password-label, @@ -557,6 +559,7 @@ input#dfrn-url { #settings-nick, #settings-defloc, #settings-allowloc, +#settings-blockw, #timezone-select, #theme-select, #settings-password,