Move configuration to config/ #633
|
@ -4,6 +4,7 @@
|
||||||
* Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
|
* Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
|
||||||
* Version: 1.0
|
* Version: 1.0
|
||||||
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
||||||
|
* Status: Unsupported
|
||||||
*/
|
*/
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
15
geonames/README.md
Normal file
15
geonames/README.md
Normal 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.
|
12
geonames/config/geonames.ini.php
Normal file
12
geonames/config/geonames.ini.php
Normal 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
|
|
@ -7,9 +7,11 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Pre-requisite: Register a username at geonames.org
|
* Pre-requisite: Register a username at geonames.org
|
||||||
* and set in .htconfig.php
|
* and set in config/addon.ini.php
|
||||||
|
*
|
||||||
|
* [geonames]
|
||||||
|
* username = your_username
|
||||||
*
|
*
|
||||||
* $a->config['geonames']['username'] = 'your_username';
|
|
||||||
* Also visit http://geonames.org/manageaccount and enable access to the free web services
|
* Also visit http://geonames.org/manageaccount and enable access to the free web services
|
||||||
*
|
*
|
||||||
* When addon is installed, the system calls the addon
|
* When addon is installed, the system calls the addon
|
||||||
|
@ -28,6 +30,8 @@ use Friendica\Util\XML;
|
||||||
|
|
||||||
function geonames_install() {
|
function geonames_install() {
|
||||||
|
|
||||||
|
Addon::registerHook('load_config', 'addon/geonames/geonames.php', 'geonames_load_config');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Our addon will attach in three places.
|
* Our addon will attach in three places.
|
||||||
|
@ -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('post_local', 'addon/geonames/geonames.php', 'geonames_post_hook');
|
||||||
Addon::unregisterHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin');
|
Addon::unregisterHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin');
|
||||||
Addon::unregisterHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
|
Addon::unregisterHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post');
|
||||||
|
@ -70,7 +75,10 @@ function geonames_uninstall() {
|
||||||
logger("removed geonames");
|
logger("removed geonames");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function geonames_load_config(\Friendica\App $a)
|
||||||
|
{
|
||||||
|
$a->loadConfigFile(__DIR__. '/config/geonames.ini.php');
|
||||||
|
}
|
||||||
|
|
||||||
function geonames_post_hook($a, &$item) {
|
function geonames_post_hook($a, &$item) {
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,15 @@ Gravatar lets users self-rate their images to be used at appropriate audiences.
|
||||||
See more information at [Gravatar][1].
|
See more information at [Gravatar][1].
|
||||||
|
|
||||||
## Alternative Configuration
|
## 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";
|
[gravatar]
|
||||||
$a->config['gravatar']['rating'] = "g";
|
default_avatar = identicon
|
||||||
|
rating = g
|
||||||
|
|
||||||
[1]: http://www.gravatar.com/site/implement/images/ "See documentation at Gravatar for more information"
|
[1]: http://www.gravatar.com/site/implement/images/ "See documentation at Gravatar for more information"
|
||||||
|
|
28
gravatar/config/gravatar.ini.php
Normal file
28
gravatar/config/gravatar.ini.php
Normal 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
|
|
@ -13,6 +13,7 @@ use Friendica\Core\L10n;
|
||||||
* Installs the addon hook
|
* Installs the addon hook
|
||||||
*/
|
*/
|
||||||
function gravatar_install() {
|
function gravatar_install() {
|
||||||
|
Addon::registerHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config');
|
||||||
Addon::registerHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
|
Addon::registerHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
|
||||||
|
|
||||||
logger("registered gravatar in avatar_lookup hook");
|
logger("registered gravatar in avatar_lookup hook");
|
||||||
|
@ -22,11 +23,17 @@ function gravatar_install() {
|
||||||
* Removes the addon hook
|
* Removes the addon hook
|
||||||
*/
|
*/
|
||||||
function gravatar_uninstall() {
|
function gravatar_uninstall() {
|
||||||
|
Addon::unregisterHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config');
|
||||||
Addon::unregisterHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
|
Addon::unregisterHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup');
|
||||||
|
|
||||||
logger("unregistered gravatar in avatar_lookup hook");
|
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.
|
* Looks up the avatar at gravatar.com and returns the URL.
|
||||||
*
|
*
|
||||||
|
@ -34,7 +41,7 @@ function gravatar_uninstall() {
|
||||||
* @param &$b array
|
* @param &$b array
|
||||||
*/
|
*/
|
||||||
function gravatar_lookup($a, &$b) {
|
function gravatar_lookup($a, &$b) {
|
||||||
$default_avatar = Config::get('gravatar', 'default_img');
|
$default_avatar = Config::get('gravatar', 'default_avatar');
|
||||||
$rating = Config::get('gravatar', 'rating');
|
$rating = Config::get('gravatar', 'rating');
|
||||||
|
|
||||||
// setting default value if nothing configured
|
// setting default value if nothing configured
|
||||||
|
@ -60,7 +67,7 @@ function gravatar_lookup($a, &$b) {
|
||||||
function gravatar_addon_admin (&$a, &$o) {
|
function gravatar_addon_admin (&$a, &$o) {
|
||||||
$t = get_markup_template( "admin.tpl", "addon/gravatar/" );
|
$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');
|
$rating = Config::get('gravatar', 'rating');
|
||||||
|
|
||||||
// set default values for first configuration
|
// 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');
|
$default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
|
||||||
$rating = ((x($_POST, 'rating')) ? notags(trim($_POST['rating'])) : 'g');
|
$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);
|
Config::set('gravatar', 'rating', $rating);
|
||||||
info(L10n::t('Gravatar settings updated.') .EOL);
|
info(L10n::t('Gravatar settings updated.') .EOL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,37 +2,27 @@ Impressum Addon for Friendica
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
* Author: Tobias Diekershoff
|
* Author: Tobias Diekershoff
|
||||||
* License: [3-clause BSD](http://opensource.org/licenses/BSD-3-Clause) license
|
* License: [3-clause BSD](http://opensource.org/licenses/BSD-3-Clause) license (see the LICENSE file in the addon directory)
|
||||||
(see the LICENSE file in the addon directory)
|
|
||||||
|
|
||||||
About
|
About
|
||||||
-----
|
-----
|
||||||
This addon adds an Impressum (contact) block to the /friendica page with
|
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.
|
||||||
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
|
In the notes and postal fields you can use bbcode tags for formatting, like in normal friendica postings..
|
||||||
normal friendica postings..
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
Simply fill in the fields in the impressium settings page in the addons
|
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.
|
||||||
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
|
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
|
[impressum]
|
||||||
$a->config['impressum']['ownerprofile'] this is an optional Friendica account
|
owner = this is the Name of the Operator
|
||||||
where the above owner name will link to
|
ownerprofile = this is an optional Friendica account where the above owner name will link to
|
||||||
$a->config['impressum']['email'] a contact email address (optional)
|
email = a contact email address (optional)
|
||||||
will be displayed slightly obfuscated
|
will be displayed slightly obfuscated as name(at)example(dot)com
|
||||||
as name(at)example(dot)com
|
postal = should contain a postal address where you can be reached at (optional)
|
||||||
$a->config['impressum']['postal'] should contain a postal address where
|
notes = additional informations that should be displayed in the Impressum block
|
||||||
you can be reached at (optional)
|
footer_text = Text that will be displayed at the bottom of the pages.
|
||||||
$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.
|
|
||||||
|
|
33
impressum/config/impressum.ini.php
Normal file
33
impressum/config/impressum.ini.php
Normal 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
|
|
@ -15,12 +15,14 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
|
||||||
function impressum_install() {
|
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('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
|
||||||
Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
|
Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
|
||||||
logger("installed impressum Addon");
|
logger("installed impressum Addon");
|
||||||
}
|
}
|
||||||
|
|
||||||
function impressum_uninstall() {
|
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('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
|
||||||
Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
|
Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
|
||||||
logger("uninstalled impressum Addon");
|
logger("uninstalled impressum Addon");
|
||||||
|
@ -46,6 +48,12 @@ function impressum_footer($a, &$b) {
|
||||||
$b .= '<div id="impressum_footer">'.$text.'</div>';
|
$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) {
|
function impressum_show($a,&$b) {
|
||||||
$b .= '<h3>'.L10n::t('Impressum').'</h3>';
|
$b .= '<h3>'.L10n::t('Impressum').'</h3>';
|
||||||
$owner = Config::get('impressum', 'owner');
|
$owner = Config::get('impressum', 'owner');
|
||||||
|
|
|
@ -10,28 +10,29 @@ However, it's possible with an option to automate the creation of a Friendica ba
|
||||||
Note when using with Windows Active Directory: you may need to set TLS_CACERT in your site
|
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.:
|
e.g.:
|
||||||
|
|
||||||
// ldap hostname server - required
|
[ldapauth]
|
||||||
$a->config['ldapauth']['ldap_server'] = 'host.example.com';
|
// ldap hostname server - required
|
||||||
// dn to search users - required
|
ldap_server = host.example.com
|
||||||
$a->config['ldapauth']['ldap_searchdn'] = 'ou=users,dc=example,dc=com';
|
// dn to search users - required
|
||||||
// attribute to find username - required
|
ldap_searchdn = ou=users,dc=example,dc=com
|
||||||
$a->config['ldapauth']['ldap_userattr'] = 'uid';
|
// attribute to find username - required
|
||||||
|
ldap_userattr = uid
|
||||||
|
|
||||||
// admin dn - optional - only if ldap server dont have anonymous access
|
// admin dn - optional - only if ldap server dont have anonymous access
|
||||||
$a->config['ldapauth']['ldap_binddn'] = 'cn=admin,dc=example,dc=com';
|
ldap_binddn = cn=admin,dc=example,dc=com
|
||||||
// admin password - optional - only if ldap server dont have anonymous access
|
// admin password - optional - only if ldap server dont have anonymous access
|
||||||
$a->config['ldapauth']['ldap_bindpw'] = 'password';
|
ldap_bindpw = password
|
||||||
|
|
||||||
// for create Friendica account if user exist in ldap
|
// for create Friendica account if user exist in ldap
|
||||||
// required an email and a simple (beautiful) nickname on user ldap object
|
// required an email and a simple (beautiful) nickname on user ldap object
|
||||||
// active account creation - optional - default none
|
// active account creation - optional - default none
|
||||||
$a->config['ldapauth']['ldap_autocreateaccount'] = 'true';
|
ldap_autocreateaccount = true
|
||||||
// attribute to get email - optional - default : 'mail'
|
// attribute to get email - optional - default : 'mail'
|
||||||
$a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail';
|
ldap_autocreateaccount_emailattribute = mail
|
||||||
// attribute to get nickname - optional - default : 'givenName'
|
// attribute to get nickname - optional - default : 'givenName'
|
||||||
$a->config['ldapauth']['ldap_autocreateaccount_nameattribute'] = 'givenName';
|
ldap_autocreateaccount_nameattribute = givenName
|
||||||
|
|
||||||
...etc.
|
...etc.
|
||||||
|
|
50
ldapauth/config/ldapauth.ini.php
Normal file
50
ldapauth/config/ldapauth.ini.php
Normal 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
|
|
@ -26,29 +26,30 @@
|
||||||
* Note when using with Windows Active Directory: you may need to set TLS_CACERT in your site
|
* 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.:
|
* e.g.:
|
||||||
*
|
*
|
||||||
* // ldap hostname server - required
|
* [ldapauth]
|
||||||
* $a->config['ldapauth']['ldap_server'] = 'host.example.com';
|
* ; ldap hostname server - required
|
||||||
* // dn to search users - required
|
* ldap_server = host.example.com
|
||||||
* $a->config['ldapauth']['ldap_searchdn'] = 'ou=users,dc=example,dc=com';
|
* ; dn to search users - required
|
||||||
* // attribute to find username - required
|
* ldap_searchdn = ou=users,dc=example,dc=com
|
||||||
* $a->config['ldapauth']['ldap_userattr'] = 'uid';
|
* ; attribute to find username - required
|
||||||
|
* ldap_userattr = uid
|
||||||
*
|
*
|
||||||
* // admin dn - optional - only if ldap server dont have anonymous access
|
* ; admin dn - optional - only if ldap server dont have anonymous access
|
||||||
* $a->config['ldapauth']['ldap_binddn'] = 'cn=admin,dc=example,dc=com';
|
* ldap_binddn = cn=admin,dc=example,dc=com
|
||||||
* // admin password - optional - only if ldap server dont have anonymous access
|
* ; admin password - optional - only if ldap server dont have anonymous access
|
||||||
* $a->config['ldapauth']['ldap_bindpw'] = 'password';
|
* ldap_bindpw = password
|
||||||
*
|
*
|
||||||
* // for create Friendica account if user exist in ldap
|
* ; for create Friendica account if user exist in ldap
|
||||||
* // required an email and a simple (beautiful) nickname on user ldap object
|
* ; required an email and a simple (beautiful) nickname on user ldap object
|
||||||
* // active account creation - optional - default none
|
* ; active account creation - optional - default none
|
||||||
* $a->config['ldapauth']['ldap_autocreateaccount'] = 'true';
|
* ldap_autocreateaccount = true
|
||||||
* // attribute to get email - optional - default : 'mail'
|
* ; attribute to get email - optional - default : 'mail'
|
||||||
* $a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail';
|
* ldap_autocreateaccount_emailattribute = mail
|
||||||
* // attribute to get nickname - optional - default : 'givenName'
|
* ; attribute to get nickname - optional - default : 'givenName'
|
||||||
* $a->config['ldapauth']['ldap_autocreateaccount_nameattribute'] = 'cn';
|
* ldap_autocreateaccount_nameattribute = cn
|
||||||
*
|
*
|
||||||
* ...etc.
|
* ...etc.
|
||||||
*/
|
*/
|
||||||
|
@ -58,14 +59,21 @@ use Friendica\Model\User;
|
||||||
|
|
||||||
function ldapauth_install()
|
function ldapauth_install()
|
||||||
{
|
{
|
||||||
|
Addon::registerHook('load_config', 'addon/ldapauth/ldapauth.php', 'ldapauth_load_config');
|
||||||
Addon::registerHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
|
Addon::registerHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
|
||||||
}
|
}
|
||||||
|
|
||||||
function ldapauth_uninstall()
|
function ldapauth_uninstall()
|
||||||
{
|
{
|
||||||
|
Addon::unregisterHook('load_config', 'addon/ldapauth/ldapauth.php', 'ldapauth_load_config');
|
||||||
Addon::unregisterHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
|
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)
|
function ldapauth_hook_authenticate($a, &$b)
|
||||||
{
|
{
|
||||||
if (ldapauth_authenticate($b['username'], $b['password'])) {
|
if (ldapauth_authenticate($b['username'], $b['password'])) {
|
||||||
|
|
|
@ -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.
|
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.)
|
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.
|
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].
|
See examples at [Libravatar][1].
|
||||||
|
|
||||||
## Alternative Configuration
|
## 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"
|
[1]: http://wiki.libravatar.org/api/ "See API documentation at Libravatar for more information"
|
||||||
|
|
18
libravatar/config/libravatar.ini.php
Normal file
18
libravatar/config/libravatar.ini.php
Normal 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
|
|
@ -14,12 +14,7 @@ use Friendica\Core\L10n;
|
||||||
*/
|
*/
|
||||||
function libravatar_install()
|
function libravatar_install()
|
||||||
{
|
{
|
||||||
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
Addon::registerHook('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config');
|
||||||
info(L10n::t('Could NOT install Libravatar successfully.<br>It requires PHP >= 5.3') .EOL);
|
|
||||||
// avoid registering the hook
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
|
Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
|
||||||
logger("registered libravatar in avatar_lookup hook");
|
logger("registered libravatar in avatar_lookup hook");
|
||||||
}
|
}
|
||||||
|
@ -29,10 +24,16 @@ function libravatar_install()
|
||||||
*/
|
*/
|
||||||
function libravatar_uninstall()
|
function libravatar_uninstall()
|
||||||
{
|
{
|
||||||
|
Addon::unregisterHook('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config');
|
||||||
Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
|
Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup');
|
||||||
logger("unregistered libravatar in avatar_lookup hook");
|
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.
|
* Looks up the avatar at Libravatar and returns the URL.
|
||||||
*
|
*
|
||||||
|
@ -41,11 +42,11 @@ function libravatar_uninstall()
|
||||||
*/
|
*/
|
||||||
function libravatar_lookup($a, &$b)
|
function libravatar_lookup($a, &$b)
|
||||||
{
|
{
|
||||||
$default_avatar = Config::get('libravatar', 'default_img');
|
$default_avatar = Config::get('libravatar', 'default_avatar');
|
||||||
|
|
||||||
if (! $default_avatar) {
|
if (! $default_avatar) {
|
||||||
// if not set, look up if there was one from the gravatar addon
|
// 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
|
// setting default avatar if nothing configured
|
||||||
if (!$default_avatar) {
|
if (!$default_avatar) {
|
||||||
$default_avatar = 'identicon'; // default image will be a random pattern
|
$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");
|
$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
|
// set default values for first configuration
|
||||||
if (!$default_avatar) {
|
if (!$default_avatar) {
|
||||||
|
@ -117,6 +118,6 @@ function libravatar_addon_admin_post(&$a)
|
||||||
check_form_security_token('libravatarrsave');
|
check_form_security_token('libravatarrsave');
|
||||||
|
|
||||||
$default_avatar = ((x($_POST, 'avatar')) ? notags(trim($_POST['avatar'])) : 'identicon');
|
$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);
|
info(L10n::t('Libravatar settings updated.') .EOL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,21 +13,23 @@ This addon for friendica includes the [MathJax][1] CDN to enable rendering of
|
||||||
|
|
||||||
Configuration
|
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.
|
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
|
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
|
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
|
In case you don't want or can use the admin panel of Friendica you can activate
|
||||||
the addon by adding _mathjax_ to the
|
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
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
12
mathjax/config/mathjax.ini.php
Normal file
12
mathjax/config/mathjax.ini.php
Normal 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
|
|
@ -13,6 +13,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
|
|
||||||
function mathjax_install() {
|
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('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header');
|
||||||
Addon::registerHook('addon_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
|
Addon::registerHook('addon_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
|
||||||
Addon::registerHook('addon_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
|
Addon::registerHook('addon_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
|
||||||
|
@ -21,12 +22,18 @@ function mathjax_install() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mathjax_uninstall() {
|
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('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header');
|
||||||
Addon::unregisterHook('addon_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
|
Addon::unregisterHook('addon_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
|
||||||
Addon::unregisterHook('addon_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
|
Addon::unregisterHook('addon_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
|
||||||
Addon::unregisterHook('template_vars', 'addon/mathjax/mathjax.php', 'mathjax_template_vars');
|
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)
|
function mathjax_template_vars($a, &$arr)
|
||||||
{
|
{
|
||||||
if (!array_key_exists('addon_hooks',$arr['vars']))
|
if (!array_key_exists('addon_hooks',$arr['vars']))
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
* - who takes no responsibility for any additional content which may appear herein
|
* - who takes no responsibility for any additional content which may appear herein
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
|
use Friendica\Core\Config;
|
||||||
|
|
||||||
function morechoice_install() {
|
function morechoice_install() {
|
||||||
|
|
||||||
|
@ -31,7 +33,7 @@ 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) {
|
function morechoice_gender_selector($a,&$b) {
|
||||||
if($a->config['system']['language'] == 'en') {
|
if(Config::get('system', 'language') == 'en') {
|
||||||
$b[] = 'Androgyne';
|
$b[] = 'Androgyne';
|
||||||
$b[] = 'Bear';
|
$b[] = 'Bear';
|
||||||
$b[] = 'Bigender';
|
$b[] = 'Bigender';
|
||||||
|
@ -59,7 +61,7 @@ function morechoice_gender_selector($a,&$b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function morechoice_sexpref_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[] = 'Girls with big tits';
|
||||||
$b[] = 'Millionaires';
|
$b[] = 'Millionaires';
|
||||||
$b[] = 'Guys with big schlongs';
|
$b[] = 'Guys with big schlongs';
|
||||||
|
@ -114,7 +116,7 @@ function morechoice_sexpref_selector($a,&$b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function morechoice_marital_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[] = 'Married to my job';
|
||||||
$b[] = 'Polygamist';
|
$b[] = 'Polygamist';
|
||||||
$b[] = 'Half married';
|
$b[] = 'Half married';
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica)
|
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Friendica\App;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Util\Emailer;
|
use Friendica\Util\Emailer;
|
||||||
use Friendica\App;
|
|
||||||
|
|
||||||
function notifyall_install()
|
function notifyall_install()
|
||||||
{
|
{
|
||||||
|
@ -43,18 +44,18 @@ function notifyall_post(App $a)
|
||||||
return;
|
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) . '"';
|
$sender_name = '"' . L10n::t('%s Administrator', $sitename) . '"';
|
||||||
} else {
|
} 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();
|
$sender_email = 'noreply@' . $a->get_hostname();
|
||||||
} else {
|
} else {
|
||||||
$sender_email = $a->config['sender_email'];
|
$sender_email = Config::get('config', 'sender_email');
|
||||||
}
|
}
|
||||||
|
|
||||||
$subject = $_REQUEST['subject'];
|
$subject = $_REQUEST['subject'];
|
||||||
|
@ -67,7 +68,7 @@ function notifyall_post(App $a)
|
||||||
// if this is a test, send it only to the admin(s)
|
// 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
|
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f
|
||||||
if (intval($_REQUEST['test'])) {
|
if (intval($_REQUEST['test'])) {
|
||||||
$email = $a->config['admin_email'];
|
$email = Config::get('config', 'admin_email');
|
||||||
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
|
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
|
||||||
}
|
}
|
||||||
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
|
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
|
||||||
|
|
|
@ -32,15 +32,17 @@ zoom level available.
|
||||||
|
|
||||||
___ Alternative Configuration ___
|
___ 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.
|
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/';
|
[openstreetmap]
|
||||||
$a->config['openstreetmap']['zoom'] = '18';
|
tmsserver = https://www.openstreetmap.org
|
||||||
|
zoom = 18
|
||||||
|
|
||||||
The *tmsserver* points to the tile server you want to use. Use the full URL,
|
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
|
with protocol (http/s) and trailing slash. You can configure the default zoom
|
||||||
|
|
23
openstreetmap/config/openstreetmap.ini.php
Normal file
23
openstreetmap/config/openstreetmap.ini.php
Normal 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
|
|
@ -15,13 +15,14 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
const OSM_TMS = 'http://www.openstreetmap.org';
|
const OSM_TMS = 'https://www.openstreetmap.org';
|
||||||
const OSM_NOM = 'http://nominatim.openstreetmap.org/search.php';
|
const OSM_NOM = 'https://nominatim.openstreetmap.org/search.php';
|
||||||
const OSM_ZOOM = 16;
|
const OSM_ZOOM = 16;
|
||||||
const OSM_MARKER = 0;
|
const OSM_MARKER = 0;
|
||||||
|
|
||||||
function openstreetmap_install()
|
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('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
|
||||||
Addon::registerHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
|
Addon::registerHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
|
||||||
Addon::registerHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
|
Addon::registerHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
|
||||||
|
@ -33,6 +34,7 @@ function openstreetmap_install()
|
||||||
|
|
||||||
function openstreetmap_uninstall()
|
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('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location');
|
||||||
Addon::unregisterHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
|
Addon::unregisterHook('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map');
|
||||||
Addon::unregisterHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
|
Addon::unregisterHook('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map');
|
||||||
|
@ -42,6 +44,11 @@ function openstreetmap_uninstall()
|
||||||
logger("removed openstreetmap");
|
logger("removed openstreetmap");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openstreetmap_load_config(\Friendica\App $a)
|
||||||
|
{
|
||||||
|
$a->loadConfigFile(__DIR__. '/config/openstreetmap.ini.php');
|
||||||
|
}
|
||||||
|
|
||||||
function openstreetmap_alterheader($a, &$navHtml)
|
function openstreetmap_alterheader($a, &$navHtml)
|
||||||
{
|
{
|
||||||
$addScriptTag = '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
|
$addScriptTag = '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
|
||||||
|
|
|
@ -3,8 +3,7 @@ Piwik Addon
|
||||||
|
|
||||||
by Tobias Diekershoff and Klaus Weidenbach
|
by Tobias Diekershoff and Klaus Weidenbach
|
||||||
|
|
||||||
This addon allows you to embed the code necessary for the FLOSS webanalytics
|
This addon allows you to embed the code necessary for the FLOSS webanalytics tool Piwik into the Friendica pages.
|
||||||
tool Piwik into the Friendica pages.
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
@ -14,55 +13,44 @@ To use this addon you need a [piwik](http://piwik.org/) installation.
|
||||||
Where to find
|
Where to find
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
In the Friendica addon git repository `/piwik/piwik.php` and a CSS file for
|
In the Friendica addon git repository `/piwik/piwik.php` and a CSS file for styling the opt-out notice.
|
||||||
styling the opt-out notice.
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
The easiest way to configure this addon is by activating the admin panels of
|
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.
|
||||||
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
|
If you don't want to use the admin panel, you can configure the addon through the config/local.ini.php file.
|
||||||
the .htconfig 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/';
|
[piwik]
|
||||||
$a->config['piwik']['sideid'] = '1';
|
baseurl = example.com/piwik/
|
||||||
$a->config['piwik']['optout'] = true;
|
sideid = 1
|
||||||
$a->config['piwik']['async'] = false;
|
optout = true
|
||||||
|
async = false
|
||||||
|
|
||||||
Configuration fields
|
Configuration fields
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
* The *baseurl* points to your Piwik installation. Use the absolute path,
|
* The *baseurl* points to your Piwik installation. Use the absolute path, remember trailing slashes but ignore the protocol (http/s) part of the URL.
|
||||||
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.
|
||||||
* Change the *sideid* parameter to whatever ID you want to use for tracking your
|
* 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
|
||||||
Friendica installation.
|
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 *optout* parameter (true|false) defines whether or
|
* The *async* parameter (true|false) defines whether or not to use asynchronous tracking so pages load (or appear to load) faster.
|
||||||
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:
|
Currently the optional notice states the following:
|
||||||
|
|
||||||
> This website is tracked using the Piwik analytics tool. If you do not want
|
> 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).
|
||||||
> 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
|
License
|
||||||
=======
|
=======
|
||||||
|
|
||||||
The _Piwik addon_ is licensed under the [3-clause BSD license][3] see the
|
The _Piwik addon_ is licensed under the [3-clause BSD license][3] see the LICENSE file in the addons directory.
|
||||||
LICENSE file in the addons directory.
|
|
||||||
|
|
||||||
[3]: http://opensource.org/licenses/BSD-3-Clause
|
[3]: http://opensource.org/licenses/BSD-3-Clause
|
||||||
|
|
29
piwik/config/piwik.ini.php
Normal file
29
piwik/config/piwik.ini.php
Normal 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
|
|
@ -16,13 +16,14 @@
|
||||||
*
|
*
|
||||||
* Configuration:
|
* Configuration:
|
||||||
* Use the administration panel to configure the Piwik tracking addon, or
|
* 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:
|
* file:
|
||||||
*
|
*
|
||||||
* $a->config['piwik']['baseurl'] = 'www.example.com/piwik/';
|
* [piwik]
|
||||||
* $a->config['piwik']['siteid'] = '1';
|
* baseurl = example.com/piwik/
|
||||||
* $a->config['piwik']['optout'] = true; // set to false to disable
|
* sideid = 1
|
||||||
* $a->config['piwik']['async'] = false; // set to true to enable
|
* 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
|
* 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
|
* installation has. Alter the baseurl to fit your needs, don't care
|
||||||
|
@ -34,17 +35,24 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
|
||||||
function piwik_install() {
|
function piwik_install() {
|
||||||
|
Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
|
||||||
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
||||||
|
|
||||||
logger("installed piwik addon");
|
logger("installed piwik addon");
|
||||||
}
|
}
|
||||||
|
|
||||||
function piwik_uninstall() {
|
function piwik_uninstall() {
|
||||||
|
Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
|
||||||
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
|
||||||
|
|
||||||
logger("uninstalled piwik addon");
|
logger("uninstalled piwik addon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function piwik_load_config(\Friendica\App $a)
|
||||||
|
{
|
||||||
|
$a->loadConfigFile(__DIR__. '/config/piwik.ini.php');
|
||||||
|
}
|
||||||
|
|
||||||
function piwik_analytics($a,&$b) {
|
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" />';
|
$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');
|
$baseurl = Config::get('piwik', 'baseurl');
|
||||||
$siteid = Config::get('piwik','siteid');
|
$siteid = Config::get('piwik', 'siteid');
|
||||||
$optout = Config::get('piwik','optout');
|
$optout = Config::get('piwik', 'optout');
|
||||||
$async = Config::get('piwik','async');
|
$async = Config::get('piwik', 'async');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add the Piwik tracking code for the site.
|
* Add the Piwik tracking code for the site.
|
||||||
|
|
|
@ -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
|
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.
|
||||||
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.
|
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
|
[public_server]
|
||||||
$a->config['public_server']['expiredays'] = 30;
|
; When an account is created on the site, it is given a hard expiration date of
|
||||||
//Set the default days for posts to expire here
|
expiredays = 30
|
||||||
$a->config['public_server']['expireposts'] = 30;
|
; Set the default days for posts to expire here
|
||||||
//Remove users who have never logged in after nologin days
|
expireposts = 30
|
||||||
$a->config['public_server']['nologin'] = 30;
|
; Remove users who have never logged in after nologin days
|
||||||
//Remove users who last logged in over flagusers days ago
|
nologin = 30
|
||||||
$a->config['public_server']['flagusers'] = 146;
|
; Remove users who last logged in over flagusers days ago
|
||||||
//For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
|
flagusers = 146
|
||||||
$a->config['public_server']['flagposts'] = 90;
|
; For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire
|
||||||
$a->config['public_server']['flagpostsexpire'] = 146;
|
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.
|
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 default values are those used by friendica.eu, change these as desired.
|
||||||
|
|
||||||
The expiration date is updated when the user logs in.
|
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.
|
||||||
|
|
30
public_server/config/public_server.ini.php
Normal file
30
public_server/config/public_server.ini.php
Normal 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
|
|
@ -14,6 +14,7 @@ use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
function public_server_install()
|
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('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('cron', 'addon/public_server/public_server.php', 'public_server_cron');
|
||||||
Addon::registerHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
|
Addon::registerHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
|
||||||
|
@ -22,12 +23,18 @@ function public_server_install()
|
||||||
|
|
||||||
function public_server_uninstall()
|
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('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('cron', 'addon/public_server/public_server.php', 'public_server_cron');
|
||||||
Addon::unregisterHook('enotify', 'addon/public_server/public_server.php', 'public_server_enotify');
|
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');
|
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)
|
function public_server_register_account($a, $b)
|
||||||
{
|
{
|
||||||
$uid = $b;
|
$uid = $b;
|
||||||
|
@ -117,7 +124,7 @@ function public_server_enotify(&$a, &$b)
|
||||||
$b['itemlink'] = $a->get_baseurl();
|
$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['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['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]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
21
pumpio/config/pumpio.ini.php
Normal file
21
pumpio/config/pumpio.ini.php
Normal 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
|
|
@ -32,6 +32,7 @@ define('PUMPIO_DEFAULT_POLL_INTERVAL', 5); // given in minutes
|
||||||
|
|
||||||
function pumpio_install()
|
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('post_local', 'addon/pumpio/pumpio.php', 'pumpio_post_local');
|
||||||
Addon::registerHook('notifier_normal', 'addon/pumpio/pumpio.php', 'pumpio_send');
|
Addon::registerHook('notifier_normal', 'addon/pumpio/pumpio.php', 'pumpio_send');
|
||||||
Addon::registerHook('jot_networks', 'addon/pumpio/pumpio.php', 'pumpio_jot_nets');
|
Addon::registerHook('jot_networks', 'addon/pumpio/pumpio.php', 'pumpio_jot_nets');
|
||||||
|
@ -44,6 +45,7 @@ function pumpio_install()
|
||||||
|
|
||||||
function pumpio_uninstall()
|
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('post_local', 'addon/pumpio/pumpio.php', 'pumpio_post_local');
|
||||||
Addon::unregisterHook('notifier_normal', 'addon/pumpio/pumpio.php', 'pumpio_send');
|
Addon::unregisterHook('notifier_normal', 'addon/pumpio/pumpio.php', 'pumpio_send');
|
||||||
Addon::unregisterHook('jot_networks', 'addon/pumpio/pumpio.php', 'pumpio_jot_nets');
|
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();
|
$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["type"] = "client_associate";
|
||||||
$params["contacts"] = $adminlist[0];
|
$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)
|
function pumpio_post_local(&$a, &$b)
|
||||||
{
|
{
|
||||||
if (!local_user() || (local_user() != $b['uid'])) {
|
if (!local_user() || (local_user() != $b['uid'])) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
|
||||||
function pumpio_sync_run(&$argv, &$argc) {
|
function pumpio_sync_run(&$argv, &$argc) {
|
||||||
global $a;
|
$a = Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
require_once("addon/pumpio/pumpio.php");
|
require_once("addon/pumpio/pumpio.php");
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Util\Emailer;
|
use Friendica\Util\Emailer;
|
||||||
|
@ -94,14 +95,14 @@ function securemail_settings_post(App &$a, array &$b){
|
||||||
info(L10n::t('Secure Mail Settings saved.') . EOL);
|
info(L10n::t('Secure Mail Settings saved.') . EOL);
|
||||||
|
|
||||||
if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
|
if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
|
||||||
$sitename = $a->config['sitename'];
|
$sitename = Config::get('config', 'sitename');
|
||||||
|
|
||||||
$hostname = $a->get_hostname();
|
$hostname = $a->get_hostname();
|
||||||
if (strpos($hostname, ':')) {
|
if (strpos($hostname, ':')) {
|
||||||
$hostname = substr($hostname, 0, 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)) {
|
if (empty($sender_email)) {
|
||||||
$sender_email = 'noreply@' . $hostname;
|
$sender_email = 'noreply@' . $hostname;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
Testdrive is a Friendica addon which implements automatic account expiration so that a site may be used as a public test bed.
|
||||||
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
|
There is no opportunity to extend an expired account using this addon.
|
||||||
in case the addon is activated accidentally.
|
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.
|
||||||
|
|
12
testdrive/config/testdrive.ini.php
Normal file
12
testdrive/config/testdrive.ini.php
Normal 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
|
|
@ -14,6 +14,7 @@ use Friendica\Util\DateTimeFormat;
|
||||||
|
|
||||||
function testdrive_install() {
|
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('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account');
|
||||||
Addon::registerHook('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron');
|
Addon::registerHook('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron');
|
||||||
Addon::registerHook('enotify','addon/testdrive/testdrive.php', 'testdrive_enotify');
|
Addon::registerHook('enotify','addon/testdrive/testdrive.php', 'testdrive_enotify');
|
||||||
|
@ -24,6 +25,7 @@ function testdrive_install() {
|
||||||
|
|
||||||
function testdrive_uninstall() {
|
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('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account');
|
||||||
Addon::unregisterHook('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron');
|
Addon::unregisterHook('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron');
|
||||||
Addon::unregisterHook('enotify','addon/testdrive/testdrive.php', 'testdrive_enotify');
|
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) {
|
function testdrive_globaldir_update($a,&$b) {
|
||||||
$b['url'] = '';
|
$b['url'] = '';
|
||||||
}
|
}
|
||||||
|
@ -93,6 +100,6 @@ function testdrive_enotify(&$a, &$b) {
|
||||||
$b['itemlink'] = $a->get_baseurl();
|
$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['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['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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,16 +3,28 @@ Twitter Addon
|
||||||
|
|
||||||
Main authors Tobias Diekershoff, Michael Vogel and Hypolite Petovan.
|
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
|
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.
|
||||||
Twitter timeline, interact with tweets from Friendica, and crosspost to Friendica their public tweets.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
To use this addon you have to register an [application](https://apps.twitter.com/) for your Friendica instance on Twitter.
|
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.
|
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).
|
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
|
## License
|
||||||
|
|
||||||
The _Twitter Connector_ is licensed under the [3-clause BSD license][2] see the LICENSE file in the addons directory.
|
The _Twitter Connector_ is licensed under the [3-clause BSD license][2] see the LICENSE file in the addons directory.
|
||||||
|
|
16
twitter/config/twitter.ini.php
Normal file
16
twitter/config/twitter.ini.php
Normal 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
|
|
@ -48,12 +48,13 @@
|
||||||
* we do not need "Twitter as login". When you've registered the app you get the
|
* 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.
|
* 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';
|
* [twitter]
|
||||||
* $a->config['twitter']['consumersecret'] = 'your consumer_secret here';
|
* 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
|
* setting. After this, your user can configure their Twitter account settings
|
||||||
* from "Settings -> Addon Settings".
|
* from "Settings -> Addon Settings".
|
||||||
*
|
*
|
||||||
|
@ -94,6 +95,7 @@ define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes
|
||||||
function twitter_install()
|
function twitter_install()
|
||||||
{
|
{
|
||||||
// we need some hooks, for the configuration and for sending tweets
|
// 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', 'addon/twitter/twitter.php', 'twitter_settings');
|
||||||
Addon::registerHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
Addon::registerHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
||||||
Addon::registerHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
|
Addon::registerHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
|
||||||
|
@ -110,6 +112,7 @@ function twitter_install()
|
||||||
|
|
||||||
function twitter_uninstall()
|
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', 'addon/twitter/twitter.php', 'twitter_settings');
|
||||||
Addon::unregisterHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
Addon::unregisterHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post');
|
||||||
Addon::unregisterHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local');
|
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');
|
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)
|
function twitter_check_item_notification(App $a, &$notification_data)
|
||||||
{
|
{
|
||||||
$own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id');
|
$own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id');
|
||||||
|
|
|
@ -4,7 +4,7 @@ use Friendica\Core\Config;
|
||||||
|
|
||||||
function twitter_sync_run($argv, $argc)
|
function twitter_sync_run($argv, $argc)
|
||||||
{
|
{
|
||||||
global $a;
|
$a = Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
require_once 'addon/twitter/twitter.php';
|
require_once 'addon/twitter/twitter.php';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue