From: Leberwurscht Date: Mon, 16 Apr 2012 17:28:23 +0000 (+0200) Subject: jappixmini: add text field for configuration help X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=af0366a9e22629a0050e8144884e6877bf103299;p=friendica-addons.git jappixmini: add text field for configuration help --- diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index a648aba7..f476753a 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -69,6 +69,15 @@ register_hook('cron', 'addon/jappixmini/jappixmini.php', 'jappixmini_cron'); // Jappix source download as required by AGPL register_hook('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source'); + +// set standard info text +$info_text = get_config("jappixmini", "infotext"); +if (!$info_text) set_config("jappixmini", "infotext", + "To get the chat working, you need to know a BOSH host which works with your Jabber account. ". + "An example of a BOSH server that works for all accounts is https://bind.jappix.com/, but keep ". + "in mind that the BOSH server can read along all chat messages. If you know that your Jabber ". + "server also provides an own BOSH server, it is much better to use this one!" +); } @@ -96,9 +105,21 @@ function jappixmini_plugin_admin(&$a, &$o) { else { $o .= '

Jappix is installed.

'; } + + // info text field + $o .= '
'; + $info_text = get_config("jappixmini", "infotext"); + $o .= '
'; + $o .= ''; } function jappixmini_plugin_admin_post(&$a) { + // set info text + $submit = $_REQUEST['jappixmini-admin-settings']; + if ($submit) { + $info_text = $_REQUEST['jappixmini-infotext']; + set_config("jappixmini", "infotext", $info_text); + } } function jappixmini_module() {} @@ -200,6 +221,10 @@ function jappixmini_settings(&$a, &$s) { $encrypt_checked = $encrypt ? ' checked="checked"' : ''; $encrypt_disabled = $encrypt ? '' : ' disabled="disabled"'; + $info_text = get_config("jappixmini", "infotext"); + $info_text = htmlentities($info_text); + $info_text = str_replace("\n", "
", $info_text); + if (!$activate) { // load scripts if not yet activated so that password can be saved $a->page['htmlhead'] .= ''."\r\n"; @@ -254,6 +279,7 @@ function jappixmini_settings(&$a, &$s) { $s .= ''; $s .= ' '; $s .= '
'; + if ($info_text) $s .= '
Configuration help:

'.$info_text.'

'; $s .= ''; $s .= ' '; $s .= '';