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

This commit is contained in:
root 2011-01-18 11:14:28 +01:00
commit 13fa27f757
17 changed files with 97 additions and 60 deletions

View file

@ -17,7 +17,7 @@ hosting provider prior to installation.
- Apache with mod-rewrite enabled and "Options All" so you can use a - Apache with mod-rewrite enabled and "Options All" so you can use a
local .htaccess file local .htaccess file
- PHP > 5.1. The later the better. You'll need 5.3 for encryption of key - PHP 5.2+. The later the better. You'll need 5.3 for encryption of key
exchange conversations exchange conversations
encryption support encryption support
- PHP *command line* access with register_argc_argv set to true in the - PHP *command line* access with register_argc_argv set to true in the
@ -67,6 +67,12 @@ database was not installed correctly. You might wish to move/rename
.htconfig.php to another name and empty (called 'dropping') the database .htconfig.php to another name and empty (called 'dropping') the database
tables, so that you can start fresh. tables, so that you can start fresh.
****************************************************************************
****************************************************************************
******** THIS NEXT STEP IS IMPORTANT!!!! ***********
****************************************************************************
****************************************************************************
7. Set up a cron job or scheduled task to run the poller once every 5-10 7. Set up a cron job or scheduled task to run the poller once every 5-10
minutes to pick up the recent "public" postings of your friends. Example: minutes to pick up the recent "public" postings of your friends. Example:

View file

@ -2,8 +2,8 @@
set_time_limit(0); set_time_limit(0);
define ( 'BUILD_ID', 1031 ); define ( 'BUILD_ID', 1032 );
define ( 'FRIENDIKA_VERSION', '2.01.1000' ); define ( 'FRIENDIKA_VERSION', '2.01.1003' );
define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
@ -910,7 +910,6 @@ function xmlify($str) {
case "'" : case "'" :
$buffer .= '&apos;'; $buffer .= '&apos;';
break; break;
case "\"" : case "\"" :
$buffer .= '&quot;'; $buffer .= '&quot;';
break; break;
@ -946,6 +945,11 @@ function unxmlify($s) {
if(! function_exists('hex2bin')) { if(! function_exists('hex2bin')) {
function hex2bin($s) { function hex2bin($s) {
if(! ctype_xdigit($s)) {
logger('hex2bin: illegal input: ' . print_r(debug_backtrace(), true));
return($s);
}
return(pack("H*",$s)); return(pack("H*",$s));
}} }}
@ -2164,11 +2168,12 @@ function get_birthdays() {
foreach($r as $rr) { foreach($r as $rr) {
$now = strtotime('now'); $now = strtotime('now');
$today = (((strtotime($rr['start']) < $now) && (strtotime($rr['finish']) > $now)) ? true : false); $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false);
$o .= '<div class="birthday-list" id="birthday-' . $rr['eid'] . '"><a class="sparkle" href="' $o .= '<div class="birthday-list" id="birthday-' . $rr['eid'] . '"><a class="sparkle" href="'
. $a->get_baseurl() . '/redir/' . $rr['cid'] . '">' . $rr['name'] . '</a> ' . $a->get_baseurl() . '/redir/' . $rr['cid'] . '">' . $rr['name'] . '</a> '
. day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '') ; . day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : '')
. '</div>' ;
} }
$o .= '</div>'; $o .= '</div>';

View file

@ -11,6 +11,9 @@ function html2bbcode($s) {
$htmltags = array( $htmltags = array(
'/\n/is', '/\n/is',
'/\<pre\>(.*?)\<\/pre\>/is',
'/\<p(.*?)\>/is',
'/\<\/p\>/is',
'/\<b\>(.*?)\<\/b\>/is', '/\<b\>(.*?)\<\/b\>/is',
'/\<i\>(.*?)\<\/i\>/is', '/\<i\>(.*?)\<\/i\>/is',
'/\<u\>(.*?)\<\/u\>/is', '/\<u\>(.*?)\<\/u\>/is',
@ -33,6 +36,9 @@ function html2bbcode($s) {
$bbtags = array( $bbtags = array(
'', '',
'[code]$1[/code]',
'',
"\n",
'[b]$1[/b]', '[b]$1[/b]',
'[i]$1[/i]', '[i]$1[/i]',
'[u]$1[/u]', '[u]$1[/u]',

View file

@ -35,6 +35,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
else else
killme(); killme();
/** /**
* *
* Determine the next birthday, but only if the birthday is published * Determine the next birthday, but only if the birthday is published
@ -380,7 +381,7 @@ function get_atom_elements($feed,$item) {
// It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust // It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
// the content type. Our own network only emits text normally, though it might have been converted to // the content type. Our own network only emits text normally, though it might have been converted to
// html if we used a pubsubhubbub transport. But if we see even one html open tag in our text, we will // html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will
// have to assume it is all html and needs to be purified. // have to assume it is all html and needs to be purified.
// It doesn't matter all that much security wise - because before this content is used anywhere, we are // It doesn't matter all that much security wise - because before this content is used anywhere, we are
@ -389,7 +390,7 @@ function get_atom_elements($feed,$item) {
// html. // html.
if(strpos($res['body'],'<')) { if((strpos($res['body'],'<')) || (strpos($res['body'],'>'))) {
$res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s', $res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
'[youtube]$1[/youtube]', $res['body']); '[youtube]$1[/youtube]', $res['body']);
@ -403,11 +404,12 @@ function get_atom_elements($feed,$item) {
$purifier = new HTMLPurifier($config); $purifier = new HTMLPurifier($config);
$res['body'] = $purifier->purify($res['body']); $res['body'] = $purifier->purify($res['body']);
$res['body'] = html2bbcode($res['body']);
} }
else
$res['body'] = escape_tags($res['body']);
$res['body'] = html2bbcode($res['body']);
$allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow'); $allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow');
if($allow && $allow[0]['data'] == 1) if($allow && $allow[0]['data'] == 1)
@ -495,7 +497,7 @@ function get_atom_elements($feed,$item) {
$body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']; $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 // 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"; $res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if(strpos($body,'<')) { if((strpos($body,'<')) || (strpos($body,'>'))) {
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s', $body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
'[youtube]$1[/youtube]', $body); '[youtube]$1[/youtube]', $body);
@ -505,9 +507,11 @@ function get_atom_elements($feed,$item) {
$purifier = new HTMLPurifier($config); $purifier = new HTMLPurifier($config);
$body = $purifier->purify($body); $body = $purifier->purify($body);
$body = html2bbcode($body);
} }
else
$body = escape_tags($body);
$body = html2bbcode($body);
$res['object'] .= '<content>' . $body . '</content>' . "\n"; $res['object'] .= '<content>' . $body . '</content>' . "\n";
} }
@ -534,7 +538,7 @@ function get_atom_elements($feed,$item) {
$body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data']; $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 // 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"; $res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
if(strpos($body,'<')) { if((strpos($body,'<')) || (strpos($body,'>'))) {
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s', $body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
'[youtube]$1[/youtube]', $body); '[youtube]$1[/youtube]', $body);
@ -544,9 +548,11 @@ function get_atom_elements($feed,$item) {
$purifier = new HTMLPurifier($config); $purifier = new HTMLPurifier($config);
$body = $purifier->purify($body); $body = $purifier->purify($body);
$body = html2bbcode($body);
} }
else
$body = escape_tags($body);
$body = html2bbcode($body);
$res['target'] .= '<content>' . $body . '</content>' . "\n"; $res['target'] .= '<content>' . $body . '</content>' . "\n";
} }
@ -571,7 +577,7 @@ function encode_rel_links($links) {
if($link['attribs']['']['type']) if($link['attribs']['']['type'])
$o .= 'type="' . $link['attribs']['']['type'] . '" '; $o .= 'type="' . $link['attribs']['']['type'] . '" ';
if($link['attribs']['']['href']) if($link['attribs']['']['href'])
$o .= 'type="' . $link['attribs']['']['href'] . '" '; $o .= 'href="' . $link['attribs']['']['href'] . '" ';
if( (x($link['attribs'],NAMESPACE_MEDIA)) && $link['attribs'][NAMESPACE_MEDIA]['width']) if( (x($link['attribs'],NAMESPACE_MEDIA)) && $link['attribs'][NAMESPACE_MEDIA]['width'])
$o .= 'media:width="' . $link['attribs'][NAMESPACE_MEDIA]['width'] . '" '; $o .= 'media:width="' . $link['attribs'][NAMESPACE_MEDIA]['width'] . '" ';
if( (x($link['attribs'],NAMESPACE_MEDIA)) && $link['attribs'][NAMESPACE_MEDIA]['height']) if( (x($link['attribs'],NAMESPACE_MEDIA)) && $link['attribs'][NAMESPACE_MEDIA]['height'])
@ -782,8 +788,8 @@ function dfrn_deliver($owner,$contact,$atom) {
return (($res->status) ? $res->status : 3); return (($res->status) ? $res->status : 3);
$postvars = array(); $postvars = array();
$sent_dfrn_id = hex2bin($res->dfrn_id); $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
$challenge = hex2bin($res->challenge); $challenge = hex2bin((string) $res->challenge);
$rino_allowed = ((intval($res->rino) === 1) ? 1 : 0); $rino_allowed = ((intval($res->rino) === 1) ? 1 : 0);
$final_dfrn_id = ''; $final_dfrn_id = '';

View file

@ -181,7 +181,7 @@
'$feed_title' => xmlify($owner['name']), '$feed_title' => xmlify($owner['name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) , '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
'$hub' => $hubxml, '$hub' => $hubxml,
'$salmon' => '', // private feed, we don't use salmon here '$salmon' => '', // private feed, we don't use salmon here
'$name' => xmlify($owner['name']), '$name' => xmlify($owner['name']),
'$profile_page' => xmlify($owner['url']), '$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo']), '$photo' => xmlify($owner['photo']),
@ -207,7 +207,6 @@
)); ));
} }
else { else {
if($followup) { if($followup) {
foreach($items as $item) { // there is only one item foreach($items as $item) { // there is only one item
if($item['id'] == $item_id) { if($item['id'] == $item_id) {
@ -224,7 +223,13 @@
continue; continue;
$atom .= atom_entry($item,'text',$contact,$owner,true); $atom .= atom_entry($item,'text',$contact,$owner,true);
$slaps[] = atom_entry($item,'html',$contact,$owner,true);
// There's a problem here - we *were* going to use salmon to provide semi-authenticated
// communication to OStatus, but unless we're the item author they won't verify.
// commented out for now, though we'll still send local replies (and any mentions
// that they contain) upstream. Rethinking the problem space.
// $slaps[] = atom_entry($item,'html',$contact,$owner,true);
} }
} }
} }
@ -232,7 +237,7 @@
logger('notifier: ' . $atom, LOGGER_DATA); logger('notifier: ' . $atom, LOGGER_DATA);
logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA); // logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA);
if($followup) if($followup)
$recip_str = $parent['contact-id']; $recip_str = $parent['contact-id'];
@ -324,14 +329,12 @@
// send additional slaps to mentioned remote tags (@foo@example.com) // send additional slaps to mentioned remote tags (@foo@example.com)
if(count($slaps) && count($url_recipients) && $notify_hub) { if($slap && count($url_recipients) && $followup && $notify_hub) {
foreach($url_recipients as $url) { foreach($url_recipients as $url) {
logger('notifier: urldelivery: ' . $url); if($url) {
foreach($slaps as $slappy) { logger('notifier: urldelivery: ' . $url);
if($url) { $deliver_status = slapper($owner,$url,$slap);
$deliver_status = slapper($owner,$url,$slappy); // TODO: redeliver/queue these items on failure, though there is no contact record
// TODO: redeliver/queue these items on failure, though there is no contact record
}
} }
} }
} }

View file

@ -186,8 +186,8 @@
$postvars = array(); $postvars = array();
$sent_dfrn_id = hex2bin($res->dfrn_id); $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
$challenge = hex2bin($res->challenge); $challenge = hex2bin((string) $res->challenge);
$final_dfrn_id = ''; $final_dfrn_id = '';

View file

@ -270,7 +270,7 @@ function message_content(&$a) {
'$sparkle' => $sparkle, '$sparkle' => $sparkle,
'$from_photo' => $message['from-photo'], '$from_photo' => $message['from-photo'],
'$subject' => $message['title'], '$subject' => $message['title'],
'$body' => bbcode($message['body']), '$body' => smilies(bbcode($message['body'])),
'$delete' => t('Delete message'), '$delete' => t('Delete message'),
'$to_name' => $message['name'], '$to_name' => $message['name'],
'$date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A') '$date' => datetime_convert('UTC',date_default_timezone_get(),$message['created'],'D, d M Y - g:i A')

View file

@ -115,6 +115,10 @@ function network_content(&$a, $update = 0) {
$o = '<h4>' . t('Group: ') . $r[0]['name'] . '</h4>' . $o; $o = '<h4>' . t('Group: ') . $r[0]['name'] . '</h4>' . $o;
} }
if((! $group) && (! $update))
$o .= get_birthdays();
$r = q("SELECT COUNT(*) AS `total` $r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0

View file

@ -230,7 +230,7 @@ function profile_content(&$a, $update = 0) {
if($is_owner && ! $update) if($is_owner && ! $update)
$o .= get_birthdays(); $o .= get_birthdays();
$cmnt_tpl = load_view_file('view/comment_item.tpl'); $cmnt_tpl = load_view_file('view/comment_item.tpl');

View file

@ -199,7 +199,12 @@ function salmon_post(&$a) {
$hub = ''; $hub = '';
// consume_feed will only accept a follow activity from this person if there is no contact record. /**
*
* anti-spam measure: consume_feed will accept a follow activity from
* this person (and nothing else) if there is no existing contact record.
*
*/
$contact_rec = ((count($r)) ? $r[0] : null); $contact_rec = ((count($r)) ? $r[0] : null);

View file

@ -302,3 +302,18 @@ function update_1030() {
} }
function update_1031() {
// Repair any bad links that slipped into the item table
$r = q("SELECT `id`, `object` FROM `item` WHERE `object` != '' ");
if($r && count($r)) {
foreach($r as $rr) {
if(strstr($rr['object'],'type=&quot;http')) {
q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(str_replace('type=&quot;http','href=&quot;http',$rr['object'])),
intval($rr['id'])
);
}
}
}
}

View file

@ -39,8 +39,8 @@ EOT;
$o .= '<div id="advanced-profile-dob">' $o .= '<div id="advanced-profile-dob">'
. ((intval($a->profile['dob'])) . ((intval($a->profile['dob']))
? datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y') ? day_translate(datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y'))
: datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F')) : day_translate(datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F')))
. "</div>\r\n</div>"; . "</div>\r\n</div>";
$o .= '<div id="advanced-profile-dob-end"></div>'; $o .= '<div id="advanced-profile-dob-end"></div>';

View file

@ -39,8 +39,8 @@ EOT;
$o .= '<div id="advanced-profile-dob">' $o .= '<div id="advanced-profile-dob">'
. ((intval($a->profile['dob'])) . ((intval($a->profile['dob']))
? datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y') ? day_translate(datetime_convert('UTC',date_default_timezone_get(),$a->profile['dob'],'j F, Y'))
: datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F')) : day_translate(datetime_convert('UTC',date_default_timezone_get(),'2001-' . substr($a->profile['dob'],6),'j F')))
. "</div>\r\n</div>"; . "</div>\r\n</div>";
$o .= '<div id="advanced-profile-dob-end"></div>'; $o .= '<div id="advanced-profile-dob-end"></div>';

View file

@ -1979,5 +1979,5 @@ a.mail-list-link {
} }
#birthday-wrapper { #birthday-wrapper {
margin-bottom: 15px; margin-bottom: 20px;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

View file

@ -3,23 +3,10 @@
* Fabio Comuni <fabrix.xm@gmail.com> * Fabio Comuni <fabrix.xm@gmail.com>
*/ */
@font-face {
font-family: FreeSans;
font-style: normal;
font-weight: bold;
src: local('FreeSansBold'), url('FreeSansBold.otf');
}
@font-face {
font-family: FreeSans;
font-style: normal;
font-weight: normal;
src: local('FreeSans'), url('FreeSans.otf');
}
/* generals */ /* generals */
body { body {
font-family: /*FreeSans,*/ helvetica,arial,clean,sans-serif; font-family: helvetica,arial,freesans,clean,sans-serif;
font-size: 12px; font-size: 12px;
background-color: #ffffff; background-color: #ffffff;
background-image: url(head.jpg); background-image: url(head.jpg);
@ -209,10 +196,10 @@ footer {
} }
.shiny { div.wall-item-content-wrapper.shiny {
background-image: url(shiny.jpg); background-image: url('shiny.png');
background-repeat: repeat-x; background-position: -5px 30px;
background-position: left bottom; background-repeat:no-repeat;
} }
/* from defautlt */ /* from defautlt */
@ -801,7 +788,7 @@ input#dfrn-url {
.wall-item-content-wrapper.comment { .wall-item-content-wrapper.comment {
margin-left: 50px; margin-left: 50px;
background: #CCCCCC; background: #EEEEEE;
} }
.wall-item-photo-wrapper { .wall-item-photo-wrapper {
@ -879,7 +866,7 @@ input#dfrn-url {
.comment-edit-wrapper { .comment-edit-wrapper {
margin-top: 15px; margin-top: 15px;
background: #CCCCCC; background: #f3f3f3;
margin-left: 50px; margin-left: 50px;
} }
@ -1876,5 +1863,5 @@ a.mail-list-link {
} }
#birthday-wrapper { #birthday-wrapper {
margin-bottom: 15px; margin-bottom: 20px;
} }