diff --git a/boot.php b/boot.php index 3bc8d2983..786ebdee6 100644 --- a/boot.php +++ b/boot.php @@ -567,7 +567,7 @@ function xml_status($st, $message = '') { if(! function_exists('local_user')) { function local_user() { if((x($_SESSION,'authenticated')) && (x($_SESSION,'uid'))) - return $_SESSION['uid']; + return intval($_SESSION['uid']); return false; }} @@ -576,7 +576,7 @@ function local_user() { if(! function_exists('remote_user')) { function remote_user() { if((x($_SESSION,'authenticated')) && (x($_SESSION,'visitor_id'))) - return $_SESSION['visitor_id']; + return intval($_SESSION['visitor_id']); return false; }} diff --git a/mod/contacts.php b/mod/contacts.php index dfd98961b..dbad2a158 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -172,7 +172,7 @@ function contacts_content(&$a) { break; } - if($r[0]['rel'] != REL_FAN) { + if(($r[0]['network'] === 'dfrn') && ($r[0]['rel'])) { $url = "redir/{$r[0]['id']}"; $sparkle = ' class="sparkle" '; } @@ -272,7 +272,7 @@ function contacts_content(&$a) { break; } - if($rr['rel'] != REL_FAN) { + if(($rr['network'] === 'dfrn') && ($rr['rel'])) { $url = "redir/{$rr['id']}"; $sparkle = ' class="sparkle" '; } diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index fc663f797..84c249a58 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -38,7 +38,7 @@ function dfrn_poll_init(&$a) { $sql_extra = ''; switch($direction) { case (-1): - $sql_extra = sprintf(" AND `dfrn-id` = '%s' ", dbesc($dfrn_id)); + $sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id)); $my_id = $dfrn_id; break; case 0: @@ -56,7 +56,10 @@ function dfrn_poll_init(&$a) { $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` - WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra LIMIT 1"); + WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0 + AND `user`.`nickname` = '%s' $sql_extra LIMIT 1", + dbesc($a->argv[1]) + ); if(count($r)) { diff --git a/mod/display.php b/mod/display.php index d8aca43e4..2b721aef8 100644 --- a/mod/display.php +++ b/mod/display.php @@ -86,7 +86,7 @@ function display_content(&$a) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -116,7 +116,7 @@ function display_content(&$a) { $sparkle = ''; if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) { $url = $item['url']; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) { + if(($item['network'] === 'dfrn') && (! $item['self'])) { $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle"'; } @@ -127,7 +127,7 @@ function display_content(&$a) { } if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) { $url = $item['url']; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) { + if(($item['network'] === 'dfrn') && (! $item['self'])) { $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle"'; } @@ -180,7 +180,7 @@ function display_content(&$a) { $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'] )) { + if(($item['network'] === 'dfrn') && (! $item['self'] )) { $profile_url = $redirect_url; $sparkle = ' sparkle'; } @@ -209,7 +209,7 @@ function display_content(&$a) { $template = $wallwall; $commentww = 'ww'; // If it is our contact, use a friendly redirect link - if(($item['owner-link'] == $item['url']) && ($item['rel'] == REL_VIP || $item['rel'] == REL_BUD)) { + if(($item['owner-link'] == $item['url']) && ($item['network'] === 'dfrn')) { $owner_url = $redirect_url; $osparkle = ' sparkle'; } diff --git a/mod/group.php b/mod/group.php index dc5dd3c71..56c3e21d1 100644 --- a/mod/group.php +++ b/mod/group.php @@ -136,12 +136,14 @@ function group_content(&$a) { '$delete' => t('Delete') )); + $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $tpl = load_view_file('view/group_edit.tpl'); $o .= replace_macros($tpl, array( '$gid' => $group['id'], '$name' => $group['name'], '$drop' => $drop_txt, - '$selector' => contact_select('group_members_select','group_members_select',$preselected,25) + '$selector' => contact_select('group_members_select','group_members_select',$preselected,25,false,$celeb) )); } diff --git a/mod/network.php b/mod/network.php index 9d12d4346..347b7817f 100644 --- a/mod/network.php +++ b/mod/network.php @@ -41,13 +41,15 @@ function network_content(&$a, $update = 0) { else $lockstate = 'unlock'; + $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $o .= replace_macros($tpl,array( '$return_path' => $a->cmd, '$baseurl' => $a->get_baseurl(), '$defloc' => $a->user['default-location'], '$visitor' => 'block', '$lockstate' => $lockstate, - '$acl' => populate_acl(($group) ? $group_acl : $a->user), + '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb), '$bang' => (($group) ? '!' : ''), '$profile_uid' => $_SESSION['uid'] )); @@ -111,7 +113,7 @@ function network_content(&$a, $update = 0) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -139,7 +141,7 @@ function network_content(&$a, $update = 0) { if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) { $url = $item['url']; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) { + if(($item['network'] === 'dfrn') && (! $item['self'])) { $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle"'; } @@ -150,7 +152,7 @@ function network_content(&$a, $update = 0) { } if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) { $url = $item['url']; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) { + if(($item['network'] === 'dfrn') && (! $item['self'])) { $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle"'; } @@ -202,7 +204,7 @@ function network_content(&$a, $update = 0) { $commentww = 'ww'; // If it is our contact, use a friendly redirect link if(($item['owner-link'] == $item['url']) - && ($item['rel'] == REL_VIP || $item['rel'] == REL_BUD)) { + && ($item['network'] === 'dfrn')) { $owner_url = $redirect_url; $osparkle = ' sparkle'; } @@ -238,7 +240,7 @@ function network_content(&$a, $update = 0) { - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'] )) { + if(($item['network'] === 'dfrn') && (! $item['self'] )) { $profile_url = $redirect_url; $sparkle = ' sparkle'; } diff --git a/mod/photos.php b/mod/photos.php index 35b03845d..767c02543 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -480,6 +480,9 @@ function photos_content(&$a) { $albumselect .= ''; } } + + $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $albumselect .= ''; $tpl = load_view_file('view/photos_upload.tpl'); $o .= replace_macros($tpl,array( @@ -490,7 +493,7 @@ function photos_content(&$a) { '$filestext' => t('Select files to upload: '), '$albumselect' => $albumselect, '$permissions' => t('Permissions'), - '$aclselect' => populate_acl($a->user), + '$aclselect' => populate_acl($a->user, $celeb), '$archive' => $a->get_baseurl() . '/jumploader_z.jar', '$nojava' => t('Use the following controls only if the Java uploader [above] fails to launch.'), '$uploadurl' => $a->get_baseurl() . '/photos', @@ -633,8 +636,8 @@ function photos_content(&$a) { $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, - `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, + `contact`.`rel`, `contact`.`thumb`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `parent-uri` = '%s' AND `uri` != '%s' AND `item`.`deleted` = 0 @@ -724,7 +727,7 @@ function photos_content(&$a) { if(local_user() && ($item['contact-uid'] == get_uid()) - && ($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'] )) { + && ($item['network'] == 'dfrn') && (! $item['self'] )) { $profile_url = $redirect_url; $sparkle = ' sparkle'; } diff --git a/mod/profile.php b/mod/profile.php index de0ae5745..b72c279e2 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -138,6 +138,7 @@ function profile_content(&$a, $update = 0) { return $o; } + $celeb = ((($a->profile['page-flags'] == PAGE_SOAPBOX) || ($a->profile['page-flags'] == PAGE_COMMUNITY)) ? true : false); if(can_write_wall($a,$a->profile['profile_uid'])) { $tpl = load_view_file('view/jot-header.tpl'); @@ -156,7 +157,7 @@ function profile_content(&$a, $update = 0) { '$visitor' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? 'block' : 'none'), '$lockstate' => $lockstate, '$bang' => '', - '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl($a->user) : ''), + '$acl' => (($_SESSION['uid'] == $a->profile['profile_uid']) ? populate_acl($a->user, $celeb) : ''), '$profile_uid' => $a->profile['profile_uid'] )); } @@ -231,8 +232,8 @@ function profile_content(&$a, $update = 0) { $a->set_pager_total($r[0]['total']); $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, - `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, - `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, + `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`, + `contact`.`thumb`, `contact`.`self`, `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 @@ -272,7 +273,7 @@ function profile_content(&$a, $update = 0) { if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) { $url = $item['url']; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) { + if(($item['network'] === 'dfrn') && (! $item['self'])) { $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle" '; } @@ -283,7 +284,7 @@ function profile_content(&$a, $update = 0) { } if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) { $url = $item['url']; - if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'])) { + if(($item['network'] === 'dfrn') && (! $item['self'])) { $url = $a->get_baseurl() . '/redir/' . $item['contact-id']; $sparkle = ' class="sparkle" '; } @@ -338,7 +339,7 @@ function profile_content(&$a, $update = 0) { // I can go directly to their profile as an authenticated guest. if(local_user() && ($item['contact-uid'] == $_SESSION['uid']) - && ($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'] )) { + && ($item['network'] === 'dfrn') && (! $item['self'] )) { $profile_url = $redirect_url; $sparkle = ' sparkle'; } diff --git a/mod/redir.php b/mod/redir.php index c9b284ddd..e743d003e 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -4,14 +4,15 @@ function redir_init(&$a) { if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1]))) goaway($a->get_baseurl()); - $r = q("SELECT `issued-id`, `dfrn-id`, `duplex`, `poll` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + $r = q("SELECT `network`, `issued-id`, `dfrn-id`, `duplex`, `poll` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), - intval($_SESSION['uid'])); - if(! count($r)) + intval(get_uid()) + ); + if((! count($r)) || ($r[0]['network'] !== 'dfrn')) goaway($a->get_baseurl()); + $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']); - $dfrn_id = $orig_id = $r[0]['issued-id']; if($r[0]['duplex'] && $r[0]['issued-id']) { $orig_id = $r[0]['issued-id']; $dfrn_id = '1:' . $orig_id; diff --git a/mod/settings.php b/mod/settings.php index 5caf08b04..7adc5e6de 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -57,6 +57,7 @@ function settings_post(&$a) { $publish = (($_POST['profile_in_directory'] == 1) ? 1: 0); $net_publish = (($_POST['profile_in_netdirectory'] == 1) ? 1: 0); $old_visibility = ((intval($_POST['visibility']) == 1) ? 1 : 0); + $page_flags = ((intval($_POST['page-flags'])) ? intval($_POST['page-flags']) : 0); $notify = 0; @@ -103,7 +104,7 @@ function settings_post(&$a) { $str_group_deny = perms2str($_POST['group_deny']); $str_contact_deny = perms2str($_POST['contact_deny']); - $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `default-location` = '%s', `theme` = '%s' WHERE `uid` = %d LIMIT 1", + $r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `theme` = '%s' WHERE `uid` = %d LIMIT 1", dbesc($username), dbesc($email), dbesc($timezone), @@ -112,6 +113,7 @@ function settings_post(&$a) { dbesc($str_contact_deny), dbesc($str_group_deny), intval($notify), + intval($page_flags), dbesc($defloc), dbesc($theme), intval(get_uid()) @@ -176,6 +178,18 @@ function settings_content(&$a) { if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); + $pageset_tpl = load_view_file('view/pagetypes.tpl'); + $pagetype = replace_macros($pageset_tpl,array( + '$normal' => (($profile['page-flags'] == PAGE_NORMAL) ? " checked=\"checked\" " : ""), + '$soapbox' => (($profile['page-flags'] == PAGE_SOAPBOX) ? " checked=\"checked\" " : ""), + '$community' => (($profile['page-flags'] == PAGE_COMMUNITY) ? " checked=\"checked\" " : ""), + '$freelove' => (($profile['page-flags'] == PAGE_FREELOVE) ? " checked=\"checked\" " : ""), + '$page_normal' => PAGE_NORMAL, + '$page_soapbox' => PAGE_SOAPBOX, + '$page_community' => PAGE_COMMUNITY, + '$page_freelove' => PAGE_FREELOVE + )); + $opt_tpl = load_view_file("view/profile-in-directory.tpl"); $profile_in_dir = replace_macros($opt_tpl,array( @@ -234,6 +248,8 @@ function settings_content(&$a) { $stpl = load_view_file('view/settings.tpl'); + $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false); + $o .= replace_macros($stpl,array( '$baseurl' => $a->get_baseurl(), '$uid' => $_SESSION['uid'], @@ -247,13 +263,14 @@ function settings_content(&$a) { '$profile_in_net_dir' => $profile_in_net_dir, '$permissions' => t('Default Post Permissions'), '$visibility' => $profile['net-publish'], - '$aclselect' => populate_acl($a->user), + '$aclselect' => populate_acl($a->user,$celeb), '$sel_notify1' => (($notify & NOTIFY_INTRO) ? ' checked="checked" ' : ''), '$sel_notify2' => (($notify & NOTIFY_CONFIRM) ? ' checked="checked" ' : ''), '$sel_notify3' => (($notify & NOTIFY_WALL) ? ' checked="checked" ' : ''), '$sel_notify4' => (($notify & NOTIFY_COMMENT) ? ' checked="checked" ' : ''), '$sel_notify5' => (($notify & NOTIFY_MAIL) ? ' checked="checked" ' : ''), - '$theme' => $theme_selector + '$theme' => $theme_selector, + '$pagetype' => $pagetype )); return $o; diff --git a/view/acl_selectors.php b/view/acl_selectors.php index 388b75ebb..7ad97dfd2 100644 --- a/view/acl_selectors.php +++ b/view/acl_selectors.php @@ -30,21 +30,24 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { -function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false) { +function contact_select($selname, $selclass, $preselected = false, $size = 4, $privmail = false, $celeb = false) { $o = ''; // When used for private messages, we limit correspondence to mutual friends and the selector // to one recipient. By default our selector allows multiple selects amongst all contacts. - if($privmail) { + $sql_extra = ''; + + if($privmail || $celeb) { $sql_extra = sprintf(" AND `rel` = %d ", intval(REL_BUD)); + } + + if($privmail) $o .= "\r\n"; - } + $r = q("SELECT `id`, `name`, `url` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 @@ -73,7 +76,7 @@ function fixacl(&$item) { $item = intval(str_replace(array('<','>'),array('',''),$item)); } -function populate_acl($user = null) { +function populate_acl($user = null,$celeb = false) { $allow_cid = $allow_gid = $deny_cid = $deny_gid = false; @@ -104,7 +107,7 @@ function populate_acl($user = null) { $o .= ''; $o .= '
'; $o .= ''; - $o .= contact_select('contact_allow','contact_allow',$allow_cid); + $o .= contact_select('contact_allow','contact_allow',$allow_cid,4,false,$celeb); $o .= '
'; $o .= '' . "\r\n"; $o .= '
' . "\r\n"; @@ -119,7 +122,7 @@ function populate_acl($user = null) { $o .= ''; $o .= '
'; $o .= ''; - $o .= contact_select('contact_deny','contact_deny', $deny_cid); + $o .= contact_select('contact_deny','contact_deny', $deny_cid,4,false, $celeb); $o .= '
'; $o .= '' . "\r\n"; $o .= '
' . "\r\n"; diff --git a/view/settings.tpl b/view/settings.tpl index da330bcd1..e06671d37 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -5,8 +5,11 @@ $nickname_block
+ +

Basic Settings

+
- +
@@ -38,6 +41,14 @@ $theme
+
+ +
+ + +

Privacy Settings

+ + $profile_in_dir @@ -56,26 +67,43 @@ $profile_in_net_dir
+
+ +
+ + + +

Notification Settings

+ +
-
Send me a notification email when:
- +
Send a notification email when:
+
- +
- +
- +
+
+ +
+ + +

Password Settings

+ +

Leave password fields blank unless changing @@ -92,14 +120,20 @@ Leave password fields blank unless changing

+
+ +
+

Advanced Page Settings

+$pagetype
+ diff --git a/view/theme/default/style.css b/view/theme/default/style.css index af84e06fa..237264df4 100644 --- a/view/theme/default/style.css +++ b/view/theme/default/style.css @@ -666,7 +666,11 @@ input#dfrn-url { #profile-in-netdir-yes, #profile-in-netdir-no, #hide-friends-yes, -#hide-friends-no { +#hide-friends-no, +#settings-normal, +#settings-soapbox, +#settings-community, +#settings-freelove { float: left; margin-bottom: 20px; } @@ -686,6 +690,20 @@ input#dfrn-url { float: left; margin-bottom: 35px; } +#settings-normal-label, +#settings-soapbox-label, +#settings-community-label, +#settings-freelove-label { + float: left; + width: 200px; +} +#settings-normal-desc, +#settings-soapbox-desc, +#settings-community-desc, +#settings-freelove-desc { + float: left; + margin-left: 75px; +} #profile-edit-profile-name-end, #profile-edit-name-end, @@ -706,7 +724,11 @@ input#dfrn-url { #profile-in-netdir-break, #profile-in-netdir-end, #hide-friends-break, -#hide-friends-end { +#hide-friends-end, +#settings-normal-break, +#settings-soapbox-break, +#settings-community-break, +#settings-freelove-break { clear: both; }