1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/addons/mailhost/mailhost.php

58 lines
1.6 KiB
PHP
Raw Normal View History

<?php
/**
* Name: mailhost
* Description: Select one server to send email notifications when you have multiple clones
* Version: 1.0
* Author: Mike Macgirvin <mike@zothub.com>
*
*/
function mailhost_install() {
register_hook('feature_settings', 'addon/mailhost/mailhost.php', 'mailhost_addon_settings');
register_hook('feature_settings_post', 'addon/mailhost/mailhost.php', 'mailhost_addon_settings_post');
}
function mailhost_uninstall() {
unregister_hook('feature_settings', 'addon/mailhost/mailhost.php', 'mailhost_addon_settings');
unregister_hook('feature_settings_post', 'addon/mailhost/mailhost.php', 'mailhost_addon_settings_post');
}
function mailhost_addon_settings(&$a,&$s) {
if(! local_channel())
return;
/* Add our stylesheet to the page so we can make our settings look nice */
//head_add_css('/addon/mailhost/mailhost.css');
$mailhost = get_pconfig(local_channel(),'system','email_notify_host');
if(! $mailhost)
$mailhost = $a->get_hostname();
$sc .= replace_macros(get_markup_template('field_input.tpl'), array(
'$field' => array('mailhost-mailhost', t('Email notification hub'), $mailhost, t('Hostname'))
));
$s .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array(
'$addon' => array('mailhost',t('Mailhost Settings'), '', t('Submit')),
'$content' => $sc
));
return;
}
function mailhost_addon_settings_post(&$a,&$b) {
if(! local_channel())
return;
if($_POST['mailhost-submit']) {
set_pconfig(local_channel(),'system','email_notify_host',trim($_POST['mailhost-mailhost']));
info( t('MAILHOST Settings saved.') . EOL);
}
}