<?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>Made of Everything You&#039;re Not &#187; Code</title>
	<atom:link href="http://blog.ericlamb.net/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ericlamb.net</link>
	<description>Thoughts on programming, people and life</description>
	<lastBuildDate>Thu, 29 Jul 2010 07:00:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ExpressionEngine White Screen</title>
		<link>http://blog.ericlamb.net/2010/07/expressionengine-white-screen/</link>
		<comments>http://blog.ericlamb.net/2010/07/expressionengine-white-screen/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 07:00:32 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Brain Dump]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ExpressionEngine]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=3326</guid>
		<description><![CDATA[The more I work with ExpressionEngine the more I keep running into the same issues. ExpressionEngine hides most error messages, especially those related to configuration, probably for security, but this doesn&#8217;t make debugging any easier. To be fair, I don&#8217;t know if this is how ExpressionEngine works out of the box or if this is [...]]]></description>
			<content:encoded><![CDATA[<p>The more I work with <a href="http://expressionengine.com" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com','ExpressionEngine')" target="_blank" title="ExpressionEngine">ExpressionEngine</a> the more I keep running into the same issues. ExpressionEngine hides most error messages, especially those related to configuration, probably for security, but this doesn&#8217;t make debugging any easier. To be fair, I don&#8217;t know if this is how ExpressionEngine works out of the box or if this is a configuration setup done by the projects original developers but it does make fixing the issue that much harder.</p>
<div id="attachment_3333" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/07/whitescreen.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F07%2Fwhitescreen.jpg','Expression+Engine+White+Screen')"><img class="size-medium wp-image-3333" title="Expression Engine White Screen" src="http://blog.ericlamb.net/wp-content/uploads/2010/07/whitescreen-300x300.jpg" alt="ExpressionEngine White Screen" width="300" height="300" /></a><p class="wp-caption-text">ExpressionEngine White Screen</p></div>
<h3>Admin White Screen</h3>
<p>I&#8217;ve only come across the administration area throwing a white screen when using ExpressionEngine 1.67 on a PHP 5.3 server and only if extensions are enabled. I&#8217;m not sure if the newer versions of the 1.x branch have this fixed so this might not work for you.</p>
<p>The issue has to do with how the variables are being passed and called; PHP 5.3 changed how references were handled so the method ExpressionEngine 1.67 uses no longer works. To fix you have to modify &#8220;/system/core/core.extensions.php&#8221; with the below changes that are on the <a href="http://expressionengine.com/archived_forums/viewthread/121802/#603928" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com%2Farchived_forums%2Fviewthread%2F121802%2F%23603928','ExpressionEngine+forums')" target="_blank" title="ExpressionEngine forums">ExpressionEngine forums</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//system/core/core.extensions.php around line 115 modify:</span>
<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #990000;">sizeof</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #000;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
    <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$which</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #990000;">version_compare</span><span style="color: #000;">&#40;</span><span style="color: #009900; font-weight: bold;">PHP_VERSION</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'5.3'</span><span style="color: #000;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
    <span style="color: #22f;">foreach</span> <span style="color: #000;">&#40;</span><span style="color: #000088;">$args</span> <span style="color: #22f;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #000;">&#41;</span>
    <span style="color: #000;">&#123;</span>
        <span style="color: #000088;">$args</span><span style="color: #000;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=&amp;</span> <span style="color: #000088;">$args</span><span style="color: #000;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000;">&#125;</span>            
<span style="color: #000;">&#125;</span>  
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//and likewise around line 174 modify:</span>
<span style="color: #000;">&#123;</span>
    <span style="color: #000088;">$php4_object</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_slice</span><span style="color: #000;">&#40;</span><span style="color: #990000;">func_get_args</span><span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #990000;">version_compare</span><span style="color: #000;">&#40;</span><span style="color: #009900; font-weight: bold;">PHP_VERSION</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'5.3'</span><span style="color: #000;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">0</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
    <span style="color: #22f;">foreach</span> <span style="color: #000;">&#40;</span><span style="color: #000088;">$args</span> <span style="color: #22f;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #000;">&#41;</span>
    <span style="color: #000;">&#123;</span>
        <span style="color: #000088;">$args</span><span style="color: #000;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=&amp;</span> <span style="color: #000088;">$args</span><span style="color: #000;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000;">&#125;</span>            
<span style="color: #000;">&#125;</span>  
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h3>Front End White Screen</h3>
<p>Then there&#8217;s the front end white screen; so far I&#8217;ve encountered this type of white screen in both the 1.6 and 2.0 branches of ExpressionEngine. Luckily, whenever I&#8217;ve ran into a white screen on the front site it&#8217;s always due to various path configurations which is easily fixed by over riding the configuration file. </p>
<p>Expression Engine is <a href="http://blog.ericlamb.net/2010/07/portability-is-a-good-thing/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2010%2F07%2Fportability-is-a-good-thing%2F','Portability+Is+A+Good+Goal')" title="Portability Is A Good Goal">one of those programs</a> that stores as much as possible in the database including file and path directory paths. To get around this permanently I&#8217;ve gotten in the habit of using a default config.php file for all any Expression Engine site I work on; it&#8217;s the first thing I do before anything else.</p>
<p>This new configuration file uses the $_SERVER super global to dynamically determine the paths and makes allowances for development, staging and production environments.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'EXT'</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#41;</span><span style="color: #000;">&#123;</span>
	<span style="color: #990000;">exit</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'Invalid file request'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'app_version'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;167&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'license_number'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'debug'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'install_lock'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_hostname'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_username'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_password'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_name'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'dev.site.com'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_hostname'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_username'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_password'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_name'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
<span style="color: #22f;">elseif</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'dev.site.com'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_hostname'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_username'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_password'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_name'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>	
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'avatar_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/avatars/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'avatar_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/avatars/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'photo_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/member_photos/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'photo_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/member_photos/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'sig_img_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/signature_attachments/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'sig_img_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/signature_attachments/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'prv_msg_upload_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/pm_attachments/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'theme_folder_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/themes/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'site_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'captcha_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/captchas/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'captcha_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/captchas/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'emoticon_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/images/smileys/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'theme_folder_path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/themes/&quot;</span><span style="color: #339933;">;</span>	
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_type'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mysql&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_prefix'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;exp&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'db_conntype'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'system_folder'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;system&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'cp_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'system_folder'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/index.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'doc_url'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://expressionengine.com/docs/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'cookie_prefix'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'is_system_on'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;y&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'allow_extensions'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;y&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$conf</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'multiple_sites_enabled'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The above config is for the 1.x branch though most values should work for the 2.x branch with the addition of $config['tmpl_file_basepath'].</p>
<p>Hopefully, this should take care of those white screens.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/07/expressionengine-white-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Portability Is A Good Goal</title>
		<link>http://blog.ericlamb.net/2010/07/portability-is-a-good-thing/</link>
		<comments>http://blog.ericlamb.net/2010/07/portability-is-a-good-thing/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 07:00:58 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Brain Dump]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[program design]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=3115</guid>
		<description><![CDATA[For most web developers that I&#8217;ve met and worked with, at least, the concept of &#8220;hard coding&#8221; variable values, especially environment variables, is a definite &#8220;I will kill you and your first born if you do this&#8221; offense. Through a combination of painful moments, especially in the push to live phase, we all learned just [...]]]></description>
			<content:encoded><![CDATA[<p>For most web developers that I&#8217;ve met and worked with, at least, the concept of &#8220;hard coding&#8221; variable values, especially environment variables, is a definite &#8220;I will kill you and your first born if you do this&#8221; offense. Through a combination of painful moments, especially in the push to live phase, we all learned just how fucked up hard coding could make a day. </p>
<div id="attachment_3311" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/07/padlock.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F07%2Fpadlock.jpg','padlock')"><img class="size-medium wp-image-3311" title="padlock" src="http://blog.ericlamb.net/wp-content/uploads/2010/07/padlock-300x199.jpg" alt="padlock" width="300" height="199" /></a><p class="wp-caption-text">Portability Is A Good Goal</p></div>
<p>I&#8217;m telling you, it&#8217;s a special kind of pain when you&#8217;re frantically  trying to fix a site <em>you</em> broke through poor planning and  execution. </p>
<p>So, we do the most logical thing and abstract out all the system variables into a single point; either a config file or a database usually. For some reason we then go about our task feeling proud that we&#8217;ve stopped hard coding, oblivious to the fact that all we&#8217;ve done is just <em>minimized</em> the amount of hard coding. And that&#8217;s not enough.</p>
<p>According to WikiPedia <a href="http://en.wikipedia.org/wiki/Hard_coding" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHard_coding','hard+coding')" title="hard coding" target="_blank">hard coding</a></p>
<blockquote><p>&#8230;refers to the software development practice of embedding input or  configuration data directly into the <a title="Source code" href="http://en.wikipedia.org/wiki/Source_code" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSource_code','Source+code')">source  code</a> of a <a title="Computer program" href="http://en.wikipedia.org/wiki/Computer_program" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FComputer_program','Computer+program')">program</a> or other executable object, or  fixed formatting of the data, instead of obtaining that data from  external sources or generating data or formatting in the program itself  with the given input.</p></blockquote>
<p>Now, while that explanation is appropriate for good old fashioned native development, to be sure, I don&#8217;t think it&#8217;s applicable to web development because for most sites the database is as much a part of the application as the code is (especially when doing maintenance work). By which I mean that, in my experience, storing environment values inside a database isn&#8217;t a good idea unless there&#8217;s no other way (sometimes a project requires the rules be broken).</p>
<p>Anywho, for most of us who don&#8217;t have the natural, innate, knowledge, learning <em>not</em> to hard code was <em> </em>a tough lesson because when we first started developing web sites it was natural to connect the idea of the web site with the code and server it was running on. Hell, I personally remember being shocked to find out it was actually <em>bad</em> to develop a site on the live/production server; just didn&#8217;t make sense at the time (stupid, I know). In hindsight it was an obviously silly and short sighted mindset to adopt but changing that was probably the most important choice I&#8217;ve made to improve the quality of my projects.</p>
<p>I was reminded of this with painful clarity when a whole slew of issues came up from a client I&#8217;m working with. During the course of transitioning dozens of their legacy sites to a new server, some of which hadn&#8217;t been updated since the projects were completed some years ago by coders long since forgotten, quite a few started having weird and, not a little insidious, bugs in the new environment. Looking deeper into the issues revealed a nasty amount of hard coding in not only the custom projects, which I would expect actually, but also from various third party commercial and open source projects that were used for the base of the sites. </p>
<p>Here&#8217;s an example of what I&#8217;m talking about in terms of your everyday configuration file hard coding along with an example of what I&#8217;ve learned to do:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//bad</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/var/www/mysite.com/html/'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.mysite.com'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/var/www/mysite.com/cache/'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//good</span>
<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/../cache/'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>All thanks to the $_SERVER variable, in PHP (though most languages have some way to get that info), you shouldn&#8217;t have to <em>ever</em> hard code the paths to pretty much anything within your site. Note though that when executing PHP through CLI scripts or using the exec() function all bets are off (though there are ways to get around that too like using variations on __FILE__ and dirname()). And, yes, there are circumstances that demand hard coding, I know, but those cases are few and far between and usually have people capable of making those changes. </p>
<p>It was the third party programs that really annoyed me though. I find it a little easier to accept an individual inexperienced coder&#8217;s exuberance in coming up with a base solution at zero hour. I&#8217;ve been there; an issue comes up and the quickest, and less painful, solution is to just throw the path in place with a perosnal promise to come back later and make it elegant. Then&#8230; well, life takes over and the promise is forgotten. Happens all the time. </p>
<p>On the other hand though, when dealing with third party projects, both open source and commercial, this type of hard coding, well, that just bugs the crap out of me. It seems like such an obvious design decision yet <a href="http://expressionengine.com/" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com%2F','Expression+Engine')" title="Expression Engine" target="_blank">Expression Engine</a>, <a href="http://www.zen-cart.com/" onclick="return TrackClick('http%3A%2F%2Fwww.zen-cart.com%2F','Zen+Cart')" title="Zen Cart" target="_blank">Zen Cart</a> and <a href="http://wordpress.com" onclick="return TrackClick('http%3A%2F%2Fwordpress.com','WordPress')" title="WordPress" target="_blank">WordPress</a> (for example) all hard code environment variables into the configuration files. </p>
<p>This is especially irritating to me because it&#8217;s been my experience that most websites move to a different server at one time or another, so it&#8217;s a given that configuration is going to be changed at some point. Keeping the pain of moving the site to a minimum rates a higher priority to me. And, unless I&#8217;m missing something, it seems that there&#8217;s very little difference between having your installation/configuration script write $_SERVER['DOCUMENT_ROOT'] versus &#8220;/var/www/html&#8221; to a configuration file. </p>
<p>Something like (as a base example with no sanitization):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #22f;">if</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #000;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_SERVER</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #000;">&#93;</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
    <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'$_SERVER[\'DOCUMENT_ROOT\']'</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
<span style="color: #22f;">else</span>
<span style="color: #000;">&#123;</span>
    <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//write it to the config file</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>As I mentioned above there are definitely times when $_SERVER['DOCUMENT_ROOT'] isn&#8217;t appropriate per the requirements or spec but for most projects that I&#8217;ve worked with replacing hard paths with the variable has been effective 99% of the time. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/07/portability-is-a-good-thing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create Expression Engine Plugin</title>
		<link>http://blog.ericlamb.net/2010/06/create-expression-engine-plugin/</link>
		<comments>http://blog.ericlamb.net/2010/06/create-expression-engine-plugin/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 07:00:03 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Brain Dump]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ExpressionEngine]]></category>
		<category><![CDATA[ExpressionEngine Plugin]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=3273</guid>
		<description><![CDATA[In Expression Engine Escaping Madness I laid out an issue I was experiencing with a client site. The issue was that there didn&#8217;t appear to be a method available to escape Expression Engine markup when it is mixed with php so there is a definite risk of parse errors using that technique (it&#8217;s not a [...]]]></description>
			<content:encoded><![CDATA[<p>In <a title="Expression Engine Escaping Madness" href="http://blog.ericlamb.net/2010/05/expression-engine-escaping-madness/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2010%2F05%2Fexpression-engine-escaping-madness%2F','Expression+Engine+Escaping+Madness')" target="_self">Expression Engine Escaping Madness</a> I laid out an issue I was experiencing with a client site. The issue was that there didn&#8217;t appear to be a method available to escape Expression Engine markup when it is mixed with php so there is a definite risk of parse errors using that technique (it&#8217;s not a security issue or anything; I want to be clear on that). This made me nervous enough that I couldn&#8217;t let it go and kept thinking about how to get around the issue. The answer: write an Expression Engine plugin.Of course this meant I had to actually <em>learn</em> how to write an Expression Engine plugin first. Here are my notes <img src='http://blog.ericlamb.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_3280" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/06/power_board.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F06%2Fpower_board.jpg','Create+Expression+Engine+Plugin')"><img class="size-medium wp-image-3280" title="Create Expression Engine Plugin" src="http://blog.ericlamb.net/wp-content/uploads/2010/06/power_board-300x225.jpg" alt="Create Expression Engine Plugin" width="300" height="225" /></a><p class="wp-caption-text">Create Expression Engine Plugin</p></div>
<p>First though credit where it&#8217;s due: for this example I used the <a title=" Number Format 1.1" href="http://expressionengine.com/downloads/details/number_format/" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com%2Fdownloads%2Fdetails%2Fnumber_format%2F','Number+Format+1.1')" target="_blank">number_format plugin</a> as a base so a lot of credit goes to Robert Wallis for the nicely written plugin I&#8217;m basically leaching from:)</p>
<p>An Expression Engine plugin is essentially a php class with at least one method that translates into an Expression Engine tag and used inside of Expression Engine templates (I don&#8217;t think they can be used inside of entries directly though I haven&#8217;t confirmed this). They are best left for small tasks though because they can&#8217;t have an administrative backend or integration with the Expression Engine l10n stuff or form processing or any manageable settings. No fun stuff for plugins&#8230;</p>
<p>Like most platforms there&#8217;s a few conventions that have to be followed but, also like most platforms, they aren&#8217;t too troublesome to work with. It should be noted that the syntax for the class uses the php4 syntax so dumb yourself down accordingly. </p>
<p>For example our plugin class will look like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> Add_Slashes
<span style="color: #000;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">function</span> Add_Slashes<span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span>
	<span style="color: #000;">&#123;</span>
&nbsp;
        <span style="color: #000;">&#125;</span>
<span style="color: #000;">&#125;</span></pre></div></div>

<p>And the plugin will be executed with the below Expression Engine template tag:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000;">&#123;</span><span style="color: #990000;">exp</span><span style="color: #339933;">:</span>add_slashes<span style="color: #000;">&#125;</span>O<span style="color: #0000ff;">'Reilly{/exp:add_slashes}</span></pre></div></div>

<p>Now, it&#8217;s possible to create template tags that aren&#8217;t done in pairs but for this example I&#8217;m going to stick with pairs. In case it wasn&#8217;t obvious, if you wanted to have a plugin that has more than a single method you would call that method like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000;">&#123;</span><span style="color: #990000;">exp</span><span style="color: #339933;">:</span>add_slashes<span style="color: #339933;">:</span>somethingelse<span style="color: #000;">&#125;</span>O<span style="color: #0000ff;">'Reilly{/exp:add_slashes:somethingelse}</span></pre></div></div>

<p>So that&#8217;s the basic syntax. The next thing that needs to be done is that a file has to be created inside the &#8220;/system/plugin/&#8221; folder. Note that I&#8217;m using the default name for that folder (system) so if you renamed it during the installation process use that instead. The file name must be lower case the same as the class name and it must have pi. as the prefix, and begin with the second segment of the tag. So, with our example plugin, the plugin name would be: pi.add_slashes.php. Simple enough. Once the file is saved to the location the plugin is installed. That&#8217;s how Expression Engine rolls.</p>
<p>Now we have a working plugin in theory but if you go into the plugin manager you&#8217;ll see an error about a missing variable as well as a distorted view of the page. We&#8217;re missing something; the $plugin_info array. </p>
<p>Every Expression Engine plugin should have a variable outside of the class called $plugin_info. For our example it should look like the below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$plugin_info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #000;">&#40;</span>
	<span style="color: #0000ff;">'pi_name'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Add Slashes'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_version'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'1.0'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_author'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Eric Lamb'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_author_url'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://blog.ericlamb.net/'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_description'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Exposes PHP\'s &lt;a href=&quot;http://php.net/manual/en/function.addslashes.php&quot;&gt;addslashes()&lt;/a&gt; function via EE tags.'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_usage'</span>        <span style="color: #339933;">=&gt;</span> Add_Slashes<span style="color: #339933;">::</span><span style="color: #004000;">usage</span><span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Obviously, the above lists all the details about the plugin for display in the plugin administration module:<br />
<div id="attachment_3293" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/06/ee-pm.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F06%2Fee-pm.png','Expression+Engine+Plugin+Manager')"><img src="http://blog.ericlamb.net/wp-content/uploads/2010/06/ee-pm-300x168.png" alt="Expression Engine Plugin Manager" title="Expression Engine Plugin Manager" width="300" height="168" class="size-medium wp-image-3293" /></a><p class="wp-caption-text">Expression Engine Plugin Manager</p></div></p>
<p>You may have noticed the pi_usage key in the array; this method is recommended by the <a title="Expression Engine Developer Center" href="http://expressionengine.com/developers/" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com%2Fdevelopers%2F','Expression+Engine+Developer+Center')" target="_blank">Expression Engine Developer Center</a> for describing the usage of a plugin. Inside the plugin create a method called usage() and just return the instructions. Those instructions will be used on the plugin description page:</p>
<div id="attachment_3295" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/06/ee-pi.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F06%2Fee-pi.png','Expression+Engine+Plugin+Information')"><img src="http://blog.ericlamb.net/wp-content/uploads/2010/06/ee-pi-300x168.png" alt="Expression Engine Plugin Information" title="Expression Engine Plugin Information" width="300" height="168" class="size-medium wp-image-3295" /></a><p class="wp-caption-text">Expression Engine Plugin Information</p></div>
<p>Using all of the above the completed plugin is below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$plugin_info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #000;">&#40;</span>
	<span style="color: #0000ff;">'pi_name'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Add Slashes'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_version'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'1.0'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_author'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Eric Lamb'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_author_url'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://blog.ericlamb.net/'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_description'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Exposes PHP\'s &lt;a href=&quot;http://php.net/manual/en/function.addslashes.php&quot;&gt;addslashes()&lt;/a&gt; function via EE tags.'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'pi_usage'</span>        <span style="color: #339933;">=&gt;</span> Add_Slashes<span style="color: #339933;">::</span><span style="color: #004000;">usage</span><span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span>
<span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Add_Slashes
<span style="color: #000;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">function</span> Add_Slashes<span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span>
	<span style="color: #000;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$TMPL</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">return_data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">addslashes</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$TMPL</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tagdata</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> usage<span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span>
	<span style="color: #000;">&#123;</span>
		<span style="color: #22f;">return</span> <span style="color: #0000ff;">&quot;This is really just a wrapper for PHP's add_slashes function:
http://php.net/manual/en/function.addslashes.php
&nbsp;
{exp:add_slashes}
O'Reilly
{/exp:add_slashes}
returns: O\'Reilly
&nbsp;
&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000;">&#125;</span> 
&nbsp;
<span style="color: #000;">&#125;</span></pre></div></div>

<p>Now, this example was used using Expression Engine 1.6.9 so the process might not work for the upcoming 2.0 (I haven&#8217;t looked into that version just yet). It also doesn&#8217;t look like EllisLabs is accepting any new submissions to their plugin library so if you&#8217;re hoping to distribute your plugin prepare to do it solo and without any help from them.</p>
<p>Still, an easy enough process that any custom functionality you may need for an Expression Engine site should be trivial to achieve.  </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/06/create-expression-engine-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hResume hKit Profile</title>
		<link>http://blog.ericlamb.net/2010/06/hresume-hkit-profile/</link>
		<comments>http://blog.ericlamb.net/2010/06/hresume-hkit-profile/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 00:14:39 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[hresume]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=2807</guid>
		<description><![CDATA[While working on Wp-hResume (a neat plugin for adding any hResume encoded resume to a WordPress site) I needed to make a decision. The strategy I was working on hinged on the choice between either using brute force regular expressions to parse the profile page for a single site (like the competition)  or to write [...]]]></description>
			<content:encoded><![CDATA[<p>While working on <a title="Introducing WP-hResume" href="http://blog.ericlamb.net/2010/01/introducing-wp-hresume/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2010%2F01%2Fintroducing-wp-hresume%2F','Introducing+WP-hResume')" target="_self">Wp-hResume</a> (a neat plugin for adding <em>any</em> <a title="hResume" href="http://en.wikipedia.org/wiki/HResume" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHResume','hResume')" target="_blank">hResume</a> encoded resume to a WordPress site) I needed to make a decision. The strategy I was working on hinged on the choice between either  using brute force regular expressions to parse the profile page for a  single site (like the competition)  or to write the missing hResume profile for the <a title="hKit" href="http://code.google.com/p/hkit/" onclick="return TrackClick('http%3A%2F%2Fcode.google.com%2Fp%2Fhkit%2F','hKit')" target="_blank">hKit  Microformat Framework</a>.</p>
<div id="attachment_3254" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/05/Redundant.gif" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2FRedundant.gif','hKit+hResume')"><img class="size-medium wp-image-3254" title="hKit hResume " src="http://blog.ericlamb.net/wp-content/uploads/2010/05/Redundant-300x205.gif" alt="hKit hResume" width="300" height="205" /></a><p class="wp-caption-text">hKit hResume </p></div>
<p>The way I saw it, with regular expressions I could only build a plugin that would only work with a single site; whereas with an hKit profile the plugin could, in theory, work with any hResume encoded site. So, clearly, an hKit profile was the best option.</p>
<p>The only problem was that there isn&#8217;t any documentation on how to actually create a profile for hKit. I don&#8217;t want to go into detail on it, and to be honest I don&#8217;t really remember all the details so suffice it to say that brute forcing this thing sucked. Donkey balls. It took forever and the steps needed to build a profile used a methodology I wasn&#8217;t familiar with. But, after a long night of tequila I did end up putting it all together though and it works pretty nicely.</p>
<p>First though, here&#8217;s how hKit works for pulling in a microformatted URL:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #22f;">include</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'hkit.class.php'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hKit</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> hKit<span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$hKit</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getByURL</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'hcard'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://microformats.org/'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Pretty obvious stuff; give it a URL, set the type of encoding expected (this time it&#8217;s hcard) and it gives back an array with all the goodies. </p>
<p>To work with the new profile you have to place the profile file in the same directory as hkit.class.php. You can download the profile along with the latest version of <a href="http://blog.ericlamb.net/wp-content/uploads/2010/06/hkit.zip" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F06%2Fhkit.zip','hKit+here')">hKit here</a>.</p>
<p>The concept is the same with the new profile:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #22f;">include</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'hkit.class.php'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$h</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> hKit<span style="color: #339933;">;</span>	
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.linkedin.com/in/mithra62'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$h</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tidy_mode</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 'proxy', 'exec', 'php' or 'none'</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$h</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getByURL</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'hresume'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">print_r</span><span style="color: #000;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The above will pull my hResume encoded info from my LinkedIn profile. Same as the original hcard example. Easy like your sister.</p>
<p>Now go forth and start parsing hresume encoded URLs <img src='http://blog.ericlamb.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/06/hresume-hkit-profile/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A Closer Look At Avactis</title>
		<link>http://blog.ericlamb.net/2010/05/a-closer-look-at-avactis/</link>
		<comments>http://blog.ericlamb.net/2010/05/a-closer-look-at-avactis/#comments</comments>
		<pubDate>Mon, 31 May 2010 17:14:14 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Brain Dump]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Avactis]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=3186</guid>
		<description><![CDATA[Avactis is another in a long line of e-commerce web applications written in php (similar to OpenCart and PrestaCart), this one a little different in that Avactis has different versions, each with different features, depending on how much you&#8217;re willing to spend. Avactis is a full featured product with all the bells and whistles any [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Avactis" href="http://www.avactis.com/" onclick="return TrackClick('http%3A%2F%2Fwww.avactis.com%2F','Avactis')" target="_blank">Avactis</a> is another in a long line of e-commerce web applications written in php (similar to <a href="http://blog.ericlamb.net/2010/05/should-we-use-opencart/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2010%2F05%2Fshould-we-use-opencart%2F','OpenCart')">OpenCart</a> and <a href="http://blog.ericlamb.net/2010/05/should-we-use-prestashop/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2010%2F05%2Fshould-we-use-prestashop%2F','PrestaCart')">PrestaCart</a>), this one a little different in that Avactis has different versions, each with different features, depending on how much you&#8217;re willing to spend. Avactis is a full featured product with all the bells and whistles any ambitious store would need (and then some more features stacked on top for good measure) combined with a very php like integration methodology. Unfortunately, the dated administration interface combined with a lack of a plugin architecture and theme community really holds it back from the awesome bar.</p>
<div id="attachment_3222" class="wp-caption aligncenter" style="width: 230px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/05/Avactis-logo.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2FAvactis-logo.png','Avactis')"><img class="size-full wp-image-3222" title="Avactis" src="http://blog.ericlamb.net/wp-content/uploads/2010/05/Avactis-logo.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2FAvactis-logo.png','Avactis')" alt="Avactis" width="220" height="79" /></a><p class="wp-caption-text">Avactis</p></div>
<p>For the uninitiated, Avactis is created and maintained by Pentasoft Corp; oddly, there&#8217;s no website for the parent company so take that for what you will. As mentioned, Avactis is based on a pay model though it&#8217;s way more upfront about it than PrestaCart and, while the free version is missing some features, the source is available for modifications. Not too bad in my opinion; at least the more cash strapped shops can still play if they want to.</p>
<p>The different versions of Avactis are Free, Owned ($199), Monthly Leased ($19.95 a month) and White Label ($299) each with their own <a title="Compare Avactis Shopping Cart Editions" href="http://www.avactis.com/compare_avactis_editions.php" onclick="return TrackClick('http%3A%2F%2Fwww.avactis.com%2Fcompare_avactis_editions.php','Compare+Avactis+Shopping+Cart+Editions')" target="_blank">features and options</a>. Most notably the Free version doesn&#8217;t include any (useful) payment modules (Authorize.net anyone?), coupon module, data export and import, quantity discounts or search engine friendly URLs out of the box. They do offer <a title="Discounts for Web developers" href="https://www.avactis.com/ads/shopping-cart-camp1.php" onclick="return TrackClick('https%3A%2F%2Fwww.avactis.com%2Fads%2Fshopping-cart-camp1.php','Discounts+for+Web+developers')" target="_blank">discounts for web developers</a> though (at least 50% and they say up to 100%), and the complete source is available without obfuscation, so at least those functions that are needed can be added which can really ease the pain of <em>paying</em> for the thing in my opinion.</p>
<p>As expected, Avactis has the ability for custom <a title="Avactis Themes" href="http://www.avactis.com/avactis_themes.php" onclick="return TrackClick('http%3A%2F%2Fwww.avactis.com%2Favactis_themes.php','Avactis+Themes')" target="_blank">themes</a> though I&#8217;m disappointed to see that there doesn&#8217;t appear to be any theme community in existence (compared to other cart software packages). The reasoning behind this is probably because Avactis bills itself as being &#8220;easy integration with an existing website  thanks to unique Avactis tag technology&#8221;. And by unique they mean including a php file and calling php function snippets. I&#8217;m all for marketing hype but wtf is that?!? Here&#8217;s an <a title="Five Easy Steps..." href="http://docs.avactis.com/190/index.html?five_easy_steps_to_integrate.htm" onclick="return TrackClick('http%3A%2F%2Fdocs.avactis.com%2F190%2Findex.html%3Ffive_easy_steps_to_integrate.htm','Five+Easy+Steps...')" target="_blank">example</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #22f;">include</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'init.php'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> NavigationBar<span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> Breadcrumb<span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> ProductList<span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>It&#8217;s called php and EVERY php site does this Avactis not just you. Essentially though, this isn&#8217;t a bad strategy and, in fact, is definitely a strength especially without all the hyperbole. Obviously, Avactis can stand alone and doesn&#8217;t <em>need</em> to be integrated into a separate site but it&#8217;s a good idea to allow easy integration into existing sites. </p>
<div id="attachment_3217" class="wp-caption aligncenter" style="width: 200px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/05/Avactis-PHP-shopping-cart-software.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2FAvactis-PHP-shopping-cart-software.png','Avactis+PHP+shopping+cart+software')"><img class="size-medium wp-image-3217" title="Avactis PHP shopping cart software" src="http://blog.ericlamb.net/wp-content/uploads/2010/05/Avactis-PHP-shopping-cart-software-190x300.png" alt="Avactis PHP shopping cart software" width="190" height="300" /></a><p class="wp-caption-text">Avactis PHP shopping cart software</p></div>
<p>Avactis is packed with all the features any online store would want; content management system, coupon and discount mechanisms, order and customer management, packing slip builder to name a few. Each feature is also highly customizable and usually includes a plethora of options and settings; nice if you build complex product build outs or specific functionality. On the other hand though, this amount of features and customization comes at a cost in terms of ease of use, work flow and a lacking user friendly experience.</p>
<p>The administration interface for Avactis is a nightmare mess of pop-up windows, tabs and accordion widgets. Slick is not a word I would use to describe the experience. Functional or crappy or painful or eyebleedingworstinterfaceeverpleasekillmefortheloveofgod!; those are better words to describe it. </p>
<p>There&#8217;s inconsistencies all over the place; for example while editing a product the help widgets will open another pop-up window (sigh&#8230;) yet in the main menu hovering over a link will display a tool tip and in the installation process the help widgets are all inline divs. </p>
<div id="attachment_3242" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/05/activis-admin.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2Factivis-admin.png','Avactis+Admin+Popups')"><img src="http://blog.ericlamb.net/wp-content/uploads/2010/05/activis-admin-300x168.png" alt="Avactis Admin Popups" title="Avactis Admin Popups" width="300" height="168" class="size-medium wp-image-3242" /></a><p class="wp-caption-text">Avactis Admin Popups</p></div>
<p>Going through the code yields such <a href="http://thedailywtf.com/Series/CodeSOD.aspx" onclick="return TrackClick('http%3A%2F%2Fthedailywtf.com%2FSeries%2FCodeSOD.aspx','codesod')" target="_blank" title="codesod">codesod</a> qualifiers as the below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #009933; font-style: italic;">/**
     * Defines the possibility of uploading images by file type.
     *
     * @param $file The array consists of the $_FILES variable, for
     * the current file.
     * @return boolean
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> isAllowedImageType<span style="color: #000;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #000;">&#41;</span>
    <span style="color: #000;">&#123;</span>
<span style="color: #666666; font-style: italic;">/*        $type = _ml_strtolower($file['type']);
        switch ($type)
        {
            case 'image/gif':
            case 'image/jpeg':
            case 'image/jpg':
            case 'image/jpe':
            case 'image/jfif':
            case 'image/pjpeg':
            case 'image/pjp':
            case 'image/png':
            case 'image/x-png':
                return true;
            default:
                return false;
        }
*/</span>
        <span style="color: #22f;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #000;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If that doesn&#8217;t make any sense to you suffice it to say that the above function is supposed to verify that an image&#8217;s mime type matches the list; unfortunately though, the function is, what we call &#8220;commented out&#8221; and will not be executed. All files sent to the function will validate as true so, essentially, any file type can be uploaded. While it&#8217;s entirely possible this is an old function that was replaced with something <em>useful</em>, and it should be noted that I never found any calls to that function (but I really didn&#8217;t look too hard), the fact that it&#8217;s still in the code-base speaks volumes, to me, about the project maintenance at the very least.  </p>
<p>On top of that Avactis has one of the most wasteful and useless installation processes I&#8217;ve ever seen. Initially, Avactis ships with a very minimal file set that includes a 15 mega byte (MB) file whose sole purpose is to contain all additional files in a gzipped and base64 encoded string. The sole purpose of this is to allow Avactis to programmatically write all source files to the file system during installation. For the life of me I can&#8217;t imagine what functional requirement precipitated this design decision. Considering the complexity added to the development cycle this would cause it makes no sense to me; I&#8217;m at a loss. I could be missing something though; you never know it may have a really sick benefit that I&#8217;m just not privy to. </p>
<p>Are any of those &#8220;issues&#8221; at all relevant? Not the function and not the installation process. Those are subjective issues that may only matter to me; it&#8217;s <a href="http://encarta.msn.com/dictionary_561535560/armchair_quarterback.html" onclick="return TrackClick('http%3A%2F%2Fencarta.msn.com%2Fdictionary_561535560%2Farmchair_quarterback.html','Armchair+Quarterback')" target="_blank" title="Armchair Quarterback">armchair quarterbacking</a> at it&#8217;s finest (if I do say so myself). For everything else, well, that obviously depends on the specific needs of the project. For my needs it&#8217;s a pass simply because my clients care about the interface and Avactis looks like it hasn&#8217;t been updated since 2002 (at least). </p>
<p>So, while Avactis is a nice program with all of the features any store would ever need I personally feel that it&#8217;s not ready for my project. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/05/a-closer-look-at-avactis/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Wp-Click-Track 0.7.1</title>
		<link>http://blog.ericlamb.net/2010/05/wp-click-track-0-7-1/</link>
		<comments>http://blog.ericlamb.net/2010/05/wp-click-track-0-7-1/#comments</comments>
		<pubDate>Thu, 20 May 2010 07:00:44 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[wp-click-track]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=3166</guid>
		<description><![CDATA[Dreamhost is slandering me! They think I suck and have no problem telling people as much. Seriously; I write bad code by them. How do I know? Because Chris Duke over at AppModo told me so. Problem is, Dreamhost was 100% right. Yup; I fucked up. On Monday I got an email from Chris asking [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Dreamhost" href="http://www.dreamhost.com/" onclick="return TrackClick('http%3A%2F%2Fwww.dreamhost.com%2F','Dreamhost')" target="_blank">Dreamhost</a> is slandering me! They think I suck and have no problem telling people as much. Seriously; I write bad code by them. How do I know? Because Chris Duke over at <a title="AppModo" href="http://appmodo.com/" onclick="return TrackClick('http%3A%2F%2Fappmodo.com%2F','AppModo')" target="_blank">AppModo</a> told me so. Problem is, Dreamhost was 100% right. Yup; I fucked up.</p>
<div id="attachment_3167" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/05/wp-click-track-0.7.1.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2Fwp-click-track-0.7.1.jpg','Wp-Click-Track+0.7.1')"><img class="size-medium wp-image-3167" title="Wp-Click-Track 0.7.1" src="http://blog.ericlamb.net/wp-content/uploads/2010/05/wp-click-track-0.7.1-300x168.jpg" alt="Wp-Click-Track 0.7.1" width="300" height="168" /></a><p class="wp-caption-text">Wp-Click-Track 0.7.1</p></div>
<p>On Monday I got an email from Chris asking for some help with one of the WordPress plugins I wrote; wp-click-track. Chris was cool enough to let me post the message he received from Dreamhost:</p>
<blockquote><p>Hello,</p>
<p>I&#8217;m writing you about your database &#8220;appmodo&#8221;, please write me back as soon as possible.  There seems to be a plugin you are running that is poorly coded (missing table joins) and this 1300+ second query that it is running is causing high server load spikes. If this plugin is not fixed, or disabled, and it causes server problems, we may need to disable the wp_tracking_clicks and wp_tracking_links tables.  You can write me at justin@dreamhost.com.</p>
<p>The problem queries:</p>
<p># Query_time: 2181  Lock_time: 1115  Rows_sent: 1  Rows_examined: 38703 use appmodo;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #22f;">SELECT</span> date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%Y-%m-%d&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> first_click<span style="color: #66cc66;">,</span>
date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%j&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> day_of_year <span style="color: #22f;">FROM</span> wp_tracking_clicks tc<span style="color: #66cc66;">,</span>
wp_tracking_links tl <span style="color: #22f;">WHERE</span> tc<span style="color: #66cc66;">.</span>click_id !<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'0'</span>  <span style="color: #22f;">GROUP</span> <span style="color: #22f;">BY</span> first_click <span style="color: #22f;">ORDER</span>
<span style="color: #22f;">BY</span> first_click <span style="color: #22f;">DESC</span> <span style="color: #22f;">LIMIT</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>

<p># Query_time: 1995  Lock_time: 924  Rows_sent: 1  Rows_examined: 38703 use appmodo;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #22f;">SELECT</span> date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%Y-%m-%d&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> first_click<span style="color: #66cc66;">,</span>
date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%j&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> day_of_year <span style="color: #22f;">FROM</span> wp_tracking_clicks tc<span style="color: #66cc66;">,</span>
wp_tracking_links tl <span style="color: #22f;">WHERE</span> tc<span style="color: #66cc66;">.</span>click_id !<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'0'</span>  <span style="color: #22f;">GROUP</span> <span style="color: #22f;">BY</span> first_click <span style="color: #22f;">ORDER</span>
<span style="color: #22f;">BY</span> first_click <span style="color: #22f;">DESC</span> <span style="color: #22f;">LIMIT</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>

<p># Query_time: 1387  Lock_time: 309  Rows_sent: 1  Rows_examined: 38703 use appmodo;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #22f;">SELECT</span> date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%Y-%m-%d&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> first_click<span style="color: #66cc66;">,</span>
date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%j&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> day_of_year <span style="color: #22f;">FROM</span> wp_tracking_clicks tc<span style="color: #66cc66;">,</span>
wp_tracking_links tl <span style="color: #22f;">WHERE</span> tc<span style="color: #66cc66;">.</span>click_id !<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'0'</span>  <span style="color: #22f;">GROUP</span> <span style="color: #22f;">BY</span> first_click <span style="color: #22f;">ORDER</span>
<span style="color: #22f;">BY</span> first_click <span style="color: #22f;">DESC</span> <span style="color: #22f;">LIMIT</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>

<p># Query_time: 2016  Lock_time: 930  Rows_sent: 1  Rows_examined: 38703 use appmodo;</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #22f;">SELECT</span> date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%Y-%m-%d&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> first_click<span style="color: #66cc66;">,</span>
date_format<span style="color: #000;">&#40;</span>click_date<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;%j&quot;</span><span style="color: #000;">&#41;</span> <span style="color: #22f;">AS</span> day_of_year <span style="color: #22f;">FROM</span> wp_tracking_clicks tc<span style="color: #66cc66;">,</span>
wp_tracking_links tl <span style="color: #22f;">WHERE</span> tc<span style="color: #66cc66;">.</span>click_id !<span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'0'</span>  <span style="color: #22f;">GROUP</span> <span style="color: #22f;">BY</span> first_click <span style="color: #22f;">ORDER</span>
<span style="color: #22f;">BY</span> first_click <span style="color: #22f;">DESC</span> <span style="color: #22f;">LIMIT</span> <span style="color: #cc66cc;">1</span>;</pre></div></div>

<p>Thanks!<br />
Justin K</p></blockquote>
<p>Justin did a nice job highlighting what the issue was; I didn&#8217;t join the tables together so it would take a really long time to complete the scans if there were a lot of rows in the tables. Another reason to always develop with <a title="Everything Is Fast For Small n" href="http://www.codinghorror.com/blog/2007/09/everything-is-fast-for-small-n.html" onclick="return TrackClick('http%3A%2F%2Fwww.codinghorror.com%2Fblog%2F2007%2F09%2Feverything-is-fast-for-small-n.html','Everything+Is+Fast+For+Small+n')" target="_blank">large data</a> sets; something I obviously didn&#8217;t do with wp-click-track.</p>
<blockquote><p>Your application is useful and popular. Your users love it. Your users love you. But over the next week, something curious happens. As people use the application, it gets progressively slower and slower. Soon, the complaints start filtering in.  Within a few weeks, the app is well-neigh unusable due to all the insufferable delays it subjects users to&#8211; and <a title="Designing for Informavores, or, Why Users Behave Like Animals Online" href="http://www.codinghorror.com/blog/archives/000882.html" onclick="return TrackClick('http%3A%2F%2Fwww.codinghorror.com%2Fblog%2Farchives%2F000882.html','Designing+for+Informavores%2C+or%2C+Why+Users+Behave+Like+Animals+Online')" target="_blank">your users turn on you</a>.</p></blockquote>
<p>Anyway, there was no excuse for that; this was shoddy on my part. The only explanation I have is poor quality on my part. </p>
<p>This particular bug affected the line chart on the admin dashboard. Ever wonder why that particular graph took <em>forever</em> to load? Yup, that&#8217;s why.</p>
<p>What&#8217;s funny, to me at least, was that I had already fixed this particular issue; I just hadn&#8217;t released it yet. This particular bug was planned to be released with 0.8 but 0.8 is taking longer to complete than I initially thought it would. So the bug fix languished and sat there. Unreleased.</p>
<p>So yeah, wp-click-track 0.7.1. It&#8217;s a good release to get.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/05/wp-click-track-0-7-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expression Engine Escaping Madness</title>
		<link>http://blog.ericlamb.net/2010/05/expression-engine-escaping-madness/</link>
		<comments>http://blog.ericlamb.net/2010/05/expression-engine-escaping-madness/#comments</comments>
		<pubDate>Wed, 12 May 2010 04:15:44 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[escaping]]></category>
		<category><![CDATA[ExpressionEngine]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=3117</guid>
		<description><![CDATA[In my pursuit for financial independence I&#8217;ve been taking on random freelancing gigs from some really smart and interesting clients. One of the more respected clients I work with has been using Expression Engine for their main platform for years, and while I was initially skeptical, I&#8217;m beginning to believe there is potential for Expression [...]]]></description>
			<content:encoded><![CDATA[<p>In my pursuit for financial independence I&#8217;ve been taking on random freelancing gigs from some really smart and interesting clients. One of the more respected clients I work with has been using <a title="Expression Engine" href="http://expressionengine.com/" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com%2F','Expression+Engine')" target="_blank">Expression Engine</a> for their main platform for <em>years</em>, and while I was initially skeptical, I&#8217;m beginning to believe there is potential for Expression Engine to be a useful tool too. There&#8217;s just one little thing; it&#8217;s possible to create a debugging nightmare pretty easily.</p>
<div id="attachment_3129" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/05/expressionengine_logo.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F05%2Fexpressionengine_logo.jpg','Expression+Engine+Escaping+Madness')"><img src="http://blog.ericlamb.net/wp-content/uploads/2010/05/expressionengine_logo-300x214.jpg" alt="Expression Engine Escaping Madness" title="Expression Engine Escaping Madness" width="300" height="214" class="size-medium wp-image-3129" /></a><p class="wp-caption-text">Expression Engine Escaping Madness</p></div>
<p>Expression Engine is built by the same <a href="http://ellislab.com/" onclick="return TrackClick('http%3A%2F%2Fellislab.com%2F','EllisLab')" target="_blank" title="EllisLab">company</a> who put together pMachine, one of my favorite blogging software from back in the day, so I had some pretty high hopes for it. Then I started reading some off the cuff comments about Expression Engine, especially in comparison to my <a title="Code Like It’s 1999 With Dolphin CMS" href="http://blog.ericlamb.net/2009/12/code-like-its-1999-with-dolphin-cms/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2009%2F12%2Fcode-like-its-1999-with-dolphin-cms%2F','Code+Like+It%E2%80%99s+1999+With+Dolphin+CMS')" target="_self">mortal enemy Dolphin CMS</a>, and I started getting a little nervous. Then, when I started seeing how the flow worked, my head almost exploded.</p>
<p>See, all the style and creative stuff is stored in the database. Because Expression Engine has it&#8217;s own meta templating language (similar to Smarty in syntax and style; to me anyway) all the templates are available and ready for anyone to make modifications to. On top of that, Expression Engine allows for the inclusion of custom php inside of the stored template files which gets executed with the dreaded and evil &#8220;<a title="Eval Function" href="http://us2.php.net/manual/en/function.eval.php" onclick="return TrackClick('http%3A%2F%2Fus2.php.net%2Fmanual%2Fen%2Ffunction.eval.php','Eval+Function')" target="_blank">eval()</a>&#8221; tag.</p>
<p>Confused? Me too. To help clear things up here&#8217;s a snippet of Expression Engine templating code:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">{assign_variable:my_weblog=&quot;default_site&quot;}
{assign_variable:my_template_group=&quot;site&quot;}
{embed=&quot;global/header&quot;}
Page Content Here.</pre></div></div>

<p>It should be pretty obvious what the code above is doing, but because I get a lot of shit for not being verbose (I&#8217;m looking at you Reddit), here&#8217;s what&#8217;s happening:</p>
<ol>
<li>A variable called &#8220;my_weblog&#8221; is being created with the variable &#8220;default_site&#8221;.</li>
<li>A variable called &#8220;my_template_group&#8221; is being created with the variable &#8220;site&#8221;.</li>
<li>The header template file is being included.</li>
</ol>
<p>Not so bad right? I didn&#8217;t think so either but there&#8217;s also the inclusion of raw php. The below is perfectly valid to do in Expression Engine (assuming the &#8220;Allow PHP in Tempaltes&#8221; setting is enabled):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$my_weblog</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'default_site'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$my_template_group</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'site'</span><span style="color: #339933;">;</span>
<span style="color: #22f;">include</span> <span style="color: #0000ff;">'global/header.php'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The above is a translation of the Expression Engine code by the way (if you hadn&#8217;t picked up on that). This, too, isn&#8217;t <em>bad</em> per se, but it does break a few very important rules which I&#8217;ll get into in a moment. Annoying and sort of dangerous? Absolutely. But I can see where the appeal lies in allowing this sort of functionality (and, yes, even if you have to use eval() to do so). </p>
<p>That being said, my head almost exploded when I saw how the logic was laid out when mixing both the Expression Engine template tags with php functionality. Keep in mind that Expression Engine has a setting that allows you to set when in the processing flow you want the php to be executed. If that sounds confusing just know that in the below example the Expression Engine stuff is executed before the php code. </p>
<p>Here&#8217;s what I mean:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">{exp:query sql=&quot;SELECT name FROM exp_freeform_entries WHERE entry_id = '1'&quot;}
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'{name}'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The above simply grabs the name from the table and then sets it up for use by php. Once again, perfectly valid usage it would seem, though the more astute people will immediately see the issue. </p>
<p>Since Expression Engine executes the template tags first this is kind of a snap. The thing is though there&#8217;s no escaping going on there. The above will work great when the value of name is something like Eric or John but what if the value is &#8220;Eric O&#8217;Reily&#8221;? </p>
<p>Yeah; it&#8217;s gonna break with a parse error. But worst of all when it does break the error message you&#8217;re going to get is going to reference the call to eval() and not the actual template file. This is going to make debugging a bit of a bitch. On top of that, there&#8217;s no native method to <a href="http://expressionengine.com/forums/viewthread/85121/" onclick="return TrackClick('http%3A%2F%2Fexpressionengine.com%2Fforums%2Fviewthread%2F85121%2F','stripping+%2F+slash+%2F+escape+quotes+in+titles')" target="_blank" title="stripping / slash / escape quotes in titles">escape anything within Expression Engine</a> itself. So adding the usual call to addslashes() isn&#8217;t possible. </p>
<p>So, while Expression Engine is pretty snazzy and nice it isn&#8217;t without it&#8217;s pitfalls. Mind you, the escaping issue isn&#8217;t impossible to avoid; it&#8217;s more a question of design than anything. It is something that needs to be watched out for because, yeah, doesn&#8217;t seem there&#8217;s going to be a change anytime soon. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/05/expression-engine-escaping-madness/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend Framework URL View Helper</title>
		<link>http://blog.ericlamb.net/2010/04/zend-framework-url-view-helper/</link>
		<comments>http://blog.ericlamb.net/2010/04/zend-framework-url-view-helper/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 21:34:57 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[view helper]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=2992</guid>
		<description><![CDATA[I&#8217;ve been working with Zend Framework a lot lately, which is one reason for the drought in posting, and have kept running into a recurring uncertainty using the URL view helper. The URL view helper included with the Zend Framework is a little confusing at random times for me so in the hopes of making [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with <a href="http://framework.zend.com/" onclick="return TrackClick('http%3A%2F%2Fframework.zend.com%2F','Zend+Framework')" target="_blank" title="Zend Framework">Zend Framework</a> a lot lately, which is one reason for the drought in posting, and have kept running into a recurring uncertainty using the URL view helper. The URL view helper included with the Zend Framework is a little <a href="http://framework.zend.com/issues/browse/ZF-5777" onclick="return TrackClick('http%3A%2F%2Fframework.zend.com%2Fissues%2Fbrowse%2FZF-5777','Missing+details+for+the+url+view+helper')" target="_blank" title="Missing details for the url view helper">confusing</a> at random times for me so in the hopes of making sense out of everything long term the below is a brief outline of how the Zend Framework URL view helper works and what not.</p>
<div id="attachment_3000" class="wp-caption aligncenter" style="width: 256px"><img src="http://blog.ericlamb.net/wp-content/uploads/2010/03/confusion.jpg" alt="Zend Framework URL View Helper" title="Zend Framework URL View Helper" width="246" height="260" class="size-full wp-image-3000" /><p class="wp-caption-text">Zend Framework URL View Helper</p></div>
<p>The Zend Framework URL view helper is used to render a URL that follows the rules setup using the Zend Route module. This is nice because you can change the routes defined for your application and not have to worry about how your URLs are structured.</p>
<p>The basic syntax is below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #000;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #000088;">$urlOptions</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #000;">&#40;</span><span style="color: #000;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #000088;">$reset</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$encode</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Using the above for a template below is an example of the usage and output:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//outputs /a/b/c/</span>
<span style="color: #22f;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #000;">&#40;</span><span style="color: #990000;">array</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'module'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'a'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'controller'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'b'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'action'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'c'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>As you can see the URL view helper outputs a simple URL to the module &#8220;a&#8221;, controller &#8220;b&#8221; and the action &#8220;c&#8221;.</p>
<p>Things get a little trickier when you want to pass along some variables though. By default the above example will append any existing variables, that are outside of the MVC paradigm, onto any new URLs created. For example, if the page url is the below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
/a/b/c/foo/4/bar/yes
*/</span></pre></div></div>

<p>And you call the below call to the URL view helper:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #22f;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #000;">&#40;</span><span style="color: #990000;">array</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'module'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'a2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'controller'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'b2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'action'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'c2'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You&#8217;ll get the below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
/a2/b2/c2/foo/4/bar/yes
*/</span></pre></div></div>

<p>When I first ran into this issue I was flummoxed. It was kind of a problem (to put it mildly). To get around this you have to set the &#8220;reset&#8221; value to TRUE. Doing so will keep any existing query variables out of your URL. </p>
<p>To add fresh variables to the URL view helper you use the below syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//outputs /a2/b2/c2/bar/yes</span>
<span style="color: #22f;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url</span><span style="color: #000;">&#40;</span><span style="color: #990000;">array</span><span style="color: #000;">&#40;</span><span style="color: #0000ff;">'module'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'a2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'controller'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'b2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'action'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'c2'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'bar'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'yes'</span><span style="color: #000;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #000;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>That will, hopefully, keep you from making the same mistake and the subsequent head bashing that would be sure to ensue. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/04/zend-framework-url-view-helper/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Remove Boonex Footer From Dolphin CMS</title>
		<link>http://blog.ericlamb.net/2010/03/remove-boonex-footer-from-dolphin-cms/</link>
		<comments>http://blog.ericlamb.net/2010/03/remove-boonex-footer-from-dolphin-cms/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 08:00:56 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[boonex]]></category>
		<category><![CDATA[dolphin cms]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=2962</guid>
		<description><![CDATA[After the server lockout and subsequent move last week I had to setup all my old sites on the new server. Aside from the loss of a few posts my blog (which I could restore from Google cache) and a few comments (which I couldn&#8217;t restore unfortunately) everything was pretty smooth. That was until I [...]]]></description>
			<content:encoded><![CDATA[<p>After the <a href="http://blog.ericlamb.net/2010/03/a-new-kind-of-failure-point/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2010%2F03%2Fa-new-kind-of-failure-point%2F','A+New+Kind+of+Failure+Point')" title="A New Kind of Failure Point">server lockout</a> and subsequent move last week I had to setup all my old sites on the new server. Aside from the loss of a few posts my blog (which I could restore from Google cache) and a few comments (which I couldn&#8217;t restore unfortunately) everything was pretty smooth. That was until I had to move over one of my clients sites that was using <a title="Code Like It’s 1999 With Dolphin CMS" href="http://blog.ericlamb.net/2009/12/code-like-its-1999-with-dolphin-cms/" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2F2009%2F12%2Fcode-like-its-1999-with-dolphin-cms%2F','Code+Like+It%E2%80%99s+1999+With+Dolphin+CMS')">Dolphin CMS</a>.</p>
<div id="attachment_2966" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/03/closed-lock.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F03%2Fclosed-lock.jpg','Remove+Boonex+Footer+From+Dolphin+CMS')"><img class="size-medium wp-image-2966" title="Remove Boonex Footer From Dolphin CMS" src="http://blog.ericlamb.net/wp-content/uploads/2010/03/closed-lock-300x219.jpg" alt="Remove Boonex Footer From Dolphin CMS" width="300" height="219" /></a><p class="wp-caption-text">Remove Boonex Footer From Dolphin CMS</p></div>
<p>The issue was that the client&#8217;s site was now being tagged with a Powered By Boonex footer; not cool because the client had purchased a license and shouldn&#8217;t have the callout to Boonex. It looked like the site couldn&#8217;t reach the licensing server so it was acting like the site wasn&#8217;t a valid and licensed version.</p>
<p>I had set up the new server in a pretty locked down way, using a pretty paranoid strategy with firewalls and port changes and all that fun stuff. Unfortunately for my client, this included mod_security which Dolphin requires <a title="Dolphin Technical Requirements" href="http://www.boonex.com/trac/dolphin/wiki/DolTech" onclick="return TrackClick('http%3A%2F%2Fwww.boonex.com%2Ftrac%2Fdolphin%2Fwiki%2FDolTech','Dolphin+Technical+Requirements')" target="_blank">special configuration for</a>:</p>
<blockquote><p>If some security module is installed on the server (such as mod_security  for Apache), it should be able to be disabled or set up for specific folders.</p></blockquote>
<p>Not wanting to allow such a blatant security hole into my server following the above just wasn&#8217;t acceptable. Instead I decided to just remove the call to the licensing server in the code; it&#8217;s just php so I didn&#8217;t think it would be too difficult. It wasn&#8217;t but it was a little confusing though so here&#8217;s the code and process in case anyone else has the need.</p>
<p>BECAUSE I DON&#8217;T WANT TO GET SUED: only use this if you&#8217;ve already purchased a license. Blah, blah, blah. Oh, and this has only been tested in Dolphin 6.1.</p>
<ol>
<li>First, open up &#8220;/inc/design.inc.php&#8221;</li>
<li>look for a HUGE base64 encoded line (one really long and one underneath is short). You&#8217;re going to need to remove both lines.<br />
It should be around line 500 and indented a few pages in. If you can&#8217;t find it search for &#8220;base64_decode&#8221; and it&#8217;ll come up.</li>
<li>Replace the both lines with the below:</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$s813518</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Y3JlYXRlX2Z1bmN0aW9u'</span><span style="color: #339933;">;</span><span style="color: #000088;">$s534634</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'base64_decode'</span><span style="color: #339933;">;</span><span style="color: #000088;">$s434741</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'YmFzZTY0X2RlY29kZQ=='</span><span style="color: #339933;">;</span><span style="color: #000088;">$s865127</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'ZWNobw=='</span><span style="color: #339933;">;</span><span style="color: #000088;">$s734874</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Z2xvYmFsICRfcGFnZTsNCg0KJHM0MzUyMzYgPSBiYXNlNjRfZGVjb2RlKCAnWW1GelpUWTBYMlJsWTI5a1pRPT0nICk7DQokczU4OTM1NSA9ICdYMTlpYjI5dVpYaGZabTl2ZEdWeWMxOWYnOw0KJHM3NDM3NjUgPSAnWjJ4dlltRnNJQ1J6YVhSbE93MEtaMnh2WW1Gc0lDUjBiWEJzT3cwS0RRb2tjMFp2YjNSbGNuTWdQU0FuSnpzTkNtbG1JQ2huWlhSUVlYSmhiU2duWlc1aFlteGxYMlJ2YkhCb2FXNWZabTl2ZEdWeUp5a3BJSHNOQ2lBZ0lDQU5DaUFnSUNBa2MwRm1aa2xFSUQwZ2RISnBiU2huWlhSUVlYSmhiU2duWW05dmJtVjRRV1ptU1VRbktTazdEUW9nSUNBZ2FXWW9JSE4wY214bGJpZ2dKSE5CWm1aSlJDQXBJQ2tnSkhOQlptWkpSQ0F1UFNBbkxtaDBiV3duT3cwS0RRb2dJQ0FnYjJKZmMzUmhjblFvS1RzTkNnMEtJQ0FnSUNSelJtOXZkR1Z5Y3lBOUlDY25PdzBLZlEwS0RRcHlaWFIxY200Z0pITkdiMjkwWlhKek93PT0nOw0KJHM1ODYyODQgPSAnVkcxd2JFdGxlWE5TWlhCc1lXTmwnOw0KJHM5ODU0OTUgPSAnTDE5ZktGdGhMWHBCTFZvd0xUbGZMVjByS1Y5Zkx3PT0nOw0KJHM3ODI0ODYgPSAnYzNSeWNHOXonOw0KJHM5NTAzMDQgPSAnYzNSeVgzSmxjR3hoWTJVPSc7DQokczk0Mzk4NSA9ICdjSEpsWjE5eVpYQnNZV05sWDJOaGJHeGlZV05yJzsNCiRzNjc3NDM0ID0gJ1dXOTFJR2hoZG1VZ2JXRnVkV0ZzYkhrZ2NtVnRiM1psWkNBOFlTQm9jbVZtUFNKb2RIUndPaTh2ZDNkM0xtSnZiMjVsZUM1amIyMHZJajVDYjI5dVJYZzhMMkUrSUdadmIzUmxjbk1nZDJsMGFHOTFkQ0J3WVhscGJtY2dabTl5SUhSb1pTQnlhV2RvZENCMGJ5NGdVR3hsWVhObExDQm5ieUIwYnlBOFlTQm9jbVZtUFNKb2RIUndjem92TDNkM2R5NWliMjl1WlhndVkyOXRMM0JoZVcxbGJuUXVjR2h3UDNCeWIyUjFZM1E5Ukc5c2NHaHBiaUkrUW05dmJrVjRMbU52YlR3dllUNGdZVzVrSUc5eVpHVnlJSFJvWlNCaFpDQm1jbVZsSUd4cFkyVnVjMlZ6SUhSdklHSmxJR0ZpYkdVZ2RHOGdkWE5sSUhsdmRYSWdjMmwwWlNCM2FYUm9iM1YwSUR4aElHaHlaV1k5SW1oMGRIQTZMeTkzZDNjdVltOXZibVY0TG1OdmJTOGlQa0p2YjI1RmVEd3ZZVDRnWm05dmRHVnljeTRnVkdobGVTQjNhV3hzSUdKbElHRjFkRzl0WVhScFkyRnNiSGtnY21WdGIzWmxaQ0JoY3lCemIyOXVJR0Z6SUhsdmRTQnlaV2RwYzNSbGNpQjViM1Z5SUdGa0lHWnlaV1VnYkdsalpXNXpaWE11SUZCc1pXRnpaU3dnY0hWMElIUm9aU0E4WWo1ZlgySnZiMjVsZUY5bWIyOTBaWEp6WDE4OEwySStJR3RsZVNCaVlXTnJJR2x1ZEc4Z1JHOXNjR2hwYmlCMFpXMXdiR0YwWlM0PSc7DQokczU0NjY5MyA9ICdibUZ0WlY5cGJtUmxlQT09JzsNCg0KJHM1NDU2MjQgPSAkczQzNTIzNiggJHM1ODYyODQgKTsNCiRzNDM0NjQzID0gJHM0MzUyMzYoICRzOTg1NDk1ICk7DQokczkzNzU4NCA9ICRzNDM1MjM2KCAkczc4MjQ4NiApOw0KJHMwMjM5NTAgPSAkczQzNTIzNiggJHM5NTAzMDQgKTsNCiRzOTM3NTA0ID0gJHM0MzUyMzYoICRzOTQzOTg1ICk7DQokczM4NTk0MyA9ICRzNDM1MjM2KCAkczU0NjY5MyApOw0KDQokczk4NzU2MCA9ICRfcGFnZTsNCiRzOTQ2NTkwID0gZmFsc2U7DQokczg1OTM0OCA9IGFycmF5KCAyOSwgNDMsIDQ0LCA1OSwgNzksIDgwLCAxNTAgKTsNCg0KaWYoIGluX2FycmF5KCAkczk4NzU2MFskczM4NTk0M10sICRzODU5MzQ4ICkgb3IgJHM5Mzc1ODQoICRzNjUzOTg3LCAkczQzNTIzNiggJHM1ODkzNTUgKSApICE9PSAkczk0NjU5MCApIHsNCiAgICAkczY1Mzk4NyA9ICRzMDIzOTUwKCAkczQzNTIzNiggJHM1ODkzNTUgKSwgZXZhbCggJHM0MzUyMzYoJHM3NDM3NjUpICksICRzNjUzOTg3ICk7DQogICAgJHM2NTM5ODcgPSAkczkzNzUwNCggJHM0MzQ2NDMsICRzNTQ1NjI0LCAkczY1Mzk4NyApOw0KICAgIGVjaG8gJHM2NTM5ODc7DQp9IGVsc2UNCiAgICBlY2hvICRzOTg3NTYwWyRzMzg1OTQzXSAuICcgJyAuICRzNDM1MjM2KCAkczY3NzQzNCApOw=='</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$s545674</span><span style="color: #339933;">=</span><span style="color: #000088;">$s534634</span><span style="color: #000;">&#40;</span> <span style="color: #000088;">$s813518</span> <span style="color: #000;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$s548866</span><span style="color: #339933;">=</span><span style="color: #000088;">$s534634</span><span style="color: #000;">&#40;</span> <span style="color: #000088;">$s434741</span> <span style="color: #000;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$s947586</span><span style="color: #339933;">=</span><span style="color: #000088;">$s534634</span><span style="color: #000;">&#40;</span> <span style="color: #000088;">$s865127</span> <span style="color: #000;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$$s947586</span><span style="color: #339933;">=</span><span style="color: #000088;">$s545674</span><span style="color: #000;">&#40;</span> <span style="color: #0000ff;">'$s653987'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s548866</span><span style="color: #000;">&#40;</span> <span style="color: #000088;">$s734874</span> <span style="color: #000;">&#41;</span></pre></div></div>

<p>Boonex uses base64 to encode and obfuscate the licensing code so it can&#8217;t be modified without a bare minimum of trouble. Not that they had much of an option; php is notoriously hard to encode with any elegance or reliability. Anyway, they chose base64.</p>
<p>All that was needed was to base64_decode the code, and then base64_decode that code (yup, they did it twice). After that I made the changes to remove the HTML that displays the Boonex footer, base64_encoded that, then did it again to create the above.</p>
<p>So, once again, only use the above code if you&#8217;ve already purchased a license. Yes, it should work if you didn&#8217;t but I don&#8217;t want to get sued so it has to be said.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/03/remove-boonex-footer-from-dolphin-cms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Horrors of C99.php</title>
		<link>http://blog.ericlamb.net/2010/02/the-horrors-of-c99-php/</link>
		<comments>http://blog.ericlamb.net/2010/02/the-horrors-of-c99-php/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:10:14 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Brain Dump]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[c99.php]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=2958</guid>
		<description><![CDATA[If you were a sysadmin a few years ago, and you had php on your servers, you’re probably already familiar with c99. In case you haven’t had the personal pleasure, c99, or specifically c99.php (hint: check the source), is the name of a script used by hackers to gain access to a web server running [...]]]></description>
			<content:encoded><![CDATA[<p>If you were a sysadmin a few years ago, and you had php on your servers, you’re probably already familiar with c99. In case you haven’t had the personal pleasure, c99, or specifically <a title="c99.php" href="http://corz.org/corz/c99.php" onclick="return TrackClick('http%3A%2F%2Fcorz.org%2Fcorz%2Fc99.php','c99.php')" target="_blank">c99.php</a> (hint: check the source), is the name of a script used by hackers to gain access to a web server running php using an exploit technique called <a title="Remote File Inclusion" href="http://en.wikipedia.org/wiki/Remote_File_Inclusion" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRemote_File_Inclusion','Remote+File+Inclusion')" target="_blank">Remote File Inclusion</a>.</p>
<div id="attachment_2959" class="wp-caption aligncenter" style="width: 301px"><a href="http://blog.ericlamb.net/wp-content/uploads/2010/03/corz.org-c99shell_1258493034502-291x300.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F03%2Fcorz.org-c99shell_1258493034502-291x300.png','The+Horrors+of+C99.php')"><img class="size-full wp-image-2959" title="The Horrors of C99.php" src="http://blog.ericlamb.net/wp-content/uploads/2010/03/corz.org-c99shell_1258493034502-291x300.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2010%2F03%2Fcorz.org-c99shell_1258493034502-291x300.png','The+Horrors+of+C99.php')" alt="The Horrors of C99.php" width="291" height="300" /></a><p class="wp-caption-text">The Horrors of C99.php</p></div>
<h3>A Little History</h3>
<p>See, back in the day some php developers were pretty stupid. (Admit it; you were stupid once too.) What other explanation could there be for writing code that allowed the injection of arbitrary routines into a program. Trivially easy too.</p>
<p>To be fair, PHP was to blame a little for this as well. Given PHP’s high adoption, and design, by, and for, newbie programmers allowing such a technique by default was just ill conceived, and maybe even a little negligent. I understand the desire, and sometime need, for a technique that could be dangerous but to enable the feature by default…. damn man…</p>
<p>So, the risk was known, yet code was still being written (like the below example) that allowed remote file inclusion to be possible. Mostly because of the aforementioned default setting.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'blue'</span><span style="color: #339933;">;</span>
<span style="color: #22f;">if</span> <span style="color: #000;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #000;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'COLOR'</span><span style="color: #000;">&#93;</span> <span style="color: #000;">&#41;</span> <span style="color: #000;">&#41;</span>
<span style="color: #000;">&#123;</span>
	<span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #000;">&#91;</span><span style="color: #0000ff;">'COLOR'</span><span style="color: #000;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000;">&#125;</span>
<span style="color: #22f;">require</span><span style="color: #000;">&#40;</span> <span style="color: #000088;">$color</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'.php'</span> <span style="color: #000;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>BTW, if you currently write code that does anything like the above, frankly, you’re an idiot. You aren’t nearly as smart and clever as you think you are. I promise you this will bite you. Bad too.</p>
<h3>About C99.php</h3>
<p>So, using a technique like the above opens you up to learning first hand about c99.php. Finding information about the program itself is a little tricky but there are a couple examples that highlight just how <a title="Find r57 and c99 Shells Hidden Inside PHP and TXT Files" onclick="return TrackClick('http%3A%2F%2Fwww.nullamatix.com%2Ffind-r57-and-c99-shells-hidden-inside-php-and-txt-files%2F','Find+r57+and+c99+Shells+Hidden+Inside+PHP+and+TXT+Files')" href="http://www.nullamatix.com/find-r57-and-c99-shells-hidden-inside-php-and-txt-files/" onclick="return TrackClick('http%3A%2F%2Fwww.nullamatix.com%2Ffind-r57-and-c99-shells-hidden-inside-php-and-txt-files%2F','Find+r57+and+c99+Shells+Hidden+Inside+PHP+and+TXT+Files')" target="_blank">devastating it can be</a>.</p>
<blockquote><p>When malicious intruders compromise a web server, there’s an excellent chance a famous Russian PHP script, r57shell, will follow. The r57shell PHP script gives the intruder a number of capabilities, including, but not limited to: downloading files, uploading files, creating backdoors, setting up a spam relay, forging email, bouncing a connection to decrease the risk of being caught, and even taking control of SQL databases. All these functions become readily available through an easy to use web interface, but now you can fight back.</p></blockquote>
<p>Using the above explanation, which I agree with, c99.php acts as an interface to control your server. Once it’s on your server an attacker has easy access to view all the files and their contents, make changes to the system, upload new files, manipulate the database(s) and more.</p>
<p>Quite the nasty little script but pretty elegant in how it’s implemented. c99 is a completely standalone script; even the images are embedded inside using base64!</p>
<p>Until a month ago I would have thought the risk of encountering c99.php in the wild would have been small these days. Then, SMACK!!, a client had a site get hacked (quick CYA; that I didn’t’ work on <img src='http://blog.ericlamb.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) using c99. So be warned. It’s out there and if you’re not smart, or if you’re a lazy, <em>lazy</em>, coder, c99 will get you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2010/02/the-horrors-of-c99-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
