fixup image on wall

This commit is contained in:
Mike Macgirvin 2010-08-02 19:06:36 -07:00
parent 3fd4b4264e
commit 93d0ef4042
6 changed files with 46 additions and 35 deletions

View File

@ -4,6 +4,7 @@
* Licensed under the MIT license ( http://valums.com/mit-license/ ) * Licensed under the MIT license ( http://valums.com/mit-license/ )
* Thanks to Gary Haran, David Mark, Corey Burns and others for contributions. * Thanks to Gary Haran, David Mark, Corey Burns and others for contributions.
*/ */
(function () { (function () {
/* global window */ /* global window */
/* jslint browser: true, devel: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true */ /* jslint browser: true, devel: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true */

View File

@ -34,12 +34,14 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) {
$contact = $r[0]; $contact = $r[0];
$groups = init_groups_visitor($contact['id']); $groups = init_groups_visitor($contact['id']);
$gs = '<<>>'; // should be impossible to match
if(count($groups)) { if(count($groups)) {
foreach($groups as $g) for($x = 0; $x < count($groups); $x ++)
$gs .= '|<' . intval($g) . '>'; $groups[$x] = '<' . intval($groups[$x]) . '>' ;
$gs = implode('|', $groups);
} }
else
$gs = '<<>>' ; // Impossible to match
$sql_extra = sprintf( $sql_extra = sprintf(
" AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' ) " AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' )
AND ( `deny_cid` = '' OR NOT `deny_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)) if($maxlen && (strlen($res['body']) > $maxlen))
$res['body'] = substr($res['body'],0, $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) if($allow && $allow[0]['data'] == 1)
$res['last-child'] = 1; $res['last-child'] = 1;
else else
@ -172,13 +174,13 @@ function get_atom_elements($item) {
if($rawedited) if($rawedited)
$res['edited'] = unxmlify($rawcreated[0]['data']); $res['edited'] = unxmlify($rawcreated[0]['data']);
$rawowner = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0', 'owner'); $rawowner = $item->get_item_tags(NAMESPACE_DFRN, 'owner');
if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']) if($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data'])
$res['owner-name'] = unxmlify($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['name'][0]['data']); $res['owner-name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']);
if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']) if($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data'])
$res['owner-link'] = unxmlify($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['uri'][0]['data']); $res['owner-link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']);
if($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']) if($rawowner[0]['child'][NAMESPACE_DFRN]['avatar'][0]['data'])
$res['owner-avatar'] = unxmlify($rawowner[0]['child']['http://purl.org/macgirvin/dfrn/1.0']['avatar'][0]['data']); $res['owner-avatar'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']);
return $res; return $res;
} }

View File

@ -19,7 +19,7 @@ function dfrn_poll_init(&$a) {
return; 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); $o = get_feed_for($a,'*', $a->argv[1],$last_update);
echo $o; echo $o;
killme(); killme();

View File

@ -9,6 +9,9 @@ function wall_upload_post(&$a) {
killme(); killme();
} }
if(! x($_FILES,'userfile'))
killme();
$src = $_FILES['userfile']['tmp_name']; $src = $_FILES['userfile']['tmp_name'];
$filename = basename($_FILES['userfile']['name']); $filename = basename($_FILES['userfile']['name']);
$filesize = intval($_FILES['userfile']['size']); $filesize = intval($_FILES['userfile']['size']);
@ -87,8 +90,8 @@ function wall_upload_post(&$a) {
} }
$basename = basename($filename); $basename = basename($filename);
echo "<br /><br /><img src=\"".$a->get_baseurl(). "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" /><br /><br />";
echo "<img src=\"".$a->get_baseurl(). "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" />";
killme(); killme();
return; // NOTREACHED
} }

View File

@ -1,7 +1,6 @@
<script language="javascript" type="text/javascript" <script language="javascript" type="text/javascript" src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script> <script language="javascript" type="text/javascript">
<script language="javascript" type="text/javascript">
tinyMCE.init({ tinyMCE.init({
theme : "advanced", theme : "advanced",
@ -18,6 +17,7 @@ tinyMCE.init({
entity_encoding : "raw", entity_encoding : "raw",
add_unload_trigger : false, add_unload_trigger : false,
remove_linebreaks : false, remove_linebreaks : false,
convert_urls: false,
content_css: "$baseurl/view/custom_tinymce.css" content_css: "$baseurl/view/custom_tinymce.css"
}); });
@ -31,7 +31,7 @@ tinyMCE.init({
name: 'userfile', name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) { onComplete: function(file,response) {
tinyMCE.execCommand('mceInsertRawHTML',false,response); alert(response); tinyMCE.execCommand('mceInsertRawHTML',false,response);
$('#profile-rotator').hide(); $('#profile-rotator').hide();
} }
} }
@ -39,7 +39,6 @@ tinyMCE.init({
}); });
function jotGetLink() { function jotGetLink() {
reply = prompt("Please enter a link URL:"); reply = prompt("Please enter a link URL:");
if(reply && reply.length) { if(reply && reply.length) {
@ -51,18 +50,24 @@ tinyMCE.init({
} }
} }
function linkdropper(event) {
var linkFound = event.dataTransfer.types.contains("text/uri-list");
if(linkFound)
event.preventDefault();
}
function linkdrop(event) {
var reply = event.dataTransfer.getData("text/uri-list");
event.target.textContent = reply;
event.preventDefault();
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
$('#profile-rotator').hide();
});
}
}
</script> </script>
<!--
relative_urls: false,
document_base_url : "$baseurl/",
external_image_list_url : "$baseurl/include/imagelist-js.php",
content_css : "$baseurl/view/tiny.css"
});
</script>
-->

View File

@ -16,8 +16,8 @@ What's on your mind?
<div id="profile-upload-wrapper" style="display: $visitor;" > <div id="profile-upload-wrapper" style="display: $visitor;" >
<div id="wall-image-upload-div" ><img id="wall-image-upload" src="images/camera-icon.gif" alt="Upload Photo" title="Upload Photo" /></div> <div id="wall-image-upload-div" ><img id="wall-image-upload" src="images/camera-icon.gif" alt="Upload Photo" title="Upload Photo" /></div>
</div> </div>
<div id="profile-link-wrapper" style="display: $visitor;" > <div id="profile-link-wrapper" style="display: $visitor;" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" >
<img id="profile-link" src="images/link-icon.gif" alt="Insert web link" title="Insert web link" onclick="jotGetLink();" /> <img id="profile-link" src="images/link-icon.gif" alt="Insert web link" title="Insert web link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" />
</div> </div>
<div id="profile-rotator-wrapper" style="display: $visitor;" > <div id="profile-rotator-wrapper" style="display: $visitor;" >
<img id="profile-rotator" src="images/rotator.gif" alt="Please wait" title="Please wait" style="display: none;" /> <img id="profile-rotator" src="images/rotator.gif" alt="Please wait" title="Please wait" style="display: none;" />