summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-03 01:49:14 +0000
committerZach Copley <zach@status.net>2010-03-03 09:52:25 -0800
commitecccb344e0bb5427ed8a3a82fdf2512da67184b6 (patch)
treef7822000bcfa19314d4a9f4efb5af7fdf285feff
parent9342e6f818fb35bd7f64412e9765205b5b0af849 (diff)
Show global key and secret, if defined, in Twitter bridge admin panel
-rw-r--r--plugins/TwitterBridge/TwitterBridgePlugin.php16
-rw-r--r--plugins/TwitterBridge/twitteradminpanel.php43
2 files changed, 51 insertions, 8 deletions
diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php
index bc702e745..1a0a69682 100644
--- a/plugins/TwitterBridge/TwitterBridgePlugin.php
+++ b/plugins/TwitterBridge/TwitterBridgePlugin.php
@@ -88,15 +88,15 @@ class TwitterBridgePlugin extends Plugin
static function hasKeys()
{
- $key = common_config('twitter', 'consumer_key');
- $secret = common_config('twitter', 'consumer_secret');
+ $ckey = common_config('twitter', 'consumer_key');
+ $csecret = common_config('twitter', 'consumer_secret');
- if (empty($key) && empty($secret)) {
- $key = common_config('twitter', 'global_consumer_key');
- $secret = common_config('twitter', 'global_consumer_secret');
+ if (empty($ckey) && empty($csecret)) {
+ $ckey = common_config('twitter', 'global_consumer_key');
+ $csecret = common_config('twitter', 'global_consumer_secret');
}
- if (!empty($key) && !empty($secret)) {
+ if (!empty($ckey) && !empty($csecret)) {
return true;
}
@@ -115,6 +115,8 @@ class TwitterBridgePlugin extends Plugin
function onRouterInitialized($m)
{
+ $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
+
if (self::hasKeys()) {
$m->connect(
'twitter/authorization',
@@ -133,8 +135,6 @@ class TwitterBridgePlugin extends Plugin
}
}
- $m->connect('admin/twitter', array('action' => 'twitteradminpanel'));
-
return true;
}
diff --git a/plugins/TwitterBridge/twitteradminpanel.php b/plugins/TwitterBridge/twitteradminpanel.php
index b22e6d99f..0ed53bc05 100644
--- a/plugins/TwitterBridge/twitteradminpanel.php
+++ b/plugins/TwitterBridge/twitteradminpanel.php
@@ -225,6 +225,49 @@ class TwitterAdminPanelForm extends AdminForm
);
$this->unli();
+ $globalConsumerKey = common_config('twitter', 'global_consumer_key');
+ $globalConsumerSec = common_config('twitter', 'global_consumer_secret');
+
+ if (!empty($globalConsumerKey)) {
+ $this->li();
+ $this->out->element(
+ 'label',
+ array('for' => 'global_consumer_key'),
+ ''
+ );
+ $this->out->element(
+ 'input',
+ array(
+ 'name' => 'global_consumer_key',
+ 'type' => 'text',
+ 'id' => 'global_consumer_key',
+ 'value' => $globalConsumerKey,
+ 'disabled' => 'true'
+ )
+ );
+ $this->out->element('p', 'form_guide', _('Global consumer key'));
+ $this->unli();
+
+ $this->li();
+ $this->out->element(
+ 'label',
+ array('for' => 'global_consumer_secret'),
+ ''
+ );
+ $this->out->element(
+ 'input',
+ array(
+ 'name' => 'global_consumer_secret',
+ 'type' => 'text',
+ 'id' => 'global_consumer_secret',
+ 'value' => $globalConsumerSec,
+ 'disabled' => 'true'
+ )
+ );
+ $this->out->element('p', 'form_guide', _('Global consumer secret'));
+ $this->unli();
+ }
+
$this->li();
$this->input(
'source',