From 93d0ef4042bdfe06b77cdbe56ec4e55143e4fc1e Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 2 Aug 2010 19:06:36 -0700 Subject: [PATCH] fixup image on wall --- include/ajaxupload.js | 3 ++- include/items.php | 28 +++++++++++++++------------- mod/dfrn_poll.php | 2 +- mod/wall_upload.php | 7 +++++-- view/jot-header.tpl | 37 +++++++++++++++++++++---------------- view/jot.tpl | 4 ++-- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/include/ajaxupload.js b/include/ajaxupload.js index f0fbfe6c29..ef872b52f8 100644 --- a/include/ajaxupload.js +++ b/include/ajaxupload.js @@ -4,6 +4,7 @@ * Licensed under the MIT license ( http://valums.com/mit-license/ ) * Thanks to Gary Haran, David Mark, Corey Burns and others for contributions. */ + (function () { /* global window */ /* jslint browser: true, devel: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true */ @@ -354,7 +355,7 @@ var input = document.createElement("input"); input.setAttribute('type', 'file'); input.setAttribute('name', this._settings.name); - + addStyles(input, { 'position' : 'absolute', // in Opera only 'browse' button diff --git a/include/items.php b/include/items.php index d160ff1313..e74132c6a7 100644 --- a/include/items.php +++ b/include/items.php @@ -34,12 +34,14 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) { $contact = $r[0]; $groups = init_groups_visitor($contact['id']); - - $gs = '<<>>'; // should be impossible to match if(count($groups)) { - foreach($groups as $g) - $gs .= '|<' . intval($g) . '>'; - } + for($x = 0; $x < count($groups); $x ++) + $groups[$x] = '<' . intval($groups[$x]) . '>' ; + $gs = implode('|', $groups); + } + else + $gs = '<<>>' ; // Impossible to match + $sql_extra = sprintf( " AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' ) AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' ) @@ -158,7 +160,7 @@ function get_atom_elements($item) { if($maxlen && (strlen($res['body']) > $maxlen)) $res['body'] = substr($res['body'],0, $maxlen); - $allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow'); + $allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow'); if($allow && $allow[0]['data'] == 1) $res['last-child'] = 1; else @@ -172,13 +174,13 @@ function get_atom_elements($item) { if($rawedited) $res['edited'] = unxmlify($rawcreated[0]['data']); - $rawowner = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0', 'owner'); - if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']) - $res['owner-name'] = unxmlify($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']); - if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']) - $res['owner-link'] = unxmlify($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']); - if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']) - $res['owner-avatar'] = unxmlify($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']); + $rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner'); + if($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']) + $res['owner-name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']); + if($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']) + $res['owner-link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']); + if($rawowner[0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']) + $res['owner-avatar'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']); return $res; } diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index e3da6c9526..dadcd31487 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -19,7 +19,7 @@ function dfrn_poll_init(&$a) { return; - if(($dfrn_id == '*') && ($a->argc > 1) && (intval($a->argv[1]))) { + if(($dfrn_id == '*') && ($a->argc > 1)) { $o = get_feed_for($a,'*', $a->argv[1],$last_update); echo $o; killme(); diff --git a/mod/wall_upload.php b/mod/wall_upload.php index d2e7325456..bd7cf85603 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -9,6 +9,9 @@ function wall_upload_post(&$a) { killme(); } + if(! x($_FILES,'userfile')) + killme(); + $src = $_FILES['userfile']['tmp_name']; $filename = basename($_FILES['userfile']['name']); $filesize = intval($_FILES['userfile']['size']); @@ -87,8 +90,8 @@ function wall_upload_post(&$a) { } $basename = basename($filename); + echo "

get_baseurl(). "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" />

"; - echo "get_baseurl(). "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" />"; killme(); - + return; // NOTREACHED } \ No newline at end of file diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 34837d075f..fc05a40be1 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -1,7 +1,6 @@ - - + - \ No newline at end of file diff --git a/view/jot.tpl b/view/jot.tpl index 24b6babcb9..9e9ab64680 100644 --- a/view/jot.tpl +++ b/view/jot.tpl @@ -16,8 +16,8 @@ What's on your mind?
Upload Photo
-