summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-01-13 07:33:51 +0000
committerZach Copley <zach@status.net>2010-01-24 16:36:04 -0800
commite101a6df6ba1cbec4664bb81fc81655e5db18b0f (patch)
tree1d807b1fd443b2e0e08868cfb4cf11ad57f78906 /lib
parent693b16174ad4142d1a543f78878c84c552ce6d74 (diff)
Rework application registration workflow to be more private
Diffstat (limited to 'lib')
-rw-r--r--lib/applicationeditform.php61
-rw-r--r--lib/applicationlist.php13
-rw-r--r--lib/router.php23
3 files changed, 42 insertions, 55 deletions
diff --git a/lib/applicationeditform.php b/lib/applicationeditform.php
index e9ab46780..040d3bf74 100644
--- a/lib/applicationeditform.php
+++ b/lib/applicationeditform.php
@@ -119,12 +119,9 @@ class ApplicationEditForm extends Form
if (!empty($this->application)) {
return common_local_url('editapplication',
- array('id' => $this->application->id,
- 'nickname' => $cur->nickname)
- );
+ array('id' => $this->application->id));
} else {
- return common_local_url('newapplication',
- array('nickname' => $cur->nickname));
+ return common_local_url('newapplication');
}
}
@@ -149,7 +146,7 @@ class ApplicationEditForm extends Form
{
if ($this->application) {
$id = $this->application->id;
- $icon = $this->application->icon;
+ $icon = $this->application->icon;
$name = $this->application->name;
$description = $this->application->description;
$source_url = $this->application->source_url;
@@ -160,7 +157,7 @@ class ApplicationEditForm extends Form
$this->access_type = $this->application->access_type;
} else {
$id = '';
- $icon = '';
+ $icon = '';
$name = '';
$description = '';
$source_url = '';
@@ -171,26 +168,26 @@ class ApplicationEditForm extends Form
$this->access_type = '';
}
- $this->out->hidden('token', common_session_token());
+ $this->out->hidden('token', common_session_token());
$this->out->elementStart('ul', 'form_data');
- $this->out->elementStart('li', array('id' => 'application_icon'));
+ $this->out->elementStart('li', array('id' => 'application_icon'));
- if (!empty($icon)) {
- $this->out->element('img', array('src' => $icon));
- }
+ if (!empty($icon)) {
+ $this->out->element('img', array('src' => $icon));
+ }
- $this->out->element('label', array('for' => 'app_icon'),
- _('Icon'));
+ $this->out->element('label', array('for' => 'app_icon'),
+ _('Icon'));
$this->out->element('input', array('name' => 'app_icon',
- 'type' => 'file',
- 'id' => 'app_icon'));
+ 'type' => 'file',
+ 'id' => 'app_icon'));
$this->out->element('p', 'form_guide', _('Icon for this application'));
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
- 'type' => 'hidden',
- 'id' => 'MAX_FILE_SIZE',
- 'value' => ImageFile::maxFileSizeInt()));
+ 'type' => 'hidden',
+ 'id' => 'MAX_FILE_SIZE',
+ 'value' => ImageFile::maxFileSizeInt()));
$this->out->elementEnd('li');
$this->out->elementStart('li');
@@ -207,13 +204,13 @@ class ApplicationEditForm extends Form
$maxDesc = Oauth_application::maxDesc();
if ($maxDesc > 0) {
$descInstr = sprintf(_('Describe your application in %d chars'),
- $maxDesc);
+ $maxDesc);
} else {
$descInstr = _('Describe your application');
}
$this->out->textarea('description', _('Description'),
($this->out->arg('description')) ? $this->out->arg('description') : $description,
- $descInstr);
+ $descInstr);
$this->out->elementEnd('li');
@@ -259,8 +256,8 @@ class ApplicationEditForm extends Form
$this->out->element('input', $attrs);
$this->out->element('label', array('for' => 'app_type-browser',
- 'class' => 'radio'),
- _('Browser'));
+ 'class' => 'radio'),
+ _('Browser'));
$attrs = array('name' => 'app_type',
'type' => 'radio',
@@ -275,8 +272,8 @@ class ApplicationEditForm extends Form
$this->out->element('input', $attrs);
$this->out->element('label', array('for' => 'app_type-desktop',
- 'class' => 'radio'),
- _('Desktop'));
+ 'class' => 'radio'),
+ _('Desktop'));
$this->out->element('p', 'form_guide', _('Type of application, browser or desktop'));
$this->out->elementEnd('li');
@@ -298,8 +295,8 @@ class ApplicationEditForm extends Form
$this->out->element('input', $attrs);
$this->out->element('label', array('for' => 'default_access_type-ro',
- 'class' => 'radio'),
- _('Read-only'));
+ 'class' => 'radio'),
+ _('Read-only'));
$attrs = array('name' => 'default_access_type',
'type' => 'radio',
@@ -309,15 +306,15 @@ class ApplicationEditForm extends Form
if ($this->application->access_type & Oauth_application::$readAccess
&& $this->application->access_type & Oauth_application::$writeAccess
- ) {
+ ) {
$attrs['checked'] = 'checked';
}
$this->out->element('input', $attrs);
$this->out->element('label', array('for' => 'default_access_type-rw',
- 'class' => 'radio'),
- _('Read-write'));
+ 'class' => 'radio'),
+ _('Read-write'));
$this->out->element('p', 'form_guide', _('Default access for this application: read-only, or read-write'));
$this->out->elementEnd('li');
@@ -334,8 +331,8 @@ class ApplicationEditForm extends Form
function formActions()
{
$this->out->submit('cancel', _('Cancel'), 'submit form_action-primary',
- 'cancel', _('Cancel'));
+ 'cancel', _('Cancel'));
$this->out->submit('save', _('Save'), 'submit form_action-secondary',
- 'save', _('Save'));
+ 'save', _('Save'));
}
}
diff --git a/lib/applicationlist.php b/lib/applicationlist.php
index 15c2d588a..f2eaefb40 100644
--- a/lib/applicationlist.php
+++ b/lib/applicationlist.php
@@ -64,7 +64,7 @@ class ApplicationList extends Widget
$this->application = $application;
$this->owner = $owner;
$this->action = $action;
- $this->connections = $connections;
+ $this->connections = $connections;
}
function show()
@@ -97,10 +97,9 @@ class ApplicationList extends Widget
$this->out->elementStart('span', 'vcard author');
if (!$this->connections) {
$this->out->elementStart('a',
- array('href' => common_local_url('showapplication',
- array('nickname' => $user->nickname,
- 'id' => $this->application->id)),
- 'class' => 'url'));
+ array('href' => common_local_url('showapplication',
+ array('id' => $this->application->id)),
+ 'class' => 'url'));
} else {
$this->out->elementStart('a', array('href' => $this->application->source_url,
@@ -154,8 +153,4 @@ class ApplicationList extends Widget
return;
}
- function highlight($text)
- {
- return htmlspecialchars($text);
- }
}
diff --git a/lib/router.php b/lib/router.php
index d6e448c2f..42bff2778 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -141,7 +141,7 @@ class Router
// settings
foreach (array('profile', 'avatar', 'password', 'im', 'oauthconnections',
- 'email', 'sms', 'userdesign', 'other') as $s) {
+ 'oauthapps', 'email', 'sms', 'userdesign', 'other') as $s) {
$m->connect('settings/'.$s, array('action' => $s.'settings'));
}
@@ -634,28 +634,23 @@ class Router
// user stuff
foreach (array('subscriptions', 'subscribers',
- 'nudge', 'all', 'foaf', 'xrds', 'apps',
+ '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}'));
}
- $m->connect(':nickname/apps',
- array('action' => 'apps'),
- array('nickname' => '['.NICKNAME_FMT.']{1,64}'));
- $m->connect(':nickname/apps/show/:id',
+ $m->connect('settings/oauthapps/show/:id',
array('action' => 'showapplication'),
- array('nickname' => '['.NICKNAME_FMT.']{1,64}',
- 'id' => '[0-9]+')
+ array('id' => '[0-9]+')
);
- $m->connect(':nickname/apps/new',
- array('action' => 'newapplication'),
- array('nickname' => '['.NICKNAME_FMT.']{1,64}'));
- $m->connect(':nickname/apps/edit/:id',
+ $m->connect('settings/oauthapps/new',
+ array('action' => 'newapplication')
+ );
+ $m->connect('settings/oauthapps/edit/:id',
array('action' => 'editapplication'),
- array('nickname' => '['.NICKNAME_FMT.']{1,64}',
- 'id' => '[0-9]+')
+ array('id' => '[0-9]+')
);
$m->connect('api/oauth/request_token',