<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Garage Blog &#187; Uncategorized</title>
	<atom:link href="http://codegarage.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://codegarage.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 08 Mar 2012 23:26:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Can I Just Replace My Old timthumb.php File With the New Version?</title>
		<link>http://codegarage.com/blog/2011/09/can-i-just-replace-my-old-timthumb-php-file-with-the-new-version/</link>
		<comments>http://codegarage.com/blog/2011/09/can-i-just-replace-my-old-timthumb-php-file-with-the-new-version/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 15:48:26 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=354</guid>
		<description><![CDATA[First things first: Yes, you can just replace your old timthumb.php file with the new version of timthumb, found here. If that&#8217;s all you were after, move along &#8211; if you want a little more explanation, read on: With all of the hubbub around the recent timthumb vulnerability, lots of people are looking for some ...]]></description>
			<content:encoded><![CDATA[<p>First things first:  Yes, you can just replace your old timthumb.php file with the new version of timthumb, found <a href="http://timthumb.googlecode.com/svn-history/r136/trunk/timthumb.php">here</a>.  If that&#8217;s all you were after, move along &#8211; if you want a little more explanation, read on:</p>
<p><object width="620" height="374"><param name="movie" value="http://www.youtube.com/v/C9zdv3M-Cpg?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/C9zdv3M-Cpg?version=3" type="application/x-shockwave-flash" width="620" height="374" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>With all of the hubbub around the recent <a href="http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/" title="How to Clean Up the TimThumb Security Vulnerability">timthumb vulnerability</a>, lots of people are looking for some easy instructions on how to get it taken care of.  You should be, because I&#8217;ve cleaned up more hacks in the past 2 weeks related to this vulnerability than I have in the last 2 months &#8211; people ARE getting hacked due to this.</p>
<p>Unfortunately, if you&#8217;re not totally comfortable with code, upgrading this file can be a little scary.  Good news, I&#8217;m here to help.</p>
<h2>How do I know if I&#8217;m using timthumb?</h2>
<p>This one isn&#8217;t too hard &#8211; the easiest way to figure this out is to use a scanner of some sort to search your server for the timthumb script.  I&#8217;ve written a <a href="http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/">timthumb scanner that runs as a WordPress Plugin</a> &#8211; you can find that <a href="http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/">here</a>.</p>
<p>If you&#8217;re not comfortable with that process, you might be able to just give your blog a once over and figure it out yourself.  Are you showing thumbnails on the homepage?  If so, you might be using timthumb.  Right click one of the thumbnails, and click &#8220;open image in new tab&#8221; (or the equivalent &#8211; that&#8217;s what it says on chrome on a mac).<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.34.36-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.34.36-AM-680x289.png" alt="" title="Open in new tab" width="600" height="255" class="aligncenter size-large wp-image-358" /></a>In the new tab that opens, check out the url bar &#8211; does it say timthumb.php anywhere in the url (check the text right before the question mark, if there is one)?  Note &#8211; this might also just say &#8220;thumb.php&#8221;<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/timthumb_url.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/timthumb_url-680x84.png" alt="" title="timthumb_url" width="600" height="74" class="aligncenter size-large wp-image-355" /></a></p>
<h2>How do I know if my timthumb script is vulnerable?</h2>
<p><a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.41.16-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-01-at-9.41.16-AM.png" alt="" title="Screen Shot 2011-09-01 at 9.41.16 AM" width="213" height="102" class="aligncenter size-full wp-image-363" /></a>Fortunately, this one is pretty easy.  Open up the file in the wordpress theme editor, or using FTP (it&#8217;s probably in your theme directory, called timthumb.php or thumb.php &#8211; the previous step should tell you that).  Look for this code, near the top:</p>
<pre class="brush: php">

// external domains that are allowed to be displayed on your website
$allowedSites = array (
	&#039;flickr.com&#039;,
	&#039;picasa.com&#039;,
	&#039;blogger.com&#039;,
	&#039;wordpress.com&#039;,
	&#039;img.youtube.com&#039;,
	&#039;upload.wikimedia.org&#039;,
);

// STOP MODIFYING HERE!
// --------------------
</pre>
<p>To clarify (or make things more confusing):  If you see this:</p>
<pre class="brush: php">
// If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains.
if(! isset($ALLOWED_SITES)){
	$ALLOWED_SITES = array (
			&#039;flickr.com&#039;,
			&#039;picasa.com&#039;,
			&#039;img.youtube.com&#039;,
			&#039;upload.wikimedia.org&#039;,
			&#039;photobucket.com&#039;,
			&#039;imgur.com&#039;,
			&#039;imageshack.us&#039;,
			&#039;tinypic.com&#039;
	);
}
// -------------------------------------------------------------
// -------------- STOP EDITING CONFIGURATION HERE --------------
// -------------------------------------------------------------
</pre>
<p>You&#8217;re ok.  $allowedSites = Bad, $ALLOWED_SITES = Good.  For another way to check, if you look up near the top of the file and see this:</p>
<pre class="brush: php">
define (&#039;VERSION&#039;, &#039;2.8&#039;);										// Version of this script
</pre>
<p>You&#8217;re good.  Version 2.0 and greater are safe to use.</p>
<p>If it doesnt look like you&#8217;re using the right version, it&#8217;s time to clean it up!</p>
<h2>How do I fix it?</h2>
<p>400 words later, we finally get back to the question posed in the title.  Can I just replace the old, vulnerable code with new, safe code, and have everything still work?  Yes, you can.<br />
From the previous step, you&#8217;ve got the file open in your WordPress theme editor.  All you need to do is replace the entire contents of the file with the code found here:</p>
<p>http://timthumb.googlecode.com/svn/trunk/timthumb.php</p>
<p>Save the file, and you&#8217;re done!  Your thumbnails still work, and you can sleep a little easier at night.</p>
<p><strong>Plug Time</strong>: I do this service for subscribers to my <a href="http://codegarage.com/">WordPress backup and security monitoring service</a> &#8211; so if you&#8217;re not sure you want to take it on yourself, have a look <a href="http://codegarage.com/">here</a>.  If you just have a question, or need some guidance, I&#8217;m happy to give that away for free.  Get in touch with me at <a href="peter@codegarage.com">peter@codegarage.com</a>.  Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/09/can-i-just-replace-my-old-timthumb-php-file-with-the-new-version/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Dealing with Curly Quotes in WordPress by Changing Your Site&#8217;s Character Encoding.</title>
		<link>http://codegarage.com/blog/2011/05/dealing-with-curly-quotes-in-wordpress-by-changing-your-sites-character-encoding/</link>
		<comments>http://codegarage.com/blog/2011/05/dealing-with-curly-quotes-in-wordpress-by-changing-your-sites-character-encoding/#comments</comments>
		<pubDate>Sat, 21 May 2011 17:30:04 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=294</guid>
		<description><![CDATA[Here&#8217;s a problem I run into every few months with a customer: Their site is suddenly showing strange characters (strange question marks, accented characters, general gibberish) in place of quotation marks, dashes, etc. Oftentimes this happens after a move, but it could also be the result of a few other things. The Problem The problem ...]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a problem I run into every few months with a customer:  Their site is suddenly showing strange characters (strange question marks, accented characters, general gibberish) in place of quotation marks, dashes, etc.  Oftentimes this happens after a move, but it could also be the result of a few other things.  </p>
<h2>The Problem</h2>
<p>The problem is generally a result of pasting straight from Microsoft Word (or similar) into WordPress.  Word generates lots of evil characters that WordPress and web servers don&#8217;t deal with properly.  As a result, you end up with gibberish.  And frustration.</p>
<h2>The Solution</h2>
<p>The best solution is to stop pasting formatted text from Word into WordPress.  That is, however, not useful if you&#8217;re already dealing with the problem.  You could manually replace the problem characters, but that takes FOREVER, and writing a script to get into the database and do it for you is a chore I havent been confident enough to take on, because of the relative obscurity of the problem ( and how difficult it is to find every problem instance ).  So, I generally take the easy way out, which is this:</p>
<h3>Change your site&#8217;s character encoding</h3>
<p>Yep.  Just trick wordpress/web browsers to treat the content with Microsoft&#8217;s character set, brush your hands off, and be on your way.  Here&#8217;s how:</p>
<ol>
<li><strong>Navigate to yoursite.com/wp-admin/options.php</strong><br />You&#8217;re goign to have to type this in, there are no links from the WP backend to this page.</li>
<li><strong>Seach for &#8220;blog_charset&#8221;:</strong><img src="http://codegarage.com/blog/wp-content/uploads/2011/05/Screen-shot-2011-05-21-at-11.26.15-AM.png" alt="" title="blog_charset" width="807" height="111" class="aligncenter size-full wp-image-295" /></li>
<li><strong>Change the value to &#8220;windows-1252&#8243; and save.</strong></li>
<li><strong>Move on to more interesting problems</strong></li>
</ol>
<p>There you go:  Band aid applied.  Again, this isn&#8217;t an ideal solution, it&#8217;s more like the &#8220;quick, dirty, I&#8217;m tired of dealing with it solution&#8221;.  </p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/05/dealing-with-curly-quotes-in-wordpress-by-changing-your-sites-character-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We&#8217;ve Moved!</title>
		<link>http://codegarage.com/blog/2011/03/weve-moved/</link>
		<comments>http://codegarage.com/blog/2011/03/weve-moved/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 16:48:09 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://yourcodegarage.com/blog/?p=260</guid>
		<description><![CDATA[I finally took the plunge and redirected apartmentonesix.com here to yourcodegarage.com/blog. This is where I&#8217;ll be doing all of my code and tech help related blogging from here on out. Expect much more frequent content over here. Thanks for visiting!]]></description>
			<content:encoded><![CDATA[<p>I finally took the plunge and redirected apartmentonesix.com here to yourcodegarage.com/blog.  This is where I&#8217;ll be doing all of my code and tech help related blogging from here on out.  Expect much more frequent content over here.</p>
<p>Thanks for visiting!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/03/weve-moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Post Tags in WordPress</title>
		<link>http://codegarage.com/blog/2009/12/get-post-tags-in-wordpress/</link>
		<comments>http://codegarage.com/blog/2009/12/get-post-tags-in-wordpress/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 22:59:47 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://apartmentonesix.com/?p=205</guid>
		<description><![CDATA[Here&#8217;s a little tidbit I can NEVER find when I need it: If you need to get all the tags that belong to a current post, here&#8217;s the function: $tags = get_the_tags($post_id); This will return an associative array of tags, with all their relevant info. BONUS If you need the same thing with categories, here&#8217;s ...]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little tidbit I can NEVER find when I need it:  If you need to get all the tags  that belong to a current post, here&#8217;s the function:</p>
<p>$tags = get_the_tags($post_id);</p>
<p>This will return an associative array of tags, with all their relevant info.</p>
<p><strong>BONUS</strong><br />
If you need the same thing with categories, here&#8217;s your function:</p>
<pre class="brush: php">
    $args[&#039;fields&#039;] = &#039;all&#039;;
    $categories = wp_get_post_categories($post_id, $args);
</pre>
<p>Including the args bit allows you to retrieve all the category info.  If you leave that out (and use only the $post_id argument), you&#8217;ll get an array of relevant category ids, but no other info.</p>
<p>Big thanks to Clay Lua at <a href="http://hugred.com">hungred.com</a> and his post <a href="http://hungred.com/how-to/tag-post-id-wordpress/">Get Tag with Post ID in WordPress</a> for pointing me in the right direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2009/12/get-post-tags-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

