X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=page%2Fpage.php;h=21a83e16d48126d96e061d40136b0c55f3e357c1;hb=c4315ad631e9b6c5d618ba807cf416ea85de89bd;hp=3333bb24ff2796465b77d8ee240ab157bb99a909;hpb=580bc49308415953be355f59a2e59b4dc95b1bc0;p=friendica-addons.git diff --git a/page/page.php b/page/page.php index 3333bb24..21a83e16 100755 --- a/page/page.php +++ b/page/page.php @@ -1,7 +1,7 @@ * based on pages plugin by @@ -10,21 +10,36 @@ */ 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'); + register_hook('profile_advanced', 'addon/page/page.php', 'page_profile_advanced'); + } 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'); + unregister_hook('profile_advanced', 'addon/page/page.php', 'page_profile_advanced'); + + // remove only - obsolete unregister_hook('page_end', 'addon/page/page.php', 'page_page_end'); } -function page_getpage($uid) { +function page_getpage($uid,$showhidden = true,$randomise = false) { $pagelist = array(); - $contacts = q("SELECT `id`, `url`, `name` FROM `contact` - WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d", + $order = (($showhidden) ? '' : " and hidden = 0 "); + $order .= (($randomise) ? ' order by rand() ' : ' order by name asc '); + + $contacts = q("SELECT `id`, `url`, `name`, `micro` FROM `contact` + WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d + and blocked = 0 and hidden = 0 and pending = 0 and archive = 0 + $order ", intval($uid) ); @@ -32,7 +47,7 @@ function page_getpage($uid) { // Look if the profile is a community page foreach($contacts as $contact) { - $page[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"]); + $page[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']); } return($page); } @@ -44,17 +59,157 @@ function page_page_end($a,&$b) { $page = '
"; if (sizeof($contacts) > 0) $a->page['aside'] = $page . $a->page['aside']; } -?> + +function page_network_mod_init($a,$b) { + + $page = ' "; + if (sizeof($contacts) > 0) + $a->page['aside'] = $page . $a->page['aside']; +} + + +function page_profile_advanced($a,&$b) { + + $profile = intval(get_pconfig($a->profile['profile_uid'],'page','show_on_profile')); + if(! $profile) + return; + + $page = '