Merge pull request #872 from annando/master
API: Supporting twidere, better supporting of the network field in the item table
This commit is contained in:
commit
7b5018fb76
12 changed files with 97 additions and 84 deletions
|
@ -331,16 +331,18 @@
|
|||
'location' => NULL,
|
||||
'description' => NULL,
|
||||
'profile_image_url' => $r[0]["avatar"],
|
||||
'profile_image_url_https' => $r[0]["avatar"],
|
||||
'url' => $r[0]["url"],
|
||||
'protected' => false,
|
||||
'followers_count' => 0,
|
||||
'friends_count' => 0,
|
||||
'created_at' => '',
|
||||
'created_at' => api_date(0),
|
||||
'favourites_count' => 0,
|
||||
'utc_offset' => 0,
|
||||
'time_zone' => 'UTC',
|
||||
'statuses_count' => 0,
|
||||
'following' => 1,
|
||||
'following' => false,
|
||||
'verified' => false,
|
||||
'statusnet_blocking' => false,
|
||||
'notifications' => false,
|
||||
'statusnet_profile_url' => $r[0]["url"],
|
||||
|
@ -430,6 +432,7 @@
|
|||
'location' => ($usr) ? $usr[0]['default-location'] : NULL,
|
||||
'description' => (($profile) ? $profile[0]['pdesc'] : NULL),
|
||||
'profile_image_url' => $uinfo[0]['micro'],
|
||||
'profile_image_url_https' => $uinfo[0]['micro'],
|
||||
'url' => $uinfo[0]['url'],
|
||||
'protected' => false,
|
||||
'followers_count' => intval($countfollowers),
|
||||
|
|
|
@ -868,6 +868,7 @@ function diaspora_post($importer,$xml,$msg) {
|
|||
$datarray['uid'] = $importer['uid'];
|
||||
$datarray['contact-id'] = $contact['id'];
|
||||
$datarray['wall'] = 0;
|
||||
$datarray['network'] = NETWORK_DIASPORA;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $datarray['parent-uri'] = $message_id;
|
||||
$datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
|
||||
|
@ -1032,6 +1033,7 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||
$datarray['uid'] = $importer['uid'];
|
||||
$datarray['contact-id'] = $contact['id'];
|
||||
$datarray['wall'] = 0;
|
||||
$datarray['network'] = NETWORK_DIASPORA;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $datarray['parent-uri'] = $message_id;
|
||||
$datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
|
||||
|
@ -1140,6 +1142,7 @@ function diaspora_asphoto($importer,$xml,$msg) {
|
|||
$datarray['uid'] = $importer['uid'];
|
||||
$datarray['contact-id'] = $contact['id'];
|
||||
$datarray['wall'] = 0;
|
||||
$datarray['network'] = NETWORK_DIASPORA;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $datarray['parent-uri'] = $message_id;
|
||||
$datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
|
||||
|
@ -1312,6 +1315,7 @@ function diaspora_comment($importer,$xml,$msg) {
|
|||
$datarray['contact-id'] = $contact['id'];
|
||||
$datarray['type'] = 'remote-comment';
|
||||
$datarray['wall'] = $parent_item['wall'];
|
||||
$datarray['network'] = NETWORK_DIASPORA;
|
||||
$datarray['gravity'] = GRAVITY_COMMENT;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $message_id;
|
||||
|
@ -1894,6 +1898,7 @@ EOT;
|
|||
$arr['uri'] = $uri;
|
||||
$arr['uid'] = $importer['uid'];
|
||||
$arr['guid'] = $guid;
|
||||
$arr['network'] = NETWORK_DIASPORA;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
$arr['type'] = 'activity';
|
||||
$arr['wall'] = $parent_item['wall'];
|
||||
|
|
|
@ -146,6 +146,7 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio
|
|||
}
|
||||
|
||||
$arr = array();
|
||||
$arr["network"] = NETWORK_OSTATUS;
|
||||
$arr["uri"] = $single_conv->id;
|
||||
$arr["plink"] = $single_conv->id;
|
||||
$arr["uid"] = $message["uid"];
|
||||
|
|
|
@ -134,7 +134,7 @@ function display_content(&$a, $update = 0) {
|
|||
return '';
|
||||
}
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
|
@ -163,7 +163,7 @@ function display_content(&$a, $update = 0) {
|
|||
if($r) {
|
||||
$item_uri = $r[0]['uri'];
|
||||
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
|
|
20
mod/item.php
20
mod/item.php
|
@ -200,6 +200,7 @@ function item_post(&$a) {
|
|||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
$private = $orig_post['private'];
|
||||
$pubmail_enable = $orig_post['pubmail'];
|
||||
$network = $orig_post['network'];
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -234,6 +235,7 @@ function item_post(&$a) {
|
|||
$verb = notags(trim($_REQUEST['verb']));
|
||||
$emailcc = notags(trim($_REQUEST['emailcc']));
|
||||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
$network = notags(trim($_REQUEST['network']));
|
||||
|
||||
|
||||
$naked_body = preg_replace('/\[(.+?)\]/','',$body);
|
||||
|
@ -275,6 +277,12 @@ function item_post(&$a) {
|
|||
if($parent_item) {
|
||||
$private = 0;
|
||||
|
||||
// for non native networks use the network of the original post as network of the item
|
||||
if (($parent_item['network'] != NETWORK_DIASPORA)
|
||||
AND ($parent_item['network'] != NETWORK_OSTATUS)
|
||||
AND ($network == ""))
|
||||
$network = $parent_item['network'];
|
||||
|
||||
if(($parent_item['private'])
|
||||
|| strlen($parent_item['allow_cid'])
|
||||
|| strlen($parent_item['allow_gid'])
|
||||
|
@ -288,7 +296,6 @@ function item_post(&$a) {
|
|||
$str_contact_deny = $parent_item['deny_cid'];
|
||||
$str_group_deny = $parent_item['deny_gid'];
|
||||
}
|
||||
|
||||
$pubmail_enable = ((x($_REQUEST,'pubmail_enable') && intval($_REQUEST['pubmail_enable']) && (! $private)) ? 1 : 0);
|
||||
|
||||
// if using the API, we won't see pubmail_enable - figure out if it should be set
|
||||
|
@ -584,6 +591,9 @@ function item_post(&$a) {
|
|||
if(! strlen($verb))
|
||||
$verb = ACTIVITY_POST ;
|
||||
|
||||
if ($network == "")
|
||||
$network = NETWORK_DFRN;
|
||||
|
||||
$gravity = (($parent) ? 6 : 0 );
|
||||
|
||||
// even if the post arrived via API we are considering that it
|
||||
|
@ -604,6 +614,7 @@ function item_post(&$a) {
|
|||
$datarray['type'] = $post_type;
|
||||
$datarray['wall'] = $wall;
|
||||
$datarray['gravity'] = $gravity;
|
||||
$datarray['network'] = $network;
|
||||
$datarray['contact-id'] = $contact_id;
|
||||
$datarray['owner-name'] = $contact_record['name'];
|
||||
$datarray['owner-link'] = $contact_record['url'];
|
||||
|
@ -709,15 +720,16 @@ function item_post(&$a) {
|
|||
$post_id = 0;
|
||||
|
||||
|
||||
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
||||
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
||||
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
|
||||
`tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file` )
|
||||
VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )",
|
||||
VALUES( '%s', %d, '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )",
|
||||
dbesc($datarray['guid']),
|
||||
intval($datarray['uid']),
|
||||
dbesc($datarray['type']),
|
||||
intval($datarray['wall']),
|
||||
intval($datarray['gravity']),
|
||||
dbesc($datarray['network']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['owner-name']),
|
||||
dbesc($datarray['owner-link']),
|
||||
|
@ -1103,7 +1115,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
|
|||
if(count($r)) {
|
||||
$profile = $r[0]['url'];
|
||||
//set newname to nick, find alias
|
||||
if($r[0]['network'] === 'stat') {
|
||||
if(($r[0]['network'] === NETWORK_OSTATUS) OR ($r[0]['network'] === NETWORK_TWITTER)) {
|
||||
$newname = $r[0]['nick'];
|
||||
$stat = true;
|
||||
if($r[0]['alias'])
|
||||
|
|
|
@ -746,7 +746,7 @@ function network_content(&$a, $update = 0) {
|
|||
if($nouveau) {
|
||||
// "New Item View" - show all items unthreaded in reverse created date order
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
|
@ -786,7 +786,7 @@ function network_content(&$a, $update = 0) {
|
|||
// Fetch a page full of parent items for this page
|
||||
|
||||
if($update) {
|
||||
$r = q("SELECT `item`.`parent` AS `item_id`, `contact`.`uid` AS `contact_uid`
|
||||
$r = q("SELECT `item`.`parent` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
|
||||
FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
||||
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
|
||||
|
@ -797,7 +797,7 @@ function network_content(&$a, $update = 0) {
|
|||
);
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
|
||||
$r = q("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid`
|
||||
FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
|
@ -832,7 +832,7 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
foreach ($parents_arr AS $parents_str) {
|
||||
|
||||
$thread_items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
$thread_items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
|
||||
`contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
|
|
|
@ -217,7 +217,8 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
if($update) {
|
||||
|
||||
$r = q("SELECT distinct(parent) AS `item_id`, `contact`.`uid` AS `contact-uid`
|
||||
$r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`uid` AS `contact-uid`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND
|
||||
(`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "')
|
||||
|
@ -278,7 +279,8 @@ function profile_content(&$a, $update = 0) {
|
|||
|
||||
// FROM `item` FORCE INDEX (created, uid) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
|
||||
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
|
||||
$r = q("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`uid` AS `contact-uid`
|
||||
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
|
||||
and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
|
||||
|
@ -299,7 +301,7 @@ function profile_content(&$a, $update = 0) {
|
|||
$parents_arr[] = $rr['item_id'];
|
||||
$parents_str = implode(', ', $parents_arr);
|
||||
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
|
||||
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`,
|
||||
`contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
|
||||
`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
|
||||
|
|
|
@ -322,7 +322,9 @@ class Item extends BaseObject {
|
|||
'wait' => t('Please wait'),
|
||||
'thread_level' => $thread_level,
|
||||
'postopts' => $langstr,
|
||||
'edited' => $edited
|
||||
'edited' => $edited,
|
||||
'network' => $item["item_network"],
|
||||
'network_name' => network_to_name($item['item_network']),
|
||||
);
|
||||
|
||||
$arr = array('item' => $item, 'output' => $tmp_item);
|
||||
|
|
|
@ -480,8 +480,9 @@ div.jGrowl div.info {
|
|||
padding-left: 58px;
|
||||
}
|
||||
|
||||
div.jGrowl div.jGrowl-notification {
|
||||
margin-top: 40px;
|
||||
div.jGrowl.top-right {
|
||||
top: 40px;
|
||||
z-index: 90;
|
||||
}
|
||||
|
||||
/* header */
|
||||
|
@ -533,7 +534,8 @@ nav {
|
|||
top: 0px;
|
||||
padding: 0px;
|
||||
padding-left: 0px;
|
||||
background: #2d2d2d;
|
||||
/* background: #2d2d2d; */
|
||||
background: rgb(36, 76, 94);
|
||||
/*background: #364A84;
|
||||
background: -moz-linear-gradient(top, #516499 0%, #364a84 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#516499), color-stop(100%,#364a84));
|
||||
|
@ -1160,6 +1162,14 @@ border-bottom: 1px solid #D2D2D2;
|
|||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wall-item-network {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.wall-item-location {
|
||||
width: 350px;
|
||||
float: left;
|
||||
|
@ -1396,8 +1406,8 @@ border-bottom: 1px solid #D2D2D2;
|
|||
|
||||
.shiny {
|
||||
/* border-right: 10px solid #fce94f; */
|
||||
border-right: 1px solid #A7C7F7;
|
||||
padding-right: 12px;
|
||||
/* border-right: 1px solid #A7C7F7;
|
||||
padding-right: 12px; */
|
||||
}
|
||||
|
||||
#profile-jot-form #profile-jot-text {
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
{{if $item.plink}}<a title="{{$item.plink.title}}" href="{{$item.plink.href}}" style="color: #999">{{$item.ago}}</a>{{else}} {{$item.ago}} {{/if}}
|
||||
{{if $item.lock}}<span class="fakelink" style="color: #999" onclick="lockview(event,{{$item.id}});">{{$item.lock}}</span> {{/if}}
|
||||
</span>
|
||||
<span class="wall-item-network">
|
||||
{{$item.network_name}}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div itemprop="description" class="wall-item-content">
|
||||
|
|
|
@ -11,10 +11,29 @@
|
|||
function vier_init(&$a) {
|
||||
set_template_engine($a, 'smarty3');
|
||||
|
||||
$baseurl = $a->get_baseurl();
|
||||
|
||||
$a->theme_info = array();
|
||||
|
||||
$a->page['htmlhead'] .= <<< EOT
|
||||
<script type="text/javascript" src="$baseurl/view/theme/vier/js/jquery.divgrow-1.3.1.f1.min.js"></script>
|
||||
<script>
|
||||
|
||||
function collapseHeight(elems) {
|
||||
var elemName = '.wall-item-body:not(.divmore)';
|
||||
if(typeof elems != 'undefined') {
|
||||
elemName = elems + ' ' + elemName;
|
||||
}
|
||||
$(elemName).each(function() {
|
||||
if($(this).height() > 450) {
|
||||
$('html').height($('html').height());
|
||||
$(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 0 });
|
||||
$(this).addClass('divmore');
|
||||
$('html').height('auto');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function insertFormatting(comment,BBcode,id) {
|
||||
|
||||
var tmpStr = $("#comment-edit-text-" + id).val();
|
||||
|
@ -62,50 +81,6 @@ function cmtBbOpen(id) {
|
|||
function cmtBbClose(id) {
|
||||
$("#comment-edit-bb-" + id).hide();
|
||||
}
|
||||
|
||||
/*
|
||||
$(document).ready(function() {
|
||||
|
||||
$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
|
||||
|
||||
$('.group-edit-icon').hover(
|
||||
function() {
|
||||
$(this).addClass('icon'); $(this).removeClass('iconspacer');},
|
||||
function() {
|
||||
$(this).removeClass('icon'); $(this).addClass('iconspacer');}
|
||||
);
|
||||
|
||||
$('.sidebar-group-element').hover(
|
||||
function() {
|
||||
id = $(this).attr('id');
|
||||
$('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
|
||||
|
||||
function() {
|
||||
id = $(this).attr('id');
|
||||
$('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
|
||||
);
|
||||
|
||||
|
||||
$('.savedsearchdrop').hover(
|
||||
function() {
|
||||
$(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
|
||||
function() {
|
||||
$(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
|
||||
);
|
||||
|
||||
$('.savedsearchterm').hover(
|
||||
function() {
|
||||
id = $(this).attr('id');
|
||||
$('#drop-' + id).addClass('icon'); $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
|
||||
|
||||
function() {
|
||||
id = $(this).attr('id');
|
||||
$('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
*/
|
||||
</script>
|
||||
EOT;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue