aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php2
-rwxr-xr-xinclude/attach.php14
-rwxr-xr-xinclude/expire.php5
-rwxr-xr-xmod/dfrn_poll.php1
-rwxr-xr-xmod/item.php15
-rwxr-xr-xmod/redir.php79
-rwxr-xr-xmod/settings.php2
-rwxr-xr-xmod/wall_attach.php2
8 files changed, 70 insertions, 50 deletions
diff --git a/boot.php b/boot.php
index c2c99a55e..4fb433fea 100755
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
-define ( 'FRIENDICA_VERSION', '2.3.1237' );
+define ( 'FRIENDICA_VERSION', '2.3.1240' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1118 );
diff --git a/include/attach.php b/include/attach.php
index 4001d2af1..6d611cec0 100755
--- a/include/attach.php
+++ b/include/attach.php
@@ -38,6 +38,7 @@ function z_mime_content_type($filename) {
// audio/video
'mp3' => 'audio/mpeg',
+ 'wav' => 'audio/wav',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'ogg' => 'application/ogg',
@@ -68,12 +69,13 @@ function z_mime_content_type($filename) {
return $mime_types[$ext];
}
}
- elseif (function_exists('finfo_open')) {
- $finfo = finfo_open(FILEINFO_MIME);
- $mimetype = finfo_file($finfo, $filename);
- finfo_close($finfo);
- return $mimetype;
- }
+// can't use this because we're just passing a name, e.g. not a file that can be opened
+// elseif (function_exists('finfo_open')) {
+// $finfo = @finfo_open(FILEINFO_MIME);
+// $mimetype = @finfo_file($finfo, $filename);
+// @finfo_close($finfo);
+// return $mimetype;
+// }
else {
return 'application/octet-stream';
}
diff --git a/include/expire.php b/include/expire.php
index 64dbe2536..7608b9054 100755
--- a/include/expire.php
+++ b/include/expire.php
@@ -29,6 +29,11 @@ function expire_run($argv, $argc){
$a->set_baseurl(get_config('system','url'));
+ // physically remove anything that has been deleted from more than two months
+
+ $r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY");
+
+
logger('expire: start');
$r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 09f198b81..b12e07132 100755
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -86,6 +86,7 @@ function dfrn_poll_init(&$a) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['id'];
$_SESSION['visitor_home'] = $r[0]['url'];
+ $_SESSION['visitor_handle'] = $r[0]['addr'];
$_SESSION['visitor_visiting'] = $r[0]['uid'];
info( sprintf(t('%s welcomes %s'), $r[0]['username'] , $r[0]['name']) . EOL);
// Visitors get 1 day session.
diff --git a/mod/item.php b/mod/item.php
index ed3d7749c..99c01c54f 100755
--- a/mod/item.php
+++ b/mod/item.php
@@ -4,7 +4,7 @@
*
* This is the POST destination for most all locally posted
* text stuff. This function handles status, wall-to-wall status,
- * local comments, and remote coments - that are posted on this site
+ * local comments, and remote coments that are posted on this site
* (as opposed to being delivered in a feed).
* Also processed here are posts and comments coming through the
* statusnet/twitter API.
@@ -42,6 +42,7 @@ function item_post(&$a) {
$api_source = ((x($_REQUEST,'api_source') && $_REQUEST['api_source']) ? true : false);
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
+ $preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
/**
* Is this a reply to something?
@@ -56,8 +57,6 @@ function item_post(&$a) {
$parid = 0;
$r = false;
- $preview = ((x($_REQUEST,'preview')) ? intval($_REQUEST['preview']) : 0);
-
if($parent || $parent_uri) {
if(! x($_REQUEST,'type'))
@@ -110,8 +109,6 @@ function item_post(&$a) {
if($parent) logger('mod_post: parent=' . $parent);
-
-
$profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0);
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : '');
@@ -606,6 +603,7 @@ function item_post(&$a) {
$datarray['thr-parent'] = $thr_parent;
$datarray['postopts'] = '';
$datarray['origin'] = $origin;
+ $datarray['moderated'] = $allow_moderated;
/**
* These fields are for the convenience of plugins...
@@ -657,8 +655,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin` )
- VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d )",
+ `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated` )
+ VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -695,7 +693,8 @@ function item_post(&$a) {
intval($datarray['pubmail']),
dbesc($datarray['attach']),
intval($datarray['bookmark']),
- intval($datarray['origin'])
+ intval($datarray['origin']),
+ intval($datarry['moderated'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
diff --git a/mod/redir.php b/mod/redir.php
index eb9702b04..9223e5483 100755
--- a/mod/redir.php
+++ b/mod/redir.php
@@ -2,44 +2,59 @@
function redir_init(&$a) {
- if((! local_user()) || (! ($a->argc == 2)) || (! intval($a->argv[1])))
- goaway(z_root());
- $cid = $a->argv[1];
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
- $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($cid),
- intval(local_user())
- );
+ // traditional DFRN
- if((! count($r)) || ($r[0]['network'] !== 'dfrn'))
- goaway(z_root());
+ if(local_user() && $a->argc == 2 && intval($a->argv[1])) {
- $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
+ $cid = $a->argv[1];
- if($r[0]['duplex'] && $r[0]['issued-id']) {
- $orig_id = $r[0]['issued-id'];
- $dfrn_id = '1:' . $orig_id;
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($cid),
+ intval(local_user())
+ );
+
+ if((! count($r)) || ($r[0]['network'] !== NETWORK_DFRN))
+ goaway(z_root());
+
+ $dfrn_id = $orig_id = (($r[0]['issued-id']) ? $r[0]['issued-id'] : $r[0]['dfrn-id']);
+
+ if($r[0]['duplex'] && $r[0]['issued-id']) {
+ $orig_id = $r[0]['issued-id'];
+ $dfrn_id = '1:' . $orig_id;
+ }
+ if($r[0]['duplex'] && $r[0]['dfrn-id']) {
+ $orig_id = $r[0]['dfrn-id'];
+ $dfrn_id = '0:' . $orig_id;
+ }
+
+ $sec = random_string();
+
+ q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)
+ VALUES( %d, %s, '%s', '%s', %d )",
+ intval(local_user()),
+ intval($cid),
+ dbesc($dfrn_id),
+ dbesc($sec),
+ intval(time() + 45)
+ );
+
+ logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
+ $dest = (($url) ? '&destination_url=' . $url : '');
+ goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
+ . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );
}
- if($r[0]['duplex'] && $r[0]['dfrn-id']) {
- $orig_id = $r[0]['dfrn-id'];
- $dfrn_id = '0:' . $orig_id;
+
+ if(local_user())
+ $handle = $a->user['nickname'] . '@' . substr($a->get_baseurl(),strpos($a->get_baseurl(),'://')+3);
+ if(remote_user())
+ $handle = $_SESSION['handle'];
+
+ if($url) {
+ $url = str_replace('{zid}','&zid=' . $handle,$url);
+ goaway($url);
}
- $sec = random_string();
-
- q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)
- VALUES( %d, %s, '%s', '%s', %d )",
- intval(local_user()),
- intval($cid),
- dbesc($dfrn_id),
- dbesc($sec),
- intval(time() + 45)
- );
-
- logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
- $dest = (($url) ? '&destination_url=' . $url : '');
- goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
- . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );
-
+ goaway(z_root());
}
diff --git a/mod/settings.php b/mod/settings.php
index c61d5c227..e75272539 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -757,7 +757,7 @@ 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')),
+ 'days' => array('expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')),
'advanced' => t('Advanced expiration settings'),
'label' => t('Advanced Expiration'),
'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'),t('Yes'))),
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index a66ed0d05..ecf475291 100755
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -61,8 +61,6 @@ function wall_attach_post(&$a) {
$filedata = @file_get_contents($src);
$mimetype = z_mime_content_type($filename);
- if(((! strlen($mimetype)) || ($mimetype === 'application/octet-stream')) && function_exists('mime_content_type'))
- $mimetype = mime_content_type($filename);
$hash = random_string();
$created = datetime_convert();
$r = q("INSERT INTO `attach` ( `uid`, `hash`, `filename`, `filetype`, `filesize`, `data`, `created`, `edited`, `allow_cid`, `allow_gid`,`deny_cid`, `deny_gid` )