if(! function_exists('local_user')) {
function local_user() {
if((x($_SESSION,'authenticated')) && (x($_SESSION,'uid')))
- return $_SESSION['uid'];
+ return intval($_SESSION['uid']);
return false;
}}
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;
}}
break;
}
- if($r[0]['rel'] != REL_FAN) {
+ if(($r[0]['network'] === 'dfrn') && ($r[0]['rel'])) {
$url = "redir/{$r[0]['id']}";
$sparkle = ' class="sparkle" ';
}
break;
}
- if($rr['rel'] != REL_FAN) {
+ if(($rr['network'] === 'dfrn') && ($rr['rel'])) {
$url = "redir/{$rr['id']}";
$sparkle = ' class="sparkle" ';
}
$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:
$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)) {
$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
$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"';
}
}
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"';
}
$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';
}
$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';
}
'$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)
));
}
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']
));
$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
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"';
}
}
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"';
}
$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';
}
- if(($item['rel'] == REL_VIP || $item['rel'] == REL_BUD) && (! $item['self'] )) {
+ if(($item['network'] === 'dfrn') && (! $item['self'] )) {
$profile_url = $redirect_url;
$sparkle = ' sparkle';
}
$albumselect .= '<option value="' . $album['album'] . '">' . $album['album'] . '</option>';
}
}
+
+ $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
+
$albumselect .= '</select>';
$tpl = load_view_file('view/photos_upload.tpl');
$o .= replace_macros($tpl,array(
'$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',
$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
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';
}
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');
'$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']
));
}
$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
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" ';
}
}
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" ';
}
// 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';
}
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;
$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;
$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),
dbesc($str_contact_deny),
dbesc($str_group_deny),
intval($notify),
+ intval($page_flags),
dbesc($defloc),
dbesc($theme),
intval(get_uid())
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(
$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'],
'$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;
-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));
- $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
}
- else {
- $sql_extra = '';
+
+ if($privmail)
+ $o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" >\r\n";
+ else
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" >\r\n";
- }
+
$r = q("SELECT `id`, `name`, `url` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0
$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;
$o .= '</div>';
$o .= '<div id="contact_allow_wrapper">';
$o .= '<label id="acl-allow-contact-label" for="contact_allow" >' . t('Contacts') . '</label>';
- $o .= contact_select('contact_allow','contact_allow',$allow_cid);
+ $o .= contact_select('contact_allow','contact_allow',$allow_cid,4,false,$celeb);
$o .= '</div>';
$o .= '</div>' . "\r\n";
$o .= '<div id="acl-allow-end"></div>' . "\r\n";
$o .= '</div>';
$o .= '<div id="contact_deny_wrapper" >';
$o .= '<label id="acl-deny-contact-label" for="contact_deny" >' . t('Contacts') . '</label>';
- $o .= contact_select('contact_deny','contact_deny', $deny_cid);
+ $o .= contact_select('contact_deny','contact_deny', $deny_cid,4,false, $celeb);
$o .= '</div>';
$o .= '</div>' . "\r\n";
$o .= '<div id="acl-deny-end"></div>' . "\r\n";
<form action="settings" id="settings-form" method="post" >
+
+<h3 class="settings-heading">Basic Settings</h3>
+
<div id="settings-username-wrapper" >
-<label id="settings-username-label" for="settings-username" >Username: </label>
+<label id="settings-username-label" for="settings-username" >Full Name: </label>
<input type="text" name="username" id="settings-username" value="$username" />
</div>
<div id="settings-username-end" ></div>
</div>
<div id="settings-theme-end"></div>
+<div id="settings-submit-wrapper" >
+<input type="submit" name="submit" id="settings-submit" value="Submit" />
+</div>
+
+
+<h3 class="settings-heading">Privacy Settings</h3>
+
+
<input type="hidden" name="visibility" value="$visibility" />
$profile_in_dir
</div>
<div id="settings-default-perms-end"></div>
+<div id="settings-submit-wrapper" >
+<input type="submit" name="submit" id="settings-submit" value="Submit" />
+</div>
+
+
+
+<h3 class="settings-heading">Notification Settings</h3>
+
+
<div id="settings-notify-wrapper">
-<div id="settings-notify-desc">Send me a notification email when: </div>
-<label for="notify1" id="settings-label-notify1">I receive an introduction</label>
+<div id="settings-notify-desc">Send a notification email when: </div>
+<label for="notify1" id="settings-label-notify1">You receive an introduction</label>
<input id="notify1" type="checkbox" $sel_notify1 name="notify1" value="1" />
<div id="notify1-end"></div>
-<label for="notify2" id="settings-label-notify2">My introductions are confirmed</label>
+<label for="notify2" id="settings-label-notify2">Your introductions are confirmed</label>
<input id="notify2" type="checkbox" $sel_notify2 name="notify2" value="2" />
<div id="notify2-end"></div>
-<label for="notify3" id="settings-label-notify3">Someone writes on my profile wall</label>
+<label for="notify3" id="settings-label-notify3">Someone writes on your profile wall</label>
<input id="notify3" type="checkbox" $sel_notify3 name="notify3" value="4" />
<div id="notify3-end"></div>
<label for="notify4" id="settings-label-notify4">Someone writes a followup comment</label>
<input id="notify4" type="checkbox" $sel_notify4 name="notify4" value="8" />
<div id="notify4-end"></div>
-<label for="notify5" id="settings-label-notify5">I receive a private message</label>
+<label for="notify5" id="settings-label-notify5">You receive a private message</label>
<input id="notify5" type="checkbox" $sel_notify5 name="notify5" value="16" />
<div id="notify5-end"></div>
</div>
<div id="settings=notify-end"></div>
+<div id="settings-submit-wrapper" >
+<input type="submit" name="submit" id="settings-submit" value="Submit" />
+</div>
+
+
+<h3 class="settings-heading">Password Settings</h3>
+
+
<div id="settings-password-wrapper" >
<p id="settings-password-desc" >
Leave password fields blank unless changing
<div id="settings-confirm-end" ></div>
+<div id="settings-submit-wrapper" >
+<input type="submit" name="submit" id="settings-submit" value="Submit" />
+</div>
+<h3 class="settings-heading">Advanced Page Settings</h3>
+$pagetype
<div id="settings-submit-wrapper" >
<input type="submit" name="submit" id="settings-submit" value="Submit" />
</div>
+
</form>
#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;
}
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,
#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;
}