aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-07 00:47:50 -0800
committerfriendica <info@friendica.com>2013-11-07 00:47:50 -0800
commit7381326b7a7a271da52464d15774a1309adb2bd5 (patch)
tree3427097b3dc93977f37c8f0b1b49eabc37160611
parentdf4c9171207065f32db52c910f86e5ef277eaa1f (diff)
downloadvolse-hubzilla-7381326b7a7a271da52464d15774a1309adb2bd5.tar.gz
volse-hubzilla-7381326b7a7a271da52464d15774a1309adb2bd5.tar.bz2
volse-hubzilla-7381326b7a7a271da52464d15774a1309adb2bd5.zip
provide expire feature on post and comments as well as private messages. This requires a feature setting and is currently unmaskable - if the author says it's gone, there's not a lot you can do to stop it or try and save it. It's gone.
-rw-r--r--include/conversation.php6
-rw-r--r--include/features.php4
-rw-r--r--include/poller.php8
-rw-r--r--mod/editblock.php3
-rw-r--r--mod/editlayout.php3
-rw-r--r--mod/editpost.php6
-rw-r--r--mod/editwebpage.php4
-rw-r--r--mod/item.php8
-rw-r--r--mod/message.php6
-rw-r--r--version.inc2
-rw-r--r--view/theme/redbasic/css/style.css7
-rwxr-xr-xview/tpl/jot-header.tpl7
-rwxr-xr-xview/tpl/jot.tpl6
-rwxr-xr-xview/tpl/prv_message.tpl2
14 files changed, 58 insertions, 14 deletions
diff --git a/include/conversation.php b/include/conversation.php
index e8b41e775..fc0ae98e6 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1064,7 +1064,8 @@ function status_editor($a,$x,$popup=false) {
'$audurl' => t("Please enter an audio link/URL:"),
'$term' => t('Tag term:'),
'$fileas' => t('Save to Folder:'),
- '$whereareu' => t('Where are you right now?')
+ '$whereareu' => t('Where are you right now?'),
+ '$expireswhen' => t('Expires YYYY-MM-DD HH:MM')
));
@@ -1130,6 +1131,9 @@ function status_editor($a,$x,$popup=false) {
'$preview' => $preview,
'$sourceapp' => t($a->sourcename),
'$jotplugins' => $jotplugins,
+ '$defexpire' => '',
+ '$feature_expire' => ((feature_enabled($x['profile_uid'],'content_expire') && (! $webpage)) ? 'block' : 'none'),
+ '$expires' => t('Set expiration date'),
));
diff --git a/include/features.php b/include/features.php
index 9950039c0..bf3323b56 100644
--- a/include/features.php
+++ b/include/features.php
@@ -19,8 +19,8 @@ function get_features() {
// General
'general' => array(
t('General Features'),
-// uncomment when expire is fixed
-// array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
+// This is per post, and different from fixed expiration 'expire' which isn't working yet
+ array('content_expire', t('Content Expiration'), t('Remove posts/comments and/or private messages at a future time')),
array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles')),
array('webpages', t('Web Pages'), t('Provide managed web pages on your channel')),
array('prettyphoto', t('Enhanced Photo Albums'), t('Enable photo album with enhanced features')),
diff --git a/include/poller.php b/include/poller.php
index b1f89955c..e5a274758 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -46,7 +46,13 @@ function poller_run($argv, $argc){
// expire any expired mail
q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
-
+
+ $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
+ if($r) {
+ require_once('include/items.php');
+ foreach($r as $rr)
+ drop_item($rr['id'],false);
+ }
// Ensure that every channel pings a directory server once a month. This way we can discover
// channels and sites that quietly vanished and prevent the directory from accumulating stale
diff --git a/mod/editblock.php b/mod/editblock.php
index a111f6666..9c691640b 100644
--- a/mod/editblock.php
+++ b/mod/editblock.php
@@ -144,6 +144,9 @@ function editblock_content(&$a) {
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
+ '$defexpire' => '',
+ '$feature_expire' => 'none',
+ '$expires' => t('Set expiration date'),
));
diff --git a/mod/editlayout.php b/mod/editlayout.php
index 7bcd02512..f8906d981 100644
--- a/mod/editlayout.php
+++ b/mod/editlayout.php
@@ -129,6 +129,9 @@ function editlayout_content(&$a) {
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
+ '$defexpire' => '',
+ '$feature_expire' => 'none',
+ '$expires' => t('Set expiration date'),
));
$ob = get_observer_hash();
diff --git a/mod/editpost.php b/mod/editpost.php
index 161e8f301..81eef2782 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -48,7 +48,8 @@ function editpost_content(&$a) {
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
- '$nickname' => $channel['channel_address']
+ '$nickname' => $channel['channel_address'],
+ '$expireswhen' => t('Expires YYYY-MM-DD HH:MM'),
));
@@ -126,6 +127,9 @@ function editpost_content(&$a) {
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
'$catsenabled' => $catsenabled,
+ '$defexpire' => $itm[0]['expires'],
+ '$feature_expire' => 'none',
+ '$expires' => t('Set expiration date'),
));
return $o;
diff --git a/mod/editwebpage.php b/mod/editwebpage.php
index 44ac0bc85..5a21aa78d 100644
--- a/mod/editwebpage.php
+++ b/mod/editwebpage.php
@@ -150,6 +150,10 @@ function editwebpage_content(&$a) {
'$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
+ '$defexpire' => '',
+ '$feature_expire' => 'none',
+ '$expires' => t('Set expiration date'),
+
));
$ob = get_observer_hash();
diff --git a/mod/item.php b/mod/item.php
index 2b8de1247..be24d242c 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -327,11 +327,9 @@ function item_post(&$a) {
$expires = '0000-00-00 00:00:00';
- if(feature_enabled($profile_uid,'expire')) {
- // expire_quantity, e.g. '3'
- // expire_units, e.g. days, weeks, months
- if(x($_REQUEST,'expire_quantity') && (x($_REQUEST,'expire_units'))) {
- $expire = datetime_convert('UTC','UTC', 'now + ' . $_REQUEST['expire_quantity'] . ' ' . $_REQUEST['expire_units']);
+ if(feature_enabled($profile_uid,'content_expire')) {
+ if(x($_REQUEST,'expire')) {
+ $expires = datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expire']);
if($expires <= datetime_convert())
$expires = '0000-00-00 00:00:00';
}
diff --git a/mod/message.php b/mod/message.php
index e31d903a7..dbbe8836b 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -324,7 +324,8 @@ function message_content(&$a) {
'$insert' => t('Insert web link'),
'$wait' => t('Please wait'),
'$submit' => t('Submit'),
- '$expires' => t('Expires: (leave blank for never)')
+ '$expires' => t('Expires: (leave blank for never)'),
+ '$feature_expire' => ((feature_enabled(local_user(),'content_expire')) ? '1' : ''),
));
return $o;
@@ -499,7 +500,8 @@ function message_content(&$a) {
'$insert' => t('Insert web link'),
'$submit' => t('Submit'),
'$wait' => t('Please wait'),
- '$expires' => t('Expires: (leave blank for never)')
+ '$expires' => t('Expires: (leave blank for never)'),
+ '$feature_expire' => ((feature_enabled(local_user(),'content_expire')) ? '1' : ''),
));
return $o;
diff --git a/version.inc b/version.inc
index 0cbb9a0a6..259a60c9a 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-11-06.489
+2013-11-07.490
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index c5d41d7ba..1a556df06 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -319,7 +319,8 @@ footer {
#profile-video,
#profile-audio,
#profile-link,
-#profile-title,
+#profile-title,
+#profile-expires,
#wall-image-upload,
#wall-file-upload,
#profile-upload-wrapper,
@@ -1137,6 +1138,10 @@ footer {
float: left;
margin-left: 15px;
}
+#profile-expire-wrapper {
+ float: left;
+ margin-left: 15px;
+}
#jot-preview-link {
float: left;
margin-left: 45px;
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 527db4e4f..05928bc32 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -191,6 +191,13 @@ function enableOnUser(){
}
}
+ function jotGetExpiry() {
+ reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
+ if(reply && reply.length) {
+ $('#jot-expire').val(reply);
+ }
+ }
+
function jotShare(id) {
if ($('#jot-popup').length != 0) $('#jot-popup').show();
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 12978038c..f7dd12758 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -5,6 +5,7 @@
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
<input type="hidden" name="return" value="{{$return_path}}" />
<input type="hidden" name="location" id="jot-location" value="{{$defloc}}" />
+ <input type="hidden" name="expire" id="jot-expire" value="{{$defexpire}}" />
<input type="hidden" name="coord" id="jot-coord" value="" />
<input type="hidden" name="post_id" value="{{$post_id}}" />
<input type="hidden" name="webpage" value="{{$webpage}}" />
@@ -50,6 +51,11 @@
<div id="profile-nolocation-wrapper" style="display: none;" >
<i id="profile-nolocation" class="icon-circle-blank jot-icons" title="{{$noloc}}" onclick="jotClearLocation();return false;"></i>
</div>
+ <div id="profile-expire-wrapper" style="display: {{$feature_expire}};" >
+ <i id="profile-expires" class="icon-eraser jot-icons" title="{{$expires}}" onclick="jotGetExpiry();return false;"></i>
+ </div>
+
+
<div id="profile-rotator-wrapper" style="display: {{$visitor}};" >
<div id="profile-rotator"></div>
</div>
diff --git a/view/tpl/prv_message.tpl b/view/tpl/prv_message.tpl
index 494eec48c..35f50da00 100755
--- a/view/tpl/prv_message.tpl
+++ b/view/tpl/prv_message.tpl
@@ -17,8 +17,10 @@
<div id="prvmail-subject-label">{{$subject}}</div>
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="{{$subjtxt}}" {{$readonly}} tabindex="11" />
+{{if $feature_expire}}
<div id="prvmail-expires-label">{{$expires}}</div>
<input type="text" size="64" maxlength="255" id="prvmail-expires" name="expires" value="" tabindex="12" />
+{{/if}}
<div id="prvmail-message-label">{{$yourmessage}}</div>
<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="13">{{$text}}</textarea>