aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--images/pen.pngbin0 -> 252 bytes
-rw-r--r--images/penhover.pngbin0 -> 270 bytes
-rw-r--r--mod/parse_url.php32
-rw-r--r--mod/wall_upload.php88
-rw-r--r--view/jot-header.tpl20
-rw-r--r--view/jot.tpl6
-rw-r--r--view/style.css11
-rw-r--r--view/wall_item.tpl3
8 files changed, 148 insertions, 12 deletions
diff --git a/images/pen.png b/images/pen.png
new file mode 100644
index 000000000..46b404941
--- /dev/null
+++ b/images/pen.png
Binary files differ
diff --git a/images/penhover.png b/images/penhover.png
new file mode 100644
index 000000000..be48d77b4
--- /dev/null
+++ b/images/penhover.png
Binary files differ
diff --git a/mod/parse_url.php b/mod/parse_url.php
new file mode 100644
index 000000000..33381a0d2
--- /dev/null
+++ b/mod/parse_url.php
@@ -0,0 +1,32 @@
+<?php
+
+require_once('library/HTML5/Parser.php');
+
+function parse_url_content(&$a) {
+ $url = trim($_GET['url']);
+
+ $template = "<a href=\"%s\" >%s</a>";
+
+ if($url)
+ $s = fetch_url($url);
+
+ if(! $s) {
+ echo sprintf($template,$url,$url);
+ killme();
+ }
+
+ $dom = HTML5_Parser::parse($s);
+
+ if(! $dom)
+ return $ret;
+
+ $items = $dom->getElementsByTagName('title');
+
+ foreach($items as $item) {
+ $title = $item->textContent;
+ break;
+ }
+
+ echo sprintf($template,$url,$title);
+ killme();
+} \ No newline at end of file
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 769e5dcbc..d74eae302 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -1,16 +1,98 @@
<?php
+require_once('Photo.php');
function wall_upload_post(&$a) {
+ if(! local_user()) {
+ notice ( "Permission denied." . EOL );
+ return;
+ }
- $src = $_FILES['userfile']['tmp_name'];
+ $src = $_FILES['userfile']['tmp_name'];
+ $filename = basename($_FILES['userfile']['name']);
+ $filesize = intval($_FILES['userfile']['size']);
+ $imagedata = @file_get_contents($src);
+ $ph = new Photo($imagedata);
-unlink($src);
+ if(! ($image = $ph->getImage())) {
+ notice("Unable to process image." . EOL);
+ @unlink($src);
+ return;
+ }
+ @unlink($src);
- echo "<img src=\"".$a->get_baseurl(). "/images/default-profile.jpg\" alt=\"default\" />";
+ $width = $ph->getWidth();
+ $height = $ph->getHeight();
+
+ $hash = hash('md5',uniqid(mt_rand(),true));
+
+ $str_image = $ph->imageString();
+ $smallest = 0;
+
+ $r = q("INSERT INTO `photo` ( `uid`, `resource-id`, `created`, `edited`, `filename`,
+ `height`, `width`, `data`, `scale` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', %d, %d, '%s', 0 )",
+ intval($_SESSION['uid']),
+ dbesc($hash),
+ datetime_convert(),
+ datetime_convert(),
+ dbesc(basename($filename)),
+ intval($height),
+ intval($width),
+ dbesc($str_image));
+ if($r)
+ notice("Image uploaded successfully." . EOL);
+ else
+ notice("Image upload failed." . EOL);
+
+ if($width > 640 || $height > 640) {
+ $ph->scaleImage(640);
+
+ $r = q("INSERT INTO `photo` ( `uid`, `resource-id`, `created`, `edited`, `filename`,
+ `height`, `width`, `data`, `scale` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', %d, %d, '%s', 1 )",
+ intval($_SESSION['uid']),
+ dbesc($hash),
+ datetime_convert(),
+ datetime_convert(),
+ dbesc(basename($filename)),
+ intval($ph->getHeight()),
+ intval($ph->getWidth()),
+ dbesc($ph->imageString())
+ );
+ if($r === false)
+ notice("Image size reduction (640) failed." . EOL );
+ else
+ $smallest = 1;
+ }
+
+ if($width > 320 || $height > 320) {
+ $ph->scaleImage(320);
+
+ $r = q("INSERT INTO `photo` ( `uid`, `resource-id`, `created`, `edited`, `filename`,
+ `height`, `width`, `data`, `scale` )
+ VALUES ( %d, '%s', '%s', '%s', '%s', %d, %d, '%s', 2 )",
+ intval($_SESSION['uid']),
+ dbesc($hash),
+ datetime_convert(),
+ datetime_convert(),
+ dbesc(basename($filename)),
+ intval($ph->getHeight()),
+ intval($ph->getWidth()),
+ dbesc($ph->imageString())
+ );
+ if($r === false)
+ notice("Image size reduction (320) failed." . EOL );
+ else
+ $smallest = 2;
+ }
+
+ $basename = basename($filename);
+
+ echo "<img src=\"".$a->get_baseurl(). "/photo/{$hash}-{$smallest}.jpg\" alt=\"$basename\" />";
killme();
} \ No newline at end of file
diff --git a/view/jot-header.tpl b/view/jot-header.tpl
index 97e30cdae..3f8fe5302 100644
--- a/view/jot-header.tpl
+++ b/view/jot-header.tpl
@@ -27,16 +27,28 @@ tinyMCE.init({
var uploader = new window.AjaxUpload(
'wall-image-upload',
{ action: 'wall_upload',
- name: 'userfile',
- onComplete: function(file,response) {
- tinyMCE.execCommand('mceInsertRawHTML',false,response);
- }
+ name: 'userfile',
+ onSubmit: function(file,ext) { $('#profile-rotator').show(); },
+ onComplete: function(file,response) {
+ tinyMCE.execCommand('mceInsertRawHTML',false,response);
+ $('#profile-rotator').hide();
+ }
}
);
});
+ function jotGetLink() {
+ reply = prompt("Please enter a link URL:");
+ $('#profile-rotator').show();
+ $.get('parse_url?url=' + reply, function(data) {
+ tinyMCE.execCommand('mceInsertRawHTML',false,data);
+ $('#profile-rotator').hide();
+ });
+ }
+
+
</script>
<!--
diff --git a/view/jot.tpl b/view/jot.tpl
index 695ac19e0..24b6babcb 100644
--- a/view/jot.tpl
+++ b/view/jot.tpl
@@ -17,9 +17,11 @@ What's on your mind?
<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" />
+ <img id="profile-link" src="images/link-icon.gif" alt="Insert web link" title="Insert web link" 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;" />
</div>
-
<div id="profile-jot-perms" class="profile-jot-perms" style="display: $visitor;" ><img src="images/$lockstate_icon.gif" alt="Permission Settings" title="Permission Settings" onClick="openClose('profile-jot-acl-wrapper');" /></div>
<div id="profile-jot-perms-end"></div>
<div id="profile-jot-acl-wrapper" style="display: none;" >$acl</div>
diff --git a/view/style.css b/view/style.css
index faf1a091c..2fd5db1fb 100644
--- a/view/style.css
+++ b/view/style.css
@@ -493,6 +493,11 @@ input#dfrn-url {
.wall-item-photo {
border: none;
}
+.wall-item-body {
+ float: left;
+ margin-top: 30px;
+ margin-left: 10px;
+}
.comment-edit-wrapper {
margin-top: 15px;
@@ -517,6 +522,10 @@ input#dfrn-url {
margin-left: 50px;
}
+#profile-rotator {
+ float: left;
+ margin-left: 50px;
+}
#profile-link-wrapper {
float: left;
margin-left: 20px;
@@ -524,7 +533,7 @@ input#dfrn-url {
#profile-jot-perms {
float: left;
- margin-left: 280px;
+ margin-left: 250px;
}
#profile-jot-perms-end {
diff --git a/view/wall_item.tpl b/view/wall_item.tpl
index 3babc8ead..56e182761 100644
--- a/view/wall_item.tpl
+++ b/view/wall_item.tpl
@@ -5,10 +5,9 @@
</div>
<div class="wall-item-wrapper" id="wall-item-wrapper-$id" >
<a href="$profile_url" title="View $name's profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-$id" >$name</span></a>
-<span class="wall-item-body" id="wall-item-body-$id" >$body</span>
<div class="wall-item-ago" id="wall-item-ago-$id">$ago</div>
-
</div>
+<span class="wall-item-body" id="wall-item-body-$id" >$body</span>
<div class="wall-item-wrapper-end"></div>
<div class="wall-item-comment-separator"></div>
$comment