scriblio

Dang addslashes() And GPC Magic Quotes

Somewhere in the WordPress code extra slashes are being added to my query terms.

I’ve turned GPC magic quotes off via a php_value magic_quotes_gpc 0 directive in the .htaccess file (we have far too much legacy code that nobody wants to touch to turn it off site-wide). And I know my code is doing one run of addslashes(), but where are the other two sets of slashes coming from?

WPopac Reloaded

I’ve re-thought the contents of the record and summary displays in WPopac. After some experimentation and a lot of listening, it became clear that people needed specific information when looking at a search result or a catalog record. So now, when searching for Cantonese slang, for instance, the summary displays show the title, year, format, […] » about 400 words

It’s Official

WPopac, a project I started on my nights and weekends, is now officially one of my day-job projects too. We’ve been using our WPopac-based catalog as a prototype since February 2006, but the change not only allocates a portion of my work time specifically to the development of the project, but also reflects the library‘s […] » about 200 words

NELINET 2006 IT Conference Proposal

I recently submitted my proposal for the 2006 NELINET Information Technology Conference. It’s about WPopac, of course, but the excitement now is that the presentation would be the story of the first library outside PSU to implement it. WPopac is an open source replacement for a library’s online catalog that improves the usability, findability, and […] » about 300 words

The URLs From My Portland Talk

Following Edward Tufte’s advice, I’ve been wanting to offer a presentation without slides for a long time now; I finally got my chance in Portland. The downside is that now I don’t have anything to offer as a takeaway memory aid for my talk. My speaking notes are too abstract to offer for public consumption, […] » about 800 words

Presentation: Designing an OPAC for Web 2.0

| <a href="http://www.innopacusers.org/iug2006/">IUG 2006 presentation</a>: <a href="http://homepage.mac.com/misterbisson/Presentations/IUG-2006May21.mov">Designing an OPAC for Web 2.0</a> (also <a href="http://homepage.mac.com/misterbisson/Presentations/IUG-2006May21.pdf">available as a PDF</a> with space for notes) This is an update of <a href="http://maisonbisson.com/blog/post/11096/">my ALA Midwinter presentation</a>. » about 400 words

WPopac Gets Googled

A discussion on Web4Lib last month raised the issue of Google indexing our library catalogs. My answer spoke of the huge number of searches being done in search engines every day and the way that people increasingly expect that anything worth finding can be found in Google. There were doubts about the effectiveness of such […] » about 800 words

Boolean Searching in WPopac

WPopac takes advantage of MySQL’s indexing and relevance-ranked searching (go ahead, try it), including boolean searching (on MySQL versions > 4.x). Here are some details and examples taken wholesale from the MySQL manual: + A leading plus sign indicates that this word must be present in each result returned.  – A leading minus sign indicates […] » about 500 words

WordPress Baseline Changes To Support WPopac

I’ve whittled things down to the point where the only baseline change from WordPress 2.0.2 is in the next_posts_link function of the wp-includes/template-functions-links.php file. The change is necessary because WPopac rewrites the SQL search queries in a way that’s incompatible with a piece of this function, but necessary for performance reasons.

Here’s how my version reads:

`

function next_posts_link($label='Next Page »', $max_page=0) {
	global $paged, $result, $request, $posts_per_page, $wpdb, $max_num_pages;
	if ( !$max_page ) {
			if ( isset($max_num_pages) ) {
				$max_page = $max_num_pages;
			} else {
				preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);

				// added April 5 2006 by Casey Bisson to support WPopac
				// necessary because the preg_match above fails with some queries
				if(!$fromwhere)
					$fromwhere = $wpdb->posts;
				
				// changed April 5 2006 by Casey Bisson to speed the query by eliminating
				// the slow DISTINCT clause
				//$numposts = $wpdb->get_var(“SELECT COUNT(DISTINCT ID) FROM $fromwhere”);
				$numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $fromwhere”);
				$max_page = $max_num_pages = ceil($numposts / $posts_per_page);
			}
	}
	if ( !$paged )
		$paged = 1;
	$nextpage = intval($paged) + 1;
	if ( (! is_single()) && (empty($paged) || $nextpage < = $max_page) ) {
		echo '<a href=“';
		next_posts($max_page);
		echo '”>'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
	}
}

`

Where’d All My Rewrite Rules Go?

Between WordPress 1.x and 2.x there was a big change to the way rewrite rules are handled.

In the old days, everything got written out to a <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule">.htaccess</a> file. Every condition, every form of permalink could be found there, and I had some comfort knowing I could see and mess with it all. I was a bit surprised to find that with 2.0.2, WP writes out a sparse file that has only one significant rule. Something that looks like this:

RewriteRule . /blog/index.php [L]

That one line takes everything in your request URL and passes it through to index.php for processing. The beauty of this is that WP doesn’t need to write to the file system with every change to the permalink structure (which used to include every new “page” added or renamed).

The only downside to this is that you can no longer expect a $_REQUEST array full of all the query terms your plugin might use. Instead you’ll have to use the <a href="http://codex.wordpress.org/Function_Reference/WP_Query">$wp_query</a> object. All of this was probably mentioned in the API docs before I built a bunch of dependancies on $_REQUEST, but it was easy enough to fix.

bsuite Feature: User Contributed Tags

Ross Singer gets the prize for submitting the first reader contributed tag, the latest feature in bsuite.

There are arguments about whether user-contributed tags are useful or even valid, or whether they should be stored in my site or aggregated at places like del.ici.ous. But who’s to worry about such questions? Who’s to worry when you can put together the work already done to support author’s tags with WordPress’s pretty good comment system and get user contributed tag support with just a few extra lines of code? Who’s to worry when we can try it and see what comes of it?

It’s all managed using the same tools we use to approve, moderate, and edit comments, which also means the spam filtering that works for comments works for contributed tags too. And because bsuite is already part of WPopac, that means it gains the new tagging features too (well, it will soon).

Is Sun’s T2000 Up To It?

Jonathan Schwartz made the kind of news that makes Slash Dotters happy: he announced Sun is (sort of) giving away free servers. It’s a promotion, a media play, of course, but one that might make a few lucky people very happy. Here’s the deal: Sun is really proud of their new T2000 eight core server. […] » about 400 words

About My code4lib Presentation

As with all my other presentations, the my slides tell less than half the story, but I’ve posted them anyway. I’m told the audio was recorded, and there’s a chance that will help explain all this, but until then you’ll have to piece this all together from my previous writings, what little I’m about to […] » about 300 words

WPopac: An OPAC 2.0 Testbed

First things first, this thing probably needs a better name, but I’m not up to the task. Got ideas? Post in the comments. For the rest of this, let’s just pretend it’s an interview. What is WPopac? It’s an OPAC — a library catalog, for my readers outside libraries — inside the framework of WordPress, […] » about 1000 words