diff --git a/boot.php b/boot.php
index 5327688dd..7fbd2a6fb 100644
--- a/boot.php
+++ b/boot.php
@@ -626,7 +626,16 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
}
}
$a->set_curl_code($http_code);
+
$body = substr($s,strlen($header)+4);
+
+ /* one more try to make sure there are no more headers */
+
+ if(strpos($body,'HTTP/') === 0) {
+ $header = substr($body,0,strpos($body,"\r\n\r\n"));
+ $body = substr($body,strlen($header)+4);
+ }
+
$a->set_curl_headers($header);
curl_close($ch);
@@ -690,6 +699,14 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
}
$a->set_curl_code($http_code);
$body = substr($s,strlen($header)+4);
+
+ /* one more try to make sure there are no more headers */
+
+ if(strpos($body,'HTTP/') === 0) {
+ $header = substr($body,0,strpos($body,"\r\n\r\n"));
+ $body = substr($body,strlen($header)+4);
+ }
+
$a->set_curl_headers($header);
curl_close($ch);
@@ -762,7 +779,7 @@ function login($register = false) {
$lostpass = t('Forgot your password?');
$lostlink = t('Password Reset');
- if(x($_SESSION,'authenticated')) {
+ if(local_user()) {
$tpl = load_view_file("view/logout.tpl");
}
else {
@@ -772,12 +789,12 @@ function login($register = false) {
$o = replace_macros($tpl,array(
'$register_html' => $register_html,
- '$classname' => $classname,
- '$namelabel' => $namelabel,
- '$passlabel' => $passlabel,
- '$login' => $login,
- '$lostpass' => $lostpass,
- '$lostlink' => $lostlink
+ '$classname' => $classname,
+ '$namelabel' => $namelabel,
+ '$passlabel' => $passlabel,
+ '$login' => $login,
+ '$lostpass' => $lostpass,
+ '$lostlink' => $lostlink
));
return $o;
@@ -1266,7 +1283,7 @@ function del_pconfig($uid,$family,$key) {
unset($a->config[$uid][$family][$key]);
$ret = q("DELETE FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
intval($uid),
- dbesc($cat),
+ dbesc($family),
dbesc($key)
);
return $ret;
@@ -2323,3 +2340,87 @@ function current_theme_url() {
}}
+if(! function_exists('feed_birthday')) {
+function feed_birthday($uid,$tz) {
+
+ /**
+ *
+ * Determine the next birthday, but only if the birthday is published
+ * in the default profile. We _could_ also look for a private profile that the
+ * recipient can see, but somebody could get mad at us if they start getting
+ * public birthday greetings when they haven't made this info public.
+ *
+ * Assuming we are able to publish this info, we are then going to convert
+ * the start time from the owner's timezone to UTC.
+ *
+ * This will potentially solve the problem found with some social networks
+ * where birthdays are converted to the viewer's timezone and salutations from
+ * elsewhere in the world show up on the wrong day. We will convert it to the
+ * viewer's timezone also, but first we are going to convert it from the birthday
+ * person's timezone to GMT - so the viewer may find the birthday starting at
+ * 6:00PM the day before, but that will correspond to midnight to the birthday person.
+ *
+ */
+
+ $birthday = '';
+
+ $p = q("SELECT `dob` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
+ intval($uid)
+ );
+
+ if($p && count($p)) {
+ $tmp_dob = substr($p[0]['dob'],5);
+ if(intval($tmp_dob)) {
+ $y = datetime_convert($tz,$tz,'now','Y');
+ $bd = $y . '-' . $tmp_dob . ' 00:00';
+ $t_dob = strtotime($bd);
+ $now = strtotime(datetime_convert($tz,$tz,'now'));
+ if($t_dob < $now)
+ $bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
+ $birthday = datetime_convert($tz,'UTC',$bd,ATOM_TIME);
+ }
+ }
+
+ return $birthday;
+}}
+
+/**
+ * return atom link elements for all of our hubs
+ */
+
+if(! function_exists('feed_hublinks')) {
+function feed_hublinks() {
+
+ $hub = get_config('system','huburl');
+
+ $hubxml = '';
+ if(strlen($hub)) {
+ $hubs = explode(',', $hub);
+ if(count($hubs)) {
+ foreach($hubs as $h) {
+ $h = trim($h);
+ if(! strlen($h))
+ continue;
+ $hubxml .= '' . "\n" ;
+ }
+ }
+ }
+ return $hubxml;
+}}
+
+/* return atom link elements for salmon endpoints */
+
+if(! function_exists('feed_salmonlinks')) {
+function feed_salmonlinks($nick) {
+
+ $a = get_app();
+
+ $salmon = '' . "\n" ;
+
+ // old style links that status.net still needed as of 12/2010
+
+ $salmon .= ' ' . "\n" ;
+ $salmon .= ' ' . "\n" ;
+ return $salmon;
+}}
+
diff --git a/include/items.php b/include/items.php
index 15fd262f4..5d9eaaaf3 100644
--- a/include/items.php
+++ b/include/items.php
@@ -9,74 +9,27 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
// default permissions - anonymous user
- $sql_extra = "
- AND `allow_cid` = ''
- AND `allow_gid` = ''
- AND `deny_cid` = ''
- AND `deny_gid` = ''
- ";
-
- if(strlen($owner_nick) && ! intval($owner_nick)) {
- $r = q("SELECT `uid`, `nickname`, `timezone` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
- dbesc($owner_nick)
- );
- if(count($r)) {
- $owner_id = $r[0]['uid'];
- $owner_nick = $r[0]['nickname'];
- $owner_tz = $r[0]['timezone'];
- }
- }
-
- $r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
- intval($owner_id)
- );
- if(count($r)) {
- $owner = $r[0];
- $owner['nickname'] = $owner_nick;
- }
- else
+ if(! strlen($owner_nick))
killme();
+ $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
- /**
- *
- * Determine the next birthday, but only if the birthday is published
- * in the default profile. We _could_ also look for a private profile that the
- * recipient can see, but somebody could get mad at us if they start getting
- * public birthday greetings when they haven't made this info public.
- *
- * Assuming we are able to publish this info, we are then going to convert
- * the start time from the owner's timezone to UTC.
- *
- * This will potentially solve the problem found with some social networks
- * where birthdays are converted to the viewer's timezone and salutations from
- * elsewhere in the world show up on the wrong day. We will convert it to the
- * viewer's timezone also, but first we are going to convert it from the birthday
- * person's timezone to GMT - so the viewer may find the birthday starting at
- * 6:00PM the day before, but that will correspond to midnight to the birthday person.
- *
- */
-
- $birthday = '';
-
- $p = q("SELECT `dob` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
- intval($owner_id)
+ $r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`
+ FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
+ WHERE `contact`.`self` = 1 AND `user`.`nickname` = '%s' LIMIT 1",
+ dbesc($owner_nick)
);
- if($p && count($p)) {
- $tmp_dob = substr($p[0]['dob'],5);
- if(intval($tmp_dob)) {
- $y = datetime_convert($owner_tz,$owner_tz,'now','Y');
- $bd = $y . '-' . $tmp_dob . ' 00:00';
- $t_dob = strtotime($bd);
- $now = strtotime(datetime_convert($owner_tz,$owner_tz,'now'));
- if($t_dob < $now)
- $bd = $y + 1 . '-' . $tmp_dob . ' 00:00';
- $birthday = datetime_convert($owner_tz,'UTC',$bd,ATOM_TIME);
- }
- }
+ if(! count($r))
+ killme();
- if($dfrn_id && $dfrn_id != '*') {
+ $owner = $r[0];
+ $owner_id = $owner['user_uid'];
+ $owner_nick = $owner['nickname'];
+
+ $birthday = feed_birthday($owner_id,$owner['timezone']);
+
+ if(strlen($dfrn_id)) {
$sql_extra = '';
switch($direction) {
@@ -102,7 +55,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
);
if(! count($r))
- return false;
+ killme();
$contact = $r[0];
$groups = init_groups_visitor($contact['id']);
@@ -156,7 +109,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
);
// Will check further below if this actually returned results.
- // We will provide an empty feed in any case.
+ // We will provide an empty feed if that is the case.
$items = $r;
@@ -164,25 +117,9 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$atom = '';
- $hub = get_config('system','huburl');
-
- $hubxml = '';
- if(strlen($hub)) {
- $hubs = explode(',', $hub);
- if(count($hubs)) {
- foreach($hubs as $h) {
- $h = trim($h);
- if(! strlen($h))
- continue;
- $hubxml .= '' . "\n" ;
- }
- }
- }
-
- $salmon = '' . "\n" ;
- $salmon .= '' . "\n" ;
- $salmon .= '' . "\n" ;
+ $hubxml = feed_hublinks();
+ $salmon = feed_salmonlinks($owner_nick);
$atom .= replace_macros($feed_template, array(
'$version' => xmlify(FRIENDIKA_VERSION),
@@ -215,7 +152,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
// public feeds get html, our own nodes use bbcode
- if($dfrn_id === '*') {
+ if($dfrn_id === '') {
$type = 'html';
}
else {
@@ -922,12 +859,12 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
}
-/*
+/**
*
* consume_feed - process atom feed and update anything/everything we might need to update
*
- * $xml = the (atom) feed to consume - no RSS spoken here, it might partially work since simplepie
- * handles both, but we don't claim it will work well, and are reasonably certain it won't.
+ * $xml = the (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.
+ *
* $importer = the contact_record (joined to user_record) of the local user who owns this relationship.
* It is this person's stuff that is going to be updated.
* $contact = the person who is sending us stuff. If not set, we MAY be processing a "follow" activity
diff --git a/include/notifier.php b/include/notifier.php
index 07bde7c4d..b6c4ca571 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -87,7 +87,7 @@ function notifier_run($argv, $argc){
}
}
- $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags`
+ $r = q("SELECT `contact`.*, `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, `user`.`page-flags`
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($uid)
@@ -179,20 +179,14 @@ function notifier_run($argv, $argc){
$mail_template = load_view_file('view/atom_mail.tpl');
$atom = '';
- $hubxml = '';
$slaps = array();
- if(strlen($hub)) {
- $hubs = explode(',', $hub);
- if(count($hubs)) {
- foreach($hubs as $h) {
- $h = trim($h);
- if(! strlen($h))
- continue;
- $hubxml .= '' . "\n" ;
- }
- }
- }
+ $hubxml = feed_hublinks();
+
+ $birthday = feed_birthday($owner['uid'],$owner['timezone']);
+
+ if(strlen($birthday))
+ $birthday = '' . xmlify($birthday) . '';
$atom .= replace_macros($feed_template, array(
'$version' => xmlify(FRIENDIKA_VERSION),
@@ -208,7 +202,7 @@ function notifier_run($argv, $argc){
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
'$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
'$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
- '$birthday' => ''
+ '$birthday' => $birthday
));
if($cmd === 'mail') {
@@ -394,7 +388,7 @@ function notifier_run($argv, $argc){
*
*/
- $max_allowed = ((get_config('system','maxpubdeliver') === false) ? 150 : intval(get_config('system','maxdeliver')));
+ $max_allowed = ((get_config('system','maxpubdeliver') === false) ? 150 : intval(get_config('system','maxpubdeliver')));
/**
*
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 85e7fc0af..334e10307 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -28,7 +28,7 @@ function dfrn_poll_init(&$a) {
if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) {
logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] );
header("Content-type: application/atom+xml");
- $o = get_feed_for($a, '*', $a->argv[1],$last_update);
+ $o = get_feed_for($a, '', $a->argv[1],$last_update);
echo $o;
killme();
}
diff --git a/mod/photos.php b/mod/photos.php
index 1a1ebaac1..9acde458d 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -268,6 +268,13 @@ foreach($_FILES AS $key => $val) {
intval($page_owner_uid)
);
}
+
+ /* Don't make the item visible if the only change was the album name */
+
+ $visibility = 0;
+ if($p[0]['desc'] !== $desc || strlen($rawtags))
+ $visibility = 1;
+
if(! $item_id) {
// Create item container
@@ -297,6 +304,7 @@ foreach($_FILES AS $key => $val) {
$arr['deny_cid'] = $p[0]['deny_cid'];
$arr['deny_gid'] = $p[0]['deny_gid'];
$arr['last-child'] = 1;
+ $arr['visible'] = $visibility;
$arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']'
. '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.jpg' . '[/img]'
. '[/url]';
diff --git a/view/de/head.tpl b/view/de/head.tpl
index 50dd9cab6..c3ec3d2c9 100644
--- a/view/de/head.tpl
+++ b/view/de/head.tpl
@@ -1,7 +1,7 @@
-
+