item source
This commit is contained in:
parent
db336929cd
commit
55112cfdd0
4
boot.php
4
boot.php
|
@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000);
|
||||||
|
|
||||||
define ( 'FRIENDIKA_VERSION', '2.2.1017' );
|
define ( 'FRIENDIKA_VERSION', '2.2.1017' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1064 );
|
define ( 'DB_UPDATE_VERSION', 1065 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
@ -128,6 +128,8 @@ define ( 'NAMESPACE_OSTATUSSUB', 'http://ostatus.org/schema/1.0/subscribe'
|
||||||
define ( 'NAMESPACE_GEORSS', 'http://www.georss.org/georss' );
|
define ( 'NAMESPACE_GEORSS', 'http://www.georss.org/georss' );
|
||||||
define ( 'NAMESPACE_POCO', 'http://portablecontacts.net/spec/1.0' );
|
define ( 'NAMESPACE_POCO', 'http://portablecontacts.net/spec/1.0' );
|
||||||
define ( 'NAMESPACE_FEED', 'http://schemas.google.com/g/2010#updates-from' );
|
define ( 'NAMESPACE_FEED', 'http://schemas.google.com/g/2010#updates-from' );
|
||||||
|
define ( 'NAMESPACE_OSTATUS', 'http://ostatus.org/schema/1.0' );
|
||||||
|
define ( 'NAMESPACE_STATUSNET', 'http://status.net/schema/api/1/' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* activity stream defines
|
* activity stream defines
|
||||||
|
|
|
@ -179,6 +179,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
`author-avatar` char(255) NOT NULL,
|
`author-avatar` char(255) NOT NULL,
|
||||||
`title` char(255) NOT NULL,
|
`title` char(255) NOT NULL,
|
||||||
`body` mediumtext NOT NULL,
|
`body` mediumtext NOT NULL,
|
||||||
|
`app` char(255) NOT NULL,
|
||||||
`verb` char(255) NOT NULL,
|
`verb` char(255) NOT NULL,
|
||||||
`object-type` char(255) NOT NULL,
|
`object-type` char(255) NOT NULL,
|
||||||
`object` text NOT NULL,
|
`object` text NOT NULL,
|
||||||
|
|
|
@ -315,7 +315,7 @@
|
||||||
api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
|
api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
|
||||||
|
|
||||||
|
|
||||||
// TODO - media uploads and alternate 'source'
|
// TODO - media uploads
|
||||||
|
|
||||||
function api_statuses_update(&$a, $type) {
|
function api_statuses_update(&$a, $type) {
|
||||||
if (local_user()===false) return false;
|
if (local_user()===false) return false;
|
||||||
|
@ -379,7 +379,7 @@
|
||||||
'created_at' => api_date($lastwall['created']),
|
'created_at' => api_date($lastwall['created']),
|
||||||
'id' => $lastwall['contact-id'],
|
'id' => $lastwall['contact-id'],
|
||||||
'text' => strip_tags(bbcode($lastwall['body'])),
|
'text' => strip_tags(bbcode($lastwall['body'])),
|
||||||
'source' => 'web',
|
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
'in_reply_to_user_id' => $in_reply_to_user_id,
|
'in_reply_to_user_id' => $in_reply_to_user_id,
|
||||||
|
@ -436,7 +436,7 @@
|
||||||
'created_at' => api_date($lastwall['created']),
|
'created_at' => api_date($lastwall['created']),
|
||||||
'id' => $lastwall['contact-id'],
|
'id' => $lastwall['contact-id'],
|
||||||
'text' => strip_tags(bbcode($lastwall['body'])),
|
'text' => strip_tags(bbcode($lastwall['body'])),
|
||||||
'source' => 'web',
|
'source' => (($lastwall['app']) ? $lastwall['app'] : 'web'),
|
||||||
'truncated' => false,
|
'truncated' => false,
|
||||||
'in_reply_to_status_id' => $in_reply_to_status_id,
|
'in_reply_to_status_id' => $in_reply_to_status_id,
|
||||||
'in_reply_to_user_id' => $in_reply_to_user_id,
|
'in_reply_to_user_id' => $in_reply_to_user_id,
|
||||||
|
@ -492,7 +492,7 @@
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'text' => strip_tags(bbcode($item['body'])),
|
'text' => strip_tags(bbcode($item['body'])),
|
||||||
'html' => bbcode($item['body']),
|
'html' => bbcode($item['body']),
|
||||||
'source' => 'web',
|
'source' => (($item['app']) ? $item['app'] : 'web'),
|
||||||
'url' => ($item['plink']!=''?$item['plink']:$item['author-link']),
|
'url' => ($item['plink']!=''?$item['plink']:$item['author-link']),
|
||||||
'truncated' => False,
|
'truncated' => False,
|
||||||
'in_reply_to_status_id' => ($item['parent']!=$item['id']?$item['parent']:''),
|
'in_reply_to_status_id' => ($item['parent']!=$item['id']?$item['parent']:''),
|
||||||
|
|
|
@ -191,7 +191,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
'$thumb' => $profile_avatar,
|
'$thumb' => $profile_avatar,
|
||||||
'$title' => $item['title'],
|
'$title' => $item['title'],
|
||||||
'$body' => $body,
|
'$body' => $body,
|
||||||
'$ago' => relative_date($item['created']),
|
'$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
|
||||||
'$location' => $location,
|
'$location' => $location,
|
||||||
'$indent' => '',
|
'$indent' => '',
|
||||||
'$owner_url' => $owner_url,
|
'$owner_url' => $owner_url,
|
||||||
|
@ -464,7 +464,7 @@ function conversation(&$a, $items, $mode, $update) {
|
||||||
'$sparkle' => $sparkle,
|
'$sparkle' => $sparkle,
|
||||||
'$title' => $item['title'],
|
'$title' => $item['title'],
|
||||||
'$body' => $body,
|
'$body' => $body,
|
||||||
'$ago' => relative_date($item['created']),
|
'$ago' => (($item['app']) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
|
||||||
'$lock' => $lock,
|
'$lock' => $lock,
|
||||||
'$location' => $location,
|
'$location' => $location,
|
||||||
'$indent' => $indent,
|
'$indent' => $indent,
|
||||||
|
|
|
@ -336,6 +336,12 @@ function get_atom_elements($feed,$item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$apps = $item->get_item_tags(NAMESPACE_STATUSNET,'notice_info');
|
||||||
|
if($apps && $apps[0]['attribs']['']['source']) {
|
||||||
|
$res['app'] = $apps[0]['attribs']['']['source'];
|
||||||
|
if($res['app'] === 'web')
|
||||||
|
$res['app'] = 'OStatus';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
|
* If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.
|
||||||
|
@ -685,6 +691,7 @@ function item_store($arr,$force_parent = false) {
|
||||||
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
|
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
|
||||||
$arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : '');
|
$arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : '');
|
||||||
$arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
|
$arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : '');
|
||||||
|
$arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : '');
|
||||||
|
|
||||||
if($arr['parent-uri'] === $arr['uri']) {
|
if($arr['parent-uri'] === $arr['uri']) {
|
||||||
$parent_id = 0;
|
$parent_id = 0;
|
||||||
|
@ -1620,7 +1627,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
|
||||||
if($item['extid'])
|
if($item['extid'])
|
||||||
$o .= '<dfrn:extid>' . $item['extid'] . '</dfrn:extid>' . "\r\n";
|
$o .= '<dfrn:extid>' . $item['extid'] . '</dfrn:extid>' . "\r\n";
|
||||||
|
|
||||||
|
if($item['app'])
|
||||||
|
$o .= '<statusnet:notice_info local_id="' . $item['id'] . '" source="' . $item['app'] . '" ></statusnet:notice_info>';
|
||||||
$verb = construct_verb($item);
|
$verb = construct_verb($item);
|
||||||
$o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n";
|
$o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n";
|
||||||
$actobj = construct_activity_object($item);
|
$actobj = construct_activity_object($item);
|
||||||
|
|
|
@ -129,7 +129,8 @@ $namespaces = <<< EOT
|
||||||
xmlns:as="http://activitystrea.ms/spec/1.0/"
|
xmlns:as="http://activitystrea.ms/spec/1.0/"
|
||||||
xmlns:georss="http://www.georss.org/georss"
|
xmlns:georss="http://www.georss.org/georss"
|
||||||
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
||||||
xmlns:ostatus="http://ostatus.org/schema/1.0" >
|
xmlns:ostatus="http://ostatus.org/schema/1.0"
|
||||||
|
xmlns:statusnet="http://status.net/schema/api/1/" > >
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
$slap = str_replace('<entry>',$namespaces,$slap);
|
$slap = str_replace('<entry>',$namespaces,$slap);
|
||||||
|
|
|
@ -61,6 +61,7 @@ function item_post(&$a) {
|
||||||
|
|
||||||
$profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0);
|
$profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0);
|
||||||
$post_id = ((x($_POST['post_id'])) ? intval($_POST['post_id']) : 0);
|
$post_id = ((x($_POST['post_id'])) ? intval($_POST['post_id']) : 0);
|
||||||
|
$app = ((x($_POST['source'])) ? notags($_POST['source']) : '');
|
||||||
|
|
||||||
if(! can_write_wall($a,$profile_uid)) {
|
if(! can_write_wall($a,$profile_uid)) {
|
||||||
notice( t('Permission denied.') . EOL) ;
|
notice( t('Permission denied.') . EOL) ;
|
||||||
|
@ -102,6 +103,7 @@ function item_post(&$a) {
|
||||||
$coord = $orig_post['coord'];
|
$coord = $orig_post['coord'];
|
||||||
$verb = $orig_post['verb'];
|
$verb = $orig_post['verb'];
|
||||||
$emailcc = $orig_post['emailcc'];
|
$emailcc = $orig_post['emailcc'];
|
||||||
|
$app = $orig_post['app'];
|
||||||
|
|
||||||
$body = escape_tags(trim($_POST['body']));
|
$body = escape_tags(trim($_POST['body']));
|
||||||
$private = $orig_post['private'];
|
$private = $orig_post['private'];
|
||||||
|
@ -421,6 +423,7 @@ function item_post(&$a) {
|
||||||
$datarray['uri'] = $uri;
|
$datarray['uri'] = $uri;
|
||||||
$datarray['title'] = $title;
|
$datarray['title'] = $title;
|
||||||
$datarray['body'] = $body;
|
$datarray['body'] = $body;
|
||||||
|
$datarray['app'] = $app;
|
||||||
$datarray['location'] = $location;
|
$datarray['location'] = $location;
|
||||||
$datarray['coord'] = $coord;
|
$datarray['coord'] = $coord;
|
||||||
$datarray['tag'] = $str_tags;
|
$datarray['tag'] = $str_tags;
|
||||||
|
@ -469,9 +472,9 @@ function item_post(&$a) {
|
||||||
|
|
||||||
|
|
||||||
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
||||||
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `location`, `coord`,
|
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `app`, `location`, `coord`,
|
||||||
`tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
|
`tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach` )
|
||||||
VALUES( %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', %d, %d, '%s' )",
|
VALUES( %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', %d, %d, '%s' )",
|
||||||
intval($datarray['uid']),
|
intval($datarray['uid']),
|
||||||
dbesc($datarray['type']),
|
dbesc($datarray['type']),
|
||||||
intval($datarray['wall']),
|
intval($datarray['wall']),
|
||||||
|
@ -489,6 +492,7 @@ function item_post(&$a) {
|
||||||
dbesc($datarray['uri']),
|
dbesc($datarray['uri']),
|
||||||
dbesc($datarray['title']),
|
dbesc($datarray['title']),
|
||||||
dbesc($datarray['body']),
|
dbesc($datarray['body']),
|
||||||
|
dbesc($datarray['app']),
|
||||||
dbesc($datarray['location']),
|
dbesc($datarray['location']),
|
||||||
dbesc($datarray['coord']),
|
dbesc($datarray['coord']),
|
||||||
dbesc($datarray['tag']),
|
dbesc($datarray['tag']),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1064 );
|
define( 'UPDATE_VERSION' , 1065 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -521,3 +521,6 @@ function update_1063() {
|
||||||
q("ALTER TABLE `addon` ADD `plugin_admin` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `timestamp` ");
|
q("ALTER TABLE `addon` ADD `plugin_admin` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `timestamp` ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1064() {
|
||||||
|
q("ALTER TABLE `item` ADD `app` CHAR( 255 ) NOT NULL AFTER `body` ");
|
||||||
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
xmlns:as="http://activitystrea.ms/spec/1.0/"
|
xmlns:as="http://activitystrea.ms/spec/1.0/"
|
||||||
xmlns:georss="http://www.georss.org/georss"
|
xmlns:georss="http://www.georss.org/georss"
|
||||||
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
xmlns:poco="http://portablecontacts.net/spec/1.0"
|
||||||
xmlns:ostatus="http://ostatus.org/schema/1.0" >
|
xmlns:ostatus="http://ostatus.org/schema/1.0"
|
||||||
|
xmlns:statusnet="http://status.net/schema/api/1/" >
|
||||||
|
|
||||||
<id>$feed_id</id>
|
<id>$feed_id</id>
|
||||||
<title>$feed_title</title>
|
<title>$feed_title</title>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user