From a5418b8b565b5e9ecb4aeb488b04008d02ed2596 Mon Sep 17 00:00:00 2001 From: tony baldwin Date: Mon, 18 Feb 2013 23:14:26 -0500 Subject: [PATCH 1/9] added pledgie plugin --- pledgie/pledgie.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 pledgie/pledgie.php diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php new file mode 100644 index 00000000..9d38320e --- /dev/null +++ b/pledgie/pledgie.php @@ -0,0 +1,16 @@ + + * */ + + +function pledgie_install() { register_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active'); } + + +function pledgie_uninstall() { unregister_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active'); } + +function pledgie_active(&$a,&$b) { $b .= '\'Click'; } + From dc2ef952b650efbaf36f7281c4ce8169065e3fc7 Mon Sep 17 00:00:00 2001 From: tony baldwin Date: Mon, 18 Feb 2013 23:19:24 -0500 Subject: [PATCH 2/9] fixed pledgie (added div tags) --- pledgie/pledgie.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php index 9d38320e..97699766 100644 --- a/pledgie/pledgie.php +++ b/pledgie/pledgie.php @@ -12,5 +12,5 @@ function pledgie_install() { register_hook('page_end', 'addon/pledgie/pledgie.ph function pledgie_uninstall() { unregister_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active'); } -function pledgie_active(&$a,&$b) { $b .= '\'Click'; } +function pledgie_active(&$a,&$b) { $b .= '
\'Click
'; } From 2cd5ff6b63953364d5d4521bad6359bbf60de52c Mon Sep 17 00:00:00 2001 From: tony baldwin Date: Mon, 18 Feb 2013 23:25:48 -0500 Subject: [PATCH 3/9] made pledgie link open in new tab/window --- pledgie/pledgie.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php index 97699766..8f6228f6 100644 --- a/pledgie/pledgie.php +++ b/pledgie/pledgie.php @@ -12,5 +12,5 @@ function pledgie_install() { register_hook('page_end', 'addon/pledgie/pledgie.ph function pledgie_uninstall() { unregister_hook('page_end', 'addon/pledgie/pledgie.php', 'pledgie_active'); } -function pledgie_active(&$a,&$b) { $b .= '
\'Click
'; } +function pledgie_active(&$a,&$b) { $b .= '
\'Click
'; } From e587631eeb7d05ebec563e57a1f665fcd911b69b Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 19 Feb 2013 08:28:10 +0100 Subject: [PATCH 4/9] look for the application name in pconfig 1st, then global config --- statusnet/statusnet.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 393bbfe5..d12aefe7 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -791,8 +791,12 @@ function statusnet_fetchtimeline($a, $uid) { $osecret = get_pconfig($uid, 'statusnet', 'oauthsecret'); $lastid = get_pconfig($uid, 'statusnet', 'lastid'); - $application_name = get_config('statusnet', 'application_name'); - + // get the application name for the SN app + // 1st try personal config, then system config and fallback to the + // hostname of the node if neither one is set. + $application_name = get_pconfig( $uid, 'statusnet', 'application_name'); + if ($application_name == "") + $application_name = get_config('statusnet', 'application_name'); if ($application_name == "") $application_name = $a->get_hostname(); From d5f5263a1652828b01fd771c39e21b1963043a0e Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 19 Feb 2013 08:58:43 +0100 Subject: [PATCH 5/9] SN admin panel with application name --- statusnet/statusnet.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index d12aefe7..273a9b8c 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -704,6 +704,7 @@ function statusnet_plugin_admin_post(&$a){ $apiurl=trim($_POST['apiurl'][$id]); $secret=trim($_POST['secret'][$id]); $key=trim($_POST['key'][$id]); + $applicationname = ((x($_POST, 'applicationname')) ? notags(trim($_POST['applicationname'][$id])):''); if ($sitename!="" && $apiurl!="" && $secret!="" && @@ -714,7 +715,8 @@ function statusnet_plugin_admin_post(&$a){ 'sitename' => $sitename, 'apiurl' => $apiurl, 'consumersecret' => $secret, - 'consumerkey' => $key + 'consumerkey' => $key, + 'applicationname' => $applicationname ); } } @@ -734,6 +736,7 @@ function statusnet_plugin_admin(&$a, &$o){ 'apiurl' => Array("apiurl[$id]", "Api url", $s['apiurl'], ""), 'secret' => Array("secret[$id]", "Secret", $s['consumersecret'], ""), 'key' => Array("key[$id]", "Key", $s['consumerkey'], ""), + 'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""), 'delete' => Array("delete[$id]", "Delete", False , "Check to delete this preset"), ); } @@ -745,6 +748,7 @@ function statusnet_plugin_admin(&$a, &$o){ 'apiurl' => Array("apiurl[$id]", t("API URL"), "", ""), 'secret' => Array("secret[$id]", t("Consumer Secret"), "", ""), 'key' => Array("key[$id]", t("Consumer Key"), "", ""), + 'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""), ); $t = get_markup_template( "admin.tpl", "addon/statusnet/" ); From 78f850215a7dfb9a15d0366f26e51565c9bd8156 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 19 Feb 2013 09:04:56 +0100 Subject: [PATCH 6/9] typo --- statusnet/statusnet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 273a9b8c..cca04ee9 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -211,7 +211,7 @@ function statusnet_settings_post ($a,$post) { goaway($a->get_baseurl().'/settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { - // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen + // if the user supplied us with a PIN from StatusNet, let the magic of OAuth happen $api = get_pconfig(local_user(), 'statusnet', 'baseapi'); $ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' ); $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' ); From 61bbedcc0f9cf84835d4c05c22e871658671d5d2 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 19 Feb 2013 09:08:31 +0100 Subject: [PATCH 7/9] user selects preconfigured SN, put app name in pconfig --- statusnet/statusnet.php | 1 + 1 file changed, 1 insertion(+) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index cca04ee9..2e653aad 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -176,6 +176,7 @@ function statusnet_settings_post ($a,$post) { set_pconfig(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey'] ); set_pconfig(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret'] ); set_pconfig(local_user(), 'statusnet', 'baseapi', $asn['apiurl'] ); + set_pconfig(local_user(), 'statusnet', 'application_name', $asn['applicationname'] ); } else { notice( t('Please contact your site administrator.
The provided API URL is not valid.').EOL.$asn['apiurl'].EOL ); } From df7cd7850b280261567305aaf7bc14577fbd299b Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 19 Feb 2013 09:17:37 +0100 Subject: [PATCH 8/9] app name now in form if user types in her own connection --- statusnet/statusnet.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 2e653aad..b08f5f74 100755 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -195,6 +195,7 @@ function statusnet_settings_post ($a,$post) { set_pconfig(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); set_pconfig(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']); set_pconfig(local_user(), 'statusnet', 'baseapi', $apibase ); + set_pconfig(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] ); } else { // the API path is not correct, maybe missing trailing / ? $apibase = $apibase . '/'; @@ -302,6 +303,9 @@ function statusnet_settings(&$a,&$s) { $s .= ''; $s .= '
'; $s .= '

'; + $s .= ''; + $s .= '
'; + $s .= '

'; $s .= '
'; } else { /*** From 66e193c4016b252fb3b16cd47bdcfb04b27bd541 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 19 Feb 2013 09:23:01 +0100 Subject: [PATCH 9/9] form styling and admin templates --- statusnet/statusnet.css | 1 + statusnet/view/admin.tpl | 1 + statusnet/view/smarty3/admin.tpl | 1 + 3 files changed, 3 insertions(+) diff --git a/statusnet/statusnet.css b/statusnet/statusnet.css index d8b9f1f1..81c38d98 100755 --- a/statusnet/statusnet.css +++ b/statusnet/statusnet.css @@ -20,6 +20,7 @@ } #statusnet-default-label, +#statusnet-applicationname-label, #statusnet-sendtaglinks-label, #statusnet-shortening-label, #statusnet-mirror-label, diff --git a/statusnet/view/admin.tpl b/statusnet/view/admin.tpl index b40adf35..686a4c79 100644 --- a/statusnet/view/admin.tpl +++ b/statusnet/view/admin.tpl @@ -3,6 +3,7 @@ {{ inc field_input.tpl with $field=$s.apiurl }}{{ endinc }} {{ inc field_input.tpl with $field=$s.secret }}{{ endinc }} {{ inc field_input.tpl with $field=$s.key }}{{ endinc }} + {{ inc field_input.tpl with $field=$s.applicationname }}{{ endinc }} {{ if $s.delete }} {{ inc field_checkbox.tpl with $field=$s.delete }}{{ endinc }}
diff --git a/statusnet/view/smarty3/admin.tpl b/statusnet/view/smarty3/admin.tpl index e2a8408f..f8d14c69 100644 --- a/statusnet/view/smarty3/admin.tpl +++ b/statusnet/view/smarty3/admin.tpl @@ -3,6 +3,7 @@ {{include file="field_input.tpl" field=$s.apiurl}} {{include file="field_input.tpl" field=$s.secret}} {{include file="field_input.tpl" field=$s.key}} + {{include file="field_input.tpl" field=$s.applicationname}} {{if $s.delete}} {{include file="field_checkbox.tpl" field=$s.delete}}