fix timeago (again), webfinger new spec implemented, some theme work

This commit is contained in:
friendica
2013-03-04 20:58:39 -08:00
parent 4cfbdfa6db
commit 8d442e6fc1
16 changed files with 133 additions and 174 deletions

View File

@@ -215,6 +215,7 @@ class Item extends BaseObject {
'osparkle' => $osparkle,
'sparkle' => $sparkle,
'title' => $item['title'],
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
'ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
'lock' => $lock,

View File

@@ -618,7 +618,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') {
'ago' => relative_date($item['created']),
'app' => $item['app'],
'str_app' => sprintf( t(' from %s'), $item['app']),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'),
'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'),
'location' => $location,
'indent' => '',
'owner_name' => $owner_name,

View File

@@ -221,7 +221,7 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
$groups = array();
$groups[] = array(
'text' => t('All Connections'),
'text' => t('All Channels'),
'id' => 0,
'selected' => (($group_id == 0) ? 'group-selected' : ''),
'href' => $every,

View File

@@ -17,6 +17,14 @@ function _well_known_init(&$a){
zfinger_init($a);
break;
case 'webfinger':
$a->argc -= 1;
array_shift($a->argv);
$a->argv[0] = 'wfinger';
require_once('mod/wfinger.php');
wfinger_init($a);
break;
}
}

View File

@@ -6,7 +6,6 @@ require_once('include/follow.php');
function follow_init(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
return;
}
@@ -27,3 +26,10 @@ function follow_init(&$a) {
goaway(z_root() . '/connections/' . $result['abook']['abook_id']);
}
functon follow_content(&$a) {
if(! local_user()) {
return login();
}
}

101
mod/wfinger.php Normal file
View File

@@ -0,0 +1,101 @@
<?php
function wfinger_init(&$a) {
$result = array();
$scheme = '';
if(x($_SERVER,'HTTPS') && $_SERVER['HTTPS'])
$scheme = 'https';
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
$scheme = 'https';
// Don't complain to me - I'm just implementing the spec.
if($scheme !== 'https') {
header($_SERVER["SERVER_PROTOCOL"] . ' ' . 500 . ' ' . 'Webfinger requires HTTPS');
killme();
}
$resource = $_REQUEST['resource'];
header('Access-Control-Allow-Origin: *');
header('Content-type: application/jrd+json');
$pubkey = get_config('system','site_pubkey');
$r = null;
if($resource) {
if(strpos($resource,'acct:') === 0) {
$channel = str_replace('acct:','',$resource);
$channel = substr($channel,0,strpos($channel,'@'));
}
if(strpos($resource,'http') === 0) {
$channel = str_replace('~','',basename($resource));
}
$r = q("select * from channel left join xchan on channel_hash = xchan_hash
where channel_address = '%s' limit 1",
dbesc($channel)
);
}
if($resource && $r) {
$result['subject'] = $resource;
$aliases = array(
'acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(),
z_root() . '/channel/' . $r[0]['channel_address'],
z_root() . '/~' . $r[0]['channel_address']
);
$result['aliases'] = array();
foreach($aliases as $alias)
if($alias != $resource)
$result['aliases'][] = $alias;
$result['links'] = array(
array(
'rel' => 'http://webfinger.example/rel/avatar',
'type' => $r[0]['xchan_photo_mimetype'],
'href' => $r[0]['xchan_photo_l']
),
array(
'rel' => 'http://webfinger.example/rel/profile-page',
'href' => z_root() . '/profile/' . $r[0]['channel_address'],
),
array(
'rel' => 'http://webfinger.example/rel/blog',
'href' => z_root() . '/channel/' . $r[0]['channel_address'],
),
array(
'rel' => 'http://purl.org/zot/protocol',
'href' => z_root() . '/well-known/zot-info' . '?zaddr=' . $r[0]['xchan_addr'],
)
);
}
else {
header($_SERVER["SERVER_PROTOCOL"] . ' ' . 400 . ' ' . 'Bad Request');
killme();
}
$arr = array('channel' => $r[0], 'request' => $_REQUEST, 'result' => $result);
call_hooks('webfinger',$arr);
echo json_encode($arr['result']);
killme();
}

View File

@@ -1 +1 @@
2013-03-03.241
2013-03-04.242

View File

@@ -419,22 +419,8 @@ footer {
margin-bottom: 10px;
}
.group-selected, .nets-selected, .fileas-selected, .categories-selected {
padding: 3px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #CCCCCC;
background: #F8F8F8;
font-weight: bold;
}
.settings-widget .selected {
padding: 3px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #CCCCCC;
background: #F8F8F8;
font-weight: bold;
.group-selected, .nets-selected, .fileas-selected, .categories-selected, .settings-widget .selected {
color: #444444 !important;
}
.smalltext {
@@ -513,62 +499,6 @@ footer {
}
/* TODO - we don't use DFRN anymore. These probably have different names now. Check and clean up later */
input#dfrn-url {
float: left;
background: url(../img/friendika-16.png) no-repeat;
background-position: 2px center;
font-size: 17px;
padding-left: 21px;
height: 21px;
background-color: #FFFFFF;
color: #000000;
margin-bottom: 20px;
}
#dfrn-url-label {
float: left;
width: 250px;
}
#dfrn-request-url-end {
clear: both;
}
#knowyouyes, #knowyouno {
float: left;
}
#dfrn-request-knowyou-yes-wrapper, #dfrn-request-knowyou-no-wrapper {
float: none;
}
#dfrn-request-knowyou-yes-label, #dfrn-request-knowyou-no-label {
float: left;
width: 75px;
margin-left: 50px;
margin-bottom: 7px;
}
#dfrn-request-knowyou-break, #dfrn-request-knowyou-end {
clear: both;
}
#dfrn-request-message-wrapper {
margin-bottom: 50px;
}
#dfrn-request-submit-wrapper {
clear: both;
margin-left: 50px;
}
#dfrn-request-info-wrapper {
margin-left: 50px;
}
#cropimage-wrapper, #cropimage-preview-wrapper {
float: left;
padding: 30px;
@@ -579,67 +509,7 @@ input#dfrn-url {
clear: both;
}
.intro-wrapper {
margin-top: 20px;
}
.intro-fullname {
font-size: 1.1em;
font-weight: bold;
}
.intro-desc {
margin-bottom: 20px;
font-weight: bold;
}
.intro-note {
padding: 10px;
}
.intro-end {
padding: 30px;
}
.intro-form {
float: left;
}
.intro-approve-form {
clear: both;
}
.intro-approve-as-friend-end {
clear: both;
}
.intro-submit-approve, .intro-submit-ignore {
margin-right: 20px;
}
.intro-submit-approve {
margin-top: 15px;
}
.intro-approve-as-friend-label, .intro-approve-as-fan-label {
float: left;
width: 100px;
margin-left: 20px;
}
.intro-approve-as-friend, .intro-approve-as-fan {
float: left;
}
.intro-form-end {
clear: both;
}
.intro-approve-as-friend-desc {
margin-top: 15px;
}
.intro-approve-as-end {
clear: both;
margin-bottom: 10px;
}
.intro-end {
clear: both;
margin-bottom: 30px;
}
.aprofile dt {
font-weight: bold;
}
@@ -677,29 +547,6 @@ input#dfrn-url {
clear: both;
}
#birthday-title {
float: left;
font-weight: bold;
}
#birthday-adjust {
float: left;
font-size: 75%;
margin-left: 10px;
}
#birthday-title-end {
clear: both;
}
.birthday-list {
margin-left: 15px;
}
#birthday-wrapper {
margin-bottom: 20px;
}
#profile-extra-links {
clear: both;
margin-top: 10px;
@@ -1497,12 +1344,7 @@ input#dfrn-url {
width: 200px;
}
.fortune {
margin-top: 50px;
color: #4444FF;
font-weight: bold;
margin-bottom: 20px;
}
.directory-end {
clear: both;
@@ -1873,7 +1715,7 @@ tr.mceLast {
list-style: none;
}
.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .group-selected, .nets-selected, .fileas-selected, .categories-selected {
.contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo {
border-radius: 5px;
-moz-border-radius: 5px;
box-shadow: 4px 4px 3px 0 #444444;

View File

@@ -38,7 +38,7 @@
</div>
<div class="wall-item-author">
<a href="$item.profile_url" title="$item.linktitle" class="wall-item-name-link"><span class="wall-item-name$item.sparkle" id="wall-item-name-$item.id" >$item.name</span></a>{{ if $item.owner_url }} $item.to <a href="$item.owner_url" title="$item.olinktitle" class="wall-item-name-link"><span class="wall-item-name$item.osparkle" id="wall-item-ownername-$item.id">$item.owner_name</span></a> $item.vwall{{ endif }}<br />
<div class="wall-item-ago" id="wall-item-ago-$item.id" title="$item.localtime">$item.ago</div>
<div class="wall-item-ago" id="wall-item-ago-$item.id" title="$item.isotime">$item.localtime</div>
</div>
<div class="wall-item-content" id="wall-item-content-$item.id" >
<div class="wall-item-title" id="wall-item-title-$item.id">$item.title</div>

View File

@@ -25,7 +25,7 @@
<div class="wall-item-author">
<a href="$item.profile_url" title="$item.linktitle" class="wall-item-name-link"><span class="wall-item-name$item.sparkle" id="wall-item-name-$item.id" >$item.name</span></a>
<div id="wall-item-ago-$item.id" class="wall-item-ago"><abbr class="wall-item-ago-time" title="$item.localtime">$item.ago</abbr>{{ if $item.app }}<span class="item.app">$item.str_app</span>{{ endif }}</div>
<div id="wall-item-ago-$item.id" class="wall-item-ago"><abbr class="wall-item-ago-time" title="$item.isotime">$item.localtime</abbr>{{ if $item.app }}<span class="item.app">$item.str_app</span>{{ endif }}</div>
</div>
<div class="wall-item-content" id="wall-item-content-$item.id" >

View File

@@ -43,7 +43,7 @@
</div>
<div class="wall-item-author">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}} {{$item.to}} <a href="{{$item.owner_url}}" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a> {{$item.vwall}}{{/if}}<br />
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}" title="{{$item.localtime}}">{{$item.ago}}</div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}" title="{{$item.isotime}}">{{$item.localtime}}</div>
</div>
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" >
<div class="wall-item-title" id="wall-item-title-{{$item.id}}">{{$item.title}}</div>

View File

@@ -30,7 +30,7 @@
<div class="wall-item-author">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>
<div id="wall-item-ago-{{$item.id}}" class="wall-item-ago"><abbr class="wall-item-ago-time" title="{{$item.localtime}}">{{$item.ago}}</abbr>{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}</div>
<div id="wall-item-ago-{{$item.id}}" class="wall-item-ago"><abbr class="wall-item-ago-time" title="{{$item.isotime}}">{{$item.localtime}}</abbr>{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}</div>
</div>
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" >

View File

@@ -29,7 +29,7 @@
</div>
<div class="wall-item-author">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>
<div id="wall-item-ago-{{$item.id}}" class="wall-item-ago"><abbr class="wall-item-ago-time" title="{{$item.localtime}}">{{$item.ago}}</abbr>{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}</div>
<div id="wall-item-ago-{{$item.id}}" class="wall-item-ago"><abbr class="wall-item-ago-time" title="{{$item.isotime}}">{{$item.localtime}}</abbr>{{if $item.app}}<span class="item.app">{{$item.str_app}}</span>{{/if}}</div>
</div>
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" >

View File

@@ -43,7 +43,7 @@
</div>
<div class="wall-item-author">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.sparkle}}" id="wall-item-name-{{$item.id}}" >{{$item.name}}</span></a>{{if $item.owner_url}} {{$item.to}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a> {{$item.vwall}}{{/if}}<br />
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}" title="{{$item.localtime}}">{{$item.ago}}</div>
<div class="wall-item-ago" id="wall-item-ago-{{$item.id}}" title="{{$item.localtime}}">{{$item.localtime}}</div>
</div>
<div class="wall-item-content" id="wall-item-content-{{$item.id}}" >
<div class="wall-item-title" id="wall-item-title-{{$item.id}}">{{$item.title}}</div>

View File

@@ -24,7 +24,7 @@
</div>
<div class="wall-item-author">
<a href="$item.profile_url" title="$item.linktitle" class="wall-item-name-link"><span class="wall-item-name$item.sparkle" id="wall-item-name-$item.id" >$item.name</span></a>
<div id="wall-item-ago-$item.id" class="wall-item-ago"><abbr class="wall-item-ago-time" title="$item.localtime">$item.ago</abbr>{{ if $item.app }}<span class="item.app">$item.str_app</span>{{ endif }}</div>
<div id="wall-item-ago-$item.id" class="wall-item-ago"><abbr class="wall-item-ago-time" title="$item.isotime">$item.localtime</abbr>{{ if $item.app }}<span class="item.app">$item.str_app</span>{{ endif }}</div>
</div>
<div class="wall-item-content" id="wall-item-content-$item.id" >

View File

@@ -38,7 +38,7 @@
</div>
<div class="wall-item-author">
<a href="$item.profile_url" title="$item.linktitle" class="wall-item-name-link"><span class="wall-item-name$item.sparkle" id="wall-item-name-$item.id" >$item.name</span></a>{{ if $item.owner_url }} $item.to <a href="$item.owner_url" target="redir" title="$item.olinktitle" class="wall-item-name-link"><span class="wall-item-name$item.osparkle" id="wall-item-ownername-$item.id">$item.owner_name</span></a> $item.vwall{{ endif }}<br />
<div class="wall-item-ago" id="wall-item-ago-$item.id" title="$item.localtime">$item.ago</div>
<div class="wall-item-ago" id="wall-item-ago-$item.id" title="$item.localtime">$item.localtime</div>
</div>
<div class="wall-item-content" id="wall-item-content-$item.id" >
<div class="wall-item-title" id="wall-item-title-$item.id">$item.title</div>