lots of fixes - most recent photo updates for contacts
This commit is contained in:
parent
0bcd552231
commit
d11c1c63c0
15 changed files with 231 additions and 47 deletions
|
@ -116,9 +116,12 @@ function dfrn_confirm_post(&$a) {
|
|||
$thumb = $a->get_baseurl() . '/images/default-profile-sm.jpg';
|
||||
}
|
||||
|
||||
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `blocked` = 0, `pending` = 0 WHERE `id` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, `pending` = 0 WHERE `id` = %d LIMIT 1",
|
||||
dbesc($photo),
|
||||
dbesc($thumb),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval($dfrn_record)
|
||||
);
|
||||
if($r === false)
|
||||
|
@ -322,9 +325,12 @@ function dfrn_confirm_post(&$a) {
|
|||
$thumb = $a->get_baseurl() . '/images/default-profile-sm.jpg';
|
||||
}
|
||||
|
||||
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `blocked` = 0, `pending` = 0 WHERE `id` = %d LIMIT 1",
|
||||
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `name-date` = '%s', `uri-date` = '%s', `avatar-date` = '%s', `blocked` = 0, `pending` = 0 WHERE `id` = %d LIMIT 1",
|
||||
dbesc($photo),
|
||||
dbesc($thumb),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
intval($contact_id)
|
||||
);
|
||||
if($r === false)
|
||||
|
|
|
@ -47,6 +47,9 @@ function dfrn_notify_post(&$a) {
|
|||
$feed->init();
|
||||
|
||||
$ismail = false;
|
||||
$photo_time = $feed->get_feed_tags( NAMESPACE_DFRN, 'icon-updated');
|
||||
if($photo_time)
|
||||
$avatar_update = $photo_time[0]['data'];
|
||||
|
||||
$rawmail = $feed->get_feed_tags( NAMESPACE_DFRN, 'mail' );
|
||||
if(isset($rawmail[0]['child'][NAMESPACE_DFRN])) {
|
||||
|
@ -57,7 +60,7 @@ function dfrn_notify_post(&$a) {
|
|||
$msg['uid'] = $importer['uid'];
|
||||
$msg['from-name'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['name'][0]['data']));
|
||||
$msg['from-photo'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']));
|
||||
$msg['from-url'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']));
|
||||
$msg['from-url'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['uri'][0]['data']));
|
||||
$msg['contact-id'] = $importer['id'];
|
||||
$msg['title'] = notags(unxmlify($base['subject'][0]['data']));
|
||||
$msg['body'] = escape_tags(unxmlify($base['content'][0]['data']));
|
||||
|
|
|
@ -375,7 +375,7 @@ function photos_post(&$a) {
|
|||
$dups = false;
|
||||
$item_hash = random_string();
|
||||
|
||||
$uri = "urn:X-dfrn:" . $a->get_hostname() . ':' . $profile_uid . ':' . $item_hash;
|
||||
$uri = "urn:X-dfrn:" . $a->get_hostname() . ':' . $_SESSION['uid'] . ':' . $item_hash;
|
||||
|
||||
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
|
||||
dbesc($uri));
|
||||
|
|
|
@ -74,6 +74,11 @@ function profile_photo_post(&$a) {
|
|||
intval($_SESSION['uid'])
|
||||
);
|
||||
|
||||
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
|
||||
}
|
||||
goaway($a->get_baseurl() . '/profiles');
|
||||
return; // NOTREACHED
|
||||
|
|
|
@ -7,16 +7,19 @@ function profiles_post(&$a) {
|
|||
notice( "Permission denied." . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$namechanged = false;
|
||||
|
||||
if(($a->argc > 1) && ($a->argv[1] != "new") && intval($a->argv[1])) {
|
||||
$r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
$orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($a->argv[1]),
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
if(! count($r)) {
|
||||
if(! count($orig)) {
|
||||
$_SESSION['sysmsg'] .= "Profile not found." . EOL;
|
||||
return;
|
||||
}
|
||||
$is_default = (($r[0]['is-default']) ? 1 : 0);
|
||||
$is_default = (($orig[0]['is-default']) ? 1 : 0);
|
||||
|
||||
$profile_name = notags(trim($_POST['profile_name']));
|
||||
if(! strlen($profile_name)) {
|
||||
|
@ -39,6 +42,10 @@ function profiles_post(&$a) {
|
|||
|
||||
|
||||
$name = notags(trim($_POST['name']));
|
||||
|
||||
if($orig[0]['name'] != $name)
|
||||
$namechanged = true;
|
||||
|
||||
$gender = notags(trim($_POST['gender']));
|
||||
$address = notags(trim($_POST['address']));
|
||||
$locality = notags(trim($_POST['locality']));
|
||||
|
@ -132,7 +139,12 @@ function profiles_post(&$a) {
|
|||
|
||||
);
|
||||
}
|
||||
|
||||
if($namechanged && $is_default) {
|
||||
$r = q("UPDATE `contact` SET `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
intval($_SESSION['uid'])
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ function register_post(&$a) {
|
|||
return;
|
||||
}
|
||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `self`, `name`, `photo`, `thumb`, `blocked`, `pending`, `url`,
|
||||
`request`, `notify`, `poll`, `confirm` )
|
||||
VALUES ( %d, '%s', 1, '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s' ) ",
|
||||
`request`, `notify`, `poll`, `confirm`, `name-date`, `uri-date`, `avatar-date` )
|
||||
VALUES ( %d, '%s', 1, '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
|
||||
intval($newuid),
|
||||
datetime_convert(),
|
||||
dbesc($username),
|
||||
|
@ -149,8 +149,10 @@ function register_post(&$a) {
|
|||
dbesc($a->get_baseurl() . "/dfrn_request/$nickname"),
|
||||
dbesc($a->get_baseurl() . "/dfrn_notify/$nickname"),
|
||||
dbesc($a->get_baseurl() . "/dfrn_poll/$nickname"),
|
||||
dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname")
|
||||
|
||||
dbesc($a->get_baseurl() . "/dfrn_confirm/$nickname"),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert())
|
||||
);
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue