2010-07-01 23:48:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function profile_init(&$a) {
|
|
|
|
|
2012-08-28 08:55:18 +00:00
|
|
|
if(argc() > 1)
|
|
|
|
$which = argv(1);
|
2010-07-01 23:48:07 +00:00
|
|
|
else {
|
2012-08-28 08:55:18 +00:00
|
|
|
notice( t('Requested profile is not available.') . EOL );
|
|
|
|
$a->error = 404;
|
|
|
|
return;
|
2010-07-01 23:48:07 +00:00
|
|
|
}
|
2012-08-28 08:55:18 +00:00
|
|
|
|
2013-07-03 09:47:36 +00:00
|
|
|
$profile = '';
|
2012-09-26 00:57:20 +00:00
|
|
|
$channel = $a->get_channel();
|
2013-07-03 10:19:58 +00:00
|
|
|
|
2012-08-30 06:03:03 +00:00
|
|
|
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
|
2012-09-26 00:57:20 +00:00
|
|
|
$which = $channel['channel_address'];
|
2012-08-30 06:03:03 +00:00
|
|
|
$profile = argv(1);
|
2013-07-03 09:47:36 +00:00
|
|
|
$r = q("select profile_guid from profile where id = %d and uid = %d limit 1",
|
|
|
|
intval($profile),
|
|
|
|
intval(local_user())
|
|
|
|
);
|
|
|
|
if(! $r)
|
|
|
|
$profile = '';
|
|
|
|
$profile = $r[0]['profile_guid'];
|
2010-07-29 04:02:36 +00:00
|
|
|
}
|
2010-10-21 21:32:29 +00:00
|
|
|
|
2013-01-06 21:42:51 +00:00
|
|
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
|
2010-07-08 14:03:25 +00:00
|
|
|
|
2013-07-03 09:47:36 +00:00
|
|
|
if(! $profile) {
|
|
|
|
$x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
|
|
|
|
dbesc(argv(1))
|
|
|
|
);
|
|
|
|
if($x) {
|
|
|
|
$a->profile = $x[0];
|
|
|
|
}
|
|
|
|
}
|
2013-01-07 21:40:58 +00:00
|
|
|
// $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format');
|
|
|
|
// if(! $channel_display)
|
2013-07-03 09:47:36 +00:00
|
|
|
profile_load($a,$which,$profile);
|
2013-07-03 10:19:58 +00:00
|
|
|
|
2013-01-06 21:42:51 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function profile_aside(&$a) {
|
|
|
|
|
|
|
|
require_once('include/contact_widgets.php');
|
|
|
|
require_once('include/items.php');
|
|
|
|
|
2013-01-07 21:40:58 +00:00
|
|
|
profile_create_sidebar($a);
|
2013-01-06 21:42:51 +00:00
|
|
|
|
2010-07-01 23:48:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-21 02:34:44 +00:00
|
|
|
function profile_content(&$a, $update = 0) {
|
|
|
|
|
2012-08-30 06:03:03 +00:00
|
|
|
if(get_config('system','block_public') && (! get_account_id()) && (! remote_user())) {
|
2012-09-26 04:35:35 +00:00
|
|
|
return login();
|
2011-04-22 00:29:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-24 00:14:50 +00:00
|
|
|
|
2010-07-01 23:48:07 +00:00
|
|
|
require_once("include/bbcode.php");
|
|
|
|
require_once('include/security.php');
|
2011-04-13 00:58:16 +00:00
|
|
|
require_once('include/conversation.php');
|
2011-04-20 12:51:02 +00:00
|
|
|
require_once('include/acl_selectors.php');
|
2012-06-13 03:46:30 +00:00
|
|
|
require_once('include/items.php');
|
|
|
|
|
2010-07-12 06:10:52 +00:00
|
|
|
$groups = array();
|
|
|
|
|
2012-10-30 00:14:02 +00:00
|
|
|
$tab = 'profile';
|
2010-10-30 20:25:37 +00:00
|
|
|
$o = '';
|
2010-07-11 02:43:55 +00:00
|
|
|
|
2010-07-26 05:51:45 +00:00
|
|
|
|
2010-08-20 00:23:13 +00:00
|
|
|
$contact = null;
|
|
|
|
$remote_contact = false;
|
|
|
|
|
2012-09-10 04:17:06 +00:00
|
|
|
$contact_id = 0;
|
|
|
|
|
|
|
|
if(is_array($_SESSION['remote'])) {
|
|
|
|
foreach($_SESSION['remote'] as $v) {
|
|
|
|
if($v['uid'] == $a->profile['profile_uid']) {
|
|
|
|
$contact_id = $v['cid'];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($contact_id) {
|
2010-07-12 06:10:52 +00:00
|
|
|
$groups = init_groups_visitor($contact_id);
|
2010-08-14 14:55:18 +00:00
|
|
|
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
|
|
|
intval($contact_id),
|
2010-08-20 00:23:13 +00:00
|
|
|
intval($a->profile['profile_uid'])
|
2010-08-14 14:55:18 +00:00
|
|
|
);
|
2010-08-20 00:23:13 +00:00
|
|
|
if(count($r)) {
|
2010-08-14 14:55:18 +00:00
|
|
|
$contact = $r[0];
|
2010-08-20 00:23:13 +00:00
|
|
|
$remote_contact = true;
|
|
|
|
}
|
2010-07-12 06:10:52 +00:00
|
|
|
}
|
2010-08-20 00:23:13 +00:00
|
|
|
|
|
|
|
if(! $remote_contact) {
|
2010-08-19 11:59:31 +00:00
|
|
|
if(local_user()) {
|
|
|
|
$contact_id = $_SESSION['cid'];
|
|
|
|
$contact = $a->contact;
|
|
|
|
}
|
2010-07-06 04:39:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-20 03:52:05 +00:00
|
|
|
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
|
2011-05-28 07:42:01 +00:00
|
|
|
|
2012-03-27 08:31:47 +00:00
|
|
|
if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
|
2011-05-28 07:42:01 +00:00
|
|
|
notice( t('Access to this profile has been restricted.') . EOL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-07-01 00:35:35 +00:00
|
|
|
|
2012-10-30 00:14:02 +00:00
|
|
|
$o .= profile_tabs($a, $is_owner, $a->profile['channel_address']);
|
2010-07-01 23:48:07 +00:00
|
|
|
|
2011-01-23 22:56:14 +00:00
|
|
|
|
2012-10-30 00:14:02 +00:00
|
|
|
require_once('include/profile_advanced.php');
|
|
|
|
$o .= advanced_profile($a);
|
|
|
|
call_hooks('profile_advanced',$o);
|
2010-07-01 23:48:07 +00:00
|
|
|
return $o;
|
2012-10-30 00:14:02 +00:00
|
|
|
|
2010-12-23 20:32:13 +00:00
|
|
|
}
|