Merge branch 'master' of git://github.com/friendika/friendika

This commit is contained in:
root 2011-01-13 08:31:20 +01:00
commit 44ff96e0cf
10 changed files with 130 additions and 10 deletions

View File

@ -0,0 +1,7 @@
.fortunate {
margin-top: 25px;
margin-left: 100px;
margin-bottom: 25px;
color: #000088;
font-size: 14px;
}

View File

@ -0,0 +1,24 @@
<?php
function fortunate_install() {
register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
function fortunate_uninstall() {
unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
function fortunate_fetch($a,&$b) {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
$s = fetch_url('http://fortunemod.com/cookie.php?numlines=2&equal=1&rand=' . mt_rand());
$b .= '<div class="fortunate">' . $s . '</div>';
}

View File

@ -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)) ? '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>' : '')
));
call_hooks('atom_feed', $atom);
@ -452,6 +492,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'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if(strpos($body,'<')) {
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
@ -489,6 +531,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'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if(strpos($body,'<')) {
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',

View File

@ -1,11 +1,35 @@
<?php
/**
*
* Build page header and site navigation bars
*
*/
if(!(x($a->page,'nav')))
$a->page['nav'] = '';
/**
* Placeholder div for popup panel
*/
$a->page['nav'] .= '<div id="panel" style="display: none;"></div>' ;
/**
*
* 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'] .= '<div id="site-location">' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 ) . '</div>';
/**
* Display login or logout
*/
if(local_user()) {
$a->page['nav'] .= '<a id="nav-logout-link" class="nav-link" href="logout">' . t('Logout') . "</a>\r\n";
}
@ -15,12 +39,16 @@
$a->page['nav'] .= "<span id=\"nav-link-wrapper\" >\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'] .= '<a id="nav-home-link" class="nav-commlink" href="' . $homelink . '">' . t('Home') . "</a>\r\n";
if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
$a->page['nav'] .= '<a id="nav-register-link" class="nav-commlink" href="register" >'
. t('Register') . "</a>\r\n";
@ -28,6 +56,13 @@
$a->page['nav'] .= '<a id="nav-search-link" class="nav-link" href="search">' . t('Search') . "</a>\r\n";
$a->page['nav'] .= '<a id="nav-directory-link" class="nav-link" href="directory">' . t('Directory') . "</a>\r\n";
/**
*
* The following nav links are only show to logged in users
*
*/
if(x($_SESSION,'uid')) {
$a->page['nav'] .= '<a id="nav-network-link" class="nav-commlink" href="network">' . t('Network')
@ -36,7 +71,7 @@
$a->page['nav'] .= '<a id="nav-home-link" class="nav-commlink" href="profile/' . $a->user['nickname'] . '">'
. t('Home') . '</a><span id="home-update" class="nav-ajax-left"></span>' . "\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'] .= '<a id="nav-notify-link" class="nav-commlink" href="notifications">' . t('Notifications')
@ -58,6 +93,12 @@
$a->page['nav'] .= "</span>\r\n<span id=\"nav-end\"></span>\r\n";
/**
*
* Provide a banner/logo/whatever
*
*/
$banner = get_config('system','banner');
if($banner === false)

View File

@ -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') {

View File

@ -1,4 +1,5 @@
<?php
function directory_init(&$a) {
$a->set_pager_itemspage(60);
}

View File

@ -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']
));
}

View File

@ -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;
}

View File

@ -22,4 +22,5 @@
<uri dfrn:updated="$uridate" >$profile_page</uri>
<link rel="photo" type="image/jpeg" dfrn:updated="$picdate" media:width="175" media:height="175" href="$photo" />
<link rel="avatar" type="image/jpeg" dfrn:updated="$picdate" media:width="175" media:height="175" href="$photo" />
$birthday
</author>

View File

@ -1,7 +1,7 @@
<div class="profile-listing" >
<div class="profile-listing-photo-wrapper" >
<a href="profiles/$id" class="profile-listing-edit-link"><img class="profile-listing-photo" id="profile-listing-photo-$id" src="$photo" alt="Profile Image" /></a>
<a href="profiles/$id" class="profile-listing-edit-link"><img class="profile-listing-photo" id="profile-listing-photo-$id" src="$photo" alt="$alt" /></a>
</div>
<div class="profile-listing-photo-end"></div>
<div class="profile-listing-name" id="profile-listing-name-$id"><a href="profiles/$id" class="profile-listing-edit-link" >$profile_name</a></div>