diff --git a/include/items.php b/include/items.php index ecf19a86ed..8c9a714cd5 100644 --- a/include/items.php +++ b/include/items.php @@ -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"); - + } diff --git a/js/main.js b/js/main.js index 74e58e0e34..9741bfaec1 100644 --- a/js/main.js +++ b/js/main.js @@ -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()); diff --git a/mod/settings.php b/mod/settings.php index a073a5e984..f51a484c82 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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, diff --git a/view/settings.tpl b/view/settings.tpl index 52f989f997..e269d97f1a 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -55,18 +55,36 @@ $blockwall $blocktags -{{inc field_input.tpl with $field=$expire }}{{endinc}} +{{inc field_input.tpl with $field=$expire.days }}{{endinc}} +