From e4f32d05783436b589910979735c3344a1cba7ea Mon Sep 17 00:00:00 2001 From: Gabriel Dunne Date: Tue, 20 Dec 2011 19:15:27 -0800 Subject: [PATCH] Added about page, added beginnings of fulltext tag search --- TODO | 3 +++ about.html | 42 +++++++++++++++++++++++++++++++++++ clmpr.sql | 4 +++- footer.html | 2 +- get.php | 36 ++++++++++++++++++++---------- index.php | 63 +++++++++-------------------------------------------- signin.php | 6 ++--- 7 files changed, 87 insertions(+), 69 deletions(-) create mode 100644 about.html diff --git a/TODO b/TODO index a89acfc..2645185 100644 --- a/TODO +++ b/TODO @@ -13,3 +13,6 @@ pages ref http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html + http://code.google.com/p/mysqlicious/ + + diff --git a/about.html b/about.html new file mode 100644 index 0000000..fc578a1 --- /dev/null +++ b/about.html @@ -0,0 +1,42 @@ +
+

+citation, logging and multi-purpose archive +
+
+

+

+use clmpr (/klum-per/) to save bookmarks. +

+ +to use: + +drag this link [+] to your bookmark bar +
+
+

+ +

+project keywords: +bookmarks, +delicious-clone. +webservice, +database, +mindmap, +citation, +semantic + +

+

+ +

+clmpr is open source. fork the project on github +
+
+

+ + + +
\ No newline at end of file diff --git a/clmpr.sql b/clmpr.sql index 8569743..2744270 100644 --- a/clmpr.sql +++ b/clmpr.sql @@ -10,7 +10,9 @@ CREATE TABLE `clumps` ( `description` text NOT NULL, `tags` text NOT NULL, `date` datetime NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + KEY `date` (`date`), + FULLTEXT KEY `tags` (`tags`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `tags` ( diff --git a/footer.html b/footer.html index 5559330..84c9b69 100644 --- a/footer.html +++ b/footer.html @@ -1,6 +1,6 @@ diff --git a/get.php b/get.php index 6b76392..0eb9941 100644 --- a/get.php +++ b/get.php @@ -9,12 +9,13 @@ $params['id'] = isset($_GET['id']) ? $_GET['id'] : null; $pathinfo = pathinfo($_SERVER['REQUEST_URI']); $format = isset($pathinfo['extension']) ? $pathinfo['extension'] : null; -$endpoint = ''; -$endpoint = str_replace('.'.$format, '', $endpoint); $dbh = get_db_connection(); $dbh->beginTransaction(); +$q = null; +$tag = null; + try { if ($params['user']) { $user = get_users($dbh, array('user' => $params['user'] )); @@ -37,6 +38,16 @@ try { ORDER BY date DESC"); $q->execute( array( $params['id'] )); } + else if ($endpoint == 'tag' && isset($urlparts[1])) { + $tag = $urlparts[1]; + $q = $dbh->prepare("SELECT *, clumps.id as clump_id + FROM clumps + JOIN users + ON users.id = clumps.user_id + WHERE tags LIKE ? + ORDER BY date DESC"); + $q->execute( array('%'.$tag.'%') ); + } else { $q = $dbh->prepare("SELECT *, clumps.id as clump_id FROM clumps @@ -72,6 +83,11 @@ switch ($format) { + +

+tag: +

+

bookmarklet: +

+ -

-rss -


- + diff --git a/index.php b/index.php index 712000c..793a2cf 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,8 @@ require_once 'init.php'; $url = isset($_GET['_url']) ? trim($_GET['_url'], '/') : '/'; -list($endpoint) = explode('/', $url); +$urlparts = explode('/', $url); +list($endpoint) = $urlparts; $pathinfo = pathinfo($_SERVER['REQUEST_URI']); $format = isset($pathinfo['extension']) ? $pathinfo['extension'] : null; @@ -16,61 +17,17 @@ switch($endpoint) case 'about' : include 'head.html'; include 'header.html'; - echo '
'; - - ?> - -

- citation, logging and multi-purpose archive -
-
-

- -

- - use clmpr (/klum-per/) to save bookmarks. - - -

- -to use: - -drag this link [+] to your bookmark bar -
-
-

- -

-project keywords: -bookmarks, -delicious-clone. -webservice, -database, -mindmap, -citation, -semantic - - -

-

- - - - -

-clmpr is open source. fork the project on github -

- - gabriel dunne'; - echo '
'; + include 'about.html'; include 'footer.html'; exit; + case 'tag' : + case 'tags' : + if (count($urlparts) == 1) { + include 'tags.php'; + exit; + } + default : if ($endpoint != '') { $dbh = get_db_connection(); diff --git a/signin.php b/signin.php index 644b612..d6f98a3 100644 --- a/signin.php +++ b/signin.php @@ -48,7 +48,7 @@ var user = $('#nuser').val(); var pass = $('#npass').val(); $('#register').text("creating user..."); - $.post('signup.php', { user : user, pass : pass }, function(result) { + $.post('/signup.php', { user : user, pass : pass }, function(result) { if (result.success = 'true') { window.location.reload(); } @@ -65,7 +65,7 @@ var user = $('#user').val(); var pass = $('#pass').val(); $('#signin').text("signing in..."); - $.post('signin.php', { user : user, pass : pass }, function(result) { + $.post('/signin.php', { user : user, pass : pass }, function(result) { window.location.reload(); }, 'json'); } @@ -73,7 +73,7 @@ function onLogout() { - $.post('signin.php', { logout : 1 }, function(result) { + $.post('/signin.php', { logout : 1 }, function(result) { $('#signin').html(result.mssg); window.location.reload(); }, 'json'); -- 2.34.1