X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Frouter.php;h=5529e60acb82f8a59f71d079823dff6bba6086d7;hb=3bc55e7b8bff2fe331371333de9ff4f96c8584d2;hp=cd2143d131056f7e9b7f5728fa8c9e6366d0c6ec;hpb=544a14d290cc6c08950b2d4a6faf324704e90c6c;p=quix0rs-gnu-social.git diff --git a/lib/router.php b/lib/router.php index cd2143d131..5529e60acb 100644 --- a/lib/router.php +++ b/lib/router.php @@ -1,6 +1,6 @@ . * * @category URL - * @package Laconica - * @author Evan Prodromou - * @copyright 2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -39,10 +39,10 @@ require_once 'Net/URL/Mapper.php'; * Cheap wrapper around Net_URL_Mapper * * @category URL - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class Router @@ -88,6 +88,10 @@ class Router $m->connect('doc/:title', array('action' => 'doc')); + // Twitter + + $m->connect('twitter/authorization', array('action' => 'twitterauthorization')); + // facebook $m->connect('facebook', array('action' => 'facebookhome')); @@ -113,6 +117,9 @@ class Router $m->connect('main/tagother/:id', array('action' => 'tagother')); + $m->connect('main/oembed', + array('action' => 'oembed')); + // these take a code foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) { @@ -168,6 +175,10 @@ class Router $m->connect('notice/new?replyto=:replyto', array('action' => 'newnotice'), array('replyto' => '[A-Za-z0-9_-]+')); + $m->connect('notice/new?replyto=:replyto&inreplyto=:inreplyto', + array('action' => 'newnotice'), + array('replyto' => '[A-Za-z0-9_-]+'), + array('inreplyto' => '[0-9]+')); $m->connect('notice/:notice/file', array('action' => 'file'), @@ -206,7 +217,7 @@ class Router array('tag' => '[a-zA-Z0-9]+')); $m->connect('tag/:tag', array('action' => 'tag'), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect('peopletag/:tag', array('action' => 'peopletag'), @@ -261,12 +272,12 @@ class Router $m->connect('api/statuses/:method', array('action' => 'api', 'apiaction' => 'statuses'), - array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|show|friends|followers|featured)(\.(atom|rss|xml|json))?')); + array('method' => '(public_timeline|home_timeline|friends_timeline|user_timeline|update|replies|mentions|show|friends|followers|featured)(\.(atom|rss|xml|json))?')); $m->connect('api/statuses/:method/:argument', array('action' => 'api', 'apiaction' => 'statuses'), - array('method' => '(|user_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)')); + array('method' => '(user_timeline|home_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)')); // users @@ -388,16 +399,61 @@ class Router array('action' => 'api', 'apiaction' => 'help')); - // laconica + // statusnet + + $m->connect('api/statusnet/:method', + array('action' => 'api', + 'apiaction' => 'statusnet')); + + // For older methods, we provide "laconica" base action $m->connect('api/laconica/:method', array('action' => 'api', - 'apiaction' => 'laconica')); + 'apiaction' => 'statusnet')); + + // Groups and tags are newer than 0.8.1 so no backward-compatibility + // necessary // Groups - $m->connect('api/laconica/groups/:method/:argument', + //'list' has to be handled differently, as php will not allow a method to be named 'list' + $m->connect('api/statusnet/groups/list/:argument', + array('action' => 'api', + 'method' => 'list_groups', + 'apiaction' => 'groups')); + + foreach (array('xml', 'json', 'rss', 'atom') as $e) { + $m->connect('api/statusnet/groups/list.' . $e, array('action' => 'api', + 'method' => 'list_groups.' . $e, 'apiaction' => 'groups')); + } + + $m->connect('api/statusnet/groups/:method', + array('action' => 'api', + 'apiaction' => 'statuses'), + array('method' => '(list_all|)(\.(atom|rss|xml|json))?')); + + $m->connect('api/statuses/:method/:argument', + array('action' => 'api', + 'apiaction' => 'statuses'), + array('method' => '(user_timeline|home_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)')); + + $m->connect('api/statusnet/groups/:method/:argument', + array('action' => 'api', + 'apiaction' => 'groups')); + + $m->connect('api/statusnet/groups/:method', + array('action' => 'api', + 'apiaction' => 'groups')); + + // Tags + $m->connect('api/statusnet/tags/:method/:argument', + array('action' => 'api', + 'apiaction' => 'tags')); + + $m->connect('api/statusnet/tags/:method', + array('action' => 'api', + 'apiaction' => 'tags')); // search $m->connect('api/search.atom', array('action' => 'twitapisearchatom'));