From 9b50b0e16f2046b91cb4c734c56024524d8b178b Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 3 Apr 2011 20:41:40 -0700 Subject: [PATCH] Public exposure warning on affected network group pages. config-able so a plugin can shut it up. --- boot.php | 4 ++-- include/group.php | 17 ++++++++++++++++- index.php | 4 ---- mod/network.php | 8 ++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/boot.php b/boot.php index 3dfd06bf17..94699a2730 100644 --- a/boot.php +++ b/boot.php @@ -2,7 +2,7 @@ set_time_limit(0); -define ( 'FRIENDIKA_VERSION', '2.1.936' ); +define ( 'FRIENDIKA_VERSION', '2.1.938' ); define ( 'DFRN_PROTOCOL_VERSION', '2.2' ); define ( 'DB_UPDATE_VERSION', 1046 ); @@ -2022,7 +2022,7 @@ function contact_block() { intval($shown) ); if(count($r)) { - $o .= '

' . sprintf(tt('%d Contact','%d Contacts', $total),$total) . '

'; + $o .= '

' . sprintf( tt('%d Contact','%d Contacts', $total),$total) . '

'; foreach($r as $rr) { $redirect_url = $a->get_baseurl() . '/redir/' . $rr['id']; if(local_user() && ($rr['uid'] == local_user()) diff --git a/include/group.php b/include/group.php index 793e854be0..07cd45f199 100644 --- a/include/group.php +++ b/include/group.php @@ -110,7 +110,7 @@ function group_get_members($gid) { LEFT JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` WHERE `gid` = %d AND `group_member`.`uid` = %d", intval($gid), - intval($_SESSION['uid']) + intval(local_user()) ); if(count($r)) $ret = $r; @@ -118,6 +118,21 @@ function group_get_members($gid) { return $ret; } +function group_public_members($gid) { + $ret = 0; + if(intval($gid)) { + $r = q("SELECT `contact`.`id` AS `contact-id` FROM `group_member` + LEFT JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id` + WHERE `gid` = %d AND `group_member`.`uid` = %d AND `contact`.`network` != 'dfrn' ", + intval($gid), + intval(local_user()) + ); + if(count($r)) + $ret = count($r); + } + return $ret; +} + function group_side($every="contacts",$each="group") { diff --git a/index.php b/index.php index 9412c1e3bd..074c1c53a4 100644 --- a/index.php +++ b/index.php @@ -42,10 +42,6 @@ if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { } else { $lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); } -if(x($_POST,'system_language')) -if(x($_SESSION,'language')) - $lang = $_SESSION['language']; - load_translation_table($lang); diff --git a/mod/network.php b/mod/network.php index 39679b48a1..a304c211fe 100644 --- a/mod/network.php +++ b/mod/network.php @@ -54,6 +54,14 @@ function network_content(&$a, $update = 0) { } if(! $update) { + if(group) { + if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) { + $plural_form = sprintf( tt('%d member', '%d members', $t), $t); + notice( sprintf( t('Warning: This group contains %s from an insecure network.'), $plural_form ) . EOL); + notice( t('Private messages to this group are at risk of public disclosure.') . EOL); + } + } + $o .= ''; $_SESSION['return_url'] = $a->cmd;