- ago by
+ ago by
diff --git a/lib/tag-it/js/tag-it.js b/lib/tag-it/js/tag-it.js
index 6b4b8d1..f99d271 100644
--- a/lib/tag-it/js/tag-it.js
+++ b/lib/tag-it/js/tag-it.js
@@ -39,9 +39,6 @@
// for inputting multi-word tags.
allowSpaces: false,
- // replace spaces with this string if set to something other than space in _cleanedInput()
- spaceChar: " ",
-
// Whether to animate tag removals or not.
animate: true,
@@ -238,12 +235,7 @@
_cleanedInput: function() {
// Returns the contents of the tag input, cleaned and ready to be passed to createTag
-
- // replace spaces with spacechar if set
- var _tval = this.options.spaceChar != ' ' ?
- this._tagInput.val().replace(/\ /g, this.options.spaceChar) : this._tagInput.val();
-
- return $.trim(_tval.replace(/^"(.*)"$/, '$1'));
+ return $.trim(this._tagInput.val().replace(/^"(.*)"$/, '$1'));
},
_lastTag: function() {
diff --git a/new.php b/new.php
index bf739c6..8470f1a 100644
--- a/new.php
+++ b/new.php
@@ -29,7 +29,6 @@ try {
$("#tag-input").tagit({
availableTags : userTags,
animate : false,
- spaceChar : '-',
tabIndex : 3
});
$('.tagit input')[0].focus();
@@ -56,14 +55,11 @@ try {
-
-
diff --git a/put.php b/put.php
index 080ef1b..c470409 100644
--- a/put.php
+++ b/put.php
@@ -4,9 +4,9 @@ include 'init.php';
$params = array();
$params['title'] = isset($_POST['title']) ? $_POST['title'] : null;
-$params['url'] = isset($_POST['url']) ? $_POST['url'] : null;
-$params['tags'] = isset($_POST['tags']) ? $_POST['tags'] : null;
-$params['description'] = isset($_POST['description']) ? $_POST['description'] : null;
+$params['url'] = isset($_POST['url']) ? $_POST['url'] : null;
+$params['tags'] = isset($_POST['tags']) ? $_POST['tags'] : null;
+$params['description'] = isset($_POST['description']) ? $_POST['description'] : null;
include 'head.html';
@@ -17,35 +17,26 @@ try {
$dbh = get_db_connection();
$dbh->beginTransaction();
- # filter tags
- $tags = filter_tags($params['tags']);
-
- #insert tags
+ # process tags
+ $tags = explode(',', $params['tags']);
if (count($tags) > 0) {
foreach($tags as $key => $tag) {
- $q = $dbh->prepare("INSERT INTO `clmpr`.`tags` (`tag`, `count`)
+ $q = $dbh->prepare("INSERT INTO `tags` (`tag`, `count`)
VALUES ( ?, 1 )
ON DUPLICATE KEY
- UPDATE `count` = `count` + 1");
+ UPDATE `count` = `count` + 1");
$q->execute(array($tag));
}
}
# insert clump
- $q = $dbh->prepare("INSERT INTO `clmpr`.`clumps`
- ( `user_id`,
- `title`,
- `url`,
- `tags`,
- `description`,
- `date` )
- VALUES ( ?, ?, ?, ?, ?, NOW() ) ");
+ $q = $dbh->prepare("INSERT INTO `clumps`
+ ( `user_id`, `title`, `url`,
+ `tags`, `description`, `date` )
+ VALUES ( ?, ?, ?, ?, ?, NOW() ) ");
$insert = $q->execute( array(
- $user['id'],
- $params['title'],
- $params['url'],
- implode(" ", $tags),
- htmlentities($params['description'])));
+ $user['id'], $params['title'], $params['url'],
+ $params['tags'], $params['description']));
echo "clumped.
";
echo 'ok';
diff --git a/style.css b/style.css
index 5873367..318390b 100644
--- a/style.css
+++ b/style.css
@@ -63,14 +63,6 @@ ul.links li span.url a {
ul.links li span.url a:hover {
text-decoration:none;
}
-ul.links li span.meta {
- color:#bbb;
- font-style:italic;
- font-size:12px;
-}
-ul.links li span.meta a {
- color:#999;
-}
ul.links li .desc {
color:#00d;
}
@@ -84,6 +76,15 @@ ul.links li .tags {
display:block;
}
+.meta {
+ color:#bbb;
+ font-style:italic;
+ font-size:12px;
+}
+.meta a {
+ color:#999;
+}
+
.ui {
font-size:12px;
diff --git a/update.php b/update.php
index abce529..0cdce50 100644
--- a/update.php
+++ b/update.php
@@ -9,6 +9,9 @@ $params['url'] = isset($_POST['url']) ? $_POST['url'] : null;
$params['tags'] = isset($_POST['tags']) ? $_POST['tags'] : null;
$params['description'] = isset($_POST['description']) ? $_POST['description'] : null;
+//print_r($_POST);
+//exit;
+
try {
if ($user = get_user() && $params['id']) {
@@ -17,19 +20,19 @@ try {
$dbh->beginTransaction();
if ($params['id']) {
- $q = $dbh->prepare("SELECT *, clumps.id as clump_id
- FROM clumps
- JOIN users
- ON users.id = clumps.user_id
- WHERE clumps.id = ?
+ $q = $dbh->prepare("SELECT *, clumps.id as clump_id
+ FROM clumps
+ JOIN users
+ ON users.id = clumps.user_id
+ WHERE clumps.id = ?
ORDER BY date DESC");
- $q->execute( array( $params['id'] ));
+ $q->execute( array( $params['id'] ));
}
$clump = $q->fetch();
- $clump['tags'] = explode(" ", $clump['tags']);
-
+ $clump['tags'] = explode(",", $clump['tags']);
+
# process tags
- $tags = filter_tags($params['tags']);
+ $tags = explode(',', $params['tags']);
$tags_to_keep = array_intersect ($tags, $clump['tags']);
$tags_to_delete = array_diff ($clump['tags'], $tags_to_keep);
$tags_to_add = array_diff ($tags, $tags_to_keep);
@@ -37,8 +40,8 @@ try {
# add/increment new tags
if (count($tags_to_add) > 0) {
foreach($tags_to_add as $key => $tag) {
- $sql = "INSERT INTO `clmpr`.`tags` ( `tag`, `count` )
- VALUES ( ?, 1 )
+ $sql = "INSERT INTO `clmpr`.`tags` ( `tag`, `count` )
+ VALUES ( ?, 1 )
ON DUPLICATE KEY UPDATE
`count` = `count` + 1";
$q = $dbh->prepare($sql);
@@ -56,14 +59,14 @@ try {
$q = $dbh->prepare($sql);
$q->execute( array( $tag ));
}
- }
+ }
# update clump
- $sql = "UPDATE `clumps`
- SET `url` = ?, `tags` = ?, `title` = ?, `description` = ?
+ $sql = "UPDATE `clumps`
+ SET `url` = ?, `tags` = ?, `title` = ?, `description` = ?
WHERE `id` = ?";
$q = $dbh->prepare($sql);
- $insert = $q->execute( array( $params['url'], implode(" ", $tags), $params['title'], $params['description'], $params['id']));
+ $insert = $q->execute( array( $params['url'], implode(",", $tags), $params['title'], $params['description'], $params['id']));
header('Location: /get.php?id=' . $params['id']);
//echo "clumped.
";
@@ -71,7 +74,7 @@ try {
//echo '';
$dbh = null;
- $q = null;
+ $q = null;
} else {
include 'signin.php';
--
2.34.1