From 2c4312012995aa3411cf5e5dbd0eb934a0801797 Mon Sep 17 00:00:00 2001 From: Simon L'nu Date: Sun, 25 Mar 2012 03:22:16 -0400 Subject: dispy-dark not experimental. start implementing fpostit Signed-off-by: Simon L'nu --- view/theme/dispy/fpostit/README | 8 ++ view/theme/dispy/fpostit/fpostit.js | 14 ++++ view/theme/dispy/fpostit/fpostit.php | 134 ++++++++++++++++++++++++++++++ view/theme/dispy/fpostit/friendica-32.png | Bin 0 -> 1593 bytes view/theme/dispy/fpostit/friendika-32.png | Bin 0 -> 1593 bytes 5 files changed, 156 insertions(+) create mode 100644 view/theme/dispy/fpostit/README create mode 100755 view/theme/dispy/fpostit/fpostit.js create mode 100644 view/theme/dispy/fpostit/fpostit.php create mode 100644 view/theme/dispy/fpostit/friendica-32.png create mode 100644 view/theme/dispy/fpostit/friendika-32.png (limited to 'view/theme/dispy/fpostit') diff --git a/view/theme/dispy/fpostit/README b/view/theme/dispy/fpostit/README new file mode 100644 index 000000000..39b7c5761 --- /dev/null +++ b/view/theme/dispy/fpostit/README @@ -0,0 +1,8 @@ +fpostit + +original author: Devlon Duthied + +see his blog posting: +http://blog.duthied.com/2011/09/13/node-agnostic-friendika-bookmarklet/ + +original published at github https://github.com/duthied/Friendika-Bookmarklet diff --git a/view/theme/dispy/fpostit/fpostit.js b/view/theme/dispy/fpostit/fpostit.js new file mode 100755 index 000000000..d18f5d345 --- /dev/null +++ b/view/theme/dispy/fpostit/fpostit.js @@ -0,0 +1,14 @@ +javascript: (function() { + the_url = 'view/theme/dispy/fpostit/fpostit.php?url=' + encodeURIComponent(window.location.href) + '&title=' + encodeURIComponent(document.title) + '&text=' + + encodeURIComponent(''+(window.getSelection ? window.getSelection() : document.getSelection ? + document.getSelection() : document.selection.createRange().text)); + a_funct = function() { + if (!window.open(the_url, 'fpostit','location=yes,links=no,scrollbars=no,toolbar=no,width=600,height=300')) { + location.href = the_url + }; + if (/Firefox/.test(navigator.userAgent)) { + setTimeout(a_funct, 0) + } else { + a_funct(); + } + })();" diff --git a/view/theme/dispy/fpostit/fpostit.php b/view/theme/dispy/fpostit/fpostit.php new file mode 100644 index 000000000..d00182946 --- /dev/null +++ b/view/theme/dispy/fpostit/fpostit.php @@ -0,0 +1,134 @@ + + + + + + + + $content); + + // echo "posting to: $url
"; + + $c = curl_init(); + curl_setopt($c, CURLOPT_URL, $url); + curl_setopt($c, CURLOPT_USERPWD, "$username:$password"); + curl_setopt($c, CURLOPT_POSTFIELDS, $data); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); + $c_result = curl_exec($c); + if(curl_errno($c)){ + $error = curl_error($c); + showForm($error, $content); + } + + curl_close($c); + if (!isset($error)) { + echo ''; + } + + } else { + $error = "Missing account name and/or password. Please try again."; + showForm($error, $content); + } + +} else { + showForm(null, $content); +} + +function showForm($error, $content) { + $username_cookie = $_COOKIE['username']; + $password_cookie = $_COOKIE['password']; + + echo << +

Friendica Bookmarklet

+ + +
+
+ Enter the email address of the Friendica Account that you want to cross-post to: (example: user@friendica.org)

+ Account ID:
+ Password:
+
+   $error +
+

+
+EOF; + +} +?> + + + diff --git a/view/theme/dispy/fpostit/friendica-32.png b/view/theme/dispy/fpostit/friendica-32.png new file mode 100644 index 000000000..61764bf20 Binary files /dev/null and b/view/theme/dispy/fpostit/friendica-32.png differ diff --git a/view/theme/dispy/fpostit/friendika-32.png b/view/theme/dispy/fpostit/friendika-32.png new file mode 100644 index 000000000..61764bf20 Binary files /dev/null and b/view/theme/dispy/fpostit/friendika-32.png differ -- cgit v1.2.3