From 9c4f69cf7fb4637d0dd1b308b105124a78d5a211 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 19 Jun 2012 03:27:51 -0700 Subject: [PATCH] randomise page results of desired --- page.tgz | Bin 1897 -> 2054 bytes page/page.css | 4 ++-- page/page.php | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/page.tgz b/page.tgz index 7fcbf750c9e8f84ec003a6a59ce90222d415925d..43eb2b5616195fb85ed7713dc21f548ea544dae9 100644 GIT binary patch literal 2054 zcmV+h2>JIPiwFQCRNzkl1MOLDbK5o&_E+gwYRqu5*99mx)$jt zC+!&EAbT4Kz9(Td@DwakvaeeUbc55C>W=ZL(25h<|L>^$dD?3KXUpu7*7)uHzjv^IbhzSw{7w7+ z+3|M&e~EVb9p=3~c>1&rPvIw)@DunM(Lhf>a2+a<86ndXxLC>?4YAM$QuCag7Oy&zQy)QMFwPvN%V+f!SSCRk&nGR=>yvex8z|Oekh}nlWX#=trD% z;oqR$p66*u{#k`nks=o2IOq^3DZW5wxtcDeybAonnQ0;;loQ79g3qEzrh~=~qHe2e zL%uWG(CO@-mdyK*%60LFHBK|BAGGw|IjEb6xEUWzb3HM1)FS{`ltnHCz_cF59hE>mM)A-khPBL&D`4 z{AjLHA71?Q16*1vxkT-I?irn>r@uxtbJHrXOZ_4>*DSV?>9kwUP>Mq{2AHx}m=6$h zFiQ@Zl5-Jr5E|GTqv7d9D$c@Xu=1B_C?D)ja4Wp~P_5yi``&m`3ca(>AG+X?v5f)S zK_en+^y4G-+PKvReB0xHAXtB-{cm!W26lailqOJ07zMkm`($@!twrC@38w{ODF*as zd~IXl70K{WAj&Z)gajN=MR;PlSU48WHCOEx&P5!t-lP!!X1r3-f%7+D2TAswk4f<{ zN@EyyFgb6lUV-yN7xC6x_ zp$0hC05EB`sre1vg$MSAfzo(|;AjfJMaoQBj2TIgq zBy<+Dy9ysAmRqflUlv3-oI=`I;Am7;Z&&Ru%AicW4mjAv^{=4snVL6a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{L?Hy0@8;F=7DuJ7Qiqgi1c?6ZSs`%`Nz`hH2tRHhZhfIi08 zHWpq9hKB-ifk9zeOarP6Pa@}YN0o)4?a z_r2XRyjI5_gxEI-anfowty3;x&y;OSa&I&!l9AtUZlrjDtTZSE63^vJNb{ogkCIqsyH%y@qp7w7pvq;ptsF<+RW zci8p79<1G8t)ijlLkG4p2|B(9EHRtIn6fkoI2w*%z+j>H423%6JH}y5TP6wx7~D|t zSf~)kY6(o5Ei}KOyY#?b4Nw}-{v1u=cgSlQOAwLl+CwY}v&LrGbi6^x5Y$ABygr3) z9f2>uq%JWF>bMNy)WvxTj!^~g+m2P_Lrj5XiYzci+QbSxGukCenTVD3Gj`3brC1hG zBBE=|D_rg+PW-l<7rgh^X1+)A^v9tR-eVLA3e~l65`9k}qsXYYUwAca-!$K}qX?x8T_`*dnQQfgNA{Ir-|L zW4q-n`eQ*u>%V|?4uD^N0qnX9_QyY7UcGgcuzEp;m*12wD;uXH{ref^pgR9r{qNj~ ze>MEUF-|s<0Rc((ai~^@B9HMh8+Q=Z4qRNmdhmX*;dJoKo-DOv=`DZjeuQ|Jj`8SN zD2KmZaBh&5-5K24BH@-p#4<=RMV(}2UP1@q=LLgZm=ONxnQSLcag)T>1E~{*Eg|!t|oLT}9B^*yXqb2`Y zK=Jl^gRbD+%<%_I3uDl~M^SX*%cvv!Iv1TgZgkzDO``HXp|R#J!f;j6TD5hrv$XGC j2kqY6@7k{I+OF-|uI<{c?b@#WSGQjQ)@-PY04M+ePXM_z diff --git a/page/page.css b/page/page.css index f145ee0f..b8d84fef 100644 --- a/page/page.css +++ b/page/page.css @@ -1,13 +1,13 @@ -#page-settings-label { +#page-settings-label, #page-random-label { float: left; width: 200px; margin-bottom: 25px; } -#page-max-pages { +#page-max-pages, #page-random { float: left; } diff --git a/page/page.php b/page/page.php index 1d2aec63..80d902de 100755 --- a/page/page.php +++ b/page/page.php @@ -26,11 +26,13 @@ function page_uninstall() { } -function page_getpage($uid) { +function page_getpage($uid,$randomise = false) { $pagelist = array(); + $random = (($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 ", @@ -89,7 +91,9 @@ function page_network_mod_init($a,$b) { $show_total = intval(get_pconfig(local_user(),'page','max_pages')); if($show_total === false) $show_total = 6; - $contacts = page_getpage($a->user['uid']); + $randomise = intval(get_pconfig(local_user(),'page','randomise')); + + $contacts = page_getpage($a->user['uid'],$randomise); $total_shown = 0; $more = false; @@ -116,6 +120,8 @@ function page_plugin_settings_post($a,$post) { 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); } @@ -134,6 +140,10 @@ function page_plugin_settings(&$a,&$s) { $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 */ @@ -142,7 +152,12 @@ function page_plugin_settings(&$a,&$s) { $s .= '
'; $s .= ''; $s .= ''; - $s .= '
'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= ''; /* provide a submit button */ -- 2.39.5