1
0
Fork 0

Merge branch 'friendika-master'

This commit is contained in:
fabrixxm 2011-02-03 07:24:58 +01:00
commit 97bb80c00f
9 changed files with 114 additions and 30 deletions

View file

@ -36,6 +36,11 @@ function js_upload_form(&$a,&$b) {
$b['addon_text'] .= '<link href="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.css" rel="stylesheet" type="text/css">'; $b['addon_text'] .= '<link href="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.css" rel="stylesheet" type="text/css">';
$b['addon_text'] .= '<script src="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.js" type="text/javascript"></script>'; $b['addon_text'] .= '<script src="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.js" type="text/javascript"></script>';
$upload_msg = t('Upload a file');
$drop_msg = t('Drop files here to upload');
$cancel = t('Cancel');
$failed = t('Failed');
$b['addon_text'] .= <<< EOT $b['addon_text'] .= <<< EOT
<div id="file-uploader-demo1"> <div id="file-uploader-demo1">
@ -65,6 +70,22 @@ function createUploader() {
uploader = new qq.FileUploader({ uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-demo1'), element: document.getElementById('file-uploader-demo1'),
action: '{$b['post_url']}', action: '{$b['post_url']}',
template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>$drop_msg</span></div>' +
'<div class="qq-upload-button">$upload_msg</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
// template for one item in file list
fileTemplate: '<li>' +
'<span class="qq-upload-file"></span>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-size"></span>' +
'<a class="qq-upload-cancel" href="#">$cancel</a>' +
'<span class="qq-upload-failed-text">$failed</span>' +
'</li>',
debug: true, debug: true,
onSubmit: function(id,filename) { onSubmit: function(id,filename) {

View file

@ -3,8 +3,8 @@
set_time_limit(0); set_time_limit(0);
define ( 'BUILD_ID', 1034 ); define ( 'BUILD_ID', 1034 );
define ( 'FRIENDIKA_VERSION', '2.10.0902' ); define ( 'FRIENDIKA_VERSION', '2.10.0903' );
define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'DFRN_PROTOCOL_VERSION', '2.1' );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -1366,6 +1366,7 @@ function lrdd($uri) {
else { else {
$html = fetch_url($uri); $html = fetch_url($uri);
$headers = $a->get_curl_headers(); $headers = $a->get_curl_headers();
logger('lrdd: headers=' . $headers, LOGGER_DEBUG);
$lines = explode("\n",$headers); $lines = explode("\n",$headers);
if(count($lines)) { if(count($lines)) {
foreach($lines as $line) { foreach($lines as $line) {
@ -1377,6 +1378,8 @@ function lrdd($uri) {
// don't try and run feeds through the html5 parser // don't try and run feeds through the html5 parser
if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml')))) if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
return array(); return array();
if(stristr($html,'<rss') || stristr($html,'<feed'))
return array();
} }
} }
if(! isset($link)) { if(! isset($link)) {

View file

@ -8,12 +8,18 @@ function scrape_dfrn($url) {
$a = get_app(); $a = get_app();
$ret = array(); $ret = array();
logger('scrape_dfrn: url=' . $url);
$s = fetch_url($url); $s = fetch_url($url);
if(! $s) if(! $s)
return $ret; return $ret;
$headers = $a->get_curl_headers(); $headers = $a->get_curl_headers();
logger('scrape_dfrn: headers=' . $headers, LOGGER_DEBUG);
$lines = explode("\n",$headers); $lines = explode("\n",$headers);
if(count($lines)) { if(count($lines)) {
foreach($lines as $line) { foreach($lines as $line) {
@ -93,12 +99,17 @@ function scrape_meta($url) {
$a = get_app(); $a = get_app();
$ret = array(); $ret = array();
logger('scrape_meta: url=' . $url);
$s = fetch_url($url); $s = fetch_url($url);
if(! $s) if(! $s)
return $ret; return $ret;
$headers = $a->get_curl_headers(); $headers = $a->get_curl_headers();
logger('scrape_meta: headers=' . $headers, LOGGER_DEBUG);
$lines = explode("\n",$headers); $lines = explode("\n",$headers);
if(count($lines)) { if(count($lines)) {
foreach($lines as $line) { foreach($lines as $line) {
@ -135,6 +146,9 @@ function scrape_vcard($url) {
$a = get_app(); $a = get_app();
$ret = array(); $ret = array();
logger('scrape_vcard: url=' . $url);
$s = fetch_url($url); $s = fetch_url($url);
if(! $s) if(! $s)
@ -190,15 +204,17 @@ function scrape_feed($url) {
return $ret; return $ret;
$headers = $a->get_curl_headers(); $headers = $a->get_curl_headers();
logger('scrape_feed: headers=' . $headers, LOGGER_DEBUG);
$lines = explode("\n",$headers); $lines = explode("\n",$headers);
if(count($lines)) { if(count($lines)) {
foreach($lines as $line) { foreach($lines as $line) {
if(stristr($line,'content-type:')) { if(stristr($line,'content-type:')) {
if(stristr($line,'application/atom+xml')) { if(stristr($line,'application/atom+xml') || stristr($s,'<feed')) {
$ret['feed_atom'] = $url; $ret['feed_atom'] = $url;
return $ret; return $ret;
} }
if(stristr($line,'application/rss+xml')) { if(stristr($line,'application/rss+xml') || stristr($s,'<rss')) {
$ret['feed_rss'] = $url; $ret['feed_rss'] = $url;
return ret; return ret;
} }

View file

@ -23,7 +23,7 @@ function html2bbcode($s) {
'/\<div(.*?)\>(.*?)\<\/div\>/is', '/\<div(.*?)\>(.*?)\<\/div\>/is',
'/\<br(.*?)\>/is', '/\<br(.*?)\>/is',
'/\<strong\>(.*?)\<\/strong\>/is', '/\<strong\>(.*?)\<\/strong\>/is',
'/\<a href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is', '/\<a (.*?)href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is',
'/\<code\>(.*?)\<\/code\>/is', '/\<code\>(.*?)\<\/code\>/is',
'/\<span style=\"color:(.*?)\"\>(.*?)\<\/span\>/is', '/\<span style=\"color:(.*?)\"\>(.*?)\<\/span\>/is',
'/\<blockquote\>(.*?)\<\/blockquote\>/is', '/\<blockquote\>(.*?)\<\/blockquote\>/is',
@ -48,7 +48,7 @@ function html2bbcode($s) {
'$2', '$2',
"\n", "\n",
'[b]$1[/b]', '[b]$1[/b]',
'[url=$1]$3[/url]', '[url=$2]$4[/url]',
'[code]$1[/code]', '[code]$1[/code]',
'[color="$1"]$2[/color]', '[color="$1"]$2[/color]',
'[quote]$1[/quote]', '[quote]$1[/quote]',

View file

@ -768,7 +768,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$a = get_app(); $a = get_app();
if((! strlen($contact['dfrn-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY))) if((! strlen($contact['issued-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY)))
return 3; return 3;
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
@ -800,6 +800,12 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if(! $xml) if(! $xml)
return 3; return 3;
if(strpos($xml,'<?xml') === false) {
logger('dfrn_deliver: no valid XML returned');
logger('dfrn_deliver: returned XML: ' . $xml, LOGGER_DATA);
return 3;
}
$res = simplexml_load_string($xml); $res = simplexml_load_string($xml);
if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id)))
@ -808,19 +814,20 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars = array(); $postvars = array();
$sent_dfrn_id = hex2bin((string) $res->dfrn_id); $sent_dfrn_id = hex2bin((string) $res->dfrn_id);
$challenge = hex2bin((string) $res->challenge); $challenge = hex2bin((string) $res->challenge);
$dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0);
$rino_allowed = ((intval($res->rino) === 1) ? 1 : 0); $rino_allowed = ((intval($res->rino) === 1) ? 1 : 0);
$final_dfrn_id = ''; $final_dfrn_id = '';
if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
}
else {
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
} }
else {
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
}
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.')); $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
@ -854,12 +861,23 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars['data'] = $data; $postvars['data'] = $data;
logger('rino: sent key = ' . $key); logger('rino: sent key = ' . $key);
if($dfrn_version >= 2.1) {
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
}
else {
openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
}
}
else {
if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']); openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
} }
else { else {
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']); openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
} }
}
logger('md5 rawkey ' . md5($postvars['key'])); logger('md5 rawkey ' . md5($postvars['key']));

View file

@ -35,7 +35,7 @@ function poller_run($argv, $argc){
q("DELETE FROM `cache` WHERE `updated`<'%s'", q("DELETE FROM `cache` WHERE `updated`<'%s'",
dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
$manual_id = 0;
$hub_update = false; $hub_update = false;
$force = false; $force = false;

View file

@ -52,8 +52,6 @@ function dfrn_notify_post(&$a) {
} }
$r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, $r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`,
`contact`.`pubkey` AS `cpubkey`, `contact`.`prvkey` AS `cprvkey`, `user`.* FROM `contact` `contact`.`pubkey` AS `cpubkey`, `contact`.`prvkey` AS `cprvkey`, `user`.* FROM `contact`
LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
@ -93,12 +91,22 @@ function dfrn_notify_post(&$a) {
logger('rino: md5 raw key: ' . md5($rawkey)); logger('rino: md5 raw key: ' . md5($rawkey));
$final_key = ''; $final_key = '';
if($dfrn_version >= 2.1) {
if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
}
else {
openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
}
}
else {
if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) { if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']); openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
} }
else { else {
openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']); openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
} }
}
logger('rino: received key : ' . $final_key); logger('rino: received key : ' . $final_key);
$data = aes_decrypt(hex2bin($data),$final_key); $data = aes_decrypt(hex2bin($data),$final_key);
@ -498,14 +506,14 @@ function dfrn_notify_content(&$a) {
$encrypted_id = ''; $encrypted_id = '';
$id_str = $my_id . '.' . mt_rand(1000,9999); $id_str = $my_id . '.' . mt_rand(1000,9999);
if((($r[0]['duplex']) && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) { if((($r[0]['duplex']) && strlen($r[0]['prvkey'])) || (! strlen($r[0]['pubkey']))) {
openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
}
else {
openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']); openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']); openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
} }
else {
openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
}
$challenge = bin2hex($challenge); $challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id); $encrypted_id = bin2hex($encrypted_id);

View file

@ -113,10 +113,16 @@ function follow_post(&$a) {
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' '))); $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
$email = $author->get_email(); $email = $author->get_email();
} }
if(! $vcard['photo']) {
$rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
if($rawmedia && $rawmedia[0]['attribs']['']['url'])
$vcard['photo'] = $rawmedia[0]['attribs']['']['url'];
}
} }
} }
if((! $vcard['photo']) && strlen($email)) if((! $vcard['photo']) && strlen($email))
$vcard['photo'] = gravatar_img($email); $vcard['photo'] = gravatar_img($email);
$network = 'feed'; $network = 'feed';
$priority = 2; $priority = 2;
} }

View file

@ -84,6 +84,7 @@ $a->strings['Delete contact'] = 'Delete contact';
$a->strings['Last updated: '] = 'Last updated: '; $a->strings['Last updated: '] = 'Last updated: ';
$a->strings['Update public posts: '] = 'Update public posts: '; $a->strings['Update public posts: '] = 'Update public posts: ';
$a->strings['Never'] = 'Never'; $a->strings['Never'] = 'Never';
$a->strings['Update now'] = 'Update now';
$a->strings['Unblock this contact'] = 'Unblock this contact'; $a->strings['Unblock this contact'] = 'Unblock this contact';
$a->strings['Block this contact'] = 'Block this contact'; $a->strings['Block this contact'] = 'Block this contact';
$a->strings['Unignore this contact'] = 'Unignore this contact'; $a->strings['Unignore this contact'] = 'Unignore this contact';
@ -219,6 +220,11 @@ $a->strings['Empty post discarded.'] = 'Empty post discarded.';
$a->strings['Wall Photos'] = 'Wall Photos'; $a->strings['Wall Photos'] = 'Wall Photos';
$a->strings[" commented on your item at "] = " commented on your item at "; $a->strings[" commented on your item at "] = " commented on your item at ";
$a->strings[" posted on your profile wall at "] = " posted on your profile wall at "; $a->strings[" posted on your profile wall at "] = " posted on your profile wall at ";
$a->strings['This message was sent to you by '] = 'This message was sent to you by ';
$a->strings[', a member of the Friendika social network.'] = ', a member of the Friendika social network.';
$a->strings['You may visit them online at'] = 'You may visit them online at';
$a->strings['Please contact the sender by replying to this post if you do not wish to receive these messages.'] = 'Please contact the sender by replying to this post if you do not wish to receive these messages.';
$a->strings['posted an update.'] = 'posted an update.';
$a->strings['photo'] = 'photo'; $a->strings['photo'] = 'photo';
$a->strings['status'] = 'status'; $a->strings['status'] = 'status';
$a->strings['likes'] = 'likes'; $a->strings['likes'] = 'likes';
@ -251,6 +257,8 @@ $a->strings['Delete message'] = 'Delete message';
$a->strings['Send Reply'] = 'Send Reply'; $a->strings['Send Reply'] = 'Send Reply';
$a->strings['Normal View'] = 'Normal View'; $a->strings['Normal View'] = 'Normal View';
$a->strings['New Item View'] = 'New Item View'; $a->strings['New Item View'] = 'New Item View';
$a->strings['CC: email addresses'] = 'CC: email addresses';
$a->strings['Example: bob@example.com, mary@example.com'] = 'Example: bob@example.com, mary@example.com';
$a->strings['No such group'] = 'No such group'; $a->strings['No such group'] = 'No such group';
$a->strings['Group is empty'] = 'Group is empty'; $a->strings['Group is empty'] = 'Group is empty';
$a->strings['Group: '] = 'Group: '; $a->strings['Group: '] = 'Group: ';
@ -411,6 +419,7 @@ $a->strings['Network'] = 'Network';
$a->strings['Notifications'] = 'Notifications'; $a->strings['Notifications'] = 'Notifications';
$a->strings['Settings'] = 'Settings'; $a->strings['Settings'] = 'Settings';
$a->strings['Profiles'] = 'Profiles'; $a->strings['Profiles'] = 'Profiles';
$a->strings['Embedding disabled'] = 'Embedding disabled';
$a->strings['Male'] = 'Male'; $a->strings['Male'] = 'Male';
$a->strings['Female'] = 'Female'; $a->strings['Female'] = 'Female';
$a->strings['Currently Male'] = 'Currently Male'; $a->strings['Currently Male'] = 'Currently Male';
@ -467,6 +476,9 @@ $a->strings['Ask me'] = 'Ask me';
$a->strings['Facebook status update failed.'] = 'Facebook status update failed.'; $a->strings['Facebook status update failed.'] = 'Facebook status update failed.';
$a->strings['Select files to upload: '] = 'Select files to upload: '; $a->strings['Select files to upload: '] = 'Select files to upload: ';
$a->strings['Use the following controls only if the Java uploader [above] fails to launch.'] = 'Use the following controls only if the Java uploader [above] fails to launch.'; $a->strings['Use the following controls only if the Java uploader [above] fails to launch.'] = 'Use the following controls only if the Java uploader [above] fails to launch.';
$a->strings['Upload a file'] = 'Upload a file';
$a->strings['Drop files here to upload'] = 'Drop files here to upload';
$a->strings['Failed'] = 'Failed';
$a->strings['No files were uploaded.'] = 'No files were uploaded.'; $a->strings['No files were uploaded.'] = 'No files were uploaded.';
$a->strings['Uploaded file is empty'] = 'Uploaded file is empty'; $a->strings['Uploaded file is empty'] = 'Uploaded file is empty';
$a->strings['Uploaded file is too large'] = 'Uploaded file is too large'; $a->strings['Uploaded file is too large'] = 'Uploaded file is too large';