From 1c7dc1879c4044848dbeb981be058dd8e78404f5 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Jan 2011 14:05:40 -0800 Subject: [PATCH 1/6] removed function was still referenced --- mod/register.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/register.php b/mod/register.php index 86bfe2066e..b52888ef9f 100644 --- a/mod/register.php +++ b/mod/register.php @@ -355,7 +355,7 @@ function register_content(&$a) { $block = get_config('system','block_extended_register'); - if((($a->config['register_policy'] == REGISTER_CLOSED) && (! getuid())) || ($block)) { + if((($a->config['register_policy'] == REGISTER_CLOSED) && (! local_user())) || ($block)) { notice("Permission denied." . EOL); return; } From 91db3b3f41f7822e80df360a0a551afb3af38797 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Jan 2011 14:20:01 -0800 Subject: [PATCH 2/6] more doco on header/nav region --- include/nav.php | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/include/nav.php b/include/nav.php index 1bde702bef..96acf826df 100644 --- a/include/nav.php +++ b/include/nav.php @@ -1,11 +1,35 @@ page,'nav'))) $a->page['nav'] = ''; + /** + * Placeholder div for popup panel + */ + $a->page['nav'] .= '' ; + /** + * + * Our network is distributed, and as you visit friends some of the + * sites look exactly the same - it isn't always easy to know where you are. + * Display the current site location as a navigation aid. + * + */ + $a->page['nav'] .= '
' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 ) . '
'; + + + /** + * Display login or logout + */ + if(local_user()) { $a->page['nav'] .= '' . t('Logout') . "\r\n"; } @@ -15,12 +39,16 @@ $a->page['nav'] .= "\r\n"; - // This should take you home from a remote profile connection + /** + * "Home" should also take you home from an authenticated remote profile connection + */ $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : ''); if(($a->module != 'home') && (! (local_user()))) $a->page['nav'] .= '' . t('Home') . "\r\n"; + + if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) $a->page['nav'] .= '' . t('Register') . "\r\n"; @@ -28,6 +56,13 @@ $a->page['nav'] .= '' . t('Search') . "\r\n"; $a->page['nav'] .= '' . t('Directory') . "\r\n"; + + /** + * + * The following nav links are only show to logged in users + * + */ + if(x($_SESSION,'uid')) { $a->page['nav'] .= '' . t('Network') @@ -36,7 +71,7 @@ $a->page['nav'] .= '' . t('Home') . '' . "\r\n"; - // only show friend requests for normal pages. Other page types have automatic friendship. + /* only show friend requests for normal pages. Other page types have automatic friendship. */ if($_SESSION['page_flags'] == PAGE_NORMAL) { $a->page['nav'] .= '' . t('Notifications') @@ -58,6 +93,12 @@ $a->page['nav'] .= "\r\n\r\n"; + /** + * + * Provide a banner/logo/whatever + * + */ + $banner = get_config('system','banner'); if($banner === false) From b11963f9ac3551ff850ddfd4c8c58fe0c87dee1a Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Jan 2011 18:46:37 -0800 Subject: [PATCH 3/6] first checkin fortunate plugin --- addon/fortunate/fortunate.css | 7 +++++++ addon/fortunate/fortunate.php | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 addon/fortunate/fortunate.css create mode 100644 addon/fortunate/fortunate.php diff --git a/addon/fortunate/fortunate.css b/addon/fortunate/fortunate.css new file mode 100644 index 0000000000..61813b7d7e --- /dev/null +++ b/addon/fortunate/fortunate.css @@ -0,0 +1,7 @@ +.fortunate { + margin-top: 25px; + margin-left: 100px; + margin-bottom: 25px; + color: #000088; + font-size: 14px; +} \ No newline at end of file diff --git a/addon/fortunate/fortunate.php b/addon/fortunate/fortunate.php new file mode 100644 index 0000000000..b91080f516 --- /dev/null +++ b/addon/fortunate/fortunate.php @@ -0,0 +1,24 @@ +page['htmlhead'] .= '' . "\r\n"; + + $s = fetch_url('http://fortunemod.com/cookie.php?numlines=2&equal=1&rand=' . mt_rand()); + $b .= '
' . $s . '
'; +} + From 2d80c601df1e2f80033194e44d90380c26e42346 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 12 Jan 2011 12:44:22 -0800 Subject: [PATCH 4/6] string extraction --- mod/profiles.php | 1 + view/profile_entry.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/profiles.php b/mod/profiles.php index 1c75dc0eb1..3488c8687e 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -401,6 +401,7 @@ function profiles_content(&$a) { $o .= replace_macros($template, array( '$photo' => $rr['thumb'], '$id' => $rr['id'], + '$alt' => t('Profile Image'), '$profile_name' => $rr['profile-name'] )); } diff --git a/view/profile_entry.tpl b/view/profile_entry.tpl index 5c6952af60..c5b782660a 100644 --- a/view/profile_entry.tpl +++ b/view/profile_entry.tpl @@ -1,7 +1,7 @@
-Profile Image +$alt
From 89a28bf0f7b43c4bafdfde794066aefe705efa89 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 12 Jan 2011 13:21:37 -0800 Subject: [PATCH 5/6] preserve body content in feed to extract microformat stuff --- include/items.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/items.php b/include/items.php index d267abe075..4c18938b0a 100644 --- a/include/items.php +++ b/include/items.php @@ -452,6 +452,8 @@ function get_atom_elements($feed,$item) { $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']; if(! $body) $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']; + // preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events + $res['object'] .= '' . xmlify($body) . '' . "\n"; if(strpos($body,'<')) { $body = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', @@ -489,6 +491,8 @@ function get_atom_elements($feed,$item) { $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['content'][0]['data']; if(! $body) $body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']; + // preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events + $res['object'] .= '' . xmlify($body) . '' . "\n"; if(strpos($body,'<')) { $body = preg_replace('#]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?#s', From 9d6f3aa4dd43af69d490d0fe8d355893a206e73f Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 12 Jan 2011 21:04:49 -0800 Subject: [PATCH 6/6] add owner's birthday information to feed (if allowed to) --- include/items.php | 50 +++++++++++++++++++++++++++++++++++++++----- include/notifier.php | 3 ++- mod/directory.php | 1 + view/atom_feed.tpl | 1 + 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/include/items.php b/include/items.php index 4c18938b0a..c63e5c208d 100644 --- a/include/items.php +++ b/include/items.php @@ -2,7 +2,7 @@ require_once('bbcode.php'); -function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { +function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) { // default permissions - anonymous user @@ -14,13 +14,14 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { AND `deny_gid` = '' "; - if(strlen($owner_id) && ! intval($owner_id)) { - $r = q("SELECT `uid`, `nickname` FROM `user` WHERE `nickname` = '%s' LIMIT 1", - dbesc($owner_id) + 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']; } } @@ -34,6 +35,44 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { else killme(); + /** + * + * 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) + ); + + 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($dfrn_id && $dfrn_id != '*') { $sql_extra = ''; @@ -154,7 +193,8 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { '$thumb' => xmlify($owner['thumb']), '$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)) + '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) , + '$birthday' => ((strlen($birthday)) ? '' . xmlify($birthday) . '' : '') )); call_hooks('atom_feed', $atom); diff --git a/include/notifier.php b/include/notifier.php index aedc560b03..5bc21cf13c 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -187,7 +187,8 @@ '$thumb' => xmlify($owner['thumb']), '$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)) + '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) , + '$birthday' => '' )); if($cmd === 'mail') { diff --git a/mod/directory.php b/mod/directory.php index 82f2b79b33..f70cd6df84 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -1,4 +1,5 @@ set_pager_itemspage(60); } diff --git a/view/atom_feed.tpl b/view/atom_feed.tpl index e993a622e4..3b2df2f676 100644 --- a/view/atom_feed.tpl +++ b/view/atom_feed.tpl @@ -22,4 +22,5 @@ $profile_page + $birthday