Merge branch 'master' into FeedPoller

This commit is contained in:
Mikael Nordfeldth
2014-03-06 01:15:19 +01:00
86 changed files with 386 additions and 1046 deletions

View File

@@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
* List users for autocompletion
* List profiles and groups for autocompletion
*
* PHP version 5
*
@@ -29,7 +29,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
exit(1);
}
@@ -62,8 +62,8 @@ class AutocompleteAction extends Action
function lastModified()
{
$max=0;
foreach($this->users as $user){
$max = max($max,strtotime($user->modified),strtotime($user->getProfile()->modified));
foreach($this->profiles as $profile){
$max = max($max,strtotime($user->modified),strtotime($profile->modified));
}
foreach($this->groups as $group){
$max = max($max,strtotime($group->modified));
@@ -103,19 +103,22 @@ class AutocompleteAction extends Action
}
$this->groups=array();
$this->users=array();
$this->profiles=array();
$term = $this->arg('term');
$limit = $this->arg('limit');
if($limit > 200) $limit=200; //prevent DOS attacks
if(substr($term,0,1)=='@'){
//user search
//profile search
$term=substr($term,1);
$user = new User();
$user->limit($limit);
$user->whereAdd('nickname like \'' . trim($user->escape($term), '\'') . '%\'');
if($user->find()){
while($user->fetch()) {
$this->users[]=clone($user);
$profile = new Profile();
$profile->limit($limit);
$profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\'');
$profile->whereAdd(sprintf('id in (SELECT id FROM user) OR '
. 'id in (SELECT subscribed from subscription'
. ' where subscriber = %d)', $cur->id));
if ($profile->find()) {
while($profile->fetch()) {
$this->profiles[]=clone($profile);
}
}
}
@@ -139,8 +142,7 @@ class AutocompleteAction extends Action
parent::handle();
$results = array();
foreach($this->users as $user){
$profile = $user->getProfile();
foreach($this->profiles as $profile){
$avatarUrl = $profile->avatarUrl(AVATAR_MINI_SIZE);
$results[] = array(
'value' => '@'.$profile->nickname,

View File

@@ -27,7 +27,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
exit(1);
}
@@ -64,10 +64,10 @@ class CometPlugin extends RealtimePlugin
{
$scripts = parent::_getScripts();
$ours = array('jquery.comet.js', 'cometupdate.js');
$ours = array('js/jquery.comet.js', 'js/cometupdate.js');
foreach ($ours as $script) {
$scripts[] = 'plugins/Comet/'.$script;
$scripts[] = $this->path($script);
}
return $scripts;
@@ -81,7 +81,7 @@ class CometPlugin extends RealtimePlugin
function _connect()
{
require_once INSTALLDIR.'/plugins/Comet/bayeux.class.inc.php';
require_once INSTALLDIR.'/plugins/Comet/extlib/Bayeux/Bayeux.class.php';
// Bayeux? Comet? Huh? These terms confuse me
$this->bay = new Bayeux($this->server, $this->user, $this->password);
}

View File

@@ -52,12 +52,7 @@ class LinkPreviewPlugin extends Plugin
{
$user = common_current_user();
if ($user && common_config('attachments', 'process_links')) {
if (common_config('site', 'minify')) {
$js = 'linkpreview.min.js';
} else {
$js = 'linkpreview.js';
}
$action->script($this->path($js));
$action->script($this->path('js/linkpreview.js'));
$data = json_encode(array(
'api' => common_local_url('oembedproxy'),
'width' => common_config('attachments', 'thumbwidth'),

View File

@@ -1 +0,0 @@
(function(){var b={api:"https://noembed.com/embed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f<g.length;f++){g[f](h)}})}else{b.callbacks[d].push(e)}}},rawLookup:function(d,f){var e={url:d,format:"json",maxwidth:b.width,maxheight:b.height,token:$("#token").val()};$.ajax({url:b.api,data:e,dataType:"json",success:function(g,h){f(g)},error:function(h,i,g){f(null)}})}};SN.Init.LinkPreview=function(d){if(d.api){b.api=d.api}if(d.width){b.width=d.width}if(d.height){b.height=d.height}};var c=SN.U.Counter;SN.U.Counter=function(d){var e=d.data("LinkPreview");if(e){e.previewLinks(d.find(".notice_data-text:first").val())}return c(d)};var a=SN.Init.NoticeFormSetup;SN.Init.NoticeFormSetup=function(d){a(d);d.bind("reset",function(){e.clear()});var e={links:[],state:[],refresh:[],findLinks:function(i){var g=/(?:^| )(https?:\/\/.+?\/.+?)(?= |$)/mg;var f=[];var h;while((h=g.exec(i))!==null){f.push(h[1])}return f},ensureArea:function(){if(d.find(".link-preview").length<1){d.append('<div class="notice-status link-preview thumbnails"></div>')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width<j){j=l.thumbnail_width}}}else{if(l&&l.type=="photo"&&typeof l.url=="string"){i=l.url;if(typeof l.width!=="undefined"){if(l.width<j){j=l.width}}}}if(i){e.ensureArea();var k=$('<span class="inline-attachment"><a><img/></a></span>');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;h<f.length&&h<g.length;h++){if(g[h]!=f[h]){if(e.state[h]=="loading"){e.refresh[h]=true}else{e.prepLinkPreview(h)}}}if(g.length>f.length){for(h=f.length;h<g.length;h++){e.addPreviewArea(h);e.prepLinkPreview(h)}}else{if(f.length>g.length){for(h=g.length;h<f.length;h++){e.clearLink(h)}}}if(g.length==0){e.clear()}},addPreviewArea:function(f){e.ensureArea();var g="link-preview-"+f;if(d.find("."+g).length<1){d.find(".link-preview").append('<span class="'+g+'"></span>')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})();

View File

@@ -27,7 +27,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
exit(1);
}
@@ -96,7 +96,7 @@ class MeteorPlugin extends RealtimePlugin
} else {
$scripts[] = 'http://'.$this->webserver.(($this->webport == 80) ? '':':'.$this->webport).'/meteor.js';
}
$scripts[] = $this->path('meteorupdater.min.js');
$scripts[] = $this->path('js/meteorupdater.js');
return $scripts;
}

View File

@@ -1 +0,0 @@
var MeteorUpdater=function(){return{init:function(c,a,b){Meteor.callbacks.process=function(d){RealtimeUpdate.receive(JSON.parse(d))};Meteor.host=c;Meteor.port=a;Meteor.joinChannel(b,0);Meteor.connect()}}}();

View File

@@ -332,7 +332,7 @@ class OStatusPlugin extends Plugin
* Find any explicit remote mentions. Accepted forms:
* Webfinger: @user@example.com
* Profile link: @example.com/mublog/user
* @param Profile $sender (os user?)
* @param Profile $sender
* @param string $text input markup text
* @param array &$mention in/out param: set of found mentions
* @return boolean hook return value
@@ -354,6 +354,7 @@ class OStatusPlugin extends Plugin
if ($oprofile && !$oprofile->isGroup()) {
$profile = $oprofile->localProfile();
$matches[$pos] = array('mentioned' => array($profile),
'type' => 'mention',
'text' => $target,
'position' => $pos,
'url' => $profile->profileurl);
@@ -380,6 +381,7 @@ class OStatusPlugin extends Plugin
if ($oprofile && !$oprofile->isGroup()) {
$profile = $oprofile->localProfile();
$matches[$pos] = array('mentioned' => array($profile),
'type' => 'mention',
'text' => $target,
'position' => $pos,
'url' => $profile->profileurl);

View File

@@ -218,7 +218,7 @@ class OStatusInitAction extends Action
}
} else if ($this->group) {
$group = Local_group::getKV('nickname', $this->group);
if ($group) {
if ($group instanceof Local_group) {
return common_local_url('groupbyid', array('id' => $group->group_id));
} else {
// TRANS: Client error.

View File

@@ -22,9 +22,7 @@
* @maintainer Brion Vibber <brion@status.net>
*/
if (!defined('STATUSNET')) {
exit(1);
}
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* Key UI methods:
@@ -42,16 +40,44 @@ class OStatusSubAction extends Action
protected $profile_uri; // provided acct: or URI of remote entity
protected $oprofile; // Ostatus_profile of remote entity, if valid
protected function prepare(array $args=array())
{
parent::prepare($args);
if (!common_logged_in()) {
// XXX: selfURL() didn't work. :<
common_set_returnto($_SERVER['REQUEST_URI']);
if (Event::handle('RedirectToLogin', array($this, null))) {
common_redirect(common_local_url('login'), 303);
}
return false;
}
if ($this->pullRemoteProfile()) {
$this->validateRemoteProfile();
}
return true;
}
/**
* Handle the submission.
*/
protected function handle()
{
parent::handle();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->handlePost();
} else {
$this->showForm();
}
}
/**
* Show the initial form, when we haven't yet been given a valid
* remote profile.
*/
function showInputForm()
{
$user = common_current_user();
$profile = $user->getProfile();
$this->elementStart('form', array('method' => 'post',
'id' => 'form_ostatus_sub',
'class' => 'form_settings',
@@ -132,8 +158,7 @@ class OStatusSubAction extends Action
$oprofile = $this->oprofile;
$profile = $oprofile->localProfile();
$cur = common_current_user();
if ($cur->isSubscribed($profile)) {
if ($this->scoped->isSubscribed($profile)) {
$this->element('div', array('class' => 'error'),
// TRANS: Extra paragraph in remote profile view when already subscribed.
_m('You are already subscribed to this user.'));
@@ -203,8 +228,7 @@ class OStatusSubAction extends Action
*/
function success()
{
$cur = common_current_user();
$url = common_local_url('subscriptions', array('nickname' => $cur->nickname));
$url = common_local_url('subscriptions', array('nickname' => $this->scoped->nickname));
common_redirect($url, 303);
}
@@ -288,12 +312,11 @@ class OStatusSubAction extends Action
function saveFeed()
{
// And subscribe the current user to the local profile
$user = common_current_user();
$local = $this->oprofile->localProfile();
if ($user->isSubscribed($local)) {
if ($this->scoped->isSubscribed($local)) {
// TRANS: OStatus remote subscription dialog error.
$this->showForm(_m('Already subscribed!'));
} elseif (Subscription::start($user->getProfile(), $local)) {
} elseif (Subscription::start($this->scoped, $local)) {
$this->success();
} else {
// TRANS: OStatus remote subscription dialog error.
@@ -301,38 +324,6 @@ class OStatusSubAction extends Action
}
}
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
// XXX: selfURL() didn't work. :<
common_set_returnto($_SERVER['REQUEST_URI']);
if (Event::handle('RedirectToLogin', array($this, null))) {
common_redirect(common_local_url('login'), 303);
}
return false;
}
if ($this->pullRemoteProfile()) {
$this->validateRemoteProfile();
}
return true;
}
/**
* Handle the submission.
*/
function handle($args)
{
parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$this->handlePost();
} else {
$this->showForm();
}
}
/**
* Handle posts to this form
*

View File

@@ -52,7 +52,7 @@ class PushCallbackAction extends Action
}
$feedsub = FeedSub::getKV('id', $feedid);
if (!$feedsub) {
if (!$feedsub instanceof FeedSub) {
// TRANS: Server exception. %s is a feed ID.
throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
}

View File

@@ -261,11 +261,16 @@ class FeedSub extends Managed_DataObject
}
/**
* Setting to subscribe means it is _waiting_ to become active. This
* cannot be done in a transaction because there is a chance that the
* remote script we're calling (as in the case of PuSHpress) performs
* the lookup _while_ we're POSTing data, which means the transaction
* never completes (PushcallbackAction gets an 'inactive' state).
*
* @return boolean true on successful sub/unsub, false on failure
*/
protected function doSubscribe($mode)
{
$this->query('BEGIN');
$orig = clone($this);
if ($mode == 'subscribe') {
$this->secret = common_random_hexstr(32);
@@ -302,7 +307,6 @@ class FeedSub extends Managed_DataObject
$response = $client->post($hub, $headers, $post);
$status = $response->getStatus();
if ($status == 202) {
$this->query('COMMIT');
common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback');
return true;
} else if ($status >= 200 && $status < 300) {
@@ -310,9 +314,7 @@ class FeedSub extends Managed_DataObject
} else {
common_log(LOG_ERR, __METHOD__ . ": sub req failed with HTTP $status: " . $response->getBody());
}
$this->query('ROLLBACK');
} catch (Exception $e) {
$this->query('ROLLBACK');
// wtf!
common_log(LOG_ERR, __METHOD__ . ": error \"{$e->getMessage()}\" hitting hub $this->huburi subscribing to $this->uri");

View File

@@ -91,13 +91,15 @@ class Magicsig extends Managed_DataObject
static function getKV($k, $v=null)
{
$obj = parent::getKV($k, $v);
if (!empty($obj)) {
if ($obj instanceof Magicsig) {
// Please note we're replacing the $obj
// FIXME: There should be an import-key that modifies the fetched $obj
$obj = Magicsig::fromString($obj->keypair);
// Double check keys: Crypt_RSA did not
// consistently generate good keypairs.
// We've also moved to 1024 bit keys.
if (strlen($obj->publicKey->modulus->toBits()) != 1024) {
// Never allow less than 1024 bit keys.
// The only case these show up in would be imported or
// legacy very-old-StatusNet generated keypairs.
if (strlen($obj->publicKey->modulus->toBits()) < 1024) {
$obj->delete();
return false;
}
@@ -144,11 +146,11 @@ class Magicsig extends Managed_DataObject
*
* @param int $user_id id of local user we're creating a key for
*/
public function generate($user_id)
public function generate($user_id, $bits=1024)
{
$rsa = new Crypt_RSA();
$keypair = $rsa->createKey();
$keypair = $rsa->createKey($bits);
$rsa->loadKey($keypair['privatekey']);

View File

@@ -27,7 +27,7 @@
* @link http://laconi.ca/
*/
if (!defined('LACONICA')) {
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) {
exit(1);
}
@@ -76,9 +76,9 @@ class OrbitedPlugin extends RealtimePlugin
$root = 'http://'.$server.(($port == 80) ? '':':'.$port);
$scripts[] = $root.'/static/Orbited.js';
$scripts[] = 'plugins/Orbited/orbitedextra.js';
$scripts[] = $this->path('js/orbitedextra.js');
$scripts[] = $root.'/static/protocols/stomp/stomp.js';
$scripts[] = 'plugins/Orbited/orbitedupdater.js';
$scripts[] = $this->path('js/orbitedupdater.js');
return $scripts;
}

View File

@@ -65,6 +65,10 @@ class QnAPlugin extends MicroAppPlugin
return true;
}
public function newFormAction() {
return 'qnanewquestion';
}
/**
* Map URLs to actions
*

View File

@@ -142,9 +142,9 @@ class RealtimePlugin extends Plugin
public function onEndShowStylesheets(Action $action)
{
$action->cssLink(Plugin::staticPath('Realtime', 'realtimeupdate.css'),
null,
'screen, projection, tv');
$urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),
'css/realtimeupdate.css');
$action->cssLink($urlpath, null, 'screen, projection, tv');
return true;
}
@@ -391,12 +391,9 @@ class RealtimePlugin extends Plugin
function _getScripts()
{
if (common_config('site', 'minify')) {
$js = 'realtimeupdate.min.js';
} else {
$js = 'realtimeupdate.js';
}
return array(Plugin::staticPath('Realtime', $js));
$urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),
'js/realtimeupdate.js');
return array($urlpath);
}
/**

File diff suppressed because one or more lines are too long

View File

@@ -26,9 +26,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* Takes parameters:
@@ -56,7 +54,7 @@ class AddMirrorAction extends BaseMirrorAction
*
* @return boolean success flag
*/
function prepare($args)
protected function prepare(array $args=array())
{
parent::prepare($args);
$feedurl = $this->getFeedUrl();
@@ -71,17 +69,13 @@ class AddMirrorAction extends BaseMirrorAction
switch ($provider) {
case 'feed':
return $this->trimmed('feedurl');
case 'twitter':
$screenie = $this->trimmed('screen_name');
$base = 'http://api.twitter.com/1/statuses/user_timeline.atom?screen_name=';
return $base . urlencode($screenie);
default:
// TRANS: Exception thrown when a feed provider could not be recognised.
throw new Exception(_m('Internal form error: Unrecognized feed provider.'));
}
}
function saveMirror()
protected function saveMirror()
{
if ($this->oprofile->subscribe()) {
SubMirror::saveMirror($this->user, $this->profile);

View File

@@ -26,9 +26,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* Takes parameters:
@@ -57,7 +55,7 @@ abstract class BaseMirrorAction extends Action
*
* @return boolean success flag
*/
function prepare($args)
protected function prepare(array $args=array())
{
parent::prepare($args);
return $this->sharedBoilerplate();
@@ -101,8 +99,8 @@ abstract class BaseMirrorAction extends Action
$oprofile = Ostatus_profile::ensureFeedURL($url);
}
if ($oprofile->isGroup()) {
// TRANS: Client error displayed when trying to mirror a StatusNet group feed.
$this->clientError(_m('Cannot mirror a StatusNet group at this time.'));
// TRANS: Client error displayed when trying to mirror a GNU social group feed.
$this->clientError(_m('Cannot mirror a GNU social group at this time.'));
}
$this->oprofile = $oprofile; // @todo FIXME: ugly side effect :D
return $oprofile->localProfile();
@@ -152,7 +150,7 @@ abstract class BaseMirrorAction extends Action
*
* @return void
*/
function handle($args)
protected function handle()
{
// Throws exception on error
$this->saveMirror();
@@ -174,5 +172,5 @@ abstract class BaseMirrorAction extends Action
}
}
abstract function saveMirror();
abstract protected function saveMirror();
}

View File

@@ -26,9 +26,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET')) {
exit(1);
}
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
/**
* Takes parameters:
@@ -54,7 +52,7 @@ class EditMirrorAction extends BaseMirrorAction
*
* @return boolean success flag
*/
function prepare($args)
protected function prepare(array $args=array())
{
parent::prepare($args);
@@ -63,7 +61,7 @@ class EditMirrorAction extends BaseMirrorAction
$this->mirror = SubMirror::pkeyGet(array('subscriber' => $this->user->id,
'subscribed' => $this->profile->id));
if (!$this->mirror) {
if (!$this->mirror instanceof SubMirror) {
// TRANS: Client error displayed when trying to edit an object that is not a feed mirror.
$this->clientError(_m('Requested invalid profile to edit.'));
}
@@ -88,7 +86,7 @@ class EditMirrorAction extends BaseMirrorAction
}
}
function saveMirror()
protected function saveMirror()
{
$mirror = SubMirror::getMirror($this->user, $this->profile);
if (!$mirror) {

View File

@@ -25,9 +25,7 @@
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
if (!defined('GNUSOCIAL') && !defined('STATUSNET')) { exit(1); }
class MirrorSettingsAction extends SettingsAction
{
@@ -52,7 +50,7 @@ class MirrorSettingsAction extends SettingsAction
{
// TRANS: Page instructions.
return _m('You can mirror updates from many RSS and Atom feeds ' .
'into your StatusNet timeline!');
'into your GNU social timeline!');
}
/**
@@ -103,9 +101,6 @@ class MirrorSettingsAction extends SettingsAction
switch ($this->arg('provider')) {
case 'statusnet':
break;
case 'twitter':
$form = new AddTwitterMirrorForm($this);
break;
case 'wordpress':
break;
case 'linkedin':

View File

@@ -1,62 +0,0 @@
<?php
/**
* StatusNet, the distributed open-source microblogging tool
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package StatusNet
* @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
class AddTwitterMirrorForm extends AddMirrorForm
{
/**
* Visible or invisible data elements
*
* Display the form fields that make up the data of the form.
* Sub-classes should overload this to show their data.
*
* @return void
*/
function formData()
{
$this->out->hidden('provider', 'twitter');
$this->out->elementStart('fieldset');
$this->out->elementStart('ul');
$this->li();
$this->doInput('addmirror-feedurl',
'screen_name',
// TRANS: Field label.
_m('Twitter username:'),
$this->out->trimmed('screen_name'));
$this->unli();
$this->li();
// TRANS: Button text for adding a Twitter feed mirror.
$this->out->submit('addmirror-save', _m('BUTTON','Add feed'));
$this->unli();
$this->out->elementEnd('ul');
$this->out->elementEnd('fieldset');
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -64,18 +64,10 @@ class AddMirrorWizard extends Widget
// We could accept hostname & username combos here, or
// webfingery combinations as for remote users.
array(
'id' => 'statusnet',
'name' => _m('StatusNet'),
'id' => 'gnusocial',
'name' => _m('GNU social'),
),
*/
// Accepts a Twitter username and pulls their user timeline as a
// public Atom feed. Requires a working alternate hub which, one
// hopes, is getting timely updates.
array(
'id' => 'twitter',
// TRANS: Name for possible feed provider.
'name' => _m('Twitter'),
),
/*
// WordPress was on our list some whiles ago, but not sure
// what we can actually do here. Search on Wordpress.com hosted
@@ -85,26 +77,6 @@ class AddMirrorWizard extends Widget
'name' => _m('WordPress'),
),
*/
/*
// In theory, Facebook lets you pull public updates over RSS,
// but the URLs for your own update feed that I can find from
// 2009-era websites no longer seem to work and there's no
// good current documentation. May not still be available...
// Mirroring from an FB account is probably better done with
// the dedicated plugin. (As of March 2011)
array(
'id' => 'facebook',
'name' => _m('Facebook'),
),
*/
/*
// LinkedIn doesn't currently seem to have public feeds
// for users or groups (March 2011)
array(
'id' => 'linkedin',
'name' => _m('LinkedIn'),
),
*/
array(
'id' => 'feed',
// TRANS: Name for possible feed provider.

View File

@@ -165,12 +165,6 @@ class TwitterImport
}
}
if (empty($notice->conversation)) {
$conv = Conversation::create();
$notice->conversation = $conv->id;
common_log(LOG_INFO, "No known conversation for status {$statusId} so making a new one {$conv->id}.");
}
$notice->is_local = Notice::GATEWAY;
$notice->content = html_entity_decode($this->linkify($status, FALSE), ENT_QUOTES, 'UTF-8');
@@ -180,11 +174,19 @@ class TwitterImport
$id = $notice->insert();
if (!$id) {
if ($id === false) {
common_log_db_error($notice, 'INSERT', __FILE__);
common_log(LOG_ERR, __METHOD__ . ' - Problem saving notice.');
}
if (empty($notice->conversation)) {
$orig = clone($notice);
$conv = Conversation::create($notice);
common_log(LOG_INFO, "No known conversation for status {$statusId} so a new one ({$conv->id}) was created.");
$notice->conversation = $conv->id;
$notice->update($orig);
}
Event::handle('EndNoticeSave', array($notice));
}
@@ -519,7 +521,7 @@ class TwitterImport
static function tagLink($tag, $orig)
{
return "<a href='https://search.twitter.com/search?q=%23{$tag}' class='hashtag'>{$orig}</a>";
return "<a href='https://twitter.com/search?q=%23{$tag}' class='hashtag'>{$orig}</a>";
}
static function atLink($screenName, $fullName, $orig)

View File

@@ -310,7 +310,7 @@ class TwitterOAuthClient extends OAuthClient
function statusesRetweet($id)
{
$url = "http://api.twitter.com/1.1/statuses/retweet/$id.json";
$url = "https://api.twitter.com/1.1/statuses/retweet/$id.json";
$response = $this->oAuthPost($url);
$status = json_decode($response);
return $status;
@@ -326,7 +326,7 @@ class TwitterOAuthClient extends OAuthClient
function favoritesCreate($id)
{
$url = "http://api.twitter.com/1.1/favorites/create.json";
$url = "https://api.twitter.com/1.1/favorites/create.json";
$params=array();
$params['id'] = $id;
$response = $this->oAuthPost($url, $params);
@@ -344,7 +344,7 @@ class TwitterOAuthClient extends OAuthClient
function favoritesDestroy($id)
{
$url = "http://api.twitter.com/1.1/favorites/destroy.json";
$url = "https://api.twitter.com/1.1/favorites/destroy.json";
$params=array();
$params['id'] = $id;
$response = $this->oAuthPost($url,$params);
@@ -362,7 +362,7 @@ class TwitterOAuthClient extends OAuthClient
function statusesDestroy($id)
{
$url = "http://api.twitter.com/1.1/statuses/destroy/$id.json";
$url = "https://api.twitter.com/1.1/statuses/destroy/$id.json";
$response = $this->oAuthPost($url);
$status = json_decode($response);
return $status;