diff --git a/public_server.tgz b/public_server.tgz index 6751b566..ec9c0177 100755 Binary files a/public_server.tgz and b/public_server.tgz differ diff --git a/public_server/README.md b/public_server/README.md index d323ff0f..44b29f8e 100644 --- a/public_server/README.md +++ b/public_server/README.md @@ -7,17 +7,17 @@ test bed with reduced data retention. This is a modified version of the testdrive plugin, DO NOT ACTIVATE AT THE SAME TIME AS THE TESTDRIVE PLUGIN. - //When an account is created on the site, it is given a hard expiration date of - $a->config['public_server']['expiredays'] = 30; - //Set the default days for posts to expire here - $a->config['public_server']['expireposts'] = 30; - //Remove users who have never logged in after nologin days - $a->config['public_server']['nologin'] = 30; - //Remove users who last logged in over flagusers days ago - $a->config['public_server']['flagusers'] = 146; - //For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire - $a->config['public_server']['flagposts'] = 90; - $a->config['public_server']['flagpostsexpire'] = 146; +//When an account is created on the site, it is given a hard expiration date of +$a->config['public_server']['expiredays'] = 30; +//Set the default days for posts to expire here +$a->config['public_server']['expireposts'] = 30; +//Remove users who have never logged in after nologin days +$a->config['public_server']['nologin'] = 30; +//Remove users who last logged in over flagusers days ago +$a->config['public_server']['flagusers'] = 146; +//For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire +$a->config['public_server']['flagposts'] = 90; +$a->config['public_server']['flagpostsexpire'] = 146; Set these in your .htconfig.php file. By default nothing is defined in case the plugin is activated accidentally. They can be ommitted or set to 0 to disable each option. diff --git a/public_server/public_server.php b/public_server/public_server.php index 8dacc916..becf96c3 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.1 + * Version: 1.0 * Author: Keith Fernie */ @@ -141,36 +141,3 @@ function public_server_login($a,$b) { local_user() ); } - -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"); - $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'))), - )); -} - diff --git a/public_server/templates/admin.tpl b/public_server/templates/admin.tpl deleted file mode 100644 index 7781c2f4..00000000 --- a/public_server/templates/admin.tpl +++ /dev/null @@ -1,10 +0,0 @@ -

{{$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}} - - -
diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 7d398cea..86975e47 100755 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -880,6 +880,22 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id) { function pumpio_get_contact($uid, $contact) { + $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", + dbesc(normalise_link($contact->url))); + + if (count($r) == 0) + q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')", + dbesc(normalise_link($contact->url)), + dbesc($contact->displayName), + dbesc($contact->preferredUsername), + dbesc($contact->image->url)); + else + q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'", + dbesc($contact->displayName), + dbesc($contact->preferredUsername), + dbesc($contact->image->url), + dbesc(normalise_link($contact->url))); + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1", intval($uid), dbesc($contact->url));