From 44cf9c2016856892513a586f645e36a6a5f7bcf8 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 20 Dec 2013 18:52:14 +0100 Subject: [PATCH 1/4] public server: added template for the admin panel --- public_server/templates/admin.tpl | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 public_server/templates/admin.tpl diff --git a/public_server/templates/admin.tpl b/public_server/templates/admin.tpl new file mode 100644 index 00000000..7781c2f4 --- /dev/null +++ b/public_server/templates/admin.tpl @@ -0,0 +1,10 @@ +

{{$infotext}}

+{{include file="field_input.tpl" field=$expiredays}} +{{include file="field_input.tpl" field=$expireposts}} +{{include file="field_input.tpl" field=$nologin}} +{{include file="field_input.tpl" field=$flagusers}} +{{include file="field_input.tpl" field=$flagposts}} +{{include file="field_input.tpl" field=$flagpostsexpire}} + + +
From 60f261b4902e27e37b32a339ea150e433ee5dac1 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 20 Dec 2013 18:58:50 +0100 Subject: [PATCH 2/4] public server: added form to admin panel --- public_server/public_server.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/public_server/public_server.php b/public_server/public_server.php index becf96c3..27e219f6 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -3,7 +3,7 @@ /** * Name: public_server * Description: Friendica plugin/addon with functions suitable for a public server. - * Version: 1.0 + * Version: 1.1 * Author: Keith Fernie */ @@ -141,3 +141,23 @@ function public_server_login($a,$b) { local_user() ); } + +function public_server_plugin_admin_post ( &$a ) { + check_form_security_token_redirectOnErr('/admin/plugins/publicserver', 'publicserver'); +} +function public_server_plugin_admin ( &$a, &$o) { + $token = get_form_security_token("publicserver"); + $t = get_markup_template( "admin.tpl", "addon/public_server"); + $o = replace_macros($t, array( + '$submit' => t('Save Settings'), + '$form_security_token' => $token, + '$infotext' => t('Set any of these options to 0 to deactivate it.'), + '$expiredays' => Array( "expiredays","Expire Days", intval(get_config('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "), + '$expireposts' => Array( "expireposts", "Expire Posts", intval(get_config('public_server','expireposts')), "Set the default days for posts to expire here"), + '$nologin' => Array( "nologin", "No Login", intval(get_config('public_server','nologin')), "Remove users who have never logged in after nologin days "), + '$flagusers' => Array( "flagusers", "Flag users", intval(get_config('public_server','flagusers')), "Remove users who last logged in over flagusers days ago"), + '$flagposts' => Array( "flagposts", "Flag posts", intval(get_config('public_server','flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "), + '$flagpostsexpire' => Array( "flagpostsexpire", "Flag posts expire", intval(get_config('public_server','flagpostsexpire'))), + )); +} + From 457b980de370e3b763a93932aed3d750b9ec1d09 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 20 Dec 2013 19:58:27 +0100 Subject: [PATCH 3/4] public server: save the settings --- public_server/public_server.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/public_server/public_server.php b/public_server/public_server.php index 27e219f6..8dacc916 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -144,6 +144,19 @@ function public_server_login($a,$b) { function public_server_plugin_admin_post ( &$a ) { check_form_security_token_redirectOnErr('/admin/plugins/publicserver', 'publicserver'); + $expiredays = (( x($_POST, 'expiredays') ) ? notags(trim($_POST['expiredays'] )) : ''); + $expireposts = (( x($_POST, 'expireposts') ) ? notags(trim($_POST['expireposts'] )) : ''); + $nologin = (( x($_POST, 'nologin') ) ? notags(trim($_POST['nologin'] )) : ''); + $flagusers = (( x($_POST, 'flagusers') ) ? notags(trim($_POST['flagusers'] )) : ''); + $flagposts = (( x($_POST, 'flagposts') ) ? notags(trim($_POST['flagposts'] )) : ''); + $flagpostsexpire = (( x($_POST, 'flagpostsexpire') ) ? notags(trim($_POST['flagpostsexpire'] )) : ''); + set_config( 'public_server','expiredays',$expiredays ); + set_config( 'public_server','expireposts',$expireposts ); + set_config( 'public_server','nologin',$nologin ); + set_config( 'public_server','flagusers',$flagusers); + set_config( 'public_server','flagposts',$flagposts ); + set_config( 'public_server','flagpostsexpire',$flagpostsexpire ); + info( t('Settings saved').EOL ); } function public_server_plugin_admin ( &$a, &$o) { $token = get_form_security_token("publicserver"); From ab9b0848866d7accb9daa1ae4a27b439463af334 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 20 Dec 2013 20:01:49 +0100 Subject: [PATCH 4/4] public server tar ball --- public_server.tgz | Bin 3834 -> 4577 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public_server.tgz b/public_server.tgz index ad51b9a3b5afbd1d3f983f1138046c620900343e..6751b5663747fb96e8bee7db0125d79d4772724b 100755 GIT binary patch literal 4577 zcmV<75gzUziwFP-l(bR+1MNNAZX3y!eiecILoF?vl!td+I4g@v7>k|}MmJcr7ha9P z6uXOLTg~pCzDPqG0w(j2%fl`vZvm3U#=v5c#bOoCqcl#T5J;`U}oT_fJ zn`}y?M7KOv9|#h=`qVk6>Rjs7g(bsjs*2RGn0d_1{EfE)1%UGMGXGmxDhB@wxKS*X zmY0jg61=!kC@z+lN;k;z+Yu)Sj%8DmkQ*l_Cs~==bR6D!@4us91oZ!)R^8aH<+}1r zd7y$EjQ zzNs)xRwPOc)oCjlIq4`;hbUb`WnHG(faBPDm)cN|N|NqqHn~j<-LeV$+)zw-p=-p_ ziQS<#(6bbqkuL3#CL@l;WI~aPFw2C^pjs0OPZYaDOeQ-LJfIrj!3J(XD@PKEdIx0V z;&pXdX(@mN0$a#QZviJpkdkaF$IKNwL+;$!*d;r=byB@o-+WZ9*GRQa>L1t0es#M> z>YMPZy3Y&hwf*|WgUv@ZvbXi{qs^T=cXEjY0m$e7uER7!wSG%M2FYa91_6LKGRF30 zh{9jBfj{7q4mD+eZ$N_>3d)Jj)9kvWYb~XHkP3Kb>hK`ND>0e&tkfZ?kj27XSCD;X zb9ORoQAf22qL7wu@}9SdtqXpPbePE|<-_X^F?ztd`Y~6PX@Tx_Xbe1R3=Krp+ihq$ z7zJ(F@T}=jqG(*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