]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorMichael Vogel <icarus@dabo.de>
Wed, 20 Feb 2013 20:49:38 +0000 (21:49 +0100)
committerMichael Vogel <icarus@dabo.de>
Wed, 20 Feb 2013 20:49:38 +0000 (21:49 +0100)
pledgie/pledgie.php [new file with mode: 0644]
statusnet/statusnet.css
statusnet/statusnet.php
statusnet/view/admin.tpl
statusnet/view/smarty3/admin.tpl

diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php
new file mode 100644 (file)
index 0000000..8f6228f
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/**
+ *  * Name: Pledgie
+ *   * Description: Show link to Friendica pledgie account for donating
+ *    * Version: 1.0
+ *     * Author: tony baldwin <tony@free-haven.org>
+ *      */
+
+
+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 .= '<div style="position: fixed; bottom: 25px; left: 5px;"><a href=\'http://www.pledgie.com/campaigns/18417\'><img alt=\'Click here to lend your support to: Beyond Social Networking and make a donation at www.pledgie.com !\' src=\'http://www.pledgie.com/campaigns/18417.png?skin_name=chrome\' border=\'0\' target=\'_blank\' /></a></div>'; } 
+
index d8b9f1f136e857e26db11335ce30fed023b8ffb6..81c38d98a1c1a841f72832b6151831b5e843f9e8 100755 (executable)
@@ -20,6 +20,7 @@
 }
 
 #statusnet-default-label,
+#statusnet-applicationname-label,
 #statusnet-sendtaglinks-label,
 #statusnet-shortening-label, 
 #statusnet-mirror-label,
index 0ffbae6b1cf3b2dbdf4fcaba4b51a89269ed03de..77bff7a44fe199d7494a43008f490aa7f7639e47 100755 (executable)
@@ -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.<br />The provided API URL is not valid.').EOL.$asn['apiurl'].EOL );
                         }
@@ -194,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 . '/';
@@ -211,7 +213,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' );
@@ -301,6 +303,9 @@ function statusnet_settings(&$a,&$s) {
             $s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">'. t("Base API Path \x28remember the trailing /\x29") .'</label>';
             $s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
             $s .= '<p></p><div class="clear"></div></div>';
+            $s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.t('StatusNet application name').'</label>';
+            $s .= '<input id="statusnet-applicationname" type="text" name="statusnet-applicationname" size="35" /><br />';
+            $s .= '<p></p><div class="clear"></div></div>';
             $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
        } else {
                /***
@@ -704,6 +709,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 +720,8 @@ function statusnet_plugin_admin_post(&$a){
                                        'sitename' => $sitename,
                                        'apiurl' => $apiurl,
                                        'consumersecret' => $secret,
-                                       'consumerkey' => $key
+                                       'consumerkey' => $key,
+                                        'applicationname' => $applicationname
                                );
                }
        }
@@ -734,6 +741,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 +753,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/" );
@@ -791,8 +800,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();
 
index b40adf35a7f2c9bd4c0ece10fffee3e77bae8298..686a4c7921e672d0c88a068aad50515712d2bdef 100644 (file)
@@ -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 }}
                <hr>
index e2a8408f8e3a47a4feed29d9b979b398f872e603..f8d14c69697aad1adcbf292f180f6686e285db17 100644 (file)
@@ -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}}
                <hr>