summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README9
-rw-r--r--lib/action.php8
-rw-r--r--lib/default.php5
-rw-r--r--lib/personalgroupnav.php7
-rw-r--r--lib/router.php207
5 files changed, 157 insertions, 79 deletions
diff --git a/README b/README
index 602288789..f83873ca8 100644
--- a/README
+++ b/README
@@ -1492,6 +1492,15 @@ disabled: whether to enable this command. If enabled, users who send
should enable it only after you've convinced yourself that
it is safe. Default is 'false'.
+singleuser
+----------
+
+If an installation has only one user, this can simplify a lot of the
+interface. It also makes the user's profile the root URL.
+
+enabled: Whether to run in "single user mode". Default false.
+nickname: nickname of the single user.
+
Plugins
=======
diff --git a/lib/action.php b/lib/action.php
index e24277558..3ffc452de 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -392,8 +392,14 @@ class Action extends HTMLOutputter // lawsuit
$this->elementStart('address', array('id' => 'site_contact',
'class' => 'vcard'));
if (Event::handle('StartAddressData', array($this))) {
+ if (common_config('singleuser', 'enabled')) {
+ $url = common_local_url('showstream',
+ array('nickname' => common_config('singleuser', 'nickname')));
+ } else {
+ $url = common_local_url('public');
+ }
$this->elementStart('a', array('class' => 'url home bookmark',
- 'href' => common_local_url('public')));
+ 'href' => $url));
if (common_config('site', 'logo') || file_exists(Theme::file('logo.png'))) {
$this->element('img', array('class' => 'logo photo',
'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png'),
diff --git a/lib/default.php b/lib/default.php
index b6ee72279..35115542f 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -56,7 +56,7 @@ $default =
'dupelimit' => 60, # default for same person saying the same thing
'textlimit' => 140,
'indent' => true,
- 'use_x_sendfile' => false,
+ 'use_x_sendfile' => false
),
'db' =>
array('database' => 'YOU HAVE TO SET THIS IN config.php',
@@ -260,4 +260,7 @@ $default =
),
'admin' =>
array('panels' => array('design', 'site', 'user', 'paths')),
+ 'singleuser' =>
+ array('enabled' => false,
+ 'nickname' => null),
);
diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php
index cdde1feca..25db5baa9 100644
--- a/lib/personalgroupnav.php
+++ b/lib/personalgroupnav.php
@@ -78,9 +78,9 @@ class PersonalGroupNav extends Widget
function show()
{
$user = null;
-
+
// FIXME: we should probably pass this in
-
+
$action = $this->action->trimmed('action');
$nickname = $this->action->trimmed('nickname');
@@ -117,7 +117,8 @@ class PersonalGroupNav extends Widget
$cur = common_current_user();
- if ($cur && $cur->id == $user->id) {
+ if ($cur && $cur->id == $user->id &&
+ !common_config('singleuser', 'enabled')) {
$this->out->menuItem(common_local_url('inbox', array('nickname' =>
$nickname)),
diff --git a/lib/router.php b/lib/router.php
index 42bff2778..c0ddc8db3 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -73,12 +73,6 @@ class Router
if (Event::handle('StartInitializeRouter', array(&$m))) {
- // In the "root"
-
- $m->connect('', array('action' => 'public'));
- $m->connect('rss', array('action' => 'publicrss'));
- $m->connect('featuredrss', array('action' => 'featuredrss'));
- $m->connect('favoritedrss', array('action' => 'favoritedrss'));
$m->connect('opensearch/people', array('action' => 'opensearch',
'type' => 'people'));
$m->connect('opensearch/notice', array('action' => 'opensearch',
@@ -145,6 +139,18 @@ class Router
$m->connect('settings/'.$s, array('action' => $s.'settings'));
}
+ $m->connect('settings/oauthapps/show/:id',
+ array('action' => 'showapplication'),
+ array('id' => '[0-9]+')
+ );
+ $m->connect('settings/oauthapps/new',
+ array('action' => 'newapplication')
+ );
+ $m->connect('settings/oauthapps/edit/:id',
+ array('action' => 'editapplication'),
+ array('id' => '[0-9]+')
+ );
+
// search
foreach (array('group', 'people', 'notice') as $s) {
@@ -227,11 +233,6 @@ class Router
array('action' => 'peopletag'),
array('tag' => '[a-zA-Z0-9]+'));
- $m->connect('featured/', array('action' => 'featured'));
- $m->connect('featured', array('action' => 'featured'));
- $m->connect('favorited/', array('action' => 'favorited'));
- $m->connect('favorited', array('action' => 'favorited'));
-
// groups
$m->connect('group/new', array('action' => 'newgroup'));
@@ -622,6 +623,17 @@ class Router
$m->connect('api/search.json', array('action' => 'twitapisearchjson'));
$m->connect('api/trends.json', array('action' => 'twitapitrends'));
+ $m->connect('api/oauth/request_token',
+ array('action' => 'apioauthrequesttoken'));
+
+ $m->connect('api/oauth/access_token',
+ array('action' => 'apioauthaccesstoken'));
+
+ $m->connect('api/oauth/authorize',
+ array('action' => 'apioauthauthorize'));
+
+ // Admin
+
$m->connect('admin/site', array('action' => 'siteadminpanel'));
$m->connect('admin/design', array('action' => 'designadminpanel'));
$m->connect('admin/user', array('action' => 'useradminpanel'));
@@ -631,78 +643,125 @@ class Router
array('action' => 'getfile'),
array('filename' => '[A-Za-z0-9._-]+'));
- // user stuff
+ // In the "root"
- foreach (array('subscriptions', 'subscribers',
- 'nudge', 'all', 'foaf', 'xrds',
- 'replies', 'inbox', 'outbox', 'microsummary') as $a) {
- $m->connect(':nickname/'.$a,
- array('action' => $a),
+ if (common_config('singleuser', 'enabled')) {
+
+ $nickname = common_config('singleuser', 'nickname');
+
+ foreach (array('subscriptions', 'subscribers',
+ 'all', 'foaf', 'xrds',
+ 'replies', 'microsummary') as $a) {
+ $m->connect($a,
+ array('action' => $a,
+ 'nickname' => $nickname));
+ }
+
+ foreach (array('subscriptions', 'subscribers') as $a) {
+ $m->connect($a.'/:tag',
+ array('action' => $a,
+ 'nickname' => $nickname),
+ array('tag' => '[a-zA-Z0-9]+'));
+ }
+
+ foreach (array('rss', 'groups') as $a) {
+ $m->connect($a,
+ array('action' => 'user'.$a,
+ 'nickname' => $nickname));
+ }
+
+ foreach (array('all', 'replies', 'favorites') as $a) {
+ $m->connect($a.'/rss',
+ array('action' => $a.'rss',
+ 'nickname' => $nickname));
+ }
+
+ $m->connect('favorites',
+ array('action' => 'showfavorites',
+ 'nickname' => $nickname));
+
+ $m->connect('avatar/:size',
+ array('action' => 'avatarbynickname',
+ 'nickname' => $nickname),
+ array('size' => '(original|96|48|24)'));
+
+ $m->connect('tag/:tag/rss',
+ array('action' => 'userrss',
+ 'nickname' => $nickname),
+ array('tag' => '[a-zA-Z0-9]+'));
+
+ $m->connect('tag/:tag',
+ array('action' => 'showstream',
+ 'nickname' => $nickname),
+ array('tag' => '[a-zA-Z0-9]+'));
+
+ $m->connect('',
+ array('action' => 'showstream',
+ 'nickname' => $nickname));
+
+ } else {
+
+ $m->connect('', array('action' => 'public'));
+ $m->connect('rss', array('action' => 'publicrss'));
+ $m->connect('featuredrss', array('action' => 'featuredrss'));
+ $m->connect('favoritedrss', array('action' => 'favoritedrss'));
+ $m->connect('featured/', array('action' => 'featured'));
+ $m->connect('featured', array('action' => 'featured'));
+ $m->connect('favorited/', array('action' => 'favorited'));
+ $m->connect('favorited', array('action' => 'favorited'));
+
+ foreach (array('subscriptions', 'subscribers',
+ 'nudge', 'all', 'foaf', 'xrds',
+ 'replies', 'inbox', 'outbox', 'microsummary') as $a) {
+ $m->connect(':nickname/'.$a,
+ array('action' => $a),
+ array('nickname' => '[a-zA-Z0-9]{1,64}'));
+ }
+
+ foreach (array('subscriptions', 'subscribers') as $a) {
+ $m->connect(':nickname/'.$a.'/:tag',
+ array('action' => $a),
+ array('tag' => '[a-zA-Z0-9]+',
+ 'nickname' => '[a-zA-Z0-9]{1,64}'));
+ }
+
+ foreach (array('rss', 'groups') as $a) {
+ $m->connect(':nickname/'.$a,
+ array('action' => 'user'.$a),
+ array('nickname' => '[a-zA-Z0-9]{1,64}'));
+ }
+
+ foreach (array('all', 'replies', 'favorites') as $a) {
+ $m->connect(':nickname/'.$a.'/rss',
+ array('action' => $a.'rss'),
+ array('nickname' => '[a-zA-Z0-9]{1,64}'));
+ }
+
+ $m->connect(':nickname/favorites',
+ array('action' => 'showfavorites'),
array('nickname' => '[a-zA-Z0-9]{1,64}'));
- }
-
- $m->connect('settings/oauthapps/show/:id',
- array('action' => 'showapplication'),
- array('id' => '[0-9]+')
- );
- $m->connect('settings/oauthapps/new',
- array('action' => 'newapplication')
- );
- $m->connect('settings/oauthapps/edit/:id',
- array('action' => 'editapplication'),
- array('id' => '[0-9]+')
- );
-
- $m->connect('api/oauth/request_token',
- array('action' => 'apioauthrequesttoken'));
-
- $m->connect('api/oauth/access_token',
- array('action' => 'apioauthaccesstoken'));
-
- $m->connect('api/oauth/authorize',
- array('action' => 'apioauthauthorize'));
- foreach (array('subscriptions', 'subscribers') as $a) {
- $m->connect(':nickname/'.$a.'/:tag',
- array('action' => $a),
- array('tag' => '[a-zA-Z0-9]+',
+ $m->connect(':nickname/avatar/:size',
+ array('action' => 'avatarbynickname'),
+ array('size' => '(original|96|48|24)',
'nickname' => '[a-zA-Z0-9]{1,64}'));
- }
- foreach (array('rss', 'groups') as $a) {
- $m->connect(':nickname/'.$a,
- array('action' => 'user'.$a),
- array('nickname' => '[a-zA-Z0-9]{1,64}'));
- }
+ $m->connect(':nickname/tag/:tag/rss',
+ array('action' => 'userrss'),
+ array('nickname' => '[a-zA-Z0-9]{1,64}'),
+ array('tag' => '[a-zA-Z0-9]+'));
+
+ $m->connect(':nickname/tag/:tag',
+ array('action' => 'showstream'),
+ array('nickname' => '[a-zA-Z0-9]{1,64}'),
+ array('tag' => '[a-zA-Z0-9]+'));
- foreach (array('all', 'replies', 'favorites') as $a) {
- $m->connect(':nickname/'.$a.'/rss',
- array('action' => $a.'rss'),
+ $m->connect(':nickname',
+ array('action' => 'showstream'),
array('nickname' => '[a-zA-Z0-9]{1,64}'));
}
- $m->connect(':nickname/favorites',
- array('action' => 'showfavorites'),
- array('nickname' => '[a-zA-Z0-9]{1,64}'));
-
- $m->connect(':nickname/avatar/:size',
- array('action' => 'avatarbynickname'),
- array('size' => '(original|96|48|24)',
- 'nickname' => '[a-zA-Z0-9]{1,64}'));
-
- $m->connect(':nickname/tag/:tag/rss',
- array('action' => 'userrss'),
- array('nickname' => '[a-zA-Z0-9]{1,64}'),
- array('tag' => '[a-zA-Z0-9]+'));
-
- $m->connect(':nickname/tag/:tag',
- array('action' => 'showstream'),
- array('nickname' => '[a-zA-Z0-9]{1,64}'),
- array('tag' => '[a-zA-Z0-9]+'));
-
- $m->connect(':nickname',
- array('action' => 'showstream'),
- array('nickname' => '[a-zA-Z0-9]{1,64}'));
+ // user stuff
Event::handle('RouterInitialized', array($m));
}