aboutsummaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-06-18 00:17:36 -0700
committerFriendika <info@friendika.com>2011-06-18 00:17:36 -0700
commitcf9f23fb74380e168870e4253458511fcee36ce8 (patch)
tree6975ba8e46c4fcfc1b74b5ed41324e1b1bd76029 /addon
parent9e2db5d5a614b5dedcd63cdc966c1382a1dfcd7a (diff)
parent4b633d54bb8d868d39039bdf76a2bd97bd1820c9 (diff)
downloadvolse-hubzilla-cf9f23fb74380e168870e4253458511fcee36ce8.tar.gz
volse-hubzilla-cf9f23fb74380e168870e4253458511fcee36ce8.tar.bz2
volse-hubzilla-cf9f23fb74380e168870e4253458511fcee36ce8.zip
Merge pull request #118 from fabrixxm/admin
Admin work
Diffstat (limited to 'addon')
-rw-r--r--addon/poormancron/poormancron.php5
-rw-r--r--addon/twitter/admin.tpl3
-rw-r--r--addon/twitter/twitter.php19
3 files changed, 23 insertions, 4 deletions
diff --git a/addon/poormancron/poormancron.php b/addon/poormancron/poormancron.php
index 9a8dc1e33..7611c43be 100644
--- a/addon/poormancron/poormancron.php
+++ b/addon/poormancron/poormancron.php
@@ -20,7 +20,7 @@ function poormancron_uninstall() {
-function poormancron_hook($a,&$b) {
+function poormancron_hook(&$a,&$b) {
$now = time();
$lastupdate = get_config('poormancron', 'lastupdate');
@@ -31,7 +31,7 @@ function poormancron_hook($a,&$b) {
}
}
-function poormancron_procrun($a, $argv) {
+function poormancron_procrun(&$a, $argv) {
logger("poormancron procrun ".implode(", ",$argv));
array_shift($argv);
$argc = count($argv);
@@ -43,5 +43,4 @@ function poormancron_procrun($a, $argv) {
}
-
?>
diff --git a/addon/twitter/admin.tpl b/addon/twitter/admin.tpl
new file mode 100644
index 000000000..a83eb07a4
--- /dev/null
+++ b/addon/twitter/admin.tpl
@@ -0,0 +1,3 @@
+{{ inc field_input.tpl with $field=$consumerkey }}{{ endinc }}
+{{ inc field_input.tpl with $field=$consumersecret }}{{ endinc }}
+<div class="submit"><input type="submit" name="page_site" value="$submit" /></div>
diff --git a/addon/twitter/twitter.php b/addon/twitter/twitter.php
index fef6583f6..3141cf0c9 100644
--- a/addon/twitter/twitter.php
+++ b/addon/twitter/twitter.php
@@ -47,6 +47,7 @@ function twitter_install() {
register_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
register_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook');
register_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets');
+ register_hook('plugin_admin', 'addon/twitter/twitter.php', 'plugin_admin');
logger("installed twitter");
}
@@ -56,6 +57,7 @@ function twitter_uninstall() {
unregister_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
unregister_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook');
unregister_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets');
+ unregister_hook('plugin_admin', 'addon/twitter/twitter.php', 'plugin_admin');
}
function twitter_jot_nets(&$a,&$b) {
@@ -240,4 +242,19 @@ function twitter_post_hook(&$a,&$b) {
}
}
}
-
+function plugin_admin_post(&$a){
+ $consumerkey = ((x($_POST,'consumerkey')) ? notags(trim($_POST['consumerkey'])) : '');
+ $consumersecret = ((x($_POST,'consumersecret')) ? notags(trim($_POST['consumersecret'])): '');
+ set_config('twitter','consumerkey',$consumerkey);
+ set_config('twitter','consumersecret',$consumersecret);
+ info( t('Settings updated.'). EOL );
+}
+function plugin_admin(&$a, &$o){
+ $t = file_get_contents( dirname(__file__). "/admin.tpl" );
+ $o = replace_macros($t, array(
+ '$submit' => t('Submit'),
+ // name, label, value, help, [extra values]
+ '$consumerkey' => array('consumerkey', t('Consumer key'), get_config('twitter', 'consumerkey' ), ''),
+ '$consumersecret' => array('consumersecret', t('Consumer secret'), get_config('twitter', 'consumersecret' ), '')
+ ));
+}