]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'pull'
authorfriendica <info@friendica.com>
Mon, 30 Jan 2012 23:14:41 +0000 (15:14 -0800)
committerfriendica <info@friendica.com>
Mon, 30 Jan 2012 23:14:41 +0000 (15:14 -0800)
boot.php
include/attach.php
include/expire.php
mod/dfrn_poll.php
mod/item.php
mod/redir.php
mod/settings.php
mod/wall_attach.php

index c2c99a55ec953391661cb1ac499817748dc3f4f8..4fb433fea2518abcd215d805faee4514221188d5 100755 (executable)
--- 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      );
 
index 4001d2af1351bd7f92714ad3263357365b3eee46..6d611cec0418534ce50f80bae09c0c3d7189587f 100755 (executable)
@@ -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';
        }
index 64dbe2536d4d880294f8060bd6e1b684d1af83df..7608b905467f0f83a90c634bc5f72a081cf0199a 100755 (executable)
@@ -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");
index 09f198b81465dc33a4cf3a87161b4bfd9734c114..b12e0713285a2b59ebe595558a8a69e1f9a4e6a9 100755 (executable)
@@ -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.
index ed3d7749c6c6b812b5b12a5272ae7c53fcaef9c4..99c01c54fd6c160e0e2fd85f96db82e0e1195541 100755 (executable)
@@ -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",
index eb9702b0415a31525b5d0e68f691f68f0c207a1a..9223e5483c0c5b816485e8c7dd62ac88402bf3ca 100755 (executable)
@@ -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());
 }
index c61d5c227a66f10f63a7a96d40941f74d860892f..e75272539d1dc16d497196f200e81429f1b9be55 100755 (executable)
@@ -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'))),
index a66ed0d059c6d36970d0f77ff2796541e68a301a..ecf4752915f22a85abee826d9534122433a38fcb 100755 (executable)
@@ -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` )