X-Git-Url: https://git.mxchange.org/?p=friendica-addons.git;a=blobdiff_plain;f=forumlist%2Fforumlist.php;fp=forumlist%2Fforumlist.php;h=0000000000000000000000000000000000000000;hp=63a8de84111644156d0e6f09725ce257fdf6fdb1;hb=dbe8118e406510d85404d9577f83d68782cfe2a0;hpb=39dd3dffe07efd69fa1ac6d0bd243c7fc0e3a66f diff --git a/forumlist/forumlist.php b/forumlist/forumlist.php deleted file mode 100644 index 63a8de84..00000000 --- a/forumlist/forumlist.php +++ /dev/null @@ -1,188 +0,0 @@ - - * based on pages plugin by - * Author: Michael Vogel - * Status: Unsupported - * - */ - -function forumlist_install() { - register_hook('network_mod_init', 'addon/forumlist/forumlist.php', 'forumlist_network_mod_init'); - register_hook('plugin_settings', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings'); - register_hook('plugin_settings_post', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings_post'); - register_hook('profile_advanced', 'addon/forumlist/forumlist.php', 'forumlist_profile_advanced'); - -} - -function forumlist_uninstall() { - unregister_hook('network_mod_init', 'addon/forumlist/forumlist.php', 'forumlist_network_mod_init'); - unregister_hook('plugin_settings', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings'); - unregister_hook('plugin_settings_post', 'addon/forumlist/forumlist.php', 'forumlist_plugin_settings_post'); - unregister_hook('profile_advanced', 'addon/forumlist/forumlist.php', 'forumlist_profile_advanced'); - -} - - -function forumlist_getpage($uid,$showhidden = true,$randomise = false, $showprivate = false) { - - - $forumlist = array(); - - $order = (($showhidden) ? '' : " and hidden = 0 "); - $order .= (($randomise) ? ' order by rand() ' : ' order by name asc '); - $select = "`forum` = 1"; - if ($showprivate) { - $select = "( `forum` = 1 OR `prv` = 1 )"; - } - - $contacts = q("SELECT `contact`.`id`, `contact`.`url`, `contact`.`name`, `contact`.`micro` from contact - WHERE `network`= 'dfrn' AND $select AND `uid` = %d - and blocked = 0 and hidden = 0 and pending = 0 and archive = 0 - $order ", - intval($uid) - ); - - // Look if the profile is a community page - foreach($contacts as $contact) { - $forumlist[] = array("url"=>$contact["url"], "name"=>$contact["name"], "id"=>$contact["id"], "micro"=>$contact['micro']); - } - return($forumlist); -} - -function forumlist_network_mod_init($a,$b) { - - if(! intval(get_pconfig(local_user(),'forumlist','show_on_network'))) - return; - - $a->page['htmlhead'] .= '' . "\r\n"; - - $forumlist = '
-
-

'.t("Forums").'

'; - - $forumlist .= '' - . '
"; - if (sizeof($contacts) > 0) - $a->page['aside'] = $forumlist . $a->page['aside']; -} - - -function forumlist_profile_advanced($a,&$b) { - $a->page['htmlhead'] .= '' . "\r\n"; - - $profile = intval(get_pconfig($a->profile['profile_uid'],'forumlist','show_on_profile')); - if(! $profile) - return; - - $forumlist = '
-
'.t("Forums:").'
-
'; - - // place holder in case somebody wants configurability - $show_total = 9999; - - $randomise = true; - - $contacts = forumlist_getpage($a->user['uid'],false,$randomise,false); - - $total_shown = 0; - $more = false; - - foreach($contacts as $contact) { - $forumlist .= micropro($contact,false,'forumlist-profile-advanced'); - $total_shown ++; - if($total_shown == $show_total) - break; - } - $forumlist .= '
'; - - if(count($contacts) > 0) - $b .= $forumlist; - -} - - - -function forumlist_plugin_settings_post($a,$post) { - if(! local_user() || (! x($_POST,'forumlist-settings-submit'))) - return; -// set_pconfig(local_user(),'forumlist','max_forumlists',intval($_POST['forumlist_max_forumlists'])); - set_pconfig(local_user(),'forumlist','randomise',intval($_POST['forumlist_random'])); - set_pconfig(local_user(),'forumlist','show_on_profile',intval($_POST['forumlist_profile'])); - set_pconfig(local_user(),'forumlist','show_on_network',intval($_POST['forumlist_network'])); - - info( t('Forumlist settings updated.') . EOL); -} - - -function forumlist_plugin_settings(&$a,&$s) { - - if(! local_user()) - return; - - /* Add our stylesheet to the forumlist so we can make our settings look nice */ - - $a->page['htmlhead'] .= '' . "\r\n"; - - /* Get the current state of our config variable */ - - $randomise = intval(get_pconfig(local_user(),'forumlist','randomise')); - $randomise_checked = (($randomise) ? ' checked="checked" ' : ''); - - $profile = intval(get_pconfig(local_user(),'forumlist','show_on_profile')); - $profile_checked = (($profile) ? ' checked="checked" ' : ''); - - $network = intval(get_pconfig(local_user(),'forumlist','show_on_network')); - $network_checked = (($network) ? ' checked="checked" ' : ''); - - - /* Add some HTML to the existing form */ - $s .= ''; - $s .= '

' . t('Forumlist') . '

'; - $s .= '
'; - $s .= ''; - -} - -