diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-08-08 21:03:08 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-08-08 21:03:08 -0700 |
commit | d11c1c63c02e88b3c73336741a2240ccc18d3b02 (patch) | |
tree | af32bf9355c99c578f696aec91f66374acd82208 /mod | |
parent | 0bcd5522315649c8d4652b8bfaa9bec328b9d548 (diff) | |
download | volse-hubzilla-d11c1c63c02e88b3c73336741a2240ccc18d3b02.tar.gz volse-hubzilla-d11c1c63c02e88b3c73336741a2240ccc18d3b02.tar.bz2 volse-hubzilla-d11c1c63c02e88b3c73336741a2240ccc18d3b02.zip |
lots of fixes - most recent photo updates for contacts
Diffstat (limited to 'mod')
-rw-r--r-- | mod/dfrn_confirm.php | 10 | ||||
-rw-r--r-- | mod/dfrn_notify.php | 5 | ||||
-rw-r--r-- | mod/photos.php | 2 | ||||
-rw-r--r-- | mod/profile_photo.php | 5 | ||||
-rw-r--r-- | mod/profiles.php | 20 | ||||
-rw-r--r-- | mod/register.php | 10 |
6 files changed, 40 insertions, 12 deletions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index a8a4b3b99..359ddef17 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -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) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 5655977e5..6aed53a77 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -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'])); diff --git a/mod/photos.php b/mod/photos.php index 81d071829..7b07f6729 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -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)); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 151277249..ebd9f1b48 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -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 diff --git a/mod/profiles.php b/mod/profiles.php index db4426474..bfdff5f6b 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -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']) + ); + } } diff --git a/mod/register.php b/mod/register.php index 62f4e60dc..65b7fa6be 100644 --- a/mod/register.php +++ b/mod/register.php @@ -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()) ); |