From 3926f5582d6d1f704201a858ca09c969d4f110a7 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 May 2012 18:05:39 -0700 Subject: [PATCH] startpage addon --- startpage.tgz | Bin 0 -> 1314 bytes startpage/startpage.css | 16 +++++++ startpage/startpage.php | 94 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 startpage.tgz create mode 100644 startpage/startpage.css create mode 100644 startpage/startpage.php diff --git a/startpage.tgz b/startpage.tgz new file mode 100644 index 0000000000000000000000000000000000000000..67a4ebd08671d8270343f7780442f438df541f92 GIT binary patch literal 1314 zcmV+-1>O1|iwFSDH@r^(1MOE^Z`(E$_N)CX&NQR4i`cTAI4nR}wri(GhBU)AeL!M~JUo~0TqG$?q)y3-dX2A!0b(*4H%8;L z$!K)e7>v(H=VwE^UZ61?PR5hL>FN3Dq%jzdCX-2%>Up?y?6ls^Zd73t#7N$_w2uz zENKjXwwhrqh@L`BLp^IX*DTP{6h?zVdWW|Okt@b~OQE$$aCvN2KkaGT)3YlQP~{tu z&$JB(xwe0ro&P=#^?w?rPio^x|BuhkMqB+qGW~xxnbiIN9JqLm*=~6+U$)>S{6Z2s zg}0^<;2JBzto?u;Dp{(T;J8IK5J)8rsgyJT+u>ROHh2Jn<1cnGgi<6BiGW)q3j@NPA>6)1$>53^$n~YJ+f#{Oor2iCM(s!t7Kn2>g^U4zMC1G@l{@~ zZBLnJK*>eY2RqG!z;Y(me3LxJLt!2b=A><~imNZO)p>zTy=W`L)6p*SHnx?%kEx0% zrf^GbPk3GqRAc-ovv8kDFtz0|^ZnnLEh51Ky=sbUw%r+$o~{ z$%Kco`58Wbxi@;C3UelEGCcQ`T1A}9>0oUDM| zf{&9xAzKC0y(L<_aW382Ml3qD(dmx+wzOGRma>Dxz3`08Y*#Z2OcHiJSJslG*p9pE z^KX~~(ssi!et*8@ln%Wq-(0FU8xrD^rFgl49)8FWoF~heU|E=nP`seP8q-$#Ztd*2 z#CV$N11>pRh2#LoSFkM!#|*5D7G-6fvUTF^sP>SW%WdX;bP*ZJH@?iF`2wp#|M89_ zDOUItUi^^>J>yibg}ljc07EU7g=Qi1?QB$@y2l4^lJAt^7j|t0Aw9P&pg4T + * + */ + + +function startpage_install() { + register_hook('home_init', 'addon/startpage/startpage.php', 'startpage_home_init'); + register_hook('plugin_settings', 'addon/startpage/startpage.php', 'startpage_settings'); + register_hook('plugin_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post'); +} + + +function startpage_uninstall() { + unregister_hook('home_init', 'addon/startpage/startpage.php', 'startpage_home_init'); + unregister_hook('plugin_settings', 'addon/startpage/startpage.php', 'startpage_settings'); + unregister_hook('plugin_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post'); +} + + + +function startpage_home_init($a, $b) { + if(! local_user()) + return; + + $page = get_pconfig(local_user(),'startpage','startpage'); + if(strlen($page)) { + $slash = ((strpos($page,'/') === 0) ? true : false); + if(stristr($page,'://')) + goaway($page); + goaway($a->get_baseurl() . (($slash) ? '' : '/') . $page); + } + return; +} + +/** + * + * Callback from the settings post function. + * $post contains the $_POST array. + * We will make sure we've got a valid user account + * and if so set our configuration setting for this person. + * + */ + +function startpage_settings_post($a,$post) { + if(! local_user()) + return; + if($_POST['startpage-submit']) + set_pconfig(local_user(),'startpage','startpage',strip_tags(trim($_POST['startpage']))); +} + + +/** + * + * Called from the Plugin Setting form. + * Add our own settings info to the page. + * + */ + + + +function startpage_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 */ + + $page = get_pconfig(local_user(),'startpage','startpage'); + + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

' . t('Startpage Settings') . '

'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + $s .= '
' . t('Examples: "network" or "notifications/system"') . '
'; + + /* provide a submit button */ + + $s .= '
'; + +} -- 2.39.5