aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php2
-rwxr-xr-xinclude/items.php6
-rw-r--r--include/message.php13
-rw-r--r--include/poller.php5
-rw-r--r--install/database.sql37
-rw-r--r--install/update.php10
-rw-r--r--mod/dirsearch.php4
-rw-r--r--mod/message.php12
-rw-r--r--version.inc2
-rw-r--r--view/theme/redbasic/css/style.css2
-rwxr-xr-xview/tpl/prv_message.tpl7
11 files changed, 64 insertions, 36 deletions
diff --git a/boot.php b/boot.php
index e2129f6f5..96b73eaaa 100755
--- a/boot.php
+++ b/boot.php
@@ -45,7 +45,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1080 );
+define ( 'DB_UPDATE_VERSION', 1081 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/include/items.php b/include/items.php
index 5fcbb0cc5..520ea7230 100755
--- a/include/items.php
+++ b/include/items.php
@@ -910,6 +910,7 @@ function encode_mail($item) {
$x['message_id'] = $item['mid'];
$x['message_parent'] = $item['parent_mid'];
$x['created'] = $item['created'];
+ $x['expires'] = $item['expires'];
$x['title'] = $item['title'];
$x['body'] = $item['body'];
$x['from'] = encode_item_xchan($item['from']);
@@ -939,6 +940,10 @@ function get_mail_elements($x) {
$arr['title'] = (($x['title'])? htmlentities($x['title'],ENT_COMPAT,'UTF-8',false) : '');
$arr['created'] = datetime_convert('UTC','UTC',$x['created']);
+ if((! array_key_exists('expires',$x)) || ($x['expires'] === '0000-00-00 00:00:00'))
+ $arr['expires'] = '0000-00-00 00:00:00';
+ else
+ $arr['expires'] = datetime_convert('UTC','UTC',$x['expires']);
$arr['mail_flags'] = 0;
@@ -2465,6 +2470,7 @@ function mail_store($arr) {
$arr['from_xchan'] = ((x($arr,'from_xchan')) ? notags(trim($arr['from_xchan'])) : '');
$arr['to_xchan'] = ((x($arr,'to_xchan')) ? notags(trim($arr['to_xchan'])) : '');
$arr['created'] = ((x($arr,'created') !== false) ? datetime_convert('UTC','UTC',$arr['created']) : datetime_convert());
+ $arr['expires'] = ((x($arr,'expires') !== false) ? datetime_convert('UTC','UTC',$arr['expires']) : '0000-00-00 00:00:00');
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
$arr['parent_mid'] = ((x($arr,'parent_mid')) ? notags(trim($arr['parent_mid'])) : '');
$arr['body'] = ((x($arr,'body')) ? trim($arr['body']) : '');
diff --git a/include/message.php b/include/message.php
index e54a6cd83..3bcd5e209 100644
--- a/include/message.php
+++ b/include/message.php
@@ -8,7 +8,7 @@ require_once('include/attach.php');
// send a private message
-function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto=''){
+function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='',$expires = ''){
$ret = array('success' => false);
@@ -22,6 +22,10 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
if(! strlen($subject))
$subject = t('[no subject]');
+// if(! $expires)
+// $expires = '0000-00-00 00:00:00';
+// else
+// $expires = datetime_convert(date_default_timezone_get(),'UTC',$expires);
if($uid) {
$r = q("select * from channel where channel_id = %d limit 1",
@@ -111,8 +115,8 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
- $r = q("INSERT INTO mail ( account_id, mail_flags, channel_id, from_xchan, to_xchan, title, body, attach, mid, parent_mid, created )
- VALUES ( %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
+ $r = q("INSERT INTO mail ( account_id, mail_flags, channel_id, from_xchan, to_xchan, title, body, attach, mid, parent_mid, created, expires )
+ VALUES ( %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
intval($channel['channel_account_id']),
intval(MAIL_OBSCURED),
intval($channel['channel_id']),
@@ -123,7 +127,8 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
dbesc($jattach),
dbesc($mid),
dbesc($replyto),
- dbesc(datetime_convert())
+ dbesc(datetime_convert()),
+ dbesc($expires)
);
// verify the save
diff --git a/include/poller.php b/include/poller.php
index f3a997913..b1f89955c 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -42,6 +42,11 @@ function poller_run($argv, $argc){
intval(ACCOUNT_EXPIRED),
intval(ACCOUNT_EXPIRED)
);
+
+ // expire any expired mail
+
+ q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() ");
+
// 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/install/database.sql b/install/database.sql
index 0d371d4b8..3a05c28ec 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -182,7 +182,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
`channel_w_storage` int(10) unsigned NOT NULL DEFAULT '128',
`channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128',
`channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128',
- `channel_a_republish` int(1) unsigned NOT NULL DEFAULT '128',
+ `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '128',
PRIMARY KEY (`channel_id`),
UNIQUE KEY `channel_address_unique` (`channel_address`),
KEY `channel_account_id` (`channel_account_id`),
@@ -193,7 +193,6 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_theme` (`channel_theme`),
KEY `channel_notifyflags` (`channel_notifyflags`),
KEY `channel_pageflags` (`channel_pageflags`),
- KEY `channel_dirdate` (`channel_dirdate`),
KEY `channel_max_anon_mail` (`channel_max_anon_mail`),
KEY `channel_max_friend_req` (`channel_max_friend_req`),
KEY `channel_default_gid` (`channel_default_group`),
@@ -216,8 +215,9 @@ CREATE TABLE IF NOT EXISTS `channel` (
KEY `channel_w_storage` (`channel_w_storage`),
KEY `channel_r_pages` (`channel_r_pages`),
KEY `channel_w_pages` (`channel_w_pages`),
+ KEY `channel_deleted` (`channel_deleted`),
KEY `channel_a_republish` (`channel_a_republish`),
- KEY `channel_deleted` (`channel_deleted`)
+ KEY `channel_dirdate` (`channel_dirdate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `clients` (
@@ -352,7 +352,7 @@ CREATE TABLE IF NOT EXISTS `group_member` (
KEY `uid` (`uid`),
KEY `gid` (`gid`),
KEY `xchan` (`xchan`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -384,12 +384,12 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
KEY `hubloc_url` (`hubloc_url`),
KEY `hubloc_guid` (`hubloc_guid`),
KEY `hubloc_flags` (`hubloc_flags`),
- KEY `hubloc_status` (`hubloc_status`),
KEY `hubloc_connect` (`hubloc_connect`),
KEY `hubloc_host` (`hubloc_host`),
KEY `hubloc_addr` (`hubloc_addr`),
KEY `hubloc_updated` (`hubloc_updated`),
- KEY `hubloc_connected` (`hubloc_connected`)
+ KEY `hubloc_connected` (`hubloc_connected`),
+ KEY `hubloc_status` (`hubloc_status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `issue` (
@@ -444,7 +444,7 @@ CREATE TABLE IF NOT EXISTS `item` (
`resource_id` char(255) NOT NULL DEFAULT '',
`resource_type` char(16) NOT NULL DEFAULT '',
`attach` mediumtext NOT NULL,
- `sig` text NOT NULL DEFAULT '',
+ `sig` text NOT NULL,
`location` char(255) NOT NULL DEFAULT '',
`coord` char(255) NOT NULL DEFAULT '',
`comment_policy` char(255) NOT NULL DEFAULT '',
@@ -500,7 +500,7 @@ CREATE TABLE IF NOT EXISTS `item_id` (
KEY `sid` (`sid`),
KEY `service` (`service`),
KEY `iid` (`iid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -515,6 +515,7 @@ CREATE TABLE IF NOT EXISTS `mail` (
`mid` char(255) NOT NULL,
`parent_mid` char(255) NOT NULL,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `created` (`created`),
KEY `mail_flags` (`mail_flags`),
@@ -523,7 +524,8 @@ CREATE TABLE IF NOT EXISTS `mail` (
KEY `from_xchan` (`from_xchan`),
KEY `to_xchan` (`to_xchan`),
KEY `mid` (`mid`),
- KEY `parent_mid` (`parent_mid`)
+ KEY `parent_mid` (`parent_mid`),
+ KEY `expires` (`expires`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `manage` (
@@ -834,11 +836,11 @@ CREATE TABLE IF NOT EXISTS `site` (
`site_sellpage` char(255) NOT NULL DEFAULT '',
`site_location` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`site_url`),
- KEY `site_access` (`site_access`),
KEY `site_flags` (`site_flags`),
KEY `site_update` (`site_update`),
KEY `site_directory` (`site_directory`),
KEY `site_register` (`site_register`),
+ KEY `site_access` (`site_access`),
KEY `site_sellpage` (`site_sellpage`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -852,7 +854,7 @@ CREATE TABLE IF NOT EXISTS `source` (
KEY `src_channel_id` (`src_channel_id`),
KEY `src_channel_xchan` (`src_channel_xchan`),
KEY `src_xchan` (`src_xchan`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `spam` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -890,7 +892,7 @@ CREATE TABLE IF NOT EXISTS `term` (
KEY `imgurl` (`imgurl`),
KEY `term_hash` (`term_hash`),
KEY `parent_hash` (`parent_hash`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tokens` (
`id` varchar(40) NOT NULL,
@@ -914,13 +916,13 @@ CREATE TABLE IF NOT EXISTS `updates` (
`ud_flags` int(11) NOT NULL DEFAULT '0',
`ud_addr` char(255) NOT NULL DEFAULT '',
PRIMARY KEY (`ud_id`),
- KEY `ud_hash` (`ud_hash`),
- KEY `ud_guid` (`ud_guid`),
KEY `ud_date` (`ud_date`),
+ KEY `ud_guid` (`ud_guid`),
+ KEY `ud_hash` (`ud_hash`),
KEY `ud_flags` (`ud_flags`),
KEY `ud_addr` (`ud_addr`),
KEY `ud_last` (`ud_last`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `verify` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -977,9 +979,8 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_url` (`xchan_url`),
KEY `xchan_flags` (`xchan_flags`),
KEY `xchan_connurl` (`xchan_connurl`),
- KEY `xchan_follow` (`xchan_follow`),
- KEY `xchan_connpage` (`xchan_connpage`),
- KEY `xchan_instance_url` (`xchan_instance_url`)
+ KEY `xchan_instance_url` (`xchan_instance_url`),
+ KEY `xchan_follow` (`xchan_follow`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `xconfig` (
diff --git a/install/update.php b/install/update.php
index 53d487f91..e1fd8c7a4 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1080 );
+define( 'UPDATE_VERSION' , 1081 );
/**
*
@@ -888,3 +888,11 @@ function update_r1079() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1080() {
+ $r = q("ALTER TABLE `mail` ADD `expires` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
+ADD INDEX ( `expires` ) ");
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 08a0bab96..527eb4c50 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -181,8 +181,8 @@ function dirsearch_content(&$a) {
$entry['name'] = $rr['xchan_name'];
$entry['hash'] = $rr['xchan_hash'];
- $entry['updated'] = (($rr['ud_date']) ? $rr['ud_date'] : '0000-00-00 00:00:00');
- $entry['update_guid'] = (($rr['ud_guid']) ? $rr['ud_guid'] : '');
+// $entry['updated'] = (($rr['ud_date']) ? $rr['ud_date'] : '0000-00-00 00:00:00');
+// $entry['update_guid'] = (($rr['ud_guid']) ? $rr['ud_guid'] : '');
$entry['url'] = $rr['xchan_url'];
$entry['photo'] = $rr['xchan_photo_m'];
$entry['address'] = $rr['xchan_addr'];
diff --git a/mod/message.php b/mod/message.php
index a4d73e6b0..e31d903a7 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -40,6 +40,7 @@ function message_post(&$a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_REQUEST,'messageto')) ? notags(trim($_REQUEST['messageto'])) : '');
$rstr = ((x($_REQUEST,'messagerecip')) ? notags(trim($_REQUEST['messagerecip'])) : '');
+ $expires = ((x($_REQUEST,'expires')) ? datetime_convert(date_default_timezone_get(),'UTC', $_REQUEST['expires']) : '0000-00-00 00:00:00');
// If we have a raw string for a recipient which hasn't been auto-filled,
// it means they probably aren't in our address book, hence we don't know
@@ -111,7 +112,7 @@ function message_post(&$a) {
// We have a local_user, let send_message use the session channel and save a lookup
- $ret = send_message(0, $recipient, $body, $subject, $replyto);
+ $ret = send_message(0, $recipient, $body, $subject, $replyto, $expires);
if(! $ret['success']) {
notice($ret['message']);
@@ -322,7 +323,8 @@ function message_content(&$a) {
'$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$wait' => t('Please wait'),
- '$submit' => t('Submit')
+ '$submit' => t('Submit'),
+ '$expires' => t('Expires: (leave blank for never)')
));
return $o;
@@ -463,8 +465,6 @@ function message_content(&$a) {
}
- logger('mails: ' . print_r($mails,true), LOGGER_DATA);
-
$recp = (($message['from_xchan'] === $channel['channel_hash']) ? 'to' : 'from');
// FIXME - move this HTML to template
@@ -498,8 +498,8 @@ function message_content(&$a) {
'$attach' => t('Attach file'),
'$insert' => t('Insert web link'),
'$submit' => t('Submit'),
- '$wait' => t('Please wait')
-
+ '$wait' => t('Please wait'),
+ '$expires' => t('Expires: (leave blank for never)')
));
return $o;
diff --git a/version.inc b/version.inc
index 812f6d03e..0cbb9a0a6 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-11-05.488
+2013-11-06.489
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index 32d33ad70..c5d41d7ba 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -1693,7 +1693,7 @@ tr.mceLast {
}
-#prvmail-to-label, #prvmail-subject-label, #prvmail-message-label {
+#prvmail-to-label, #prvmail-subject-label, #prvmail-expires-label, #prvmail-message-label {
margin-bottom: 10px;
margin-top: 20px;
}
diff --git a/view/tpl/prv_message.tpl b/view/tpl/prv_message.tpl
index d65bc3570..494eec48c 100755
--- a/view/tpl/prv_message.tpl
+++ b/view/tpl/prv_message.tpl
@@ -17,12 +17,15 @@
<div id="prvmail-subject-label">{{$subject}}</div>
<input type="text" size="64" maxlength="255" id="prvmail-subject" name="subject" value="{{$subjtxt}}" {{$readonly}} tabindex="11" />
+<div id="prvmail-expires-label">{{$expires}}</div>
+<input type="text" size="64" maxlength="255" id="prvmail-expires" name="expires" value="" tabindex="12" />
+
<div id="prvmail-message-label">{{$yourmessage}}</div>
-<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="12">{{$text}}</textarea>
+<textarea rows="8" cols="72" class="prvmail-text" id="prvmail-text" name="body" tabindex="13">{{$text}}</textarea>
<div id="prvmail-submit-wrapper" >
- <input type="submit" id="prvmail-submit" name="submit" value="{{$submit}}" tabindex="13" />
+ <input type="submit" id="prvmail-submit" name="submit" value="{{$submit}}" tabindex="14" />
<div id="prvmail-upload-wrapper" >
<i id="prvmail-upload" class="icon-camera jot-icons" title="{{$upload}}"></i>
</div>