<?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>gen = new Random</title>
	<atom:link href="http://www.gen.newrandom.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gen.newrandom.com</link>
	<description>Random info for the Random user</description>
	<lastBuildDate>Sun, 24 Jul 2011 09:30:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>CodeIgniter 2 with CSRF and Zebra_Form</title>
		<link>http://www.gen.newrandom.com/2011/07/22/codeigniter-2-with-csrf-and-zebra_form/</link>
		<comments>http://www.gen.newrandom.com/2011/07/22/codeigniter-2-with-csrf-and-zebra_form/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 12:36:20 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zebra_Form]]></category>

		<guid isPermaLink="false">http://www.gen.newrandom.com/?p=290</guid>
		<description><![CDATA[There is an awesome (imo) PHP class that is helpful in auto-generating forms with client side (jquery) and server side (php) validation. My words cannot do it justice, so an excerpt from the the author, Stefan Gabos: Zebra_Form is a PHP class that simplifies the process of creating and validating HTML forms. Its object-oriented structure [...]]]></description>
			<content:encoded><![CDATA[<p>There is an awesome (imo) PHP class that is helpful in auto-generating forms with client side (jquery) and server side (php) validation. My words cannot do it justice, so an excerpt from the the author, <a href="http://stefangabos.ro/php-libraries/zebra-form/" title="Zebra Form">Stefan Gabos</a>:</p>
<blockquote><p>Zebra_Form is a PHP class that simplifies the process of creating and validating HTML forms. Its object-oriented structure promotes rapid HTML forms development and encourages developers to write clean and easily maintainable code. It frees the developers from the repetitive task of writing the code for validating forms by offering powerful built-in client-side and server-side validation.</p></blockquote>
<p>I was using Zebra_Form a lot recently, actually, you can see my bug fix accredits and comments under the pseudo-name &#8216;Jack Ryan&#8217; (I <del datetime="2011-07-22T10:08:42+00:00">had</del> <ins datetime="2011-07-22T10:08:42+00:00">have</ins> a Tom Clancy fascination&#8230;). Even more recently, I&#8217;ve been hooked on phonics with <a href="http://codeigniter.com/" title="CodeIgniter">CodeIgniter</a> (and sometimes have an affair with <a href="http://cibonfire.com/" title="Bonfire">Bonfire</a>).</p>
<p>If you look at the built in form validation in CodeIgniter 2.0, it is actually well put together. Unfortunately, it does not offer anything near the capabilities of Zebra_Form, which out of the box, is far more aesthetically pleasing. What I&#8217;m going to share is how I incorporated Zebra_Form in CodeIgniter while best preserving the MVC framework. Let&#8217;s get started. <span id="more-290"></span></p>
<p>1. Download the latest version of <a href="http://stefangabos.ro/php-libraries/zebra-form/" title="Zebra_Form">Zebra_Form</a> (I&#8217;m using 2.7)<br />
- Note: Stefan rolls out updates constantly! It&#8217;s almost hard to keep up as he is really quick to respond to bugs. These updates should not affect this tutorial but if you have a problem let me know.</p>
<p>2. Rename the folder to &#8216;zebra&#8217; and put it in your root/application/libraries/ directory. So you should be able to reach your files at root/application/libraries/zebra/Zebra_Form.php.<br />
- Note: I named the library class Zebra, but now that I think about it, it would have made sense to rename the folder &#8216;zebra_form&#8217; instead but you can do as you please.</p>
<p>3. Create a new library called &#8216;Zebra.php&#8217; and you can start out with the following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">// include the Zebra_Form class</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">&quot;application/libraries/zebra/Zebra_Form.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Zebra <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$zebraForm</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
	log_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'debug'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Initializing Zebra library'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// get an instance of CodeIgniter</span>
	<span style="color: #000088;">$CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// load the form helper class</span>
        <span style="color: #666666; font-style: italic;">// This is your own class, but works just like the CI form helper except</span>
        <span style="color: #666666; font-style: italic;">// instead of the functions to create a form, you created the form already.</span>
        <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'zebra_form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;"># application/helpers/zebra_form_helper.php
</span>    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Call by your controller to get which form to create</span>
    <span style="color: #666666; font-style: italic;">// I do this because my website creates different types of forms (i.e., login, contact, etc)</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> create_form<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form_name</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
	log_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'info'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Creating '</span><span style="color: #339933;">.</span><span style="color: #000088;">$form_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// call a helper function to create the form</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">zebraForm</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// above we dynamically called the function by $form_name</span>
        <span style="color: #666666; font-style: italic;">// as you can tell naming is important so you have to make sure</span>
        <span style="color: #666666; font-style: italic;">// you name the function 'funtion form_name' in your helper</span>
        <span style="color: #666666; font-style: italic;">// and call this from your controller as '$this-&gt;zebra-&gt;create_form('form_name')'</span>
        <span style="color: #666666; font-style: italic;">// I will go over this later too.</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file Zebra.php */</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That&#8217;s the Zebra library!! Now, onto the helper class!</p>
<p>4. Create a file in application/helpers/ called &#8216;zebra_form_helper.php&#8217;</p>
<p>5. Add the following code to make your form! If you are not familiar with creating forms with Zebra_Form, you should refer to the documentation. Right now, I&#8217;m going to make a simple Contact From.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php 	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/*
 * Zebra_Form helper class
 *
 * Functions for creating individual forms
 */</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Remember, this has to be the same name as what you call the form from the controller</span>
 <span style="color: #666666; font-style: italic;">// $this-&gt;{zebra_library}-&gt;create_form('form_name');</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> zf_contact<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// instantiate a Zebra_Form object</span>
	<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zebra_Form<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contact_form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// necessary for CodeIgnition's CSRF!</span>
	<span style="color: #000088;">$CI</span> <span style="color: #339933;">=</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// if you make the $CI in Zebra.php global, you do not need a new instance</span>
	<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hidden'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">security</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_csrf_token_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">security</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_csrf_hash</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lock</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// the label for the &quot;first name&quot;</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'label_contact_name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contact_name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Name:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// add the &quot;first name&quot; field</span>
	<span style="color: #666666; font-style: italic;">// the &quot;&amp;&quot; symbol is there so that $obj will be a reference to the object in PHP 4</span>
	<span style="color: #666666; font-style: italic;">// for PHP 5+ there is no need for it</span>
	<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contact_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// set rules</span>
	<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rule</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// error messages will be sent to a variable called &quot;error&quot;, usable in custom templates</span>
		<span style="color: #0000ff;">'required'</span>  <span style="color: #339933;">=&gt;</span>  <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'A name is required!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// &quot;contact_email&quot;</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'label_contact_email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contact_email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email address:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contact_email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rule</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
&nbsp;
		<span style="color: #0000ff;">'required'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email is required!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'email'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email address seems to be invalid!'</span><span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// attach a note to the email element</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'note'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'note_contact_email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contact_email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Please enter a valid email address.'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'style'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'width:200px'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// &quot;message&quot;</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'label'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'label_message'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'message'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Message:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'textarea'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rule</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Message is required!'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// &quot;captcha&quot;</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'captcha'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'captcha_image'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'captcha_code'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'captcha_code'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'note'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'note_captcha'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'captcha_code'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'You must enter the characters in black that stand
	out from the other characters. Not case sensitive.'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'style'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'width: 200px'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rule</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'captcha'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Characters from image entered incorrectly!'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// &quot;ip&quot;</span>
	<span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hidden'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ip'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lock</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// &quot;submit&quot;</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'submit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'btnsubmit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Submit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#
</span>	<span style="color: #666666; font-style: italic;"># we must return the form object so we can use it later to validate the form
</span>	<span style="color: #666666; font-style: italic;">#
</span>	
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Okay, so let&#8217;s review.<br />
- We have our Zebra library<br />
- We have our zebra_form_helper</p>
<p>Now let&#8217;s go to the controller!</p>
<p>6. I create a controller as such: application/controllers/site.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #009933; font-style: italic;">/**
 * Site Controller Class
 *
 * @package 	Default
 * @author  	Josh Tomaino
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> Site <span style="color: #000000; font-weight: bold;">extends</span> CI_Controller <span style="color: #009900;">&#123;</span>
<span style="color: #009933; font-style: italic;">/**
	 *  Array containing all the error messages generated by the controller
	 *
	 *  @var    array
	 */</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$error</span><span style="color: #339933;">;</span>		<span style="color: #666666; font-style: italic;">// It is no coincidence that THIS is the SAME name </span>
				<span style="color: #666666; font-style: italic;">// As the error variable that Zebra_Form creates.</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// ------------------------------------------------------------------------</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Constructor
	 *
	 * @access	public
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		log_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'info'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Initialized Site controller'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">contact</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		<span style="color: #666666; font-style: italic;">// since I have not set my default page to contact()</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// ------------------------------------------------------------------------</span>
&nbsp;
	<span style="color: #009933; font-style: italic;">/**
	 * Contact
	 * 
	 * Load the 'contact us' page
	 *
	 * @access	public
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> contact<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// define function global</span>
&nbsp;
		<span style="color: #000088;">$email_sent</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// load the Zebra library for the Zebra_Form framework</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'zebra'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>			<span style="color: #666666; font-style: italic;"># libraries/Zebra.php
</span>		
		<span style="color: #666666; font-style: italic;">// create the contact from the helper class</span>
		<span style="color: #666666; font-style: italic;">// gets the $form object that was returned from the helper</span>
&nbsp;
		<span style="color: #000088;">$contact_form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">zebra</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create_form</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'zf_contact'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;"># your form name!
</span>		
		<span style="color: #666666; font-style: italic;">// if the form was submitted</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contact_form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// and the form was valid</span>
&nbsp;
			log_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'info'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Contact form validated, sending results'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// load the email library from CodeIgniter</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// define mail parameters</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sender@mail.com'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Sender'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;"># from: Sender
</span>			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">to</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'recipient@mail.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>			<span style="color: #666666; font-style: italic;"># to: 	Customer Service Email 
</span>			
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">subject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Contact Form);			# subj:	Contact Form
			$this-&gt;email-&gt;message(					# message
				&quot;
					Email delivered by Contact Form.			\n\n
					From: 	&quot;.$this-&gt;input-&gt;post('</span>contact_name<span style="color: #0000ff;">').&quot;		\n\n
					Email: 	&quot;.$this-&gt;input-&gt;post('</span>contact_email<span style="color: #0000ff;">').&quot;		\n\n
					IP: 	&quot;.$this-&gt;input-&gt;post('</span>ip<span style="color: #0000ff;">').&quot;			\n\n
					Message: 						\n\n
&nbsp;
					&quot;.$this-&gt;input-&gt;post('</span>message<span style="color: #0000ff;">')
				);
&nbsp;
			// if
			if( $this-&gt;email-&gt;send() )
			{
				// form submission sent
&nbsp;
				log_message('</span>info<span style="color: #0000ff;">', '</span>Contact form submission was emailed to recipient<span style="color: #339933;">@</span>email<span style="color: #339933;">.</span>com<span style="color: #0000ff;">');
&nbsp;
				// let'</span>s remember the email was sent so we can tell the view
&nbsp;
				<span style="color: #000088;">$email_sent</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// could not send form submission</span>
&nbsp;
				log_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'info'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Failed to send the form submission'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// report the error to the user</span>
&nbsp;
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mail_form'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'We failed to receive your inquiry! Please try again later.'</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #000088;">$email_sent</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">// unnecessary but good visual</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// print email debugger to the logs, which I think is pretty useful.</span>
&nbsp;
			log_message<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'debug'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">print_debugger</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// define data we want in our view</span>
&nbsp;
		<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>					<span style="color: #666666; font-style: italic;"># view data
</span>			<span style="color: #0000ff;">'page_title'</span> 	<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Contact'</span><span style="color: #339933;">,</span>		<span style="color: #666666; font-style: italic;"># head&gt;title
</span>			<span style="color: #0000ff;">'contact_form'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$contact_form</span><span style="color: #339933;">,</span>	<span style="color: #666666; font-style: italic;"># pass contact form to view
</span>			<span style="color: #0000ff;">'error'</span>		<span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #339933;">,</span>	<span style="color: #666666; font-style: italic;"># errors that may have been recorded
</span>			<span style="color: #0000ff;">'email_sent'</span>	<span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$email_sent</span><span style="color: #339933;">,</span>		<span style="color: #666666; font-style: italic;"># tell view if email was sent or not
</span>		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// show the view to the user</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contact'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		<span style="color: #666666; font-style: italic;"># views/contact.php
</span>	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Please note, btw that unless you are running a local mailserver you cannot successfully perform this function on your local machine. Try uploaded it to a web server or replace ($this->mail->send()) with ($email_sent = true) to see what would happen if it worked correctly (or false if it didn&#8217;t).</p>
<p>Now that we have our Controller, all that is left is our view.</p>
<p>7. I create a view as such: application/views/contact.php.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt; !DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
	&lt;head&gt;
		&lt;base href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 	<span style="color: #666666; font-style: italic;"># this is a habit i've been getting into </span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #0000ff;">&quot;&gt; 
		&lt;title&gt;&lt; ?php echo <span style="color: #006699; font-weight: bold;">$page_title</span>; ?&gt;&lt;/title&gt;
	&lt;/base&gt;&lt;/head&gt;
&nbsp;
	&lt;body&gt;
&nbsp;
		&lt;div class=&quot;</span>content<span style="color: #0000ff;">&quot;&gt;
&nbsp;
			&lt;h2&gt;&lt; ?php echo <span style="color: #006699; font-weight: bold;">$page_title</span>; ?&gt;&lt;/h2&gt;
&nbsp;
			&lt;p&gt;
				Your feedback and concerns are of the utmost importance to us.
			&lt;/p&gt;
			&lt;p&gt;
				An asterisk (&lt;span style=&quot;</span>color<span style="color: #339933;">:</span>red<span style="color: #0000ff;">&quot;&gt;*&lt;/span&gt;) indicates a required entry.
			&lt;/p&gt;
			&lt;br /&gt;
&nbsp;
&lt; ?php
			// if
			if(<span style="color: #006699; font-weight: bold;">$email_sent</span>):
&nbsp;
				// email was sent
?&gt;
				&lt;p style='font-weight:bold'&gt;Thank you for your inquiry! We will get back to you as soon as possible.&lt;/p&gt;
&lt; ?php
			else:
&nbsp;
				// email was not sent
&nbsp;
				// maybe there were errors
&nbsp;
				// if
				if( isset(<span style="color: #006699; font-weight: bold;">$error</span>) ):
&nbsp;
					// there were errors present
&nbsp;
					foreach(<span style="color: #006699; font-weight: bold;">$error</span> as <span style="color: #006699; font-weight: bold;">$e</span>): 		# show the errors
&nbsp;
						// Server Side error messages in this form look really good! 
						// If you haven't used Zebra_Form before you'll be impressed
&nbsp;
						// You can add your own error like we did 
						// <span style="color: #006699; font-weight: bold;">$error</span>['something'] = 'Error message text user sees!';
&nbsp;
						// 'error' has to be 'error', that's for Zebra
						<span style="color: #006699; font-weight: bold;">$contact_form-&gt;add_error</span>('error', <span style="color: #006699; font-weight: bold;">$e</span>);
&nbsp;
					endforeach;
&nbsp;
				endif;
?&gt;</span>
&nbsp;
				&lt;div id=&quot;zebra_form&quot;&gt;
&lt; ?php
					// auto generate output, labels to the left of form elements
&nbsp;
					$contact_form-&gt;render('*horizontal');	# this renders the form auto-magically!!
&nbsp;
					// If you want to make your own template, you can!
					// Follow the instructions for making your own template
					// at the Zebra Form website. If you have problems though, 
					// let me know and I will add instructions for templates.
?&gt;			
				&lt;/div&gt; &lt;!-- /ZebraForm --&gt;	
&lt; ?php
			endif;
?&gt;
		&lt;/div&gt; &lt;!-- /Content --&gt;
&nbsp;
                &lt;!-- load Zebra_Form's stylesheet file --&gt; 
		&lt;link rel=&quot;stylesheet&quot; href=&quot;zebra/public/css/zebra_form.css&quot; type=&quot;text/css&quot;&gt; 
		&lt;!-- load jQuery --&gt; 
		&lt;script src=&quot;zebra/public/javascript/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; 
		&lt;!-- load Zebra_Form's JavaScript file --&gt; 
		&lt;script src=&quot;zebra/public/javascript/zebra_form.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&nbsp;
	&lt;/link&gt;&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>There&#8217;s one more thing you have to do!</p>
<p>The captcha in Zebra_Form is generated by the process.php file. However, since we put the zebra library in our libraries folder, we do not have access to that file. If your captcha image appears to be broken, you need to put the following lines of code in a .htaccess file and put it in &#8216;zebra&#8217; folder with &#8216;process.php&#8217;. This will give your code access to that one file:</p>
<p><code><br />
Order Deny,Allow<br />
Deny from All </p>
<p><files "process.php"><br />
     Order Deny,Allow<br />
     Allow from All<br />
</files><br />
</code></p>
<p>&#8211; edit: the author of ZF actually advises putting the process.php near the root. Read <a href="http://stefangabos.ro/wp-content/docs/Zebra_Form/Zebra_Form/Zebra_Form.html#methodassets_path">here</a>.</p>
<p>There you have it! A fully functional Zebra Form nearly seamlessly integrated into CodeIgniter. If you want the code, you can find all the files listed separately along with a zip file here:</p>
<p><a href="http://public.newrandom.com/examples/codeigniter/zebra_form/" title="Directory">http://public.newrandom.com/examples/codeigniter/zebra_form/</a></p>
<p>And the compressed zip file:<br />
<a href=&#8221;http://public.newrandom.com/examples/codeigniter/zebra_form/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gen.newrandom.com/2011/07/22/codeigniter-2-with-csrf-and-zebra_form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter and XAJAX &#8211; CSRF fix</title>
		<link>http://www.gen.newrandom.com/2011/07/21/codeigniter-and-xajax-csrf-fix/</link>
		<comments>http://www.gen.newrandom.com/2011/07/21/codeigniter-and-xajax-csrf-fix/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 02:24:28 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[XAJAX]]></category>

		<guid isPermaLink="false">http://www.gen.newrandom.com/?p=283</guid>
		<description><![CDATA[- Added author note: This assumes the latest version of CodeIgniter (2.0.2) but I assume this will work on any CI 2.x with CSRF. All the code edits are in the XAJAX to make it more compatible with CodeIgniter, so the only things to keep in mind for CodeIgniter is the following: - what is [...]]]></description>
			<content:encoded><![CDATA[<p>- Added author note:<br />
This assumes the latest version of CodeIgniter (2.0.2) but I assume this will work on any CI 2.x with CSRF. All the code edits are in the XAJAX to make it more compatible with CodeIgniter, so the only things to keep in mind for CodeIgniter is the following:<br />
- what is the name of my ci_csrf_token<br />
- how do i generate my csrf hash<br />
- how do i get an instance of CI<br />
If you can answer that for your version of CodeIgniter, you should be ok. <span id="more-283"></span></p>
<p>If you already have xajax installed as a library, you can skip to step 7.</p>
<p>1. download the latest version of xajax (or my version: 0.6-beta1)</p>
<p>2. move contents of xajax_core into application/libraries/xajax/</p>
<p>3. rename xajax.inc.php to Xajax.php (per CI library protocol)</p>
<p>4. change ~line 59 (final class xajax) to (final class Xajax)  per CI library protocol (probably unnecessary)</p>
<p>5. put the xajax_js folder in /root/public/js/ folder. (location of my js files) </p>
<p>6.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">// in my Site controller class</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> __constructor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>	<span style="color: #666666; font-style: italic;"># b/c index() is the default page in my controller
</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> ajax<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'xajax/xajax'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;"># libraries/xajax/Xajax.php
</span>	
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">configure</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;requestURI&quot;</span><span style="color: #339933;">,</span> base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'index.php/site/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;"># index.php/controller/
</span>	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">configure</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;javascript URI&quot;</span><span style="color: #339933;">,</span> base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'public/js/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;"># loc of xajax_js/
</span>
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span>XAJAX_FUNCTION<span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'say_hello'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'say_hello'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">processRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> say_hello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$objResponse</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> xajaxResponse<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$objResponse</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Assign</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ajax_div&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;innerHTML&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Hello, world! ~from xAJAX!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$objResponse</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now we will add XAJAX functionality while CSRF is enabled.</p>
<p>7. Find and open xajax/plugin_layer/xajaxDefaultIncludePlugin.inc.php in libraries/<br />
a. Go to line 213 and add the following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">// add ci_csrf_token to auto-generated script</span>
<span style="color: #000088;">$CI</span> <span style="color: #339933;">=&amp;</span> get_instance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$sCrLf</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'xajax.config.ci_csrf_token = &quot;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$CI</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">security</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_csrf_hash</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot;;'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>note: you could make it clean and add the variables and match it up like the previous options, but at the end of the day you&#8217;re just spreading the 5 lines of code around the script which will pain you when you get new xajax updates and have to do it again.</p>
<p>8. Find and open the xajax_core_uncompressed.js in xajax_js/<br />
a. Go to line 3250 and add the following code after &#8216;delete dNow;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000000; font-weight: bold;">var</span> csrf <span style="color: #339933;">=</span> xx<span style="color: #339933;">.</span>config<span style="color: #339933;">.</span>ci_csrf_token<span style="color: #339933;">;</span>
&nbsp;
rd<span style="color: #339933;">.</span>push<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;ci_csrf_token='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
rd<span style="color: #339933;">.</span>push<span style="color: #009900;">&#40;</span>csrf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
delete csrf<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>9. By default, if you are using the xajax_core.js, you will have to go to that file and make the change there but it is easier to know where you&#8217;re making the change if you look at the uncompressed version first. (you can download the changes in the compressed version below).</p>
<p>10.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php   <span style="color: #666666; font-style: italic;"># in my &lt;head&gt;
</span>	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xajax</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>	<span style="color: #666666; font-style: italic;">// not all my pages use ajax</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xajax</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">printJavascript</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> 
&nbsp;
		<span style="color: #666666; font-style: italic;">// other stuff here</span>
&nbsp;
	<span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #666666; font-style: italic;"># in my &lt;body&gt;
</span>	
	<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:xajax_say_hello();&quot;</span><span style="color: #339933;">&gt;</span>Say Hello<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;</span>br <span style="color: #339933;">/&gt;</span>
&nbsp;
	<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ajax_div&quot;</span><span style="color: #339933;">&gt;</span>i say goodbye<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>   		<span style="color: #666666; font-style: italic;">#before
</span>	<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ajax_div&quot;</span><span style="color: #339933;">&gt;</span>Just saying hello from XAJAX<span style="color: #339933;">.&lt;/</span>div<span style="color: #339933;">&gt;</span>	<span style="color: #666666; font-style: italic;">#after
</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That should do it. If you are having problems, you can add the debugger which I wish I knew about and probably would have saved me hours. Just paste the following code in your <head> but after the xajax.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;loc/of/xajax_js/xajax_debug.js&quot;&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>You should see the following in the popup window:</p>
<blockquote><p>POST: xjxfun=say_hello<br />
&#038;xjxr=1311328512430&#038;ci_csrf_token=[your_token_hash_here]</p></blockquote>
<p>You can see how we added &#038;ci_csrf_token to the request.</p>
<p>Now you will always have access to the CSRF token while using XAJAX without having to worry about reading/decrypting CI&#8217;s cookies in your XAJAX calls. It is all passed by adding the parameter directly. Of course, in the future, you will have to add the &#038;ci_csrf_token in future updates (or rename it depending on the version of CI? I recall some versions use csrf_token_name from what I have read.)</p>
<p>Just another note, just because you aren&#8217;t using XAJAX, doesn&#8217;t mean this solution isn&#8217;t for you. The step is the same, it just looks different in XAJAX. Download the xajax script and look at what the rd.push() is doing, then you can manipulate your own request string. Or search for how to add parameters manually.</p>
<p>The code can be found here: (I included the code in the uncompressed version of xajax_core)</p>
<p><a href="http://public.newrandom.com/examples/codeigniter/" title="example code">http://public.newrandom.com/examples/codeigniter/</a></p>
<p>Compressed file:</p>
<p><a href="http://public.newrandom.com/examples/codeigniter/xajax/ci_xajax_fix.tgz" title="example code">http://public.newrandom.com/examples/codeigniter/xajax/ci_xajax_fix.tgz</a></head></p>
<p>Hope that helps someone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gen.newrandom.com/2011/07/21/codeigniter-and-xajax-csrf-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iE8:Focus</title>
		<link>http://www.gen.newrandom.com/2009/06/04/ie8focus/</link>
		<comments>http://www.gen.newrandom.com/2009/06/04/ie8focus/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 16:57:51 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.gen.newrandom.com/?p=231</guid>
		<description><![CDATA[Using the brand new Internet Explorer 8 (because that is the only version I have on this machine), I immediately noticed the pretty dotted black borders appearing over elements that were being &#8220;clicked on&#8221;. The real term is focus, but that&#8217;s too proper. Anyway, it is exciting that Internet Explorer is supporting :focus for CSS, [...]]]></description>
			<content:encoded><![CDATA[<p>Using the brand new Internet Explorer 8 (because that is the only version I have on this machine), I immediately noticed the pretty dotted black borders appearing over elements that were being &#8220;clicked on&#8221;. The real term is focus, but that&#8217;s too proper. Anyway, it is exciting that Internet Explorer is supporting <em>:focus</em> for <abbr title="Cascading Style Sheet">CSS</abbr>, but I find the outline it creates obtrusive by default. The way to get rid of this is to add the following to your css: </p>
<p><code>div:focus { outline: none; }</code></p>
<p>Just thought that was interesting that other elements besides images were being given a default outline value. Maybe they thought it would be a good idea. with the increase in multifunction interfaces. to make it easier to interact with a website, or track your interaction (ie. using tab to navigate a page).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gen.newrandom.com/2009/06/04/ie8focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Missing Required System Fonts&#8230;</title>
		<link>http://www.gen.newrandom.com/2006/06/04/missing-required-system-fonts/</link>
		<comments>http://www.gen.newrandom.com/2006/06/04/missing-required-system-fonts/#comments</comments>
		<pubDate>Sun, 04 Jun 2006 19:37:56 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Base]]></category>
		<category><![CDATA[Cmap]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[CS2]]></category>
		<category><![CDATA[inDesign]]></category>
		<category><![CDATA[Missing]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Reqrd]]></category>
		<category><![CDATA[System Fonts]]></category>

		<guid isPermaLink="false">http://www.gen.newrandom.com/2006/06/04/missing-required-system-fonts/</guid>
		<description><![CDATA[Awhile ago, I had a problem with inDesign CS2. After installing, when I launched the application, I was given a message &#8220;Missing Required System Fonts or Cmap Files&#8221; &#8211; or something to that effect. After zero help from Adobe&#8217;s solution, or the support forums &#8211; which already had a thread on the subject &#8211; it [...]]]></description>
			<content:encoded><![CDATA[<p>Awhile ago, I had a problem with inDesign CS2. After installing, when I launched the application, I was given a message &#8220;Missing Required System Fonts or Cmap Files&#8221; &#8211; or something to that effect. After zero help from <a rel="nofollow" title="Adobe | Error about CMAP files" target="_blank" href="http://www.adobe.com/support/techdocs/324343.html">Adobe&#8217;s solution</a>, or the support forums &#8211; which already had a <a rel="nofollow" title="Adobe Forums" target="_blank" href="http://www.adobeforums.com/cgi-bin/webx?14@@.3bbdb0a7/0">thread on the subject</a> &#8211; it quickly became obvious that I had to find the files I was missing. With some help over iRC, I was sent a copy of the files, pasted them in the correct location, and everything worked fine. Going back to the Adobe Forums, I posted my method for solving the problem, and my email for anyone who wanted them. My inbox was soon flooded.<span id="more-130"></span></p>
<p>Although I have been hosting the archive of the files on my site for awhile, I haven&#8217;t quite moved the instructions here either. Just getting another email from someone for the files (probably because they didn&#8217;t read the entire thread), it reminded me to do this. </p>
<p>You can download the &#8220;Missing System Fonts and Cmap Files&#8221; for inDesign <a title="Missing Required System Fonts and Cmap Files" href="http://public.newrandom.com/adobe/Reqrd.rar">here</a>. </p>
<p>Below are further instructions.</p>
<p><strong>The missing files folders go in the following directory:</strong><br />
C:Program FilesCommon FilesAdobeFontsReqrd</p>
<p>In that directory, there should be a <strong>CMaps</strong> Folder. The following files that should be in there are:</p>
<p>78-EUC-H<br />
78-EUC-V<br />
78-H<br />
78-RKSJ-H<br />
78-RKSJ-V<br />
78-V<br />
78ms-RKSJ-H<br />
78ms-RKSJ-V<br />
83pv-RKSJ-H<br />
90ms-RKSJ-H<br />
90ms-RKSJ-V<br />
90msp-RKSJ-H<br />
90msp-RKSJ-V<br />
90pv-RKSJ-H<br />
90pv-RKSJ-V<br />
Add-H<br />
Add-RKSJ-H<br />
Add-RKSJ-V<br />
Add-V<br />
Adobe-CNS1-0<br />
Adobe-CNS1-1<br />
Adobe-CNS1-2<br />
Adobe-CNS1-3<br />
Adobe-CNS1-4<br />
Adobe-GB1-0<br />
Adobe-GB1-1<br />
Adobe-GB1-2<br />
Adobe-GB1-3<br />
Adobe-GB1-4<br />
Adobe-Japan1-0<br />
Adobe-Japan1-1<br />
Adobe-Japan1-2<br />
Adobe-Japan1-3<br />
Adobe-Japan1-4<br />
Adobe-Japan1-5<br />
Adobe-Japan1-6<br />
Adobe-Japan2-0<br />
Adobe-Korea1-0<br />
Adobe-Korea1-1<br />
Adobe-Korea1-2<br />
B5-H<br />
B5-V<br />
B5pc-H<br />
B5pc-V<br />
CNS-EUC-H<br />
CNS-EUC-V<br />
CNS1-H<br />
CNS1-V<br />
CNS2-H<br />
CNS2-V<br />
ETen-B5-H<br />
ETen-B5-V<br />
ETenms-B5-H<br />
ETenms-B5-V<br />
ETHK-B5-H<br />
ETHK-B5-V<br />
EUC-H<br />
EUC-V<br />
Ext-H<br />
Ext-RKSJ-H<br />
Ext-RKSJ-V<br />
Ext-V<br />
GB-EUC-H<br />
GB-EUC-V<br />
GB-H<br />
GB-V<br />
GBK-EUC-H<br />
GBK-EUC-V<br />
GBK2K-H<br />
GBK2K-V<br />
GBKp-EUC-H<br />
GBKp-EUC-V<br />
GBpc-EUC-H<br />
GBpc-EUC-V<br />
GBT-EUC-H<br />
GBT-EUC-V<br />
GBT-H<br />
GBT-V<br />
GBTpc-EUC-H<br />
GBTpc-EUC-V<br />
H<br />
Hankaku<br />
Hiragana<br />
HKdla-B5-H<br />
HKdla-B5-V<br />
HKdlb-B5-H<br />
HKdlb-B5-V<br />
HKgccs-B5-H<br />
HKgccs-B5-V<br />
HKm314-B5-H<br />
HKm314-B5-V<br />
HKm471-B5-H<br />
HKm471-B5-V<br />
HKscs-B5-H<br />
HKscs-B5-V<br />
Hojo-EUC-H<br />
Hojo-EUC-V<br />
Hojo-H<br />
Hojo-V<br />
Identity-H<br />
Identity-V<br />
Katakana<br />
KSC-EUC-H<br />
KSC-EUC-V<br />
KSC-H<br />
KSC-Johab-H<br />
KSC-Johab-V<br />
KSC-V<br />
KSCms-UHC-H<br />
KSCms-UHC-HW-H<br />
KSCms-UHC-HW-V<br />
KSCms-UHC-V<br />
KSCpc-EUC-H<br />
KSCpc-EUC-V<br />
NWP-H<br />
NWP-V<br />
RKSJ-H<br />
RKSJ-V<br />
Roman<br />
UniCNS-UCS2-H<br />
UniCNS-UCS2-V<br />
UniCNS-UTF16-H<br />
UniCNS-UTF16-V<br />
UniCNS-UTF32-H<br />
UniCNS-UTF32-V<br />
UniCNS-UTF8-H<br />
UniCNS-UTF8-V<br />
UniGB-UCS2-H<br />
UniGB-UCS2-V<br />
UniGB-UTF16-H<br />
UniGB-UTF16-V<br />
UniGB-UTF32-H<br />
UniGB-UTF32-V<br />
UniGB-UTF8-H<br />
UniGB-UTF8-V<br />
UniHojo-UCS2-H<br />
UniHojo-UCS2-V<br />
UniHojo-UTF16-H<br />
UniHojo-UTF16-V<br />
UniHojo-UTF32-H<br />
UniHojo-UTF32-V<br />
UniHojo-UTF8-H<br />
UniHojo-UTF8-V<br />
UniJIS-UCS2-H<br />
UniJIS-UCS2-HW-H<br />
UniJIS-UCS2-HW-V<br />
UniJIS-UCS2-V<br />
UniJIS-UTF16-H<br />
UniJIS-UTF16-V<br />
UniJIS-UTF32-H<br />
UniJIS-UTF32-V<br />
UniJIS-UTF8-H<br />
UniJIS-UTF8-V<br />
UniJISB-UCS2-H<br />
UniJISPro-UCS2-HW-V<br />
UniJISPro-UCS2-V<br />
UniJISPro-UTF8-V<br />
UniJISX0213-UTF32-H<br />
UniJISX0213-UTF32-V<br />
UniKS-UCS2-H<br />
UniKS-UCS2-V<br />
UniKS-UTF16-H<br />
UniKS-UTF16-V<br />
UniKS-UTF32-H<br />
UniKS-UTF32-V<br />
UniKS-UTF8-H<br />
UniKS-UTF8-V<br />
V<br />
WP-Symbol</p>
<p>You may also be missing a <strong>Base</strong> folder. It should be in the same <strong>Reqrd</strong> directory as the <strong>CMaps</strong> folder. The files that belong in this folder are:<br />
wmbi____.afm<br />
wmbi____.inf<br />
wmbi____.pfb<br />
wmbi____.pfm<br />
wmb_____.afm<br />
wmb_____.inf<br />
wmb_____.pfb<br />
wmb_____.pfm<br />
wmi_____.afm<br />
wmi_____.inf<br />
wmi_____.pfb<br />
wmi_____.pfm<br />
wmr_____.afm<br />
wmr_____.inf<br />
wmr_____.pfb<br />
wmr_____.pfm</p>
<p>If you have a Base and CMaps folder, but not all of the files, make sure inDesign isn&#8217;t running, delete both folders, and replace them with the ones available in the archive linked above. Relaunch inDesign, and everything should be fine. If you have any problems, don&#8217;t hesitate to comment.</p>
<p>-Update</p>
<p>It&#8217;s been 2 years, and almost 40GB later since I posted the files!! WOW! It has been great being able to help so many people, and I can&#8217;t believe a 2mb file has been caused 40GB of bandwidth!</p>
<p>If you have been helped, please consider donating to my paypal, any amount will be appreciated and will go to my hosting.</p>
<p><ins datetime="2011-07-24T08:29:19+00:00"></p>
<p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&#038;business=Josh%2eTomaino%40Gmail%2ecom&#038;lc=US&#038;item_name=Josh%20Tomaino&#038;item_number=system_fonts&#038;currency_code=USD&#038;bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" alt="PayPal - The safer, easier way to pay online!" /></a></p>
<p></ins></p>
<p>As always, the files are available here:</p>
<p><a href="http://public.newrandom.com/adobe/Reqrd.rar">.RAR</a><br />
<a href="http://public.newrandom.com/adobe/Reqrd.zip">.ZIP</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gen.newrandom.com/2006/06/04/missing-required-system-fonts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

