Permalink
Browse files

public commit

  • Loading branch information...
0 parents commit 089208be33ef34fc8a10fac285bb057fc35e081a @garrettmurray committed Feb 25, 2009
Showing with 502 additions and 0 deletions.
  1. +65 −0 README.markdown
  2. +9 −0 _conf.php
  3. +98 −0 bookmarklet.php
  4. BIN img/icon.gif
  5. +133 −0 index.php
  6. +119 −0 lib/quickbite.php
  7. +78 −0 lib/xmlparser.php
@@ -0,0 +1,65 @@
+quickbite
+=========
+
+A faster way to add bookmarks to Del.icio.us. Written by Garrett Murray.
+
+FEATURES
+--------
+
+* It's fast! Add a page to Del.icio.us without having to fill out any forms.
+* If you select text on the page you're about to bookmark, it will automatically be added as
+the notes for the mark.
+* All bookmarks added with quickbite will be tagged "quickbite" allowing you to quickly view
+everything you've added via this tool.
+
+INSTALL
+-------
+
+* Add appropriate settings in `conf.php`
+* Upload `quickbite` dir to your server somewhere
+* Generate your bookmarklet by visiting the location you uploaded to + `/bookmarklet.php`
+* DELETE OR RENAME THE `bookmarklet.php` FILE TO SOMETHING CRYPTIC! THIS IS VERY IMPORTANT!
+
+You're done!
+
+UPDATES
+-------
+
+Code is hosted at GitHub: [http://github.com/garrettmurray/quickbite](http://github.com/garrettmurray/quickbite)
+Author writes nonsense at Maniacal Rage: [http://maniacalrage.net](http://maniacalrage.net)
+
+LICENSE
+-------
+
+This project uses selected code originally written by Edward Eliot for the
+PhpDelicious project (http://www.phpdelicious.com/). Because of this, Edward
+is included in licensing notes where appropriate.
+
+Software License Agreement (BSD License)
+
+Copyright (C) 2005-2008, Edward Eliot.
+Copyright (C) 2009, Garrett Murray.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of Edward Eliot nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission of Edward Eliot.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,9 @@
+<?php
+
+// username and password
+define('DELICIOUS_USER', '');
+define('DELICIOUS_PASS', '');
+// share bookmarks you create with this tool?
+define('SHARE_BOOKMARKS', false);
+// overwrite bookmarks with the same URL?
+define('OVERWRITE_DUPLICATES', true);
@@ -0,0 +1,98 @@
+<?php
+
+// License
+// -------
+//
+// Software License Agreement (BSD License)
+//
+// Copyright (C) 2009, Garrett Murray.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of Edward Eliot nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission of Edward Eliot.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+require('_conf.php');
+$current_url = 'http://'.$_SERVER['HTTP_HOST'].(str_replace('bookmarklet.php', '', $_SERVER['REQUEST_URI']));
+$current_url .= (substr($current_url, -1) == '/' ? '' : '/');
+
+?>
+<?= '<'.'?xml version="1.0" encoding="UTF-8"'.'?'.'>'; ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>Create Bookmarklet</title>
+ <style type="text/css" media="screen">
+ body {
+ background-color: #fff;
+ margin: 30px;
+ padding: 0;
+ font: 14px/18px HelveticaNeue, "Helvetica Neue", Helvetica, Arial, Sans-serif;
+ color: #3e3e3e;
+ }
+ h1 {
+ margin: 0;
+ padding: 0;
+ font-size: 18px;
+ margin: 14px 0 0 0;
+ }
+ #wrapper {
+ width: 500px;
+ }
+ .large {
+ font-size: 18px;
+ font-weight: bold;
+ margin-left: 10px;
+ }
+ .credit {
+ font-size: 12px;
+ color: gray;
+ margin-top: 60px;
+ }
+ .imp {
+ color: red;
+ margin-top: 40px;
+ }
+ </style>
+</head>
+
+<body>
+
+ <div id="wrapper">
+
+ <h1>Grab the Bookmarklet</h1>
+
+ <p>We think quickbite is installed at: <b><?= $current_url; ?></b>. If that's incorrect, you'll need to modify the code in this bookmarklet appropriately.</p>
+
+ <p><b>Drag this bookmarklet to your browser's bookmarks bar:</b> <a class="large" href="javascript:window.open('<?= $current_url ?>?z=1&desc='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text)).replace(/ /g,'+')+'&mp=<?= md5(DELICIOUS_PASS) ?>&tags=quickbite&u=<?= DELICIOUS_USER ?>&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'','Saving to Del.icio.us...','toolbar=0,resizable=0,status=1,width=240,height=140')">quickbite</a></p>
+
+ <p class="imp"><b>NOTE:</b> When you're done with this file, please either delete it or rename it to something cryptic. If someone were to access this page, they could use it to post to your Del.icio.us account.</p>
+
+ <p class="credit">Written by <a href="http://maniacalrage.net">Garrett Murray</a>. Updates at <a href="http://github.com/garrettmurray/quickbite">GitHub</a>.</p>
+
+
+ </div>
+
+</body>
+</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 index.php
@@ -0,0 +1,133 @@
+<?php
+
+// License
+// -------
+//
+// Software License Agreement (BSD License)
+//
+// Copyright (C) 2009, Garrett Murray.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of Edward Eliot nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission of Edward Eliot.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+require('_conf.php');
+require('lib/quickbite.php');
+$qb = new quick_bite(DELICIOUS_USER, DELICIOUS_PASS);
+$create_post = false;
+
+if (array_key_exists('z', $_GET) && $_GET['z'] == '1')
+{
+ if (
+ (array_key_exists('u', $_GET) && $_GET['u'] == DELICIOUS_USER) &&
+ (array_key_exists('mp', $_GET) && $_GET['mp'] == md5(DELICIOUS_PASS))
+ )
+ {
+ $create_post = true;
+ $url = $_GET['url'];
+ $desc = $_GET['title'];
+ $notes = $_GET['desc'];
+ $tags = array($_GET['tags']);
+ $date = date('Y-m-d H:i:s', time());
+ }
+}
+
+?>
+<?= '<'.'?xml version="1.0" encoding="UTF-8"'.'?'.'>'; ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>Saving to Del.icio.us...</title>
+ <style type="text/css" media="screen">
+ body {
+ background-color: #d2d2d2;
+ margin: 0;
+ padding: 0;
+ font: 18px/18px HelveticaNeue, "Helvetica Neue", Helvetica, Arial, Sans-serif;
+ color: #3e3e3e;
+ }
+ h1, h3 {
+ margin: 0;
+ padding: 0;
+ }
+ h1 {
+ margin: 14px 0 0 0;
+ }
+ h3 {
+ color: #000;
+ font-size: 14px;
+ background: url('img/icon.gif') no-repeat left top;
+ padding: 0 0 0 28px;
+ margin: 8px 0 0 1px;
+ }
+ #wrapper {
+ background-color: #fff;
+ -webkit-border-radius: 14px;
+ -moz-border-radius: 14px;
+ padding: 20px 20px 20px 30px;
+ width: 170px;
+ height: 80px;
+ margin: 10px;
+ }
+ .err, .good {
+ color: red;
+ font-size: 11px;
+ margin-top: 8px;
+ }
+ .good {
+ color: green;
+ }
+ </style>
+</head>
+
+<body>
+
+ <div id="wrapper">
+ <h3>del.icio.us</h3>
+ <h1>Saving...</h1>
+ <div class="err">
+
+ <?php
+
+ if ($create_post)
+ {
+ $result = $qb->add_post($url, $desc, $notes, $tags, $date);
+ if ($result == '1' || $result == '')
+ echo '<script type="text/javascript" charset="utf-8">setTimeout(\'window.close()\', 700);</script><div class="good">Done!</span>';
+ else
+ echo ERROR;
+ }
+ else
+ {
+ echo 'No info submitted!';
+ }
+
+ ?>
+
+ </div>
+ </div>
+
+</body>
+</html>
Oops, something went wrong.

0 comments on commit 089208b

Please sign in to comment.