<?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>Utahcon.com &#187; Code</title>
	<atom:link href="http://blog.utahcon.com/category/computers/code/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.utahcon.com</link>
	<description></description>
	<lastBuildDate>Wed, 25 Jan 2012 14:18:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MyGeekScore++</title>
		<link>http://blog.utahcon.com/computers/code/mygeekscore?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mygeekscore</link>
		<comments>http://blog.utahcon.com/computers/code/mygeekscore#comments</comments>
		<pubDate>Fri, 15 Jul 2011 20:05:53 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[FuelPHP]]></category>
		<category><![CDATA[Fuel]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[Oil]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[planet]]></category>
		<category><![CDATA[Source Control]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=742</guid>
		<description><![CDATA[Ah yeah! I have finally done it! I have forked, committed, pushed, sent a pull request and now&#8230; I HAVE BEEN MERGED! 12:25 &#60; Fuel-Bot&#62; [oil] philsturgeon pushed 2 new commits to master: https://github.com/fuel/oil/compare/a8e1387&#8230;4be84aa                                                   eighty4 12:25 &#60; Fuel-Bot&#62; [oil/master] Making more use of the Form::label() in the scaffold builds &#8211; Adam Barrett                                                                    el2ro 12:25 &#60; [...]]]></description>
			<content:encoded><![CDATA[<p>Ah yeah! I have finally done it! I have forked, committed, pushed, sent a pull request and now&#8230; I HAVE BEEN MERGED!</p>
<blockquote><p>12:25 &lt; Fuel-Bot&gt; [oil] philsturgeon pushed 2 new commits to master: https://github.com/fuel/oil/compare/a8e1387&#8230;4be84aa                                                   eighty4<br />
12:25 &lt; Fuel-Bot&gt; [oil/master] Making more use of the Form::label() in the scaffold builds &#8211; Adam Barrett                                                                    el2ro<br />
12:25 &lt; Fuel-Bot&gt; [oil/master] Merge pull request #18 from utahcon/master &#8211; Phil Sturgeon</p></blockquote>
<p>Today at 12:25MST <a href="https://github.com/fuel/oil/pull/18">my pull request for Oil</a> was <a href="https://github.com/fuel/oil/commit/4be84aaea6acb92464dbd92dda94a7b22478f8e1">merged into the master line</a>, which means it is gold!</p>
<p><strong>$geekScore++;</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/mygeekscore/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FuelPHP: My new favorite framework</title>
		<link>http://blog.utahcon.com/computers/code/frameworks/fuelphp/fuelphp-my-new-favorite-framework?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fuelphp-my-new-favorite-framework</link>
		<comments>http://blog.utahcon.com/computers/code/frameworks/fuelphp/fuelphp-my-new-favorite-framework#comments</comments>
		<pubDate>Wed, 06 Jul 2011 16:23:32 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[FuelPHP]]></category>
		<category><![CDATA[1 Tech Post Challenge]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[planet]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=693</guid>
		<description><![CDATA[I have posted on FuelPHP once before, and I think it is time I share more about it and why I have chosen it as my PHP Framework of choice. From FuelPHP.com: Fuel is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start. [...]]]></description>
			<content:encoded><![CDATA[<p>I have posted on FuelPHP once before, and I think it is time I share more about it and why I have chosen it as my PHP Framework of choice.</p>
<p>From FuelPHP.com:</p>
<blockquote><p>Fuel is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start.</p></blockquote>
<p>How much clearer can they get?</p>
<h2>The Geeks Behind FuelPHP</h2>
<p>Dan Horrigan, Phil Sturgeon, Jelmer Schreuder and Harro Verton. If those names mean nothing to you, let me shed some light.</p>
<p><strong>Dan Horrigan</strong></p>
<p>Coding in PHP for 10+ years Dan has contributed to projects like CodeIgniter and PyroCMS, as well as PancakeApp.</p>
<p><strong>Phil Sturgeon</strong></p>
<p>Another great mind behind CodeIgniter. Just look at <a href="http://philsturgeon.co.uk/blog">Phil&#8217;s blog</a>, he has done it all!</p>
<p><strong>Jelmer Schreuder</strong></p>
<p><strong></strong>Look through <a href="https://github.com/jschreuder">Jelmer&#8217;s Github</a> and you can see he is quite experienced as well. He is also super friend in the #fuelphp channel on Freenode.</p>
<p><strong>Harro Verton aka WanWizard</strong></p>
<p><strong></strong>After a long and sordid past as a mainframer he has found roots in programming and contributes a lot of support in #fuelphp as well. He has personally helped me through some of the beginning steps of using FuelPHP.</p>
<p>To all the geeks involved in FuelPHP, a huge thanks!</p>
<h2>What Make Fuel Different?</h2>
<p>Fuel is young, under a year as of this writing, but already it has seen support and contributions from 30+ developers. The maintainers are really open to anyone committing code cause they believe that since we all use it, we all deserve to support it. Or something like that. Basically if you use it and identify a bug, and you can fix it, then they will let you.</p>
<p>That is probably the best thing about this young framework is the amount of involvement everyone has. Being open source and hosted on GitHub anyone can get the source, and anyone can submit a pull request for changes to the code. I have personally been watching the commits in the IRC channel and I can attest that they are sincere in saying that things are getting done. And fast!</p>
<h2>What Make Fuel Awesome?</h2>
<p>Gleaming from other great frameworks (and languages) Fuel has been given some great tools. Like Oil.</p>
<p><strong>Oil</strong></p>
<p><strong></strong>Oil is a utility for the CLI that allows you to Generate code, Refine (run tasks, more on this later),  Package (install, update and remove packages) and Console (test code).</p>
<p><strong>Tasks</strong></p>
<p>Tasks are classes that can be run through the command line or set up as a cron job. They are generally used for background processes, timed tasks and maintenance tasks. Tasks can calls models and other classes just like controllers.</p>
<p>Because Tasks actually use the whole framework you can write scripts using the native language of FuelPHP and all things work. All the controllers, all the helpers etc are available to the user.</p>
<p><strong>Lightweight</strong></p>
<p>Autoloading is fun, and useful, but you don&#8217;t want to load everything everywhere. Fuel has an extensive (and configurable) configuration to allow you to only load what you want when you want.</p>
<p><strong>Docs</strong></p>
<p>The <a href="http://fuelphp.com/docs/">documentation</a> is a ongoing project, and no where near perfect right now, but it certainly is coming along. Don&#8217;t take that to mean it isn&#8217;t helpful, cause it absolutely is! Also you can update the docs and commit the changes to the project <img src='http://blog.utahcon.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><strong>ORM and Active Record or just DB</strong></p>
<p>ORM has been done, and done again. FuelPHP has an ORM, or you can opt for ActiveRecord, or if you don&#8217;t like either of those you can just use good old SQL. Fuel is flexible and this is a great example of how flexible they really are.</p>
<h2>Why Not?!</h2>
<p>If you haven&#8217;t been sold by my simple blog post on Fuel, then perhaps you need to play with the framework yourself. You can get it from http://fuelphp.com or  from GitHub.</p>
<p><strong>What&#8217;s Next?</strong></p>
<p>I am working on a series of blog posts showing how to do things with FuelPHP, so keep tuned for those.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/frameworks/fuelphp/fuelphp-my-new-favorite-framework/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Timezones in FuelPHP</title>
		<link>http://blog.utahcon.com/computers/code/php/timezones-in-fuelphp?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=timezones-in-fuelphp</link>
		<comments>http://blog.utahcon.com/computers/code/php/timezones-in-fuelphp#comments</comments>
		<pubDate>Thu, 16 Jun 2011 14:46:31 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[FuelPHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=671</guid>
		<description><![CDATA[Just thought I would make a note that if you are seeing weird timezones in your FuelPHP programs that you should checkout fuel/app/config/config.php around line 72 I have already set these to my local timezone of  &#8216;America/Denver&#8217; but you can simply comment them out and the default from your php.ini will take effect.]]></description>
			<content:encoded><![CDATA[<p>Just thought I would make a note that if you are seeing weird timezones in your FuelPHP programs that you should checkout fuel/app/config/config.php around line 72</p>
<pre class="brush: php; title: ; notranslate">

/**
 * DateTime settings
 *
 * server_gmt_offset    in seconds the server offset from gmt timestamp when time() is used
 * default_timezone        optional, if you want to change the server's default timezone
 */
'server_gmt_offset'    =&gt; 0,
 'default_timezone'    =&gt; 'America/Denver'
</pre>
<p>I have already set these to my local timezone of  &#8216;America/Denver&#8217; but you can simply comment them out and the default from your php.ini will take effect.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/php/timezones-in-fuelphp/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Code Igniter: Hooks</title>
		<link>http://blog.utahcon.com/computers/code/frameworks/code-igniter-hooks?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=code-igniter-hooks</link>
		<comments>http://blog.utahcon.com/computers/code/frameworks/code-igniter-hooks#comments</comments>
		<pubDate>Wed, 11 May 2011 21:01:29 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[Frameworks]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=659</guid>
		<description><![CDATA[Code Igniter is a great framework, and has some awesome documentation for a lot of what it does, but one place it lacks is in Hooks. What are hooks, how are they used etc, it is explained but not really. So I thought since I just accomplished an awesome example of when to use Hooks [...]]]></description>
			<content:encoded><![CDATA[<p>Code Igniter is a great framework, and has some awesome documentation for a lot of what it does, but one place it lacks is in Hooks. What are hooks, how are they used etc, it is explained but not really. So I thought since I just accomplished an awesome example of when to use Hooks in a CI project, I would share it with the world.</p>
<h2>What are Hooks?</h2>
<p>I&#8217;m going to let the folks at Code Igniter field this one:</p>
<blockquote><p>CodeIgniter&#8217;s Hooks feature provides a means to tap into and modify  the inner workings of the framework without hacking the core files. When CodeIgniter runs it follows a specific execution process, diagramed  in the <a href="http://codeigniter.com/user_guide/overview/appflow.html">Application Flow</a> page. There may be instances, however, where you&#8217;d like to cause some action  to take place at a particular stage in the execution process. For example, you might want to run a script right before your  controllers get loaded, or right after, or you might want to trigger one  of your own scripts in some other location.</p></blockquote>
<p>So to clear that up, Hooks let you change the way Code Igniter works, without changing Code Igniter.</p>
<h2>10K ft view:</h2>
<p>So the problem I had recently was a page that loads a CSS class only when the user selects to change the theme. However it had to be done through a link and had to set the preference in the session to be stored throughout the users session.</p>
<p>To accomplish that I had planned to create a simple controller action called setCssTheme and pass the theme the user had selected. The only problem was I needed to send the user back to the page they had come from, and in some cases the referrer was not being set (different browsers handle things differently).</p>
<p>In order to solve this last problem I had decided to set in the session the last page visited on each page load. This works great in a constructor of a particular class but what if you want to do that site wide, on every single page load like I do?</p>
<p>Force all your site through a single controller? I think not.</p>
<p>Force all your controllers to have this same piece of code? I think not.</p>
<p>Let&#8217;s get DRY (Don&#8217;t Repeat Yourself).</p>
<p>The solution I decided on was using Hooks in Code Igniter to Hook the system process and set in the session the current page I am on. In order to be able to do this I have to be able to write to the session before the headers are sent to the browser, and so I had to choose the appropriate hook point. CI gives you the follow points to hook in:</p>
<ul>
<li><strong>pre_system</strong><br />
Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.</li>
<li><strong>pre_controller</strong><br />
Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.</li>
<li><strong>post_controller_constructor</strong><br />
Called immediately after your controller is instantiated, but prior to any method calls happening.</li>
<li><strong>post_controller</strong><br />
Called immediately after your controller is fully executed.</li>
<li><strong>display_override</strong><br />
Overrides the <dfn>_display()</dfn> function, used to send the finalized page to the web browser at the end of system execution. This permits you to use your own display methodology. Note that you will need to reference the CI superobject with <dfn>$this-&gt;CI =&amp; get_instance()</dfn> and then the finalized data will be available by calling <dfn>$this-&gt;CI-&gt;output-&gt;get_output()</dfn></li>
<li><strong>cache_override</strong><br />
Enables you to call your own function instead of the <dfn>_display_cache()</dfn> function in the output class. This permits you to use your own cache display mechanism.</li>
<li><strong>post_system</strong><br />
Called after the final rendered page is sent to the browser, at the end of system execution after the finalized data is sent to the browser</li>
</ul>
<p>From those you can see the logic answer is to hook the post_controller so that our controller has a chance to do it&#8217;s work, and then to hack in out changes for the session, in this case add data to it.</p>
<h2>How To:</h2>
<p>Time to put rubber to the road, here is what I had to do to accomplish this task:</p>
<ol>
<li>Enable Hooks</li>
<li>Configure Hook</li>
<li>Write Hook</li>
</ol>
<h3>Enable Hooks:</h3>
<p>To enable the hooks you simply edit</p>
<pre>application/config/config.php</pre>
<p>and find the line:</p>
<pre class="brush: php; title: ; notranslate">$config['enable_hooks'] = false;</pre>
<p>and change it to:</p>
<pre class="brush: php; title: ; notranslate">$config['enable_hooks'] = TRUE;</pre>
<h3>Configure Hook:</h3>
<p>Now in application/config/hooks.php you need to tell the system what file path, file, controller, method, and parameters you want to run on the hook.</p>
<pre class="brush: php; title: ; notranslate">
$hook['post_controller'] = array(
  'filepath' =&gt; 'hooks',
  'filename' =&gt; 'SessionHelper.php',
  'class' =&gt; 'SessionHelper',
  'function' =&gt; 'setCurrentPage',
  'params' =&gt; array(),
);</pre>
<p>Here I tell CI that when the controller is done, load hooks/SessionHelper.php and fire off SessionHelper-&gt;setCurrentPage() (more or less).</p>
<p>Then I created the file mentioned above as follows:</p>
<pre class="brush: php; title: ; notranslate">
class SessionHelper extends CI_Hooks {
  public $CI;

  function __construct() {
    parent::__construct();
    $this-&gt;CI = get_instance();
  }

  function setCurrentPage(){
    $this-&gt;CI-&gt;session-&gt;set_userdata('current_page', current_url());
  }
</pre>
<p>This simply loads the current_url() into the session userdata.</p>
<p>Now on every final page load (redirects won&#8217;t be caught if they are in the controller) the current_url is stored in the session. So I can check values and redirect back to the current page if needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/frameworks/code-igniter-hooks/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery: Novice to Ninja</title>
		<link>http://blog.utahcon.com/books/jquery-novice-to-ninja?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-novice-to-ninja</link>
		<comments>http://blog.utahcon.com/books/jquery-novice-to-ninja#comments</comments>
		<pubDate>Thu, 22 Jul 2010 23:55:25 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=537</guid>
		<description><![CDATA[I was recently given the opportunity to fly to Florida and hire people to clean up oil from the BP spill. Given that I had some long flights (I live in Salt Lake City, UT) I picked up a Nook from Barnes and Noble and had on my computer a copy of jQuery: Novice to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://oreilly.com/catalog/9780980576856"><img class="alignleft" title="jQuery: Novice to Ninja" src="http://covers.oreilly.com/images/9780980576856/cat.gif" alt="" width="180" height="232" /></a> I was recently given the opportunity to fly to Florida and hire people to clean up oil from the BP spill. Given that I had some long flights (I live in Salt Lake City, UT) I picked up a Nook from Barnes and Noble and had on my computer a copy of jQuery: Novice to Ninja. What better way to spend my flight time than reading a jQuery book! So I dug in.</p>
<p>I have been using jQuery both professionally and personally for about a year now but this book still brought a lot to the table.</p>
<p>Earle Castedine and Craig Sharkie have a great sense of humor, and obviously know their way around jQuery, CSS, HTML and the likes. The book uses some real world examples of creating image galleries and user interfaces. They break down the jQuery code to it&#8217;s basic forms, and then explain why things work the way they do. They don&#8217;t get too deep into Javascript except to note that jQuery is nothing more than a fancy framework on top of Javascript and uses Javascript for everything! I thought it particularly neat when they would show the &#8220;hard&#8221; way to do things, then the better way to do them, and then finally a plugin that made all the work you had just done seem useless, but it isn&#8217;t useless because you now understand how the plugin works better than if you had just slapped it in place in the beginning.</p>
<p>The book is quite deep about animations, AJAX actions, DOM manipulation and the sort. Even if you know Javascript and you have been using jQuery there is something in here that will make you go &#8220;ah ha!&#8221;.</p>
<p>To the folks over at SitePoint (an O&#8217;reilly company) good work!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/books/jquery-novice-to-ninja/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>State of Zend Framework 2.0</title>
		<link>http://blog.utahcon.com/uncategorized/state-of-zend-framework-2-0?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=state-of-zend-framework-2-0</link>
		<comments>http://blog.utahcon.com/uncategorized/state-of-zend-framework-2-0#comments</comments>
		<pubDate>Fri, 04 Jun 2010 21:03:20 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[planet]]></category>
		<category><![CDATA[ZF2.0]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=497</guid>
		<description><![CDATA[Matthew Weier O&#8217;Phinney has posted about the State of Zend Framework 2.0: The past few months have kept myself and my team quite busy, as we&#8217;ve turned our attentions from maintenance of the Zend Framework 1.X series to Zend Framework 2.0. I&#8217;ve been fielding questions regularly about ZF2 lately, and felt it was time to [...]]]></description>
			<content:encoded><![CDATA[<p>Matthew Weier O&#8217;Phinney has posted about the State of Zend Framework 2.0:</p>
<blockquote><p>The past few months have kept myself and my team quite busy, as we&#8217;ve turned our attentions from maintenance of the Zend Framework 1.X series to Zend Framework 2.0. I&#8217;ve been fielding questions regularly about ZF2 lately, and felt it was time to talk about the roadmap for ZF2, what we&#8217;ve done so far, and how the community can help.</p></blockquote>
<p>He goes on to talk about the processes being taken to get Zf2.0 the exemplar of PHP 5.3 and to add namespaces to the project. He talks about his team, the road map and the struggles they have already expereienced:</p>
<blockquote><p>After completing this process, my entire team &#8212; all three of us &#8212; started the work of migrating the code to namespaces. <a href="http://ralphschindler.com">Ralph</a> wrote a tool that scanned the library and created a map file of existing classes and suggested namespace/classname combinations. We then used this tool as a launching point for the migration, each of us working on a component at a time. This work was by no means automated &#8212; we discovered very quickly that such a tool only took care of the most cursory work. <a href="http://weierophinney.net/matthew/archives/237-A-Primer-for-PHP-5.3s-New-Language-Features.html">I detailed some of our findings a couple months back</a>; we ran into a number of issues we never anticipated, and the progress has been far from speedy. At this point, however, we have migrated everything but the<code>Zend_Service</code> classes, the MVC, and those components that build on top of the MVC (Application, Navigation, Form, etc.).</p></blockquote>
<p>Finally he shares details about getting ZF2.0 available through Git and Github, and what the community can do to help:</p>
<blockquote><p>A number of contributors are also starting to discuss rewrites and refactoring of components. Much of this is being done on the zf-contributors mailing list, and some on the #zftalk.dev channel on Freenode. If you are interested in contributing, I highly recommend subscribing to the list and dropping into the channel when you can.</p></blockquote>
<p>You can read the post in it&#8217;s entirety at  <a href="http://weierophinney.net/matthew/index.php?url=archives/241-State-of-Zend-Framework-2.0.html&amp;serendipity[cview]=linear#comments" target="_blank">http://weierophinney.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/uncategorized/state-of-zend-framework-2-0/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>#hackUTOS June 2010</title>
		<link>http://blog.utahcon.com/computers/code/hackutos-june-2010?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hackutos-june-2010</link>
		<comments>http://blog.utahcon.com/computers/code/hackutos-june-2010#comments</comments>
		<pubDate>Thu, 03 Jun 2010 21:48:36 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[#hackUTOS]]></category>
		<category><![CDATA[caffeine]]></category>
		<category><![CDATA[coffee]]></category>
		<category><![CDATA[gathering]]></category>
		<category><![CDATA[Geeks]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[planet]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[utos]]></category>
		<category><![CDATA[UTOSC]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=487</guid>
		<description><![CDATA[Ceiling Cat announces: #hackUTOS is is happening tomorrow, Friday June 4th, at CoffeeConnection! Here&#8217;s how it works. #hackUTOS is a gathering of the hacking inclined. There is a main project (ConMan) that is being hacked on for the purpose of volunteering for Utah Open Source Conference 2010. More details on ConMan in a minute. If [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_488" class="wp-caption alignleft" style="width: 330px"><a href="http://blog.utahcon.com/wp-content/uploads/2010/06/ceiling_cat.png" rel="lightbox[487]"><img class="size-full wp-image-488" title="ceiling_cat" src="http://blog.utahcon.com/wp-content/uploads/2010/06/ceiling_cat.png" alt="Ceiling Cat" width="320" height="211" /></a><p class="wp-caption-text">Ceiling Cat</p></div>
<p>Ceiling Cat announces:</p>
<blockquote><p>#hackUTOS is is happening tomorrow, Friday June 4th, at CoffeeConnection!</p></blockquote>
<p>Here&#8217;s how it works. #hackUTOS is a gathering of the hacking inclined. There is a main project (<a href="http://github.com/herlo/ConMan" target="_blank">ConMan</a>) that is being hacked on for the purpose of volunteering for <a href="http://2010.utosc.com" target="_blank">Utah Open Source Conference 2010</a>. More details on ConMan in a minute.</p>
<p>If you are looking to generally gather with geeks then this is the premier event in June for your geekiness! We will be gathering at <a href="http://saltlakecoffeeconnection.com/" target="_blank">CoffeeConnection</a> who has great caffeinated beverages for sale (as well as food) and we will be getting our Geek on.</p>
<p>Want to get your geek on, but can&#8217;t make it in person&#8230; we are going to be on IRC too! Find us on <a href="http://freenode.net/" target="_blank">Freenode</a> at <a href="irc://irc.freenode.org:6667/#hackUTOS" target="_blank">#hackUTOS</a></p>
<p>If you are not interested in hacking on ConMan, we still encourage you to come on down! We want all geeks to come by and share in the glory of #hackUTOS. That means you can even bring your own project. Think of #hackUTOS as a <a href="http://workatjelly.com/" target="_blank">Jelly</a> or CoWork (for 1 night). Come share your project and your ideas, find people, network, and generally have a good time.</p>
<p>Now some details on ConMan!</p>
<p>ConMan is the Conference Management software used by UTOS for the UTOS Conference. It is written in <a href="http://python.org" target="_blank">Python</a>, using the <a href="http://www.djangoproject.com" target="_blank">Django</a> framework. It is hosted at <a href="http://github.com" target="_blank">GitHub</a> and it is open to the public. If you don&#8217;t hack python do not turn and run just yet. We are in need of things besides python coding. We need folks who are willing to conceptualize, we need graphic designers to help make the app look pretty, we need people to help with bug reporting, and more. If you are reading this blog post you are more than qualified to come help us tomorrow (and at any other #hackUTOS event).</p>
<p>Alright&#8230; I am tired of typing, and Ceiling cat is starting to freak me out&#8230; see you at #hackUTOS</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/hackutos-june-2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Come Support Open Source!!!</title>
		<link>http://blog.utahcon.com/computers/code/come-support-open-source?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=come-support-open-source</link>
		<comments>http://blog.utahcon.com/computers/code/come-support-open-source#comments</comments>
		<pubDate>Fri, 26 Feb 2010 17:21:30 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[conman]]></category>
		<category><![CDATA[event revolution]]></category>
		<category><![CDATA[geek lunch]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[planet]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=382</guid>
		<description><![CDATA[Geek Lunch Meet at the nearest location to you at 12:30pm this Friday, February 26, 2010.  If you have never been, look for the group with this logo at their table.  Geek Lunch is organized by the Utah Open Source Foundation, but you must pay for your meal.  We look forward to seeing all of [...]]]></description>
			<content:encoded><![CDATA[<h2>Geek Lunch</h2>
<p>Meet at the nearest location to you at 12:30pm this Friday, February 26, 2010.  If you have never been, look for the group with <a href="http://dl.dropbox.com/u/149379/img/geek_lunch.pdf" target="_blank">this logo</a> at their table.  Geek Lunch is organized by the Utah Open Source Foundation, but you must pay for your meal.  We look forward to seeing all of you there.</p>
<h3>When:</h3>
<p>Date: Friday,February 26, 2010<br />
Time: 12:30pm – 2:00pm</p>
<h3>Where:</h3>
<p>We have geeks all over Utah, and as such we like to spread the love to more than just 1 pub, so we have two (because Utah county is slacking) locations to choose from.</p>
<p><strong> Salt Lake County</strong><br />
The Green Pig<br />
31 East 400 South<br />
Salt Lake City, Utah 84111<br />
Website: <a href="http://www.thegreenpigpub.com/" target="_blank">http://www.thegreenpigpub.com/</a><br />
Map: <a href="http://snipr.com/uhhox" target="_blank">http://snipr.com/uhhox</a><br />
Phone: (801) 532-7441</p>
<p><strong>Weber / Davis Counties</strong><br />
Roosters<br />
748 Heritage Park Boulevard<br />
Layton, Utah 84041<br />
Website: <a href="http://roostersbrewingco.com/" target="_blank">http://roostersbrewingco.com/</a><br />
Map: <a href="http://snipr.com/uhizp" target="_blank">http://snipr.com/uhizp</a><br />
Phone: (801) 774-9330</p>
<p><strong>Utah County</strong><br />
There is currently no place planned for in Utah county due to low turnout.  If you would like to help organize a Geek Lunch in Utah county, please email <a href="mailto:clint@utos.org?subject=Geek Lunch">clint@utos.org</a>.</p>
<h2>ConMan Hack Night</h2>
<p>Did you attend UTOSC last year? Are you going to attend this year? Did you like how the process to register and attend was super easy? That is all thanks to ConMan, the Conference Management software that the Utah Open Source Foundation created, and maintains.</p>
<p>If you want to make sure things stay smooth at the conference, and participate in an open source project then you are invited to come down and help us code the project to the next milestone!</p>
<p><strong>Where:</strong></p>
<p>Salt Lake Coffee Connection</p>
<p>1588 South State Street, Salt Lake City UT</p>
<p><a href="http://saltlakecoffeeconnection.com/map-directions/">Directions</a></p>
<p><strong>When:</strong> 7pm &#8211; ??</p>
<p>You see the ?? means you can come and code as late as you want! The coffee house is open really late, and you are welcome to stay and code till they kick you out!</p>
<p><strong>What:</strong></p>
<p>So we get together each week to work on the project, cause we think ConMan can be the best conference management software ever! We simply would love to have some more people who love open source, and know python and django come down and contribute to the code base!</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 890px; width: 1px; height: 1px;">http://saltlakecoffeeconnection.com/map-directions/</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/come-support-open-source/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP, Soap and WSDL Caching</title>
		<link>http://blog.utahcon.com/computers/code/php-soap-and-wsdl-caching?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-soap-and-wsdl-caching</link>
		<comments>http://blog.utahcon.com/computers/code/php-soap-and-wsdl-caching#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:27:10 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[planet]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=367</guid>
		<description><![CDATA[Today I was offered a free lesson in how PHP handles Soap, and more specifically WSDL caching. When you instantiate a PHP Soap Class you pass it a WSDL (Web Services Description Language) and it looks like this: Depending on how your caching is setup, this will go out to the WSDL provided, pull in [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was offered a free lesson in how PHP handles Soap, and more specifically WSDL caching.</p>
<p>When you instantiate a PHP Soap Class you pass it a WSDL (Web Services Description Language) and it looks like this:</p>
<pre class="brush: php; title: ; notranslate">

$client = new SoapClient('http://example.com/services/thescript.php?wsdl');
</pre>
<p>Depending on how your caching is setup, this will go out to the WSDL provided, pull in the document and store it in a cache. The default cache for PHP is 86400 seconds. If you are familiar with time in seconds you know that that is 24 hours. So by default you only actually read the WSDL once in a 24 hour period. Normally this is not a problem.</p>
<h2>What is a WSDL?<strong><br />
</strong></h2>
<p>For that answer let&#8217;s turn to the W3 site:</p>
<blockquote><p>WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.</p></blockquote>
<p>So in English that means it is a map to the services provided by the provider. Basically you get a copy of the map, and follow the endpoints to the answers you need.</p>
<p>One basic function of this is that it tells you want methods (services) are available on your fresh client.</p>
<h2>When WSDLs go bad</h2>
<p>So today one of my providers, without warning, updated their WSDL. This wreaked havoc on my system because I had cached the WSDL on my side for 24 hours (remember, the PHP default). The change was a super simple change, a change in URL for a service, that&#8217;s it!</p>
<p>The problem was that since PHP had already read the file within 24 hours it didn&#8217;t care that there was a new file, that the URLs had changed, and so it continued to work as it had before.</p>
<p>The real problem wasn&#8217;t that the URLs changed, that would have been fine if the provider hadn&#8217;t shut off the previously reported URLs.</p>
<h2>Turn off the cache</h2>
<p>So you are left with two options when something like this happens. First, you can sit and wait up to 24 hours for the problem to fix itself. This was not an option for us. The second is to clear your cache and try again.</p>
<p>Now PHP (on Linux) stores the cache for the Soap WSDL in /tmp and I wasn&#8217;t sure which one of the many files was the actual cache for this particular provider so I decided I would have to tell PHP to not cache the WSDL and try again.</p>
<p>Into php.ini I went, located the <em>soap.wsdl_cache_enabled</em> flag. I changed it from 0 to 1</p>
<pre class="brush: plain; title: ; notranslate">

soap.wsdl_cache_enabled=0
</pre>
<p>I saved the file and restarted Apache.</p>
<p>The service continued to fail. I was perplexed. I thought maybe I flubbed the save so I opened the php.ini again located my line and it was fine. So I looked around there to see if maybe I missed another important flag. The only thing I could find was <em>soap.wsdl_cache_ttl</em> listed as the &#8220;(time to live) Sets the number of second while cached file will be used instead of original one&#8221; I promptly changed this to 0 as well</p>
<pre class="brush: plain; title: ; notranslate">

soap.wsdl_cache_ttl=0
</pre>
<p>Restarted Apache, and finally my script stopped failing.</p>
<p>I have since re-enabled my cache ttl and enabled flags, as reading the WSDL every time is a resource hog that doesn&#8217;t need to be in place.</p>
<h2>The Lesson Learned</h2>
<p>The lesson learned by all today is be aware of your caching, and be aware of the changes you make to your live/production systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/php-soap-and-wsdl-caching/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP and Josso &#8211; Transparency Rocks!</title>
		<link>http://blog.utahcon.com/computers/code/php-and-josso-transparency-rocks?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-and-josso-transparency-rocks</link>
		<comments>http://blog.utahcon.com/computers/code/php-and-josso-transparency-rocks#comments</comments>
		<pubDate>Wed, 20 Jan 2010 22:15:38 +0000</pubDate>
		<dc:creator>utahcon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Josso]]></category>
		<category><![CDATA[planet]]></category>
		<category><![CDATA[Single Signon]]></category>

		<guid isPermaLink="false">http://blog.utahcon.com/?p=315</guid>
		<description><![CDATA[Bogdan recently asked in my comments: I can&#8217;t seem to find a call like josso_authenticate($name, $pass), returning an array to be appended to user&#8217;s SESSION. I was expecting such a method, because SOAP is already used everywhere, so it shouldn&#8217;t be too hard implementing this. Has anyone had success implementing this kind of &#8220;transparent&#8221; login? [...]]]></description>
			<content:encoded><![CDATA[<p>Bogdan recently asked in my comments:</p>
<blockquote><p>I can&#8217;t seem to find a call like josso_authenticate($name, $pass), returning an array to be appended to user&#8217;s SESSION. I was expecting such a method, because SOAP is already used everywhere, so it shouldn&#8217;t be too hard implementing this.</p>
<p>Has anyone had success implementing this kind of &#8220;transparent&#8221; login?</p></blockquote>
<p>JOSSO simply doesn&#8217;t make it easy to log people in with a single call. Instead you need to make an interface to the API to do so. I just so happen to have an example of such a wrapper function.</p>
<p><span id="more-315"></span></p>
<h2>Logging In A User</h2>
<p>To do everything and make it easy for future reuse I built two classes. The first is a Login Class and the second a Josso Class (below). My Login Class is pretty sparse, but it includes a wrapper to handle all the tasks required to login a user through Josso and get back the Josso details for that user.</p>
<p>The full code of each class is down at the bottom of the post, just expand the code block, but here is the function that is really what you are looking for Login-&gt;authorize()</p>
<h2>Login-&gt;authorize()</h2>
<pre class="brush: php; title: ; notranslate">public function authorize($username, $password){

 # make sure we have a valid username
 if(empty($username)){
 # return invalid username
 throw new LoginException('Invalid username');
 } else {
 $this-&gt;username = $username;
 }

 # make sure we have a valid password
 if(empty($password)){
 # return invalid username
 throw new LoginException('Invalid password');
 }

 # check that user exists
 if( ! $this-&gt;josso-&gt;userExists($this-&gt;username)){
 throw new LoginException('Invalid username');
 }

 # check Josso with username and password
 $this-&gt;assertion = $this-&gt;josso-&gt;assertIdentityWithSimpleAuthentication($username, $password);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Invalid username/password combination');
 }

 # resolve Authentication Assertion
 $this-&gt;token = $this-&gt;josso-&gt;resolveAuthenticationAssertion($this-&gt;assertion);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;session = $this-&gt;josso-&gt;getSession($this-&gt;token);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;user = $this-&gt;josso-&gt;findUserInSession($this-&gt;token);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;cleanUpUser();

 $this-&gt;roles = $this-&gt;josso-&gt;findRolesByUsername($this-&gt;username);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;cleanUpRoles();

 $this-&gt;user-&gt;sosPermissions =&amp; $this-&gt;roles;
 }</pre>
<h2>What That Actually Did</h2>
<p>As you can see you simply pass the $username and $password to the function and it runs through a ton of work for you.</p>
<p>First it validates the input, make sure you aren&#8217;t working for no reason.</p>
<p>Next it makes sure the <strong><em>userExists()</em></strong>, this will save you heartache later when JOSSO pretends a user exists, but really doesn&#8217;t.</p>
<p>Then I <strong><em>asserIdentityWithSimpleAuthentication()</em></strong> which literally means I pass those to JOSSO and wait for an answer. The answer returned is an <strong>assertion_id</strong>, which really doesn&#8217;t mean anything.</p>
<p>You then take the <strong>assertion_id</strong> returned and call <strong><em>resolveAuthenticationAssertion()</em></strong>, this will return your <strong>session_id</strong> if the login was valid.</p>
<p>With the <strong>session_id</strong> you call <em><strong>getSession()</strong></em>. This returns all the details of the session that JOSSO now has open. This varies depending on who setup your JOSSO implementation but you should have an identifying is (user_id) if nothing else.</p>
<p>I go on to make sure that JOSSO hasn&#8217;t forgotten anything by calling <em><strong>findUserInSession()</strong></em>, which literally just tells me who I am supposed to be working with.</p>
<p>The <em><strong>cleanUpUser()</strong></em> you could probably ignore, but our system returns an object with dots ( . ) in the name and I can&#8217;t stand that, so I change them to underscores ( _ ).</p>
<p>Finally I call back to my JOSSO install to get any roles the user has, again this will vary if your JOSSO doesn&#8217;t handle roles.</p>
<h2>Login Class</h2>
<pre class="brush: php; collapse: true; light: false; title: ; toolbar: true; notranslate">

class Login {

 public $token;
 public $username;
 public $session;
 public $roles;
 public $user;
 public $request;
 private $assertion;
 # this will hold the instance of Josso Controller we need
 private $josso;

 function Login($request = null){

 $this-&gt;josso = new Josso;
 if(!empty($request)){
 $this-&gt;request = $request;
 }
 }

 #validate an existing token
 public function validateToken($user_token){
 $session = $this-&gt;josso-&gt;accessSession($user_token);

 /*
 * For whatever reason Josso returns nothing if the session is valid
 * and the operation has been completed.
 */
 if( empty($session)){
 return true;
 }

 if($this-&gt;josso-&gt;error){
 throw new LoginException('Internal Error [Login]: '. __LINE__);
 }
 return false;
 }

 # authorize a user with password
 public function authorize($username, $password){

 # make sure we have a valid username
 if(empty($username)){
 # return invalid username
 throw new LoginException('Invalid username');
 } else {
 $this-&gt;username = $username;
 }

 # make sure we have a valid password
 if(empty($password)){
 # return invalid username
 throw new LoginException('Invalid password');
 }

 # check that user exists
 if( ! $this-&gt;josso-&gt;userExists($this-&gt;username)){
 throw new LoginException('Invalid username');
 }

 # check Josso with username and password
 $this-&gt;assertion = $this-&gt;josso-&gt;assertIdentityWithSimpleAuthentication($username, $password);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Invalid username/password combination');
 }

 # resolve Authentication Assertion
 $this-&gt;token = $this-&gt;josso-&gt;resolveAuthenticationAssertion($this-&gt;assertion);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;session = $this-&gt;josso-&gt;getSession($this-&gt;token);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;user = $this-&gt;josso-&gt;findUserInSession($this-&gt;token);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;cleanUpUser();

 $this-&gt;roles = $this-&gt;josso-&gt;findRolesByUsername($this-&gt;username);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;cleanUpRoles();

 $this-&gt;user-&gt;sosPermissions =&amp; $this-&gt;roles;
 }

 public function createLoginFromToken($token){

 $this-&gt;user = $this-&gt;josso-&gt;findUserInSession($token);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;cleanUpUser();

 $this-&gt;roles = $this-&gt;josso-&gt;findRolesByUsername($this-&gt;user-&gt;name);
 if($this-&gt;josso-&gt;error){
 throw new LoginException('Interal Error [Login]: '. __LINE__);
 }

 $this-&gt;cleanUpRoles();

 $this-&gt;user-&gt;sosPermissions =&amp; $this-&gt;roles;
 }

 # get a Josso hashed version of a password
 public function getPassHash($password){
 $passhash = $this-&gt;josso-&gt;getPassHash($password);
 return $passhash;
 }

 # acquire roles for the user from josso
 public function getUserRoles(){
 return $this-&gt;roles;
 }

 # send the signal to Josso to signoff (closes all sessions)
 public function signoff($session_id = null){
 if( ! $session_id &amp;&amp; ! $this-&gt;session-&gt;id){
 return false;
 }

 if(!$session_id){
 if(!empty($this-&gt;session)){
 if($this-&gt;josso-&gt;globalSignoff($this-&gt;session-&gt;id)){
 return true;
 }
 } else {
 return false;
 }
 } else {
 if($this-&gt;josso-&gt;globalSignoff($session_id)){
 return true;
 }
 }
 return false;
 }

 private function cleanUpUser(){
 if(!empty($this-&gt;user)){
 foreach($this-&gt;user-&gt;properties as $prop =&gt; $details){
 $name = $details-&gt;name;
 if($pos = strpos($name, '.')){
 $name = explode('.',$name);
 $name = $name[0] . ucwords($name[1]);
 }
 $this-&gt;user-&gt;$name = $details-&gt;value;
 }
 unset($this-&gt;user-&gt;properties);
 }
 }

 private function cleanUpRoles(){
 if(!empty($this-&gt;roles)){
 foreach($this-&gt;roles as $key =&gt; $details){
 $tmpRoles[$key] = $details-&gt;name;
 }
 $this-&gt;roles = $tmpRoles;
 }
 }
}
?&gt;</pre>
<h2>Josso Class</h2>
<pre class="brush: php; collapse: true; light: false; title: ; toolbar: true; notranslate">
&lt;pre&gt;class Josso {

 var $SSOIdentityManager;
 var $SSOSessionManager;
 var $SSOIdentityProvider;
 var $JossoPashHash;
 var $error;

 function Josso(){

 // create the soapclients
 $this-&gt;SSOIdentityManager = new Soapclient(JOSSO_SERVER .'/josso/services/SSOIdentityManager?wsdl', array('Trace' =&gt; 1));
 $this-&gt;SSOSessionManager = new Soapclient(JOSSO_SERVER .'/josso/services/SSOSessionManager?wsdl', array('trace' =&gt; 1));
 $this-&gt;SSOIdentityProvider = new Soapclient(JOSSO_SERVER .'/josso/services/SSOIdentityProvider?wsdl', array('trace' =&gt; 1));
 }

 function accessSession($session_id){
 try{
 $accessSession = $this-&gt;SSOSessionManager-&gt;accessSession($session_id);
 // we expect a null
 return $accessSession;
 } catch(Exception $e){
 $this-&gt;error = $e;
 return false;
 }
 }

 // check if a user exists
 function userExists($username){
 try {
 $userExists = $this-&gt;SSOIdentityManager-&gt;userExists($username);
 return true;
 } catch (Exception $e){
 $this-&gt;error = $e;
 return false;
 }
 }

 // assert a login
 function assertIdentityWithSimpleAuthentication($username, $password){
 try{
 $loginAssertion = $this-&gt;SSOIdentityProvider-&gt;assertIdentityWithSimpleAuthentication($username, $password);
 return $loginAssertion;
 } catch (Exception $e){
 $this-&gt;error = $e;
 return false;
 }
 }

 // check assertion and get session
 function resolveAuthenticationAssertion($loginAssertion){
 try{
 $session = $this-&gt;SSOIdentityProvider-&gt;resolveAuthenticationAssertion($loginAssertion);
 return $session;
 } catch (Exception $e){
 $this-&gt;error = $e;
 return false;
 }
 }

 // get session details
 function getSession($session){
 try {
 $sessionDetails = $this-&gt;SSOSessionManager-&gt;getSession($session);
 return $sessionDetails;
 } catch (Exception $e){
 $this-&gt;error = $e;
 return false;
 }
 }

 // make sure the session we found belongs to our user
 function findUserInSession($session){
 try {
 $userInSession = $this-&gt;SSOIdentityManager-&gt;findUserInSession($session);
 return $userInSession;
 } catch (Exception $e){
 return false;
 }
 }

 // not used
 function findUser($username){
 try{
 $userDetails = $this-&gt;SSOIdentityManager-&gt;findUser($username);
 return $userDetails;
 } catch (Exception $e){
 return $e;
 }
 }

 // get a users roles
 function findRolesByUsername($username){
 try {
 $userRoles = $this-&gt;SSOIdentityManager-&gt;findRolesByUsername($username);
 return $userRoles;
 } catch (Exception $e){
 $this-&gt;error = $e;
 return false;
 }
 }

 function globalSignoff($session){
 try {
 $signoff = $this-&gt;SSOIdentityProvider-&gt;globalSignoff($session);
 } catch (Exception $e){
 $signoff = $e;
 }
 unset($_SESSION['josso']);
 return $signoff;
 }

 function getPassHash($password){
 try{
 $result = $this-&gt;JossoPashHash-&gt;hash($password);
 return $result;
 } catch (Exception $e){
 return $e;
 }
 }

}</pre>
<h2>That&#8217;s It!</h2>
<pre>I hope I have at least in part helped with your quest to make logging people in through JOSSO more bearable.</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.utahcon.com/computers/code/php-and-josso-transparency-rocks/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

