<?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"
	>

<channel>
	<title>Adventures in Programming</title>
	<atom:link href="http://www.rockurchin.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rockurchin.com/blog</link>
	<description>And other random crap</description>
	<pubDate>Thu, 01 May 2008 01:05:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Fricken HTML Emails!</title>
		<link>http://www.rockurchin.com/blog/2008/04/fricken-html-emails/</link>
		<comments>http://www.rockurchin.com/blog/2008/04/fricken-html-emails/#comments</comments>
		<pubDate>Thu, 01 May 2008 01:05:41 +0000</pubDate>
		<dc:creator>Rockurchin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[hell]]></category>

		<category><![CDATA[hotmail]]></category>

		<category><![CDATA[html email]]></category>

		<guid isPermaLink="false">http://www.rockurchin.com/blog/?p=6</guid>
		<description><![CDATA[Building html emails is a royal pain in the arse. Every email clients buggers up something along the way. Here&#8217;s the most annoying things I&#8217;ve figured out along the way&#8230;
Microsoft Outlook 2007

You can&#8217;t use background images in table cells. Thanks Microsoft.
Forgetting a width on a table cell can cause the whole thing to blow apart [...]]]></description>
			<content:encoded><![CDATA[<p>Building html emails is a royal pain in the arse. Every email clients buggers up something along the way. Here&#8217;s the most annoying things I&#8217;ve figured out along the way&#8230;</p>
<p>Microsoft Outlook 2007</p>
<ul>
<li>You can&#8217;t use background images in table cells. Thanks Microsoft.</li>
<li>Forgetting a width on a table cell can cause the whole thing to blow apart to full page width, even though the main table width is defined</li>
</ul>
<p>Firefox</p>
<ul>
<li>Table cells with no align specified default to center aligned. Everyone else defaults to left.</li>
</ul>
<p>Hotmail</p>
<ul>
<li>WTF?!. Images randomly completely screw everything up unless you specifically add an inline style of &#8220;display:block&#8221;</li>
</ul>
<p>I shall add to this list as I discover more mind numbingly stupid things I have to deal with&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockurchin.com/blog/2008/04/fricken-html-emails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Phorum - A forum that is actually easy to integrate!</title>
		<link>http://www.rockurchin.com/blog/2008/04/phorum-a-forum-that-is-actually-easy-to-integrate/</link>
		<comments>http://www.rockurchin.com/blog/2008/04/phorum-a-forum-that-is-actually-easy-to-integrate/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 17:38:13 +0000</pubDate>
		<dc:creator>Rockurchin</dc:creator>
		
		<category><![CDATA[3rd Party Integration]]></category>

		<category><![CDATA[Add new tag]]></category>

		<category><![CDATA[forums]]></category>

		<category><![CDATA[phorum]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.rockurchin.com/blog/?p=4</guid>
		<description><![CDATA[Integrating forums with your own application and user base can be a real pain in the ass. I&#8217;ve done this in the past with Vbulletin and phpBB, but it&#8217;s really not that much fun. Both involved some degree of hacking of their core code which means problems when trying to upgrade (you have to remember [...]]]></description>
			<content:encoded><![CDATA[<p>Integrating forums with your own application and user base can be a real pain in the ass. I&#8217;ve done this in the past with Vbulletin and phpBB, but it&#8217;s really not that much fun. Both involved some degree of hacking of their core code which means problems when trying to upgrade (you have to remember every tiny thing you did to make it work).  As both products improve and get more advanced you&#8217;d think they&#8217;d have built nice apis to make this job easier. Apparently not yet&#8230;</p>
<p>I&#8217;ve been pissing about with my own pet project ( <a title="BandResources.net" href="http://www.bandresources.net" target="_blank">http://www.bandresources.net</a> ), and decided I&#8217;d like a forum too. Obviously I&#8217;d need single sign on.  Was even considering building my own forum app from scratch so I would have to deal with the usual headaches, but then I discovered <a title="phorum" href="http://www.phorum.org/" target="_blank">Phorum</a> .  OK, it&#8217;s been around since 1998, but it always seemed kind of fugly and basic compared to phpBB and VBulletin when I&#8217;d checked it out in the past. Turns out it is actually awesome - lean and fast, and it has a fricken API so that it&#8217;s really bloody easy to integrate with other apps!</p>
<p>Read on to find out how to integrate in a rediculously short time.</p>
<p><span id="more-4"></span></p>
<p>As I mentioned Phorum has it&#8217;s own API with hooks into all the important areas of functionality. To get external authentication up and running all I had to do was a few simple things.</p>
<ul>
<li>Install phorum!</li>
<li>Alter my login script to sync the phorum_users table whenever a user logs in successfully. Don&#8217;t need to sync all fields, but make sure the record contains at least the user_id, username, displayname, email.  Also the &#8220;active&#8221; field has to be set to &#8220;1&#8243; or this won&#8217;t work.</li>
<li>Create a simple forum module that overrides phorum&#8217;s own check to see if you&#8217;re logged in. My code is below. How you get the user_id will depend on your own application. Drop this php file in the mods directory</li>
<li>Login to phorum admin panel. Go to Global Settings > Modules, and your module should be somewhere on that page. Turn it on!</li>
</ul>
<p>After you have done this trying logging into your main site, then come back to phorum. If all is well it will show you are logged in! After that you just need to edit the templates of whatever theme you are using and change login/registration links to point to your the corresponding pages on the main site.</p>
<div class="geshi no php">
<div class="head">
<h3>mod_userauth.php</h3>
</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw2">function</span> userauth_session_restore<span class="br0">&#40;</span><span class="re1">$sessions</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span><span class="co1">//I found out how to do this here: http://www.phorum.org/phorum5/read.php?28,125993</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span><span class="kw3">defined</span><span class="br0">&#40;</span><span class="st0">&quot;PHORUM&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw1">return</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* phorum module info</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">title: UserAuth</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">desc: This is an external UserAuth module for Phorum. Going to use my own authentication</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">version: 1.0.0</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">release_date: Apr 14th, 2008</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">url: http://www.bandresources.net</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">author: xxx</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">require_version: 5.2.2</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">category: user_features</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">hook: user_session_restore|userauth_session_restore</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* I&#39;m using a custom session handler in the main site. Fire this up to get my user_id */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">include_once</span> SITE_PATH <span class="sy0">.</span> <span class="st0">&quot;/classes/class.sessions.php&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$ses_class</span> <span class="sy0">=</span> <span class="kw2">new</span> Session<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">session_set_cookie_params</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">session_set_save_handler</span> <span class="br0">&#40;</span><span class="kw3">array</span><span class="br0">&#40;</span><span class="sy0">&amp;</span>amp<span class="sy0">;</span><span class="re1">$ses_class</span><span class="sy0">,</span> <span class="st0">&#39;_open&#39;</span><span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">array</span><span class="br0">&#40;</span><span class="sy0">&amp;</span>amp<span class="sy0">;</span><span class="re1">$ses_class</span><span class="sy0">,</span> <span class="st0">&#39;_close&#39;</span><span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">array</span><span class="br0">&#40;</span><span class="sy0">&amp;</span>amp<span class="sy0">;</span><span class="re1">$ses_class</span><span class="sy0">,</span> <span class="st0">&#39;_read&#39;</span><span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">array</span><span class="br0">&#40;</span><span class="sy0">&amp;</span>amp<span class="sy0">;</span><span class="re1">$ses_class</span><span class="sy0">,</span> <span class="st0">&#39;_write&#39;</span><span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">array</span><span class="br0">&#40;</span><span class="sy0">&amp;</span>amp<span class="sy0">;</span><span class="re1">$ses_class</span><span class="sy0">,</span> <span class="st0">&#39;_destroy&#39;</span><span class="br0">&#41;</span><span class="sy0">,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">array</span><span class="br0">&#40;</span><span class="sy0">&amp;</span>amp<span class="sy0">;</span><span class="re1">$ses_class</span><span class="sy0">,</span> <span class="st0">&#39;_gc&#39;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">session_start</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$user_id</span> <span class="sy0">=</span> <span class="re1">$_SESSION</span><span class="br0">&#91;</span><span class="st0">&#39;user_id&#39;</span><span class="br0">&#93;</span><span class="sy0">;</span> &nbsp;<span class="co1">//If there&#39;s value for $_SESSION[&#39;user_id&#39;] then I&#39;m logged in</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// If no user is logged in. Let&#39;s asume that the magic code would return</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// NULL in that case here. Note that if it would return FALSE, you could even</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// skip the whole if/then here and directly assign $user_id to the $sessions</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// array elements.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="re1">$user_id</span> <span class="sy0">===</span> <span class="kw2">NULL</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$sessions</span><span class="br0">&#91;</span>PHORUM_SESSION_LONG_TERM<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw2">FALSE</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$sessions</span><span class="br0">&#91;</span>PHORUM_SESSION_SHORT_TERM<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw2">FALSE</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// A user is logged in.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//echo &quot;Logged in!&quot;;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$sessions</span><span class="br0">&#91;</span>PHORUM_SESSION_LONG_TERM<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re1">$user_id</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$sessions</span><span class="br0">&#91;</span>PHORUM_SESSION_SHORT_TERM<span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re1">$user_id</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//print_r($sessions);</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">return</span> <span class="re1">$sessions</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Extensive developer and API docs are available at <a href="http:/www.phorum.org/docs/html/">http:/www.phorum.org/docs/html/</a></p>
<p>Phorum rawks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockurchin.com/blog/2008/04/phorum-a-forum-that-is-actually-easy-to-integrate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shadowbox - Yet Another Lightbox</title>
		<link>http://www.rockurchin.com/blog/2008/04/shadowbox-yet-another-lightbox/</link>
		<comments>http://www.rockurchin.com/blog/2008/04/shadowbox-yet-another-lightbox/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 19:28:38 +0000</pubDate>
		<dc:creator>Rockurchin</dc:creator>
		
		<category><![CDATA[Discoveries]]></category>

		<category><![CDATA[ajax]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[lightbox]]></category>

		<guid isPermaLink="false">http://www.rockurchin.com/blog/?p=3</guid>
		<description><![CDATA[Who knew that when Michael Jackson wasn&#8217;t innappropriately touching small boys that he was creating awesome javascript utilitities? (OK probably a different MJ)
Shadowbox is a cross-browser, cross-platform, cleanly-coded and fully-documented media viewer application written entirely in JavaScript. Using Shadowbox, website authors can display a wide assortment of media in all major browsers without navigating away [...]]]></description>
			<content:encoded><![CDATA[<p>Who knew that when Michael Jackson wasn&#8217;t innappropriately touching small boys that he was creating awesome javascript utilitities? (OK probably a different MJ)</p>
<blockquote><p>Shadowbox is a <a href="http://www.astro.cz/_java/shadowbox/doc/support.html#browsers">cross-browser</a>, <a href="http://www.astro.cz/_java/shadowbox/doc/support.html#adapters">cross-platform</a>, cleanly-coded and fully-documented media viewer application written entirely in JavaScript. Using Shadowbox, website authors can display a wide assortment of media in <a href="http://www.astro.cz/_java/shadowbox/doc/support.html#browsers">all major browsers</a> without navigating away from the linking page.</p></blockquote>
<p>This lightbox lets you view not only images, but flash movies and even entire websites. It is also not tied to a particular javascript framework like most of the other lightbox scripts I&#8217;ve found. It comes with adapters for some of the most popular (jquery, prototype etc). You can read more about it, and download the code here: <a href="http://www.astro.cz/_java/shadowbox/">http://www.astro.cz/_java/shadowbox/</a></p>
<p>I&#8217;ve used it in a wee portfolio page I threw together here: <a href="http://www.rockurchin.com/portfolio">http://www.rockurchin.com/portfolio</a> Click on a website link to see it in action. I used it with Jquery.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockurchin.com/blog/2008/04/shadowbox-yet-another-lightbox/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Another pointless blog</title>
		<link>http://www.rockurchin.com/blog/2008/04/hello-world/</link>
		<comments>http://www.rockurchin.com/blog/2008/04/hello-world/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 00:22:39 +0000</pubDate>
		<dc:creator>Rockurchin</dc:creator>
		
		<category><![CDATA[Bollocks]]></category>

		<guid isPermaLink="false">http://www.rockurchin.com/blog/?p=1</guid>
		<description><![CDATA[Yay, another pointless fricken blog hits the interweb. Going to try and post some useful code things I figure out along the way though.  Something to do I suppose&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Yay, another pointless fricken blog hits the interweb. Going to try and post some useful code things I figure out along the way though.  Something to do I suppose&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockurchin.com/blog/2008/04/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
