mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:45:16 +02:00
Merge remote branch 'upstream/master'
Conflicts: include/items.php
This commit is contained in:
commit
65268d25e6
55 changed files with 1631 additions and 946 deletions
192
include/api.php
192
include/api.php
|
@ -565,18 +565,19 @@
|
|||
if(requestdata('lat') && requestdata('long'))
|
||||
$_REQUEST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long'));
|
||||
$_REQUEST['profile_uid'] = local_user();
|
||||
if(requestdata('parent'))
|
||||
|
||||
if($parent)
|
||||
$_REQUEST['type'] = 'net-comment';
|
||||
else {
|
||||
$_REQUEST['type'] = 'wall';
|
||||
if(x($_FILES,'media')) {
|
||||
// upload the image if we have one
|
||||
$_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
|
||||
require_once('mod/wall_upload.php');
|
||||
$media = wall_upload_post($a);
|
||||
if(strlen($media)>0)
|
||||
$_REQUEST['body'] .= "\n\n".$media;
|
||||
}
|
||||
if(x($_FILES,'media')) {
|
||||
// upload the image if we have one
|
||||
$_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
|
||||
require_once('mod/wall_upload.php');
|
||||
$media = wall_upload_post($a);
|
||||
if(strlen($media)>0)
|
||||
$_REQUEST['body'] .= "\n\n".$media;
|
||||
}
|
||||
}
|
||||
|
||||
// set this so that the item_post() function is quiet and doesn't redirect or emit json
|
||||
|
@ -864,8 +865,13 @@
|
|||
logger('API: api_statuses_show: '.$id);
|
||||
|
||||
//$include_entities = (x($_REQUEST,'include_entities')?$_REQUEST['include_entities']:false);
|
||||
//$sql_extra = "";
|
||||
if ($_GET["conversation"] == "true") $sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC "; else $sql_extra .= " AND `item`.`id` = %d";
|
||||
$conversation = (x($_REQUEST,'conversation')?1:0);
|
||||
|
||||
$sql_extra = '';
|
||||
if ($conversation)
|
||||
$sql_extra .= " AND `item`.`parent` = %d ORDER BY `received` ASC ";
|
||||
else
|
||||
$sql_extra .= " AND `item`.`id` = %d";
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
|
@ -875,16 +881,15 @@
|
|||
WHERE `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||
AND `contact`.`id` = `item`.`contact-id`
|
||||
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
$sql_extra
|
||||
",
|
||||
$sql_extra",
|
||||
intval($id)
|
||||
);
|
||||
//var_dump($r);
|
||||
|
||||
$ret = api_format_items($r,$user_info);
|
||||
//var_dump($ret);
|
||||
if ($_GET["conversation"] == "true") {
|
||||
|
||||
if ($conversation) {
|
||||
$data = array('$statuses' => $ret);
|
||||
return api_apply_template("timeline", $type, $data);
|
||||
return api_apply_template("timeline", $type, $data);
|
||||
} else {
|
||||
$data = array('$status' => $ret[0]);
|
||||
/*switch($type){
|
||||
|
@ -1233,6 +1238,40 @@
|
|||
return($as);
|
||||
}
|
||||
|
||||
function api_format_messages($item, $recipient, $sender) {
|
||||
// standard meta information
|
||||
$ret=Array(
|
||||
'id' => $item['id'],
|
||||
'created_at' => api_date($item['created']),
|
||||
'sender_id' => $sender['id'] ,
|
||||
'sender_screen_name' => $sender['screen_name'],
|
||||
'sender' => $sender,
|
||||
'recipient_id' => $recipient['id'],
|
||||
'recipient_screen_name' => $recipient['screen_name'],
|
||||
'recipient' => $recipient,
|
||||
);
|
||||
|
||||
//don't send title to regular StatusNET requests to avoid confusing these apps
|
||||
if (x($_GET, 'getText')) {
|
||||
$ret['title'] = $item['title'] ;
|
||||
if ($_GET["getText"] == "html") {
|
||||
$ret['text'] = bbcode($item['body']);
|
||||
}
|
||||
elseif ($_GET["getText"] == "plain") {
|
||||
$ret['text'] = html2plain(bbcode($item['body']), 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$ret['text'] = $item['title']."\n".html2plain(bbcode($item['body']), 0);
|
||||
}
|
||||
if (isset($_GET["getUserObjects"]) && $_GET["getUserObjects"] == "false") {
|
||||
unset($ret['sender']);
|
||||
unset($ret['recipient']);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function api_format_items($r,$user_info) {
|
||||
|
||||
//logger('api_format_items: ' . print_r($r,true));
|
||||
|
@ -1429,7 +1468,13 @@
|
|||
'logo' => $logo, 'fancy' => 'true', 'language' => 'en', 'email' => $email, 'broughtby' => '',
|
||||
'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false',
|
||||
'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl,
|
||||
'shorturllength' => '30'
|
||||
'shorturllength' => '30',
|
||||
'friendica' => array(
|
||||
'FRIENDICA_PLATFORM' => FRIENDICA_PLATFORM,
|
||||
'FRIENDICA_VERSION' => FRIENDICA_VERSION,
|
||||
'DFRN_PROTOCOL_VERSION' => DFRN_PROTOCOL_VERSION,
|
||||
'DB_UPDATE_VERSION' => DB_UPDATE_VERSION
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -1503,37 +1548,39 @@
|
|||
if (local_user()===false) return false;
|
||||
|
||||
if (!x($_POST, "text") || !x($_POST,"screen_name")) return;
|
||||
|
||||
|
||||
$sender = api_get_user($a);
|
||||
|
||||
require_once("include/message.php");
|
||||
|
||||
$r = q("SELECT `id` FROM `contact` WHERE `uid`=%d AND `nick`='%s'",
|
||||
intval(local_user()),
|
||||
dbesc($_POST['screen_name']));
|
||||
|
||||
$recipient = api_get_user($a, $r[0]['id']);
|
||||
|
||||
|
||||
require_once("include/message.php");
|
||||
$sub = ( (strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
|
||||
$id = send_message($recipient['id'], $_POST['text'], $sub);
|
||||
|
||||
|
||||
$recipient = api_get_user($a, $r[0]['id']);
|
||||
$replyto = '';
|
||||
$sub = '';
|
||||
if (x($_REQUEST,'replyto')) {
|
||||
$r = q('SELECT `parent-uri`, `title` FROM `mail` WHERE `uid`=%d AND `id`=%d',
|
||||
intval(local_user()),
|
||||
intval($_REQUEST['replyto']));
|
||||
$replyto = $r[0]['parent-uri'];
|
||||
$sub = $r[0]['title'];
|
||||
}
|
||||
else {
|
||||
if (x($_REQUEST,'title')) {
|
||||
$sub = $_REQUEST['title'];
|
||||
}
|
||||
else {
|
||||
$sub = ((strlen($_POST['text'])>10)?substr($_POST['text'],0,10)."...":$_POST['text']);
|
||||
}
|
||||
}
|
||||
|
||||
$id = send_message($recipient['id'], $_POST['text'], $sub, $replyto);
|
||||
|
||||
if ($id>-1) {
|
||||
$r = q("SELECT * FROM `mail` WHERE id=%d", intval($id));
|
||||
$item = $r[0];
|
||||
$ret=Array(
|
||||
'id' => $item['id'],
|
||||
'created_at'=> api_date($item['created']),
|
||||
'sender_id'=> $sender['id'] ,
|
||||
'sender_screen_name'=> $sender['screen_name'],
|
||||
'sender'=> $sender,
|
||||
'recipient_id'=> $recipient['id'],
|
||||
'recipient_screen_name'=> $recipient['screen_name'],
|
||||
'recipient'=> $recipient,
|
||||
|
||||
'text'=> $item['title']."\n".html2plain(bbcode($item['body']), 0) ,
|
||||
|
||||
);
|
||||
$ret = api_format_messages($r[0], $recipient, $sender);
|
||||
|
||||
} else {
|
||||
$ret = array("error"=>$id);
|
||||
|
@ -1552,7 +1599,7 @@
|
|||
}
|
||||
api_register_func('api/direct_messages/new','api_direct_messages_new',true);
|
||||
|
||||
function api_direct_messages_box(&$a, $type, $box) {
|
||||
function api_direct_messages_box(&$a, $type, $box) {
|
||||
if (local_user()===false) return false;
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
|
@ -1564,46 +1611,37 @@
|
|||
|
||||
$start = $page*$count;
|
||||
|
||||
|
||||
$profile_url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
|
||||
if ($box=="sentbox") {
|
||||
$sql_extra = "`from-url`='%s'";
|
||||
} else {
|
||||
$sql_extra = "`from-url`!='%s'";
|
||||
$sql_extra = "`from-url`='".dbesc( $profile_url )."'";
|
||||
}
|
||||
elseif ($box=="conversation") {
|
||||
$sql_extra = "`parent-uri`='".dbesc( $_GET["uri"] ) ."'";
|
||||
}
|
||||
elseif ($box=="all") {
|
||||
$sql_extra = "true";
|
||||
}
|
||||
elseif ($box=="inbox") {
|
||||
$sql_extra = "`from-url`!='".dbesc( $profile_url )."'";
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `mail` WHERE uid=%d AND $sql_extra ORDER BY created DESC LIMIT %d,%d",
|
||||
intval(local_user()),
|
||||
dbesc( $a->get_baseurl() . '/profile/' . $a->user['nickname'] ),
|
||||
intval($start), intval($count)
|
||||
);
|
||||
);
|
||||
|
||||
$ret = Array();
|
||||
foreach($r as $item){
|
||||
switch ($box){
|
||||
case "inbox":
|
||||
$recipient = $user_info;
|
||||
$sender = api_get_user($a,$item['contact-id']);
|
||||
break;
|
||||
case "sentbox":
|
||||
$recipient = api_get_user($a,$item['contact-id']);
|
||||
$sender = $user_info;
|
||||
break;
|
||||
foreach($r as $item) {
|
||||
if ($box == "inbox" || $item['from-url'] != $profile_url){
|
||||
$recipient = $user_info;
|
||||
$sender = api_get_user($a,$item['contact-id']);
|
||||
}
|
||||
|
||||
$ret[]=Array(
|
||||
'id' => $item['id'],
|
||||
'created_at'=> api_date($item['created']),
|
||||
'sender_id'=> $sender['id'] ,
|
||||
'sender_screen_name'=> $sender['screen_name'],
|
||||
'sender'=> $sender,
|
||||
'recipient_id'=> $recipient['id'],
|
||||
'recipient_screen_name'=> $recipient['screen_name'],
|
||||
'recipient'=> $recipient,
|
||||
|
||||
'text'=> $item['title']."\n".html2plain(bbcode($item['body']), 0) ,
|
||||
|
||||
);
|
||||
|
||||
elseif ($box == "sentbox" || $item['from-url'] != $profile_url){
|
||||
$recipient = api_get_user($a,$item['contact-id']);
|
||||
$sender = $user_info;
|
||||
}
|
||||
|
||||
$ret[]=api_format_messages($item, $recipient, $sender);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1624,6 +1662,14 @@
|
|||
function api_direct_messages_inbox(&$a, $type){
|
||||
return api_direct_messages_box($a, $type, "inbox");
|
||||
}
|
||||
function api_direct_messages_all(&$a, $type){
|
||||
return api_direct_messages_box($a, $type, "all");
|
||||
}
|
||||
function api_direct_messages_conversation(&$a, $type){
|
||||
return api_direct_messages_box($a, $type, "conversation");
|
||||
}
|
||||
api_register_func('api/direct_messages/conversation','api_direct_messages_conversation',true);
|
||||
api_register_func('api/direct_messages/all','api_direct_messages_all',true);
|
||||
api_register_func('api/direct_messages/sent','api_direct_messages_sentbox',true);
|
||||
api_register_func('api/direct_messages','api_direct_messages_inbox',true);
|
||||
|
||||
|
|
|
@ -68,9 +68,14 @@ function stripdcode_br_cb($s) {
|
|||
|
||||
|
||||
function diaspora_ul($s) {
|
||||
// Replace "[\\*]" followed by any number (including zero) of
|
||||
// Replace "[*]" followed by any number (including zero) of
|
||||
// spaces by "* " to match Diaspora's list format
|
||||
return preg_replace("/\[\\\\\*\]( *)/", "* ", $s[1]);
|
||||
if( strpos($s[0], "[list]") === 0 )
|
||||
return '<ul class="listbullet" style="list-style-type: circle;">' . preg_replace("/\[\*\]( *)/", "* ", $s[1]) . '</ul>';
|
||||
elseif( strpos($s[0], "[ul]") === 0 )
|
||||
return '<ul class="listbullet" style="list-style-type: circle;">' . preg_replace("/\[\*\]( *)/", "* ", $s[1]) . '</ul>';
|
||||
else
|
||||
return $s[0];
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,12 +85,47 @@ function diaspora_ol($s) {
|
|||
// 1. First element
|
||||
// 1. Second element
|
||||
// 1. Third element
|
||||
return preg_replace("/\[\\\\\*\]( *)/", "1. ", $s[1]);
|
||||
if( strpos($s[0], "[list=1]") === 0 )
|
||||
return '<ul class="listdecimal" style="list-style-type: decimal;">' . preg_replace("/\[\*\]( *)/", "1. ", $s[1]) . '</ul>';
|
||||
elseif( strpos($s[0], "[list=i]") === 0 )
|
||||
return '<ul class="listlowerroman" style="list-style-type: lower-roman;">' . preg_replace("/\[\*\]( *)/", "1. ", $s[1]) . '</ul>';
|
||||
elseif( strpos($s[0], "[list=I]") === 0 )
|
||||
return '<ul class="listupperroman" style="list-style-type: upper-roman;">' . preg_replace("/\[\*\]( *)/", "1. ", $s[1]) . '</ul>';
|
||||
elseif( strpos($s[0], "[list=a]") === 0 )
|
||||
return '<ul class="listloweralpha" style="list-style-type: lower-alpha;">' . preg_replace("/\[\*\]( *)/", "1. ", $s[1]) . '</ul>';
|
||||
elseif( strpos($s[0], "[list=A]") === 0 )
|
||||
return '<ul class="listupperalpha" style="list-style-type: upper-alpha;">' . preg_replace("/\[\*\]( *)/", "1. ", $s[1]) . '</ul>';
|
||||
elseif( strpos($s[0], "[ol]") === 0 )
|
||||
return '<ul class="listdecimal" style="list-style-type: decimal;">' . preg_replace("/\[\*\]( *)/", "1. ", $s[1]) . '</ul>';
|
||||
else
|
||||
return $s[0];
|
||||
}
|
||||
|
||||
|
||||
function bb2diaspora($Text,$preserve_nl = false) {
|
||||
|
||||
// bbcode() will convert "[*]" into "<li>" with no closing "</li>"
|
||||
// Markdownify() is unable to handle these, as it makes each new
|
||||
// "<li>" into a deeper nested element until it crashes. So pre-format
|
||||
// the lists as Diaspora lists before sending the $Text to bbcode()
|
||||
//
|
||||
// Note that to get nested lists to work for Diaspora, we would need
|
||||
// to define the closing tag for the list elements. So nested lists
|
||||
// are going to be flattened out in Diaspora for now
|
||||
$endlessloop = 0;
|
||||
while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
|
||||
((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
|
||||
((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false))) && (++$endlessloop < 20)) {
|
||||
$Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
|
||||
$Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text);
|
||||
$Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text);
|
||||
$Text = preg_replace_callback("/\[list=I\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
|
||||
$Text = preg_replace_callback("/\[list=a\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
|
||||
$Text = preg_replace_callback("/\[list=A\](.*?)\[\/list\]/s", 'diaspora_ol', $Text);
|
||||
$Text = preg_replace_callback("/\[ul\](.*?)\[\/ul\]/is", 'diaspora_ul', $Text);
|
||||
$Text = preg_replace_callback("/\[ol\](.*?)\[\/ol\]/is", 'diaspora_ol', $Text);
|
||||
}
|
||||
|
||||
// Convert it to HTML - don't try oembed
|
||||
$Text = bbcode($Text, $preserve_nl, false);
|
||||
|
||||
|
@ -93,6 +133,12 @@ function bb2diaspora($Text,$preserve_nl = false) {
|
|||
$md = new Markdownify(false, false, false);
|
||||
$Text = $md->parseString($Text);
|
||||
|
||||
// If the text going into bbcode() has a plain URL in it, i.e.
|
||||
// with no [url] tags around it, it will come out of parseString()
|
||||
// looking like: <http://url.com>, which gets removed by strip_tags().
|
||||
// So take off the angle brackets of any such URL
|
||||
$Text = preg_replace("/<http(.*?)>/is", "http$1", $Text);
|
||||
|
||||
// Remove all unconverted tags
|
||||
$Text = strip_tags($Text);
|
||||
|
||||
|
|
|
@ -162,7 +162,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
|||
|
||||
// handle nested lists
|
||||
$endlessloop = 0;
|
||||
while ((strpos($Text, "[/list]") !== false) and (strpos($Text, "[list") !== false) and (++$endlessloop < 20)) {
|
||||
|
||||
while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
|
||||
((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
|
||||
((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false))) && (++$endlessloop < 20)) {
|
||||
$Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text);
|
||||
|
@ -170,11 +173,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
|||
$Text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '<ul class="listupperroman" style="list-style-type: upper-roman;">$2</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$2</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$2</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text);
|
||||
}
|
||||
|
||||
$Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
|
||||
$Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text);
|
||||
|
||||
$Text = preg_replace("/\[th\](.*?)\[\/th\]/sm", '<th>$1</th>' ,$Text);
|
||||
$Text = preg_replace("/\[td\](.*?)\[\/td\]/sm", '<td>$1</td>' ,$Text);
|
||||
$Text = preg_replace("/\[tr\](.*?)\[\/tr\]/sm", '<tr>$1</tr>' ,$Text);
|
||||
|
@ -295,12 +297,16 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
|
|||
$Text = oembed_bbcode2html($Text);
|
||||
|
||||
// If we found an event earlier, strip out all the event code and replace with a reformatted version.
|
||||
// Replace the event-start section with the entire formatted event. The other bbcode is stripped.
|
||||
// Summary (e.g. title) is required, earlier revisions only required description (in addition to
|
||||
// start which is always required). Allow desc with a missing summary for compatibility.
|
||||
|
||||
if(x($ev,'desc') && x($ev,'start')) {
|
||||
if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) {
|
||||
$sub = format_event_html($ev);
|
||||
|
||||
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",$sub,$Text);
|
||||
$Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text);
|
||||
$Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text);
|
||||
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
|
||||
|
|
|
@ -432,7 +432,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
continue;
|
||||
|
||||
$toplevelpost = (($item['id'] == $item['parent']) ? true : false);
|
||||
$toplevelprivate = false;
|
||||
|
||||
|
||||
// Take care of author collapsing and comment collapsing
|
||||
// (author collapsing is currently disabled)
|
||||
|
@ -440,7 +440,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
// If there are more than two comments, squash all but the last 2.
|
||||
|
||||
if($toplevelpost) {
|
||||
$toplevelprivate = (($toplevelpost && $item['private']) ? true : false);
|
||||
|
||||
$item_writeable = (($item['writable'] || $item['self']) ? true : false);
|
||||
|
||||
$comments_seen = 0;
|
||||
|
@ -485,7 +485,7 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
|
||||
$redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
|
||||
|
||||
$lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||
$lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||
? t('Private Message')
|
||||
: false);
|
||||
|
@ -546,16 +546,16 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
}
|
||||
|
||||
$likebuttons = '';
|
||||
$shareable = ((($profile_owner == local_user()) && ((! $item['private']) || $item['network'] === NETWORK_FEED)) ? true : false);
|
||||
$shareable = ((($profile_owner == local_user()) && (! $item['private'] == 1)) ? true : false);
|
||||
|
||||
if($page_writeable) {
|
||||
if($toplevelpost) {
|
||||
/* if($toplevelpost) { */
|
||||
$likebuttons = array(
|
||||
'like' => array( t("I like this \x28toggle\x29"), t("like")),
|
||||
'dislike' => array( t("I don't like this \x28toggle\x29"), t("dislike")),
|
||||
);
|
||||
if ($shareable) $likebuttons['share'] = array( t('Share this'), t('share'));
|
||||
}
|
||||
/* } */
|
||||
|
||||
$qc = $qcomment = null;
|
||||
|
||||
|
@ -659,8 +659,8 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
|||
else
|
||||
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
|
||||
|
||||
$like = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
|
||||
$dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
|
||||
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
|
||||
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
|
||||
|
||||
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
|
||||
call_hooks('render_location',$locate);
|
||||
|
@ -876,13 +876,17 @@ function like_puller($a,$item,&$arr,$mode) {
|
|||
}
|
||||
else
|
||||
$url = zrl($url);
|
||||
if(! ((isset($arr[$item['parent'] . '-l'])) && (is_array($arr[$item['parent'] . '-l']))))
|
||||
$arr[$item['parent'] . '-l'] = array();
|
||||
if(! isset($arr[$item['parent']]))
|
||||
$arr[$item['parent']] = 1;
|
||||
|
||||
if(! $item['thr-parent'])
|
||||
$item['thr-parent'] = $item['parent-uri'];
|
||||
|
||||
if(! ((isset($arr[$item['thr-parent'] . '-l'])) && (is_array($arr[$item['thr-parent'] . '-l']))))
|
||||
$arr[$item['thr-parent'] . '-l'] = array();
|
||||
if(! isset($arr[$item['thr-parent']]))
|
||||
$arr[$item['thr-parent']] = 1;
|
||||
else
|
||||
$arr[$item['parent']] ++;
|
||||
$arr[$item['parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
|
||||
$arr[$item['thr-parent']] ++;
|
||||
$arr[$item['thr-parent'] . '-l'][] = '<a href="'. $url . '"'. $sparkle .'>' . $item['author-name'] . '</a>';
|
||||
}
|
||||
return;
|
||||
}}
|
||||
|
|
|
@ -447,11 +447,13 @@ function update_contact_birthdays() {
|
|||
*
|
||||
*/
|
||||
|
||||
$bdtext = t('Birthday:') . ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]' ;
|
||||
$bdtext = sprintf( t('%s\'s birthday'), $rr['name']);
|
||||
$bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $rr['url'] . ']' . $rr['name'] . '[/url]') ;
|
||||
|
||||
|
||||
$r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`desc`,`type`,`adjust`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ",
|
||||
|
||||
$r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`,`adjust`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ",
|
||||
intval($rr['uid']),
|
||||
intval($rr['id']),
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -459,6 +461,7 @@ function update_contact_birthdays() {
|
|||
dbesc(datetime_convert('UTC','UTC', $nextbd)),
|
||||
dbesc(datetime_convert('UTC','UTC', $nextbd . ' + 1 day ')),
|
||||
dbesc($bdtext),
|
||||
dbesc($bdtext2),
|
||||
dbesc('birthday'),
|
||||
intval(0)
|
||||
);
|
||||
|
|
|
@ -113,7 +113,7 @@ function delivery_run($argv, $argc){
|
|||
$uid = $r[0]['uid'];
|
||||
$updated = $r[0]['edited'];
|
||||
|
||||
// The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
|
||||
// POSSIBLE CLEANUP --> The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
|
||||
if(! $parent_id)
|
||||
continue;
|
||||
|
||||
|
@ -280,7 +280,7 @@ function delivery_run($argv, $argc){
|
|||
continue;
|
||||
|
||||
// private emails may be in included in public conversations. Filter them.
|
||||
if(($public_message) && $item['private'])
|
||||
if(($public_message) && $item['private'] == 1)
|
||||
continue;
|
||||
|
||||
$item_contact = get_item_contact($item,$icontacts);
|
||||
|
@ -383,7 +383,7 @@ function delivery_run($argv, $argc){
|
|||
continue;
|
||||
|
||||
// private emails may be in included in public conversations. Filter them.
|
||||
if(($public_message) && $item['private'])
|
||||
if(($public_message) && $item['private'] == 1)
|
||||
continue;
|
||||
|
||||
$item_contact = get_item_contact($item,$icontacts);
|
||||
|
|
|
@ -1560,7 +1560,8 @@ function diaspora_photo($importer,$xml,$msg) {
|
|||
|
||||
$link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n";
|
||||
|
||||
$link_text = scale_external_images($link_text);
|
||||
$link_text = scale_external_images($link_text, true,
|
||||
array($remote_photo_name, 'scaled_full_' . $remote_photo_name));
|
||||
|
||||
if(strpos($parent_item['body'],$link_text) === false) {
|
||||
$r = q("update item set `body` = '%s', `visible` = 1 where `id` = %d and `uid` = %d limit 1",
|
||||
|
@ -2251,7 +2252,6 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
|
|||
$relay_retract = true;
|
||||
|
||||
$target_type = ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
|
||||
$sender_signed_text = $item['guid'] . ';' . $target_type ;
|
||||
|
||||
$sql_sign_id = 'retract_iid';
|
||||
$tpl = get_markup_template('diaspora_relayable_retraction.tpl');
|
||||
|
@ -2262,13 +2262,10 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
|
|||
$target_type = 'Post';
|
||||
// $positive = (($item['deleted']) ? 'false' : 'true');
|
||||
$positive = 'true';
|
||||
$sender_signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $myaddr;
|
||||
|
||||
$tpl = get_markup_template('diaspora_like_relay.tpl');
|
||||
}
|
||||
else { // item is a comment
|
||||
$sender_signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $myaddr;
|
||||
|
||||
$tpl = get_markup_template('diaspora_comment_relay.tpl');
|
||||
}
|
||||
|
||||
|
@ -2294,6 +2291,13 @@ function diaspora_send_relay($item,$owner,$contact,$public_batch = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
if($relay_retract)
|
||||
$sender_signed_text = $item['guid'] . ';' . $target_type;
|
||||
elseif($like)
|
||||
$sender_signed_text = $item['guid'] . ';' . $target_type . ';' . $parent_guid . ';' . $positive . ';' . $handle;
|
||||
else
|
||||
$sender_signed_text = $item['guid'] . ';' . $parent_guid . ';' . $text . ';' . $handle;
|
||||
|
||||
// Sign the relayable with the top-level owner's signature
|
||||
//
|
||||
// We'll use the $sender_signed_text that we just created, instead of the $signed_text
|
||||
|
|
|
@ -12,6 +12,9 @@ function format_event_html($ev) {
|
|||
|
||||
$o = '<div class="vevent">' . "\r\n";
|
||||
|
||||
|
||||
$o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
|
||||
|
||||
$o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
|
||||
|
||||
$o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
|
||||
|
@ -114,6 +117,9 @@ function format_event_bbcode($ev) {
|
|||
|
||||
$o = '';
|
||||
|
||||
if($ev['summary'])
|
||||
$o .= '[event-summary]' . $ev['summary'] . '[/event-summary]';
|
||||
|
||||
if($ev['desc'])
|
||||
$o .= '[event-description]' . $ev['desc'] . '[/event-description]';
|
||||
|
||||
|
@ -147,6 +153,9 @@ function bbtoevent($s) {
|
|||
|
||||
$ev = array();
|
||||
|
||||
$match = '';
|
||||
if(preg_match("/\[event\-summary\](.*?)\[\/event\-summary\]/is",$s,$match))
|
||||
$ev['summary'] = $match[1];
|
||||
$match = '';
|
||||
if(preg_match("/\[event\-description\](.*?)\[\/event\-description\]/is",$s,$match))
|
||||
$ev['desc'] = $match[1];
|
||||
|
@ -244,6 +253,7 @@ function event_store($arr) {
|
|||
`edited` = '%s',
|
||||
`start` = '%s',
|
||||
`finish` = '%s',
|
||||
`summary` = '%s',
|
||||
`desc` = '%s',
|
||||
`location` = '%s',
|
||||
`type` = '%s',
|
||||
|
@ -258,6 +268,7 @@ function event_store($arr) {
|
|||
dbesc($arr['edited']),
|
||||
dbesc($arr['start']),
|
||||
dbesc($arr['finish']),
|
||||
dbesc($arr['summary']),
|
||||
dbesc($arr['desc']),
|
||||
dbesc($arr['location']),
|
||||
dbesc($arr['type']),
|
||||
|
@ -306,9 +317,9 @@ function event_store($arr) {
|
|||
|
||||
// New event. Store it.
|
||||
|
||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`,
|
||||
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
|
||||
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
|
||||
intval($arr['uid']),
|
||||
intval($arr['cid']),
|
||||
dbesc($arr['uri']),
|
||||
|
@ -316,6 +327,7 @@ function event_store($arr) {
|
|||
dbesc($arr['edited']),
|
||||
dbesc($arr['start']),
|
||||
dbesc($arr['finish']),
|
||||
dbesc($arr['summary']),
|
||||
dbesc($arr['desc']),
|
||||
dbesc($arr['location']),
|
||||
dbesc($arr['type']),
|
||||
|
|
|
@ -62,6 +62,11 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// This extra param just confuses things, remove it
|
||||
if($ret['network'] === NETWORK_DIASPORA)
|
||||
$ret['url'] = str_replace('?absolute=true','',$ret['url']);
|
||||
|
@ -89,6 +94,11 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
$ret['notify'] = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(! $ret['notify']) {
|
||||
$result['message'] .= t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
|
||||
}
|
||||
|
@ -129,6 +139,32 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
}
|
||||
else {
|
||||
|
||||
|
||||
// check service class limits
|
||||
|
||||
$r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
|
||||
intval($uid)
|
||||
);
|
||||
if(count($r))
|
||||
$total_contacts = $r[0]['total'];
|
||||
|
||||
if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
|
||||
$result['message'] .= upgrade_message();
|
||||
return $result;
|
||||
}
|
||||
|
||||
$r = q("select count(network) as total from contact where uid = %d and network = '%s' and pending = 0 and self = 0",
|
||||
intval($uid),
|
||||
dbesc($network)
|
||||
);
|
||||
if(count($r))
|
||||
$total_network = $r[0]['total'];
|
||||
|
||||
if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
|
||||
$result['message'] .= upgrade_message();
|
||||
return $result;
|
||||
}
|
||||
|
||||
$new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||
if($ret['network'] === NETWORK_DIASPORA)
|
||||
$new_relation = CONTACT_IS_FOLLOWER;
|
||||
|
|
|
@ -469,8 +469,8 @@ function get_atom_elements($feed,$item) {
|
|||
$res['last-child'] = 0;
|
||||
|
||||
$private = $item->get_item_tags(NAMESPACE_DFRN,'private');
|
||||
if($private && $private[0]['data'] == 1)
|
||||
$res['private'] = 1;
|
||||
if($private && intval($private[0]['data']) > 0)
|
||||
$res['private'] = intval($private[0]['data']);
|
||||
else
|
||||
$res['private'] = 0;
|
||||
|
||||
|
@ -817,7 +817,7 @@ function item_store($arr,$force_parent = false) {
|
|||
// email correspondents to be private even if the overall thread is not.
|
||||
|
||||
if($r[0]['private'])
|
||||
$arr['private'] = 1;
|
||||
$arr['private'] = $r[0]['private'];
|
||||
|
||||
// Edge case. We host a public forum that was originally posted to privately.
|
||||
// The original author commented, but as this is a comment, the permissions
|
||||
|
@ -1460,11 +1460,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
*
|
||||
*/
|
||||
|
||||
$bdtext = t('Birthday:') . ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ;
|
||||
$bdtext = sprintf( t('%s\'s birthday'), $contact['name']);
|
||||
$bdtext2 = sprintf( t('Happy Birthday %s'), ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' ) ;
|
||||
|
||||
|
||||
$r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`desc`,`type`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s' ) ",
|
||||
$r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`)
|
||||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
|
||||
intval($contact['uid']),
|
||||
intval($contact['id']),
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -1472,6 +1473,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
dbesc(datetime_convert('UTC','UTC', $birthday)),
|
||||
dbesc(datetime_convert('UTC','UTC', $birthday . ' + 1 day ')),
|
||||
dbesc($bdtext),
|
||||
dbesc($bdtext2),
|
||||
dbesc('birthday')
|
||||
);
|
||||
|
||||
|
@ -1660,6 +1662,21 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
continue;
|
||||
}
|
||||
|
||||
$force_parent = false;
|
||||
if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
|
||||
if($contact['network'] === NETWORK_OSTATUS)
|
||||
$force_parent = true;
|
||||
if(strlen($datarray['title']))
|
||||
unset($datarray['title']);
|
||||
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($parent_uri),
|
||||
intval($importer['uid'])
|
||||
);
|
||||
$datarray['last-child'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($item_id),
|
||||
intval($importer['uid'])
|
||||
|
@ -1703,19 +1720,6 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
continue;
|
||||
}
|
||||
|
||||
$force_parent = false;
|
||||
if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
|
||||
if($contact['network'] === NETWORK_OSTATUS)
|
||||
$force_parent = true;
|
||||
if(strlen($datarray['title']))
|
||||
unset($datarray['title']);
|
||||
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($parent_uri),
|
||||
intval($importer['uid'])
|
||||
);
|
||||
$datarray['last-child'] = 1;
|
||||
}
|
||||
|
||||
if(($contact['network'] === NETWORK_FEED) || (! strlen($contact['notify']))) {
|
||||
// one way feed - no remote comment ability
|
||||
|
@ -1728,10 +1732,12 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
$datarray['type'] = 'activity';
|
||||
$datarray['gravity'] = GRAVITY_LIKE;
|
||||
// only one like or dislike per person
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s' OR `thr-parent` = '%s') limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb'])
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri)
|
||||
);
|
||||
if($r && count($r))
|
||||
continue;
|
||||
|
@ -1811,6 +1817,13 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
}
|
||||
}
|
||||
|
||||
if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
|
||||
if(strlen($datarray['title']))
|
||||
unset($datarray['title']);
|
||||
$datarray['last-child'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||
dbesc($item_id),
|
||||
intval($importer['uid'])
|
||||
|
@ -1873,24 +1886,23 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
if(! is_array($contact))
|
||||
return;
|
||||
|
||||
if($contact['network'] === NETWORK_OSTATUS || stristr($contact['url'],'twitter.com')) {
|
||||
if(strlen($datarray['title']))
|
||||
unset($datarray['title']);
|
||||
$datarray['last-child'] = 1;
|
||||
}
|
||||
|
||||
if(($contact['network'] === NETWORK_FEED) || (! strlen($contact['notify']))) {
|
||||
// one way feed - no remote comment ability
|
||||
$datarray['last-child'] = 0;
|
||||
}
|
||||
if($contact['network'] === NETWORK_FEED)
|
||||
$datarray['private'] = 1;
|
||||
$datarray['private'] = 2;
|
||||
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
|
||||
if($contact['remote_self'])
|
||||
if($contact['remote_self']) {
|
||||
$datarray['wall'] = 1;
|
||||
if($contact['network'] === NETWORK_FEED) {
|
||||
$datarray['private'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$datarray['parent-uri'] = $item_id;
|
||||
$datarray['uid'] = $importer['uid'];
|
||||
|
@ -2148,6 +2160,67 @@ function local_delivery($importer,$data) {
|
|||
}
|
||||
if($deleted) {
|
||||
|
||||
// check for relayed deletes to our conversation
|
||||
|
||||
$is_reply = false;
|
||||
$r = q("select * from item where uri = '%s' and uid = %d limit 1",
|
||||
dbesc($uri),
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
if(count($r)) {
|
||||
$parent_uri = $r[0]['parent-uri'];
|
||||
if($r[0]['id'] != $r[0]['parent'])
|
||||
$is_reply = true;
|
||||
}
|
||||
|
||||
if($is_reply) {
|
||||
$community = false;
|
||||
|
||||
if($importer['page-flags'] == PAGE_COMMUNITY || $importer['page-flags'] == PAGE_PRVGROUP ) {
|
||||
$sql_extra = '';
|
||||
$community = true;
|
||||
logger('local_delivery: possible community delete');
|
||||
}
|
||||
else
|
||||
$sql_extra = " and contact.self = 1 and item.wall = 1 ";
|
||||
|
||||
// was the top-level post for this reply written by somebody on this site?
|
||||
// Specifically, the recipient?
|
||||
|
||||
$is_a_remote_delete = false;
|
||||
|
||||
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
|
||||
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
|
||||
AND `item`.`uid` = %d
|
||||
$sql_extra
|
||||
LIMIT 1",
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri),
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
if($r && count($r))
|
||||
$is_a_remote_delete = true;
|
||||
|
||||
// Does this have the characteristics of a community or private group comment?
|
||||
// If it's a reply to a wall post on a community/prvgroup page it's a
|
||||
// valid community comment. Also forum_mode makes it valid for sure.
|
||||
// If neither, it's not.
|
||||
|
||||
if($is_a_remote_delete && $community) {
|
||||
if((! $r[0]['forum_mode']) && (! $r[0]['wall'])) {
|
||||
$is_a_remote_delete = false;
|
||||
logger('local_delivery: not a community delete');
|
||||
}
|
||||
}
|
||||
|
||||
if($is_a_remote_delete) {
|
||||
logger('local_delivery: received remote delete');
|
||||
}
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.*, `contact`.`self` FROM `item` left join contact on `item`.`contact-id` = `contact`.`id`
|
||||
WHERE `uri` = '%s' AND `item`.`uid` = %d AND `contact-id` = %d AND NOT `item`.`file` LIKE '%%[%%' LIMIT 1",
|
||||
dbesc($uri),
|
||||
|
@ -2235,7 +2308,11 @@ function local_delivery($importer,$data) {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if this is a relayed delete, propagate it to other recipients
|
||||
|
||||
if($is_a_remote_delete)
|
||||
proc_run('php',"include/notifier.php","drop",$item['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2268,15 +2345,17 @@ function local_delivery($importer,$data) {
|
|||
|
||||
$is_a_remote_comment = false;
|
||||
|
||||
// POSSIBLE CLEANUP --> Why select so many fields when only forum_mode and wall are used?
|
||||
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`, `item`.`forum_mode`,`item`.`origin`,`item`.`wall`,
|
||||
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
|
||||
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s'
|
||||
WHERE `item`.`uri` = '%s' AND (`item`.`parent-uri` = '%s' or `item`.`thr-parent` = '%s')
|
||||
AND `item`.`uid` = %d
|
||||
$sql_extra
|
||||
LIMIT 1",
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri),
|
||||
intval($importer['importer_uid'])
|
||||
);
|
||||
if($r && count($r))
|
||||
|
@ -2364,10 +2443,13 @@ function local_delivery($importer,$data) {
|
|||
$datarray['gravity'] = GRAVITY_LIKE;
|
||||
$datarray['last-child'] = 0;
|
||||
// only one like or dislike per person
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`thr-parent` = '%s' or `parent-uri` = '%s') and deleted = 0 limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb'])
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($datarray['parent-uri']),
|
||||
dbesc($datarray['parent-uri'])
|
||||
|
||||
);
|
||||
if($r && count($r))
|
||||
continue;
|
||||
|
@ -2535,10 +2617,12 @@ function local_delivery($importer,$data) {
|
|||
$datarray['type'] = 'activity';
|
||||
$datarray['gravity'] = GRAVITY_LIKE;
|
||||
// only one like or dislike per person
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 limit 1",
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s' OR `thr-parent` = '%s') limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb'])
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri)
|
||||
);
|
||||
if($r && count($r))
|
||||
continue;
|
||||
|
@ -2933,8 +3017,10 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
|
|||
if(strlen($item['owner-name']))
|
||||
$o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
|
||||
|
||||
if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']))
|
||||
$o .= '<thr:in-reply-to ref="' . xmlify($item['parent-uri']) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['parent']) . '" />' . "\r\n";
|
||||
if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || ($item['thr-parent'])) {
|
||||
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
||||
$o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['parent']) . '" />' . "\r\n";
|
||||
}
|
||||
|
||||
$o .= '<id>' . xmlify($item['uri']) . '</id>' . "\r\n";
|
||||
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
|
||||
|
@ -2955,7 +3041,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
|
|||
$o .= '<georss:point>' . xmlify($item['coord']) . '</georss:point>' . "\r\n";
|
||||
|
||||
if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']))
|
||||
$o .= '<dfrn:private>1</dfrn:private>' . "\r\n";
|
||||
$o .= '<dfrn:private>' . (($item['private']) ? $item['private'] : 1) . '</dfrn:private>' . "\r\n";
|
||||
|
||||
if($item['extid'])
|
||||
$o .= '<dfrn:extid>' . xmlify($item['extid']) . '</dfrn:extid>' . "\r\n";
|
||||
|
@ -3351,40 +3437,8 @@ function drop_item($id,$interactive = true) {
|
|||
);
|
||||
}
|
||||
|
||||
// Add a relayable_retraction signature for Diaspora. Note that we can't add a target_author_signature
|
||||
// if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
|
||||
// the comment, that means we're the home of the post, and Diaspora will only
|
||||
// check the parent_author_signature of retractions that it doesn't have to relay further
|
||||
//
|
||||
// I don't think this function gets called for an "unlike," but I'll check anyway
|
||||
$signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
|
||||
|
||||
if(local_user() == $item['uid']) {
|
||||
|
||||
$handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
|
||||
$authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256'));
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
|
||||
$item['contact-id']
|
||||
);
|
||||
if(count($r)) {
|
||||
// The below handle only works for NETWORK_DFRN. I think that's ok, because this function
|
||||
// only handles DFRN deletes
|
||||
$handle_baseurl_start = strpos($r['url'],'://') + 3;
|
||||
$handle_baseurl_length = strpos($r['url'],'/profile') - $handle_baseurl_start;
|
||||
$handle = $r['nick'] . '@' . substr($r['url'], $handle_baseurl_start, $handle_baseurl_length);
|
||||
$authorsig = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($handle))
|
||||
q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
|
||||
intval($item['id']),
|
||||
dbesc($signed_text),
|
||||
dbesc($authorsig),
|
||||
dbesc($handle)
|
||||
);
|
||||
// Add a relayable_retraction signature for Diaspora.
|
||||
store_diaspora_retract_sig($item, $a->user, $a->get_baseurl());
|
||||
}
|
||||
$drop_id = intval($item['id']);
|
||||
|
||||
|
@ -3472,3 +3526,51 @@ function posted_date_widget($url,$uid,$wall) {
|
|||
));
|
||||
return $o;
|
||||
}
|
||||
|
||||
function store_diaspora_retract_sig($item, $user, $baseurl) {
|
||||
// Note that we can't add a target_author_signature
|
||||
// if the comment was deleted by a remote user. That should be ok, because if a remote user is deleting
|
||||
// the comment, that means we're the home of the post, and Diaspora will only
|
||||
// check the parent_author_signature of retractions that it doesn't have to relay further
|
||||
//
|
||||
// I don't think this function gets called for an "unlike," but I'll check anyway
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
logger('drop_item: diaspora support disabled, not storing retraction signature', LOGGER_DEBUG);
|
||||
return;
|
||||
}
|
||||
|
||||
logger('drop_item: storing diaspora retraction signature');
|
||||
|
||||
$signed_text = $item['guid'] . ';' . ( ($item['verb'] === ACTIVITY_LIKE) ? 'Like' : 'Comment');
|
||||
|
||||
if(local_user() == $item['uid']) {
|
||||
|
||||
$handle = $user['nickname'] . '@' . substr($baseurl, strpos($baseurl,'://') + 3);
|
||||
$authorsig = base64_encode(rsa_sign($signed_text,$user['prvkey'],'sha256'));
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `nick`, `url` FROM `contact` WHERE `id` = '%d' LIMIT 1",
|
||||
$item['contact-id']
|
||||
);
|
||||
if(count($r)) {
|
||||
// The below handle only works for NETWORK_DFRN. I think that's ok, because this function
|
||||
// only handles DFRN deletes
|
||||
$handle_baseurl_start = strpos($r['url'],'://') + 3;
|
||||
$handle_baseurl_length = strpos($r['url'],'/profile') - $handle_baseurl_start;
|
||||
$handle = $r['nick'] . '@' . substr($r['url'], $handle_baseurl_start, $handle_baseurl_length);
|
||||
$authorsig = '';
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($handle))
|
||||
q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
|
||||
intval($item['id']),
|
||||
dbesc($signed_text),
|
||||
dbesc($authorsig),
|
||||
dbesc($handle)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -793,7 +793,7 @@ function add_fcontact($arr,$update = false) {
|
|||
}
|
||||
|
||||
|
||||
function scale_external_images($s,$include_link = true) {
|
||||
function scale_external_images($s, $include_link = true, $scale_replace = false) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
|
@ -803,10 +803,22 @@ function scale_external_images($s,$include_link = true) {
|
|||
require_once('include/Photo.php');
|
||||
foreach($matches as $mtch) {
|
||||
logger('scale_external_image: ' . $mtch[1]);
|
||||
|
||||
$hostname = str_replace('www.','',substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3));
|
||||
if(stristr($mtch[1],$hostname))
|
||||
continue;
|
||||
$i = fetch_url($mtch[1]);
|
||||
|
||||
// $scale_replace, if passed, is an array of two elements. The
|
||||
// first is the name of the full-size image. The second is the
|
||||
// name of a remote, scaled-down version of the full size image.
|
||||
// This allows Friendica to display the smaller remote image if
|
||||
// one exists, while still linking to the full-size image
|
||||
if($scale_replace)
|
||||
$scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]);
|
||||
else
|
||||
$scaled = $mtch[1];
|
||||
$i = fetch_url($scaled);
|
||||
|
||||
// guess mimetype from headers or filename
|
||||
$type = guess_image_type($mtch[1],true);
|
||||
|
||||
|
@ -822,7 +834,7 @@ function scale_external_images($s,$include_link = true) {
|
|||
$new_width = $ph->getWidth();
|
||||
$new_height = $ph->getHeight();
|
||||
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
|
||||
$s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $mtch[1] . '[/img]'
|
||||
$s = str_replace($mtch[0],'[img=' . $new_width . 'x' . $new_height. ']' . $scaled . '[/img]'
|
||||
. "\n" . (($include_link)
|
||||
? '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n"
|
||||
: ''),$s);
|
||||
|
|
|
@ -125,7 +125,7 @@ function notifier_run($argv, $argc){
|
|||
$uid = $r[0]['uid'];
|
||||
$updated = $r[0]['edited'];
|
||||
|
||||
// The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
|
||||
// POSSIBLE CLEANUP --> The following seems superfluous. We've already checked for "if (! intval($r[0]['parent']))" a few lines up
|
||||
if(! $parent_id)
|
||||
return;
|
||||
|
||||
|
@ -399,7 +399,7 @@ function notifier_run($argv, $argc){
|
|||
|
||||
// private emails may be in included in public conversations. Filter them.
|
||||
|
||||
if(($public_message) && $item['private'])
|
||||
if(($public_message) && $item['private'] == 1)
|
||||
continue;
|
||||
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ function onepoll_run($argv, $argc){
|
|||
|
||||
if($xml) {
|
||||
logger('poller: received xml : ' . $xml, LOGGER_DATA);
|
||||
if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
|
||||
if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
|
||||
logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
|
||||
$r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
|
|
|
@ -316,3 +316,87 @@ function get_theme_screenshot($theme) {
|
|||
}
|
||||
return($a->get_baseurl() . '/images/blank.png');
|
||||
}
|
||||
|
||||
|
||||
// check service_class restrictions. If there are no service_classes defined, everything is allowed.
|
||||
// if $usage is supplied, we check against a maximum count and return true if the current usage is
|
||||
// less than the subscriber plan allows. Otherwise we return boolean true or false if the property
|
||||
// is allowed (or not) in this subscriber plan. An unset property for this service plan means
|
||||
// the property is allowed, so it is only necessary to provide negative properties for each plan,
|
||||
// or what the subscriber is not allowed to do.
|
||||
|
||||
|
||||
function service_class_allows($uid,$property,$usage = false) {
|
||||
|
||||
if($uid == local_user()) {
|
||||
$service_class = $a->user['service_class'];
|
||||
}
|
||||
else {
|
||||
$r = q("select service_class from user where uid = %d limit 1",
|
||||
intval($uid)
|
||||
);
|
||||
if($r !== false and count($r)) {
|
||||
$service_class = $r[0]['service_class'];
|
||||
}
|
||||
}
|
||||
if(! x($service_class))
|
||||
return true; // everything is allowed
|
||||
|
||||
$arr = get_config('service_class',$service_class);
|
||||
if(! is_array($arr) || (! count($arr)))
|
||||
return true;
|
||||
|
||||
if($usage === false)
|
||||
return ((x($arr[$property])) ? (bool) $arr['property'] : true);
|
||||
else {
|
||||
if(! array_key_exists($property,$arr))
|
||||
return true;
|
||||
return (((intval($usage)) < intval($arr[$property])) ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function service_class_fetch($uid,$property) {
|
||||
|
||||
if($uid == local_user()) {
|
||||
$service_class = $a->user['service_class'];
|
||||
}
|
||||
else {
|
||||
$r = q("select service_class from user where uid = %d limit 1",
|
||||
intval($uid)
|
||||
);
|
||||
if($r !== false and count($r)) {
|
||||
$service_class = $r[0]['service_class'];
|
||||
}
|
||||
}
|
||||
if(! x($service_class))
|
||||
return false; // everything is allowed
|
||||
|
||||
$arr = get_config('service_class',$service_class);
|
||||
if(! is_array($arr) || (! count($arr)))
|
||||
return false;
|
||||
|
||||
return((array_key_exists($property,$arr)) ? $arr[$property] : false);
|
||||
|
||||
}
|
||||
|
||||
function upgrade_link($bbcode = false) {
|
||||
$l = get_config('service_class','upgrade_link');
|
||||
if(! $l)
|
||||
return '';
|
||||
if($bbcode)
|
||||
$t = sprintf('[url=%s]' . t('Click here to upgrade.') . '[/url]', $l);
|
||||
else
|
||||
$t = sprintf('<a href="%s">' . t('Click here to upgrade.') . '</div>', $l);
|
||||
return $t;
|
||||
}
|
||||
|
||||
function upgrade_message($bbcode = false) {
|
||||
$x = upgrade_link($bbcode);
|
||||
return t('This action exceeds the limits set by your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
||||
}
|
||||
|
||||
function upgrade_bool_message($bbcode = false) {
|
||||
$x = upgrade_link($bbcode);
|
||||
return t('This action is not available under your subscription plan.') . (($x) ? ' ' . $x : '') ;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,11 @@ function advanced_profile(&$a) {
|
|||
|
||||
if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
|
||||
|
||||
if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt);
|
||||
|
||||
if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
|
||||
|
||||
|
||||
if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
|
||||
|
||||
if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);
|
||||
|
|
|
@ -750,40 +750,40 @@ function smilies($s, $sample = false) {
|
|||
);
|
||||
|
||||
$icons = array(
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-cool.gif" alt="8-)" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":beer" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/like.gif" alt=":like" />',
|
||||
'<img src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
|
||||
'<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>',
|
||||
'<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>'
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-\"" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-cool.gif" alt="8-)" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":beer" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/like.gif" alt=":like" />',
|
||||
'<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
|
||||
'<a href="http://project.friendika.com">~friendika <img class="smiley" src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>',
|
||||
'<a href="http://friendica.com">~friendica <img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>'
|
||||
);
|
||||
|
||||
$params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
|
||||
|
@ -823,7 +823,7 @@ function preg_heart($x) {
|
|||
return $x[0];
|
||||
$t = '';
|
||||
for($cnt = 0; $cnt < strlen($x[1]); $cnt ++)
|
||||
$t .= '<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />';
|
||||
$t .= '<img class="smiley" src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />';
|
||||
$r = str_replace($x[0],$t,$x[0]);
|
||||
return $r;
|
||||
}
|
||||
|
@ -1059,12 +1059,13 @@ function feed_salmonlinks($nick) {
|
|||
if(! function_exists('get_plink')) {
|
||||
function get_plink($item) {
|
||||
$a = get_app();
|
||||
if (x($item,'plink') && ((! $item['private']) || ($item['network'] === NETWORK_FEED))){
|
||||
if (x($item,'plink') && ($item['private'] != 1)) {
|
||||
return array(
|
||||
'href' => $item['plink'],
|
||||
'title' => t('link to source'),
|
||||
);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -147,13 +147,18 @@ function create_user($arr) {
|
|||
|
||||
require_once('include/crypto.php');
|
||||
|
||||
$keys = new_keypair(1024);
|
||||
$keys = new_keypair(4096);
|
||||
|
||||
if($keys === false) {
|
||||
$result['message'] .= t('SERIOUS ERROR: Generation of security keys failed.') . EOL;
|
||||
return $result;
|
||||
}
|
||||
|
||||
$default_service_class = get_config('system','default_service_class');
|
||||
if(! $default_service_class)
|
||||
$default_service_class = '';
|
||||
|
||||
|
||||
$prvkey = $keys['prvkey'];
|
||||
$pubkey = $keys['pubkey'];
|
||||
|
||||
|
@ -173,8 +178,8 @@ function create_user($arr) {
|
|||
$spubkey = $sres['pubkey'];
|
||||
|
||||
$r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
|
||||
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone` )
|
||||
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC' )",
|
||||
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class` )
|
||||
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s' )",
|
||||
dbesc(generate_user_guid()),
|
||||
dbesc($username),
|
||||
dbesc($new_password_encoded),
|
||||
|
@ -187,7 +192,8 @@ function create_user($arr) {
|
|||
dbesc($sprvkey),
|
||||
dbesc(datetime_convert()),
|
||||
intval($verified),
|
||||
intval($blocked)
|
||||
intval($blocked),
|
||||
dbesc($default_service_class)
|
||||
);
|
||||
|
||||
if($r) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue