expire settings for items, notes and photos.
show default privacy acl in popup
This commit is contained in:
parent
844a36e2b6
commit
79603e3146
4 changed files with 75 additions and 7 deletions
|
@ -2723,15 +2723,33 @@ function item_expire($uid,$days) {
|
|||
|
||||
if(! count($r))
|
||||
return;
|
||||
|
||||
$expire_items = get_pconfig($uid, 'expire','items');
|
||||
$expire_items = (($expire_items===false)?1:intval($expire_items)); // default if not set: 1
|
||||
|
||||
$expire_notes = get_pconfig($uid, 'expire','notes');
|
||||
$expire_notes = (($expire_notes===false)?1:intval($expire_notes)); // default if not set: 1
|
||||
|
||||
$expire_photos = get_pconfig($uid, 'expire','photos');
|
||||
$expire_photos = (($expire_photos===false)?0:intval($expire_photos)); // default if not set: 0
|
||||
|
||||
logger('expire: # items=' . count($r) );
|
||||
logger("expire: items: $expire_items, notes: $expire_notes, photos: $expire_photos");
|
||||
|
||||
foreach($r as $item) {
|
||||
|
||||
// Only expire posts, not photos and photo comments
|
||||
|
||||
if(strlen($item['resource-id']))
|
||||
logger('expire: item '.$item['type'].' id '.intval($item['id']).' "'.$item['body'].'" '.$item['resource-id']);
|
||||
|
||||
if($expire_photos==0 && strlen($item['resource-id']))
|
||||
continue;
|
||||
if($expire_notes==0 && $item['type']=='note')
|
||||
continue;
|
||||
if($expire_items==0 && $item['type']!='note')
|
||||
continue;
|
||||
|
||||
logger('expire');
|
||||
|
||||
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
|
||||
dbesc(datetime_convert()),
|
||||
|
@ -2751,7 +2769,7 @@ function item_expire($uid,$days) {
|
|||
}
|
||||
|
||||
proc_run('php',"include/notifier.php","expire","$uid");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,6 +78,13 @@
|
|||
menu.toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// fancyboxes
|
||||
$("a.popupbox").fancybox({
|
||||
'transitionIn' : 'elastic',
|
||||
'transitionOut' : 'elastic'
|
||||
});
|
||||
|
||||
|
||||
/* notifications template */
|
||||
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
|
||||
|
|
|
@ -215,6 +215,12 @@ function settings_post(&$a) {
|
|||
$openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
|
||||
$maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
|
||||
$expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0);
|
||||
|
||||
|
||||
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
|
||||
$expire_notes = ((x($_POST,'expire_notes')) ? intval($_POST['expire_notes']) : 0);
|
||||
$expire_photos = ((x($_POST,'expire_photos'))? intval($_POST['expire_photos']) : 0);
|
||||
|
||||
|
||||
$allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
|
||||
$publish = (((x($_POST,'profile_in_directory')) && (intval($_POST['profile_in_directory']) == 1)) ? 1: 0);
|
||||
|
@ -297,6 +303,10 @@ function settings_post(&$a) {
|
|||
$openidserver = '';
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'expire','items', $expire_items);
|
||||
set_pconfig(local_user(),'expire','notes', $expire_notes);
|
||||
set_pconfig(local_user(),'expire','photos', $expire_photos);
|
||||
|
||||
$r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `expire` = %d, `openidserver` = '%s', `blockwall` = %d, `hidewall` = %d, `blocktags` = %d WHERE `uid` = %d LIMIT 1",
|
||||
dbesc($username),
|
||||
dbesc($email),
|
||||
|
@ -586,6 +596,15 @@ function settings_content(&$a) {
|
|||
$blockwall = $a->user['blockwall'];
|
||||
$blocktags = $a->user['blocktags'];
|
||||
|
||||
$expire_items = get_pconfig(local_user(), 'expire','items');
|
||||
$expire_items = (($expire_items===false)?1:$expire_items); // default if not set: 1
|
||||
|
||||
$expire_notes = get_pconfig(local_user(), 'expire','notes');
|
||||
$expire_notes = (($expire_notes===false)?1:$expire_notes); // default if not set: 1
|
||||
|
||||
$expire_photos = get_pconfig(local_user(), 'expire','photos');
|
||||
$expire_photos = (($expire_photos===false)?0:$expire_photos); // default if not set: 0
|
||||
|
||||
if(! strlen($a->user['timezone']))
|
||||
$timezone = date_default_timezone_get();
|
||||
|
||||
|
@ -698,7 +717,13 @@ function settings_content(&$a) {
|
|||
|
||||
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
|
||||
|
||||
|
||||
$expire_arr = array(
|
||||
'days' => array('expire', t("Automatically expire posts after days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
|
||||
'advanced' => t('Advanced expire settings'),
|
||||
'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))),
|
||||
'notes' => array('expire_notes', t("Expire personal notes:"), $expire_notes, '', array(t('No'),t('Yes'))),
|
||||
'photos' => array('expire_photos', t("Expire photos:"), $expire_photos, '', array(t('No'),t('Yes'))),
|
||||
);
|
||||
|
||||
$o .= replace_macros($stpl,array(
|
||||
'$tabs' => $tabs,
|
||||
|
@ -736,7 +761,7 @@ function settings_content(&$a) {
|
|||
|
||||
'$blockwall'=> $blockwall, // array('blockwall', t('Allow friends to post to your profile page:'), !$blockwall, ''),
|
||||
'$blocktags'=> $blocktags, // array('blocktags', t('Allow friends to tag your posts:'), !$blocktags, ''),
|
||||
'$expire' => array('expire', t("Automatically expire posts after days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
|
||||
'$expire' => $expire_arr,
|
||||
|
||||
'$profile_in_dir' => $profile_in_dir,
|
||||
'$profile_in_net_dir' => $profile_in_net_dir,
|
||||
|
|
|
@ -55,18 +55,36 @@ $blockwall
|
|||
|
||||
$blocktags
|
||||
|
||||
{{inc field_input.tpl with $field=$expire }}{{endinc}}
|
||||
{{inc field_input.tpl with $field=$expire.days }}{{endinc}}
|
||||
<div class="field input">
|
||||
<span class="field_help"><a href="#advaced-expire-popup" id="advenced-expire" class='popupbox' title="$expire.advanced">Advanced</a></span>
|
||||
<div style="display: none;">
|
||||
<div id="advaced-expire-popup" style="width:auto;height:auto;overflow:auto;">
|
||||
<h3>$expire.advanced</h3>
|
||||
{{ inc field_yesno.tpl with $field=$expire.items }}{{endinc}}
|
||||
{{ inc field_yesno.tpl with $field=$expire.notes }}{{endinc}}
|
||||
{{ inc field_yesno.tpl with $field=$expire.photos }}{{endinc}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="settings-default-perms" class="settings-default-perms" >
|
||||
<div id="settings-default-perms-menu" class="fakelink" onClick="openClose('settings-default-perms-select');" >$permissions $permdesc</div>
|
||||
<a href="#profile-jot-acl-wrapper" id="settings-default-perms-menu" class='popupbox'>$permissions $permdesc</a>
|
||||
<div id="settings-default-perms-menu-end"></div>
|
||||
|
||||
<div id="settings-default-perms-select" style="display: none; margin-bottom: 20px" >
|
||||
|
||||
$aclselect
|
||||
<div style="display: none;">
|
||||
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
|
||||
$aclselect
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="settings-default-perms-end"></div>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue