Merge pull request #633 from MrPetovan/task/4889-move-config-to-config

Move configuration to config/
pull/648/head
Michael Vogel 2018-07-18 11:04:38 +02:00 committed by GitHub
commit 3940618a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 607 additions and 223 deletions

View 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') {

15
geonames/README.md Normal file
View File

@ -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.

View File

@ -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

View 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
*
* $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.
*
*/

View 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"

View File

@ -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

View 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);
}

View 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.

View File

@ -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

View 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');

View 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.

View File

@ -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

View File

@ -26,29 +26,30 @@
* 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'])) {

View 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"

View File

@ -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

View 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);
}

View 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
=====

View File

@ -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

View 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']))

View 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';

View 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) : '');

View 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.

View File

@ -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

View 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";

View 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

View File

@ -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

View File

@ -16,13 +16,14 @@
*
* 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.

View 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.

View File

@ -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

View File

@ -14,6 +14,7 @@ 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 +23,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 +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]");
}
}

View 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.

View File

@ -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

View File

@ -32,6 +32,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 +45,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 +103,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 +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'])) {

View 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");

View 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;
}

View 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.
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.

View File

@ -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

View 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());
}
}

View 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.

View File

@ -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

View File

@ -48,12 +48,13 @@
* 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".
*
@ -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');

View 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';