Merge remote-tracking branch 'friendika/master' into newui

This commit is contained in:
Fabio Comuni 2011-08-30 11:00:23 +02:00
commit d0926240a8
45 changed files with 4569 additions and 960 deletions

View file

@ -15,20 +15,32 @@ hosting provider prior to installation.
Before you begin: Choose a domain name or subdomain name for your server.
Put some thought into this - because changing it is currently not-supported.
Things will break, and some of your friends may have difficulty communicating
with you. We plan to address this limitation in a future release.
with you. We plan to address this limitation in a future release. Also decide
if you wish to connect with members of the Diaspora network, as this will
impact the installation requirements.
Decide if you will use SSL and obtain an SSL cert. Communications with the
Diaspora network MAY require both SSL AND an SSL cert signed by a CA which is
recognised by the major browsers. Friendika will work with self-signed certs
but Diaspora communication may not. For best results, install your cert PRIOR
to installing Friendika and when visiting your site for the initial
installation in step 5, please use the https: link. (Use the http: or non-SSL
link if your cert is self-signed).
1. Requirements
- Apache with mod-rewrite enabled and "Options All" so you can use a
local .htaccess file
- PHP 5.2+. The later the better. You'll need 5.3 for encryption of key
exchange conversations
- PHP 5.2+. The later the better. PHP 5.3 is required for communications
with the Diaspora network and improved security.
- PHP *command line* access with register_argc_argv set to true in the
php.ini file
- curl, gd, mysql, mbstring, and openssl extensions
php.ini file [or see 'poormancron' in section 8]
- curl, gd, mysql, mbstring, mcrypt, and openssl extensions
- some form of email server or email gateway such that PHP mail() works
- mcrypt (optional; used for end-to-end message encryption)
- Mysql 5.x
@ -36,12 +48,8 @@ php.ini file
(Windows) [Note: other options are presented in Section 8 of this document]
- Installation into a top-level domain or sub-domain (without a
directory/path component in the URL) is preferred. Directory paths will
not be as convenient to use and have not been thoroughly tested.
[Dreamhost.com offers all of the necessary hosting features at a
reasonable price. If your hosting provider doesn't allow Unix shell access,
you might have trouble getting everything to work.]
directory/path component in the URL) is preferred. This is REQUIRED if
you wish to communicate with the Diaspora network.
2. Unpack the Friendika files into the root of your web server document area.
@ -58,7 +66,9 @@ write or create files in your web directory, create an empty file called
.htconfig.php and make it writable by the web server.
5. Visit your website with a web browser and follow the instructions. Please
note any error messages and correct these before continuing.
note any error messages and correct these before continuing. If you are using
SSL with a known signature authority (recommended), use the https: link to your
website. If you are using a self-signed cert or no cert, use the http: link.
6. *If* the automated installation fails for any reason, check the following:
@ -99,7 +109,9 @@ have troubles with this section please contact your hosting provider for
assistance. Friendika will not work correctly if you cannot perform this step.
Alternative: You may be able to use the 'poormancron' plugin to perform this
step if you are using a recent Friendika release. To do this, edit the file
step if you are using a recent Friendika release. 'poormancron' may result in
perfomance and memory issues and is only suitable for small sites with one or
two users and a handful of contacts. To do this, edit the file
".htconfig.php" and look for a line describing your plugins. On a fresh
installation, it will look like
@ -114,7 +126,7 @@ $a->config['system']['addon'] = 'js_upload,poormancron';
and save your changes.
#####################################################################
If things don't work...

View file

@ -151,6 +151,8 @@ function fb_get_friends($uid) {
logger('facebook: fb_get_friends: ' . $s, LOGGER_DATA);
$j = json_decode($s);
logger('facebook: fb_get_friends: json: ' . print_r($j,true), LOGGER_DATA);
if(! $j->data)
return;
foreach($j->data as $person) {
$s = fetch_url('https://graph.facebook.com/' . $person->id . '?access_token=' . $access_token);
if($s) {

View file

@ -8,9 +8,9 @@ require_once("include/pgettext.php");
require_once('include/nav.php');
define ( 'FRIENDIKA_VERSION', '2.2.1079' );
define ( 'FRIENDIKA_VERSION', '2.2.1087' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1081 );
define ( 'DB_UPDATE_VERSION', 1084 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -38,7 +38,7 @@ CREATE TABLE IF NOT EXISTS `config` (
`k` char(255) NOT NULL,
`v` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -267,6 +267,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
`contact-id` int(10) unsigned NOT NULL,
`guid` char(64) NOT NULL,
`resource-id` char(255) NOT NULL,
`created` datetime NOT NULL,
`edited` datetime NOT NULL,
@ -288,7 +289,8 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `resource-id` (`resource-id`),
KEY `album` (`album`),
KEY `scale` (`scale`),
KEY `profile` (`profile`)
KEY `profile` (`profile`),
KEY `guid` (`guid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
@ -426,7 +428,7 @@ CREATE TABLE IF NOT EXISTS `register` (
`password` CHAR(255) NOT NULL,
`language` CHAR(16) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `clients` (
@ -434,7 +436,7 @@ CREATE TABLE IF NOT EXISTS `clients` (
`pw` VARCHAR( 20 ) NOT NULL ,
`redirect_uri` VARCHAR( 200 ) NOT NULL ,
PRIMARY KEY ( `client_id` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tokens` (
`id` VARCHAR( 40 ) NOT NULL ,
@ -442,7 +444,7 @@ CREATE TABLE IF NOT EXISTS `tokens` (
`expires` INT NOT NULL ,
`scope` VARCHAR( 200 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `auth_codes` (
`id` VARCHAR( 40 ) NOT NULL ,
@ -451,7 +453,7 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
`expires` INT NOT NULL ,
`scope` VARCHAR( 250 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `queue` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
@ -460,7 +462,7 @@ CREATE TABLE IF NOT EXISTS `queue` (
`created` DATETIME NOT NULL ,
`last` DATETIME NOT NULL ,
`content` MEDIUMTEXT NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `pconfig` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
@ -468,7 +470,7 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
`cat` CHAR( 255 ) NOT NULL ,
`k` CHAR( 255 ) NOT NULL ,
`v` MEDIUMTEXT NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `hook` (
@ -476,7 +478,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`hook` CHAR( 255 ) NOT NULL ,
`file` CHAR( 255 ) NOT NULL ,
`function` CHAR( 255 ) NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `addon` (
@ -486,7 +488,7 @@ CREATE TABLE IF NOT EXISTS `addon` (
`installed` TINYINT( 1 ) NOT NULL DEFAULT '0' ,
`timestamp` BIGINT NOT NULL DEFAULT '0' ,
`plugin_admin` TINYINT( 1 ) NOT NULL DEFAULT '0'
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `event` (
@ -507,13 +509,13 @@ CREATE TABLE IF NOT EXISTS `event` (
`allow_gid` MEDIUMTEXT NOT NULL ,
`deny_cid` MEDIUMTEXT NOT NULL ,
`deny_gid` MEDIUMTEXT NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `cache` (
`k` CHAR( 255 ) NOT NULL PRIMARY KEY ,
`v` TEXT NOT NULL,
`updated` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fcontact` (
@ -534,14 +536,14 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
INDEX ( `addr` ),
INDEX ( `network` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ffinder` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT UNSIGNED NOT NULL ,
`cid` INT UNSIGNED NOT NULL ,
`fid` INT UNSIGNED NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `fsuggest` (
@ -554,7 +556,7 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
`photo` CHAR( 255 ) NOT NULL ,
`note` TEXT NOT NULL ,
`created` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `mailacct` (
@ -569,7 +571,7 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
`reply_to` CHAR( 255 ) NOT NULL ,
`pubmail` TINYINT(1) NOT NULL DEFAULT '0',
`last_check` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `attach` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
@ -585,13 +587,13 @@ CREATE TABLE IF NOT EXISTS `attach` (
`allow_gid` MEDIUMTEXT NOT NULL ,
`deny_cid` MEDIUMTEXT NOT NULL ,
`deny_gid` MEDIUMTEXT NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `guid` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`guid` CHAR( 64 ) NOT NULL ,
INDEX ( `guid` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `sign` (
@ -601,6 +603,12 @@ CREATE TABLE IF NOT EXISTS `sign` (
`signature` TEXT NOT NULL ,
`signer` CHAR( 255 ) NOT NULL ,
INDEX ( `iid` )
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `deliverq` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`cmd` CHAR( 32 ) NOT NULL ,
`item` INT NOT NULL ,
`contact` INT NOT NULL
) ENGINE = MyISAM DEFAULT CHARSET=utf8;

View file

@ -85,3 +85,55 @@ function unmark_for_death($contact) {
);
}}
if(! function_exists('contact_photo_menu')){
function contact_photo_menu($contact) {
$a = get_app();
$contact_url="";
$pm_url="";
$status_link="";
$photos_link="";
$posts_link="";
$sparkle = false;
if($contact['network'] === NETWORK_DFRN) {
$sparkle = true;
$profile_link = $a->get_baseurl() . '/redir/' . $contact['id'];
}
else
$profile_link = $contact['url'];
if($profile_link === 'mailbox')
$profile_link = '';
if($sparkle) {
$status_link = $profile_link . "?url=status";
$photos_link = $profile_link . "?url=photos";
$profile_link = $profile_link . "?url=profile";
$pm_url = $a->get_baseurl() . '/message/new/' . $contact['id'];
}
$contact_url = $a->get_baseurl() . '/contacts/' . $contact['id'];
$posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id'];
$menu = Array(
t("View status") => $status_link,
t("View profile") => $profile_link,
t("View photos") => $photos_link,
t("View recent") => $posts_link,
t("Edit contact") => $contact_url,
t("Send PM") => $pm_url,
);
$args = array('contact' => $contact, 'menu' => $menu);
call_hooks('contact_photo_menu', $args);
$o = "";
foreach($menu as $k=>$v){
if ($v!="") $o .= "<li><a href='$v'>$k</a></li>\n";
}
return $o;
}}

View file

@ -185,11 +185,20 @@ class Photo {
public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') {
$r = q("select `guid` from photo where `resource-id` = '%s' and `guid` != '' limit 1",
dbesc($rid)
);
if(count($r))
$guid = $r[0]['guid'];
else
$guid = get_guid();
$r = q("INSERT INTO `photo`
( `uid`, `contact-id`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, '%s', '%s', '%s', '%s' )",
intval($uid),
intval($cid),
dbesc($guid),
dbesc($rid),
dbesc(datetime_convert()),
dbesc(datetime_convert()),

View file

@ -170,7 +170,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$sql_extra .= " AND `network` IN ( 'dfrn' ) ";
}
elseif($privatenet) {
$sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face' ) ";
$sql_extra .= " AND `network` IN ( 'dfrn', 'mail', 'face', 'dspr' ) ";
}

View file

@ -1,6 +1,7 @@
<?php
require_once("bbcode.php");
require_once("datetime.php");
require_once("conversation.php");
/*
* Twitter-Like API
@ -8,7 +9,7 @@
*/
$API = Array();
$called_api = Null;
function api_date($str){
//Wed May 23 06:01:13 +0000 2007
@ -103,9 +104,10 @@
* MAIN API ENTRY POINT *
**************************/
function api_call(&$a){
GLOBAL $API;
GLOBAL $API, $called_api;
foreach ($API as $p=>$info){
if (strpos($a->query_string, $p)===0){
$called_api= explode("/",$p);
#unset($_SERVER['PHP_AUTH_USER']);
if ($info['auth']===true && local_user()===false) {
api_login($a);
@ -131,7 +133,7 @@
return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
break;
case "json":
header ("Content-Type: application/json");
//header ("Content-Type: application/json");
foreach($r as $rr)
return json_encode($rr);
break;
@ -193,6 +195,7 @@
* Returns user info array.
*/
function api_get_user(&$a, $contact_id = Null){
global $called_api;
$user = null;
$extra_query = "";
@ -209,16 +212,20 @@
if(is_null($user) && x($_GET, 'screen_name')) {
$user = dbesc($_GET['screen_name']);
$extra_query = "AND `contact`.`nick` = '%s' ";
if (local_user()!==false) $extra_query .= "AND `contact`.`uid`=".intval(local_user());
}
if (is_null($user) && $a->argc > 3){
list($user, $null) = explode(".",$a->argv[3]);
if (is_null($user) && $a->argc > (count($called_api)-1)){
$argid = count($called_api);
list($user, $null) = explode(".",$a->argv[$argid]);
if(is_numeric($user)){
$user = intval($user);
$extra_query = "AND `contact`.`id` = %d ";
} else {
$user = dbesc($user);
$extra_query = "AND `contact`.`nick` = '%s' ";
if (local_user()!==false) $extra_query .= "AND `contact`.`uid`=".intval(local_user());
}
}
@ -301,6 +308,7 @@
}
$ret = Array(
'self' => intval($uinfo[0]['self']),
'uid' => intval($uinfo[0]['uid']),
'id' => intval($uinfo[0]['cid']),
'name' => $uinfo[0]['name'],
@ -321,7 +329,7 @@
'followers_count' => intval($countfollowers),
'favourites_count' => intval($starred),
'contributors_enabled' => false,
'follow_request_sent' => false,
'follow_request_sent' => true,
'profile_background_color' => 'cfe8f6',
'profile_text_color' => '000000',
'profile_link_color' => 'FF8500',
@ -616,6 +624,7 @@
$user_info = api_get_user($a);
// get last newtork messages
// params
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
@ -664,6 +673,12 @@
$user_info = api_get_user($a);
// get last newtork messages
logger("api_statuses_user_timeline: local_user: ". local_user() .
"\nuser_info: ".print_r($user_info, true) .
"\n_REQUEST: ".print_r($_REQUEST, true),
LOGGER_DEBUG);
// params
$count = (x($_REQUEST,'count')?$_REQUEST['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
@ -672,6 +687,7 @@
$start = $page*$count;
if ($user_info['self']==1) $sql_extra = "AND `item`.`wall` = 1 ";
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@ -679,14 +695,15 @@
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
AND `item`.`contact-id` = %d
AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`wall` = 1
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
AND `item`.`id`>%d
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
intval($user_info['uid']),
intval(local_user()),
intval($user_info['id']),
intval($since_id),
intval($start), intval($count)
);
@ -711,33 +728,41 @@
if (local_user()===false) return false;
$user_info = api_get_user($a);
// get last newtork messages
// in friendika starred item are private
// return favorites only for self
logger('api_favorites: self:' . $user_info['self']);
// params
$count = (x($_GET,'count')?$_GET['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0;
if ($user_info['self']==0) {
$ret = array();
} else {
// params
$count = (x($_GET,'count')?$_GET['count']:20);
$page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0);
if ($page<0) $page=0;
$start = $page*$count;
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`starred` = 1
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
intval($user_info['uid']),
intval($start), intval($count)
);
$ret = api_format_items($r,$user_info);
$start = $page*$count;
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
FROM `item`, `contact`
WHERE `item`.`uid` = %d
AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `item`.`starred` = 1
AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra
ORDER BY `item`.`received` DESC LIMIT %d ,%d ",
intval($user_info['uid']),
intval($start), intval($count)
);
$ret = api_format_items($r,$user_info);
}
$data = array('$statuses' => $ret);
switch($type){
@ -762,6 +787,7 @@
$ret = Array();
foreach($r as $item) {
localize_item($item);
$status_user = (($item['cid']==$user_info['id'])?$user_info: api_item_get_user($a,$item));
$status = array(
'created_at'=> api_date($item['created']),
@ -819,15 +845,21 @@
if (local_user()===false) return false;
$user_info = api_get_user($a);
// friends and followers only for self
if ($user_info['self']==0){
return false;
}
if (x($_GET,'cursor') && $_GET['cursor']=='undefined'){
/* this is to stop Hotot to load friends multiple times
* I'm not sure if I'm missing return something or
* is a bug in hotot. Workaround, meantime
*/
$ret=Array();
$data = array('$users' => $ret);
return api_apply_template("friends", $type, $data);
/*$ret=Array();
return array('$users' => $ret);*/
return false;
}
if($qtype == 'friends')
@ -845,15 +877,18 @@
}
$data = array('$users' => $ret);
return api_apply_template("friends", $type, $data);
return array('$users' => $ret);
}
function api_statuses_friends(&$a, $type){
return api_statuses_f($a,$type,"friends");
$data = api_statuses_f($a,$type,"friends");
if ($data===false) return false;
return api_apply_template("friends", $type, $data);
}
function api_statuses_followers(&$a, $type){
return api_statuses_f($a,$type,"followers");
$data = api_statuses_f($a,$type,"followers");
if ($data===false) return false;
return api_apply_template("friends", $type, $data);
}
api_register_func('api/statuses/friends','api_statuses_friends',true);
api_register_func('api/statuses/followers','api_statuses_followers',true);

View file

@ -48,7 +48,8 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
goaway(z_root());
}
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE `uid` = %d LIMIT 1",
intval($_SESSION['uid'])
);
@ -183,7 +184,8 @@ else {
// process normal login request
$r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' )
AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
dbesc(trim($_POST['openid_url'])),
dbesc(trim($_POST['openid_url'])),

178
include/bb2diaspora.php Normal file
View file

@ -0,0 +1,178 @@
<?php
require_once("include/oembed.php");
require_once('include/event.php');
function diaspora2bb($s) {
$s = str_replace(array('\\**','\\__','\\*','\\_'), array('-^doublestar^-','-^doublescore-^','-^star^-','-^score^-'),$s);
$s = preg_replace("/\*\*\*(.+?)\*\*\*/", '[b][i]$1[/i][/b]', $s);
$s = preg_replace("/\_\_\_(.+?)\_\_\_/", '[b][i]$1[/i][/b]', $s);
$s = preg_replace("/\*\*(.+?)\*\*/", '[b]$1[/b]', $s);
$s = preg_replace("/\_\_(.+?)\_\_/", '[b]$1[/b]', $s);
$s = preg_replace("/\*(.+?)\*/", '[i]$1[/i]', $s);
$s = preg_replace("/\_(.+?)\_/", '[i]$1[/i]', $s);
$s = str_replace(array('-^doublestar^-','-^doublescore-^','-^star^-','-^score^-'), array('**','__','*','_'), $s);
$s = preg_replace('/\[(.+?)\]\((.+?)\)/','[url=$2]$1[/url]',$s);
$s = escape_tags($s);
return $s;
}
function stripdcode_br_cb($s) {
return '[code]' . str_replace('<br />', '', $s[1]) . '[/code]';
}
// BBcode 2 HTML was written by WAY2WEB.net
// extended to work with Mistpark/Friendika - Mike Macgirvin
function bb2diaspora($Text,$preserve_nl = false) {
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
$Text = str_replace("<", "&lt;", $Text);
$Text = str_replace(">", "&gt;", $Text);
if($preserve_nl)
$Text = str_replace(array("\n","\r"), array('',''),$Text);
// Set up the parameters for a URL search string
$URLSearchString = "^\[\]";
// Set up the parameters for a MAIL search string
$MAILSearchString = $URLSearchString;
// Perform URL Search
// [img]pathtoimage[/img]
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '[$1]($1)', $Text);
$Text = preg_replace("(\[url\=([$URLSearchString]*)\](.*?)\[/url\])", '[$2]($1)', $Text);
// $Text = preg_replace("/\[img\](.*?)\[\/img\]/", t('Image/photo: ') . '$1', $Text);
// $Text = preg_replace("/\[img\](.*?)\[\/img\]/", t('image/photo'), $Text);
// Perform MAIL Search
$Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '[$1](mailto:$1)', $Text);
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '[$2](mailto:$1)', $Text);
$Text = str_replace('*', '\\*', $Text);
$Text = str_replace('_', '\\_', $Text);
$Text = str_replace('`','\\`', $Text);
// Check for bold text
$Text = preg_replace("(\[b\](.*?)\[\/b\])is",'**$1**',$Text);
// Check for Italics text
$Text = preg_replace("(\[i\](.*?)\[\/i\])is",'_$1_',$Text);
// Check for Underline text
// $Text = preg_replace("(\[u\](.*?)\[\/u\])is",'<u>$1</u>',$Text);
// Check for strike-through text
// $Text = preg_replace("(\[s\](.*?)\[\/s\])is",'<strike>$1</strike>',$Text);
// Check for over-line text
// $Text = preg_replace("(\[o\](.*?)\[\/o\])is",'<span class="overline">$1</span>',$Text);
// Check for colored text
// $Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])is","<span style=\"color: $1;\">$2</span>",$Text);
// Check for sized text
// $Text = preg_replace("(\[size=(.*?)\](.*?)\[\/size\])is","<span style=\"font-size: $1;\">$2</span>",$Text);
// Check for list text
// $Text = preg_replace("/\[list\](.*?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text);
// $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/is", '<ul class="listdecimal">$1</ul>' ,$Text);
// $Text = preg_replace("/\[list=i\](.*?)\[\/list\]/s",'<ul class="listlowerroman">$1</ul>' ,$Text);
// $Text = preg_replace("/\[list=I\](.*?)\[\/list\]/s", '<ul class="listupperroman">$1</ul>' ,$Text);
// $Text = preg_replace("/\[list=a\](.*?)\[\/list\]/s", '<ul class="listloweralpha">$1</ul>' ,$Text);
// $Text = preg_replace("/\[list=A\](.*?)\[\/list\]/s", '<ul class="listupperalpha">$1</ul>' ,$Text);
// $Text = preg_replace("/\[li\](.*?)\[\/li\]/s", '<li>$1</li>' ,$Text);
// $Text = preg_replace("/\[td\](.*?)\[\/td\]/s", '<td>$1</td>' ,$Text);
// $Text = preg_replace("/\[tr\](.*?)\[\/tr\]/s", '<tr>$1</tr>' ,$Text);
// $Text = preg_replace("/\[table\](.*?)\[\/table\]/s", '<table>$1</table>' ,$Text);
// $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/s", '<table border="1" >$1</table>' ,$Text);
// $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/s", '<table border="0" >$1</table>' ,$Text);
// $Text = str_replace("[*]", "<li>", $Text);
// Check for font change text
// $Text = preg_replace("(\[font=(.*?)\](.*?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text);
// Declare the format for [code] layout
$Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/is",'stripdcode_br_cb',$Text);
// $CodeLayout = '<code>$1</code>';
// Check for [code] text
$Text = preg_replace("/\[code\](.*?)\[\/code\]/is","```$1```", $Text);
// Declare the format for [quote] layout
// $QuoteLayout = '<blockquote>$1</blockquote>';
// Check for [quote] text
// $Text = preg_replace("/\[quote\](.*?)\[\/quote\]/is","$QuoteLayout", $Text);
// Images
// html5 video and audio
// $Text = preg_replace("/\[video\](.*?)\[\/video\]/", '<video src="$1" controls="controls" width="425" height="350"><a href="$1">$1</a></video>', $Text);
// $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '<audio src="$1" controls="controls"><a href="$1">$1</a></audio>', $Text);
// $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/", '<iframe src="$1" width="425" height="350"><a href="$1">$1</a></iframe>', $Text);
// [img=widthxheight]image source[/img]
// $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/", '<img src="$3" style="height:{$2}px; width:{$1}px;" >', $Text);
// if (get_pconfig(local_user(), 'oembed', 'use_for_youtube' )==1){
// // use oembed for youtube links
// $Text = preg_replace("/\[youtube\]/",'[embed]',$Text);
// $Text = preg_replace("/\[\/youtube\]/",'[/embed]',$Text);
// } else {
// // Youtube extensions
// $Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
// $Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<iframe width="425" height="349" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>', $Text);
// }
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);
// oembed tag
// $Text = oembed_bbcode2html($Text);
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
// if(x($ev,'desc') && x($ev,'start')) {
// $sub = format_event_html($ev);
// $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/is",$sub,$Text);
//$Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/is",'',$Text);
// $Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/is",'',$Text);
// $Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/is",'',$Text);
// $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",'',$Text);
// }
call_hooks('bb2diaspora',$Text);
return $Text;
}

View file

@ -41,7 +41,7 @@ function bbcode($Text,$preserve_nl = false) {
// Perform URL Search
$Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%\$\!\+\,]+)/", ' <a href="$2" target="external-link">$2</a>', $Text);
$Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\%\$\!\+\,]+)/", '$1<a href="$2" target="external-link">$2</a>', $Text);
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="external-link">$1</a>', $Text);
$Text = preg_replace("(\[url\=([$URLSearchString]*)\](.*?)\[/url\])", '<a href="$1" target="external-link">$2</a>', $Text);
@ -134,7 +134,7 @@ function bbcode($Text,$preserve_nl = false) {
// Youtube extensions
$Text = preg_replace("/\[youtube\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
$Text = preg_replace("/\[youtube\]https?:\/\/youtu.be\/(.*?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
$Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<iframe width="425" height="349" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>', $Text);
$Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<iframe width="425" height="349" src="http://www.youtube.com/embed/$1" frameborder="0" ></iframe>', $Text);
}
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '<object width="425" height="350" type="application/x-shockwave-flash" data="http://www.youtube.com/v/$1" ><param name="movie" value="http://www.youtube.com/v/$1"></param><!--[if IE]><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350" /><![endif]--></object>', $Text);

View file

@ -46,10 +46,11 @@ function contact_reputation($current) {
}
function contact_poll_interval($current) {
function contact_poll_interval($current, $disabled = false) {
$dis = (($disabled) ? ' disabled="disabled" ' : '');
$o = '';
$o .= '<select id="contact-poll-interval" name="poll" />' . "\r\n";
$o .= "<select id=\"contact-poll-interval\" name=\"poll\" $dis />" . "\r\n";
$rep = array(
0 => t('Frequently'),
@ -67,3 +68,13 @@ function contact_poll_interval($current) {
$o .= "</select>\r\n";
return $o;
}
function network_to_name($s) {
call_hooks('network_to_name', $s);
return str_replace(array(NETWORK_DFRN,NETWORK_OSTATUS,NETWORK_FEED,NETWORK_MAIL,NETWORK_DIASPORA,NETWORK_FACEBOOK,NETWORK_ZOT),
array(t('Friendika'),t('OStatus'),t('RSS/Atom'),t('Email'),t('Diaspora'),t('Facebook'),t('Zot!')),$s);
}

View file

@ -80,6 +80,9 @@ function localize_item(&$item){
}
// fix bad embeds
$item['body'] = str_replace('http://www.youtube.com/embed/http:','http:',$item['body']);
}
/**

View file

@ -225,3 +225,68 @@ function pkcs5_unpad($text)
if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false;
return substr($text, 0, -1 * $pad);
}
function AES256CBC_encrypt($data,$key,$iv) {
return mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,
str_pad($key,32,"\0"),
pkcs5_pad($data,16),
MCRYPT_MODE_CBC,
str_pad($iv,16,"\0"));
}
function AES256CBC_decrypt($data,$key,$iv) {
return pkcs5_unpad(mcrypt_decrypt(
MCRYPT_RIJNDAEL_128,
str_pad($key,32,"\0"),
$data,
MCRYPT_MODE_CBC,
str_pad($iv,16,"\0")));
}
function aes_encapsulate($data,$pubkey) {
$key = random_string(32,RANDOM_STRING_TEXT);
$iv = random_string(16,RANDOM_STRING_TEXT);
$result['data'] = base64url_encode(AES256CBC_encrypt($data,$key,$iv),true);
openssl_public_encrypt($key,$k,$pubkey);
$result['key'] = base64url_encode($k,true);
openssl_public_encrypt($iv,$i,$pubkey);
$result['iv'] = base64url_encode($i,true);
return $result;
}
function aes_unencapsulate($data,$prvkey) {
openssl_private_decrypt(base64url_decode($data['key']),$k,$prvkey);
openssl_private_decrypt(base64url_decode($data['iv']),$i,$prvkey);
return AES256CBC_decrypt(base64url_decode($data['data']),$k,$i);
}
function zot_encapsulate($data,$sender,$pubkey) {
$res = aes_encapsulate($data,$pubkey);
openssl_public_encrypt($sender,$s,$pubkey);
$s1 = base64url_encode($s,true);
return <<< EOT
<?xml version='1.0' encoding='UTF-8'?>
<zot:env xmlns:zot='http://purl.org/zot/1.0'>
<zot:key>{$res['key']}</zot:key>
<zot:iv>{$res['iv']}</zot:iv>
<zot:sender>$s1</zot:sender>
<zot:alg>AES-256-CBC</zot:alg>
<zot:data type='application/magic-envelope+xml'>{$res['data']}</zot:data>
</zot:env>
EOT;
}
function zot_unencapsulate($data,$prvkey) {
$ret = array();
$c = array();
$x = parse_xml_string($data);
$c = array('key' => $x->key,'iv' => $x->iv,'data' => $x->data);
openssl_private_decrypt(base64url_decode($x->sender),$s,$prvkey);
$ret['sender'] = $s;
$ret['data'] = aes_unencapsulate($x,$prvkey);
return $ret;
}

444
include/delivery.php Normal file
View file

@ -0,0 +1,444 @@
<?php
require_once("boot.php");
function delivery_run($argv, $argc){
global $a, $db;
if(is_null($a)){
$a = new App;
}
if(is_null($db)) {
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
require_once("session.php");
require_once("datetime.php");
require_once('include/items.php');
require_once('include/bbcode.php');
require_once('include/diaspora.php');
load_config('config');
load_config('system');
load_hooks();
if($argc < 3)
return;
$a->set_baseurl(get_config('system','url'));
logger('delivery: invoked: ' . print_r($argv,true));
$cmd = $argv[1];
$item_id = intval($argv[2]);
$contact_id = intval($argv[3]);
// Some other process may have delivered this item already.
$r = q("select * from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",
dbesc($cmd),
dbesc($item_id),
dbesc($contact_id)
);
if(! count($r)) {
return;
}
// It's ours to deliver. Remove it from the queue.
q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",
dbesc($cmd),
dbesc($item_id),
dbesc($contact_id)
);
if((! $item_id) || (! $contact_id))
return;
$expire = false;
$top_level = false;
$recipients = array();
$url_recipients = array();
$normal_mode = true;
$recipients[] = $contact_id;
if($cmd === 'expire') {
$normal_mode = false;
$expire = true;
$items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1
AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP - INTERVAL 30 MINUTE",
intval($item_id)
);
$uid = $item_id;
$item_id = 0;
if(! count($items))
return;
}
else {
// find ancestors
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
intval($item_id)
);
if((! count($r)) || (! intval($r[0]['parent']))) {
return;
}
$target_item = $r[0];
$parent_id = intval($r[0]['parent']);
$uid = $r[0]['uid'];
$updated = $r[0]['edited'];
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d ORDER BY `id` ASC",
intval($parent_id)
);
if(! count($items)) {
return;
}
$icontacts = q("SELECT * FROM `contact` WHERE `id` IN ( SELECT distinct(`contact-id`) FROM `item` where `parent` = %d ) ",
intval($parent_id)
);
if(! count($icontacts))
return;
// avoid race condition with deleting entries
if($items[0]['deleted']) {
foreach($items as $item)
$item['deleted'] = 1;
}
if((count($items) == 1) && ($items[0]['uri'] === $items[0]['parent-uri'])) {
logger('delivery: top level post');
$top_level = true;
}
}
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
`user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
`user`.`page-flags`, `user`.`prvnets`
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($uid)
);
if(! count($r))
return;
$owner = $r[0];
$public_message = true;
// fill this in with a single salmon slap if applicable
$slap = '';
require_once('include/group.php');
$parent = $items[0];
// This is IMPORTANT!!!!
// We will only send a "notify owner to relay" or followup message if the referenced post
// originated on our system by virtue of having our hostname somewhere
// in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
// if $parent['wall'] == 1 we will already have the parent message in our array
// and we will relay the whole lot.
// expire sends an entire group of expire messages and cannot be forwarded.
// However the conversation owner will be a part of the conversation and will
// be notified during this run.
// Other DFRN conversation members will be alerted during polled updates.
// Diaspora members currently are not notified of expirations, and other networks have
// either limited or no ability to process deletions. We should at least fix Diaspora
// by stringing togther an array of retractions and sending them onward.
$localhost = $a->get_hostname();
if(strpos($localhost,':'))
$localhost = substr($localhost,0,strpos($localhost,':'));
/**
*
* Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes
* have been known to cause runaway conditions which affected several servers, along with
* permissions issues.
*
*/
if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
logger('relay denied for delivery agent.');
/* no relay allowed for direct contact delivery */
return;
}
if((strlen($parent['allow_cid']))
|| (strlen($parent['allow_gid']))
|| (strlen($parent['deny_cid']))
|| (strlen($parent['deny_gid']))) {
$public_message = false; // private recipients, not public
}
$conversant_str = intval($contact_id);
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `blocked` = 0 AND `pending` = 0",
intval($contact_id)
);
if(count($r))
$contact = $r[0];
$feed_template = get_markup_template('atom_feed.tpl');
$mail_template = get_markup_template('atom_mail.tpl');
$atom = '';
$slaps = array();
$hubxml = feed_hublinks();
$birthday = feed_birthday($owner['uid'],$owner['timezone']);
if(strlen($birthday))
$birthday = '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>';
$atom .= replace_macros($feed_template, array(
'$version' => xmlify(FRIENDIKA_VERSION),
'$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname'] ),
'$feed_title' => xmlify($owner['name']),
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00' , ATOM_TIME)) ,
'$hub' => $hubxml,
'$salmon' => '', // private feed, we don't use salmon here
'$name' => xmlify($owner['name']),
'$profile_page' => xmlify($owner['url']),
'$photo' => xmlify($owner['photo']),
'$thumb' => xmlify($owner['thumb']),
'$picdate' => xmlify(datetime_convert('UTC','UTC',$owner['avatar-date'] . '+00:00' , ATOM_TIME)) ,
'$uridate' => xmlify(datetime_convert('UTC','UTC',$owner['uri-date'] . '+00:00' , ATOM_TIME)) ,
'$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) ,
'$birthday' => $birthday
));
foreach($items as $item) {
if(! $item['parent'])
continue;
// private emails may be in included in public conversations. Filter them.
if(($public_message) && $item['private'])
continue;
$item_contact = get_item_contact($item,$icontacts);
if(! $item_contact)
continue;
$atom .= atom_entry($item,'text',$item_contact,$owner,true);
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
$slaps[] = atom_entry($item,'html',$item_contact,$owner,true);
}
$atom .= '</feed>' . "\r\n";
logger('notifier: ' . $atom, LOGGER_DATA);
logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA);
require_once('include/salmon.php');
if($contact['self'])
return;
$deliver_status = 0;
switch($contact['network']) {
case NETWORK_DFRN :
logger('notifier: dfrndelivery: ' . $contact['name']);
$deliver_status = dfrn_deliver($owner,$contact,$atom);
logger('notifier: dfrn_delivery returns ' . $deliver_status);
if($deliver_status == (-1)) {
logger('notifier: delivery failed: queuing message');
// queue message for redelivery
q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
VALUES ( %d, '%s', '%s', '%s') ",
intval($contact['id']),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($atom)
);
}
break;
case NETWORK_OSTATUS :
// Do not send to otatus if we are not configured to send to public networks
if($owner['prvnets'])
break;
if(get_config('system','ostatus_disabled') || get_config('system','dfrn_only'))
break;
// only send salmon if public - e.g. if it's ok to notify
// a public hub, it's ok to send a salmon
if((count($slaps)) && ($public_message) && (! $expire)) {
logger('notifier: slapdelivery: ' . $contact['name']);
foreach($slaps as $slappy) {
if($contact['notify']) {
$deliver_status = slapper($owner,$contact['notify'],$slappy);
if($deliver_status == (-1)) {
// queue message for redelivery
q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
VALUES ( %d, '%s', '%s', '%s') ",
intval($contact['id']),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($slappy)
);
}
}
}
}
break;
case NETWORK_MAIL :
if(get_config('system','dfrn_only'))
break;
// WARNING: does not currently convert to RFC2047 header encodings, etc.
$addr = $contact['addr'];
if(! strlen($addr))
break;
if($cmd === 'wall-new' || $cmd === 'comment-new') {
$it = null;
if($cmd === 'wall-new')
$it = $items[0];
else {
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($argv[2]),
intval($uid)
);
if(count($r))
$it = $r[0];
}
if(! $it)
break;
$local_user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if(! count($local_user))
break;
$reply_to = '';
$r1 = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if($r1 && $r1[0]['reply_to'])
$reply_to = $r1[0]['reply_to'];
$subject = (($it['title']) ? $it['title'] : t("\x28no subject\x29")) ;
$headers = 'From: ' . $local_user[0]['username'] . ' <' . $local_user[0]['email'] . '>' . "\n";
if($reply_to)
$headers .= 'Reply-to: ' . $reply_to . "\n";
$headers .= 'Message-id: <' . $it['uri'] . '>' . "\n";
if($it['uri'] !== $it['parent-uri']) {
$header .= 'References: <' . $it['parent-uri'] . '>' . "\n";
if(! strlen($it['title'])) {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' LIMIT 1",
dbesc($it['parent-uri'])
);
if(count($r)) {
$subtitle = $r[0]['title'];
if($subtitle) {
if(strncasecmp($subtitle,'RE:',3))
$subject = $subtitle;
else
$subject = 'Re: ' . $subtitle;
}
}
}
}
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
$html = prepare_body($it);
$message = '<html><body>' . $html . '</body></html>';
logger('notifier: email delivery to ' . $addr);
mail($addr, $subject, $message, $headers);
}
break;
case NETWORK_DIASPORA :
logger('delivery: diaspora deliver: ' . $contact['name']);
if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')) || (! $normal_mode))
break;
if(! $contact['pubkey'])
break;
if($target_item['verb'] === ACTIVITY_DISLIKE) {
// unsupported
break;
}
elseif(($target_item['deleted']) && ($target_item['verb'] !== ACTIVITY_LIKE)) {
logger('delivery: diaspora retract: ' . $contact['name']);
// diaspora delete,
diaspora_send_retraction($target_item,$owner,$contact);
break;
}
elseif($target_item['parent'] != $target_item['id']) {
logger('delivery: diaspora relay: ' . $contact['name']);
// we are the relay - send comments, likes and unlikes to our conversants
diaspora_send_relay($target_item,$owner,$contact);
break;
}
elseif($top_level) {
logger('delivery: diaspora status: ' . $contact['name']);
diaspora_send_status($target_item,$owner,$contact);
break;
}
logger('delivery: diaspora unknown mode: ' . $contact['name']);
break;
case NETWORK_FEED :
case NETWORK_FACEBOOK :
if(get_config('system','dfrn_only'))
break;
default:
break;
}
return;
}
if (array_search(__file__,get_included_files())===0){
delivery_run($argv,$argc);
killme();
}

View file

@ -2,6 +2,75 @@
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/bb2diaspora.php');
require_once('include/contact_selectors.php');
function diaspora_dispatch($importer,$msg) {
$parsed_xml = parse_xml_string($msg['message'],false);
$xmlbase = $parsed_xml->post;
if($xmlbase->request) {
diaspora_request($importer,$xmlbase->request);
}
elseif($xmlbase->status_message) {
diaspora_post($importer,$xmlbase->status_message);
}
elseif($xmlbase->comment) {
diaspora_comment($importer,$xmlbase->comment,$msg);
}
elseif($xmlbase->like) {
diaspora_like($importer,$xmlbase->like,$msg);
}
elseif($xmlbase->retraction) {
diaspora_retraction($importer,$xmlbase->retraction,$msg);
}
elseif($xmlbase->photo) {
diaspora_photo($importer,$xmlbase->photo,$msg);
}
else {
logger('diaspora_dispatch: unknown message type: ' . print_r($xmlbase,true));
}
return;
}
function diaspora_get_contact_by_handle($uid,$handle) {
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `addr` = '%s' LIMIT 1",
dbesc(NETWORK_DIASPORA),
intval($uid),
dbesc($handle)
);
if($r && count($r))
return $r[0];
return false;
}
function find_diaspora_person_by_handle($handle) {
$r = q("select * from fcontact where network = '%s' and addr = '%s' limit 1",
dbesc(NETWORK_DIASPORA),
dbesc($handle)
);
if(count($r)) {
// update record occasionally so it doesn't get stale
$d = strtotime($r[0]['updated'] . ' +00:00');
if($d < strtotime('now - 14 days')) {
q("delete from fcontact where id = %d limit 1",
intval($r[0]['id'])
);
}
else
return $r[0];
}
require_once('include/Scrape.php');
$r = probe_url($handle, PROBE_DIASPORA);
if((count($r)) && ($r['network'] === NETWORK_DIASPORA)) {
add_fcontact($r);
return ($r);
}
return false;
}
function get_diaspora_key($uri) {
logger('Fetching diaspora key for: ' . $uri);
@ -13,16 +82,6 @@ function get_diaspora_key($uri) {
}
function diaspora_base_message($type,$data) {
$tpl = get_markup_template('diaspora_' . $type . '.tpl');
if(! $tpl)
return '';
return replace_macros($tpl,$data);
}
function diaspora_msg_build($msg,$user,$contact,$prvkey,$pubkey) {
$a = get_app();
@ -81,10 +140,9 @@ EOT;
$encrypted_outer_key_bundle = '';
openssl_public_encrypt($outer_json,$encrypted_outer_key_bundle,$pubkey);
logger('outer_bundle_encrypt: ' . openssl_error_string());
$b64_encrypted_outer_key_bundle = base64_encode($encrypted_outer_key_bundle);
logger('outer_bundle: ' . $b64_encrypted_outer_key_bundle . ' key: ' . $pubkey);
logger('outer_bundle: ' . $b64_encrypted_outer_key_bundle . ' key: ' . $pubkey, LOGGER_DATA);
$encrypted_header_json_object = json_encode(array('aes_key' => base64_encode($encrypted_outer_key_bundle),
'ciphertext' => base64_encode($ciphertext)));
@ -164,7 +222,7 @@ function diaspora_decode($importer,$xml) {
* </decrypted_header>
*/
logger('decrypted: ' . $decrypted);
logger('decrypted: ' . $decrypted, LOGGER_DEBUG);
$idom = parse_xml_string($decrypted,false);
$inner_iv = base64_decode($idom->iv);
@ -262,42 +320,6 @@ function diaspora_decode($importer,$xml) {
}
function diaspora_get_contact_by_handle($uid,$handle) {
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `addr` = '%s' LIMIT 1",
dbesc(NETWORK_DIASPORA),
intval($uid),
dbesc($handle)
);
if($r && count($r))
return $r[0];
return false;
}
function find_diaspora_person_by_handle($handle) {
$r = q("select * from fcontact where network = '%s' and addr = '%s' limit 1",
dbesc(NETWORK_DIASPORA),
dbesc($handle)
);
if(count($r)) {
// update record occasionally so it doesn't get stale
$d = strtotime($r[0]['updated'] . ' +00:00');
if($d < strtotime('now - 14 days')) {
q("delete from fcontact where id = %d limit 1",
intval($r[0]['id'])
);
}
else
return $r[0];
}
require_once('include/Scrape.php');
$r = probe_url($handle, PROBE_DIASPORA);
if((count($r)) && ($r['network'] === NETWORK_DIASPORA)) {
add_fcontact($r);
return ($r);
}
return false;
}
function diaspora_request($importer,$xml) {
@ -395,8 +417,10 @@ function diaspora_post($importer,$xml) {
dbesc($message_id),
dbesc($guid)
);
if(count($r))
if(count($r)) {
logger('diaspora_post: message exists: ' . $guid);
return;
}
// allocate a guid on our system - we aren't fixing any collisions.
// we're ignoring them
@ -413,32 +437,7 @@ function diaspora_post($importer,$xml) {
$created = unxmlify($xml->created_at);
$private = ((unxmlify($xml->public) == 'false') ? 1 : 0);
$body = unxmlify($xml->raw_message);
require_once('library/HTMLPurifier.auto.php');
require_once('include/html2bbcode.php');
$maxlen = get_max_import_size();
if($maxlen && (strlen($body) > $maxlen))
$body = substr($body,0, $maxlen);
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
'[youtube]$1[/youtube]', $body);
$body = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
'[youtube]$1[/youtube]', $body);
$body = oembed_html2bbcode($body);
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
$purifier = new HTMLPurifier($config);
$body = $purifier->purify($body);
$body = html2bbcode($body);
}
$body = diaspora2bb($xml->raw_message);
$datarray = array();
$datarray['uid'] = $importer['uid'];
@ -456,6 +455,7 @@ function diaspora_post($importer,$xml) {
$datarray['author-link'] = $contact['url'];
$datarray['author-avatar'] = $contact['thumb'];
$datarray['body'] = $body;
$datarray['app'] = 'Diaspora';
item_store($datarray);
@ -477,8 +477,10 @@ function diaspora_comment($importer,$xml,$msg) {
$text = $xml->text;
$contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']);
if(! $contact)
if(! $contact) {
logger('diaspora_comment: cannot find contact: ' . $msg['author']);
return;
}
if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
logger('diaspora_comment: Ignoring this author.');
@ -486,6 +488,15 @@ function diaspora_comment($importer,$xml,$msg) {
// NOTREACHED
}
$r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1",
intval($importer['uid']),
dbesc($guid)
);
if(count($r)) {
logger('diaspora_comment: our comment just got relayed back to us (or there was a guid collision) : ' . $guid);
return;
}
$r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1",
intval($importer['uid']),
dbesc($parent_guid)
@ -522,7 +533,7 @@ function diaspora_comment($importer,$xml,$msg) {
if($parent_author_signature) {
$owner_signed_data = $guid . ';' . $parent_guid . ';' . $text . ';' . $msg['author'];
$owner_signed_data = $guid . ';' . $parent_guid . ';' . $text . ';' . $diaspora_handle;
$parent_author_signature = base64_decode($parent_author_signature);
@ -536,32 +547,7 @@ function diaspora_comment($importer,$xml,$msg) {
// Phew! Everything checks out. Now create an item.
require_once('library/HTMLPurifier.auto.php');
require_once('include/html2bbcode.php');
$body = $text;
$maxlen = get_max_import_size();
if($maxlen && (strlen($body) > $maxlen))
$body = substr($body,0, $maxlen);
if((strpos($body,'<') !== false) || (strpos($body,'>') !== false)) {
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
'[youtube]$1[/youtube]', $body);
$body = preg_replace('#<iframe[^>].+?' . 'http://www.youtube.com/embed/([A-Za-z0-9\-_=]+).+?</iframe>#s',
'[youtube]$1[/youtube]', $body);
$body = oembed_html2bbcode($body);
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
$purifier = new HTMLPurifier($config);
$body = $purifier->purify($body);
$body = html2bbcode($body);
}
$body = diaspora2bb($text);
$message_id = $diaspora_handle . ':' . $guid;
@ -586,6 +572,7 @@ function diaspora_comment($importer,$xml,$msg) {
$datarray['author-link'] = $person['url'];
$datarray['author-avatar'] = ((x($person,'thumb')) ? $person['thumb'] : $person['photo']);
$datarray['body'] = $body;
$datarray['app'] = 'Diaspora';
$message_id = item_store($datarray);
@ -596,13 +583,67 @@ function diaspora_comment($importer,$xml,$msg) {
dbesc(base64_encode($author_signature)),
dbesc($diaspora_handle)
);
// if the message isn't already being relayed, notify others
// the existence of parent_author_signature means the parent_author or owner
// is already relaying.
proc_run('php','include/notifier.php','comment',$message_id);
}
return;
}
function diaspora_photo($importer,$xml,$msg) {
$remote_photo_path = notags(unxmlify($xml->remote_photo_path));
$remote_photo_name = notags(unxmlify($xml->remote_photo_name));
$status_message_guid = notags(unxmlify($xml->status_message_guid));
$guid = notags(unxmlify($xml->guid));
$diaspora_handle = notags(unxmlify($xml->diaspora_handle));
$public = notags(unxmlify($xml->public));
$created_at = notags(unxmlify($xml_created_at));
$contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']);
if(! $contact)
return;
if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
logger('diaspora_photo: Ignoring this author.');
http_status_exit(202);
// NOTREACHED
}
// notify others
return;
$r = q("SELECT * FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1",
intval($importer['uid']),
dbesc($status_message_guid)
);
if(! count($r)) {
logger('diaspora_photo: parent item not found: parent: ' . $parent_guid . ' item: ' . $guid);
return;
}
$parent_item = $r[0];
$link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n";
$r = q("update item set `body` = '%s' where `id` = %d and `uid` = %d limit 1",
dbesc($link_text . $parent_item['body']),
intval($parent_item['id']),
intval($parent_item['uid'])
);
return;
}
function diaspora_like($importer,$xml,$msg) {
$a = get_app();
@ -621,8 +662,10 @@ function diaspora_like($importer,$xml,$msg) {
return;
$contact = diaspora_get_contact_by_handle($importer['uid'],$msg['author']);
if(! $contact)
if(! $contact) {
logger('diaspora_like: cannot find contact: ' . $msg['author']);
return;
}
if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
logger('diaspora_like: Ignoring this author.');
@ -689,7 +732,8 @@ function diaspora_like($importer,$xml,$msg) {
}
if($parent_author_signature) {
$owner_signed_data = $guid . ';' . $parent_guid . ';' . $target_type . ';' . $positive . ';' . $msg['author'];
// $owner_signed_data = $guid . ';' . $parent_guid . ';' . $target_type . ';' . $positive . ';' . $msg['author'];
$owner_signed_data = $guid . ';' . $parent_guid . ';' . $target_type . ';' . $positive . ';' . $diaspora_handle;
$parent_author_signature = base64_decode($parent_author_signature);
@ -749,6 +793,8 @@ EOT;
$plink = '[url=' . $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $parent_item['id'] . ']' . $post_type . '[/url]';
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
$arr['app'] = 'Diaspora';
$arr['private'] = $parent_item['private'];
$arr['verb'] = $activity;
$arr['object-type'] = $objtype;
@ -768,7 +814,12 @@ EOT;
);
}
// FIXME send notification
// if the message isn't already being relayed, notify others
// the existence of parent_author_signature means the parent_author or owner
// is already relaying.
if(! $parent_author_signature)
proc_run('php','include/notifier.php','comment',$message_id);
return;
}
@ -777,19 +828,32 @@ function diaspora_retraction($importer,$xml) {
$guid = notags(unxmlify($xml->guid));
$diaspora_handle = notags(unxmlify($xml->diaspora_handle));
$type = notags(unxmlify($xml->type));
$contact = diaspora_get_contact_by_handle($importer['uid'],$diaspora_handle);
if(! $contact)
return;
// if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
// logger('diaspora_retraction: Ignoring this author.');
// http_status_exit(202);
// // NOTREACHED
// }
if($type === 'Person') {
contact_remove($contact['id']);
}
elseif($type === 'Post') {
$r = q("select * from item where guid = '%s' and uid = %d limit 1",
dbesc('guid'),
intval($importer['uid'])
);
if(count($r)) {
if(link_compare($r[0]['author-link'],$contact['url'])) {
q("update item set `deleted` = 1, `changed` = '%s' where `id` = %d limit 1",
dbesc(datetime_convert()),
intval($r[0]['id'])
);
}
}
}
http_exit_status(202);
// NOTREACHED
}
function diaspora_share($me,$contact) {
@ -805,24 +869,59 @@ function diaspora_share($me,$contact) {
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey'])));
post_url($contact['notify'] . '/',$slap);
$return_code = $a->get_curl_code();
logger('diaspora_send_share: returns: ' . $return_code);
return $return_code;
return(diaspora_transmit($owner,$contact,$slap));
}
function diaspora_unshare($me,$contact) {
$a = get_app();
$myaddr = $me['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
$tpl = get_markup_template('diaspora_retract.tpl');
$msg = replace_macros($tpl, array(
'$guid' => $me['guid'],
'$type' => 'Person',
'$handle' => $myaddr
));
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$me,$contact,$me['prvkey'],$contact['pubkey'])));
return(diaspora_transmit($owner,$contact,$slap));
}
function diaspora_send_status($item,$owner,$contact) {
$a = get_app();
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
$theiraddr = $contact['addr'];
require_once('include/bbcode.php');
$body = xmlify(bbcode($item['body']));
$images = array();
$body = $item['body'];
$cnt = preg_match_all('|\[img\](.*?)\[\/img\]|',$body,$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
$detail = array();
$detail['str'] = $mtch[0];
$detail['path'] = dirname($mtch[1]) . '/';
$detail['file'] = basename($mtch[1]);
$detail['guid'] = $item['guid'];
$detail['handle'] = $myaddr;
$images[] = $detail;
$body = str_replace($detail['str'],t('link'),$body);
}
}
$body = xmlify(html_entity_decode(bb2diaspora($body)));
$public = (($item['private']) ? 'false' : 'true');
require_once('include/datetime.php');
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d h:i:s \U\T\C');
$created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C');
$tpl = get_markup_template('diaspora_post.tpl');
$msg = replace_macros($tpl, array(
@ -833,17 +932,59 @@ function diaspora_send_status($item,$owner,$contact) {
'$created' => $created
));
logger('diaspora_send_status: base message: ' . $msg, LOGGER_DATA);
logger('diaspora_send_status: ' . $owner['username'] . ' -> ' . $contact['name'] . ' base message: ' . $msg, LOGGER_DATA);
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'])));
post_url($contact['notify'] . '/',$slap);
$return_code = $a->get_curl_code();
logger('diaspora_send_status: returns: ' . $return_code);
$return_code = diaspora_transmit($owner,$contact,$slap);
if(count($images)) {
diaspora_send_images($item,$owner,$contact,$images);
}
return $return_code;
}
function diaspora_send_images($item,$owner,$contact,$images) {
$a = get_app();
if(! count($images))
return;
$mysite = substr($a->get_baseurl(),strpos($a->get_baseurl(),'://') + 3) . '/photo';
$tpl = get_markup_template('diaspora_photo.tpl');
foreach($images as $image) {
if(! stristr($image['path'],$mysite))
continue;
$resource = str_replace('.jpg','',$image['file']);
$resource = substr($resource,0,strpos($resource,'-'));
$r = q("select * from photo where `resource-id` = '%s' and `uid` = %d limit 1",
dbesc($resource),
intval($owner['uid'])
);
if(! count($r))
continue;
$public = (($r[0]['allow_cid'] || $r[0]['allow_gid'] || $r[0]['deny_cid'] || $r[0]['deny_gid']) ? 'false' : 'true' );
$msg = replace_macros($tpl,array(
'$path' => xmlify($image['path']),
'$filename' => xmlify($image['file']),
'$msg_guid' => xmlify($image['guid']),
'$guid' => xmlify($r[0]['guid']),
'$handle' => xmlify($image['handle']),
'$public' => xmlify($public),
'$created_at' => xmlify(datetime_convert('UTC','UTC',$r[0]['created'],'Y-m-d H:i:s \U\T\C'))
));
logger('diaspora_send_photo: base message: ' . $msg, LOGGER_DATA);
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'])));
diaspora_transmit($owner,$contact,$slap);
}
}
function diaspora_send_followup($item,$owner,$contact) {
$a = get_app();
@ -869,16 +1010,16 @@ function diaspora_send_followup($item,$owner,$contact) {
$like = false;
}
$text = bbcode($item['body']);
$text = html_entity_decode(bb2diaspora($item['body']));
// sign it
if($like)
$signed_text = $item['guid'] . ';' . $target_type . ';' . $positive . ';' . $myaddr;
$signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
else
$signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
$authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey']),'sha');
$authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha'));
$msg = replace_macros($tpl,array(
'$guid' => xmlify($item['guid']),
@ -894,11 +1035,7 @@ function diaspora_send_followup($item,$owner,$contact) {
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'])));
post_url($contact['notify'] . '/',$slap);
$return_code = $a->get_curl_code();
logger('diaspora_send_followup: returns: ' . $return_code);
return $return_code;
return(diaspora_transmit($owner,$contact,$slap));
}
@ -918,14 +1055,6 @@ function diaspora_send_relay($item,$owner,$contact) {
else
return;
// fetch the original signature
$r = q("select * from sign where iid = %d limit 1",
intval($item['id'])
);
if(! count($r))
return;
$orig_sign = $r[0];
if($item['verb'] === ACTIVITY_LIKE) {
$tpl = get_markup_template('diaspora_like_relay.tpl');
$like = true;
@ -937,15 +1066,60 @@ function diaspora_send_relay($item,$owner,$contact) {
$like = false;
}
$text = bbcode($item['body']);
$body = $item['body'];
$text = html_entity_decode(bb2diaspora($body));
// fetch the original signature if somebody sent the post to us to relay
// If we are relaying for a reply originating on our own account, there wasn't a 'send to relay'
// action. It wasn't needed. In that case create the original signature and the
// owner (parent author) signature
// comments from other networks will be relayed under our name, with a brief
// preamble to describe what's happening and noting the real author
$r = q("select * from sign where iid = %d limit 1",
intval($item['id'])
);
if(count($r)) {
$orig_sign = $r[0];
$signed_text = $orig_sign['signed_text'];
$authorsig = $orig_sign['signature'];
$handle = $orig_sign['signer'];
}
else {
$itemcontact = q("select * from contact where `id` = %d limit 1",
intval($item['contact-id'])
);
if(count($itemcontact)) {
if(! $itemcontact[0]['self']) {
$prefix = sprintf( t('[Relayed] Comment authored by %s from network %s'),
'['. $item['author-name'] . ']' . '(' . $item['author-link'] . ')',
network_to_name($itemcontact['network'])) . "\n";
$body = $prefix . $body;
}
}
else {
if($like)
$signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
else
$signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
$authorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha'));
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($item['id']),
dbesc($signed_text),
dbesc(base64_encode($authorsig)),
dbesc($myaddr)
);
$handle = $myaddr;
}
}
// sign it
if($like)
$parent_signed_text = $orig_sign['signed_text'];
else
$parent_signed_text = $orig_sign['signed_text'];
$parentauthorsig = base64_encode(rsa_sign($signed_text,$owner['uprvkey'],'sha'));
$msg = replace_macros($tpl,array(
@ -954,26 +1128,16 @@ function diaspora_send_relay($item,$owner,$contact) {
'$target_type' =>xmlify($target_type),
'$authorsig' => xmlify($orig_sign['signature']),
'$parentsig' => xmlify($parentauthorsig),
'$text' => xmlify($text),
'$body' => xmlify($text),
'$positive' => xmlify($positive),
'$diaspora_handle' => xmlify($myaddr)
'$handle' => xmlify($handle)
));
// fetch the original signature
$r = q("select * from sign where iid = %d limit 1",
intval($item['id'])
);
if(! count($r))
return;
logger('diaspora_relay_comment: base message: ' . $msg, LOGGER_DATA);
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'])));
post_url($contact['notify'] . '/',$slap);
$return_code = $a->get_curl_code();
logger('diaspora_send_relay: returns: ' . $return_code);
return $return_code;
return(diaspora_transmit($owner,$contact,$slap));
}
@ -981,8 +1145,42 @@ function diaspora_send_relay($item,$owner,$contact) {
function diaspora_send_retraction($item,$owner,$contact) {
$a = get_app();
$myaddr = $owner['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
$tpl = get_markup_template('diaspora_retract.tpl');
$msg = replace_macros($tpl, array(
'$guid' => $item['guid'],
'$type' => 'Post',
'$handle' => $myaddr
));
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg,$owner,$contact,$owner['uprvkey'],$contact['pubkey'])));
return(diaspora_transmit($owner,$contact,$slap));
}
function diaspora_transmit($owner,$contact,$slap) {
}
$a = get_app();
post_url($contact['notify'] . '/',$slap);
$return_code = $a->get_curl_code();
logger('diaspora_transmit: returns: ' . $return_code);
if(! $return_code) {
logger('diaspora_transmit: queue message');
// queue message for redelivery
q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`)
VALUES ( %d, '%s', '%s', '%s') ",
intval($contact['id']),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($slap)
);
}
return(($return_code) ? $return_code : (-1));
}

View file

@ -124,9 +124,10 @@ function group_public_members($gid) {
$r = q("SELECT `contact`.`id` AS `contact-id` FROM `group_member`
LEFT JOIN `contact` ON `contact`.`id` = `group_member`.`contact-id`
WHERE `gid` = %d AND `group_member`.`uid` = %d
AND `contact`.`network` != 'dfrn' AND `contact`.`network` != 'mail' AND `contact`.`network` != 'face' ",
AND ( `contact`.`network` = '%s' OR `contact`.`notify` = '' )",
intval($gid),
intval(local_user())
intval(local_user()),
dbesc(NETWORK_OSTATUS)
);
if(count($r))
$ret = count($r);

View file

@ -12,6 +12,18 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
if(! strlen($owner_nick))
killme();
$public_feed = (($dfrn_id) ? false : true);
$starred = false;
$converse = false;
if($public_feed && $a->argc > 2) {
for($x = 2; $x < $a->argc; $x++) {
if($a->argv[$x] == 'converse')
$converse = true;
}
}
$sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' ";
$r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`
@ -29,7 +41,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$birthday = feed_birthday($owner_id,$owner['timezone']);
if(strlen($dfrn_id)) {
if(! $public_feed) {
$sql_extra = '';
switch($direction) {
@ -81,7 +93,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
);
}
if($dfrn_id === '' || $dfrn_id === '*')
if($public_feed)
$sort = 'DESC';
else
$sort = 'ASC';
@ -89,14 +101,21 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
if(! strlen($last_update))
$last_update = 'now -30 days';
if($public_feed) {
if(! $converse)
$sql_extra .= " AND `contact`.`self` = 1 ";
}
$check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`,
`contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
`contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
`contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`
`contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`,
`sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`parent` != 0
AND `item`.`wall` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' )
@ -152,7 +171,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
// public feeds get html, our own nodes use bbcode
if($dfrn_id === '') {
if($public_feed) {
$type = 'html';
// catch any email that's in a public conversation and make sure it doesn't leak
if($item['private'])
@ -346,6 +365,18 @@ function get_atom_elements($feed,$item) {
$res['app'] = 'OStatus';
}
// base64 encoded json structure representing Diaspora signature
$dsig = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_signature');
if($dsig) {
$res['dsprsig'] = unxmlify($dsig[0]['data']);
}
$dguid = $item->get_item_tags(NAMESPACE_DFRN,'diaspora_guid');
if($dguid)
$res['guid'] = unxmlify($dguid[0]['data']);
/**
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
*/
@ -642,6 +673,15 @@ function encode_rel_links($links) {
function item_store($arr,$force_parent = false) {
// If a Diaspora signature structure was passed in, pull it out of the
// item array and set it aside for later storage.
$dsprsig = null;
if(x($arr,'dsprsig')) {
$dsprsig = json_decode(base64_decode($arr['dsprsig']));
unset($arr['dsprsig']);
}
if($arr['gravity'])
$arr['gravity'] = intval($arr['gravity']);
elseif($arr['parent-uri'] == $arr['uri'])
@ -818,6 +858,16 @@ function item_store($arr,$force_parent = false) {
intval($current_post)
);
if($dsprsig) {
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($current_post),
dbesc($dsprsig->signed_text),
dbesc($dsprsig->signature),
dbesc($dsprsig->signer)
);
}
/**
* If this is now the last-child, force all _other_ children of this parent to *not* be last-child
*/
@ -877,7 +927,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if(! $curl_stat)
return(-1); // timed out
logger('dfrn_deliver: ' . $xml);
logger('dfrn_deliver: ' . $xml, LOGGER_DATA);
if(! $xml)
return 3;
@ -941,7 +991,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$key = substr(random_string(),0,16);
$data = bin2hex(aes_encrypt($postvars['data'],$key));
$postvars['data'] = $data;
logger('rino: sent key = ' . $key);
logger('rino: sent key = ' . $key, LOGGER_DEBUG);
if($dfrn_version >= 2.1) {
@ -1556,7 +1606,7 @@ function subscribe_to_hub($url,$importer,$contact) {
intval($importer['uid'])
);
}
if(! count($r))
if((! count($r)) || $contact['network'] === NETWORK_DIASPORA)
return;
$push_url = get_config('system','url') . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
@ -1653,10 +1703,19 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
$o .= '<dfrn:private>1</dfrn:private>' . "\r\n";
if($item['extid'])
$o .= '<dfrn:extid>' . $item['extid'] . '</dfrn:extid>' . "\r\n";
$o .= '<dfrn:extid>' . xmlify($item['extid']) . '</dfrn:extid>' . "\r\n";
if($item['app'])
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . $item['app'] . '" ></statusnet:notice_info>';
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . xmlify($item['app']) . '" ></statusnet:notice_info>' . "\r\n";
if($item['guid'])
$o .= '<dfrn:diaspora_guid>' . $item['guid'] . '</dfrn:diaspora_guid>' . "\r\n";
if($item['signed_text']) {
$sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer'])));
$o .= '<dfrn:diaspora_signature>' . xmlify($sign) . '</dfrn:diaspora_signature>' . "\r\n";
}
$verb = construct_verb($item);
$o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n";
$actobj = construct_activity_object($item);

View file

@ -9,37 +9,37 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
$a = get_app();
$ch = curl_init($url);
$ch = @curl_init($url);
if(($redirects > 8) || (! $ch))
return false;
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
@curl_setopt($ch, CURLOPT_HEADER, true);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
@curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
if(intval($timeout)) {
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
@curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
}
else {
$curl_time = intval(get_config('system','curl_timeout'));
curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}
// by default we will allow self-signed certs
// but you can override this
$check_cert = get_config('system','verifyssl');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, (($check_cert) ? true : false));
$prx = get_config('system','proxy');
if(strlen($prx)) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $prx);
$prxusr = get_config('system','proxyuser');
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
@curl_setopt($ch, CURLOPT_PROXY, $prx);
$prxusr = @get_config('system','proxyuser');
if(strlen($prxusr))
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
@curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
}
if($binary)
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
@curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$a->set_curl_code(0);
@ -49,7 +49,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
$s = @curl_exec($ch);
$base = $s;
$curl_info = curl_getinfo($ch);
$curl_info = @curl_getinfo($ch);
$http_code = $curl_info['http_code'];
$header = '';
@ -80,7 +80,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
$a->set_curl_headers($header);
curl_close($ch);
@curl_close($ch);
return($body);
}}
@ -508,7 +508,7 @@ function fetch_xrd_links($url) {
$xrd_timeout = intval(get_config('system','xrd_timeout'));
$redirects = 0;
$xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 30));
$xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 20));
logger('fetch_xrd_links: ' . $xml, LOGGER_DATA);
@ -536,7 +536,7 @@ function fetch_xrd_links($url) {
$aliases = array($alias);
else
$aliases = $alias;
if($aliases && count($aliases)) {
if(is_array($aliases) && count($aliases)) {
foreach($aliases as $alias) {
$links[]['@attributes'] = array('rel' => 'alias' , 'href' => $alias);
}

View file

@ -1,4 +1,5 @@
<?php
require_once("boot.php");
function notifier_run($argv, $argc){
@ -35,7 +36,6 @@ function notifier_run($argv, $argc){
$cmd = $argv[1];
switch($cmd) {
case 'mail':
default:
$item_id = intval($argv[2]);
@ -46,6 +46,8 @@ function notifier_run($argv, $argc){
}
$expire = false;
$mail = false;
$fsuggest = false;
$top_level = false;
$recipients = array();
$url_recipients = array();
@ -54,6 +56,7 @@ function notifier_run($argv, $argc){
if($cmd === 'mail') {
$normal_mode = false;
$mail = true;
$message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
intval($item_id)
);
@ -79,6 +82,8 @@ function notifier_run($argv, $argc){
}
elseif($cmd === 'suggest') {
$normal_mode = false;
$fsuggest = true;
$suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
intval($item_id)
);
@ -104,7 +109,8 @@ function notifier_run($argv, $argc){
$uid = $r[0]['uid'];
$updated = $r[0]['edited'];
$items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id` ASC",
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d ORDER BY `id` ASC",
intval($parent_id)
);
@ -119,8 +125,10 @@ function notifier_run($argv, $argc){
$item['deleted'] = 1;
}
if(count($items) == 1 && $items[0]['uri'] === $items[0]['parent-uri'])
if((count($items) == 1) && ($items[0]['uri'] === $items[0]['parent-uri'])) {
logger('notifier: top level post');
$top_level = true;
}
}
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
@ -139,21 +147,51 @@ function notifier_run($argv, $argc){
$hub = get_config('system','huburl');
// If this is a public conversation, notify the feed hub
$notify_hub = true;
$public_message = true;
// fill this in with a single salmon slap if applicable
$slap = '';
if($cmd != 'mail' && $cmd != 'suggest') {
if(! ($mail || $fsuggest)) {
require_once('include/group.php');
$parent = $items[0];
if($parent['wall'] == 0 && (! $expire)) {
// This is IMPORTANT!!!!
// We will only send a "notify owner to relay" or followup message if the referenced post
// originated on our system by virtue of having our hostname somewhere
// in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
// if $parent['wall'] == 1 we will already have the parent message in our array
// and we will relay the whole lot.
// expire sends an entire group of expire messages and cannot be forwarded.
// However the conversation owner will be a part of the conversation and will
// be notified during this run.
// Other DFRN conversation members will be alerted during polled updates.
// Diaspora members currently are not notified of expirations, and other networks have
// either limited or no ability to process deletions. We should at least fix Diaspora
// by stringing togther an array of retractions and sending them onward.
$localhost = $a->get_hostname();
if(strpos($localhost,':'))
$localhost = substr($localhost,0,strpos($localhost,':'));
/**
*
* Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes
* have been known to cause runaway conditions which affected several servers, along with
* permissions issues.
*
*/
if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) {
// local followup to remote post
$followup = true;
$notify_hub = false; // not public
$public_message = false; // not public
$conversant_str = dbesc($parent['contact-id']);
}
else {
@ -163,7 +201,7 @@ function notifier_run($argv, $argc){
|| (strlen($parent['allow_gid']))
|| (strlen($parent['deny_cid']))
|| (strlen($parent['deny_gid']))) {
$notify_hub = false; // private recipients, not public
$public_message = false; // private recipients, not public
}
$allow_people = expand_acl($parent['allow_cid']);
@ -177,7 +215,7 @@ function notifier_run($argv, $argc){
$recipients[] = $item['contact-id'];
$conversants[] = $item['contact-id'];
// pull out additional tagged people to notify (if public message)
if($notify_hub && strlen($item['inform'])) {
if($public_message && strlen($item['inform'])) {
$people = explode(',',$item['inform']);
foreach($people as $person) {
if(substr($person,0,4) === 'cid:') {
@ -205,7 +243,6 @@ function notifier_run($argv, $argc){
$r = q("SELECT * FROM `contact` WHERE `id` IN ( $conversant_str ) AND `blocked` = 0 AND `pending` = 0");
if(count($r))
$contacts = $r;
}
@ -240,8 +277,8 @@ function notifier_run($argv, $argc){
'$birthday' => $birthday
));
if($cmd === 'mail') {
$notify_hub = false; // mail is not public
if($mail) {
$public_message = false; // mail is not public
$body = fix_private_photos($item['body'],$owner['uid']);
@ -256,8 +293,8 @@ function notifier_run($argv, $argc){
'$parent_id' => xmlify($item['parent-uri'])
));
}
elseif($cmd === 'suggest') {
$notify_hub = false; // suggestions are not public
elseif($fsuggest) {
$public_message = false; // suggestions are not public
$sugg_template = get_markup_template('atom_suggest.tpl');
@ -296,7 +333,7 @@ function notifier_run($argv, $argc){
// private emails may be in included in public conversations. Filter them.
if(($notify_hub) && $item['private'])
if(($public_message) && $item['private'])
continue;
$contact = get_item_contact($item,$contacts);
@ -305,7 +342,7 @@ function notifier_run($argv, $argc){
$atom .= atom_entry($item,'text',$contact,$owner,true);
if(($top_level) && ($notify_hub) && ($item['author-link'] === $item['owner-link']) && (! $expire))
if(($top_level) && ($public_message) && ($item['author-link'] === $item['owner-link']) && (! $expire))
$slaps[] = atom_entry($item,'html',$contact,$owner,true);
}
}
@ -344,17 +381,43 @@ function notifier_run($argv, $argc){
dbesc($recip_str)
);
// delivery loop
require_once('include/salmon.php');
$interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));
// delivery loop
if(count($r)) {
foreach($r as $contact) {
if((! $mail) && (! $fsuggest) && (! $followup) && (! $contact['self'])) {
q("insert into deliverq ( `cmd`,`item`,`contact` ) values ('%s', %d, %d )",
dbesc($cmd),
intval($item_id),
intval($contact['id'])
);
}
}
foreach($r as $contact) {
if($contact['self'])
continue;
// potentially more than one recipient. Start a new process and space them out a bit.
// we will deliver single recipient types of message and email receipients here.
if((! $mail) && (! $fsuggest) && (! $followup)) {
proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']);
if($interval)
@time_sleep_until(microtime(true) + (float) $interval);
continue;
}
$deliver_status = 0;
logger("main delivery by notifier: followup=$followup mail=$mail fsuggest=$fsuggest");
switch($contact['network']) {
case NETWORK_DFRN:
logger('notifier: dfrndelivery: ' . $contact['name']);
@ -403,7 +466,7 @@ function notifier_run($argv, $argc){
// only send salmon if public - e.g. if it's ok to notify
// a public hub, it's ok to send a salmon
if((count($slaps)) && ($notify_hub) && (! $expire)) {
if((count($slaps)) && ($public_message) && (! $expire)) {
logger('notifier: slapdelivery: ' . $contact['name']);
foreach($slaps as $slappy) {
if($contact['notify']) {
@ -505,12 +568,15 @@ function notifier_run($argv, $argc){
require_once('include/diaspora.php');
if(get_config('system','dfrn_only') || (! get_config('system','diaspora_enabled')) || (! $normal_mode))
break;
if(! $contact['pubkey'])
break;
if($target_item['verb'] === ACTIVITY_DISLIKE) {
// unsupported
break;
}
elseif($target_item['deleted'] && (! $parent_item['verb'] === ACTIVITY_LIKE)) {
elseif(($target_item['deleted']) && ($target_item['verb'] !== ACTIVITY_LIKE)) {
// diaspora delete,
diaspora_send_retraction($target_item,$owner,$contact);
break;
@ -544,7 +610,7 @@ function notifier_run($argv, $argc){
// send additional slaps to mentioned remote tags (@foo@example.com)
if($slap && count($url_recipients) && ($followup || $top_level) && $notify_hub && (! $expire)) {
if($slap && count($url_recipients) && ($followup || $top_level) && $public_message && (! $expire)) {
if(! get_config('system','dfrn_only')) {
foreach($url_recipients as $url) {
if($url) {
@ -556,72 +622,68 @@ function notifier_run($argv, $argc){
}
}
if((strlen($hub)) && ($notify_hub)) {
$hubs = explode(',', $hub);
if(count($hubs)) {
foreach($hubs as $h) {
$h = trim($h);
if(! strlen($h))
continue;
$params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
post_url($h,$params);
logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code());
if(count($hubs) > 1)
sleep(7); // try and avoid multiple hubs responding at precisely the same time
}
}
}
if($notify_hub) {
/**
*
* If you have less than 999 dfrn friends and it's a public message,
* we'll just go ahead and push them out securely with dfrn/rino.
* If you've got more than that, you'll have to rely on PuSH delivery.
*
*/
$max_allowed = ((get_config('system','maxpubdeliver') === false) ? 999 : intval(get_config('system','maxpubdeliver')));
/**
*
* Only get the bare essentials and go back for the full record.
* If you've got a lot of friends and we grab all the details at once it could exhaust memory.
*
*/
if($public_message) {
$r = q("SELECT `id`, `name` FROM `contact`
WHERE `network` = '%s' AND `uid` = %d AND `blocked` = 0 AND `pending` = 0
AND `rel` != %d ",
WHERE `network` in ('%s','%s') AND `uid` = %d AND `blocked` = 0 AND `pending` = 0
AND `rel` != %d order by rand() ",
dbesc(NETWORK_DFRN),
dbesc(NETWORK_DIASPORA),
intval($owner['uid']),
intval(CONTACT_IS_SHARING)
);
if((count($r)) && (($max_allowed == 0) || (count($r) < $max_allowed))) {
if(count($r)) {
logger('pubdeliver: ' . print_r($r,true));
// throw everything into the queue in case we get killed
foreach($r as $rr) {
if((! $mail) && (! $fsuggest) && (! $followup)) {
q("insert into deliverq ( `cmd`,`item`,`contact` ) values ('%s', %d, %d )",
dbesc($cmd),
intval($item_id),
intval($rr['id'])
);
}
}
foreach($r as $rr) {
/* Don't deliver to folks who have already been delivered to */
if(! in_array($rr['id'], $conversants)) {
$n = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($rr['id'])
);
if(count($n)) {
logger('notifier: dfrnpubdelivery: ' . $n[0]['name']);
$deliver_status = dfrn_deliver($owner,$n[0],$atom);
}
if(in_array($rr['id'],$conversants)) {
logger('notifier: already delivered id=' . $rr['id']);
continue;
}
if((! $mail) && (! $fsuggest) && (! $followup)) {
logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']);
proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']);
if($interval)
@time_sleep_until(microtime(true) + (float) $interval);
}
else
logger('notifier: dfrnpubdelivery: ignoring ' . $rr['name']);
}
}
if(strlen($hub)) {
$hubs = explode(',', $hub);
if(count($hubs)) {
foreach($hubs as $h) {
$h = trim($h);
if(! strlen($h))
continue;
$params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
post_url($h,$params);
logger('pubsub: publish: ' . $h . ' ' . $params . ' returned ' . $a->get_curl_code());
if(count($hubs) > 1)
sleep(7); // try and avoid multiple hubs responding at precisely the same time
}
}
}
}
return;

View file

@ -82,12 +82,18 @@ function poller_run($argv, $argc){
if(! $restart)
proc_run('php','include/cronhooks.php');
// Only poll from those with suitable relationships,
// and which have a polling address and ignore Diaspora since
// we are unable to match those posts with a Diaspora GUID and prevent duplicates.
$contacts = q("SELECT `id` FROM `contact`
WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
AND `network` != '%s'
$sql_extra
AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 ORDER BY RAND()",
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND)
intval(CONTACT_IS_FRIEND),
dbesc(NETWORK_DIASPORA)
);
if(! count($contacts)) {

View file

@ -3,18 +3,18 @@ require_once("boot.php");
require_once('include/queue_fn.php');
function queue_run($argv, $argc){
global $a, $db;
global $a, $db;
if(is_null($a)){
$a = new App;
}
if(is_null($a)){
$a = new App;
}
if(is_null($db)){
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
if(is_null($db)){
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
require_once("session.php");
@ -29,10 +29,27 @@ function queue_run($argv, $argc){
load_hooks();
if($argc > 1)
$queue_id = intval($argv[1]);
else
$queue_id = 0;
$deadguys = array();
logger('queue: start');
$interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval')));
$r = q("select * from deliverq where 1");
if(count($r)) {
foreach($r as $rr) {
logger('queue: deliverq');
proc_run('php','include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']);
if($interval)
@time_sleep_until(microtime(true) + (float) $interval);
}
}
$r = q("SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue`
LEFT JOIN `contact` ON `queue`.`cid` = `contact`.`id`
WHERE `queue`.`created` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
@ -44,27 +61,41 @@ function queue_run($argv, $argc){
q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
}
$r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ");
if($queue_id)
$r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1",
intval($queue_id)
);
else
$r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ");
if(! count($r)){
return;
}
call_hooks('queue_predeliver', $a, $r);
if(! $queue_id)
call_hooks('queue_predeliver', $a, $r);
// delivery loop
require_once('include/salmon.php');
require_once('include/diaspora.php');
foreach($r as $q_item) {
// queue_predeliver hooks may have changed the queue db details,
// so check again if this entry still needs processing
$qi = q("SELECT * FROM `queue` WHERE `id` = %d AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ",
intval($q_item['id'])
);
if($queue_id) {
$qi = q("select * from queue where `id` = %d limit 1",
intval($queue_id)
);
}
else {
$qi = q("SELECT * FROM `queue` WHERE `id` = %d AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ",
intval($q_item['id'])
);
}
if(! count($qi))
continue;
@ -82,7 +113,8 @@ function queue_run($argv, $argc){
continue;
}
$u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
$u = q("SELECT `user`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`
FROM `user` WHERE `uid` = %d LIMIT 1",
intval($c[0]['uid'])
);
if(! count($u)) {
@ -120,6 +152,18 @@ function queue_run($argv, $argc){
remove_queue_item($q_item['id']);
}
break;
case NETWORK_DIASPORA:
if($contact['notify']) {
logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name']);
$deliver_status = diaspora_transmit($owner,$contact,$data);
if($deliver_status == (-1))
update_queue_time($q_item['id']);
else
remove_queue_item($q_item['id']);
}
break;
default:
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
call_hooks('queue_deliver', $a, $params);

View file

@ -73,6 +73,13 @@ function slapper($owner,$url,$slap) {
if(! strlen($url))
return;
if(! $owner['sprvkey']) {
logger(sprintf("slapper: user '%s' (%d) does not have a salmon private key. Send failed.",
$owner['username'],$owner['uid']));
return;
}
// add all namespaces to item
$namespaces = <<< EOT
@ -102,11 +109,11 @@ EOT;
$precomputed = '.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng==';
$signature = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),true),$owner['sprvkey']);
$signature = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),$owner['sprvkey']));
$signature2 = base64url_encode(rsa_sign($data . $precomputed),$owner['sprvkey']);
$signature2 = base64url_encode(rsa_sign($data . $precomputed,$owner['sprvkey']));
$signature3 = base64url_encode(rsa_sign($data),$owner['sprvkey']);
$signature3 = base64url_encode(rsa_sign($data,$owner['sprvkey']));
$salmon_tpl = get_markup_template('magicsig.tpl');

View file

@ -197,6 +197,7 @@ function admin_page_site_post(&$a){
$timeout = ((x($_POST,'timeout')) ? intval(trim($_POST['timeout'])) : 60);
$dfrn_only = ((x($_POST,'dfrn_only')) ? True : False);
$ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False);
$diaspora_enabled = ((x($_POST,'diaspora_enabled')) ? True : False);
set_config('config','sitename',$sitename);
@ -241,6 +242,7 @@ function admin_page_site_post(&$a){
set_config('system','curl_timeout', $timeout);
set_config('system','dfrn_only', $dfrn_only);
set_config('system','ostatus_disabled', $ostatus_disabled);
set_config('system','diaspora_enabled', $diaspora_enabled);
info( t('Site settings updated.') . EOL);
goaway($a->get_baseurl() . '/admin/site' );
@ -325,6 +327,7 @@ function admin_page_site(&$a) {
'$no_utf' => array('no_utf', t("UTF-8 Regular expressions"), !get_config('system','no_utf'), "Use PHP UTF8 regular expressions"),
'$no_community_page' => array('no_community_page', t("Show Community Page"), !get_config('system','no_community_page'), "Display a Community page showing all recent public postings on this site."),
'$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !get_config('system','ostatus_disable'), "Provide built-in OStatus \x28identi.ca, status.net, etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed."),
'$diaspora_enabled' => array('diaspora_enabled', t("Enable Diaspora support"), get_config('system','diaspora_enabled'), "Provide built-in Diaspora network compatibility."),
'$dfrn_only' => array('dfrn_only', t('Only allow Friendika contacts'), get_config('system','dfrn_only'), "All contacts must use Friendika protocols. All other built-in communication protocols disabled."),
'$verifyssl' => array('verifyssl', t("Verify SSL"), get_config('system','verifyssl'), "If you wish, you can turn on strict certificate checking. This will mean you cannot connect (at all) to self-signed SSL sites."),
'$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),

View file

@ -87,25 +87,15 @@ function contacts_post(&$a) {
$priority = intval($_POST['poll']);
if($priority == (-1))
if($priority > 5 || $priority < 0)
$priority = 0;
$rating = intval($_POST['reputation']);
if($rating > 5 || $rating < 0)
$rating = 0;
$reason = notags(trim($_POST['reason']));
$info = escape_tags(trim($_POST['info']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `rating` = %d, `reason` = '%s', `info` = '%s'
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s'
WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id),
intval($priority),
intval($rating),
dbesc($reason),
dbesc($info),
intval($contact_id),
intval(local_user())
@ -163,9 +153,9 @@ function contacts_content(&$a) {
if($cmd === 'block') {
$blocked = (($orig_record[0]['blocked']) ? 0 : 1);
$r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($blocked),
intval($contact_id),
intval(local_user())
intval($blocked),
intval($contact_id),
intval(local_user())
);
if($r) {
//notice( t('Contact has been ') . (($blocked) ? t('blocked') : t('unblocked')) . EOL );
@ -178,9 +168,9 @@ function contacts_content(&$a) {
if($cmd === 'ignore') {
$readonly = (($orig_record[0]['readonly']) ? 0 : 1);
$r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($readonly),
intval($contact_id),
intval(local_user())
intval($readonly),
intval($contact_id),
intval(local_user())
);
if($r) {
info( (($readonly) ? t('Contact has been ignored') : t('Contact has been unignored')) . EOL );
@ -193,7 +183,7 @@ function contacts_content(&$a) {
// create an unfollow slap
if($orig_record[0]['network'] === 'stat') {
if($orig_record[0]['network'] === NETWORK_OSTATUS) {
$tpl = get_markup_template('follow_slap.tpl');
$slap = replace_macros($tpl, array(
'$name' => $a->user['username'],
@ -215,13 +205,15 @@ function contacts_content(&$a) {
slapper($a->user,$orig_record[0]['notify'],$slap);
}
}
if($orig_record[0]['network'] === 'dfrn') {
elseif($orig_record[0]['network'] === NETWORK_DIASPORA) {
require_once('include/diaspora.php');
diaspora_unshare($a->user,$orig_record[0]);
}
elseif($orig_record[0]['network'] === NETWORK_DFRN) {
require_once('include/items.php');
dfrn_deliver($a->user,$orig_record[0],'placeholder', 1);
}
contact_remove($orig_record[0]['id']);
info( t('Contact has been removed.') . EOL );
goaway($a->get_baseurl() . '/contacts');
@ -275,8 +267,6 @@ function contacts_content(&$a) {
$sparkle = '';
}
$grps = '';
$insecure = '<div id="profile-edit-insecure"><p><img src="images/unlock_icon.gif" alt="' . t('Privacy Unavailable') . '" />&nbsp;'
. t('Private communications are not available for this contact.') . '</p></div>';
@ -290,6 +280,9 @@ function contacts_content(&$a) {
$lblsuggest = (($r[0]['network'] === NETWORK_DFRN)
? '<div id="contact-suggest-wrapper"><a href="fsuggest/' . $r[0]['id'] . '" id="contact-suggest">' . t('Suggest friends') . '</a></div>' : '');
$poll_enabled = (($r[0]['network'] !== NETWORK_DIASPORA) ? true : false);
$nettype = '<div id="contact-edit-nettype">' . sprintf( t('Network type: %s'),network_to_name($r[0]['network'])) . '</div>';
$o .= replace_macros($tpl,array(
'$header' => t('Contact Editor'),
@ -308,9 +301,10 @@ function contacts_content(&$a) {
'$lblcrepair' => t("Repair contact URL settings \x28WARNING: Advanced\x29"),
'$lblrecent' => t('View conversations'),
'$lblsuggest' => $lblsuggest,
'$grps' => $grps,
'$delete' => t('Delete contact'),
'$poll_interval' => contact_poll_interval($r[0]['priority']),
'$nettype' => $nettype,
'$poll_interval' => contact_poll_interval($r[0]['priority'],(! $poll_enabled)),
'$poll_enabled' => $poll_enabled,
'$lastupdtext' => t('Last updated: '),
'$updpub' => t('Update public posts: '),
'$last_update' => $last_update,
@ -323,9 +317,6 @@ function contacts_content(&$a) {
'$info' => $r[0]['info'],
'$blocked' => (($r[0]['blocked']) ? '<div id="block-message">' . t('Currently blocked') . '</div>' : ''),
'$ignored' => (($r[0]['readonly']) ? '<div id="ignore-message">' . t('Currently ignored') . '</div>' : ''),
'$rating' => contact_reputation($r[0]['rating']),
'$reason' => $r[0]['reason'],
'$groups' => '', // group_selector(),
'$photo' => $r[0]['photo'],
'$name' => $r[0]['name'],
'$dir_icon' => $dir_icon,
@ -420,11 +411,12 @@ function contacts_content(&$a) {
$o .= replace_macros($tpl, array(
'$img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
'$edit_hover' => t('Edit contact'),
'$contact_photo_menu' => contact_photo_menu($rr),
'$id' => $rr['id'],
'$alt_text' => $alt_text,
'$dir_icon' => $dir_icon,
'$thumb' => $rr['thumb'],
'$name' => substr($rr['name'],0,20),
'$name' => $rr['name'],
'$username' => $rr['name'],
'$sparkle' => $sparkle,
'$url' => $url

View file

@ -15,6 +15,8 @@
*
*/
require_once('include/crypto.php');
function item_post(&$a) {
if((! local_user()) && (! remote_user()))
@ -674,6 +676,27 @@ function item_post(&$a) {
pop_lang();
}
// We won't be able to sign Diaspora comments for authenticated visitors - we don't have their private key
if($self) {
require_once('include/bb2diaspora.php');
$signed_body = html_entity_decode(bb2diaspora($datarray['body']));
$myaddr = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
if($datarray['verb'] === ACTIVITY_LIKE)
$signed_text = $datarray['guid'] . ';' . 'Post' . ';' . $parent_item['guid'] . ';' . 'true' . ';' . $myaddr;
else
$signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $myaddr;
$authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha'));
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($post_id),
dbesc($signed_text),
dbesc(base64_encode($authorsig)),
dbesc($myaddr)
);
}
}
else {
$parent = $post_id;
@ -799,6 +822,12 @@ function item_post(&$a) {
}
}
logger('post_complete');
// figure out how to return, depending on from whence we came

View file

@ -188,7 +188,7 @@ function network_content(&$a, $update = 0) {
if(count($r)) {
$sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $star_sql AND `contact-id` IN ( " . intval($cid) . " )) ";
$o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o;
if($r[0]['network'] !== NETWORK_MAIL && $r[0]['network'] !== NETWORK_DFRN && $r[0]['network'] !== NETWORK_FACEBOOK && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
if($r[0]['network'] !== NETWORK_MAIL && $r[0]['network'] !== NETWORK_DFRN && $r[0]['network'] !== NETWORK_FACEBOOK && $r[0]['network'] !== NETWORK_DIASPORA && $r[0]['writable'] && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
notice( t('Private messages to this person are at risk of public disclosure.') . EOL);
}

View file

@ -55,7 +55,8 @@ function openid_content(&$a) {
}
$r = q("SELECT * FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
$r = q("SELECT `user`.*, `user`.`pubkey` as `upubkey`, `user`.`prvkey` as `uprvkey`
FROM `user` WHERE `openid` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1",
dbesc($_SESSION['openid'])
);
if(! count($r)) {

View file

@ -122,6 +122,12 @@ function pubsub_post(&$a) {
$contact = $r[0];
// we have no way to match Diaspora guid's with atom post id's and could get duplicates.
// we'll assume that direct delivery is robust (and this is a bad assumption, but the duplicates are messy).
if($r[0]['network'] === NETWORK_DIASPORA)
hub_post_return();
$feedhub = '';
require_once('include/items.php');

View file

@ -15,8 +15,6 @@ function receive_post(&$a) {
if($a->argc != 3 || $a->argv[1] !== 'users')
http_status_exit(500);
logger('receive: raw input: ' . file_get_contents('php://input'), LOGGER_DATA);
$guid = $a->argv[2];
$r = q("SELECT * FROM `user` WHERE `guid` = '%s' LIMIT 1",
@ -43,29 +41,7 @@ function receive_post(&$a) {
if(! is_array($msg))
http_status_exit(500);
$parsed_xml = parse_xml_string($msg['message'],false);
$xmlbase = $parsed_xml->post;
if($xmlbase->request) {
diaspora_request($importer,$xmlbase->request);
}
elseif($xmlbase->status_message) {
diaspora_post($importer,$xmlbase->status_message);
}
elseif($xmlbase->comment) {
diaspora_comment($importer,$xmlbase->comment,$msg);
}
elseif($xmlbase->like) {
diaspora_like($importer,$xmlbase->like,$msg);
}
elseif($xmlbase->retraction) {
diaspora_retraction($importer,$xmlbase->retraction,$msg);
}
else {
logger('mod-diaspora: unknown message type: ' . print_r($xmlbase,true));
}
diaspora_dispatch($importer,$msg);
http_status_exit(200);
// NOTREACHED

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1081 );
define( 'UPDATE_VERSION' , 1084 );
/**
*
@ -673,4 +673,37 @@ function update_1079() {
function update_1080() {
q("ALTER TABLE `fcontact` ADD `updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
}
function update_1081() {
// there was a typo in update 1081 so it was corrected and moved up to 1082
}
function update_1082() {
q("ALTER TABLE `photo` ADD `guid` CHAR( 64 ) NOT NULL AFTER `contact-id`,
ADD INDEX ( `guid` ) ");
// make certain the following code is only executed once
$r = q("select `id` from `photo` where `guid` != '' limit 1");
if($r && count($r))
return;
$r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`");
if(count($r)) {
foreach($r as $rr) {
$guid = get_guid();
q("update `photo` set `guid` = '%s' where `resource-id` = '%s'",
dbesc($guid),
dbesc($rr['resource-id'])
);
}
}
}
function update_1083() {
q("CREATE TABLE IF NOT EXISTS `deliverq` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`cmd` CHAR( 32 ) NOT NULL ,
`item` INT NOT NULL ,
`contact` INT NOT NULL
) ENGINE = MYISAM ;");
}

View file

@ -31,6 +31,7 @@
{{ inc field_checkbox.tpl with $field=$force_publish }}{{ endinc }}
{{ inc field_checkbox.tpl with $field=$no_community_page }}{{ endinc }}
{{ inc field_checkbox.tpl with $field=$ostatus_disabled }}{{ endinc }}
{{ inc field_checkbox.tpl with $field=$diaspora_enabled }}{{ endinc }}
{{ inc field_checkbox.tpl with $field=$dfrn_only }}{{ endinc }}
{{ inc field_input.tpl with $field=$global_directory }}{{ endinc }}

View file

@ -83,7 +83,7 @@
<poco:primary>true</poco:primary>
</poco:urls>
</author>
<link rel="ostatus:conversation" href="$status.url"/>
<link rel="ostatus:conversation" type="text/html" href="$status.url"/>
</entry>
{{ endfor }}

View file

@ -3,6 +3,8 @@
<div id="contact-edit-banner-name">$name</div>
$nettype
<form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id">
@ -28,13 +30,14 @@
</div>
<div id="contact-edit-nav-end"></div>
{{ if $poll_enabled }}
<div id="contact-edit-poll-wrapper">
<div id="contact-edit-last-update-text">$lastupdtext<span id="contact-edit-last-updated">$last_update</span></div>
<div id="contact-edit-poll-text">$updpub</div>
$poll_interval
<div id="contact-edit-update-now"><a href="contacts/$contact_id/update">$udnow</a></div>
<div id="contact-edit-update-now"><a href="contacts/$contact_id/update" >$udnow</a></div>
</div>
{{ endif }}
</div>
<div id="contact-edit-end" ></div>
@ -42,8 +45,6 @@ $insecure
$blocked
$ignored
$grps
<div id="view-recent-wrapper"><a href="network/?cid=$contact_id" id="contact-view-recent">$lblrecent</a></div>
$lblsuggest
@ -65,24 +66,5 @@ $profile_select
<input class="contact-edit-submit" type="submit" name="submit" value="$submit" />
<div id="contact-edit-rating-wrapper">
<h4>$lbl_rep1</h4>
<p>
$lbl_rep2 $lbl_rep3
</p>
<div id="contact-edit-rating-select-wrapper">
$rating
</div>
<div id="contact-edit-rating-explain">
<p>
$lbl_rep4
</p>
<textarea id="contact-edit-rating-text" name="reason" rows="3" cols="64" >$reason</textarea>
</div>
</div>
$groups
<input class="contact-edit-submit" type="submit" name="submit" value="$submit" />
</form>
</div>

View file

@ -1,19 +1,18 @@
<div class="contact-entry-wrapper" id="contact-entry-wrapper-$id" >
<div class="contact-entry-photo-wrapper" >
<div class="contact-entry-nav-wrapper" >
<div class="contact-entry-direction-wrapper" >
<img class="contact-entry-direction-icon" src="$dir_icon" alt="$alt_text" title="$alt_text" />
</div>
<div class="contact-entry-direction-end" ></div>
<div class="contact-entry-edit-links" >
<a class="icon pencil" href="contacts/$id" class="contact-entry-edit-link" title="$edit_hover"></a>
</div>
<div class="contact-entry-edit-end"></div>
</div>
<div class="contact-entry-nav-end"></div>
<div class="contact-entry-photo" id="contact-entry-photo-$id" >
<div class="contact-entry-photo" id="contact-entry-photo-$id"
onmouseover="if (typeof t$id != 'undefined') clearTimeout(t$id); openMenu('contact-photo-menu-button-$id')" onmouseout="t$id=setTimeout('closeMenu(\'contact-photo-menu-button-$id\'); closeMenu(\'contact-photo-menu-$id\');',200)" >
<a href="$url" title="$img_hover" /><img src="$thumb" $sparkle alt="$name" /></a>
<span onclick="openClose('contact-photo-menu-$id');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-$id">menu</span>
<div class="contact-photo-menu" id="contact-photo-menu-$id">
<ul>
$contact_photo_menu
</ul>
</div>
</div>
</div>

View file

@ -380,8 +380,8 @@ $a->strings["View New Items"] = "Neue Einträge anzeigen";
$a->strings["View Any Items"] = "Alle Einträge anzeigen";
$a->strings["View Starred Items"] = "Gesternte Einträge anzeigen";
$a->strings["Warning: This group contains %s member from an insecure network."] = array(
0 => "",
1 => "",
0 => "Warnung: Diese Gruppe beinhaltet %s Mitglied aus unsicheren Netzwerken.",
1 => "Warnung: Diese Gruppe beinhaltet %s Mitglieder aus unsicheren Netzwerken.",
);
$a->strings["Private messages to this group are at risk of public disclosure."] = "Private Nachrichten an diese Gruppe könnten an die Öffentlichkeit geraten.";
$a->strings["No such group"] = "Es gibt keine solche Gruppe";

13
view/diaspora_photo.tpl Normal file
View file

@ -0,0 +1,13 @@
<XML>
<post>
<photo>
<remote_photo_path>$path</remote_photo_path>
<remote_photo_name>$filename</remote_photo_name>
<status_message_guid>$msg_guid</status_message_guid>
<guid>$guid</guid>
<diaspora_handle>$handle</diaspora_handle>
<public>$public</public>
<created_at>$created_at</created_at>
</photo>
</post>
</XML>

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
<?php
function string_plural_select($n){
return ;
return ($n != 1);
}
;
$a->strings["Logged out."] = "Déconnecté.";
@ -367,7 +367,7 @@ $a->strings["Global Directory"] = "Annuaire global";
$a->strings["Finding: "] = "Trouvé: ";
$a->strings["View Contacts"] = "Voir les contacts";
$a->strings["No contacts."] = "Aucun contact.";
$a->strings["Visit \$username's profile"] = "Visiter le profil de %s";
$a->strings["Visit \$username's profile"] = "Visiter le profil de \$username";
$a->strings["No profile"] = "Aucun profil";
$a->strings["Tag removed"] = "Étiquette enlevée";
$a->strings["Remove Item Tag"] = "Enlever l'étiquette de l'élément";
@ -394,7 +394,7 @@ $a->strings["(Toggle between different identities or community/group pages which
$a->strings["Select an identity to manage: "] = "Choisir une identité à gérer: ";
$a->strings["noreply"] = "noreply";
$a->strings["New mail received at "] = "Nouvel email reçu à ";
$a->strings["%s commented on an item at %s"] = "%s a commanté sur une publication : %s";
$a->strings["%s commented on an item at %s"] = "%s a commenté sur une publication : %s";
$a->strings["%s welcomes %s"] = "%s accueille %s";
$a->strings["This introduction has already been accepted."] = "Cette introduction a déjà été acceptée.";
$a->strings["Profile location is not valid or does not contain profile information."] = "L'emplacement du profil est invalide ou ne contient pas de profil valide.";
@ -676,7 +676,7 @@ $a->strings["%d member"] = array(
1 => "%d membres",
);
$a->strings["Warning: This group contains %s from an insecure network."] = "Attention : ce groupe contient %s, qui se connecte depuis un réseau non-sécurisé.";
$a->strings["Private messages to this group are at risk of public disclosure."] = "Les messages privés envoyés à ce groupe s'exposent à une diffusion incontrôlée.";
$a->strings["Private messages to this group are at risk of public disclosure."] = "es messages privés envoyés à ce groupe s'exposent à une diffusion incontrôlée.";
$a->strings["D, d M Y - g:i A"] = "D, d M Y - g:i A";
$a->strings["Friendika Social Network"] = "Réseau social Friendika";
$a->strings["Installation"] = "Installation";
@ -689,9 +689,9 @@ $a->strings["Database Login Password"] = "Mot de passe de la base";
$a->strings["Database Name"] = "Nom de la base";
$a->strings["Please select a default timezone for your website"] = "Sélectionner un fuseau horaire par défaut pour votre site";
$a->strings["Normal Account"] = "Compte normal";
$a->strings["This account is a normal personal profile"] = "Ce compte correspond à un profil normal, pour une seule personne (physique, généralement)";
$a->strings["This account is a normal personal profile"] = "e compte correspond à un profil normal, pour une seule personne (physique, généralement)";
$a->strings["Soapbox Account"] = "Compte \"boîte à savon\"";
$a->strings["Automatically approve all connection/friend requests as read-only fans"] = "Accepter automatiquement toutes les demandes d'amitié/connexion comme étant des fans 'en lecture seule'";
$a->strings["Automatically approve all connection/friend requests as read-only fans"] = "ccepter automatiquement toutes les demandes d'amitié/connexion comme étant des fans 'en lecture seule'";
$a->strings["Community/Celebrity Account"] = "Compte de communauté/célébrité";
$a->strings["Automatically approve all connection/friend requests as read-write fans"] = "Accepter automatiquement toutes les demandes d'amitié/connexion comme étant des fans en 'lecture/écriture'";
$a->strings["Automatic Friend Account"] = "Compte auto-amical";
@ -770,3 +770,319 @@ $a->strings["Invalid profile identifier."] = "Identifiant de profil invalide.";
$a->strings["Profile Visibility Editor"] = "Éditer la visibilité du profil";
$a->strings["Visible To"] = "Visible par";
$a->strings["All Contacts (with secure profile access)"] = "Tous les contacts (ayant un accès sécurisé)";
$a->strings["(click to open/close)"] = "(cliquer pour ouvrir/fermer)";
$a->strings["Contact settings applied."] = "Réglages du contact appliqués.";
$a->strings["Contact update failed."] = "Echec lors de la mise à jour du contact.";
$a->strings["Repair Contact Settings"] = "Réparer les réglages du contact";
$a->strings["<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact will stop working."] = "<strong>ATTENTION: Ceci est à réserver aux utilisateurs avancés</strong> et pourrait bloquer vos communications avec ce contact en cas d'erreur.";
$a->strings["Please use your browser 'Back' button <strong>now</strong> if you are uncertain what to do on this page."] = "Merci d'utiliser le bouton 'Précédent' <strong>tout de suite</strong> si vous avez le moindre doute.";
$a->strings["Name"] = "Nom";
$a->strings["Account Nickname"] = "Pseudo du compte";
$a->strings["Account URL"] = "URL du compte";
$a->strings["Friend Request URL"] = "URL de requête";
$a->strings["Friend Confirm URL"] = "URL de confirmation";
$a->strings["Notification Endpoint URL"] = "URL de notification";
$a->strings["Poll/Feed URL"] = "URL de poll/feed";
$a->strings["Repair contact URL settings"] = "Réparer les URLs du contact";
$a->strings["Repair contact URL settings (WARNING: Advanced)"] = "Réparer les URLs du contact (ATTENTION: procédure avancée)";
$a->strings["(no subject)"] = "(aucun sujet)";
$a->strings["Welcome "] = "Bienvenue ";
$a->strings["Please upload a profile photo."] = "Merci de téléverser une photo pour votre profil.";
$a->strings["%1\$s is now friends with %2\$s"] = "%1\$s est désormais relié à %2\$s";
$a->strings["View recent"] = "Voir les nouveautés";
$a->strings["Visible to <strong>everybody</strong>"] = "Visible par <strong>tout le monde</strong>";
$a->strings["Post to Email"] = "Transmettre par courriel";
$a->strings["Image/photo"] = "Image/photo";
$a->strings["Updating contacts"] = "Mettre les contacts à jour";
$a->strings["Install Facebook connector for this account."] = "Activer le connecteur Facebook pour ce compte.";
$a->strings["Remove Facebook connector"] = "Désactiver le connecteur Facebook";
$a->strings["Post to Facebook cancelled because of multi-network access permission conflict."] = "Envoi vers Facebook annulé à cause d'un conflit dans les permissions d'accès aux réseaux tiers.";
$a->strings["View on Friendika"] = "Voir sur Friendika";
$a->strings["Contact: "] = "Contact: ";
$a->strings["Private messages to this person are at risk of public disclosure."] = "Les messages privés destinés à cette personne risquent des fuites.";
$a->strings["Invalid contact."] = "Contact invalide.";
$a->strings["Public access denied."] = "Accès public refusé.";
$a->strings["Your Identity Address is"] = "L'adresse de votre identité est";
$a->strings["Email/Mailbox Setup"] = "Réglages Courriel/Boîte";
$a->strings["If you wish to communicate with email contacts using this service (optional), please specify how to connect to your mailbox."] = "Si vous souhaitez communiquer avec vos contacts 'courriel' via ce service (facultatif), indiquez comment vous connecter à votre boîte.";
$a->strings["IMAP server name:"] = "Serveur IMAP:";
$a->strings["IMAP port:"] = "Port:";
$a->strings["Security (TLS or SSL):"] = "Sécurité (TLS ou SSL):";
$a->strings["Email login name:"] = "Identifiant courriel:";
$a->strings["Email password:"] = "Mot de passe courriel:";
$a->strings["Reply-to address (Optional):"] = "Adresse de réponse (facultatif):";
$a->strings["Send public posts to all email contacts:"] = "Envoyer les entrées publiques à tous les contacts courriel:";
$a->strings["Email access is disabled on this site."] = "L'accès par courriel est désactivé sur ce site.";
$a->strings["You may visit them online at %s"] = "Vous pouvez leur rendre visite à %s";
$a->strings["skip this step"] = "ignorer cette étape";
$a->strings["Help:"] = "Aide:";
$a->strings["Examples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo, testuser@identi.ca"] = "Exemples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo, utilisateur@identi.ca";
$a->strings["Please enter your 'Identity Address' from one of the following supported social networks:"] = "Merci d'indiquer votre 'Adresse d'identité' issue de l'un des réseaux sociaux supportés:";
$a->strings["Your Identity Address:"] = "Adresse de votre identité:";
$a->strings["View conversations"] = "Voir conversations";
$a->strings["event"] = "[[event]]";
$a->strings["%s from %s"] = "[[%s from %s]]";
$a->strings["Select"] = "Sélectionner";
$a->strings["toggle star status"] = "(dé)marquer d'une étoile";
$a->strings["Delete Selected Items"] = "Supprimer les éléments selectionnés";
$a->strings["Attach file"] = "Joindre un fichier";
$a->strings["Public post"] = "Entrée publique";
$a->strings["bytes"] = "octets";
$a->strings["Select an alternate language"] = "Choisir une langue complémentaire";
$a->strings["show"] = "montrer";
$a->strings["don't show"] = "ne pas montrer";
$a->strings["l F d, Y \\@ g:i A"] = "l F d, Y \\@ g:i A";
$a->strings["Starts:"] = "Commence:";
$a->strings["Finishes:"] = "Termine:";
$a->strings["Sharing notification from Diaspora network"] = "Partager les notifications du réseau Diaspora";
$a->strings["link"] = "lien";
$a->strings["From: "] = "De:";
$a->strings["never"] = "jamais";
$a->strings["End this session"] = "Terminer cette session";
$a->strings["Sign in"] = "Se connecter";
$a->strings["Home Page"] = "Page d'accueil";
$a->strings["Create an account"] = "Créer un compte";
$a->strings["Help and documentation"] = "Aide et documentation";
$a->strings["Addon applications, utilities, games"] = "Applications supplémentaires, utilitaires, jeux";
$a->strings["Search site content"] = "Rechercher dans le contenu du site";
$a->strings["Community"] = "Place publique";
$a->strings["Conversations on this site"] = "Conversations sur ce site";
$a->strings["People directory"] = "Annuaire";
$a->strings["Conversations from your friends"] = "Conversations de vos amis";
$a->strings["Your posts and conversations"] = "Vos conversations et entrées";
$a->strings["Friend requests"] = "Demandes de connexion/amitié";
$a->strings["Private mail"] = "Courriel privé";
$a->strings["Manage other pages"] = "Gérer les autres pages";
$a->strings["Account settings"] = "Réglages du compte";
$a->strings["Manage/edit profiles"] = "Gérer/éditer les profils";
$a->strings["Manage/edit friends and contacts"] = "Gérer/éditer les amis et contacts";
$a->strings["Admin"] = "Admin";
$a->strings["Site setup and configuration"] = "Configuration du site";
$a->strings["This website is tracked using the <a href='http://www.piwik.org'>Piwik</a> analytics tool."] = "Ce site construit ses statistiques grâce à <a href='http://www.piwik.org'>Piwik</a>.";
$a->strings["If you do not want that your visits are logged this way you <a href='%s'>can set a cookie to prevent Piwik from tracking further visits of the site</a> (opt-out)."] = "Si vous ne souhaitez pas que vos visites soient comptabilisées de cette manière, vous pouvez <a href='%s'>activer un cookie qui internet à Piwik d'en tenir compte à l'avenir</a> (mécanisme d'opt-out).";
$a->strings["Piwik Base URL"] = "URL de base de Piwik";
$a->strings["Site ID"] = "ID du site";
$a->strings["Show opt-out cookie link?"] = "Montrer le lien du cookie d'opt-out?";
$a->strings["Link all your Facebook friends and conversations"] = "Relier tous vos amis et conversations Facebook";
$a->strings["Warning: Your Facebook privacy settings can not be imported."] = "Attention: vos réglages de vie privée ne pourront être importés de Facebook.";
$a->strings["Linked Facebook items <strong>may</strong> be publicly visible, depending on your privacy settings for this website/account."] = "Les éléments liés depuis Facebook <strong>pourront</strong> être visibles publiquement, selon les réglages.";
$a->strings["Facebook post failed. Queued for retry."] = "Echec temporaire de l'envoi vers Facebook.";
$a->strings["Generate new key"] = "Générer une nouvelle clé";
$a->strings["Widgets key"] = "Clé des widgets";
$a->strings["Widgets available"] = "Widgets disponibles";
$a->strings["Connect on Friendika!"] = "Relier par Friendika!";
$a->strings["OEmbed settings updated"] = "Réglages OEmbed mis à jour";
$a->strings["Use OEmbed for YouTube videos"] = "Utiliser OEmbed pour les vidéos YouTube";
$a->strings["URL to embed:"] = "URL à incorporer:";
$a->strings["Twitter settings updated."] = "Réglages Twitter mis à jour.";
$a->strings["If enabled all your <strong>public</strong> postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry."] = "Si activé, toutes vos entrées <strong>publiques</strong> pourront être postées sur le compte Twitter associé. Vous pouvez choisir de le faire par défaut (ici) ou pour chaque entrée séparément dans les options de la-dite entrée.";
$a->strings["Allow posting to Twitter"] = "Autoriser à poster vers Twitter";
$a->strings["Send public postings to Twitter by default"] = "Envoyer les entrées publiques vers Twitter par défaut";
$a->strings["Consumer key"] = "Consumer key";
$a->strings["Consumer secret"] = "Consumer secret";
$a->strings["Impressum"] = "Mentions légales";
$a->strings["Site Owner"] = "Propriétaire du site";
$a->strings["Email Address"] = "Courriel";
$a->strings["Postal Address"] = "Adresse postale";
$a->strings["The impressum addon needs to be configured!<br />Please add at least the <tt>owner</tt> variable to your config file. For other variables please refer to the README file of the addon."] = "Les mentions légales ont besoin d'être paramêtrées!<br />Merci d'ajouter au moins le <tt>propriétaire</tt> à votre configuration. Pour les autres variables, merci de vous référer au README de l'extension.";
$a->strings["Site Owners Profile"] = "Profil du propriétaire";
$a->strings["Notes"] = "Notes";
$a->strings["Please contact your site administrator.<br />The provided API URL is not valid."] = "Merci de contacter l'administrateur.<br />L'URL d'API fournie n'est pas valide.";
$a->strings["We could not contact the StatusNet API with the Path you entered."] = "Impossible de contacter l'API StatusNet avec le chemin fourni.";
$a->strings["StatusNet settings updated."] = "Réglages StatusNet mis à jour.";
$a->strings["Globally Available StatusNet OAuthKeys"] = "Clé OAuth globales de StatusNet";
$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)."] = "Voici quelques paires de clés OAuth correspondant à quelques serveurs courants. Si vous utilisez l'un d'entre eux, merci d'utiliser la paire fournie. Sinon, vous pouvez toujours vous connecter à l'instance StatusNet de votre choix (voir plus bas).";
$a->strings["Provide your own OAuth Credentials"] = "Entrez vos coordonnées OAuth manuellement";
$a->strings["Cancel Connection Process"] = "Annuler la mise en relation";
$a->strings["Current StatusNet API is"] = "L'API StatusNet actuelle est";
$a->strings["Cancel StatusNet Connection"] = "Annuler la connexion à StatusNet";
$a->strings["If enabled all your <strong>public</strong> postings can be posted to the associated StatusNet account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry."] = "Si activé, toutes vos entrées <strong>publiques</strong> pourront être postées sur le compte StatusNet associé. Vous pouvez choisir de le faire par défaut (ici) ou pour chaque entrée séparément dans les options de la-dite entrée.";
$a->strings["Allow posting to StatusNet"] = "Autoriser à poster vers StatusNet";
$a->strings["Send public postings to StatusNet by default"] = "Envoyer les entrées publiques vers StatusNet par défaut";
$a->strings["Site name"] = "Nom du site";
$a->strings["API URL"] = "URL de l'API";
$a->strings["Consumer Secret"] = "Consumer Secret";
$a->strings["Consumer Key"] = "Consumer Key";
$a->strings["Hide your contact/friend list from viewers of this profile?"] = "Cacher vos amis/contacts des visiteurs de ce profil?";
$a->strings["Birthday (%s):"] = "Date de naissance (%s):";
$a->strings["visible to everybody"] = "visible par tout le monde";
$a->strings["Events"] = "Evènements";
$a->strings["Personal Notes"] = "Notes personnelles";
$a->strings["Save"] = "Enregistrer";
$a->strings["An invitation is required."] = "Une invitation est requise.";
$a->strings["Invitation could not be verified."] = "L'invitation n'a pu être vérifiée.";
$a->strings["Membership on this site is by invitation only."] = "L'inscription à ce site se fait sur invitation uniquement.";
$a->strings["Your invitation ID: "] = "Votre invitation: ";
$a->strings["Welcome to Friendika"] = "Bienvenue sur Friendika";
$a->strings["New Member Checklist"] = "Checklist du nouvel inscrit";
$a->strings["We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page."] = "Nous souhaitons vous offrir quelques astuces et pointeurs pour vous aider à faire de votre passage ici un moment agréable. Cliquez sur les éléments suivants pour visiter les pages adéquates.";
$a->strings["On your <em>Settings</em> page - change your initial password. Also make a note of your Identity Address. This will be useful in making friends."] = "Sur votre page <em>Réglages</em> - vous pouvez modifier votre mot de passe. Par ailleurs, notez bien l'adresse de votre identité : elle sera fort utile pour vous faire des amis.";
$a->strings["Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you."] = "";
$a->strings["Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not."] = "Téléversez (c'est-à-dire envoyez-nous) une photo de profil si vous ne l'avez déjà fait. Les études montrent que les gens qui utilisent une vraie photo d'eux sont dix fois plus susceptibles de se faire de nouveaux amis que les autres.";
$a->strings["Authorise the Facebook Connector if you currently have a Facebook account and we will (optionally) import all your Facebook friends and conversations."] = "Activez le connecteur Facebook si vous avez un compte sur ce service, et nous pourrons (de manière facultative) importer tous vos amis et conversations.";
$a->strings["Enter your email access information on your Settings page if you wish to import and interact with friends or mailing lists from your email INBOX"] = "Renseignez la page Réglages à propos de votre accès à vos courriels si vous souhaitez interagir avec des amis ou des listes de diffusion issues de votre boîte de réception";
$a->strings["Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors."] = "Pensez à éditer votre profil <strong>par défaut</strong> à votre convenance. Vérifiez bien les réglages permettant de cacher vos informations aux visiteurs inconnus.";
$a->strings["Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships."] = "Choisissez quelques mots-clés publiques pour votre profil par défaut. Vous pourrez ainsi décrire vos centres d'intérêt, et nous pourrons vous suggérer des amis les partageant.";
$a->strings["Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Connect</em> dialog."] = "Votre page Contacts est l'endroit idéal pour gérer vos relations et vous connecter à des amis issus d'autres réseaux. En général, il suffit de saisir leur adresse dans la section <em>Relier</em>.";
$a->strings["The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested."] = "L'Annuaire vous permet de rechercher d'autres personnes au sein de ce réseau, ou dans l'ensemble des sites fédérés. Cherchez un lien nommé <em>Relier</em>, <em>Connect</em> ou <em>Follow</em> sur leurs profils. Vous aurez peut-être à fournir votre propre adresse d'identité.";
$a->strings["Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page."] = "Une fois que vous aurez retrouvé quelques amis ou contacts, vous pourrez les classer en groupes depuis le panneau latéral de votre page Contacts. Vous serez désormais en mesure d'interagir avec chaque groupe de manière exclusive et privée depuis la page Réseau.";
$a->strings["Our <strong>help</strong> pages may be consulted for detail on other program features and resources."] = "Nos pages d'<strong>aide</strong> peuvent être consultées pour davantage d'informations sur les fonctionnalités et procédures du réseau.";
$a->strings["No keywords to match. Please add keywords to your default profile."] = "Aucun mot-clé ne correspond. Merci d'ajouter quelques mots-clés à votre profil par défaut.";
$a->strings["[Embedded content - reload page to view]"] = "[Contenu incorporé - rechargez la page]";
$a->strings["No installed applications."] = "Pas d'application installée.";
$a->strings["View Conversations"] = "Voir par conversation";
$a->strings["View New Items"] = "Voir les nouveautés";
$a->strings["View Any Items"] = "Tout voir";
$a->strings["View Starred Items"] = "Voir les favoris";
$a->strings["Warning: This group contains %s member from an insecure network."] = array(
0 => "Ce groupe contient %s membre issu d'un réseau non-fiable.",
1 => "Ce groupe contient %s membres issus de réseaux non-fiables.",
);
$a->strings["Access to this profile has been restricted."] = "L'accès à ce profil a été restreint.";
$a->strings["Site"] = "Site";
$a->strings["Users"] = "Utilisateurs";
$a->strings["Plugins"] = "Extensions";
$a->strings["Update"] = "Mises-à-jour";
$a->strings["Logs"] = "Journaux";
$a->strings["User registrations waiting for confirmation"] = "Inscriptions d'utilisateurs en attente de confirmation";
$a->strings["Administration"] = "Administration";
$a->strings["Summary"] = "En résumé";
$a->strings["Registered users"] = "Utilisateurs inscrits";
$a->strings["Pending registrations"] = "Utilisateurs en attente d'inscription";
$a->strings["Version"] = "Version";
$a->strings["Active plugins"] = "Extensions actives";
$a->strings["Site settings updated."] = "Réglages du site appliqués.";
$a->strings["Closed"] = "Fermé";
$a->strings["Requires approval"] = "Après autorisation";
$a->strings["Open"] = "Ouvert";
$a->strings["File upload"] = "Envoi de fichiers";
$a->strings["Policies"] = "Politiques";
$a->strings["Advanced"] = "Avancé";
$a->strings["Banner/Logo"] = "Titre/Logo";
$a->strings["System language"] = "Langue du système";
$a->strings["System theme"] = "Thème du système";
$a->strings["Maximum image size"] = "Taille maximum des images";
$a->strings["Register policy"] = "Politique d'inscription";
$a->strings["Register text"] = "Texte à l'inscription";
$a->strings["Allowed friend domains"] = "Domaines autorisés pour la mise en relation";
$a->strings["Allowed email domains"] = "Domaines autorisés pour les courriels";
$a->strings["Block public"] = "Bloquer public";
$a->strings["Force publish"] = "Forcer la publication";
$a->strings["Global directory update URL"] = "URL de mise à jour de l'annuaire global";
$a->strings["Block multiple registrations"] = "Interdire les inscriptions multiples";
$a->strings["OpenID support"] = "Support d'OpenID";
$a->strings["Gravatar support"] = "Support de Gravatar";
$a->strings["Fullname check"] = "Imposer 'Prénom Nom'";
$a->strings["UTF-8 Regular expressions"] = "Expressions rationnelles en UTF-8";
$a->strings["Show Community Page"] = "Montrer la Place publique";
$a->strings["Enable OStatus support"] = "Activer OStatus";
$a->strings["Enable Diaspora support"] = "Activer Diaspora";
$a->strings["Only allow Friendika contacts"] = "N'autoriser que les contacts Friendika";
$a->strings["Verify SSL"] = "Vérifier SSL";
$a->strings["Proxy user"] = "Utilisateur du proxy";
$a->strings["Proxy URL"] = "URL du proxy";
$a->strings["Network timeout"] = "Délai d'attente du réseau";
$a->strings["%s user blocked"] = array(
0 => "%s utilisateur bloqué",
1 => "%s utilisateurs bloqués/débloqués",
);
$a->strings["%s user deleted"] = array(
0 => "%s utilisateur supprimé",
1 => "%s utilisateurs supprimés",
);
$a->strings["User '%s' deleted"] = "Utilisateur '%s' supprimé";
$a->strings["User '%s' unblocked"] = "Utilisateur '%s' débloqué";
$a->strings["User '%s' blocked"] = "Utilisateur '%s' bloqué";
$a->strings["select all"] = "tout sélectionner";
$a->strings["Request date"] = "Date de la demande";
$a->strings["Email"] = "Courriel";
$a->strings["Block"] = "Bloquer";
$a->strings["Unblock"] = "Débloquer";
$a->strings["Register date"] = "Date d'inscription";
$a->strings["Last login"] = "Dernière connexion";
$a->strings["Last item"] = "Dernière entrée";
$a->strings["Account"] = "Compte";
$a->strings["Selected users will be deleted!\\n\\nEverything these users had posted on this site will be permanently deleted!\\n\\nAre you sure?"] = "Les utilisateurs selectionnés seront supprimés!\\n\\nTout ce qu'ils ont posté sur ce site sera définitivement perdu!\\n\\nÊtes-vous certain?";
$a->strings["The user {0} will be deleted!\\n\\nEverything this user has posted on this site will be permanently deleted!\\n\\nAre you sure?"] = "L'utilisateur {0} sera supprimé!\\n\\nTout ce qu'il a posté sur ce site sera définitivement perdu!\\n\\nÊtes-vous certain?";
$a->strings["Plugin %s disabled."] = "Extension %s désactivée.";
$a->strings["Plugin %s enabled."] = "Extension %s activée.";
$a->strings["Disable"] = "Désactiver";
$a->strings["Enable"] = "Activer";
$a->strings["Toggle"] = "Activer/Désactiver";
$a->strings["Log settings updated."] = "Réglages des journaux mis-à-jour.";
$a->strings["Clear"] = "Remettre à zéro";
$a->strings["Debugging"] = "Débogage";
$a->strings["Log file"] = "Fichier de journal";
$a->strings["Must be writable by web server. Relative to your Friendika index.php."] = "Doit pouvoir être modifié par le serveur web. Chemin relatif à l'index.php de Friendika.";
$a->strings["Log level"] = "Niveau de journalisation";
$a->strings["Close"] = "Fermer";
$a->strings["FTP Host"] = "Hôte FTP";
$a->strings["FTP Path"] = "Chemin FTP";
$a->strings["FTP User"] = "Utilisateur FTP";
$a->strings["FTP Password"] = "Mot de passe FTP";
$a->strings["In order to install Friendika we need to know how to connect to your database."] = "Pour installer Friendika, nous avons besoin des coordonnées de votre base de données.";
$a->strings["The database you specify below should already exist. If it does not, please create it before continuing."] = "La base spécifiée ci-dessous doit exister. Si ce n'est le cas, créez-la avant de continuer.";
$a->strings["Site administrator email address. Your account email address must match this in order to use the web admin panel."] = "Courriel de l'administrateur du site. L'adresse de courriel de votre compte doit correspondre pour pouvoir utiliser la page d'Administration.";
$a->strings["Error: mb_string PHP module required but not installed."] = "Erreur: le module mb_string de PHP est manquant.";
$a->strings["everybody"] = "tout le monde";
$a->strings["Failed to connect with email account using the settings provided."] = "Impossible de se connecter aux courriels avec les réglages fournis.";
$a->strings["Plugin settings"] = "Réglages des extensions";
$a->strings["OpenID:"] = "OpenID:";
$a->strings["(Optional) Allow this OpenID to login to this account."] = "(Facultatif) Autoriser cet OpenID à accéder à ce compte.";
$a->strings["Publish your default profile in your local site directory?"] = "Publier votre profil par défaut dans l'annuaire local?";
$a->strings["Publish your default profile in the global social directory?"] = "Publier votre profil par défaut dans l'annuaire global?";
$a->strings["Hide your contact/friend list from viewers of your default profile?"] = "Masquer vos contacts/amis aux visiteurs de votre profil par défaut?";
$a->strings["Hide profile details and all your messages from unknown viewers?"] = "Masquer vos informations et messages à tous les visiteurs inconnus?";
$a->strings["Automatically expire posts after days:"] = "Expiration automatique des entrées de plus de <em>n</em> jours:";
$a->strings["If empty, posts will not expire. Expired posts will be deleted"] = "Si le champ est vide, les entrées n'expireront pas. L'expiration équivaut à une suppression";
$a->strings["Last successful email check:"] = "Dernière vérification des courriels:";
$a->strings["Security:"] = "Sécurité";
$a->strings["None"] = "Aucune";
$a->strings["Reply-to address:"] = "Adresse de réponse:";
$a->strings["No valid account found."] = "Pas de compte valide trouvé.";
$a->strings["Create New Event"] = "Créer un évènement";
$a->strings["Previous"] = "Précédent";
$a->strings["Next"] = "Suivant";
$a->strings["l, F j"] = "l, F j";
$a->strings["Edit event"] = "Modifier l'évènement";
$a->strings["hour:minute"] = "heure:minute";
$a->strings["Event details"] = "Détails de l'évènement";
$a->strings["Format is %s %s. Starting date and Description are required."] = "Le format est %s %s. La date de début et la description sont obligatoires.";
$a->strings["Event Starts:"] = "Date/heure de début:";
$a->strings["Finish date/time is not known or not relevant"] = "La date/heure de fin est inconnue ou sans objet";
$a->strings["Event Finishes:"] = "Date/heure de fin:";
$a->strings["Adjust for viewer timezone"] = "Ajuster au fuseau horaire du visiteur";
$a->strings["Description:"] = "Description:";
$a->strings["Share this event"] = "Partager cet évènement";
$a->strings["Administrator@"] = "Administrator@";
$a->strings["%s posted to your profile wall at %s"] = "%s a écrit sur votre profil (%s)";
$a->strings["Normal site view"] = "Vue normale";
$a->strings["View all site entries"] = "Vue de toutes les entrées";
$a->strings["Visit %s's profile [%s]"] = "Visiter le profile de %s [%s]";
$a->strings["Not available."] = "Indisponible.";
$a->strings["File exceeds size limit of %d"] = "Le fichier dépasse la limite de %d";
$a->strings["File upload failed."] = "Echec du téléversement.";
$a->strings["Tips for New Members"] = "Astuces pour les nouveaux inscrits";
$a->strings["You have no more invitations available"] = "Vous ne disposez pas d'invitations";
$a->strings["You will need to supply this invitation code: \$invite_code"] = "Vous devrez fournir ce code d'invitation: \$invite_code";
$a->strings["Friend suggestion sent."] = "Suggestion d'amitié envoyée.";
$a->strings["Suggest Friends"] = "Suggérer de amis/contacts";
$a->strings["Suggest a friend for %s"] = "Suggérer un ami/contact pour %s";
$a->strings["Does %s know you?"] = "Est-ce que %s vous connaît?";
$a->strings["This site is not configured to allow communications with other networks."] = "Ce site n'est pas configuré pour permettre les communication avec d'autres réseaux.";
$a->strings["No compatible communication protocols or feeds were discovered."] = "Aucun protocole ou flux compatible n'a pu être découvert.";
$a->strings["An author or name was not found."] = "Impossible de trouver le nom ou l'auteur.";
$a->strings["No browser URL could be matched to this address."] = "Aucune URL ne correspond à cette adresse.";
$a->strings["The profile address specified belongs to a network which has been disabled on this site."] = "L'adresse de profil spécifiée appartient à un réseau dont l'usage a été désactivé sur ce site.";
$a->strings["Item not available."] = "Entrée inaccessible.";
$a->strings["Item was not found."] = "Entrée introuvable.";
$a->strings["Image file is empty."] = "L'image est vide.";
$a->strings["Access to this item is restricted."] = "L'accès à cette entrée est restreint.";
$a->strings["Friend Suggestion"] = "Suggestion d'amitié/contact";
$a->strings["suggested by %s"] = "suggéré(e) par %s";
$a->strings["Sharer"] = "Source du partage";
$a->strings["%d invitation available"] = array(
0 => "%d invitation disponible",
1 => "%d invitations disponibles",
);
$a->strings["Suggest friends"] = "Suggérer des amis/contacts";

View file

@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: friendika\n"
"Report-Msgid-Bugs-To: http://bugs.friendika.com/\n"
"POT-Creation-Date: 2011-08-14 21:17-0700\n"
"PO-Revision-Date: 2011-08-17 17:49+0000\n"
"PO-Revision-Date: 2011-08-26 14:28+0000\n"
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
"Language-Team: Italian (http://www.transifex.net/projects/p/friendika/team/it/)\n"
"MIME-Version: 1.0\n"
@ -2158,7 +2158,7 @@ msgstr "Regitrati"
#: ../../include/diaspora.php:446 ../../include/conversation.php:26
#: ../../include/conversation.php:35
msgid "status"
msgstr "stato"
msgstr "lo stato"
#: ../../mod/like.php:127 ../../addon/facebook/facebook.php:958
#: ../../include/diaspora.php:463 ../../include/conversation.php:43
@ -4420,7 +4420,7 @@ msgstr "Hai un nuovo seguace su "
#: ../../include/conversation.php:23
msgid "event"
msgstr "evento"
msgstr "l'evento"
#: ../../include/conversation.php:213 ../../include/conversation.php:488
#: ../../include/conversation.php:489

View file

@ -459,7 +459,7 @@ $a->strings["Your Email Address: "] = "Il tuo Indirizzo Email: ";
$a->strings["Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be '<strong>nickname@\$sitename</strong>'."] = "Scegli un soprannome. Deve cominciare con un carattere. L'indirizzo del tuo profilo sarà '<strong>soprannome@\$sitename</strong>'.";
$a->strings["Choose a nickname: "] = "Scegli un soprannome: ";
$a->strings["Register"] = "Regitrati";
$a->strings["status"] = "stato";
$a->strings["status"] = "lo stato";
$a->strings["%1\$s likes %2\$s's %3\$s"] = "A %1\$s piace %3\$s di %2\$s";
$a->strings["%1\$s doesn't like %2\$s's %3\$s"] = "A %1\$s non piace %3\$s di %2\$s";
$a->strings["This is Friendika version"] = "Questo è Friendika versione";
@ -985,7 +985,7 @@ $a->strings["show"] = "mostra";
$a->strings["don't show"] = "non mostrare";
$a->strings["(no subject)"] = "(nessun oggetto)";
$a->strings["You have a new follower at "] = "Hai un nuovo seguace su ";
$a->strings["event"] = "evento";
$a->strings["event"] = "l'evento";
$a->strings["View %s's profile"] = "Vedi il profilo di %s";
$a->strings["%s from %s"] = "%s da %s";
$a->strings["View in context"] = "Vedi nel contesto";

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

View file

@ -688,12 +688,17 @@ div[id$="wrapper"] br { clear: left; }
*/
.view-contact-wrapper,
.contact-entry-wrapper { float: left; margin-right: 20px; margin-bottom: 20px; position: relative;}
.contact-entry-wrapper { float: left; margin-right: 20px; margin-bottom: 20px; width: 120px; height: 120px; position: relative;}
.contact-entry-direction-wrapper {position: absolute; top: 20px;}
.contact-entry-edit-links { position: absolute; top: 60px; }
.contact-entry-photo {
margin-left:20px;
}
.contact-entry-name { width: 120px; overflow: hidden; }
.contact-entry-photo {
position: relative;
}
.contact-entry-edit-links .icon {
border: 1px solid #babdb6;
-webkit-border-radius: 3px;
@ -718,7 +723,36 @@ div[id$="wrapper"] br { clear: left; }
#contact-edit-last-update-text { margin-bottom: 15px; }
#contact-edit-last-updated { font-weight: bold; }
#contact-edit-poll-text { display: inline; }
#contact-edit-end { clear: both; }
#contact-edit-end { clear: both; margin-bottom: 65px;}
.contact-photo-menu-button {
position: absolute;
background-image: url("photo-menu.jpg");
background-position: top left;
background-repeat: no-repeat;
margin: 0px; padding: 0px;
width: 16px;
height: 16px;
top: 64px; left:0px;
overflow: hidden;
text-indent: 40px;
display: none;
}
.contact-photo-menu {
width: auto;
border: 2px solid #444444;
background: #FFFFFF;
position: absolute;
left: 0px; top: 90px;
display: none;
z-index: 10000;
}
.contact-photo-menu ul { margin:0px; padding: 0px; list-style: none }
.contact-photo-menu li a { display: block; padding: 2px; }
.contact-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; }
/**
* register, settings & profile forms

View file

@ -743,7 +743,8 @@ input#dfrn-url {
.contact-entry-wrapper {
float: left;
width: 180px;
width: 120px;
height: 120px;
}
.contact-entry-direction-icon {
@ -759,7 +760,9 @@ input#dfrn-url {
}
.contact-entry-name {
float: left;
margin-left: 30px;
margin-left: 0px;
width: 120px;
overflow: hidden;
}
.contact-entry-edit-links {
margin-top: 6px;
@ -777,6 +780,7 @@ input#dfrn-url {
}
.contact-entry-photo {
float: left;
position: relative;
}
.contact-entry-end {
clear: both;
@ -784,6 +788,7 @@ input#dfrn-url {
#contact-edit-end {
clear: both;
margin-bottom: 65px;
}
#fsuggest-desc, #fsuggest-submit-wrapper {
@ -1374,6 +1379,12 @@ input#dfrn-url {
margin-left: 30px;
}
#contact-edit-nettype {
margin-top: 5px;
margin-left: 30px;
}
#contact-edit-poll-wrapper {
margin-left: 50px;
margin-top: 30px;
@ -1458,6 +1469,35 @@ input#dfrn-url {
/*margin-left: 50px;*/
}
.contact-photo-menu-button {
position: absolute;
background-image: url("photo-menu.jpg");
background-position: top left;
background-repeat: no-repeat;
margin: 0px; padding: 0px;
width: 16px;
height: 16px;
top: 64px; left:0px;
overflow: hidden;
text-indent: 40px;
display: none;
}
.contact-photo-menu {
width: auto;
border: 2px solid #444444;
background: #FFFFFF;
position: absolute;
left: 0px; top: 90px;
display: none;
z-index: 10000;
}
.contact-photo-menu ul { margin:0px; padding: 0px; list-style: none }
.contact-photo-menu li a { display: block; padding: 2px; }
.contact-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; }
#block-message, #ignore-message {
margin-top: 20px;
color: #FF0000;

View file

@ -841,7 +841,8 @@ input#dfrn-url {
.contact-entry-wrapper {
float: left;
width: 180px;
width: 120px;
height: 120px;
}
.contact-entry-direction-icon {
@ -857,7 +858,9 @@ input#dfrn-url {
}
.contact-entry-name {
float: left;
margin-left: 30px;
margin-left: 0px;
width: 120px;
oveflow: hidden;
}
.contact-entry-edit-links {
margin-top: 6px;
@ -875,6 +878,7 @@ input#dfrn-url {
}
.contact-entry-photo {
float: left;
position: relative;
}
.contact-entry-end {
clear: both;
@ -882,8 +886,36 @@ input#dfrn-url {
#contact-edit-end {
clear: both;
margin-bottom: 65px;
}
.contact-photo-menu-button {
position: absolute;
background-image: url("photo-menu.jpg");
background-position: top left;
background-repeat: no-repeat;
margin: 0px; padding: 0px;
width: 16px;
height: 16px;
top: 64px; left:0px;
overflow: hidden;
text-indent: 40px;
display: none;
}
.contact-photo-menu {
width: 100px;
border: 2px solid #444444;
background: #FFFFFF;
position: absolute;
left: 0px; top: 90px;
display: none;
z-index: 10000;
}
.contact-photo-menu ul { margin:0px; padding: 0px; list-style: none }
.contact-photo-menu li a { display: block; padding: 2px; }
.contact-photo-menu li a:hover { color: #FFFFFF; background: #3465A4; text-decoration: none; }
#fsuggest-desc, #fsuggest-submit-wrapper {
margin-top: 15px;
@ -1420,6 +1452,11 @@ padding: 5px 10px 0px;
font-weight: bold;
margin-left: 30px;
}
#contact-edit-nettype {
margin-top: 5px;
margin-left: 30px;
}
#contact-edit-poll-wrapper {
margin-left: 50px;