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

This commit is contained in:
Tobias Diekershoff 2011-01-25 08:54:10 +01:00
commit 4c717b38ae
7 changed files with 63 additions and 12 deletions

View File

@ -2215,3 +2215,17 @@ function link_compare($a,$b) {
return true; return true;
return false; return false;
}} }}
if(! function_exists('prepare_body')) {
function prepare_body($item) {
require_once('include/bbcode.php');
$s = smilies(bbcode($item['body']));
return $s;
}}

View File

@ -161,6 +161,8 @@ function scrape_feed($url) {
$x = $item->getAttribute('rel'); $x = $item->getAttribute('rel');
if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml')) if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml'))
$ret['feed_atom'] = $item->getAttribute('href'); $ret['feed_atom'] = $item->getAttribute('href');
if(($x === 'alternate') && ($item->getAttribute('type') === 'application/rss+xml'))
$ret['feed_rss'] = $item->getAttribute('href');
} }
return $ret; return $ret;

View File

@ -423,19 +423,29 @@ function get_atom_elements($feed,$item) {
else else
$res['private'] = 0; $res['private'] = 0;
$rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'published');
if($rawcreated)
$res['created'] = unxmlify($rawcreated[0]['data']);
$rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location'); $rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
if($rawlocation) if($rawlocation)
$res['location'] = unxmlify($rawlocation[0]['data']); $res['location'] = unxmlify($rawlocation[0]['data']);
$rawcreated = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'published');
if($rawcreated)
$res['created'] = unxmlify($rawcreated[0]['data']);
$rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'updated'); $rawedited = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'updated');
if($rawedited) if($rawedited)
$res['edited'] = unxmlify($rawcreated[0]['data']); $res['edited'] = unxmlify($rawcreated[0]['data']);
if(! $res['created'])
$res['created'] = $item->get_date();
if(! $res['edited'])
$res['edited'] = $item->get_date();
$rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner'); $rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner');
if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']) if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])
$res['owner-name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']); $res['owner-name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']);
@ -1155,6 +1165,10 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
); );
$datarray['last-child'] = 1; $datarray['last-child'] = 1;
} }
if(($contact['network'] === 'feed') || (! strlen($contact['poll']))) {
// one way feed - no remote comment ability
$datarray['last-child'] = 0;
}
$datarray['parent-uri'] = $parent_uri; $datarray['parent-uri'] = $parent_uri;
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
@ -1207,6 +1221,11 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
$datarray['last-child'] = 1; $datarray['last-child'] = 1;
} }
if(($contact['network'] === 'feed') || (! strlen($contact['poll']))) {
// one way feed - no remote comment ability
$datarray['last-child'] = 0;
}
$datarray['parent-uri'] = $item_id; $datarray['parent-uri'] = $item_id;
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
@ -1216,7 +1235,6 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
} }
} }
} }
} }
function new_follower($importer,$contact,$datarray,$item) { function new_follower($importer,$contact,$datarray,$item) {

View File

@ -74,8 +74,8 @@ function follow_post(&$a) {
$ret = scrape_feed($url); $ret = scrape_feed($url);
if(count($ret) && $ret['feed_atom']) { if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) {
$poll = $ret['feed_atom']; $poll = ((x($ret,'feed_atom')) ? $ret['feed_atom'] : $ret['feed_rss']);
$vcard = array(); $vcard = array();
require_once('simplepie/simplepie.inc'); require_once('simplepie/simplepie.inc');
$feed = new SimplePie(); $feed = new SimplePie();
@ -115,7 +115,6 @@ function follow_post(&$a) {
logger('follow: poll=' . $poll . ' notify=' . $notify . ' profile=' . $profile . ' vcard=' . print_r($vcard,true)); logger('follow: poll=' . $poll . ' notify=' . $notify . ' profile=' . $profile . ' vcard=' . print_r($vcard,true));
// do we have enough information? // do we have enough information?
if(! ((x($vcard['fn'])) && ($poll) && ($profile))) { if(! ((x($vcard['fn'])) && ($poll) && ($profile))) {

View File

@ -87,11 +87,14 @@ function settings_post(&$a) {
$err = ''; $err = '';
$name_change = false;
if($username != $a->user['username']) { if($username != $a->user['username']) {
if(strlen($username) > 40) $name_change = true;
$err .= t(' Please use a shorter name.'); if(strlen($username) > 40)
if(strlen($username) < 3) $err .= t(' Please use a shorter name.');
$err .= t(' Name too short.'); if(strlen($username) < 3)
$err .= t(' Name too short.');
} }
if($email != $a->user['email']) { if($email != $a->user['email']) {
@ -165,6 +168,15 @@ function settings_post(&$a) {
intval(local_user()) intval(local_user())
); );
if($name_change) {
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
dbesc($username),
dbesc(datetime_convert()),
intval(local_user())
);
}
if($old_visibility != $net_publish) { if($old_visibility != $net_publish) {
// Update global directory in background // Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');

View File

@ -985,6 +985,10 @@ input#dfrn-url {
width: 450px; width: 450px;
margin-left: 10px; margin-left: 10px;
margin-bottom: 20px; margin-bottom: 20px;
padding: 20px;
max-height: 400px;
overflow: auto;
} }
.wall-item-title { .wall-item-title {

View File

@ -854,6 +854,9 @@ input#dfrn-url {
width: 450px; width: 450px;
margin-left: 10px; margin-left: 10px;
margin-bottom: 20px; margin-bottom: 20px;
padding: 20px;
max-height: 400px;
overflow: auto;
} }
.wall-item-title { .wall-item-title {
@ -1879,4 +1882,3 @@ a.mail-list-link {
margin-bottom: 15px; margin-bottom: 15px;
} }