<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Moggylaceous</title>
	
	<link>http://moggy.laceous.com</link>
	<description>If nothing we do matters, then all that matters is what we do.</description>
	<pubDate>Fri, 15 Aug 2008 22:16:55 +0000</pubDate>
	
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Moggylaceous" type="application/rss+xml" /><feedburner:emailServiceId>971292</feedburner:emailServiceId><feedburner:feedburnerHostname>http://www.feedburner.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.rojo.com/add-subscription?resource=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://blog.rojo.com/RojoWideRed.gif">Subscribe with Rojo</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/Moggylaceous" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FMoggylaceous" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item>
		<title>Paging Hemingway Part Deux</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/365971231/</link>
		<comments>http://moggy.laceous.com/2008/08/15/paging-hemingway-part-deux/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 20:52:14 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[hemingway]]></category>

		<category><![CDATA[paging]]></category>

		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=61</guid>
		<description><![CDATA[A little over a year ago, I wrote a plugin that let you page the HemingwayEx home-page.  Unfortunately it doesn&#8217;t work out-of-the-box with HemingwayEx 1.1 (it also wouldn&#8217;t work with vanilla Hemingway).  The original version made a few assumptions that are no longer true.  So here&#8217;s a new version that still works [...]]]></description>
			<content:encoded><![CDATA[<p>A little over a year ago, I wrote a <a href="http://moggy.laceous.com/2007/07/29/paging-the-hemingwayex-home-page/">plugin</a> that let you page the <a href="http://www.nalinmakar.com/hemingwayex/">HemingwayEx</a> home-page.  Unfortunately it doesn&#8217;t work out-of-the-box with HemingwayEx 1.1 (it also wouldn&#8217;t work with vanilla <a href="http://warpspire.com/hemingway/">Hemingway</a>).  The original version made a few assumptions that are no longer true.  So here&#8217;s a new version that still works with older versions of HemingwayEx (that had a built-in asides feature) as well as working with the latest version (1.1) of HemingwayEx (where the asides feature has been removed).  It will also work with the original Hemingway theme.</p>
<p>The best hook to use is still the <em>query_string</em> filter.  Unfortunately, this specific filter is technically deprecated (and may be removed at some point).  You&#8217;re supposed to use the <em>request</em> filter now.  However, the request filter doesn&#8217;t seem to provide quite as much functionality as the query_string filter.  Namely, there doesn&#8217;t appear to be a good way to check for <em>is_home</em> (which is important for our purposes).</p>
<pre>
&lt;?php

/*
 * Plugin Name: Custom Hemingway Home Query
 * Plugin URI: http://moggy.laceous.com/2008/08/15/paging-hemingway-part-deux/
 * Description: Gives you the ability to use the paging links on your homepage (works with Hemingway and HemingwayEx)
 * Version: 0.2a
 * Author: moggy
 * Author URI: http://moggy.laceous.com
 */

add_filter('query_string', 'custom_hem_home_query');
function custom_hem_home_query($query_string) {
	global $wp_query;
	$wp_query-&gt;parse_query($query_string); //required in order to check is_home
	if ($wp_query-&gt;is_home) {
		if (strlen($query_string) &gt; 0) {
			$query_string .= '&#038;';
		}
		$query_string .= 'posts_per_page=2';
		global $hemingwayEx;
		if (isset($hemingwayEx)) {
			if (method_exists($hemingwayEx, 'get_asides_category_id')) {
				$category_id = $hemingwayEx-&gt;get_asides_category_id();
				if (!is_null($category_id) &#038;&#038; !empty($category_id) &#038;&#038; is_numeric($category_id)) {
					$query_string .= '&#038;cat=-' . $category_id;
				}
			}
		}
	}
	return $query_string;
}

?&gt;
</pre>
<p>An alternate way to do this would be to hook into the <em>pre_get_posts</em> action.  Unfortunately, there&#8217;s a down-side here as well.  Namely, if you create a new <strong>WP_Query</strong> object then this method might interfere with your new WP_Query instance (rather than just affecting the main <a href="http://codex.wordpress.org/The_Loop">loop</a>).  I ran into this very problem with my asides widget, and had to throw in a category check in the code below.</p>
<pre>
&lt;?php

/*
 * Plugin Name: Custom Hemingway Home Query
 * Plugin URI: http://moggy.laceous.com/2008/08/15/paging-hemingway-part-deux/
 * Description: Gives you the ability to use the paging links on your homepage (works with Hemingway and HemingwayEx)
 * Version: 0.2b
 * Author: moggy
 * Author URI: http://moggy.laceous.com
 */

add_action('pre_get_posts', 'custom_hem_home_query', 1, 1);
function custom_hem_home_query($wp_query) {
	if (is_home()) { //at this point is_home is already set
		$wp_query-&gt;query_vars['posts_per_page'] = 2;
		//$wp_query-&gt;query['posts_per_page'] = 2; //only setting query_vars seems to matter
		if (isset($GLOBALS['hemingwayEx'])) {
			if (method_exists($GLOBALS['hemingwayEx'], 'get_asides_category_id')) {
				$category_id = $GLOBALS['hemingwayEx']-&gt;get_asides_category_id();
				if (!is_null($category_id) &#038;&#038; !empty($category_id) &#038;&#038; is_numeric($category_id)) {
					//check if the category has already been set
					//if I don't check this then it breaks my asides widget
					if (strlen($wp_query-&gt;query_vars['cat']) &lt;= 0) {
						$wp_query-&gt;query_vars['cat'] = '-' . $category_id;
					}
				}
			}
		}
	}
}

?&gt;
</pre>
<p>To get this to work you&#8217;ll still need to follow the 3 steps from my <a href="http://moggy.laceous.com/2007/07/29/paging-the-hemingwayex-home-page/">original post</a>. Namely (that&#8217;s número tres for those of you counting along at home *wink wink*), copying the PHP code into a file (i.e. <strong>custom_hem_home_query.php</strong>) and uploading to your plugins folder (don&#8217;t forget to activate the plugin when you&#8217;re ready), commenting out the custom query in your theme&#8217;s index.php file (the <em>query_posts</em> line towards the top), and adding the paging links to your home page (also in your theme&#8217;s index.php file).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=6A13LK"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=6A13LK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=ktY8wk"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=ktY8wk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=zRkJeK"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=zRkJeK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=oXQbtK"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=oXQbtK" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/365971231" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/08/15/paging-hemingway-part-deux/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/08/15/paging-hemingway-part-deux/</feedburner:origLink></item>
		<item>
		<title>Fluency Admin</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/357318532/</link>
		<comments>http://moggy.laceous.com/2008/08/06/fluency-admin/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 11:05:42 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=60</guid>
		<description><![CDATA[Re-skin the WordPress admin area with this cool theme
]]></description>
			<content:encoded><![CDATA[<p>Re-skin the <a href="http://en.wikipedia.org/wiki/WordPress">WordPress</a> admin area with this cool <a href="http://deanjrobinson.com/projects/fluency-admin/">theme</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=CD7U7K"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=CD7U7K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=9JPYek"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=9JPYek" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=bjBf0K"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=bjBf0K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=LCEPMK"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=LCEPMK" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/357318532" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/08/06/fluency-admin/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/08/06/fluency-admin/</feedburner:origLink></item>
		<item>
		<title>Custom Request Methods And PHP</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/352673990/</link>
		<comments>http://moggy.laceous.com/2008/08/01/custom-request-methods-and-php/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 14:41:29 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Internet]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[http]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=59</guid>
		<description><![CDATA[By default, PHP (along with web browsers and HTML in general) uses two of the eight defined HTTP request methods.  The eight methods are: HEAD, GET, POST, PUT, DELETE, TRACE, OPTIONS, and CONNECT.  GET is the most widely used, followed by POST.  Whenever you type a URL into your browser&#8217;s address bar, [...]]]></description>
			<content:encoded><![CDATA[<p>By default, <a href="http://en.wikipedia.org/wiki/PHP">PHP</a> (along with <a href="http://en.wikipedia.org/wiki/Web_browser">web browsers</a> and <a href="http://en.wikipedia.org/wiki/HTML">HTML</a> in general) uses two of the eight defined HTTP <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods">request methods</a>.  The eight methods are: HEAD, GET, POST, PUT, DELETE, TRACE, OPTIONS, and CONNECT.  <strong>GET</strong> is the most widely used, followed by <strong>POST</strong>.  Whenever you type a <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator">URL</a> into your browser&#8217;s address bar, select a bookmark, or click a link you&#8217;re doing a GET.  When you submit a form on a web page the method will be either GET or POST.</p>
<p><a href="http://en.wikipedia.org/wiki/Representational_State_Transfer#RESTful_example:_the_World_Wide_Web">RESTfully</a> designed web-services use POST, GET, PUT, and DELETE.</p>
<p>Behind the scenes a basic GET request looks like this:</p>
<pre>
GET /path/to/file.php HTTP/1.1
Host: www.domain.com
</pre>
<p>If you were to type this URL into your browser it would look like http://www.domain.com/path/to/file.php</p>
<p>Similarly, a POST to the same URL would look like this:</p>
<pre>
POST /path/to/file.php HTTP/1.1
Host: www.domain.com
</pre>
<p>(Note: For the purpose of these examples I&#8217;m leaving out other request headers such as User-Agent, Keep-Alive, Connection, etc. that you might normally see when using a web browser)</p>
<p>When you do a GET or POST you can also pass in variables.  Consider a web page with a form that asks you to submit your first and last name.</p>
<p>The GET request might look like this:</p>
<pre>
GET /path/to/file.php?FirstName=John&#038;LastName=Doe HTTP/1.1
Host: www.domain.com
</pre>
<p>As you can see, the variables are attached to the URL.  In your browser this would look like http://www.domain.com/path/to/file.php?FirstName=John&#038;LastName=Doe.  These type of request variables are sometimes known as GET variables.</p>
<p>The POST version of this request would look like this:</p>
<pre>
POST /path/to/file.php HTTP/1.1
Host: www.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 27

FirstName=John&#038;LastName=Doe
</pre>
<p>As you can see, the variables aren&#8217;t appended to the URL in a POST, but instead submitted following the request headers.  Variables submitted in this way are sometimes known as POST variables.  In this example I also set the Content-Length and Content-Type headers indicating that this POST was submitting name/value pairs.  You can also submit other data via POST such as uploading a file (and you would want to set the Content-Type appropriately).</p>
<p>PHP has two <a href="http://php.net/manual/en/language.variables.superglobals.php">superglobals</a> called <strong>$_GET</strong> and <strong>$_POST</strong>.  These arrays are automatically populated by PHP based on the request.</p>
<p>It should be noted that it&#8217;s technically possible to submit a POST request with both GET and POST-type variables.</p>
<pre>
POST /path/to/file.php?variable1=value1&#038;variable2=value2 HTTP/1.1
Host: www.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 27

FirstName=John&#038;LastName=Doe
</pre>
<p>In this case, $_GET would be populated with:</p>
<pre>
Array
(
    [variable1] => value1
    [variable2] => value2
)
</pre>
<p>And $_POST would be populated with:</p>
<pre>
Array
(
    [FirstName] => John
    [LastName] => Doe
)
</pre>
<p><span style="text-decoration: underline;"><strong>Using A Custom Request Method</strong></span><br />
What happens if you want to create a RESTful web-service and submit a PUT request to a PHP page?  What if you want to make up your own request method; how do you handle that with PHP?</p>
<p>Consider the following request:</p>
<pre>
MYMETHOD /path/to/file.php HTTP/1.1
Host: www.domain.com
Content-Length: 27

FirstName=John&#038;LastName=Doe
</pre>
<p>In this example I&#8217;m submitting POST-style variables with my own made-up request method called <strong>MYMETHOD</strong>.  I could just as easily substitute <strong>MYMETHOD</strong> with <strong>PUT</strong>.  You can easily submit this type of request with a <a href="http://en.wikipedia.org/wiki/Mozilla_Firefox">Firefox</a> extension called <a href="http://www.xucia.com/#RestTest">RestTest</a>.  You can verify what is actually being sent with another extension called <a href="http://livehttpheaders.mozdev.org/">Live HTTP Headers</a>.</p>
<p>(Note: Some servers may be locked down to only allow certain request methods. If you make a request with a method that&#8217;s not allowed then the server will respond back with a 405 Method Not Allowed error.  A 405 response will include a response header letting you know which methods are allowed.)</p>
<p>If you don&#8217;t want to rely on the convenience of $_GET and $_POST then you can always parse out the raw data yourself.</p>
<ul>
<li><strong>$_SERVER['QUERY_STRING']</strong> is the raw version of <strong>$_GET</strong></li>
<li><strong>php://input</strong> is the raw version of <strong>$_POST</strong></li>
</ul>
<p>You should never have to parse out the query string manually, but $_POST is only populated if the request method is POST and an appropriate Content-Type is set.</p>
<p>To get our raw MYMETHOD data we could do something like this:</p>
<pre>
if ($_SERVER['REQUEST_METHOD'] == 'MYMETHOD')
{
  $raw_data = file_get_contents('php://input');
}
</pre>
<p>We could then parse out the raw data into a $_MYMETHOD variable (to mimic $_GET and $_POST).</p>
<pre>
$array = explode('&#038;', $raw_data);
foreach($array as $item)
{
  list($key, $value) = explode('=', $item);
  $_MYMETHOD[$key] = $value;
}
</pre>
<p><span style="text-decoration: underline;"><strong>Putting It All Together</strong></span><br />
Besides using a tool like RestTest, we can also create a web page that submits a MYMETHOD request.  We&#8217;ll do this by using some JavaScript and making an <a href="http://en.wikipedia.org/wiki/Ajax_(programming)">Ajax</a> request with the <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest</a> object.</p>
<pre>
&lt;?php
if ($_SERVER['REQUEST_METHOD'] == 'MYMETHOD' &#038;&#038; strpos($_SERVER['CONTENT_TYPE'], 'application/x-javascript') !== FALSE):
  $raw_data = file_get_contents('php://input');
  $array = explode('&#038;', $raw_data);
  foreach($array as $item)
  {
    list($key, $value) = explode('=', $item);
    $_MYMETHOD[$key] = $value;
  }
  print_r($_MYMETHOD);

else:
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
/**
 * Bridge XMLHTTP to XMLHttpRequest in pre-7.0 Internet Explorers
 */
if( typeof XMLHttpRequest == "undefined" )
  XMLHttpRequest = function() {
    try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
    try { return new ActiveXObject("Msxml2.XMLHTTP") }     catch(e) {}
    try { return new ActiveXObject("Microsoft.XMLHTTP") }  catch(e) {}
    throw new Error( "This browser does not support XMLHttpRequest or XMLHTTP." )
  };

function ajax(url, vars) {
  var request = new XMLHttpRequest();
  request.open("MYMETHOD", url, true);
  request.setRequestHeader("Content-Type", "application/x-javascript;");

  request.onreadystatechange = function() {
    if (request.readyState == 4 &#038;&#038; request.status == 200) {
      if (request.responseText) {
        alert(request.responseText);
      }
    }
  };

  request.send(vars);
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;input type="button" value="click for ajax" onclick="javascript:ajax('&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;', 'FirstName=John&amp;amp;LastName=Doe');" /&gt;

&lt;/body&gt;
&lt;/html&gt;
&lt;?php endif; ?&gt;
</pre>
<p>If you copy this into a PHP file (i.e. mymethod.php), upload it to a PHP-enabled web server, and navigate to it with your web browser you&#8217;ll see a button that says <strong>click for ajax</strong>.  If you click the button, an asynchronous MYMETHOD request will be sent, the server will parse out the sent name/value pairs and send the processed data back to the browser.  The user will then be presented with an alert popup containing the following text:</p>
<pre>
Array
(
    [FirstName] => John
    [LastName] => Doe
)
</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=8DoZjK"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=8DoZjK" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=reXHXk"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=reXHXk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=54le7K"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=54le7K" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=nQZsEK"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=nQZsEK" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/352673990" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/08/01/custom-request-methods-and-php/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/08/01/custom-request-methods-and-php/</feedburner:origLink></item>
		<item>
		<title>Criticizing OpenID</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/346651411/</link>
		<comments>http://moggy.laceous.com/2008/07/26/criticizing-openid/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 14:57:13 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<category><![CDATA[openid]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=55</guid>
		<description><![CDATA[Problems with OpenID
]]></description>
			<content:encoded><![CDATA[<p><a href="http://idcorner.org/2007/08/22/the-problems-with-openid/">Problems</a> with <a href="http://en.wikipedia.org/wiki/OpenID">OpenID</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=Y4F8mJ"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=Y4F8mJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=d8rMij"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=d8rMij" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=fgPwgJ"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=fgPwgJ" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=68kaWJ"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=68kaWJ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/346651411" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/07/26/criticizing-openid/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/07/26/criticizing-openid/</feedburner:origLink></item>
		<item>
		<title>Firefox &amp; KDE</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/317089882/</link>
		<comments>http://moggy.laceous.com/2008/06/21/firefox-kde/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 21:50:51 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=54</guid>
		<description><![CDATA[Integrating Firefox with KDE
]]></description>
			<content:encoded><![CDATA[<p><a href="http://gentoo-wiki.com/HOWTO_Integrate_Firefox_with_KDE">Integrating</a> <a href="http://en.wikipedia.org/wiki/Mozilla_Firefox">Firefox</a> with <a href="http://en.wikipedia.org/wiki/KDE">KDE</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=6TkgXI"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=6TkgXI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=uJRxEi"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=uJRxEi" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=gYTVBI"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=gYTVBI" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=AIfSII"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=AIfSII" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/317089882" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/06/21/firefox-kde/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/06/21/firefox-kde/</feedburner:origLink></item>
		<item>
		<title>Semisecure Login Reimagined</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/301636131/</link>
		<comments>http://moggy.laceous.com/2008/05/30/semisecure-login-reimagined/#comments</comments>
		<pubDate>Sat, 31 May 2008 03:28:17 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=51</guid>
		<description><![CDATA[Prior to WordPress 2.5, I&#8217;d been using a plugin called Semisecure Login.  This plugin would encrypt your password when logging in via a one-way md5 hash and compare this to your password&#8217;s md5 hash on the server side (prior to WordPress 2.5 passwords were stored in the database as md5 hashes).  A nonce [...]]]></description>
			<content:encoded><![CDATA[<p>Prior to WordPress 2.5, I&#8217;d been using a plugin called <a href="http://jamesmallen.net/2007/09/16/semisecure-login/">Semisecure Login</a>.  This plugin would encrypt your password when logging in via a one-way <a href="http://en.wikipedia.org/wiki/MD5">md5</a> hash and compare this to your password&#8217;s md5 hash on the server side (prior to WordPress 2.5 passwords were stored in the database as md5 hashes).  A <a href="http://en.wikipedia.org/wiki/Cryptographic_nonce">nonce</a> was thrown in for good measure to help prevent replay attacks.  This, effectively, provided a &#8220;semisecure&#8221; login environment.  It obviously wasn&#8217;t as secure as using an SSL cert (it wouldn&#8217;t prevent session hijacking, etc.) but I liked it.</p>
<p>With the release of WordPress 2.5, passwords are now hashed up by <a href="http://www.openwall.com/phpass/">phpass</a> before entering the database.  Further complicating the matter, phpass salts each password before hashing.  This change effectively &#8220;breaks&#8221;  Semisecure Login.  Using a <a href="http://boren.nu/archives/2008/03/27/md5-password-hashes-for-25/">plugin</a>, it&#8217;s possible to revert back to the md5 hashes, and  <a href="http://wordpress.org/extend/plugins/semisecure-login-for-25/">Semisecure Login for WordPress 2.5</a> takes advantage of this.</p>
<p>On the other hand, I wanted to keep using the new phpass hashes and still provide a semisecure login environment.  <a href="http://www.nabble.com/Client-side-password-encryption-td16077072.html">This</a> thread details the difficulty in making this happen.  There didn&#8217;t seem to be any way to use one-way hashing, and using standard <a href="http://en.wikipedia.org/wiki/Symmetric-key_algorithm">secret-key</a> encryption was out (for obvious reasons).  The only thing that left me with was to try and use <a href="http://en.wikipedia.org/wiki/Public-key_cryptography">public-key</a> encryption.</p>
<p><a href="http://en.wikipedia.org/wiki/RSA">RSA</a> is a popular public-key algorithm, and I was able to find a few implementations in both JavaScript and PHP.  My main criteria in picking which implementation(s) to use were (1) interoperability between JavaScript and PHP, (2) efficiency, speed, and performance and (3) a solution that would work for most shared hosts.  I ended up settling on the <a href="http://www-cs-students.stanford.edu/~tjw/jsbn/">jsbn</a> library for JavaScript and <a href="http://php.net/openssl">OpenSSL</a> on the PHP side.  Unfortunately, PHP&#8217;s built-in openssl functions are rather limited when it comes to generating RSA keypairs, so I had to rely on making calls directly against openssl when generating a keypair. This works great on a Linux server but is currently untested on Windows (although I have a feeling it would work as long as the folder where OpenSSL lives was added to the system path).</p>
<p><span style="text-decoration: underline;"><strong>Download</strong></span><br />
You can download <a href="http://wordpress.org/extend/plugins/semisecure-login-reimagined/">Semisecure Login Reimagined</a> at its official Wordpress page. Additional information, such as installation instructions and changelog, are located there as well.</p>
<p><span style="text-decoration: underline;"><strong>Requirements</strong></span></p>
<ul>
<li>Wordpress: 2.1 to 2.5.1 (2.5.1 is the latest version at the time of this post)</li>
<li>PHP: 4 or 5 (tested as far back as 4.4.6 and up to 5.2.6)</li>
<li>OpenSSL (initial keypair generation is handled by direct calls, while decryption is handled by built-in PHP functions)</li>
</ul>
<p>All tests were performed on various Linux servers. PHP&#8217;s program execution <a href="http://php.net/manual/en/ref.exec.php">functions</a> need to be enabled for the initial keypair generation (<a href="http://php.net/safe+mode">safe mode</a> should also be disabled for this). After the keypair is generated, it&#8217;s safe to go ahead and re-disable these functions and/or re-enable safe mode. Everyday use of this plugin relies on PHP&#8217;s built-in openssl functions.</p>
<p><span style="text-decoration: underline;"><strong>Update (6/13/08)</strong></span><br />
As of v1.1.0, keypair generation will work even if safe mode is enabled or the PHP execution fuctions have been disabled.  This alternative keypair generation mode will only work if you&#8217;re running PHP 5.2.0 or greater, however.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=X9sFMH"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=X9sFMH" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=nzgU9h"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=nzgU9h" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=FrTnxH"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=FrTnxH" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=SBO9YH"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=SBO9YH" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/301636131" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/05/30/semisecure-login-reimagined/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/05/30/semisecure-login-reimagined/</feedburner:origLink></item>
		<item>
		<title>Gmail Redesigned</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/300092081/</link>
		<comments>http://moggy.laceous.com/2008/05/28/gmail-redesigned/#comments</comments>
		<pubDate>Wed, 28 May 2008 21:04:41 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[gmail]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/?p=52</guid>
		<description><![CDATA[Re-skin Gmail with this cool theme
]]></description>
			<content:encoded><![CDATA[<p>Re-skin <a href="http://mail.google.com">Gmail</a> with this cool <a href="http://userstyles.org/styles/5867">theme</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=PZjD2H"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=PZjD2H" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=V3wxqh"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=V3wxqh" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=JY5WtH"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=JY5WtH" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=ctfljH"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=ctfljH" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/300092081" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/05/28/gmail-redesigned/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/05/28/gmail-redesigned/</feedburner:origLink></item>
		<item>
		<title>Access Linux Drives From Windows</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/254950248/</link>
		<comments>http://moggy.laceous.com/2008/03/20/access-linux-drives-from-windows/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 14:46:11 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/2008/03/20/access-linux-drives-from-windows/</guid>
		<description><![CDATA[Accessing Ext2/3 drives (or partitions) from Windows
]]></description>
			<content:encoded><![CDATA[<p><a href="http://gentoo-wiki.com/Ext3_in_windows">Accessing</a> Ext2/3 drives (or partitions) from Windows</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=5UlHGDF"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=5UlHGDF" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=u6L4Dmf"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=u6L4Dmf" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=1Pt4Z4F"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=1Pt4Z4F" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=xWa7mbF"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=xWa7mbF" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/254950248" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/03/20/access-linux-drives-from-windows/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/03/20/access-linux-drives-from-windows/</feedburner:origLink></item>
		<item>
		<title>How To Unprotect A Folder In Apache</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/232080255/</link>
		<comments>http://moggy.laceous.com/2008/02/09/how-to-unprotect-a-folder-in-apache/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 08:45:39 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Internet]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[passwords]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/2008/02/09/how-to-unprotect-a-folder-in-apache/</guid>
		<description><![CDATA[The Apache HTTP web-server makes it easy to protect a folder (and its sub-folders) with a username/password prompt.  Simply create a .htaccess file in the specified folder, and add something like this:

AuthName "Folder Protection"
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
Require valid-user
For help with generating a valid .htpasswd file, you can use a tool like Dynamic Drive&#8217;s .htaccess [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/Apache_HTTP_Server">Apache HTTP web-server</a> makes it easy to protect a folder (and its sub-folders) with a username/password prompt.  Simply create a <a href="http://en.wikipedia.org/wiki/.htaccess">.htaccess</a> file in the specified folder, and add something like this:</p>
<pre>
AuthName "Folder Protection"
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
Require valid-user</pre>
<p>For help with generating a valid .htpasswd file, you can use a tool like Dynamic Drive&#8217;s <a href="http://tools.dynamicdrive.com/password/">.htaccess Password Generator</a>.  There are <a href="http://www.google.com/search?q=apache+password+protect">plenty</a> of tutorials online that explain this process.</p>
<p>On the other hand, it&#8217;s much harder to find information about unprotecting a sub-folder of a folder that is protected in the manner specified above.  Some posts I read implied that it wasn&#8217;t possible at all.  I finally found the answer <a href="http://toel.se/~toel/content/knowledge.php?act=show&amp;id=11">here</a> and <a href="http://www.hybrid6.com/webgeek/2007/02/htaccess-reference.php#Password_unprotection">here</a>.  Basically, in the sub-folder you&#8217;re trying to unprotect, you simply need to create a new .htaccess file and add the following:</p>
<pre>
Satisfy Any</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=ZOxtGJE"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=ZOxtGJE" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=xzD2Ede"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=xzD2Ede" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=orxdF5E"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=orxdF5E" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=vOb7DwE"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=vOb7DwE" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/232080255" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/02/09/how-to-unprotect-a-folder-in-apache/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/02/09/how-to-unprotect-a-folder-in-apache/</feedburner:origLink></item>
		<item>
		<title>Custom Firefox Autoscrolling Icon</title>
		<link>http://feeds.feedburner.com/~r/Moggylaceous/~3/232058877/</link>
		<comments>http://moggy.laceous.com/2008/02/08/custom-firefox-autoscrolling-icon/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 07:31:19 +0000</pubDate>
		<dc:creator>moggy</dc:creator>
		
		<category><![CDATA[Asides]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[icon]]></category>

		<guid isPermaLink="false">http://moggy.laceous.com/2008/02/08/custom-firefox-autoscrolling-icon/</guid>
		<description><![CDATA[Using a bug in Firefox you can manipulate the autoscrolling icon
]]></description>
			<content:encoded><![CDATA[<p>Using a bug in Firefox you can <a href="http://www.sitepoint.com/blogs/2005/01/17/customizing-the-autoscrolling-icon/">manipulate</a> the autoscrolling icon</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/Moggylaceous?a=5g2bqiE"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=5g2bqiE" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=wPQmmue"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=wPQmmue" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=8kGqRrE"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=8kGqRrE" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/Moggylaceous?a=rGqOQsE"><img src="http://feeds.feedburner.com/~f/Moggylaceous?i=rGqOQsE" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Moggylaceous/~4/232058877" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://moggy.laceous.com/2008/02/08/custom-firefox-autoscrolling-icon/feed/</wfw:commentRss>
		<feedburner:origLink>http://moggy.laceous.com/2008/02/08/custom-firefox-autoscrolling-icon/</feedburner:origLink></item>
	</channel>
</rss>
