diff --git a/fortunate/fortunate.php b/fortunate/fortunate.php index 8c15caa6..ebece489 100644 --- a/fortunate/fortunate.php +++ b/fortunate/fortunate.php @@ -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 + * 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'] .= '' . "\r\n"; if (FORTUNATE_SERVER != 'hostname.com') { diff --git a/geonames/README.md b/geonames/README.md new file mode 100644 index 00000000..ba90dc5d --- /dev/null +++ b/geonames/README.md @@ -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 index 00000000..280e7a93 --- /dev/null +++ b/geonames/config/geonames.ini.php @@ -0,0 +1,12 @@ + - * - * - * Pre-requisite: Register a username at geonames.org - * and set in .htconfig.php * - * $a->config['geonames']['username'] = 'your_username'; + * + * 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 * * 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. * */ diff --git a/gravatar/README.md b/gravatar/README.md index 0145570b..b8ca8244 100644 --- a/gravatar/README.md +++ b/gravatar/README.md @@ -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 index 00000000..a07005a3 --- /dev/null +++ b/gravatar/config/gravatar.ini.php @@ -0,0 +1,28 @@ +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); } diff --git a/impressum/README.md b/impressum/README.md index 963a085e..0d0aa51c 100644 --- a/impressum/README.md +++ b/impressum/README.md @@ -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 index 00000000..1de4468c --- /dev/null +++ b/impressum/config/impressum.ini.php @@ -0,0 +1,33 @@ +'.$text.''; } } + +function impressum_load_config(\Friendica\App $a) +{ + $a->loadConfigFile(__DIR__. '/config/impressum.ini.php'); +} + function impressum_show($a,&$b) { $b .= '

'.L10n::t('Impressum').'

'; $owner = Config::get('impressum', 'owner'); diff --git a/ldapauth/README b/ldapauth/README index ee09e94d..03e8b0d4 100644 --- a/ldapauth/README +++ b/ldapauth/README @@ -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 index 00000000..d707550b --- /dev/null +++ b/ldapauth/config/ldapauth.ini.php @@ -0,0 +1,50 @@ +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'])) { diff --git a/libravatar/README.md b/libravatar/README.md index d535aa07..ca595be2 100644 --- a/libravatar/README.md +++ b/libravatar/README.md @@ -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 index 00000000..e3631204 --- /dev/null +++ b/libravatar/config/libravatar.ini.php @@ -0,0 +1,18 @@ +=')) { - info(L10n::t('Could NOT install Libravatar successfully.
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); } diff --git a/mathjax/README.md b/mathjax/README.md index 9647a986..19407e86 100644 --- a/mathjax/README.md +++ b/mathjax/README.md @@ -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 index 00000000..261a7327 --- /dev/null +++ b/mathjax/config/mathjax.ini.php @@ -0,0 +1,12 @@ +loadConfigFile(__DIR__. '/config/mathjax.ini.php'); +} + function mathjax_template_vars($a, &$arr) { if (!array_key_exists('addon_hooks',$arr['vars'])) diff --git a/morechoice/morechoice.php b/morechoice/morechoice.php index b8a170a1..0d929430 100644 --- a/morechoice/morechoice.php +++ b/morechoice/morechoice.php @@ -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'; diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index c58d8c8e..408e74a3 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -8,53 +8,54 @@ * Author: 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 = '
    ' . L10n::t('Send email to all members') . '
'; } -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) : ''); diff --git a/openstreetmap/README b/openstreetmap/README index 93f231c6..48402e29 100644 --- a/openstreetmap/README +++ b/openstreetmap/README @@ -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 index 00000000..986843b4 --- /dev/null +++ b/openstreetmap/config/openstreetmap.ini.php @@ -0,0 +1,23 @@ +loadConfigFile(__DIR__. '/config/openstreetmap.ini.php'); +} + function openstreetmap_alterheader($a, &$navHtml) { $addScriptTag = '' . "\r\n"; diff --git a/piwik/README.md b/piwik/README.md index 37ece2f0..44d906b6 100644 --- a/piwik/README.md +++ b/piwik/README.md @@ -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 index 00000000..b66c69c6 --- /dev/null +++ b/piwik/config/piwik.ini.php @@ -0,0 +1,29 @@ +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'] .= ''; /* - * 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. diff --git a/public_server/README.md b/public_server/README.md index b1fb49df..7ba002e8 100644 --- a/public_server/README.md +++ b/public_server/README.md @@ -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 index 00000000..79b2ef46 --- /dev/null +++ b/public_server/config/public_server.ini.php @@ -0,0 +1,30 @@ +loadConfigFile(__DIR__. '/config/public_server.ini.php'); +} + function public_server_register_account($a, $b) { $uid = $b; @@ -117,7 +124,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]"); } } diff --git a/pumpio/README.md b/pumpio/README.md index 4dd90d5f..9fb01055 100644 --- a/pumpio/README.md +++ b/pumpio/README.md @@ -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 index 00000000..cd5e732c --- /dev/null +++ b/pumpio/config/pumpio.ini.php @@ -0,0 +1,21 @@ +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 +374,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'])) { diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php index 834bc1e6..a8fa7b3c 100644 --- a/pumpio/pumpio_sync.php +++ b/pumpio/pumpio_sync.php @@ -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"); diff --git a/securemail/securemail.php b/securemail/securemail.php index d63c2ee9..87941e79 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -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; } diff --git a/testdrive/README.md b/testdrive/README.md index edc63ed5..ad9414eb 100644 --- a/testdrive/README.md +++ b/testdrive/README.md @@ -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 index 00000000..8d3f8632 --- /dev/null +++ b/testdrive/config/testdrive.ini.php @@ -0,0 +1,12 @@ +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()); } } diff --git a/twitter/README.md b/twitter/README.md index 5a488690..357180cc 100644 --- a/twitter/README.md +++ b/twitter/README.md @@ -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 index 00000000..5359fd6d --- /dev/null +++ b/twitter/config/twitter.ini.php @@ -0,0 +1,16 @@ +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". * @@ -94,6 +95,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 +112,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 +131,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'); diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 7ff3dbb3..60924acd 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -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';