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

This commit is contained in:
Tobias Diekershoff 2011-05-28 10:37:33 +02:00
commit 770d1bb7a3
19 changed files with 203 additions and 45 deletions

View File

@ -505,6 +505,21 @@ function facebook_post_hook(&$a,&$b) {
$msg = trim(strip_tags(bbcode($msg)));
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
// add any attachments as text urls
$arr = explode(',',$b['attach']);
if(count($arr)) {
$msg .= "\n";
foreach($arr as $r) {
$matches = false;
$cnt = preg_match('|\[attach\]href=\"(.+?)\" size=\"(.+?)\" type=\"(.+?)\" title=\"(.+?)\"\[\/attach\]|',$r,$matches);
if($cnt) {
$msg .= $matches[1];
}
}
}
if (strlen($msg) > FACEBOOK_MAXPOSTLEN) {
$shortlink = "";
require_once('library/slinky.php');
@ -718,11 +733,17 @@ function fb_consume_stream($uid,$j,$wall = false) {
if(! $orig_post)
continue;
$r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s' AND `author-link` = '%s' LIMIT 1",
// If we posted the like locally, it will be found with our url, not the FB url.
$second_url = (($likes->id == $self_id) ? $self[0]['url'] : 'http://facebook.com/profile.php?id=' . $likes->id);
$r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s'
AND ( `author-link` = '%s' OR `author-link` = '%s' ) LIMIT 1",
dbesc($orig_post['uri']),
intval($uid),
dbesc(ACTIVITY_LIKE),
dbesc('http://facebook.com/profile.php?id=' . $likes->id)
dbesc('http://facebook.com/profile.php?id=' . $likes->id),
dbesc($second_url)
);
if(count($r))

View File

@ -207,7 +207,7 @@ function statusnet_settings(&$a,&$s) {
*/
if (! $globalsn == null) {
$s .= '<h4>' . t('Globally Available StatusNet OAuthKeys') . '</h4>';
$s .= '<p>'. t('There are preconfigured OAuth key pairs for some StatusNet servers available. If you are useing one of them, please use these credentials. If not feel free to connect to any other StatusNet instance (see below).') .'</p>';
$s .= '<p>'. t("There are preconfigured OAuth key pairs for some StatusNet servers available. If you are useing one of them, please use these credentials. If not feel free to connect to any other StatusNet instance \x28see below\x29.") .'</p>';
$s .= '<div id="statusnet-preconf-wrapper">';
foreach ($globalsn as $asn) {
$s .= '<input type="radio" name="statusnet-preconf-apiurl" value="'. $asn['apiurl'] .'">'. $asn['sitename'] .'<br />';

View File

@ -4,9 +4,9 @@ set_time_limit(0);
ini_set('pcre.backtrack_limit', 250000);
define ( 'FRIENDIKA_VERSION', '2.2.991' );
define ( 'FRIENDIKA_VERSION', '2.2.993' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1058 );
define ( 'DB_UPDATE_VERSION', 1059 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -682,7 +682,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
$s = substr($s,strlen($header)+4);
$header = substr($s,0,strpos($s,"\r\n\r\n"));
}
if($http_code == 301 || $http_code == 302 || $http_code == 303) {
if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
$matches = array();
preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
$url = trim(array_pop($matches));
@ -2106,10 +2106,10 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
if(! function_exists('search')) {
function search($s) {
function search($s,$id='search-box',$url='/search') {
$a = get_app();
$o = '<div id="search-box">';
$o .= '<form action="' . $a->get_baseurl() . '/search' . '" method="get" >';
$o = '<div id="' . $id . '">';
$o .= '<form action="' . $a->get_baseurl() . $url . '" method="get" >';
$o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />';
$o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />';
$o .= '</form></div>';
@ -2196,12 +2196,13 @@ function smilies($s) {
$a = get_app();
return str_replace(
array( '&lt;3', '&lt;/3', '&lt;\\3', ':-)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
array( '&lt;3', '&lt;/3', '&lt;\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
array(
'<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />',
@ -2547,8 +2548,8 @@ function prepare_body($item,$attach = false) {
return $s;
$arr = explode(',',$item['attach']);
$s .= '<div class="body-attach">';
if(count($arr)) {
$s .= '<div class="body-attach">';
foreach($arr as $r) {
$matches = false;
$icon = '';
@ -2572,8 +2573,8 @@ function prepare_body($item,$attach = false) {
$s .= '<a href="' . strip_tags($matches[1]) . '" title="' . $title . '" class="attachlink" target="external-link" >' . $icon . '</a>';
}
}
$s .= '<div class="clear"></div></div>';
}
$s .= '<div class="clear"></div></div>';
return $s;
}}

View File

@ -186,6 +186,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`target` text NOT NULL,
`plink` char(255) NOT NULL,
`resource-id` char(255) NOT NULL,
`event-id` int(10) unsigned NOT NULL,
`tag` mediumtext NOT NULL,
`attach` mediumtext NOT NULL,
`inform` mediumtext NOT NULL,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

View File

@ -446,9 +446,16 @@ function probe_url($url) {
$feed = new SimplePie();
$xml = fetch_url($poll);
logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
$a = get_app();
logger('probe_url: scrape_feed: headers: ' . $a->get_curl_headers(), $LOGGER_DATA);
$feed->set_raw_data($xml);
$feed->init();
if($feed->error())
logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
if(! x($vcard,'photo'))
$vcard['photo'] = $feed->get_image_url();

View File

@ -12,20 +12,27 @@ function email_connect($mailbox,$username,$password) {
function email_poll($mbox,$email_addr) {
if(! ($mbox && $email_addr))
return array();;
return array();
$search = imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID);
$search1 = imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID);
if(! $search1)
$search1 = array();
$search2 = imap_search($mbox,'TO "' . $email_addr . '"', SE_UID);
if(! $search2)
$search2 = array();
if($search && $search2)
$res = array_merge($search,$search2);
elseif($search)
$res = $search;
else
$res = $search2;
$search3 = imap_search($mbox,'CC "' . $email_addr . '"', SE_UID);
if(! $search3)
$search3 = array();
return (($res) ? $res : array());
$search4 = imap_search($mbox,'BCC "' . $email_addr . '"', SE_UID);
if(! $search4)
$search4 = array();
$res = array_unique(array_merge($search1,$search2,$search3,$search4));
return $res;
}

34
include/event.php Normal file
View File

@ -0,0 +1,34 @@
<?php
function format_event_html($ev) {
if(! ((is_array($ev)) && count($ev)))
return '';
$o = '<div class="vevent">';
$o .= '<p class="description">' . $ev['desc'] . '</p>';
$o .= '<p>' . t('Starts: ') . '<abbr class="dtstart" title="'
. datetime_convert('UTC','UTC',$ev['start'], ATOM_TIME)
. '" >'
. datetime_convert('UTC', date_default_timezone_get(),
$ev['start'] /*, format */ )
. '</abbr></p>';
$o .= '<p>' . t('Ends: ') . '<abbr class="dtend" title="'
. datetime_convert('UTC','UTC',$ev['finish'], ATOM_TIME)
. '" >'
. datetime_convert('UTC', date_default_timezone_get(),
$ev['finish'] /*, format */ )
. '</abbr></p>';
$o .= '<p> ' . t('Location:') . '<span class="location">'
. $ev['location']
. '</span></p>';
$o .= '</div>';
return $o;
}

View File

@ -420,7 +420,7 @@ function dfrn_notify_post(&$a) {
'$url' => $datarray['author-link'], // full url for the site
'$from' => $from, // name of the person sending the message
'$body' => $msg['htmlversion'], // html version of the message
'$display' => $a->get_baseurl() . '/display/' . $importer['nick'] . '/' . $posted_id,
'$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
));
// load the template for private message notifications
@ -433,7 +433,7 @@ function dfrn_notify_post(&$a) {
'$url' => $datarray['author-link'], // full url for the site
'$from' => $from, // name of the person sending the message
'$body' => $msg['textversion'], // text version of the message
'$display' => $a->get_baseurl() . '/display/' . $importer['nick'] . '/' . $posted_id,
'$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
));
// use the EmailNotification library to send the message

View File

@ -204,13 +204,25 @@ function item_post(&$a) {
continue;
$image_uri = substr($image,strrpos($image,'/') + 1);
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
$srch = '<' . intval($profile_uid) . '>';
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
AND `resource-id` = '%s' AND `uid` = %d LIMIT 1",
dbesc($srch),
dbesc($image_uri),
intval($profile_uid)
);
if(! count($r))
continue;
$r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `resource-id` = '%s' AND `album` = '%s' ",
WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ",
dbesc($str_contact_allow),
dbesc($str_group_allow),
dbesc($str_contact_deny),
dbesc($str_group_deny),
dbesc($image_uri),
intval($profile_uid),
dbesc( t('Wall Photos'))
);

View File

@ -12,10 +12,18 @@ function network_init(&$a) {
if(! x($a->page,'aside'))
$a->page['aside'] = '';
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
$srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '');
$a->page['aside'] .= search($search,'netsearch-box',$srchurl);
$a->page['aside'] .= '<div id="network-new-link">';
if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new'))
$a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>';
if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new') || x($_GET,'search'))
$a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>';
else
$a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . $a->cmd . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('New Item View') . '</a>';
@ -55,6 +63,8 @@ function network_content(&$a, $update = 0) {
}
}
if(x($_GET,'search'))
$nouveau = true;
if($cid)
$def_acl = array('allow_cid' => '<' . intval($cid) . '>');
@ -96,7 +106,8 @@ function network_content(&$a, $update = 0) {
$o .= '<div id="live-network"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . $_SESSION['uid']
. "; var netargs = '" . substr($a->cmd,8)
. ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '')
. ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
. ((x($_GET,'search')) ? '?search=' . $_GET['search'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
}
@ -169,6 +180,10 @@ function network_content(&$a, $update = 0) {
$sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` ");
if(x($_GET,'search'))
$sql_extra .= " AND `item`.`body` REGEXP '" . dbesc(escape_tags($_GET['search'])) . "' ";
$r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0

View File

@ -722,6 +722,8 @@ function photos_content(&$a) {
$owner_uid = $a->data['user']['uid'];
$community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
if((local_user()) && (local_user() == $owner_uid))
@ -763,6 +765,15 @@ function photos_content(&$a) {
}
}
$r = q("SELECT `hidewall` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($owner_uid)
);
if(count($r) && $r[0]['hidewall'] && (local_user() != $owner_uid) && (! $remote_contact)) {
notice( t('Access to this item is restricted.') . EOL);
return;
}
// default permissions - anonymous user
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";

View File

@ -55,11 +55,6 @@ function profile_content(&$a, $update = 0) {
return login();
}
if($a->profile['hidewall'] && (! local_user()) && (! remote_user())) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
@ -102,6 +97,12 @@ function profile_content(&$a, $update = 0) {
}
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
notice( t('Access to this profile has been restricted.') . EOL);
return;
}
if(! $update) {
if(x($_GET,'tab'))

24
mod/webfinger.php Normal file
View File

@ -0,0 +1,24 @@
<?php
function webfinger_content(&$a) {
$o .= '<h3>Webfinger Diagnostic</h3>';
$o .= '<form action="webfinger" method="get">';
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />';
if(x($_GET,'addr')) {
$addr = $_GET['addr'];
if(strpos($addr,'@' !== false))
$res = webfinger($addr);
else
$res = lrdd($addr);
$o .= str_replace("\n",'<br />',print_r($res,true));
}
return $o;
}

View File

@ -495,3 +495,7 @@ function update_1056() {
function update_1057() {
q("ALTER TABLE `attach` ADD `filename` CHAR( 255 ) NOT NULL AFTER `hash` ");
}
function update_1058() {
q("ALTER TABLE `item` ADD `event-id` INT NOT NULL AFTER `resource-id` ");
}

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2.2.991\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-05-25 17:11-0700\n"
"POT-Creation-Date: 2011-05-26 06:46-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1725,12 +1725,12 @@ msgstr ""
msgid "Register"
msgstr ""
#: ../../mod/like.php:110 ../../addon/facebook/facebook.php:759
#: ../../mod/like.php:110 ../../addon/facebook/facebook.php:774
#: ../../include/conversation.php:20
msgid "status"
msgstr ""
#: ../../mod/like.php:127 ../../addon/facebook/facebook.php:763
#: ../../mod/like.php:127 ../../addon/facebook/facebook.php:778
#: ../../include/conversation.php:25
#, php-format
msgid "%1$s likes %2$s's %3$s"
@ -1822,8 +1822,15 @@ msgstr ""
msgid "Administrator@"
msgstr ""
#: ../../mod/item.php:562 ../../mod/item.php:626 ../../mod/dfrn_notify.php:573
msgid " commented on an item at "
#: ../../mod/item.php:562 ../../mod/dfrn_notify.php:446
#: ../../mod/dfrn_notify.php:573
#, php-format
msgid "%s commented on an item at %s"
msgstr ""
#: ../../mod/item.php:626
#, php-format
msgid "%s posted to your profile wall at %s"
msgstr ""
#: ../../mod/item.php:655
@ -2084,11 +2091,6 @@ msgstr ""
msgid "New mail received at "
msgstr ""
#: ../../mod/dfrn_notify.php:446
#, php-format
msgid "%s commented on an item at %s"
msgstr ""
#: ../../mod/apps.php:6
msgid "Applications"
msgstr ""
@ -2508,7 +2510,7 @@ msgstr ""
msgid "Image: "
msgstr ""
#: ../../addon/facebook/facebook.php:561
#: ../../addon/facebook/facebook.php:576
msgid "View on Friendika"
msgstr ""

View File

@ -158,7 +158,6 @@ $a->strings["Connection accepted at %s"] = "Connection accepted at %s";
$a->strings['Administrator'] = 'Administrator';
$a->strings['noreply'] = 'noreply';
$a->strings['%s commented on an item at %s'] = '%s commented on an item at %s';
$a->strings[" commented on an item at "] = " commented on an item at ";
$a->strings["This introduction has already been accepted."] = "This introduction has already been accepted.";
$a->strings['Profile location is not valid or does not contain profile information.'] = 'Profile location is not valid or does not contain profile information.';
$a->strings['Warning: profile location has no identifiable owner name.'] = 'Warning: profile location has no identifiable owner name.';
@ -314,6 +313,7 @@ $a->strings["%d message sent."] = array(
$a->strings['Unable to locate original post.'] = 'Unable to locate original post.';
$a->strings['Empty post discarded.'] = 'Empty post discarded.';
$a->strings['Wall Photos'] = 'Wall Photos';
$a->strings['%s posted to your profile wall at %s'] = '%s posted to your profile wall at %s';
$a->strings['System error. Post not saved.'] = 'System error. Post not saved.';
$a->strings['This message was sent to you by %s, a member of the Friendika social network.'] = 'This message was sent to you by %s, a member of the Friendika social network.';
$a->strings['You may visit them online at %s'] = 'You may visit them online at %s';
@ -787,7 +787,7 @@ $a->strings['We could not contact the StatusNet API with the Path you entered.']
$a->strings['StatusNet settings updated.'] = 'StatusNet settings updated.';
$a->strings['StatusNet Posting Settings'] = 'StatusNet Posting Settings';
$a->strings['Globally Available StatusNet OAuthKeys'] = 'Globally Available StatusNet OAuthKeys';
$a->strings['There are preconfigured OAuth key pairs for some StatusNet servers available. If you are useing one of them, please use these credentials. If not feel free to connect to any other StatusNet instance (see below] = 'There are preconfigured OAuth key pairs for some StatusNet servers available. If you are useing one of them, please use these credentials. If not feel free to connect to any other StatusNet instance (see below;
$a->strings["There are preconfigured OAuth key pairs for some StatusNet servers available. If you are useing one of them, please use these credentials. If not feel free to connect to any other StatusNet instance \x28see below\x29."] = "There are preconfigured OAuth key pairs for some StatusNet servers available. If you are useing one of them, please use these credentials. If not feel free to connect to any other StatusNet instance \x28see below\x29.";
$a->strings['Provide your own OAuth Credentials'] = 'Provide your own OAuth Credentials';
$a->strings['No consumer key pair for StatusNet found. Register your Friendika Account as an desktop client on your StatusNet account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendika installation at your favorited StatusNet installation.'] = 'No consumer key pair for StatusNet found. Register your Friendika Account as an desktop client on your StatusNet account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendika installation at your favorited StatusNet installation.';
$a->strings['OAuth Consumer Key'] = 'OAuth Consumer Key';

View File

@ -2394,6 +2394,16 @@ a.mail-list-link {
margin: 0px 3px 0px 3px;
}
#netsearch-box {
margin-top: 20px;
}
#netsearch-box #search-submit {
margin: 5px 0px 0px 0px;
}
/**
* ICONS
*/

View File

@ -2411,6 +2411,14 @@ a.mail-list-link {
width: 300px;
}
#netsearch-box {
margin-top: 20px;
}
#netsearch-box #search-submit {
margin: 5px 0px 0px 0px;
}
/**
* ICONS
*/