diff options
Diffstat (limited to 'mod')
-rwxr-xr-x | mod/dfrn_poll.php | 1 | ||||
-rwxr-xr-x | mod/item.php | 15 | ||||
-rwxr-xr-x | mod/redir.php | 79 | ||||
-rwxr-xr-x | mod/settings.php | 2 | ||||
-rwxr-xr-x | mod/wall_attach.php | 2 |
5 files changed, 56 insertions, 43 deletions
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` ) |