diff --git a/infiniteimprobabilitydrive.tgz b/infiniteimprobabilitydrive.tgz index 6d10fb69..8d9a2203 100644 Binary files a/infiniteimprobabilitydrive.tgz and b/infiniteimprobabilitydrive.tgz differ diff --git a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.css b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.css index f4be6051..7fb4019c 100644 --- a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.css +++ b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.css @@ -1,4 +1,3 @@ -section { - padding-left: 0px; - -} \ No newline at end of file +section {padding-left: 0px;} + +iframe {border: none;} \ No newline at end of file diff --git a/page.tgz b/page.tgz index c94f01b2..f77dcf23 100644 Binary files a/page.tgz and b/page.tgz differ diff --git a/page/page.css b/page/page.css new file mode 100644 index 00000000..b8d84fef --- /dev/null +++ b/page/page.css @@ -0,0 +1,14 @@ + + + +#page-settings-label, #page-random-label { + float: left; + width: 200px; + margin-bottom: 25px; +} + +#page-max-pages, #page-random { + float: left; +} + + diff --git a/page/page.php b/page/page.php index 129af412..fd48b4ee 100755 --- a/page/page.php +++ b/page/page.php @@ -1,7 +1,7 @@ * based on pages plugin by @@ -10,22 +10,32 @@ */ 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'); } -function page_getpage($uid) { +function page_getpage($uid,$randomise = false) { $pagelist = array(); + $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 - order by name asc ", + $order ", intval($uid) ); @@ -55,7 +65,7 @@ function page_page_end($a,&$b) { $more = false; foreach($contacts as $contact) { - $page .= '
  • ' . $contact['url'] . ' '. + $page .= '
  • ' . $contact['url'] . ' '. $contact["name"]."
  • "; $total_shown ++; if($total_shown == 6) { @@ -71,5 +81,88 @@ 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'])); + set_pconfig(local_user(),'page','randomise',intval($_POST['page_random'])); + + 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; + + $randomise = intval(get_pconfig(local_user(),'page','randomise')); + $randomise_checked = (($randomise) ? ' checked="checked" ' : ''); + + + /* Add some HTML to the existing form */ + + $s .= '
    '; + $s .= '

    ' . t('Page Settings') . '

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