Merge pull request #650 from annando/post-type
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Fri, 20 Jul 2018 10:53:12 +0000 (12:53 +0200)
committerGitHub <noreply@github.com>
Fri, 20 Jul 2018 10:53:12 +0000 (12:53 +0200)
We don't store the "type" parameter anymore

54 files changed:
advancedcontentfilter/advancedcontentfilter.php
buffer/buffer.php
catavatar/catavatar.php
curweather/templates/widget.tpl
diaspora/diaspora.php
fortunate/fortunate.php
geonames/README.md [new file with mode: 0644]
geonames/config/geonames.ini.php [new file with mode: 0644]
geonames/geonames.php
gravatar/README.md
gravatar/config/gravatar.ini.php [new file with mode: 0644]
gravatar/gravatar.php
ifttt/ifttt.php
impressum/README.md
impressum/config/impressum.ini.php [new file with mode: 0644]
impressum/impressum.php
ldapauth/README
ldapauth/config/ldapauth.ini.php [new file with mode: 0644]
ldapauth/ldapauth.php
libertree/libertree.php
libravatar/README.md
libravatar/config/libravatar.ini.php [new file with mode: 0644]
libravatar/libravatar.php
mastodoncustomemojis/mastodoncustomemojis.php
mathjax/README.md
mathjax/config/mathjax.ini.php [new file with mode: 0644]
mathjax/mathjax.php
morechoice/morechoice.php
notifyall/notifyall.php
openstreetmap/README
openstreetmap/config/openstreetmap.ini.php [new file with mode: 0644]
openstreetmap/openstreetmap.php
piwik/README.md
piwik/config/piwik.ini.php [new file with mode: 0644]
piwik/piwik.php
public_server/README.md
public_server/config/public_server.ini.php [new file with mode: 0644]
public_server/public_server.php
pumpio/README.md
pumpio/config/pumpio.ini.php [new file with mode: 0644]
pumpio/pumpio.php
pumpio/pumpio_sync.php
securemail/securemail.php
statusnet/statusnet.php
testdrive/README.md
testdrive/config/testdrive.ini.php [new file with mode: 0644]
testdrive/testdrive.php
tumblr/tumblr.php
twitter/README.md
twitter/config/twitter.ini.php [new file with mode: 0644]
twitter/twitter.php
twitter/twitter_sync.php
windowsphonepush/windowsphonepush.php
wppost/wppost.php

index eebec4b..239f3d9 100644 (file)
  */
 
 use Friendica\App;
+use Friendica\Content\Text\Markdown;
 use Friendica\Core\Addon;
+use Friendica\Core\Cache;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
+use Friendica\Database\dba;
+use Friendica\Database\DBM;
 use Friendica\Database\DBStructure;
+use Friendica\Model\Item;
+use Friendica\Model\Term;
+use Friendica\Module\Login;
 use Friendica\Network\HTTPException;
+use Friendica\Util\DateTimeFormat;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use Symfony\Component\ExpressionLanguage;
-use Friendica\Model\Item;
 
 require_once 'boot.php';
 require_once 'include/conversation.php';
@@ -110,7 +117,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
                $vars[str_replace('-', '_', $key)] = $value;
        }
 
-       $rules = Friendica\Core\Cache::get('rules_' . local_user());
+       $rules = Cache::get('rules_' . local_user());
        if (!isset($rules)) {
                $rules = dba::inArray(dba::select(
                        'advancedcontentfilter_rules',
@@ -179,7 +186,7 @@ function advancedcontentfilter_init(App $a)
 function advancedcontentfilter_content(App $a)
 {
        if (!local_user()) {
-               return \Friendica\Module\Login::form('/' . implode('/', $a->argv));
+               return Login::form('/' . implode('/', $a->argv));
        }
 
        if ($a->argc > 0 && $a->argv[1] == 'help') {
@@ -194,7 +201,7 @@ function advancedcontentfilter_content(App $a)
 
                $content = file_get_contents($help_path);
 
-               $html = \Friendica\Content\Text\Markdown::convert($content, false);
+               $html = Markdown::convert($content, false);
 
                $html = str_replace('code>', 'key>', $html);
 
@@ -332,7 +339,7 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request)
        }
 
        $fields['uid'] = local_user();
-       $fields['created'] = \Friendica\Util\DateTimeFormat::utcNow();
+       $fields['created'] = DateTimeFormat::utcNow();
 
        if (!dba::insert('advancedcontentfilter_rules', $fields)) {
                throw new HTTPException\ServiceUnavaiableException(dba::errorMessage());
@@ -407,11 +414,11 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
        $params = ['order' => ['uid' => true]];
        $item = Item::selectFirstForUser(local_user(), [], $condition, $params);
 
-       if (!\Friendica\Database\DBM::is_result($item)) {
+       if (!DBM::is_result($item)) {
                throw new HTTPException\NotFoundException(L10n::t('Unknown post with guid: %s', $args['guid']));
        }
 
-       $tags = \Friendica\Model\Term::populateTagsFromItem($item);
+       $tags = Term::populateTagsFromItem($item);
 
        $item['tags'] = $tags['tags'];
        $item['hashtags'] = $tags['hashtags'];
index 9d14fd8..0fef484 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
 use Friendica\Model\ItemContent;
 
 function buffer_install() {
index 72fc1e0..20291b5 100644 (file)
@@ -5,17 +5,18 @@
  * Version: 1.1
  * Author: Fabio <https://kirgroup.com/profile/fabrixxm>
  */
+
 use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Core\Worker;
 use Friendica\Core\PConfig;
-use Friendica\Util\DateTimeFormat;
-use Friendica\Network\HTTPException\NotFoundException;
+use Friendica\Core\Worker;
+use Friendica\Database\dba;
+use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Photo;
-use Friendica\Database\DBM;
+use Friendica\Network\HTTPException\NotFoundException;
 
 define("CATAVATAR_SIZE", 256);
 
index db3b7a8..0847ec0 100644 (file)
@@ -1,6 +1,6 @@
 <div id="curweather-network" class="widget">
        <div class="title tool">
-               <h4 title="{{$lastupdate}}">{{$title}}: {{$city}}</h4>
+               <h3 title="{{$lastupdate}}">{{$title}}: {{$city}}</h3>
        </div>
        <p>
        <img src="{{$icon}}" title="{{$description}}">
index 04d3c7e..7f955ce 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
 use Friendica\Database\DBM;
 use Friendica\Model\Queue;
 
index 8c15caa..ebece48 100644 (file)
@@ -4,6 +4,7 @@
  * Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ * Status: Unsupported
  */
 use Friendica\Core\Addon;
 use Friendica\Util\Network;
@@ -28,7 +29,7 @@ function fortunate_uninstall()
 
 function fortunate_fetch(&$a, &$b)
 {
-       $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' 
+       $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
                . $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
 
        if (FORTUNATE_SERVER != 'hostname.com') {
diff --git a/geonames/README.md b/geonames/README.md
new file mode 100644 (file)
index 0000000..ba90dc5
--- /dev/null
@@ -0,0 +1,15 @@
+Geonames Addon
+==============
+
+Authors Mike Macgirvin.
+
+Use Geonames service to resolve nearest populated location for given latitude, longitude.
+
+## Installation
+
+Pre-requisite: Register a username at geonames.org and set in config/addon.ini.php
+
+    [geonames]
+    username = your_username
+
+Also visit http://geonames.org/manageaccount and enable access to the free web services.
\ No newline at end of file
diff --git a/geonames/config/geonames.ini.php b/geonames/config/geonames.ini.php
new file mode 100644 (file)
index 0000000..280e7a9
--- /dev/null
@@ -0,0 +1,12 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[geonames]
+; username (String)
+; The geonames.org API username
+username =
+
+INI;
+//Keep this line
\ No newline at end of file
index 79e268e..4cd1b27 100644 (file)
@@ -4,18 +4,20 @@
  * Description: Use Geonames service to resolve nearest populated location for given latitude, longitude
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
- * 
- * 
+ *
+ *
  * Pre-requisite: Register a username at geonames.org
- * and set in .htconfig.php
+ * and set in config/addon.ini.php
+ *
+ * [geonames]
+ * username = your_username
  *
- * $a->config['geonames']['username'] = 'your_username';
  * Also visit http://geonames.org/manageaccount and enable access to the free web services
  *
  * When addon is installed, the system calls the addon
  * name_install() function, located in 'addon/name/name.php',
  * where 'name' is the name of the addon.
- * If the addon is removed from the configuration list, the 
+ * If the addon is removed from the configuration list, the
  * system will call the name_uninstall() function.
  *
  */
@@ -28,8 +30,10 @@ use Friendica\Util\XML;
 
 function geonames_install() {
 
+       Addon::registerHook('load_config', 'addon/geonames/geonames.php', 'geonames_load_config');
+
        /**
-        * 
+        *
         * Our addon will attach in three places.
         * The first is just prior to storing a local post.
         *
@@ -39,7 +43,7 @@ function geonames_install() {
 
        /**
         *
-        * Then we'll attach into the addon settings page, and also the 
+        * Then we'll attach into the addon settings page, and also the
         * settings post hook so that we can create and update
         * user preferences.
         *
@@ -62,6 +66,7 @@ function geonames_uninstall() {
         *
         */
 
+       Addon::unregisterHook('load_config',   'addon/geonames/geonames.php', 'geonames_load_config');
        Addon::unregisterHook('post_local',    'addon/geonames/geonames.php', 'geonames_post_hook');
        Addon::unregisterHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin');
        Addon::unregisterHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
@@ -70,7 +75,10 @@ function geonames_uninstall() {
        logger("removed geonames");
 }
 
-
+function geonames_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/geonames.ini.php');
+}
 
 function geonames_post_hook($a, &$item) {
 
@@ -151,7 +159,7 @@ function geonames_addon_admin_post($a,$post) {
 
 /**
  *
- * Called from the Addon Setting form. 
+ * Called from the Addon Setting form.
  * Add our own settings info to the page.
  *
  */
index 0145570..b8ca824 100644 (file)
@@ -30,13 +30,15 @@ Gravatar lets users self-rate their images to be used at appropriate audiences.
 See more information at [Gravatar][1].
 
 ## Alternative Configuration
-Open the .htconfig.php file and add "gravatar" to the list of activated addons:
+Open the config/local.ini.php file and add "gravatar" to the list of activated addons:
 
-        $a->config['system']['addon'] = "..., gravatar";
+        [system]
+               addon = ...,gravatar
 
-You can add two configuration variables for the addon:
+You can add two configuration variables for the addon to the config/addon.ini.php file:
 
-        $a->config['gravatar']['default_avatar'] = "identicon";
-        $a->config['gravatar']['rating'] = "g";
+        [gravatar]
+               default_avatar = identicon
+        rating = g
 
 [1]: http://www.gravatar.com/site/implement/images/ "See documentation at Gravatar for more information"
diff --git a/gravatar/config/gravatar.ini.php b/gravatar/config/gravatar.ini.php
new file mode 100644 (file)
index 0000000..a07005a
--- /dev/null
@@ -0,0 +1,28 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[gravatar]
+; default_avatar (String)
+; If no avatar was found for an email Gravatar can create some pseudo-random generated avatars based on an email hash.
+; You can choose between these presets:
+; - gravatar : default static Gravatar logo
+; - mm       : (mystery-man) a static image
+; - identicon: a generated geometric pattern based on email hash
+; - monsterid: a generated 'monster' with different colors, faces, etc. based on email hash
+; - wavatar  : faces with different features and backgrounds based on email hash
+; - retro    : 8-bit arcade-styled pixelated faces based on email hash
+default_avatar = gravatar
+
+; rating (String)
+; Gravatar lets users self-rate their images to be used at appropriate audiences.
+; Choose which are appropriate for your friendica site:
+; - g : suitable for display on all wesites with any audience type
+; - pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence
+; - r : may contain such things as harsh profanity, intense violence, nudity, or hard drug use
+; - x : may contain hardcore sexual imagery or extremely disurbing violence
+rating = g
+
+INI;
+//Keep this line
\ No newline at end of file
index a765a2e..7e5a918 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\L10n;
  * Installs the addon hook
  */
 function gravatar_install() {
+       Addon::registerHook('load_config',   'addon/gravatar/gravatar.php', 'gravatar_load_config');
        Addon::registerHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
 
        logger("registered gravatar in avatar_lookup hook");
@@ -22,11 +23,17 @@ function gravatar_install() {
  * Removes the addon hook
  */
 function gravatar_uninstall() {
+       Addon::unregisterHook('load_config',   'addon/gravatar/gravatar.php', 'gravatar_load_config');
        Addon::unregisterHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
 
        logger("unregistered gravatar in avatar_lookup hook");
 }
 
+function gravatar_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/gravatar.ini.php');
+}
+
 /**
  * Looks up the avatar at gravatar.com and returns the URL.
  *
@@ -34,7 +41,7 @@ function gravatar_uninstall() {
  * @param &$b array
  */
 function gravatar_lookup($a, &$b) {
-       $default_avatar = Config::get('gravatar', 'default_img');
+       $default_avatar = Config::get('gravatar', 'default_avatar');
        $rating = Config::get('gravatar', 'rating');
 
        // setting default value if nothing configured
@@ -60,7 +67,7 @@ function gravatar_lookup($a, &$b) {
 function gravatar_addon_admin (&$a, &$o) {
        $t = get_markup_template( "admin.tpl", "addon/gravatar/" );
 
-       $default_avatar = Config::get('gravatar', 'default_img');
+       $default_avatar = Config::get('gravatar', 'default_avatar');
        $rating = Config::get('gravatar', 'rating');
 
        // set default values for first configuration
@@ -109,7 +116,7 @@ function gravatar_addon_admin_post (&$a) {
 
        $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
        $rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g');
-       Config::set('gravatar', 'default_img', $default_avatar);
+       Config::set('gravatar', 'default_avatar', $default_avatar);
        Config::set('gravatar', 'rating', $rating);
        info(L10n::t('Gravatar settings updated.') .EOL);
 }
index a17b05c..87cb176 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 
index 963a085..0d0aa51 100644 (file)
@@ -2,37 +2,27 @@ Impressum Addon for Friendica
 ==============================
 
 * Author: Tobias Diekershoff
-* License: [3-clause BSD](http://opensource.org/licenses/BSD-3-Clause) license
-  (see the LICENSE file in the addon directory)
+* License: [3-clause BSD](http://opensource.org/licenses/BSD-3-Clause) license (see the LICENSE file in the addon directory)
 
 About
 -----
-This addon adds an Impressum (contact) block to the /friendica page with 
-informations about the page operator/owner and how to contact you in case of
-any questions.
+This addon adds an Impressum (contact) block to the /friendica page with informations about the page operator/owner and how to contact you in case of any questions.
 
-In the notes and postal fields you can use bbcode tags for formatting, like in
-normal friendica postings..
+In the notes and postal fields you can use bbcode tags for formatting, like in normal friendica postings..
 
 Configuration
 -------------
-Simply fill in the fields in the impressium settings page in the addons 
-area of your admin panel. For email adresses the "@" symbol will be obfuscated
-in the source of the page to make in harder for harvesting tools.
+Simply fill in the fields in the impressium settings page in the addons area of your admin panel. For email adresses the "@" symbol will be obfuscated in the source of the page to make in harder for harvesting tools.
 
 Manual Configuration
 --------------------
-If you for any reason prefer to use a configuration file instead, you can set the following variables in the .htconfig file
+If you for any reason you prefer to use a configuration file instead, you can set the following variables in the config/addon.ini.php file
 
-       $a->config['impressum']['owner']           this is the Name of the Operator
-       $a->config['impressum']['ownerprofile']    this is an optional Friendica account
-                                                  where the above owner name will link to
-       $a->config['impressum']['email']           a contact email address (optional)
-                                                  will be displayed slightly obfuscated
-                                                  as name(at)example(dot)com
-       $a->config['impressum']['postal']          should contain a postal address where
-                                                  you can be reached at (optional)
-       $a->config['impressum']['notes']           additional informations that should
-                                                  be displayed in the Impressum block
-       $a->config['impressum']['footer_text']     Text that will be displayed at
-                                                  the bottom of the pages.
+       [impressum]
+       owner =           this is the Name of the Operator
+       ownerprofile =    this is an optional Friendica account where the above owner name will link to
+       email =           a contact email address (optional)
+                                         will be displayed slightly obfuscated as name(at)example(dot)com
+       postal =          should contain a postal address where you can be reached at (optional)
+       notes =           additional informations that should be displayed in the Impressum block
+       footer_text =     Text that will be displayed at the bottom of the pages.
diff --git a/impressum/config/impressum.ini.php b/impressum/config/impressum.ini.php
new file mode 100644 (file)
index 0000000..1de4468
--- /dev/null
@@ -0,0 +1,33 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[impressum]
+; owner (String)
+; This is the Name of the Operator
+owner =
+
+; ownerprofile (String)
+; This is an optional Friendica account where the above owner name will link to
+ownerprofile =
+
+; email (String)
+; A contact email address (optional)
+; Will be displayed slightly obfuscated as name(at)example(dot)com
+email =
+
+; postal (String)
+; Should contain a postal address where you can be reached at (optional)
+postal =
+
+; notes (String)
+; Additional informations that should be displayed in the Impressum block
+notes =
+
+; footer_text (String)
+; Text that will be displayed at the bottom of the pages.
+footer_text =
+
+INI;
+//Keep this line
\ No newline at end of file
index 50458ee..149b139 100644 (file)
@@ -15,12 +15,14 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 
 function impressum_install() {
+       Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
     Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
     Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
     logger("installed impressum Addon");
 }
 
 function impressum_uninstall() {
+       Addon::unregisterHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
     Addon::unregisterHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
     Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
     logger("uninstalled impressum Addon");
@@ -46,6 +48,12 @@ function impressum_footer($a, &$b) {
         $b .= '<div id="impressum_footer">'.$text.'</div>';
     }
 }
+
+function impressum_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/impressum.ini.php');
+}
+
 function impressum_show($a,&$b) {
     $b .= '<h3>'.L10n::t('Impressum').'</h3>';
     $owner = Config::get('impressum', 'owner');
index ee09e94..03e8b0d 100644 (file)
@@ -3,35 +3,36 @@ Useful for Windows Active Directory and other LDAP-based organisations
 to maintain a single password across the organisation.
 Optionally authenticates only if a member of a given group in the directory.
 
-By default, the person must have registered with Friendica using the normal registration 
+By default, the person must have registered with Friendica using the normal registration
 procedures in order to have a Friendica user record, contact, and profile.
 However, it's possible with an option to automate the creation of a Friendica basic account.
 
 Note when using with Windows Active Directory: you may need to set TLS_CACERT in your site
-ldap.conf file to the signing cert for your LDAP server. 
+ldap.conf file to the signing cert for your LDAP server.
 
-The configuration options for this module may be set in the .htconfig.php file
+The configuration options for this module may be set in the config/addon.ini.php file
 e.g.:
 
-// ldap hostname server - required
-$a->config['ldapauth']['ldap_server'] = 'host.example.com';
-// dn to search users - required
-$a->config['ldapauth']['ldap_searchdn'] = 'ou=users,dc=example,dc=com';
-// attribute to find username - required
-$a->config['ldapauth']['ldap_userattr'] = 'uid';
+       [ldapauth]
+       // ldap hostname server - required
+       ldap_server = host.example.com
+       // dn to search users - required
+       ldap_searchdn = ou=users,dc=example,dc=com
+       // attribute to find username - required
+       ldap_userattr = uid
 
-// admin dn - optional - only if ldap server dont have anonymous access
-$a->config['ldapauth']['ldap_binddn'] = 'cn=admin,dc=example,dc=com';
-// admin password - optional - only if ldap server dont have anonymous access
-$a->config['ldapauth']['ldap_bindpw'] = 'password';
+       // admin dn - optional - only if ldap server dont have anonymous access
+       ldap_binddn = cn=admin,dc=example,dc=com
+       // admin password - optional - only if ldap server dont have anonymous access
+       ldap_bindpw = password
 
-// for create Friendica account if user exist in ldap
-//     required an email and a simple (beautiful) nickname on user ldap object
-//   active account creation - optional - default none
-$a->config['ldapauth']['ldap_autocreateaccount'] = 'true';
-//   attribute to get email - optional - default : 'mail'
-$a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail';
-//   attribute to get nickname - optional - default : 'givenName'
-$a->config['ldapauth']['ldap_autocreateaccount_nameattribute'] = 'givenName';
+       // for create Friendica account if user exist in ldap
+       //     required an email and a simple (beautiful) nickname on user ldap object
+       //   active account creation - optional - default none
+       ldap_autocreateaccount = true
+       //   attribute to get email - optional - default : 'mail'
+       ldap_autocreateaccount_emailattribute = mail
+       //   attribute to get nickname - optional - default : 'givenName'
+       ldap_autocreateaccount_nameattribute = givenName
 
 ...etc.
diff --git a/ldapauth/config/ldapauth.ini.php b/ldapauth/config/ldapauth.ini.php
new file mode 100644 (file)
index 0000000..d707550
--- /dev/null
@@ -0,0 +1,50 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[ldapauth]
+; ldap_server (String)
+; ldap hostname server - required
+; Example: ldap_server = host.example.com
+ldap_server =
+
+; ldap_binddn (String)
+; admin dn - optional - only if ldap server dont have anonymous access
+; Example: ldap_binddn = cn=admin,dc=example,dc=com
+ldap_binddn =
+
+; ldap_bindpw (String)
+; admin password - optional - only if ldap server dont have anonymous access
+ldap_bindpw =
+
+; ldap_searchdn (String)
+; dn to search users - required
+; Example: ldap_searchdn = ou=users,dc=example,dc=com
+ldap_searchdn =
+
+; ldap_userattr (String)
+; attribute to find username - required
+; Example: ldap_userattr = uid
+ldap_userattr =
+
+; ldap_group (String)
+; DN of the group whose member can auth on Friendica - optional
+ldap_group =
+
+; ldap_autocreateaccount (Boolean)
+; for create Friendica account if user exist in ldap
+;      required an email and a simple (beautiful) nickname on user ldap object
+; active account creation - optional - default none
+ldap_autocreateaccount = true
+
+; ldap_autocreateaccount_emailattribute (String)
+; attribute to get email - optional - default : 'mail'
+ldap_autocreateaccount_emailattribute = mail
+
+; ldap_autocreateaccount_nameattribute (String)
+; attribute to get nickname - optional - default : 'givenName'
+ldap_autocreateaccount_nameattribute = givenName
+
+INI;
+//Keep this line
\ No newline at end of file
index d06874b..514fb1d 100644 (file)
  * Note when using with Windows Active Directory: you may need to set TLS_CACERT in your site
  * ldap.conf file to the signing cert for your LDAP server.
  *
- * The configuration options for this module may be set in the .htconfig.php file
+ * The configuration options for this module may be set in the config/addon.ini.php file
  * e.g.:
  *
- * // ldap hostname server - required
- * $a->config['ldapauth']['ldap_server'] = 'host.example.com';
- * // dn to search users - required
- * $a->config['ldapauth']['ldap_searchdn'] = 'ou=users,dc=example,dc=com';
- * // attribute to find username - required
- * $a->config['ldapauth']['ldap_userattr'] = 'uid';
+ * [ldapauth]
+ * ; ldap hostname server - required
+ * ldap_server = host.example.com
+ * ; dn to search users - required
+ * ldap_searchdn = ou=users,dc=example,dc=com
+ * ; attribute to find username - required
+ * ldap_userattr = uid
  *
- * // admin dn - optional - only if ldap server dont have anonymous access
- * $a->config['ldapauth']['ldap_binddn'] = 'cn=admin,dc=example,dc=com';
- * // admin password - optional - only if ldap server dont have anonymous access
- * $a->config['ldapauth']['ldap_bindpw'] = 'password';
+ * ; admin dn - optional - only if ldap server dont have anonymous access
+ * ldap_binddn = cn=admin,dc=example,dc=com
+ * ; admin password - optional - only if ldap server dont have anonymous access
+ * ldap_bindpw = password
  *
- * // for create Friendica account if user exist in ldap
- * //     required an email and a simple (beautiful) nickname on user ldap object
- * //   active account creation - optional - default none
- * $a->config['ldapauth']['ldap_autocreateaccount'] = 'true';
- * //   attribute to get email - optional - default : 'mail'
- * $a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail';
- * //   attribute to get nickname - optional - default : 'givenName'
- * $a->config['ldapauth']['ldap_autocreateaccount_nameattribute'] = 'cn';
+ * ; for create Friendica account if user exist in ldap
+ * ;     required an email and a simple (beautiful) nickname on user ldap object
+ * ;   active account creation - optional - default none
+ * ldap_autocreateaccount = true
+ * ;   attribute to get email - optional - default : 'mail'
+ * ldap_autocreateaccount_emailattribute = mail
+ * ;   attribute to get nickname - optional - default : 'givenName'
+ * ldap_autocreateaccount_nameattribute = cn
  *
  * ...etc.
  */
@@ -58,14 +59,21 @@ use Friendica\Model\User;
 
 function ldapauth_install()
 {
+       Addon::registerHook('load_config',  'addon/ldapauth/ldapauth.php', 'ldapauth_load_config');
        Addon::registerHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
 }
 
 function ldapauth_uninstall()
 {
+       Addon::unregisterHook('load_config',  'addon/ldapauth/ldapauth.php', 'ldapauth_load_config');
        Addon::unregisterHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
 }
 
+function ldapauth_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/ldapauth.ini.php');
+}
+
 function ldapauth_hook_authenticate($a, &$b)
 {
        if (ldapauth_authenticate($b['username'], $b['password'])) {
index 4d159bf..b1188e9 100644 (file)
@@ -10,6 +10,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
 use Friendica\Util\Network;
 
 function libertree_install() {
index d535aa0..ca595be 100644 (file)
@@ -9,8 +9,6 @@ This addon allows you to look up an avatar image for new users and contacts at [
 Libravatar is a free and open replacement for Gravatar. It is a service where people can store an avatar image for their email-addresses. These avatar images can get looked up for example in comment functions, profile pages, etc. on other sites. There exists a central installation at [www.libravatar.com](http://www.libravatar.com), but you can also host it on your own server. If no avatar was found Libravatar will look up at Gravatar as a fallback.
 There is no rating available, as it is on Gravatar, so all avatar lookups are g-rated. (Suitable for all audiences.)
 
-PHP >= 5.3 is required for this addon!
-
 You can not use the Libravatar and Gravatar addon at the same time. You need to choose one. If you need other ratings than g you better stay with Gravatar, otherwise it is safe to use Libravatar, because it will fall back to Gravatar if nothing was found at Libravatar.
 
 * * *
@@ -28,12 +26,14 @@ If no avatar was found for an email Libravatar can create some pseudo-random gen
 See examples at [Libravatar][1].
 
 ## Alternative Configuration
-Open the .htconfig.php file and add "libravatar" to the list of activated addons:
+Open the config/local.ini.php file and add "libravatar" to the list of activated addons:
 
-        $a->config['system']['addon'] = "..., libravatar";
+        [system]
+               addon = ...,libravatar
 
-You can add one configuration variable for the addon:
+You can add one configuration variables for the addon to the config/addon.ini.php file:
 
-        $a->config['libravatar']['default_avatar'] = "identicon";
+        [libravatar]
+               default_avatar = identicon
 
 [1]: http://wiki.libravatar.org/api/ "See API documentation at Libravatar for more information"
diff --git a/libravatar/config/libravatar.ini.php b/libravatar/config/libravatar.ini.php
new file mode 100644 (file)
index 0000000..e363120
--- /dev/null
@@ -0,0 +1,18 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[libravatar]
+; default_avatar (String)
+; If no avatar was found for an email Gravatar can create some pseudo-random generated avatars based on an email hash.
+; You can choose between these presets:
+; - mm       : (mystery-man) a static image
+; - identicon: a generated geometric pattern based on email hash
+; - monsterid: a generated 'monster' with different colors, faces, etc. based on email hash
+; - wavatar  : faces with different features and backgrounds based on email hash
+; - retro    : 8-bit arcade-styled pixelated faces based on email hash
+default_avatar = identicon
+
+INI;
+//Keep this line
\ No newline at end of file
index dd1d613..14bc035 100644 (file)
@@ -14,12 +14,7 @@ use Friendica\Core\L10n;
  */
 function libravatar_install()
 {
-       if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
-               info(L10n::t('Could NOT install Libravatar successfully.<br>It requires PHP >= 5.3') .EOL);
-               // avoid registering the hook
-               return false;
-       }
-
+       Addon::registerHook('load_config',   'addon/libravatar/libravatar.php', 'libravatar_load_config');
        Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
        logger("registered libravatar in avatar_lookup hook");
 }
@@ -29,10 +24,16 @@ function libravatar_install()
  */
 function libravatar_uninstall()
 {
+       Addon::unregisterHook('load_config',   'addon/libravatar/libravatar.php', 'libravatar_load_config');
        Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
        logger("unregistered libravatar in avatar_lookup hook");
 }
 
+function libravatar_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/libravatar.ini.php');
+}
+
 /**
  * Looks up the avatar at Libravatar and returns the URL.
  *
@@ -41,11 +42,11 @@ function libravatar_uninstall()
  */
 function libravatar_lookup($a, &$b)
 {
-       $default_avatar = Config::get('libravatar', 'default_img');
+       $default_avatar = Config::get('libravatar', 'default_avatar');
 
        if (! $default_avatar) {
                // if not set, look up if there was one from the gravatar addon
-               $default_avatar = Config::get('gravatar', 'default_img');
+               $default_avatar = Config::get('gravatar', 'default_avatar');
                // setting default avatar if nothing configured
                if (!$default_avatar) {
                        $default_avatar = 'identicon'; // default image will be a random pattern
@@ -69,7 +70,7 @@ function libravatar_addon_admin(&$a, &$o)
 {
        $t = get_markup_template("admin.tpl", "addon/libravatar");
 
-       $default_avatar = Config::get('libravatar', 'default_img');
+       $default_avatar = Config::get('libravatar', 'default_avatar');
 
        // set default values for first configuration
        if (!$default_avatar) {
@@ -117,6 +118,6 @@ function libravatar_addon_admin_post(&$a)
        check_form_security_token('libravatarrsave');
 
        $default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
-       Config::set('libravatar', 'default_img', $default_avatar);
+       Config::set('libravatar', 'default_avatar', $default_avatar);
        info(L10n::t('Libravatar settings updated.') .EOL);
 }
index d7ce742..93d0ba6 100644 (file)
@@ -5,9 +5,16 @@
  * Description: Replace emojis shortcodes in Mastodon posts with their originating server custom emojis images.
  * Version: 1.0
  * Author: Hypolite Petovan
+ * Author: Roland Haeder
  */
 
+use Friendica\App;
+use Friendica\Content\Smilies;
 use Friendica\Core\Addon;
+use Friendica\Core\Cache;
+use Friendica\Core\Config;
+use Friendica\Core\Protocol;
+use Friendica\Util\Network;
 
 function mastodoncustomemojis_install()
 {
@@ -29,7 +36,7 @@ function mastodoncustomemojis_uninstall()
        Addon::unregisterHook('contacts_mod_init',  __FILE__, 'mastodoncustomemojis_css_hook');
 }
 
-function mastodoncustomemojis_css_hook(Friendica\App $a)
+function mastodoncustomemojis_css_hook(App $a)
 {
        $a->page['htmlhead'] .= <<<HTML
 <!-- Style added by mastodoncustomemojis -->
@@ -44,16 +51,16 @@ function mastodoncustomemojis_css_hook(Friendica\App $a)
 HTML;
 }
 
-function mastodoncustomemojis_put_item_in_cache(Friendica\App $a, &$hook_data)
+function mastodoncustomemojis_put_item_in_cache(App $a, array &$hook_data)
 {
        // Mastodon uses OStatus, skipping other network protocols
-       if ($hook_data['item']['network'] != Friendica\Core\Protocol::OSTATUS) {
+       if (empty($hook_data['item']['author-link']) || ($hook_data['item']['network'] != Protocol::OSTATUS)) {
                return;
        }
 
        $emojis = mastodoncustomemojis_get_custom_emojis_for_author($hook_data['item']['author-link']);
 
-       $hook_data["rendered-html"] = Friendica\Content\Smilies::replaceFromArray($hook_data["rendered-html"], $emojis);
+       $hook_data["rendered-html"] = Smilies::replaceFromArray($hook_data["rendered-html"], $emojis);
 }
 
 function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
@@ -62,18 +69,18 @@ function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
 
        $url_parts = parse_url($author_link);
 
-       $api_base_url = $url_parts['scheme'] . '://' . $url_parts['host'] . ($url_parts['port'] ? ':' . $url_parts['port'] : '');
+       $api_base_url = $url_parts['scheme'] . '://' . $url_parts['host'] . (isset($url_parts['port']) ? ':' . $url_parts['port'] : '');
 
        $cache_key = 'mastodoncustomemojis:' . $api_base_url;
 
-       $emojis = Friendica\Core\Cache::get($cache_key);
-       if (empty($emojis)) {
+       $emojis = Cache::get($cache_key);
+       if (empty($emojis['texts']) || Config::get('system', 'ignore_cache')) {
                // Reset the emojis array
                $emojis = $return;
 
                $api_url = $api_base_url . '/api/v1/custom_emojis';
 
-               $ret = Friendica\Util\Network::fetchUrlFull($api_url);
+               $ret = Network::fetchUrlFull($api_url);
 
                if ($ret['success']) {
                        $emojis_array = json_decode($ret['body'], true);
@@ -84,9 +91,13 @@ function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
                                        $emojis['icons'][] = '<img class="emoji mastodon" src="' . proxy_url($emoji['static_url']) . '" alt=":' . $emoji['shortcode'] . ':" title=":' . $emoji['shortcode'] . ':"/>';
                                }
                        }
+
+                       $ttl = Cache::WEEK;
+               } else {
+                       $ttl = Cache::HALF_HOUR;
                }
 
-               Friendica\Core\Cache::set($cache_key, $emojis, Friendica\Core\Cache::WEEK);
+               Cache::set($cache_key, $emojis, $ttl);
 
                $return = $emojis;
        }
index 9647a98..19407e8 100644 (file)
@@ -13,21 +13,23 @@ This addon for friendica includes the [MathJax][1] CDN to enable rendering of
 
 Configuration
 -------------
-All you need to do is provide friendica with the base URL of MathJax. This can
+All you need to do is provide Friendica with the base URL of MathJax. This can
 be either the URL of the CDN of MathJax or your own installation.
 
 In case you want to use the CDN you can try the following URL as a quick start
 
        http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML
 
-In case you don't want or can use the admin panel of firneidca you can activate
-the addon by adding _mathjax_ to the 
+In case you don't want or can use the admin panel of Friendica you can activate
+the addon by adding _mathjax_ to the list in your config/local.ini.php file
 
-       $a->config['system']['addon']
+       [system]
+       addon = ...,mathjax
 
-list in your .htconfig.php file and then providing the base URL after that
+and then providing the base URL after that in the config/addon.ini.php file
 
-        $a->config['mathjax']['baseurl'] = 'the URL to your MathJax installation';
+       [mathjax]
+       baseurl = [the URL to your MathJax installation];
 
 Usage
 =====
diff --git a/mathjax/config/mathjax.ini.php b/mathjax/config/mathjax.ini.php
new file mode 100644 (file)
index 0000000..261a732
--- /dev/null
@@ -0,0 +1,12 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[mathjax]
+; baseurl (String)
+; The URL to your MathJax installation
+baseurl =
+
+INI;
+//Keep this line
\ No newline at end of file
index 91a6a06..c85068e 100644 (file)
@@ -13,6 +13,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 
 function mathjax_install() {
+       Addon::registerHook('load_config', 'addon/mathjax/mathjax.php', 'mathjax_load_config');
     Addon::registerHook('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header');
     Addon::registerHook('addon_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
     Addon::registerHook('addon_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
@@ -21,12 +22,18 @@ function mathjax_install() {
 }
 
 function mathjax_uninstall() {
+       Addon::unregisterHook('load_config', 'addon/mathjax/mathjax.php', 'mathjax_load_config');
     Addon::unregisterHook('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header');
     Addon::unregisterHook('addon_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
     Addon::unregisterHook('addon_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
     Addon::unregisterHook('template_vars', 'addon/mathjax/mathjax.php', 'mathjax_template_vars');
 }
 
+function mathjax_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/mathjax.ini.php');
+}
+
 function mathjax_template_vars($a, &$arr)
 {
     if (!array_key_exists('addon_hooks',$arr['vars']))
index b8a170a..0d92943 100644 (file)
@@ -7,7 +7,9 @@
  *    - who takes no responsibility for any additional content which may appear herein
  *
  */
+
 use Friendica\Core\Addon;
+use Friendica\Core\Config;
 
 function morechoice_install() {
 
@@ -28,17 +30,17 @@ function morechoice_uninstall() {
 
 }
 
-// We aren't going to bother translating these to other languages. 
+// We aren't going to bother translating these to other languages.
 
 function morechoice_gender_selector($a,&$b) {
-       if($a->config['system']['language'] == 'en') {
+       if(Config::get('system', 'language') == 'en') {
                $b[] = 'Androgyne';
-               $b[] = 'Bear';  
-               $b[] = 'Bigender';      
+               $b[] = 'Bear';
+               $b[] = 'Bigender';
                $b[] = 'Cross dresser';
                $b[] = 'Drag queen';
                $b[] = 'Eunuch';
-               $b[] = 'Faux queen';    
+               $b[] = 'Faux queen';
                $b[] = 'Gender fluid';
                $b[] = 'Kathoey';
                $b[] = 'Lady';
@@ -59,7 +61,7 @@ function morechoice_gender_selector($a,&$b) {
 }
 
 function morechoice_sexpref_selector($a,&$b) {
-       if($a->config['system']['language'] == 'en') {
+       if(Config::get('system', 'language') == 'en') {
                $b[] = 'Girls with big tits';
                $b[] = 'Millionaires';
                $b[] = 'Guys with big schlongs';
@@ -114,7 +116,7 @@ function morechoice_sexpref_selector($a,&$b) {
 }
 
 function morechoice_marital_selector($a,&$b) {
-       if($a->config['system']['language'] == 'en') {
+       if(Config::get('system', 'language') == 'en') {
                $b[] = 'Married to my job';
                $b[] = 'Polygamist';
                $b[] = 'Half married';
index c58d8c8..408e74a 100644 (file)
@@ -8,53 +8,54 @@
  * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica)
  */
 
+use Friendica\App;
 use Friendica\Content\Text\BBCode;
+use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Util\Emailer;
-use Friendica\App;
 
-function notifyall_install() 
+function notifyall_install()
 {
        logger("installed notifyall");
 }
 
-function notifyall_uninstall() 
+function notifyall_uninstall()
 {
        logger("removed notifyall");
 }
 
 function notifyall_module() {}
 
-function notifyall_addon_admin(App $a, &$o) 
+function notifyall_addon_admin(App $a, &$o)
 {
        $o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . z_root() . '/notifyall">' . L10n::t('Send email to all members') . '</a></br/>';
 }
 
 
-function notifyall_post(App $a) 
+function notifyall_post(App $a)
 {
        if(!is_site_admin()) {
                return;
        }
 
        $text = trim($_REQUEST['text']);
-       
+
        if(! $text) {
                return;
        }
 
-       $sitename = $a->config['sitename'];
+       $sitename = Config::get('config', 'sitename');
 
-       if (empty($a->config['admin_name'])) {
+       if (empty(Config::get('config', 'admin_name'))) {
                $sender_name = '"' . L10n::t('%s Administrator', $sitename) . '"';
        } else {
-               $sender_name = '"' . L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename) . '"';
+               $sender_name = '"' . L10n::t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename) . '"';
        }
 
-       if (! x($a->config['sender_email'])) {
+       if (! x(Config::get('config', 'sender_email'))) {
                $sender_email = 'noreply@' . $a->get_hostname();
        } else {
-               $sender_email = $a->config['sender_email'];
+               $sender_email = Config::get('config', 'sender_email');
        }
 
        $subject = $_REQUEST['subject'];
@@ -67,7 +68,7 @@ function notifyall_post(App $a)
        // if this is a test, send it only to the admin(s)
        // admin_email might be a comma separated list, but we need "a@b','c@d','e@f
        if (intval($_REQUEST['test'])) {
-               $email = $a->config['admin_email'];
+               $email = Config::get('config', 'admin_email');
                $email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
        }
        $sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
index 93f231c..48402e2 100644 (file)
@@ -16,10 +16,10 @@ Support the OpenStreetMap community and share the load.
 
 ___ Configuration ___
 
-If you for any reason prefer to use a configuration file instead 
-of the admin panels, please refer to the Alternative Configuration below. 
+If you for any reason prefer to use a configuration file instead
+of the admin panels, please refer to the Alternative Configuration below.
 
-Activate the addon from your admin panel.  
+Activate the addon from your admin panel.
 
 You can now add a Tile Server and default zoom level in the addon settings
 page of your admin panel.
@@ -32,17 +32,19 @@ zoom level available.
 
 ___ Alternative Configuration ___
 
-Open the .htconfig.php file and add "openstreetmap" to the list of activated
+Open the config/local.ini.php file and add "openstreetmap" to the list of activated
 addons.
 
-    $a->config['system']['addon'] = "openstreetmap, ..."
+    [system]
+       addon = ...,openstreetmap
 
-You have to add two configuration variables for the addon:
+You can change two configuration variables for the addon in the config/addon.ini.php file:
 
-    $a->config['openstreetmap']['tmsserver'] = 'http://www.openstreetmap.org/';
-    $a->config['openstreetmap']['zoom'] = '18';
+       [openstreetmap]
+       tmsserver = https://www.openstreetmap.org
+    zoom = 18
 
 The *tmsserver* points to the tile server you want to use. Use the full URL,
-with protocol (http/s) and trailing slash. You can configure the default zoom 
-level on the map with *zoom*. 1 will show the whole world and 18 is the highest 
+with protocol (http/s) and trailing slash. You can configure the default zoom
+level on the map with *zoom*. 1 will show the whole world and 18 is the highest
 zoom level available.
\ No newline at end of file
diff --git a/openstreetmap/config/openstreetmap.ini.php b/openstreetmap/config/openstreetmap.ini.php
new file mode 100644 (file)
index 0000000..986843b
--- /dev/null
@@ -0,0 +1,23 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[openstreetmap]
+; tmsserver (String)
+; This points to the tile server you want to use. Use the full URL, with protocol (http/s) and trailing slash.
+tmsserver = https://www.openstreetmap.org
+
+; nomserver (String)
+nomserver = https://nominatim.openstreetmap.org/search.php
+
+; zoom (Integer)
+; The default zoom level on the map.
+; 1 will show the whole world and 18 is the highest zoom level available.
+zoom = 16
+
+; marker (Integer)
+marker = 0
+
+INI;
+//Keep this line
\ No newline at end of file
index 0fe2a2f..26d51e1 100644 (file)
@@ -15,13 +15,14 @@ use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Util\Network;
 
-const OSM_TMS = 'http://www.openstreetmap.org';
-const OSM_NOM = 'http://nominatim.openstreetmap.org/search.php';
+const OSM_TMS = 'https://www.openstreetmap.org';
+const OSM_NOM = 'https://nominatim.openstreetmap.org/search.php';
 const OSM_ZOOM = 16;
 const OSM_MARKER = 0;
 
 function openstreetmap_install()
 {
+       Addon::registerHook('load_config',     'addon/openstreetmap/openstreetmap.php', 'openstreetmap_load_config');
        Addon::registerHook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
        Addon::registerHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
        Addon::registerHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
@@ -33,6 +34,7 @@ function openstreetmap_install()
 
 function openstreetmap_uninstall()
 {
+       Addon::unregisterHook('load_config',     'addon/openstreetmap/openstreetmap.php', 'openstreetmap_load_config');
        Addon::unregisterHook('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
        Addon::unregisterHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
        Addon::unregisterHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
@@ -42,6 +44,11 @@ function openstreetmap_uninstall()
        logger("removed openstreetmap");
 }
 
+function openstreetmap_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/openstreetmap.ini.php');
+}
+
 function openstreetmap_alterheader($a, &$navHtml)
 {
        $addScriptTag = '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
index 37ece2f..44d906b 100644 (file)
@@ -3,8 +3,7 @@ Piwik Addon
 
 by Tobias Diekershoff and Klaus Weidenbach
 
-This addon allows you to embed the code necessary for the FLOSS webanalytics
-tool Piwik into the Friendica pages.
+This addon allows you to embed the code necessary for the FLOSS webanalytics tool Piwik into the Friendica pages.
 
 Requirements
 ------------
@@ -14,55 +13,44 @@ To use this addon you need a [piwik](http://piwik.org/) installation.
 Where to find
 -------------
 
-In the Friendica addon git repository `/piwik/piwik.php` and a CSS file for
-styling the opt-out notice.
+In the Friendica addon git repository `/piwik/piwik.php` and a CSS file for styling the opt-out notice.
 
 Configuration
 -------------
 
-The easiest way to configure this addon is by activating the admin panels of
-your ~friendica server and then enter the needed details on the config page
-for the addon.
+The easiest way to configure this addon is by activating the admin panels of your ~friendica server and then enter the needed details on the config page for the addon.
 
-If you don't want to use the admin panel, you can configure the addon through
-the .htconfig file.
+If you don't want to use the admin panel, you can configure the addon through the config/local.ini.php file.
 
-Open the .htconfig.php file and add "piwik" to the list of activated addons.
+Open the config/local.ini.php file and add "piwik" to the list of activated addons.
 
-    $a->config['system']['addon'] = "piwik, ..."
+    [system]
+    addon = ...,piwik
 
-You have to add 4 more configuration variables for the addon:
+You can change 4 more configuration variables for the addon in the config/addon.ini.php file:
 
-    $a->config['piwik']['baseurl'] = 'example.com/piwik/';
-    $a->config['piwik']['sideid'] = '1';
-    $a->config['piwik']['optout'] = true;
-    $a->config['piwik']['async'] = false;
+    [piwik]
+    baseurl = example.com/piwik/
+    sideid = 1
+    optout = true
+    async = false
 
 Configuration fields
 ---------------------
 
-* The *baseurl* points to your Piwik installation. Use the absolute path,
-remember trailing slashes but ignore the protocol (http/s) part of the URL.
-* Change the *sideid* parameter to whatever ID you want to use for tracking your
-Friendica installation.
-* The *optout* parameter (true|false) defines whether or
-not a short notice about the utilization of Piwik will be displayed on every
-page of your Friendica site (at the bottom of the page with some spacing to the
-other content). Part of the note is a link that allows the visitor to set an
-_opt-out_ cookie which will prevent visits from that user be tracked by piwik.
-* The *async* parameter (true|false) defines whether or not to use asynchronous
-tracking so pages load (or appear to load) faster.
+* The *baseurl* points to your Piwik installation. Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL.
+* Change the *sideid* parameter to whatever ID you want to use for tracking your Friendica installation.
+* The *optout* parameter (true|false) defines whether or not a short notice about the utilization of Piwik will be displayed on every page of your Friendica site (at the bottom of the page with some spacing to the
+other content). Part of the note is a link that allows the visitor to set an _opt-out_ cookie which will prevent visits from that user be tracked by piwik.
+* The *async* parameter (true|false) defines whether or not to use asynchronous tracking so pages load (or appear to load) faster.
 
 Currently the optional notice states the following:
 
->    This website is tracked using the Piwik analytics tool. If you do not want
->    that your visits are logged this way you can set a cookie to prevent Piwik
->    from tracking further visits of the site (opt-out).
+>    This website is tracked using the Piwik analytics tool. If you do not want that your visits are logged this way you can set a cookie to prevent Piwik from tracking further visits of the site (opt-out).
 
 License
 =======
 
-The _Piwik addon_ is licensed under the [3-clause BSD license][3] see the
-LICENSE file in the addons directory.
+The _Piwik addon_ is licensed under the [3-clause BSD license][3] see the LICENSE file in the addons directory.
 
 [3]: http://opensource.org/licenses/BSD-3-Clause
diff --git a/piwik/config/piwik.ini.php b/piwik/config/piwik.ini.php
new file mode 100644 (file)
index 0000000..b66c69c
--- /dev/null
@@ -0,0 +1,29 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[piwik]
+; baseurl (String)
+; This URL points to your Piwik installation.
+; Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL.
+; Example: baseurl = example.com/piwik/
+baseurl =
+
+; siteid (Integer)
+; Change the *sideid* parameter to whatever ID you want to use for tracking your Friendica installation.
+sideid =
+
+; optout (Boolean)
+; This defines whether or not a short notice about the utilization of Piwik will be displayed on every
+; page of your Friendica site (at the bottom of the page with some spacing to the other content).
+; Part of the note is a link that allows the visitor to set an opt-out cookie which will prevent visits
+; from that user be tracked by Piwik.
+optout = true
+
+; async (Boolean)
+; This defines whether or not to use asynchronous tracking so pages load (or appear to load) faster.
+async = false
+
+INI;
+//Keep this line
\ No newline at end of file
index bbec1f6..5e34e09 100644 (file)
  *
  *   Configuration:
  *     Use the administration panel to configure the Piwik tracking addon, or
- *     in case you don't use this add the following lines to your .htconfig.php
+ *     in case you don't use this add the following lines to your config/addon.ini.php
  *     file:
  *
- *     $a->config['piwik']['baseurl'] = 'www.example.com/piwik/';
- *     $a->config['piwik']['siteid'] = '1';
- *     $a->config['piwik']['optout'] = true;  // set to false to disable
- *     $a->config['piwik']['async'] = false;  // set to true to enable
+ *     [piwik]
+ *     baseurl = example.com/piwik/
+ *     sideid = 1
+ *     optout = true ;set to false to disable
+ *     async = false ;set to true to enable
  *
  *     Change the siteid to the ID that the Piwik tracker for your Friendica
  *     installation has. Alter the baseurl to fit your needs, don't care
@@ -34,17 +35,24 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 
 function piwik_install() {
+       Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
        Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
 
        logger("installed piwik addon");
 }
 
 function piwik_uninstall() {
+       Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
        Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
 
        logger("uninstalled piwik addon");
 }
 
+function piwik_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/piwik.ini.php');
+}
+
 function piwik_analytics($a,&$b) {
 
        /*
@@ -55,12 +63,12 @@ function piwik_analytics($a,&$b) {
        $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/piwik/piwik.css' . '" media="all" />';
 
        /*
-        *   Get the configuration variables from the .htconfig file.
+        *   Get the configuration variables from the config/addon.ini.php file.
         */
-       $baseurl = Config::get('piwik','baseurl');
-       $siteid  = Config::get('piwik','siteid');
-       $optout  = Config::get('piwik','optout');
-       $async   = Config::get('piwik','async');
+       $baseurl = Config::get('piwik', 'baseurl');
+       $siteid  = Config::get('piwik', 'siteid');
+       $optout  = Config::get('piwik', 'optout');
+       $async   = Config::get('piwik', 'async');
 
        /*
         *   Add the Piwik tracking code for the site.
index b1fb49d..7ba002e 100644 (file)
@@ -2,28 +2,28 @@ Public Server
 =============
 
 
-Public Server is a Friendica addon which implements automatic account & post expiration so that a site may be used as a public
-test bed with reduced data retention. 
+Public Server is a Friendica addon which implements automatic account & post expiration so that a site may be used as a public test bed with reduced data retention.
 
 This is a modified version of the testdrive addon, DO NOT ACTIVATE AT THE SAME TIME AS THE TESTDRIVE ADDON.
 
-    //When an account is created on the site, it is given a hard expiration date of 
-    $a->config['public_server']['expiredays'] = 30;
-    //Set the default days for posts to expire here
-    $a->config['public_server']['expireposts'] = 30;
-    //Remove users who have never logged in after nologin days
-    $a->config['public_server']['nologin'] = 30;
-    //Remove users who last logged in over flagusers days ago
-    $a->config['public_server']['flagusers'] = 146;
-    //For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
-    $a->config['public_server']['flagposts'] = 90;
-    $a->config['public_server']['flagpostsexpire'] = 146;
+    [public_server]
+       ; When an account is created on the site, it is given a hard expiration date of
+    expiredays = 30
+    ; Set the default days for posts to expire here
+    expireposts = 30
+    ; Remove users who have never logged in after nologin days
+    nologin = 30
+    ; Remove users who last logged in over flagusers days ago
+    flagusers = 146
+    ; For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
+    flagposts = 90
+    flagpostsexpire = 146
 
-Set these in your .htconfig.php file. By default nothing is defined in case the addon is activated accidentally. 
+Set these in your config/addon.ini.php file. By default nothing is defined in case the addon is activated accidentally.
 They can be ommitted or set to 0 to disable each option.
 The default values are those used by friendica.eu, change these as desired.
 
 The expiration date is updated when the user logs in.
 
-An email warning will be sent out approximately five days before the expiration occurs. Five days later the account is removed completely. 
-   
+An email warning will be sent out approximately five days before the expiration occurs.
+Five days later the account is removed completely.
diff --git a/public_server/config/public_server.ini.php b/public_server/config/public_server.ini.php
new file mode 100644 (file)
index 0000000..79b2ef4
--- /dev/null
@@ -0,0 +1,30 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[public_server]
+; expiredays (Integer)
+; When an account is created on the site, it is given a hard expiration date of
+expiredays =
+
+; expireposts (Integer)
+; Set the default days for posts to expire here
+expireposts =
+
+; nologin (Integer)
+; Remove users who have never logged in after nologin days
+nologin =
+
+; flagusers (Integer)
+; Remove users who last logged in over flagusers days ago
+flagusers =
+
+; flagposts (Integer)
+; flagpostsexpire (Integer)
+; For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
+flagposts =
+flagpostsexpire =
+
+INI;
+//Keep this line
\ No newline at end of file
index cfcb8fd..9e56664 100644 (file)
@@ -9,11 +9,13 @@
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
+use Friendica\Database\dba;
 use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 
 function public_server_install()
 {
+       Addon::registerHook('load_config',      'addon/public_server/public_server.php', 'public_server_load_config');
        Addon::registerHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account');
        Addon::registerHook('cron', 'addon/public_server/public_server.php', 'public_server_cron');
        Addon::registerHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
@@ -22,12 +24,18 @@ function public_server_install()
 
 function public_server_uninstall()
 {
+       Addon::unregisterHook('load_config',      'addon/public_server/public_server.php', 'public_server_load_config');
        Addon::unregisterHook('register_account', 'addon/public_server/public_server.php', 'public_server_register_account');
        Addon::unregisterHook('cron', 'addon/public_server/public_server.php', 'public_server_cron');
        Addon::unregisterHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
        Addon::unregisterHook('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
 }
 
+function public_server_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/public_server.ini.php');
+}
+
 function public_server_register_account($a, $b)
 {
        $uid = $b;
@@ -117,7 +125,7 @@ function public_server_enotify(&$a, &$b)
                $b['itemlink'] = $a->get_baseurl();
                $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
                $b['subject'] = L10n::t('Your Friendica account is about to expire.');
-               $b['body'] = L10n::t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]");
+               $b['body'] = L10n::t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . Config::get('system', 'url') . "]" . Config::get('config', 'sitename') . "[/url]");
        }
 }
 
index 4dd90d5..9fb0105 100644 (file)
@@ -1,5 +1,6 @@
-To let the connector work properly you should define an application name in the .htconfig:
+To let the connector work properly you should define an application name in config/addon.ini.php:
 
-$a->config['pumpio']['application_name'] = "Name of you site";
+[pumpio]
+application_name = Name of you site
 
-This name appears at pump.io and is important for not mirroring back posts that came from friendica.
+This name appears at pump.io and is important for not mirroring back posts that came from Friendica.
diff --git a/pumpio/config/pumpio.ini.php b/pumpio/config/pumpio.ini.php
new file mode 100644 (file)
index 0000000..cd5e732
--- /dev/null
@@ -0,0 +1,21 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[pumpio]
+; application_name (String)
+; To let the connector work properly you should define an application name.
+; This name appears at pump.io and is important for not mirroring back posts that came from Friendica.
+application_name =
+
+; wall-to-wall_share (Boolean)
+; Displays forwarded posts like "wall-to-wall" posts.
+wall-to-wall_share = false
+
+; poll_interval (Integer)
+; Given in minutes
+poll_interval = 5
+
+INI;
+//Keep this line
\ No newline at end of file
index 494fd40..a2f21ce 100644 (file)
@@ -13,6 +13,8 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
+use Friendica\Database\dba;
+use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\Model\Group;
@@ -21,7 +23,6 @@ use Friendica\Model\Queue;
 use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use Friendica\Database\DBM;
 
 require 'addon/pumpio/oauth/http.php';
 require 'addon/pumpio/oauth/oauth_client.php';
@@ -32,6 +33,7 @@ define('PUMPIO_DEFAULT_POLL_INTERVAL', 5); // given in minutes
 
 function pumpio_install()
 {
+       Addon::registerHook('load_config',          'addon/pumpio/pumpio.php', 'pumpio_load_config');
        Addon::registerHook('post_local',           'addon/pumpio/pumpio.php', 'pumpio_post_local');
        Addon::registerHook('notifier_normal',      'addon/pumpio/pumpio.php', 'pumpio_send');
        Addon::registerHook('jot_networks',         'addon/pumpio/pumpio.php', 'pumpio_jot_nets');
@@ -44,6 +46,7 @@ function pumpio_install()
 
 function pumpio_uninstall()
 {
+       Addon::unregisterHook('load_config',      'addon/pumpio/pumpio.php', 'pumpio_load_config');
        Addon::unregisterHook('post_local',       'addon/pumpio/pumpio.php', 'pumpio_post_local');
        Addon::unregisterHook('notifier_normal',  'addon/pumpio/pumpio.php', 'pumpio_send');
        Addon::unregisterHook('jot_networks',     'addon/pumpio/pumpio.php', 'pumpio_jot_nets');
@@ -101,7 +104,7 @@ function pumpio_registerclient(&$a, $host)
                $application_name = $a->get_hostname();
        }
 
-       $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
+       $adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
 
        $params["type"] = "client_associate";
        $params["contacts"] = $adminlist[0];
@@ -372,6 +375,11 @@ function pumpio_settings_post(&$a, &$b)
        }
 }
 
+function pumpio_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/pumpio.ini.php');
+}
+
 function pumpio_post_local(&$a, &$b)
 {
        if (!local_user() || (local_user() != $b['uid'])) {
index 834bc1e..a8fa7b3 100644 (file)
@@ -2,7 +2,7 @@
 use Friendica\Core\Config;
 
 function pumpio_sync_run(&$argv, &$argc) {
-       global $a;
+       $a = Friendica\BaseObject::getApp();
 
        require_once("addon/pumpio/pumpio.php");
 
index d63c2ee..87941e7 100644 (file)
@@ -8,6 +8,7 @@
 
 use Friendica\App;
 use Friendica\Core\Addon;
+use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Util\Emailer;
@@ -94,14 +95,14 @@ function securemail_settings_post(App &$a, array &$b){
         info(L10n::t('Secure Mail Settings saved.') . EOL);
 
         if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
-            $sitename = $a->config['sitename'];
+            $sitename = Config::get('config', 'sitename');
 
             $hostname = $a->get_hostname();
             if (strpos($hostname, ':')) {
                 $hostname = substr($hostname, 0, strpos($hostname, ':'));
             }
 
-            $sender_email = $a->config['sender_email'];
+            $sender_email = Config::get('config', 'sender_email');
             if (empty($sender_email)) {
                 $sender_email = 'noreply@' . $hostname;
             }
index 51fe650..04926f1 100644 (file)
@@ -47,6 +47,8 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
+use Friendica\Database\DBM;
 use Friendica\Model\GContact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
@@ -55,7 +57,6 @@ use Friendica\Model\Photo;
 use Friendica\Model\User;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use Friendica\Database\DBM;
 
 function statusnet_install()
 {
index edc63ed..ad9414e 100644 (file)
@@ -2,22 +2,21 @@ TestDrive
 =========
 
 
-Testdrive is a Friendica addon which implements automatic account expiration so that a site may be used as a public
-test bed. 
+Testdrive is a Friendica addon which implements automatic account expiration so that a site may be used as a public test bed.
 
-When an account is created on the site, it is given a hard expiration date of 
+When an account is created on the site, it is given a hard expiration date of
 
+       [testdrive]
+       expiredays = 30
 
-$a->config['testdrive']['expiredays'] = 30;
+Set this in your config/addon.ini.php file to allow a 30 day test drive period.
+By default no expiration period is defined in case the addon is activated accidentally.
 
-Set this in your .htconfig.php file to allow a 30 day test drive period. By default no expiration period is defined 
-in case the addon is activated accidentally. 
+There is no opportunity to extend an expired account using this addon.
+Expiration is final.
+Other addons may be created which charge for service and extend the expiration as long as a balance is maintained.
+This addon is purely for creating a limited use test site.
 
-
-There is no opportunity to extend an expired account using this addon. Expiration is final. Other addons may be created
-which charge for service and extend the expiration as long as a balance is maintained. This addon is purely for creating
-a limited use test site. 
-
-An email warning will be sent out approximately five days before the expiration occurs. Once it occurs logins and many 
-system functions are disabled. Five days later the account is removed completely. 
-   
\ No newline at end of file
+An email warning will be sent out approximately five days before the expiration occurs.
+Once it occurs logins and many system functions are disabled.
+Five days later the account is removed completely.
diff --git a/testdrive/config/testdrive.ini.php b/testdrive/config/testdrive.ini.php
new file mode 100644 (file)
index 0000000..8d3f863
--- /dev/null
@@ -0,0 +1,12 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[testdrive]
+; expiredays (Integer)
+; When an account is created on the site, it is given a hard expiration date of this many days.
+expiredays =
+
+INI;
+//Keep this line
\ No newline at end of file
index 5c3930c..8e71103 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Util\DateTimeFormat;
 
 function testdrive_install() {
 
+       Addon::registerHook('load_config',      'addon/testdrive/testdrive.php', 'testdrive_load_config');
        Addon::registerHook('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account');
        Addon::registerHook('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron');
        Addon::registerHook('enotify','addon/testdrive/testdrive.php', 'testdrive_enotify');
@@ -24,6 +25,7 @@ function testdrive_install() {
 
 function testdrive_uninstall() {
 
+       Addon::unregisterHook('load_config',      'addon/testdrive/testdrive.php', 'testdrive_load_config');
        Addon::unregisterHook('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account');
        Addon::unregisterHook('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron');
        Addon::unregisterHook('enotify','addon/testdrive/testdrive.php', 'testdrive_enotify');
@@ -31,6 +33,11 @@ function testdrive_uninstall() {
 
 }
 
+function testdrive_load_config(\Friendica\App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/testdrive.ini.php');
+}
+
 function testdrive_globaldir_update($a,&$b) {
        $b['url'] = '';
 }
@@ -93,6 +100,6 @@ function testdrive_enotify(&$a, &$b) {
         $b['itemlink'] = $a->get_baseurl();
         $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
         $b['subject'] = L10n::t('Your Friendica test account is about to expire.');
-        $b['body'] = L10n::t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at http://friendica.com.", $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server());
+        $b['body'] = L10n::t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at https://friendi.ca.", $b['params']['to_name'], "[url=".Config::get('system', 'url')."]".Config::get('config', 'sitename')."[/url]", get_server());
     }
 }
index 9617a3a..6026e9b 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
 
 function tumblr_install() {
        Addon::registerHook('post_local',           'addon/tumblr/tumblr.php', 'tumblr_post_local');
index 5a48869..357180c 100644 (file)
@@ -3,16 +3,28 @@ Twitter Addon
 
 Main authors Tobias Diekershoff, Michael Vogel and Hypolite Petovan.
 
-This bi-directional connector addon allows each user to crosspost their Friendica public posts to Twitter, import their
-Twitter timeline, interact with tweets from Friendica, and crosspost to Friendica their public tweets.
+This bi-directional connector addon allows each user to crosspost their Friendica public posts to Twitter, import their Twitter timeline, interact with tweets from Friendica, and crosspost to Friendica their public tweets.
 
 ## Installation
 
 To use this addon you have to register an [application](https://apps.twitter.com/) for your Friendica instance on Twitter.
+Register your Friendica site as "Client" application with "Read & Write" access we do not need "Twitter as login".
 Please leave the field "Callback URL" empty.
+When you've registered the app you get the OAuth Consumer key and secret pair for your application/site.
 
 After the registration please enter the values for "Consumer Key" and "Consumer Secret" in the [administration](admin/addons/twitter).
 
+## Alternative configuration
+
+Add your key pair to your global config/addon.ini.php.
+
+    [twitter]
+    consumerkey = your consumer_key here
+    consumersecret = your consumer_secret here
+
+To activate the addon itself add it to the [system] addon setting.
+After this, users can configure their Twitter account settings from "Settings -> Addon Settings".
+
 ## License
 
 The _Twitter Connector_ is licensed under the [3-clause BSD license][2] see the LICENSE file in the addons directory.
diff --git a/twitter/config/twitter.ini.php b/twitter/config/twitter.ini.php
new file mode 100644 (file)
index 0000000..5359fd6
--- /dev/null
@@ -0,0 +1,16 @@
+<?php return <<<INI
+
+; Warning: Don't change this file! It only holds the default config values for this addon.
+; Instead overwrite these config values in config/addon.ini.php in your Friendica directory
+
+[twitter]
+; consumerkey (String)
+; OAuth Consumer Key provided by Twitter on registering an app at https://twitter.com/apps
+consumerkey =
+
+; consumersecret (String)
+; OAuth Consumer Secret provided by Twitter on registering an app at https://twitter.com/apps
+consumersecret =
+
+INI;
+//Keep this line
\ No newline at end of file
index 96bd2bb..79c77ee 100644 (file)
  *     we do not need "Twitter as login". When you've registered the app you get the
  *     OAuth Consumer key and secret pair for your application/site.
  *
- *     Add this key pair to your global .htconfig.php or use the admin panel.
+ *     Add this key pair to your global config/addon.ini.php or use the admin panel.
  *
- *     $a->config['twitter']['consumerkey'] = 'your consumer_key here';
- *     $a->config['twitter']['consumersecret'] = 'your consumer_secret here';
+ *     [twitter]
+ *     consumerkey = your consumer_key here
+ *     consumersecret = your consumer_secret here
  *
- *     To activate the addon itself add it to the $a->config['system']['addon']
+ *     To activate the addon itself add it to the [system] addon
  *     setting. After this, your user can configure their Twitter account settings
  *     from "Settings -> Addon Settings".
  *
@@ -70,8 +71,10 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
-use Friendica\Model\GContact;
+use Friendica\Database\dba;
+use Friendica\Database\DBM;
 use Friendica\Model\Contact;
+use Friendica\Model\GContact;
 use Friendica\Model\Group;
 use Friendica\Model\Item;
 use Friendica\Model\ItemContent;
@@ -80,7 +83,6 @@ use Friendica\Model\User;
 use Friendica\Object\Image;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
-use Friendica\Database\DBM;
 
 require_once 'boot.php';
 require_once 'include/dba.php';
@@ -94,6 +96,7 @@ define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes
 function twitter_install()
 {
        //  we need some hooks, for the configuration and for sending tweets
+       Addon::registerHook('load_config', 'addon/twitter/twitter.php', 'twitter_load_config');
        Addon::registerHook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
        Addon::registerHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
        Addon::registerHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
@@ -110,6 +113,7 @@ function twitter_install()
 
 function twitter_uninstall()
 {
+       Addon::unregisterHook('load_config', 'addon/twitter/twitter.php', 'twitter_load_config');
        Addon::unregisterHook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings');
        Addon::unregisterHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
        Addon::unregisterHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
@@ -128,6 +132,11 @@ function twitter_uninstall()
        Addon::unregisterHook('addon_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
 }
 
+function twitter_load_config(App $a)
+{
+       $a->loadConfigFile(__DIR__. '/config/twitter.ini.php');
+}
+
 function twitter_check_item_notification(App $a, &$notification_data)
 {
        $own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id');
index 7ff3dbb..60924ac 100644 (file)
@@ -4,7 +4,7 @@ use Friendica\Core\Config;
 
 function twitter_sync_run($argv, $argc)
 {
-       global $a;
+       $a = Friendica\BaseObject::getApp();
 
        require_once 'addon/twitter/twitter.php';
 
index dd461ea..725e898 100644 (file)
@@ -32,8 +32,9 @@ use Friendica\Content\Text\HTML;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
-use Friendica\Model\User;
+use Friendica\Database\dba;
 use Friendica\Model\Item;
+use Friendica\Model\User;
 
 function windowsphonepush_install()
 {
index a2c1129..caa355e 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Content\Text\HTML;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Database\dba;
 use Friendica\Util\Network;
 
 function wppost_install() {