From b863aa697ede1b8de522fe125f9bfd9e7fb1b782 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 19 Jun 2012 02:30:44 -0700 Subject: [PATCH] page updates --- page/page.php | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/page/page.php b/page/page.php index 129af4124..4ae471bac 100755 --- a/page/page.php +++ b/page/page.php @@ -10,10 +10,18 @@ */ function page_install() { - register_hook('page_end', 'addon/page/page.php', 'page_page_end'); + register_hook('network_mod_init', 'addon/page/page.php', 'page_network_mod_init'); + register_hook('plugin_settings', 'addon/page/page.php', 'page_plugin_settings'); + register_hook('plugin_settings_post', 'addon/page/page.php', 'page_plugin_settings_post'); + } function page_uninstall() { + unregister_hook('network_mod_init', 'addon/page/page.php', 'page_network_mod_init'); + unregister_hook('plugin_settings', 'addon/page/page.php', 'page_plugin_settings'); + unregister_hook('plugin_settings_post', 'addon/page/page.php', 'page_plugin_settings_post'); + + // remove only - obsolete unregister_hook('page_end', 'addon/page/page.php', 'page_page_end'); } @@ -71,5 +79,75 @@ function page_page_end($a,&$b) { $a->page['aside'] = $page . $a->page['aside']; } +function page_network_mod_init($a,$b) { + + $page = '
+
+

'.t("Forums").'

+
"; + if (sizeof($contacts) > 0) + $a->page['aside'] = $page . $a->page['aside']; +} + +function page_plugin_settings_post($a,$post) { + if(! local_user() || (! x($_POST,'page-settings-submit'))) + return; + + set_pconfig(local_user(),'page','max_pages',intval($_POST['page_max_pages'])); + info( t('Page settings updated.') . EOL); +} + + +function page_plugin_settings(&$a,&$s) { + + if(! local_user()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + $a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variable */ + + $max_pages = get_pconfig(local_user(),'page','max_pages'); + if($max_pages === false) + $max_pages = 6; + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

' . t('Page Settings') . '

'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + /* provide a submit button */ + + $s .= '
'; + +}