-Tue Jul 14 21:38 EST 2009 Luke Reeve <luke@neuro-tech.net>\r
-\r
- * Fix the option "proxy_host" not being saved correctly.\r
-\r
-Sun Jul 12 11:00 EST 2009 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Fixed the Perl 5.10 module reloading bug.\r
- * Fixed snapshotting functionality\r
-\r
-Sat Jul 11 23:30 EST 2009 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Dusted off the codebase, kicked the tires and finally\r
- finished off the git migration.\r
-\r
-Mon Mar 27 18:59 EST 2006 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Added an option for disabling mod_rewrite support\r
- * Added a prefix option for database tables\r
-\r
-Tue Mar 21 19:34 EST 2006 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Fix the export system\r
-\r
-Tue Feb 21 12:30 EST 2006 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Fix up database connectivity for newer PostgreSQL \r
- libraries\r
- * Incorporate patch from Paul Boin that allows importing\r
- of regular del.icio.us backups (as opposed to only\r
- supporting exports as before)\r
-\r
-Mon Nov 21 12:41 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Fixed some of the cleanup process for snapshot deletion\r
- * Added a "Fetch Related" function, so that the snapshot\r
- tool can grab related objects\r
- * Work on the tag tools - delete and rename tags \r
-\r
-Fri Nov 04 09:00 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Database fix (thanks to Jutta Horstmann)\r
- * Remove export and import to server-side files, since the \r
- standalone tools can easily accomplish that\r
-\r
-Fri Sep 23 07:35 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Enable taint mode for all the modules/scripts.\r
-\r
-Thu Sep 22 12:15 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Remove dependency on App::Config, since all it does is\r
- read a simple text file.\r
- * Remove dependency on CGI::Session in lieu of a built-in\r
- session management system\r
- * Fixed up database tables\r
-\r
-Mon Sep 19 20:37 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Add the ability to drill-down into more details on cached\r
- objects.\r
- * Fix up the standalone import and export tools.\r
- * Show the correct total size of snapshots in the snapshot\r
- view.\r
-\r
-Fri Sep 16 21:02 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Move tools to a separate directory\r
- * Add a standalone export script.\r
- * Fix bugs in the export concerning character encoding.\r
-\r
-Fri Sep 16 12:30 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Fix a couple possible installation issues on PostgreSQL\r
- systems.\r
-\r
-Mon Sep 05 22:28 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
- \r
- * Major code cleanup (splitting the main CGI file into multiple,\r
- more maintainable ones inside of the lib/Insipid directory)\r
- * Bugfix for adding duplicate items not being flagged as such\r
-\r
-Tue Aug 09 22:05 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Added proxy support for fetching pages\r
- * Fix blob size for MySQL tables\r
- * Added a toggle to not redirect when a mark is added\r
- * Added a toggle to snapshot a page when bookmarked\r
- * Support passing the Referer header when snapshotting a page.\r
- * Added support for If-Modified-Since requests to cached objects.\r
- * Added a Last-Modified header for cache objects.\r
-\r
-Thu Jul 21 21:35 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Fix a bunch of errors concerning PostgreSQL and the snapshots,\r
- as well as other bug fixes.\r
-\r
-Sun Jul 17 15:19 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
- \r
- * Added the page cache feature, so a user can take snapshots of pages\r
- that have been bookmarked.\r
-\r
-Tue Jul 05 21:58 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Added addition of tags (like Documentation + Java) to get\r
- intersections of bookmarks.\r
-\r
-Fri May 27 11:05 JST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Added postgresql backend support (submitted by Stephen Patterson)\r
-\r
-Mon Apr 25 21:00 EST 2005 Luke Reeves <luke@neuro-tech.net>\r
-\r
- * Add a search box, with the option of showing it to non-logged in\r
- users.\r
+06.2011 CEST jumpin.banana
+ * tag suggest was not working correctly.
+
+Tue Jul 14 21:38 EST 2009 Luke Reeve <luke@neuro-tech.net>
+
+ * Fix the option "proxy_host" not being saved correctly.
+
+Sun Jul 12 11:00 EST 2009 Luke Reeves <luke@neuro-tech.net>
+
+ * Fixed the Perl 5.10 module reloading bug.
+ * Fixed snapshotting functionality
+
+Sat Jul 11 23:30 EST 2009 Luke Reeves <luke@neuro-tech.net>
+
+ * Dusted off the codebase, kicked the tires and finally
+ finished off the git migration.
+
+Mon Mar 27 18:59 EST 2006 Luke Reeves <luke@neuro-tech.net>
+
+ * Added an option for disabling mod_rewrite support
+ * Added a prefix option for database tables
+
+Tue Mar 21 19:34 EST 2006 Luke Reeves <luke@neuro-tech.net>
+
+ * Fix the export system
+
+Tue Feb 21 12:30 EST 2006 Luke Reeves <luke@neuro-tech.net>
+
+ * Fix up database connectivity for newer PostgreSQL
+ libraries
+ * Incorporate patch from Paul Boin that allows importing
+ of regular del.icio.us backups (as opposed to only
+ supporting exports as before)
+
+Mon Nov 21 12:41 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Fixed some of the cleanup process for snapshot deletion
+ * Added a "Fetch Related" function, so that the snapshot
+ tool can grab related objects
+ * Work on the tag tools - delete and rename tags
+
+Fri Nov 04 09:00 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Database fix (thanks to Jutta Horstmann)
+ * Remove export and import to server-side files, since the
+ standalone tools can easily accomplish that
+
+Fri Sep 23 07:35 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Enable taint mode for all the modules/scripts.
+
+Thu Sep 22 12:15 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Remove dependency on App::Config, since all it does is
+ read a simple text file.
+ * Remove dependency on CGI::Session in lieu of a built-in
+ session management system
+ * Fixed up database tables
+
+Mon Sep 19 20:37 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Add the ability to drill-down into more details on cached
+ objects.
+ * Fix up the standalone import and export tools.
+ * Show the correct total size of snapshots in the snapshot
+ view.
+
+Fri Sep 16 21:02 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Move tools to a separate directory
+ * Add a standalone export script.
+ * Fix bugs in the export concerning character encoding.
+
+Fri Sep 16 12:30 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Fix a couple possible installation issues on PostgreSQL
+ systems.
+
+Mon Sep 05 22:28 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Major code cleanup (splitting the main CGI file into multiple,
+ more maintainable ones inside of the lib/Insipid directory)
+ * Bugfix for adding duplicate items not being flagged as such
+
+Tue Aug 09 22:05 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Added proxy support for fetching pages
+ * Fix blob size for MySQL tables
+ * Added a toggle to not redirect when a mark is added
+ * Added a toggle to snapshot a page when bookmarked
+ * Support passing the Referer header when snapshotting a page.
+ * Added support for If-Modified-Since requests to cached objects.
+ * Added a Last-Modified header for cache objects.
+
+Thu Jul 21 21:35 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Fix a bunch of errors concerning PostgreSQL and the snapshots,
+ as well as other bug fixes.
+
+Sun Jul 17 15:19 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Added the page cache feature, so a user can take snapshots of pages
+ that have been bookmarked.
+
+Tue Jul 05 21:58 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Added addition of tags (like Documentation + Java) to get
+ intersections of bookmarks.
+
+Fri May 27 11:05 JST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Added postgresql backend support (submitted by Stephen Patterson)
+
+Mon Apr 25 21:00 EST 2005 Luke Reeves <luke@neuro-tech.net>
+
+ * Add a search box, with the option of showing it to non-logged in
+ users.
-#!/usr/bin/perl\r
-#\r
-# Copyright (C) 2008 Luke Reeves\r
-#\r
-# This program is free software; you can redistribute it and/or modify\r
-# it under the terms of the GNU General Public License as published by\r
-# the Free Software Foundation; either version 2 of the License, or\r
-# (at your option) any later version.\r
-#\r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-#\r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\r
-# USA\r
-#\r
-\r
-package Insipid::DBInstall;\r
-\r
-use strict;\r
-use warnings;\r
-\r
-use Insipid::Config;\r
-use Insipid::Schemas;\r
-\r
-use DBI qw/:sql_types/;;\r
-use vars qw($version);\r
-\r
-use Exporter ();\r
-our (@ISA, @EXPORT);\r
- \r
-@ISA = qw(Exporter);\r
-@EXPORT = qw(install);\r
-\r
-sub install {\r
- my ($sth, $dbname, $dbuser, $dbpass, $dbtype, $dsn, $dbh, @creates);\r
-\r
- $dbname = getconfig('dbname');\r
- $dbuser = getconfig('dbuser');\r
- $dbpass = getconfig('dbpass');\r
-\r
- if(defined(getconfig('dbtype'))) {\r
- $dbtype = getconfig('dbtype');\r
- } else {\r
- $dbtype = 'mysql';\r
- }\r
-\r
- $dsn = "DBI:$dbtype:dbname=$dbname;host=localhost";\r
- $dbh = DBI->connect($dsn, $dbuser, $dbpass, { 'RaiseError' => 0}) or die $DBI::errstr;\r
-\r
- print "Content-Type: text/html\r\n\r\n";\r
- print "<html><head><title>Insipid Installation</title></head><body>";\r
-\r
- print "<p>Creating tables...";\r
-\r
- if($dbtype eq 'mysql') {\r
- @creates = split(/\;/, $createMySQL);\r
- } else {\r
- @creates = split(/\;/, $createPostgres);\r
- }\r
-\r
- foreach(@creates) {\r
- my $sql = $_;\r
- if(length($sql) > 2) {\r
- $sth = $dbh->prepare($sql);\r
- $sth->execute() or print "<br />Error executing \"$sql\" - $DBI::errstr<br />";\r
- }\r
- }\r
- print " done!</p>";\r
-\r
- print "<p>Insipid's database has been installed. You can reload this " .\r
- "page to start using Insipid.</p>";\r
- \r
- print "</body></html>";\r
-\r
-}\r
-\r
-1;\r
-__END__\r
+#!/usr/bin/perl
+#
+# Copyright (C) 2008 Luke Reeves
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+
+package Insipid::DBInstall;
+
+use strict;
+use warnings;
+
+use Insipid::Config;
+use Insipid::Schemas;
+
+use DBI qw/:sql_types/;;
+use vars qw($version);
+
+use Exporter ();
+our (@ISA, @EXPORT);
+
+@ISA = qw(Exporter);
+@EXPORT = qw(install);
+
+sub install {
+ my ($sth, $dbname, $dbuser, $dbpass, $dbhost, $dbtype, $dsn, $dbh, @creates);
+
+ $dbname = getconfig('dbname');
+ $dbuser = getconfig('dbuser');
+ $dbpass = getconfig('dbpass');
+ $dbhost = getconfig('dbhost');
+
+ if(defined(getconfig('dbtype'))) {
+ $dbtype = getconfig('dbtype');
+ } else {
+ $dbtype = 'mysql';
+ }
+
+ $dsn = "DBI:$dbtype:dbname=$dbname;host=$dbhost";
+ $dbh = DBI->connect($dsn, $dbuser, $dbpass, { 'RaiseError' => 0}) or die $DBI::errstr;
+
+ print "Content-Type: text/html\r\n\r\n";
+ print "<html><head><title>Insipid Installation</title></head><body>";
+
+ print "<p>Creating tables...";
+
+ if($dbtype eq 'mysql') {
+ @creates = split(/\;/, $createMySQL);
+ } else {
+ @creates = split(/\;/, $createPostgres);
+ }
+
+ foreach(@creates) {
+ my $sql = $_;
+ if(length($sql) > 2) {
+ $sth = $dbh->prepare($sql);
+ $sth->execute() or print "<br />Error executing \"$sql\" - $DBI::errstr<br />";
+ }
+ }
+ print " done!</p>";
+
+ print "<p>Insipid's database has been installed. You can reload this " .
+ "page to start using Insipid.</p>";
+
+ print "</body></html>";
+
+}
+
+1;
+__END__
-#!/usr/bin/perl\r
-#\r
-# Copyright (C) 2008 Luke Reeves\r
-#\r
-# This program is free software; you can redistribute it and/or modify\r
-# it under the terms of the GNU General Public License as published by\r
-# the Free Software Foundation; either version 2 of the License, or\r
-# (at your option) any later version.\r
-#\r
-# This program is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-# GNU General Public License for more details.\r
-#\r
-# You should have received a copy of the GNU General Public License\r
-# along with this program; if not, write to the Free Software\r
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\r
-# USA\r
-#\r
-\r
-package Insipid::Database;\r
-\r
-use strict;\r
-use warnings;\r
-\r
-use Insipid::Config;\r
-use Insipid::Schemas;\r
-\r
-use DBI qw/:sql_types/;;\r
-use vars qw($version);\r
-\r
-use Exporter ();\r
-our (@ISA, @EXPORT);\r
- \r
-@ISA = qw(Exporter);\r
-@EXPORT = qw($dbname $dbuser $dbpass $dsn $dbh $dbtype get_option \r
- install $version $tag_url $feed_url $full_url $snapshot_url\r
- export_options $dbprefix);\r
- \r
-our ($dsn, $dbh, $dbname, $dbuser, $dbpass, $snapshot_url,\r
- $dbtype, $tag_url, $feed_url, $full_url, $dbprefix);\r
-\r
-$dbname = getconfig('dbname');\r
-$dbuser = getconfig('dbuser');\r
-$dbpass = getconfig('dbpass');\r
-\r
-if(defined(getconfig('dbtype'))) {\r
- $dbtype = getconfig('dbtype');\r
-} else {\r
- $dbtype = 'mysql';\r
-}\r
-\r
-$dsn = "DBI:$dbtype:dbname=$dbname;host=localhost";\r
-$dbh = DBI->connect($dsn, $dbuser, $dbpass, { 'RaiseError' => 0}) or die $DBI::errstr;\r
-\r
-my %options;\r
-\r
-sub export_options {\r
- my ($writer) = (@_);\r
- my ($sth);\r
- \r
- $writer->startTag('options');\r
- $sth = $dbh->prepare("select name, value from $tbl_options");\r
- $sth->execute();\r
- while(my $row = $sth->fetchrow_hashref) {\r
- if($row->{name} ne 'version') {\r
- $writer->emptyTag('option', \r
- 'name' => $row->{name},\r
- 'value' => $row->{value});\r
- }\r
- }\r
- \r
- $writer->endTag('options');\r
-}\r
-\r
-sub dbupgrade {\r
- my $sql = "update $tbl_options set value = ? where (name = ?)";\r
- my $sth = $dbh->prepare($sql);\r
- $sth->execute($version, 'version');\r
-\r
- $sql = "insert into $tbl_options(name, value, description) \r
- values(?, ?, ?)";\r
- $sth = $dbh->prepare($sql);\r
- $sth->execute('version', $version, 'Internal Insipid version');\r
- $sth->execute('use_rewrite', 'yes', 'Use mod_rewrite - disable this if you do not want to use mod_rewrite.');\r
-\r
- # Delete the old sessions table\r
- $sql = 'drop table sessions';\r
- $sth = $dbh->prepare($sql);\r
- $sth->execute();\r
-\r
- # Create the new session table if it's not there.\r
- $sql = "create table $tbl_authentication (\r
- session_id varchar(32),\r
- create_time int,\r
- primary key(session_id))";\r
- $sth = $dbh->prepare($sql);\r
- $sth->execute();\r
- if($dbh->errstr) {\r
- print STDERR $dbh->errstr;\r
- }\r
- \r
- return;\r
-}\r
-\r
-sub get_option {\r
- my ($name) = (@_);\r
-\r
- if(keys (%options) == 0) {\r
- reload_options();\r
- }\r
-\r
- # Determine if we need to upgrade the database\r
- if($version ne $options{'version'}) {\r
- print STDERR "Upgrading schema from $options{'version'} to $version.\n";\r
- dbupgrade();\r
- reload_options();\r
- }\r
-\r
- return $options{$name};\r
-}\r
-\r
-sub reload_options {\r
- my $sql = "select name, value from $tbl_options";\r
- my $sth = $dbh->prepare($sql);\r
- $sth->execute() or die $DBI::errstr;\r
-\r
- while(my $hr = $sth->fetchrow_hashref) {\r
- $options{$hr->{'name'}} = $hr->{'value'};\r
- }\r
-}\r
-\r
-# This configures the URLs in the application to support mod_rewrite or\r
-# a webserver sans mod_rewrite.\r
-if(get_option('use_rewrite') eq 'yes') {\r
- $tag_url = $site_url . '/bookmarks/';\r
- $feed_url = $site_url . '/feeds/bookmarks';\r
- $full_url = $site_url . '/bookmarks';\r
- $snapshot_url = $site_url . '/snapshot/';\r
-} else {\r
- $tag_url = 'insipid.cgi?tag=';\r
- $feed_url = $site_url . '/insipid.cgi?op=rss&tag=';\r
- $full_url = $site_url . '/insipid.cgi';\r
- $snapshot_url = 'insipid.cgi?op=viewsnapshot&md5=';\r
-}\r
-\r
-\r
-1;\r
-__END__\r
+#!/usr/bin/perl
+#
+# Copyright (C) 2008 Luke Reeves
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+
+package Insipid::Database;
+
+use strict;
+use warnings;
+
+use Insipid::Config;
+use Insipid::Schemas;
+
+use DBI qw/:sql_types/;;
+use vars qw($version);
+
+use Exporter ();
+our (@ISA, @EXPORT);
+
+@ISA = qw(Exporter);
+@EXPORT = qw($dbname $dbuser $dbpass $dsn $dbh $dbtype get_option
+ install $version $tag_url $feed_url $full_url $snapshot_url
+ export_options $dbprefix);
+
+our ($dsn, $dbh, $dbname, $dbuser, $dbpass, $dbhost, $snapshot_url,
+ $dbtype, $tag_url, $feed_url, $full_url, $dbprefix);
+
+$dbname = getconfig('dbname');
+$dbuser = getconfig('dbuser');
+$dbpass = getconfig('dbpass');
+$dbhost = getconfig('dbhost');
+
+if(defined(getconfig('dbtype'))) {
+ $dbtype = getconfig('dbtype');
+} else {
+ $dbtype = 'mysql';
+}
+
+$dsn = "DBI:$dbtype:dbname=$dbname;host=$dbhost";
+$dbh = DBI->connect($dsn, $dbuser, $dbpass, { 'RaiseError' => 0}) or die $DBI::errstr;
+
+my %options;
+
+sub export_options {
+ my ($writer) = (@_);
+ my ($sth);
+
+ $writer->startTag('options');
+ $sth = $dbh->prepare("select name, value from $tbl_options");
+ $sth->execute();
+ while(my $row = $sth->fetchrow_hashref) {
+ if($row->{name} ne 'version') {
+ $writer->emptyTag('option',
+ 'name' => $row->{name},
+ 'value' => $row->{value});
+ }
+ }
+
+ $writer->endTag('options');
+}
+
+sub dbupgrade {
+ my $sql = "update $tbl_options set value = ? where (name = ?)";
+ my $sth = $dbh->prepare($sql);
+ $sth->execute($version, 'version');
+
+ $sql = "insert into $tbl_options(name, value, description)
+ values(?, ?, ?)";
+ $sth = $dbh->prepare($sql);
+ $sth->execute('version', $version, 'Internal Insipid version');
+ $sth->execute('use_rewrite', 'yes', 'Use mod_rewrite - disable this if you do not want to use mod_rewrite.');
+
+ # Delete the old sessions table
+ $sql = 'drop table sessions';
+ $sth = $dbh->prepare($sql);
+ $sth->execute();
+
+ # Create the new session table if it's not there.
+ $sql = "create table $tbl_authentication (
+ session_id varchar(32),
+ create_time int,
+ primary key(session_id))";
+ $sth = $dbh->prepare($sql);
+ $sth->execute();
+ if($dbh->errstr) {
+ print STDERR $dbh->errstr;
+ }
+
+ return;
+}
+
+sub get_option {
+ my ($name) = (@_);
+
+ if(keys (%options) == 0) {
+ reload_options();
+ }
+
+ # Determine if we need to upgrade the database
+ if($version ne $options{'version'}) {
+ print STDERR "Upgrading schema from $options{'version'} to $version.\n";
+ dbupgrade();
+ reload_options();
+ }
+
+ return $options{$name};
+}
+
+sub reload_options {
+ my $sql = "select name, value from $tbl_options";
+ my $sth = $dbh->prepare($sql);
+ $sth->execute() or die $DBI::errstr;
+
+ while(my $hr = $sth->fetchrow_hashref) {
+ $options{$hr->{'name'}} = $hr->{'value'};
+ }
+}
+
+# This configures the URLs in the application to support mod_rewrite or
+# a webserver sans mod_rewrite.
+if(get_option('use_rewrite') eq 'yes') {
+ $tag_url = $site_url . '/bookmarks/';
+ $feed_url = $site_url . '/feeds/bookmarks';
+ $full_url = $site_url . '/bookmarks';
+ $snapshot_url = $site_url . '/snapshot/';
+} else {
+ $tag_url = 'insipid.cgi?tag=';
+ $feed_url = $site_url . '/insipid.cgi?op=rss&tag=';
+ $full_url = $site_url . '/insipid.cgi';
+ $snapshot_url = 'insipid.cgi?op=viewsnapshot&md5=';
+}
+
+
+1;
+__END__
if (w.length > 1 && stopSuggesting == false) {
$.ajax({
- url: 'lib/tagsSuggest.pl?' + w,
+ url: 'lib/tagsSuggest.cgi?' + w,
dataType: 'html',
success: function(o) {
if (o.length > 0) {
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use CGI;
+use Insipid::Config;
+use Insipid::Database;
+use Insipid::Sessions;
+
+my $cgi = new CGI();
+print $cgi->header(-type => "text/html", -charset => "utf-8");
+
+# Retrieve all related tags as the user adds a tag. This is to reduce
+# the mental guess-work for the type of user who loathes creating
+# redundant tags. Invoke this subroutine via js in a text input event.
+#
+# @param $in:string - First letters of the tag to match.
+# @return $out:string - HTML-formatted list of tags.
+my ($in) = shift;
+
+if ($in =~ /^[0-9a-z:_]+/i) {
+ my ($sql, $sth);
+
+ # The user has typed in the first two letters, look for a match.
+ # Order suggestions by popularity.
+ $sql = "select $tbl_tags.name, count(*) from `$tbl_tags`
+ inner join $tbl_bookmark_tags on
+ ($tbl_tags.id = $tbl_bookmark_tags.tag_id)
+ where ($tbl_tags.name LIKE ".$dbh->quote($in.'%').")
+ group by $tbl_tags.name
+ order by count(*) desc";
+ $sth = $dbh->prepare($sql);
+ $sth->execute();
+
+ # external wrappers div.suggestlist>ul> ... /ul/div
+ if($sth->rows ne 0) {
+ my $out = "";
+ #$out .= "Content-Type: text/html; charset=UTF-8\n\n";
+ while(my @r = $sth->fetchrow_array()) {
+ $out .= "<li>$r[0]</li>";
+ }
+ print $out;
+ }
+}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use CGI;
-use Insipid::Config;
-use Insipid::Database;
-use Insipid::Sessions;
-
-my $cgi = new CGI();
-print $cgi->header(-type => "text/html", -charset => "utf-8");
-
-# Retrieve all related tags as the user adds a tag. This is to reduce
-# the mental guess-work for the type of user who loathes creating
-# redundant tags. Invoke this subroutine via js in a text input event.
-#
-# @param $in:string - First letters of the tag to match.
-# @return $out:string - HTML-formatted list of tags.
-my ($in) = shift;
-
-if ($in =~ /^[0-9a-z:_]+/i)
-{
- my ($sql, $sth);
-
- # The user has typed in the first two letters, look for a match.
- # Order suggestions by popularity.
- $sql = "select $tbl_tags.name,count(*) from $tbl_tags
- inner join $tbl_bookmark_tags on
- ($tbl_tags.id = $tbl_bookmark_tags.tag_id)
- where ($tbl_tags.name LIKE '$in%')
- group by $tbl_tags.name
- order by count( * ) desc";
- $sth = $dbh->prepare($sql);
- $sth->execute();
-
- # external wrappers div.suggestlist>ul> ... /ul/div
- if($sth->rows ne 0)
- {
- my $out = "";
- #$out .= "Content-Type: text/html; charset=UTF-8\n\n";
- while(my @r = $sth->fetchrow_array()) {
- $out .= "<li>$r[0]</li>";
- }
- print $out;
- }
-}