X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapisearchatom.php;h=51e8a8881bf2730646da314f0ebcb16729465c07;hb=a6408be566dc9877eb67c86d4283dd57b2255d8b;hp=560eb64d293054271ee4c727c3ef81452fe2405d;hpb=d35b2d3f3c2128b147a6fa897032262c1f632262;p=quix0rs-gnu-social.git diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 560eb64d29..51e8a8881b 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -21,18 +21,16 @@ * * @category Search * @package StatusNet - * @author Zach Copley + * @author Zach Copley * @copyright 2008-2009 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('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; - /** * Action for outputting search results in Twitter compatible Atom * format. @@ -42,14 +40,14 @@ require_once INSTALLDIR.'/lib/twitterapi.php'; * * @category Search * @package StatusNet - * @author Zach Copley + * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ * - * @see TwitterapiAction + * @see ApiAction */ -class TwitapisearchatomAction extends TwitterapiAction +class TwitapisearchatomAction extends ApiAction { var $cnt; @@ -71,7 +69,7 @@ class TwitapisearchatomAction extends TwitterapiAction * @see Action::__construct */ - function __construct($output='php://output', $indent=true) + function __construct($output='php://output', $indent=null) { parent::__construct($output, $indent); } @@ -161,7 +159,7 @@ class TwitapisearchatomAction extends TwitterapiAction // lcase it for comparison $q = strtolower($this->query); - $search_engine = $notice->getSearchEngine('identica_notices'); + $search_engine = $notice->getSearchEngine('notice'); $search_engine->set_sort_mode('chron'); $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true); @@ -208,7 +206,14 @@ class TwitapisearchatomAction extends TwitterapiAction $this->showFeed(); foreach ($notices as $n) { - $this->showEntry($n); + + $profile = $n->getProfile(); + + // Don't show notices from deleted users + + if (!empty($profile)) { + $this->showEntry($n); + } } $this->endAtom(); @@ -227,7 +232,7 @@ class TwitapisearchatomAction extends TwitterapiAction $server = common_config('site', 'server'); $sitename = common_config('site', 'name'); - // XXX: Use xmlns:laconica instead? + // XXX: Use xmlns:statusnet instead? $this->elementStart('feed', array('xmlns' => 'http://www.w3.org/2005/Atom', @@ -238,7 +243,7 @@ class TwitapisearchatomAction extends TwitterapiAction 'xmlns:twitter' => 'http://api.twitter.com/', 'xml:lang' => 'en-US')); // XXX Other locales ? - $taguribase = common_config('integration', 'taguri'); + $taguribase = TagURI::base(); $this->element('id', null, "tag:$taguribase:search/$server"); $site_uri = common_path(false); @@ -322,7 +327,7 @@ class TwitapisearchatomAction extends TwitterapiAction $this->elementStart('entry'); - $taguribase = common_config('integration', 'taguri'); + $taguribase = TagURI::base(); $this->element('id', null, "tag:$taguribase:$notice->id"); $this->element('published', null, common_date_w3dtf($notice->created)); @@ -337,10 +342,24 @@ class TwitapisearchatomAction extends TwitterapiAction 'rel' => 'related', 'href' => $profile->avatarUrl())); - // TODO: Here is where we'd put in a link to an atom feed for threads + // @todo: Here is where we'd put in a link to an atom feed for threads + + $source = null; + + $ns = $notice->getSource(); + if ($ns) { + if (!empty($ns->name) && !empty($ns->url)) { + $source = '' + . htmlspecialchars($ns->name) + . ''; + } else { + $source = $ns->code; + } + } - $this->element("twitter:source", null, - htmlentities($this->source_link($notice->source))); + $this->element("twitter:source", null, $source); $this->elementStart('author');