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/ )
* 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 */

View File

@ -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;
}

View File

@ -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();

View File

@ -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 "<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();
return; // NOTREACHED
}

View File

@ -1,6 +1,5 @@
<script language="javascript" type="text/javascript"
src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript" src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
@ -18,6 +17,7 @@ tinyMCE.init({
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
convert_urls: false,
content_css: "$baseurl/view/custom_tinymce.css"
});
@ -31,7 +31,7 @@ tinyMCE.init({
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
tinyMCE.execCommand('mceInsertRawHTML',false,response);
alert(response); tinyMCE.execCommand('mceInsertRawHTML',false,response);
$('#profile-rotator').hide();
}
}
@ -39,7 +39,6 @@ tinyMCE.init({
});
function jotGetLink() {
reply = prompt("Please enter a link URL:");
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();
}
</script>
<!--
relative_urls: false,
document_base_url : "$baseurl/",
external_image_list_url : "$baseurl/include/imagelist-js.php",
content_css : "$baseurl/view/tiny.css"
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>
-->

View File

@ -16,8 +16,8 @@ What's on your mind?
<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>
<div id="profile-link-wrapper" style="display: $visitor;" >
<img id="profile-link" src="images/link-icon.gif" alt="Insert web link" title="Insert web link" onclick="jotGetLink();" />
<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" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" />
</div>
<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;" />