Location: PHPKode > projects > Program E > docs/developer/__filesource/fsource_Interpreter__respond.php.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>File Source for respond.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
											</head>
		<body>
						
<h1>Source for file respond.php</h1>
<p>Documentation is available at <a href="../Interpreter/_respond_php.html">respond.php</a></p>
<div class="src-code">
<pre><ol><li><a name="a1"></a><span class="src-php">&lt;?php</span></li>
<li><a name="a2"></a>&nbsp;</li>
<li><a name="a3"></a><span class="src-comm">/*</span></li>
<li><a name="a4"></a><span class="src-comm">    Program E</span></li>
<li><a name="a5"></a><span class="src-comm">    Copyright 2002, Paul Rydell</span></li>
<li><a name="a6"></a>    </li>
<li><a name="a7"></a><span class="src-comm">    This file is part of Program E.</span></li>
<li><a name="a8"></a>    </li>
<li><a name="a9"></a><span class="src-comm">    Program E is free software; you can redistribute it and/or modify</span></li>
<li><a name="a10"></a><span class="src-comm">    it under the terms of the GNU General Public License as published by</span></li>
<li><a name="a11"></a><span class="src-comm">    the Free Software Foundation; either version 2 of the License, or</span></li>
<li><a name="a12"></a><span class="src-comm">    (at your option) any later version.</span></li>
<li><a name="a13"></a>&nbsp;</li>
<li><a name="a14"></a><span class="src-comm">    Program E is distributed in the hope that it will be useful,</span></li>
<li><a name="a15"></a><span class="src-comm">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span></li>
<li><a name="a16"></a><span class="src-comm">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></li>
<li><a name="a17"></a><span class="src-comm">    GNU General Public License for more details.</span></li>
<li><a name="a18"></a>&nbsp;</li>
<li><a name="a19"></a><span class="src-comm">    You should have received a copy of the GNU General Public License</span></li>
<li><a name="a20"></a><span class="src-comm">    along with Program E; if not, write to the Free Software</span></li>
<li><a name="a21"></a><span class="src-comm">    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span></li>
<li><a name="a22"></a><span class="src-comm">*/</span></li>
<li><a name="a23"></a>&nbsp;</li>
<li><a name="a24"></a><span class="src-doc">/**</span></li>
<li><a name="a25"></a><span class="src-doc"> * Respond functions</span></li>
<li><a name="a26"></a><span class="src-doc"> * </span></li>
<li><a name="a27"></a><span class="src-doc"> * Second layer functions that are prior to entering the AIML match routine.</span></li>
<li><a name="a28"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> Paul Rydell</span></li>
<li><a name="a29"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> 2002</span></li>
<li><a name="a30"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@version</span><span class="src-doc"> 0.0.8</span></li>
<li><a name="a31"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> Interpreter</span></li>
<li><a name="a32"></a><span class="src-doc"> */</span></li>
<li><a name="a33"></a>&nbsp;</li>
<li><a name="a34"></a><span class="src-doc">/**</span></li>
<li><a name="a35"></a><span class="src-doc">* The general preferences and database details.</span></li>
<li><a name="a36"></a><span class="src-doc">*/</span></li>
<li><a name="a37"></a><span class="src-inc">require_once </span><span class="src-str">&quot;admin/dbprefs.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a38"></a>&nbsp;</li>
<li><a name="a39"></a><span class="src-doc">/**</span></li>
<li><a name="a40"></a><span class="src-doc">* The matching engine functions of the AIML interpreter.</span></li>
<li><a name="a41"></a><span class="src-doc">*/</span></li>
<li><a name="a42"></a><span class="src-inc">require_once </span><span class="src-str">&quot;graphnew.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a43"></a>&nbsp;</li>
<li><a name="a44"></a><span class="src-doc">/**</span></li>
<li><a name="a45"></a><span class="src-doc">* A collection of generally useful utility functions</span></li>
<li><a name="a46"></a><span class="src-doc">*/</span></li>
<li><a name="a47"></a><span class="src-inc">require_once </span><span class="src-str">&quot;util.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a48"></a>&nbsp;</li>
<li><a name="a49"></a><span class="src-doc">/**</span></li>
<li><a name="a50"></a><span class="src-doc">* The file containing the function that process custom, non AIML 1.0.x specified, tags.</span></li>
<li><a name="a51"></a><span class="src-doc">*/</span></li>
<li><a name="a52"></a><span class="src-inc">require_once </span><span class="src-str">&quot;plugins/customtags.php&quot;</span><span class="src-sym">;</span></li>
<li><a name="a53"></a>&nbsp;</li>
<li><a name="a54"></a>&nbsp;</li>
<li><a name="a55"></a>&nbsp;</li>
<li><a name="a56"></a><span class="src-doc">/**</span></li>
<li><a name="a57"></a><span class="src-doc">* Start function for retrieving bot reply</span></li>
<li><a name="a58"></a><span class="src-doc">*</span></li>
<li><a name="a59"></a><span class="src-doc">* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.</span></li>
<li><a name="a60"></a><span class="src-doc">*</span></li>
<li><a name="a61"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> lookupbotid()</span></li>
<li><a name="a62"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> reply()</span></li>
<li><a name="a63"></a><span class="src-doc">*</span></li>
<li><a name="a64"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$userinput </span><span class="src-doc">         The user's input</span></li>
<li><a name="a65"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">integer </span><span class="src-doc-var">$uniqueid </span><span class="src-doc">         The user's session ID</span></li>
<li><a name="a66"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$botname </span><span class="src-doc">           The bot's name, if no name selected the default value is &quot;TestBot&quot;.</span></li>
<li><a name="a67"></a><span class="src-doc">*</span></li>
<li><a name="a68"></a><span class="src-doc">* </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc">                   The bot's reply.</span></li>
<li><a name="a69"></a><span class="src-doc">*/</span></li>
<li><a name="a70"></a><span class="src-key">function </span><a href="../Interpreter/_respond_php.html#functionreplybotname">replybotname</a><span class="src-sym">(</span><span class="src-var">$userinput</span><span class="src-sym">,</span><span class="src-var">$uniqueid</span><span class="src-sym">,</span><span class="src-var">$botname </span>= <span class="src-str">&quot;TestBot&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a71"></a>&nbsp;</li>
<li><a name="a72"></a>    <span class="src-var">$botid </span>= <a href="../Interpreter/_util_php.html#functionlookupbotid">lookupbotid</a><span class="src-sym">(</span><span class="src-var">$botname</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a73"></a>&nbsp;</li>
<li><a name="a74"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$botid</span>==-<span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a75"></a>        print <span class="src-str">&quot;</span><span class="src-str"><span class="src-id">I</span> <span class="src-id">don</span>'<span class="src-id">t</span> <span class="src-id">know</span> <span class="src-id">that</span> <span class="src-id">bot</span>: <span class="src-var">$botname</span>&lt;<span class="src-id">BR</span>&gt;\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a76"></a>    <span class="src-sym">}</span></li>
<li><a name="a77"></a>    <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a78"></a>        <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionreply">reply</a><span class="src-sym">(</span><span class="src-var">$userinput</span><span class="src-sym">,</span><span class="src-var">$uniqueid</span><span class="src-sym">,</span><span class="src-var">$botid</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a79"></a>    <span class="src-sym">}</span></li>
<li><a name="a80"></a>&nbsp;</li>
<li><a name="a81"></a><span class="src-sym">}</span></li>
<li><a name="a82"></a>&nbsp;</li>
<li><a name="a83"></a>&nbsp;</li>
<li><a name="a84"></a><span class="src-doc">/**</span></li>
<li><a name="a85"></a><span class="src-doc">* Main container function in creating the bot's reply.</span></li>
<li><a name="a86"></a><span class="src-doc">*</span></li>
<li><a name="a87"></a><span class="src-doc">* This function is the 'manager' of all the sub-funtions that do the real processing. It creates a class</span></li>
<li><a name="a88"></a><span class="src-doc">* called Response that is used throughout the application.</span></li>
<li><a name="a89"></a><span class="src-doc">* </span></li>
<li><a name="a90"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> addinputs()</span></li>
<li><a name="a91"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> addthats()</span></li>
<li><a name="a92"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> bget()</span></li>
<li><a name="a93"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> cleanup()</span></li>
<li><a name="a94"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> getthat()</span></li>
<li><a name="a95"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> loadcustomtags()</span></li>
<li><a name="a96"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> logconversation()</span></li>
<li><a name="a97"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> normalsentences()</span></li>
<li><a name="a98"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> respond()</span></li>
<li><a name="a99"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> ss_timing_current()</span></li>
<li><a name="a100"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> ss_timing_start()</span></li>
<li><a name="a101"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> ss_timing_stop()</span></li>
<li><a name="a102"></a><span class="src-doc">* </span></li>
<li><a name="a103"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">string </span><span class="src-doc">that                   The conversation's previous bot output</span></li>
<li><a name="a104"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">string </span><span class="src-doc">topic                  The contents of the AIML tag 'Topic'</span></li>
<li><a name="a105"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">integer </span><span class="src-doc">uid                   The session ID of the user (previously $uniqueid)</span></li>
<li><a name="a106"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">integer </span><span class="src-doc">loopcounter           Counts the number of time a particular category is used in the same match trace.</span></li>
<li><a name="a107"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">array </span><span class="src-doc">patternmatched          The pattern's that matched the</span></li>
<li><a name="a108"></a><span class="src-doc">*</span></li>
<li><a name="a109"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$userinput </span><span class="src-doc">             The user's input.</span></li>
<li><a name="a110"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">integer </span><span class="src-doc-var">$uniqueid </span><span class="src-doc">             The user's session ID.</span></li>
<li><a name="a111"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">integer </span><span class="src-doc-var">$bot </span><span class="src-doc">                  The bot's ID.</span></li>
<li><a name="a112"></a><span class="src-doc">*</span></li>
<li><a name="a113"></a><span class="src-doc">* </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">object </span><span class="src-doc">                       </span><span class="src-doc-type">A </span><span class="src-doc">class link to 'Response'.</span></li>
<li><a name="a114"></a><span class="src-doc">*/</span></li>
<li><a name="a115"></a><span class="src-key">function </span><a href="../Interpreter/_respond_php.html#functionreply">reply</a><span class="src-sym">(</span><span class="src-var">$userinput</span><span class="src-sym">,</span><span class="src-var">$uniqueid</span><span class="src-sym">, </span><span class="src-var">$bot </span>= <span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">{    </span></li>
<li><a name="a116"></a>&nbsp;</li>
<li><a name="a117"></a>    <span class="src-key">global </span><span class="src-var">$that</span><span class="src-sym">,</span><span class="src-var">$topic</span><span class="src-sym">,</span><span class="src-var">$uid</span><span class="src-sym">,</span><span class="src-var">$loopcounter</span><span class="src-sym">,</span><span class="src-var">$patternmatched</span><span class="src-sym">,</span><span class="src-var">$inputmatched</span><span class="src-sym">,</span><span class="src-var">$selectbot</span><span class="src-sym">;    </span></li>
<li><a name="a118"></a>&nbsp;</li>
<li><a name="a119"></a>    <a href="../Interpreter/_util_php.html#functioncleanup">cleanup</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a120"></a>&nbsp;</li>
<li><a name="a121"></a>    <a href="../Interpreter/_util_php.html#functionss_timing_start">ss_timing_start</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a122"></a>&nbsp;</li>
<li><a name="a123"></a>    <span class="src-var">$patternmatched</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a124"></a>    <span class="src-var">$inputmatched</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a125"></a>&nbsp;</li>
<li><a name="a126"></a>    <span class="src-var">$myresponse </span>= <span class="src-key">new </span><span class="src-id"><a href="../Interpreter/Response.html">Response</a></span><span class="src-sym">;</span></li>
<li><a name="a127"></a>&nbsp;</li>
<li><a name="a128"></a>    <span class="src-var">$myresponse</span><span class="src-sym">-&gt;</span><span class="src-id">errors</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a129"></a>    </li>
<li><a name="a130"></a>    <span class="src-var">$uid</span>=<span class="src-var">$uniqueid</span><span class="src-sym">;</span></li>
<li><a name="a131"></a>    <span class="src-var">$selectbot</span>=<span class="src-var">$bot</span><span class="src-sym">;    </span></li>
<li><a name="a132"></a>&nbsp;</li>
<li><a name="a133"></a>    <span class="src-comm">// Load the custom plugin tags</span></li>
<li><a name="a134"></a>    <a href="../Interpreter/_util_php.html#functionloadcustomtags">loadcustomtags</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a135"></a>&nbsp;</li>
<li><a name="a136"></a>    <span class="src-comm">// Get the &quot;that&quot; and the &quot;topic&quot;</span></li>
<li><a name="a137"></a>    <span class="src-var">$that</span>=<a href="../Interpreter/_util_php.html#functiongetthat">getthat</a><span class="src-sym">(</span><span class="src-num">1</span><span class="src-sym">,</span><span class="src-num">1</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a138"></a>    <span class="src-var">$topic</span>=<a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-str">&quot;TOPIC&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a139"></a>&nbsp;</li>
<li><a name="a140"></a>    <span class="src-comm">// Normalize the input</span></li>
<li><a name="a141"></a>    <span class="src-var">$allinputs</span>=<a href="../Interpreter/_util_php.html#functionnormalsentences">normalsentences</a><span class="src-sym">(</span><span class="src-var">$userinput</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a142"></a>&nbsp;</li>
<li><a name="a143"></a>    <span class="src-comm">// If nothing said then use INACTIVITY special input</span></li>
<li><a name="a144"></a>    <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$allinputs</span><span class="src-sym">)</span>==<span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a145"></a>        <span class="src-var">$allinputs</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-str">&quot;INACTIVITY&quot;</span><span class="src-sym">;</span></li>
<li><a name="a146"></a>    <span class="src-sym">}</span></li>
<li><a name="a147"></a>&nbsp;</li>
<li><a name="a148"></a>    <span class="src-comm">// Put all the inputs into the &lt;input&gt; stack.</span></li>
<li><a name="a149"></a>    <a href="../Interpreter/_util_php.html#functionaddinputs">addinputs</a><span class="src-sym">(</span><span class="src-var">$allinputs</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a150"></a>&nbsp;</li>
<li><a name="a151"></a>    <span class="src-var">$finalanswer</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a152"></a>    <span class="src-comm">// Build our response to all of the inputs.</span></li>
<li><a name="a153"></a>    <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$x</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$allinputs</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$x</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a154"></a>        <span class="src-var">$finalanswer</span>.=<a href="../Interpreter/_respond_php.html#functionrespond">respond</a><span class="src-sym">(</span><span class="src-var">$allinputs</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a155"></a>    <span class="src-sym">}</span></li>
<li><a name="a156"></a>&nbsp;</li>
<li><a name="a157"></a>    <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$loopcounter</span>&gt;<span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#defineLOOPINGLIMIT">LOOPINGLIMIT</a></span><span class="src-sym">)</span>&amp;&amp;<span class="src-sym">(</span><span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#defineLOOPINGLIMIT">LOOPINGLIMIT</a></span>!=-<span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a158"></a>        <span class="src-var">$finalanswer</span>=<span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#defineLOOPINGERRORMSG">LOOPINGERRORMSG</a></span><span class="src-sym">;</span></li>
<li><a name="a159"></a>        <span class="src-var">$myresponse</span><span class="src-sym">-&gt;</span><span class="src-id">errors</span>=<span class="src-str">&quot;LOOPINGLIMIT&quot;</span><span class="src-sym">;</span></li>
<li><a name="a160"></a>    <span class="src-sym">}</span></li>
<li><a name="a161"></a>&nbsp;</li>
<li><a name="a162"></a>    <span class="src-comm">// Put the final answers into the &lt;that&gt; stack.</span></li>
<li><a name="a163"></a>    <a href="../Interpreter/_util_php.html#functionaddthats">addthats</a><span class="src-sym">(</span><a href="../Interpreter/_util_php.html#functionnormalsentences">normalsentences</a><span class="src-sym">(</span><span class="src-var">$finalanswer</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a164"></a>&nbsp;</li>
<li><a name="a165"></a>    <span class="src-comm">// Log the conversation</span></li>
<li><a name="a166"></a>    <a href="../Interpreter/_util_php.html#functionlogconversation">logconversation</a><span class="src-sym">(</span><span class="src-var">$userinput</span><span class="src-sym">,</span><span class="src-var">$finalanswer</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a167"></a>&nbsp;</li>
<li><a name="a168"></a>&nbsp;</li>
<li><a name="a169"></a>    <span class="src-var">$myresponse</span><span class="src-sym">-&gt;</span><span class="src-id">response</span>=<span class="src-var">$finalanswer</span><span class="src-sym">;</span></li>
<li><a name="a170"></a>    <span class="src-var">$myresponse</span><span class="src-sym">-&gt;</span><span class="src-id">patternsmatched</span>=<span class="src-var">$patternmatched</span><span class="src-sym">;</span></li>
<li><a name="a171"></a>    <span class="src-var">$myresponse</span><span class="src-sym">-&gt;</span><span class="src-id">inputs</span>=<span class="src-var">$inputmatched</span><span class="src-sym">;</span></li>
<li><a name="a172"></a>&nbsp;</li>
<li><a name="a173"></a>    <a href="../Interpreter/_util_php.html#functionss_timing_stop">ss_timing_stop</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a174"></a>&nbsp;</li>
<li><a name="a175"></a>    <span class="src-var">$myresponse</span><span class="src-sym">-&gt;</span><span class="src-id">timer</span>=<a href="../Interpreter/_util_php.html#functionss_timing_current">ss_timing_current</a><span class="src-sym">(</span><span class="src-str">&quot;all&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a176"></a>&nbsp;</li>
<li><a name="a177"></a>    <span class="src-key">return </span><span class="src-var">$myresponse</span><span class="src-sym">;</span></li>
<li><a name="a178"></a>&nbsp;</li>
<li><a name="a179"></a><span class="src-sym">}</span></li>
<li><a name="a180"></a><span class="src-doc">/**</span></li>
<li><a name="a181"></a><span class="src-doc">* This is the second level response function.</span></li>
<li><a name="a182"></a><span class="src-doc">*</span></li>
<li><a name="a183"></a><span class="src-doc">* After reply() this function is the second level function to get the answer to the user's input.</span></li>
<li><a name="a184"></a><span class="src-doc">*</span></li>
<li><a name="a185"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> bget()</span></li>
<li><a name="a186"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> debugger()</span></li>
<li><a name="a187"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> gettemplate()</span></li>
<li><a name="a188"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> GetXMLTree()</span></li>
<li><a name="a189"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> recursechildren()</span></li>
<li><a name="a190"></a><span class="src-doc">*</span></li>
<li><a name="a191"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">string </span></li>
<li><a name="a192"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">integer </span></li>
<li><a name="a193"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">array </span></li>
<li><a name="a194"></a><span class="src-doc">* </span><span class="src-doc-coretag">@global </span><span class="src-doc-type">array </span></li>
<li><a name="a195"></a><span class="src-doc">* </span></li>
<li><a name="a196"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$sentence </span><span class="src-doc">       The sentence to be matched.</span></li>
<li><a name="a197"></a><span class="src-doc">*</span></li>
<li><a name="a198"></a><span class="src-doc">*  #return string                 The response to the user's input.</span></li>
<li><a name="a199"></a><span class="src-doc">*/</span></li>
<li><a name="a200"></a><span class="src-key">function </span><a href="../Interpreter/_respond_php.html#functionrespond">respond</a><span class="src-sym">(</span><span class="src-var">$sentence</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a201"></a>    </li>
<li><a name="a202"></a>    <span class="src-key">global </span><span class="src-var">$that</span><span class="src-sym">,</span><span class="src-var">$loopcounter</span><span class="src-sym">,</span><span class="src-var">$patternmatched</span><span class="src-sym">,</span><span class="src-var">$inputmatched</span><span class="src-sym">;</span></li>
<li><a name="a203"></a>&nbsp;</li>
<li><a name="a204"></a>    <span class="src-var">$topic </span>= <a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-str">&quot;topic&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a205"></a>&nbsp;</li>
<li><a name="a206"></a>    <span class="src-var">$loopcounter</span>++<span class="src-sym">;</span></li>
<li><a name="a207"></a>    <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$loopcounter</span>&gt;<span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#defineLOOPINGLIMIT">LOOPINGLIMIT</a></span><span class="src-sym">)</span>&amp;&amp;<span class="src-sym">(</span><span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#defineLOOPINGLIMIT">LOOPINGLIMIT</a> </span>!= -<span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a208"></a>        <span class="src-key">return </span><span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a209"></a>    <span class="src-sym">}</span></li>
<li><a name="a210"></a>&nbsp;</li>
<li><a name="a211"></a>    <span class="src-var">$inputstarvals</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a212"></a>    <span class="src-var">$thatstarvals</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a213"></a>    <span class="src-var">$topicstarvals</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a214"></a>    </li>
<li><a name="a215"></a>    <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">respond</span> <span class="src-id">called</span> <span class="src-id">with</span> <span class="src-id">sentence</span>: <span class="src-var">$sentence</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a216"></a>    <a href="http://www.php.net/flush">flush</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a217"></a>&nbsp;</li>
<li><a name="a218"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$that</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a219"></a>        <span class="src-var">$that</span>=<span class="src-str">&quot;&lt;nothing&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a220"></a>    <span class="src-sym">}</span></li>
<li><a name="a221"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$topic</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a222"></a>        <span class="src-var">$topic</span>=<span class="src-str">&quot;&lt;nothing&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a223"></a>    <span class="src-sym">}</span></li>
<li><a name="a224"></a>&nbsp;</li>
<li><a name="a225"></a>    </li>
<li><a name="a226"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$sentence</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a227"></a>        <span class="src-key">return </span><span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a228"></a>    <span class="src-sym">}</span></li>
<li><a name="a229"></a>    <span class="src-key">else</span><span class="src-sym">{</span></li>
<li><a name="a230"></a>&nbsp;</li>
<li><a name="a231"></a>        <span class="src-comm">//If we found a template</span></li>
<li><a name="a232"></a>        <span class="src-var">$template</span>=<a href="../Interpreter/Engine/_graphnew_php.html#functiongettemplate">gettemplate</a><span class="src-sym">(</span><span class="src-var">$sentence</span><span class="src-sym">,</span><span class="src-var">$that</span><span class="src-sym">,</span><span class="src-var">$topic</span><span class="src-sym">,</span><span class="src-var">$inputstarvals</span><span class="src-sym">,</span><span class="src-var">$thatstarvals</span><span class="src-sym">,</span><span class="src-var">$topicstarvals</span><span class="src-sym">,</span><span class="src-var">$s_patternmatched</span><span class="src-sym">,</span><span class="src-var">$s_inputmatched</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a233"></a>&nbsp;</li>
<li><a name="a234"></a>        <span class="src-var">$patternmatched</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-var">$s_patternmatched</span><span class="src-sym">;</span></li>
<li><a name="a235"></a>        <span class="src-var">$inputmatched</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-var">$s_inputmatched</span><span class="src-sym">;</span></li>
<li><a name="a236"></a>            </li>
<li><a name="a237"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$template</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a238"></a>&nbsp;</li>
<li><a name="a239"></a>            <span class="src-var">$template</span>=<span class="src-str">&quot;&lt;xml&gt;&lt;TEMPLATE&gt;&quot; </span>. <span class="src-var">$template </span>. <span class="src-str">&quot;&lt;/TEMPLATE&gt;&lt;/xml&gt;&quot;</span><span class="src-sym">;        </span></li>
<li><a name="a240"></a>            <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a> <span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">found</span> <span class="src-id">template</span>: <span class="src-var">$template</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;            </span></li>
<li><a name="a241"></a>            </li>
<li><a name="a242"></a>&nbsp;</li>
<li><a name="a243"></a>            <span class="src-var">$root</span>=<a href="../Interpreter/_util_php.html#functionGetXMLTree">GetXMLTree</a><span class="src-sym">(</span><span class="src-var">$template</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a244"></a>&nbsp;</li>
<li><a name="a245"></a>&nbsp;</li>
<li><a name="a246"></a>            <span class="src-key">if     </span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$root</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'children'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'value'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a247"></a>                <span class="src-var">$root</span>=<span class="src-var">$root</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'children'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'children'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a248"></a>            <span class="src-sym">}</span></li>
<li><a name="a249"></a>            <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a250"></a>                <span class="src-var">$root</span>=<span class="src-var">$root</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'children'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'value'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a251"></a>            <span class="src-sym">}</span></li>
<li><a name="a252"></a>&nbsp;</li>
<li><a name="a253"></a><span class="src-comm">/*</span></li>
<li><a name="a254"></a><span class="src-comm">            if     ($root[0]['children'][0]['value']==&quot;&quot;){</span></li>
<li><a name="a255"></a><span class="src-comm">                $root=$root[0]['children'][0]['children'];</span></li>
<li><a name="a256"></a><span class="src-comm">            }</span></li>
<li><a name="a257"></a><span class="src-comm">            else {</span></li>
<li><a name="a258"></a><span class="src-comm">                $root=$root[0]['children'][0]['value'];</span></li>
<li><a name="a259"></a><span class="src-comm">            }</span></li>
<li><a name="a260"></a><span class="src-comm">*/</span></li>
<li><a name="a261"></a>&nbsp;</li>
<li><a name="a262"></a>            <span class="src-var">$myresponse</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><span class="src-var">$root</span><span class="src-sym">,</span><span class="src-var">$inputstarvals</span><span class="src-sym">,</span><span class="src-var">$thatstarvals</span><span class="src-sym">,</span><span class="src-var">$topicstarvals</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a263"></a>            <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">recursechildren</span> <span class="src-id">ret</span>: <span class="src-var">$myresponse</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a264"></a>&nbsp;</li>
<li><a name="a265"></a>            <span class="src-key">return </span><span class="src-var">$myresponse</span><span class="src-sym">;</span></li>
<li><a name="a266"></a>&nbsp;</li>
<li><a name="a267"></a>        <span class="src-sym">}</span></li>
<li><a name="a268"></a>    <span class="src-sym">}</span></li>
<li><a name="a269"></a><span class="src-sym">}</span></li>
<li><a name="a270"></a>&nbsp;</li>
<li><a name="a271"></a>&nbsp;</li>
<li><a name="a272"></a><span class="src-doc">/**</span></li>
<li><a name="a273"></a><span class="src-doc">* Third level response processing</span></li>
<li><a name="a274"></a><span class="src-doc">*</span></li>
<li><a name="a275"></a><span class="src-doc">* This function is the 'manager' function of the template processing.</span></li>
<li><a name="a276"></a><span class="src-doc">*</span></li>
<li><a name="a277"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> handlenode()</span></li>
<li><a name="a278"></a><span class="src-doc">*</span></li>
<li><a name="a279"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$xmlnode </span><span class="src-doc">              Getting either a string or an array from respond() func.</span></li>
<li><a name="a280"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$inputstar </span><span class="src-doc">            If a matched pattern includes *'s then what is covere by the * is found here.</span></li>
<li><a name="a281"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$thatstar </span><span class="src-doc">             if a used that contains a star, then what is covered by the * is found here.</span></li>
<li><a name="a282"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$topicstar </span><span class="src-doc">            if a used topic contains a star, then what is covered by the * is found here.</span></li>
<li><a name="a283"></a><span class="src-doc">*</span></li>
<li><a name="a284"></a><span class="src-doc">* </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc">                     The bot's response.</span></li>
<li><a name="a285"></a><span class="src-doc">*/</span></li>
<li><a name="a286"></a><span class="src-key">function </span><a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a287"></a>&nbsp;</li>
<li><a name="a288"></a>    <span class="src-comm">// Getting either a string or an array from respond() func.</span></li>
<li><a name="a289"></a>    <span class="src-var">$response</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a290"></a>&nbsp;</li>
<li><a name="a291"></a>    <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a292"></a>&nbsp;</li>
<li><a name="a293"></a>&nbsp;</li>
<li><a name="a294"></a><span class="src-comm">//        if ($xmlnode['value']==&quot;&quot;){</span></li>
<li><a name="a295"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">'value'</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a296"></a>            <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$x</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$x</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a297"></a>&nbsp;</li>
<li><a name="a298"></a>                <span class="src-var">$response </span>.= <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a299"></a>&nbsp;</li>
<li><a name="a300"></a>            <span class="src-sym">}</span></li>
<li><a name="a301"></a>&nbsp;</li>
<li><a name="a302"></a>        <span class="src-sym">}</span></li>
<li><a name="a303"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a304"></a>            <span class="src-var">$response </span>.= <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">'value'</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a305"></a>        <span class="src-sym">}    </span></li>
<li><a name="a306"></a>    <span class="src-sym">}</span></li>
<li><a name="a307"></a>    <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a308"></a>        <span class="src-var">$response </span>.= <a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a309"></a>    <span class="src-sym">}</span></li>
<li><a name="a310"></a>&nbsp;</li>
<li><a name="a311"></a>&nbsp;</li>
<li><a name="a312"></a>    <span class="src-key">return </span><span class="src-var">$response</span><span class="src-sym">;</span></li>
<li><a name="a313"></a>&nbsp;</li>
<li><a name="a314"></a><span class="src-sym">}</span></li>
<li><a name="a315"></a>&nbsp;</li>
<li><a name="a316"></a>&nbsp;</li>
<li><a name="a317"></a><span class="src-doc">/**</span></li>
<li><a name="a318"></a><span class="src-doc">* Get the real XML child</span></li>
<li><a name="a319"></a><span class="src-doc">*</span></li>
<li><a name="a320"></a><span class="src-doc">* Get the real XML child which is used for processing AIML tags that may contain other AIML tags, such as SRAI, CONDITION etc.</span></li>
<li><a name="a321"></a><span class="src-doc">*</span></li>
<li><a name="a322"></a><span class="src-doc">*</span></li>
<li><a name="a323"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$xmlnode </span></li>
<li><a name="a324"></a><span class="src-doc">* </span></li>
<li><a name="a325"></a><span class="src-doc">* </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">mixed </span></li>
<li><a name="a326"></a><span class="src-doc">*/</span></li>
<li><a name="a327"></a><span class="src-key">function </span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a328"></a>&nbsp;</li>
<li><a name="a329"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;value&quot;</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a330"></a>&nbsp;</li>
<li><a name="a331"></a>        <span class="src-key">if </span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;children&quot;</span><span class="src-sym">]</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a332"></a>            <span class="src-key">return</span><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;children&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a333"></a>        <span class="src-sym">}</span></li>
<li><a name="a334"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a335"></a>            <span class="src-key">return </span><span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a336"></a>        <span class="src-sym">}</span></li>
<li><a name="a337"></a>&nbsp;</li>
<li><a name="a338"></a>    <span class="src-sym">}</span></li>
<li><a name="a339"></a>    <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a340"></a>        <span class="src-key">return</span><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;value&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a341"></a>    <span class="src-sym">}</span></li>
<li><a name="a342"></a>&nbsp;</li>
<li><a name="a343"></a><span class="src-comm">/*</span></li>
<li><a name="a344"></a><span class="src-comm">    if ($xmlnode[&quot;value&quot;]==&quot;&quot;){</span></li>
<li><a name="a345"></a><span class="src-comm">        return($xmlnode[&quot;children&quot;]);</span></li>
<li><a name="a346"></a><span class="src-comm">    }</span></li>
<li><a name="a347"></a><span class="src-comm">    else {</span></li>
<li><a name="a348"></a><span class="src-comm">        return($xmlnode[&quot;value&quot;]);</span></li>
<li><a name="a349"></a><span class="src-comm">    }</span></li>
<li><a name="a350"></a><span class="src-comm">*/</span></li>
<li><a name="a351"></a>&nbsp;</li>
<li><a name="a352"></a><span class="src-sym">}</span></li>
<li><a name="a353"></a>&nbsp;</li>
<li><a name="a354"></a><span class="src-doc">/**</span></li>
<li><a name="a355"></a><span class="src-doc">* Handles the actual XML between the &lt;template/&gt; tags.</span></li>
<li><a name="a356"></a><span class="src-doc">*</span></li>
<li><a name="a357"></a><span class="src-doc">* Recognises the different tags, access the different functions to process each individual tag. Notes by the original developer: &lt;br/&gt;</span></li>
<li><a name="a358"></a><span class="src-doc">* Why isn't this a huge switch statement? Because it has to do more comlicated checking than just string comparison to figure out what it should do. &lt;br/&gt;</span></li>
<li><a name="a359"></a><span class="src-doc">* How can I organize this better? Good question.</span></li>
<li><a name="a360"></a><span class="src-doc">*</span></li>
<li><a name="a361"></a><span class="src-doc">* </span><span class="src-doc-coretag">@todo</span><span class="src-doc"> It seems to me that this function could modelled similarly to the custom tag system. Where there is a seperate function for each tag.</span></li>
<li><a name="a362"></a><span class="src-doc">*</span></li>
<li><a name="a363"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> getid()</span></li>
<li><a name="a364"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> getfdate()</span></li>
<li><a name="a365"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> getsize()</span></li>
<li><a name="a366"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> upperkeysarray()</span></li>
<li><a name="a367"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> debugger()</span></li>
<li><a name="a368"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> recursechildren()</span></li>
<li><a name="a369"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> respond()</span></li>
<li><a name="a370"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> botget()</span></li>
<li><a name="a371"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> gender()</span></li>
<li><a name="a372"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> getinput()</span></li>
<li><a name="a373"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> bset()</span></li>
<li><a name="a374"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> insertgossip()</span></li>
<li><a name="a375"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> firstthird()</span></li>
<li><a name="a376"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> firstsecond()</span></li>
<li><a name="a377"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> getthat()</span></li>
<li><a name="a378"></a><span class="src-doc">* </span><span class="src-doc-coretag">@uses</span><span class="src-doc"> realchild()</span></li>
<li><a name="a379"></a><span class="src-doc">*</span></li>
<li><a name="a380"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">mixed </span><span class="src-doc-var">$xmlnode </span><span class="src-doc">              Getting either a string or an array from recursechildren() func.</span></li>
<li><a name="a381"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$inputstar </span><span class="src-doc">            If a matched pattern includes *'s then what is covere by the * is found here.</span></li>
<li><a name="a382"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$thatstar </span><span class="src-doc">             if a used that contains a star, then what is covered by the * is found here.</span></li>
<li><a name="a383"></a><span class="src-doc">* </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">array </span><span class="src-doc-var">$topicstar </span><span class="src-doc">            if a used topic contains a star, then what is covered by the * is found here.</span></li>
<li><a name="a384"></a><span class="src-doc">*</span></li>
<li><a name="a385"></a><span class="src-doc">* </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">string </span><span class="src-doc">                     The bot's response.</span></li>
<li><a name="a386"></a><span class="src-doc">*/</span></li>
<li><a name="a387"></a>&nbsp;</li>
<li><a name="a388"></a><span class="src-key">function </span><a href="../Interpreter/_respond_php.html#functionhandlenode">handlenode</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a389"></a>&nbsp;</li>
<li><a name="a390"></a>    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a391"></a>        <span class="src-key">return </span><span class="src-var">$xmlnode</span><span class="src-sym">;</span></li>
<li><a name="a392"></a>    <span class="src-sym">}</span></li>
<li><a name="a393"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;ID&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a394"></a>        </li>
<li><a name="a395"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetid">getid</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a396"></a>&nbsp;</li>
<li><a name="a397"></a>    <span class="src-sym">}</span></li>
<li><a name="a398"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;DATE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a399"></a>&nbsp;</li>
<li><a name="a400"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetfdate">getfdate</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a401"></a>&nbsp;</li>
<li><a name="a402"></a>    <span class="src-sym">}</span></li>
<li><a name="a403"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;VERSION&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a404"></a>&nbsp;</li>
<li><a name="a405"></a>        <span class="src-key">return </span><span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#definePROGRAMEVERSION">PROGRAMEVERSION</a></span><span class="src-sym">;</span></li>
<li><a name="a406"></a>&nbsp;</li>
<li><a name="a407"></a>    <span class="src-sym">}</span></li>
<li><a name="a408"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SIZE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a409"></a>&nbsp;</li>
<li><a name="a410"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetsize">getsize</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a411"></a>&nbsp;</li>
<li><a name="a412"></a>    <span class="src-sym">}</span></li>
<li><a name="a413"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;STAR&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a414"></a>&nbsp;</li>
<li><a name="a415"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a416"></a>&nbsp;</li>
<li><a name="a417"></a>        <span class="src-comm">//$starindex=$xmlnode[&quot;attributes&quot;][&quot;INDEX&quot;];</span></li>
<li><a name="a418"></a>&nbsp;</li>
<li><a name="a419"></a>&nbsp;</li>
<li><a name="a420"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">))))</span><span class="src-sym">{</span></li>
<li><a name="a421"></a>            <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a422"></a>        <span class="src-sym">}</span></li>
<li><a name="a423"></a>&nbsp;</li>
<li><a name="a424"></a>        <span class="src-var">$starindex</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a425"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$starindex</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a426"></a>            <span class="src-var">$starindex</span>=<span class="src-str">&quot;1&quot;</span><span class="src-sym">;</span></li>
<li><a name="a427"></a>        <span class="src-sym">}</span></li>
<li><a name="a428"></a>        <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">starindex</span>: <span class="src-var">$starindex</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a429"></a>        <span class="src-comm">//print_r($inputstar);</span></li>
<li><a name="a430"></a>        <span class="src-key">return </span><span class="src-var">$inputstar</span><span class="src-sym">[</span><span class="src-var">$starindex</span>-<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a431"></a>        </li>
<li><a name="a432"></a>&nbsp;</li>
<li><a name="a433"></a>    <span class="src-sym">}</span></li>
<li><a name="a434"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;THATSTAR&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a435"></a>&nbsp;</li>
<li><a name="a436"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a437"></a>&nbsp;</li>
<li><a name="a438"></a>        <span class="src-comm">//$starindex=$xmlnode[&quot;attributes&quot;][&quot;INDEX&quot;];</span></li>
<li><a name="a439"></a>        </li>
<li><a name="a440"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">))))</span><span class="src-sym">{</span></li>
<li><a name="a441"></a>            <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a442"></a>        <span class="src-sym">}</span></li>
<li><a name="a443"></a>        </li>
<li><a name="a444"></a>        <span class="src-var">$starindex</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a445"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$starindex</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a446"></a>            <span class="src-var">$starindex</span>=<span class="src-str">&quot;1&quot;</span><span class="src-sym">;</span></li>
<li><a name="a447"></a>        <span class="src-sym">}</span></li>
<li><a name="a448"></a>        <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">starindex</span>: <span class="src-var">$starindex</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a449"></a>        <span class="src-comm">//print_r($inputstar);</span></li>
<li><a name="a450"></a>        <span class="src-key">return </span><span class="src-var">$thatstar</span><span class="src-sym">[</span><span class="src-var">$starindex</span>-<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a451"></a>        </li>
<li><a name="a452"></a>&nbsp;</li>
<li><a name="a453"></a>    <span class="src-sym">}</span></li>
<li><a name="a454"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;TOPICSTAR&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a455"></a>&nbsp;</li>
<li><a name="a456"></a>        </li>
<li><a name="a457"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a458"></a>&nbsp;</li>
<li><a name="a459"></a>        <span class="src-comm">//$starindex=$xmlnode[&quot;attributes&quot;][&quot;INDEX&quot;];</span></li>
<li><a name="a460"></a>&nbsp;</li>
<li><a name="a461"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">))))</span><span class="src-sym">{</span></li>
<li><a name="a462"></a>            <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a463"></a>        <span class="src-sym">}</span></li>
<li><a name="a464"></a>&nbsp;</li>
<li><a name="a465"></a>        <span class="src-var">$starindex</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">'INDEX'</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a466"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$starindex</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a467"></a>            <span class="src-var">$starindex</span>=<span class="src-str">&quot;1&quot;</span><span class="src-sym">;</span></li>
<li><a name="a468"></a>        <span class="src-sym">}</span></li>
<li><a name="a469"></a>        <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">starindex</span>: <span class="src-var">$starindex</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a470"></a>        <span class="src-comm">//print_r($inputstar);</span></li>
<li><a name="a471"></a>        <span class="src-key">return </span><span class="src-var">$topicstar</span><span class="src-sym">[</span><span class="src-var">$starindex</span>-<span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a472"></a>        </li>
<li><a name="a473"></a>&nbsp;</li>
<li><a name="a474"></a>    <span class="src-sym">}</span></li>
<li><a name="a475"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SRAI&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a476"></a>        </li>
<li><a name="a477"></a>        <span class="src-comm">// Build up a new response inside of here (using recursechildren function and then call response with it.</span></li>
<li><a name="a478"></a>        </li>
<li><a name="a479"></a>        <span class="src-var">$newresponse</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a480"></a>&nbsp;</li>
<li><a name="a481"></a>        <a href="../Interpreter/Engine/_graphnew_php.html#functiondebugger">debugger</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str"><span class="src-id">newresponts</span>: <span class="src-var">$newresponse</span></span><span class="src-str">&quot;</span><span class="src-sym">,</span><span class="src-num">3</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a482"></a>        <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionrespond">respond</a><span class="src-sym">(</span><span class="src-var">$newresponse</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a483"></a>&nbsp;</li>
<li><a name="a484"></a>    <span class="src-sym">}</span></li>
<li><a name="a485"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SR&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a486"></a>&nbsp;</li>
<li><a name="a487"></a>        <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionrespond">respond</a><span class="src-sym">(</span><span class="src-var">$inputstar</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a488"></a>&nbsp;</li>
<li><a name="a489"></a>    <span class="src-sym">}</span></li>
<li><a name="a490"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;RANDOM&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a491"></a>&nbsp;</li>
<li><a name="a492"></a>        <span class="src-var">$liarray</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a493"></a>&nbsp;</li>
<li><a name="a494"></a>        <span class="src-var">$children </span>= <span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;children&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a495"></a>&nbsp;</li>
<li><a name="a496"></a>        <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$randomc</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$randomc</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$randomc</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a497"></a>            <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">) </span>== <span class="src-str">&quot;LI&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a498"></a>                <span class="src-var">$liarray</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-var">$randomc</span><span class="src-sym">;</span></li>
<li><a name="a499"></a>            <span class="src-sym">}</span></li>
<li><a name="a500"></a>        <span class="src-sym">}</span></li>
<li><a name="a501"></a>        </li>
<li><a name="a502"></a>        <span class="src-comm">// Pick a random number from 0 to sizeof($liarray)-1</span></li>
<li><a name="a503"></a>        <a href="http://www.php.net/mt_srand">mt_srand</a> <span class="src-sym">(</span>(float) <a href="http://www.php.net/microtime">microtime</a><span class="src-sym">(</span><span class="src-sym">) </span>* <span class="src-num">1000000</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a504"></a>        <span class="src-var">$lirandom</span>= <a href="http://www.php.net/mt_rand">mt_rand</a><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">,</span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$liarray</span><span class="src-sym">)</span>-<span class="src-num">1</span><span class="src-sym">))</span><span class="src-sym">;</span></li>
<li><a name="a505"></a>&nbsp;</li>
<li><a name="a506"></a>&nbsp;</li>
<li><a name="a507"></a>        <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$liarray</span><span class="src-sym">[</span><span class="src-var">$lirandom</span><span class="src-sym">]]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a508"></a>&nbsp;</li>
<li><a name="a509"></a>    <span class="src-sym">}</span></li>
<li><a name="a510"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;THINK&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a511"></a>&nbsp;</li>
<li><a name="a512"></a>        <a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a513"></a>        <span class="src-key">return </span><span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a514"></a>&nbsp;</li>
<li><a name="a515"></a>    <span class="src-sym">}</span></li>
<li><a name="a516"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;BOT&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a517"></a>&nbsp;</li>
<li><a name="a518"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a519"></a>&nbsp;</li>
<li><a name="a520"></a>        <span class="src-comm">//$name=$xmlnode[&quot;attributes&quot;][&quot;NAME&quot;];</span></li>
<li><a name="a521"></a>&nbsp;</li>
<li><a name="a522"></a>        <span class="src-var">$name</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a523"></a>&nbsp;</li>
<li><a name="a524"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionbotget">botget</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a525"></a>&nbsp;</li>
<li><a name="a526"></a>    <span class="src-sym">}</span></li>
<li><a name="a527"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GET&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a528"></a>&nbsp;</li>
<li><a name="a529"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a530"></a>        </li>
<li><a name="a531"></a>        <span class="src-comm">//$name=$xmlnode[&quot;attributes&quot;][&quot;NAME&quot;];</span></li>
<li><a name="a532"></a>&nbsp;</li>
<li><a name="a533"></a>        <span class="src-var">$name</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a534"></a>&nbsp;</li>
<li><a name="a535"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a536"></a>&nbsp;</li>
<li><a name="a537"></a>    <span class="src-sym">}</span></li>
<li><a name="a538"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SET&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a539"></a>&nbsp;</li>
<li><a name="a540"></a>        <span class="src-comm">//$name=$xmlnode[&quot;attributes&quot;][&quot;NAME&quot;];</span></li>
<li><a name="a541"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a542"></a>        <span class="src-var">$name</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a543"></a>&nbsp;</li>
<li><a name="a544"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a545"></a>&nbsp;</li>
<li><a name="a546"></a>        <a href="../Interpreter/_util_php.html#functionbset">bset</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a547"></a>&nbsp;</li>
<li><a name="a548"></a>        <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a549"></a>&nbsp;</li>
<li><a name="a550"></a>    <span class="src-sym">}</span></li>
<li><a name="a551"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;UPPERCASE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a552"></a>&nbsp;</li>
<li><a name="a553"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a554"></a>&nbsp;</li>
<li><a name="a555"></a>        <span class="src-key">return </span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a556"></a>&nbsp;</li>
<li><a name="a557"></a>    <span class="src-sym">}</span></li>
<li><a name="a558"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;FORMAL&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a559"></a>&nbsp;</li>
<li><a name="a560"></a>        <span class="src-var">$nvalue</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a561"></a>&nbsp;</li>
<li><a name="a562"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a563"></a>&nbsp;</li>
<li><a name="a564"></a>        <span class="src-var">$value</span>=<a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a565"></a>&nbsp;</li>
<li><a name="a566"></a>        <span class="src-var">$words</span>=<a href="http://www.php.net/split">split</a><span class="src-sym">(</span><span class="src-str">&quot; &quot;</span><span class="src-sym">,</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a567"></a>        <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$x</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$words</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$x</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a568"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$x</span>!=<span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a569"></a>                <span class="src-var">$nvalue</span>.=<span class="src-str">&quot; &quot;</span><span class="src-sym">;</span></li>
<li><a name="a570"></a>            <span class="src-sym">}</span></li>
<li><a name="a571"></a>            <span class="src-var">$nvalue </span>.= <a href="http://www.php.net/ucfirst">ucfirst</a><span class="src-sym">(</span><span class="src-var">$words</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a572"></a>        <span class="src-sym">}</span></li>
<li><a name="a573"></a>&nbsp;</li>
<li><a name="a574"></a>        <span class="src-key">return </span><span class="src-var">$nvalue</span><span class="src-sym">;</span></li>
<li><a name="a575"></a>&nbsp;</li>
<li><a name="a576"></a>    <span class="src-sym">}</span></li>
<li><a name="a577"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;LOWERCASE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a578"></a>&nbsp;</li>
<li><a name="a579"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a580"></a>&nbsp;</li>
<li><a name="a581"></a>        <span class="src-key">return </span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a582"></a>&nbsp;</li>
<li><a name="a583"></a>    <span class="src-sym">}</span></li>
<li><a name="a584"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GENDER&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a585"></a>&nbsp;</li>
<li><a name="a586"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a587"></a>&nbsp;</li>
<li><a name="a588"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongender">gender</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a589"></a>&nbsp;</li>
<li><a name="a590"></a>    <span class="src-sym">}</span></li>
<li><a name="a591"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SENTENCE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a592"></a>&nbsp;</li>
<li><a name="a593"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a594"></a>&nbsp;</li>
<li><a name="a595"></a>        <span class="src-key">return </span><a href="http://www.php.net/ucfirst">ucfirst</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a596"></a>&nbsp;</li>
<li><a name="a597"></a>    <span class="src-sym">}</span></li>
<li><a name="a598"></a>&nbsp;</li>
<li><a name="a599"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;INPUT&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a600"></a>&nbsp;</li>
<li><a name="a601"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a602"></a>        </li>
<li><a name="a603"></a>        <span class="src-comm">//$index = $xmlnode[&quot;attributes&quot;][&quot;INDEX&quot;];</span></li>
<li><a name="a604"></a>&nbsp;</li>
<li><a name="a605"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">))))</span><span class="src-sym">{</span></li>
<li><a name="a606"></a>            <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a607"></a>        <span class="src-sym">}        </span></li>
<li><a name="a608"></a>        </li>
<li><a name="a609"></a>        <span class="src-var">$index </span>= <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a610"></a>&nbsp;</li>
<li><a name="a611"></a>&nbsp;</li>
<li><a name="a612"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$index</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a613"></a>            <span class="src-var">$index</span>=<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a614"></a>        <span class="src-sym">}</span></li>
<li><a name="a615"></a>&nbsp;</li>
<li><a name="a616"></a>        <span class="src-var">$index</span>=<span class="src-var">$index</span>-<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a617"></a>&nbsp;</li>
<li><a name="a618"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetinput">getinput</a><span class="src-sym">(</span><span class="src-var">$index</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a619"></a>    </li>
<li><a name="a620"></a>&nbsp;</li>
<li><a name="a621"></a>    <span class="src-sym">}</span></li>
<li><a name="a622"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GOSSIP&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a623"></a>&nbsp;</li>
<li><a name="a624"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a625"></a>&nbsp;</li>
<li><a name="a626"></a>        <a href="../Interpreter/_util_php.html#functioninsertgossip">insertgossip</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a627"></a>&nbsp;</li>
<li><a name="a628"></a>        <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a629"></a>&nbsp;</li>
<li><a name="a630"></a>    <span class="src-sym">}</span></li>
<li><a name="a631"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;PERSON&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a632"></a>&nbsp;</li>
<li><a name="a633"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a634"></a>&nbsp;</li>
<li><a name="a635"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$value</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a636"></a>            <span class="src-var">$value</span>=<span class="src-var">$inputstar</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a637"></a>        <span class="src-sym">}</span></li>
<li><a name="a638"></a>&nbsp;</li>
<li><a name="a639"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionfirstthird">firstthird</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a640"></a>&nbsp;</li>
<li><a name="a641"></a>    <span class="src-sym">}</span></li>
<li><a name="a642"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;PERSON2&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a643"></a>&nbsp;</li>
<li><a name="a644"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a645"></a>&nbsp;</li>
<li><a name="a646"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$value</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a647"></a>            <span class="src-var">$value</span>=<span class="src-var">$inputstar</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a648"></a>        <span class="src-sym">}</span></li>
<li><a name="a649"></a>&nbsp;</li>
<li><a name="a650"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionfirstsecond">firstsecond</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a651"></a>&nbsp;</li>
<li><a name="a652"></a>    <span class="src-sym">}</span></li>
<li><a name="a653"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;THAT&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a654"></a>&nbsp;</li>
<li><a name="a655"></a>        </li>
<li><a name="a656"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a657"></a>        <span class="src-comm">//$indexes = $xmlnode[&quot;attributes&quot;][&quot;INDEX&quot;];</span></li>
<li><a name="a658"></a>&nbsp;</li>
<li><a name="a659"></a>        <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a660"></a>            <span class="src-var">$indexes </span>= <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;INDEX&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a661"></a>        <span class="src-sym">}</span></li>
<li><a name="a662"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a663"></a>            <span class="src-var">$indexes</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a664"></a>        <span class="src-sym">}</span></li>
<li><a name="a665"></a>&nbsp;</li>
<li><a name="a666"></a>        <span class="src-var">$indexes </span>= <a href="http://www.php.net/split">split</a> <span class="src-sym">(</span><span class="src-str">&quot;,&quot;</span><span class="src-sym">, </span><span class="src-var">$indexes</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a667"></a>&nbsp;</li>
<li><a name="a668"></a>        <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$indexes</span><span class="src-sym">)</span>&lt;<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a669"></a>            <span class="src-var">$indexes</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a670"></a>            <span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a671"></a>            <span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a672"></a>        <span class="src-sym">}</span></li>
<li><a name="a673"></a>&nbsp;</li>
<li><a name="a674"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetthat">getthat</a><span class="src-sym">(</span><span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a675"></a>    </li>
<li><a name="a676"></a>&nbsp;</li>
<li><a name="a677"></a>    <span class="src-sym">}</span></li>
<li><a name="a678"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;CONDITION&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a679"></a>    </li>
<li><a name="a680"></a>        </li>
<li><a name="a681"></a>        <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a682"></a>&nbsp;</li>
<li><a name="a683"></a>        <span class="src-comm">// First do multi condition name=value</span></li>
<li><a name="a684"></a>        <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a685"></a>            <span class="src-var">$condname</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a686"></a>        <span class="src-sym">}</span></li>
<li><a name="a687"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a688"></a>            <span class="src-var">$condname </span>= <span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a689"></a>        <span class="src-sym">}</span></li>
<li><a name="a690"></a>        <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a691"></a>            <span class="src-var">$condvalue</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a692"></a>        <span class="src-sym">}</span></li>
<li><a name="a693"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a694"></a>            <span class="src-var">$condvalue </span>= <span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a695"></a>        <span class="src-sym">}</span></li>
<li><a name="a696"></a>        <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;CONTAINS&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a697"></a>            <span class="src-var">$condcontains</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;CONTAINS&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a698"></a>        <span class="src-sym">}</span></li>
<li><a name="a699"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a700"></a>            <span class="src-var">$condcontains </span>= <span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a701"></a>        <span class="src-sym">}</span></li>
<li><a name="a702"></a>        <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;EXISTS&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a703"></a>            <span class="src-var">$condexists</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;EXISTS&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a704"></a>        <span class="src-sym">}</span></li>
<li><a name="a705"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a706"></a>            <span class="src-var">$condexists </span>= <span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a707"></a>        <span class="src-sym">}</span></li>
<li><a name="a708"></a><span class="src-comm">/*</span></li>
<li><a name="a709"></a><span class="src-comm">        $condname=$mynode[&quot;NAME&quot;];</span></li>
<li><a name="a710"></a><span class="src-comm">        $condvalue=$mynode[&quot;VALUE&quot;];</span></li>
<li><a name="a711"></a><span class="src-comm">        $condcontains=$mynode[&quot;CONTAINS&quot;];</span></li>
<li><a name="a712"></a><span class="src-comm">        $condexists=$mynode[&quot;EXISTS&quot;];</span></li>
<li><a name="a713"></a><span class="src-comm">*/</span></li>
<li><a name="a714"></a>        <span class="src-comm">// If this is a multi condition</span></li>
<li><a name="a715"></a>        <span class="src-key">if </span><span class="src-sym">((</span><span class="src-var">$condname</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span>&amp;&amp;<span class="src-sym">(</span><span class="src-var">$condvalue</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a716"></a>&nbsp;</li>
<li><a name="a717"></a>            </li>
<li><a name="a718"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$condvalue</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a719"></a>                <span class="src-var">$condtype</span>=<span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">;</span></li>
<li><a name="a720"></a>            <span class="src-sym">}</span></li>
<li><a name="a721"></a>            <span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$condcontains</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a722"></a>                <span class="src-var">$condtype</span>=<span class="src-str">&quot;CONTAINS&quot;</span><span class="src-sym">;</span></li>
<li><a name="a723"></a>            <span class="src-sym">}</span></li>
<li><a name="a724"></a>            <span class="src-key">elseif </span><span class="src-sym">(</span><span class="src-var">$condexists</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a725"></a>                <span class="src-var">$condtype</span>=<span class="src-str">&quot;EXISTS&quot;</span><span class="src-sym">;</span></li>
<li><a name="a726"></a>            <span class="src-sym">}</span></li>
<li><a name="a727"></a>&nbsp;</li>
<li><a name="a728"></a>            <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$condtype</span>==<span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a729"></a>&nbsp;</li>
<li><a name="a730"></a>                <span class="src-var">$condvalue</span>=<span class="src-str">&quot;^&quot; </span>. <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;*&quot;</span><span class="src-sym">,</span><span class="src-str">&quot;(.*)&quot;</span><span class="src-sym">,</span><span class="src-var">$condvalue</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a731"></a>                <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/eregi">eregi</a><span class="src-sym">(</span><span class="src-var">$condvalue</span><span class="src-sym">,</span><a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$condname</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a732"></a>                <span class="src-comm">//if ((bget($condname))==$condvalue){</span></li>
<li><a name="a733"></a>&nbsp;</li>
<li><a name="a734"></a>                    <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a735"></a>                    </li>
<li><a name="a736"></a>                <span class="src-sym">}</span></li>
<li><a name="a737"></a>&nbsp;</li>
<li><a name="a738"></a>            <span class="src-sym">}</span></li>
<li><a name="a739"></a>&nbsp;</li>
<li><a name="a740"></a>&nbsp;</li>
<li><a name="a741"></a>        <span class="src-sym">}</span></li>
<li><a name="a742"></a>        <span class="src-comm">// Else condname not blank and value is blank then it goes to &lt;li&gt;'s that have conditions in them.</span></li>
<li><a name="a743"></a>        <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$condname</span>!=<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span>&amp;&amp;<span class="src-sym">(</span><span class="src-var">$condvalue</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a744"></a>            </li>
<li><a name="a745"></a>&nbsp;</li>
<li><a name="a746"></a>            <span class="src-var">$children </span>= <span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;children&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a747"></a>&nbsp;</li>
<li><a name="a748"></a>            <span class="src-var">$checkval</span>=<a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$condname</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a749"></a>&nbsp;</li>
<li><a name="a750"></a>&nbsp;</li>
<li><a name="a751"></a>            <span class="src-comm">// After a match break. If no match then execute last if no name or val            </span></li>
<li><a name="a752"></a>            <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$randomc</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$randomc</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$randomc</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a753"></a>&nbsp;</li>
<li><a name="a754"></a>                <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">) </span>== <span class="src-str">&quot;LI&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a755"></a>&nbsp;</li>
<li><a name="a756"></a>                    <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a757"></a>&nbsp;</li>
<li><a name="a758"></a>                    <span class="src-comm">//$condvalue=$children[$randomc][&quot;attributes&quot;][&quot;VALUE&quot;];</span></li>
<li><a name="a759"></a>                    </li>
<li><a name="a760"></a>                    <span class="src-key">if </span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span><span class="src-sym">))))</span><span class="src-sym">{</span></li>
<li><a name="a761"></a>                        <span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a762"></a>                    <span class="src-sym">}</span></li>
<li><a name="a763"></a>                    </li>
<li><a name="a764"></a>                    <span class="src-var">$condvalue</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a765"></a>&nbsp;</li>
<li><a name="a766"></a>&nbsp;</li>
<li><a name="a767"></a>                    <span class="src-var">$condvalue</span>=<span class="src-str">&quot;^&quot; </span>. <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;*&quot;</span><span class="src-sym">,</span><span class="src-str">&quot;(.*)&quot;</span><span class="src-sym">,</span><span class="src-var">$condvalue</span><span class="src-sym">) </span>. <span class="src-str">&quot;</span><span class="src-str">$</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a768"></a>&nbsp;</li>
<li><a name="a769"></a>                    <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/eregi">eregi</a><span class="src-sym">(</span><span class="src-var">$condvalue</span><span class="src-sym">,</span><span class="src-var">$checkval</span><span class="src-sym">))</span>||<span class="src-sym">(</span><span class="src-var">$condvalue</span>==<span class="src-str">&quot;^\$&quot;</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a770"></a>&nbsp;</li>
<li><a name="a771"></a>                        <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a772"></a>                        </li>
<li><a name="a773"></a>                    <span class="src-sym">}</span></li>
<li><a name="a774"></a>&nbsp;</li>
<li><a name="a775"></a>                <span class="src-sym">}</span></li>
<li><a name="a776"></a>            <span class="src-sym">}</span></li>
<li><a name="a777"></a>&nbsp;</li>
<li><a name="a778"></a>        <span class="src-sym">}</span></li>
<li><a name="a779"></a>        <span class="src-comm">// Else condname and value both blank then the &lt;li&gt;'s inside have both</span></li>
<li><a name="a780"></a>        <span class="src-key">elseif </span><span class="src-sym">((</span><span class="src-var">$condname</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)</span>&amp;&amp;<span class="src-sym">(</span><span class="src-var">$condvalue</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a781"></a>&nbsp;</li>
<li><a name="a782"></a>&nbsp;</li>
<li><a name="a783"></a>&nbsp;</li>
<li><a name="a784"></a>            <span class="src-var">$children </span>= <span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;children&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a785"></a>&nbsp;</li>
<li><a name="a786"></a>            <span class="src-comm">// After a match break. If no match then execute last if no name or val</span></li>
<li><a name="a787"></a>            <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$randomc</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$randomc</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$randomc</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a788"></a>                <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">) </span>== <span class="src-str">&quot;LI&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a789"></a>&nbsp;</li>
<li><a name="a790"></a>                    <span class="src-var">$mynode</span>=<a href="../Interpreter/_util_php.html#functionupperkeysarray">upperkeysarray</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a791"></a>&nbsp;</li>
<li><a name="a792"></a>                    <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a793"></a>                        <span class="src-var">$condname</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;NAME&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a794"></a>                    <span class="src-sym">}</span></li>
<li><a name="a795"></a>                    <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a796"></a>                        <span class="src-var">$condname </span>= <span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a797"></a>                    <span class="src-sym">}</span></li>
<li><a name="a798"></a>                    <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/is_array">is_array</a><span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">))</span>&amp;&amp;<span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a799"></a>                        <span class="src-var">$condvalue</span>=<span class="src-var">$mynode</span><span class="src-sym">[</span><span class="src-str">&quot;VALUE&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a800"></a>                    <span class="src-sym">}</span></li>
<li><a name="a801"></a>                    <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a802"></a>                        <span class="src-var">$condvalue </span>= <span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a803"></a>                    <span class="src-sym">}</span></li>
<li><a name="a804"></a>                                </li>
<li><a name="a805"></a>&nbsp;</li>
<li><a name="a806"></a>&nbsp;</li>
<li><a name="a807"></a>                    <span class="src-var">$condvalue</span>=<span class="src-str">&quot;^&quot; </span>. <a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;*&quot;</span><span class="src-sym">,</span><span class="src-str">&quot;(.*)&quot;</span><span class="src-sym">,</span><span class="src-var">$condvalue</span><span class="src-sym">) </span>. <span class="src-str">&quot;</span><span class="src-str">$</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a808"></a>&nbsp;</li>
<li><a name="a809"></a>&nbsp;</li>
<li><a name="a810"></a>                    <span class="src-key">if </span><span class="src-sym">((</span><a href="http://www.php.net/eregi">eregi</a><span class="src-sym">(</span><span class="src-var">$condvalue</span><span class="src-sym">,</span><a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$condname</span><span class="src-sym">)))</span>||<span class="src-sym">((</span><span class="src-var">$condvalue</span>==<span class="src-str">&quot;^\$&quot;</span><span class="src-sym">)</span>&amp;&amp;<span class="src-sym">(</span><span class="src-var">$condname</span>==<span class="src-str">&quot;&quot;</span><span class="src-sym">)))</span><span class="src-sym">{</span></li>
<li><a name="a811"></a>&nbsp;</li>
<li><a name="a812"></a>                        <span class="src-key">return </span><a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$children</span><span class="src-sym">[</span><span class="src-var">$randomc</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a813"></a>                        </li>
<li><a name="a814"></a>                    <span class="src-sym">}</span></li>
<li><a name="a815"></a>&nbsp;</li>
<li><a name="a816"></a>&nbsp;</li>
<li><a name="a817"></a>                <span class="src-sym">}</span></li>
<li><a name="a818"></a>            <span class="src-sym">}</span></li>
<li><a name="a819"></a>&nbsp;</li>
<li><a name="a820"></a>&nbsp;</li>
<li><a name="a821"></a>        <span class="src-sym">}</span></li>
<li><a name="a822"></a>&nbsp;</li>
<li><a name="a823"></a>    <span class="src-sym">}</span></li>
<li><a name="a824"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SYSTEM&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a825"></a>&nbsp;</li>
<li><a name="a826"></a>        <span class="src-var">$command</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a827"></a>&nbsp;</li>
<li><a name="a828"></a>        <a href="http://www.php.net/exec">exec</a><span class="src-sym">(</span><span class="src-var">$command</span><span class="src-sym">,</span><span class="src-var">$execoutput</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a829"></a>&nbsp;</li>
<li><a name="a830"></a>        <span class="src-key">for </span><span class="src-sym">(</span><span class="src-var">$x</span>=<span class="src-num">0</span><span class="src-sym">;</span><span class="src-var">$x</span>&lt;<a href="http://www.php.net/sizeof">sizeof</a><span class="src-sym">(</span><span class="src-var">$execoutput</span><span class="src-sym">)</span><span class="src-sym">;</span><span class="src-var">$x</span>++<span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a831"></a>            <span class="src-var">$allout</span>=<span class="src-var">$allout </span>. <span class="src-var">$execoutput</span><span class="src-sym">[</span><span class="src-var">$x</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a832"></a>        <span class="src-sym">}</span></li>
<li><a name="a833"></a>&nbsp;</li>
<li><a name="a834"></a>        <span class="src-key">return </span><span class="src-var">$allout</span><span class="src-sym">;</span></li>
<li><a name="a835"></a>&nbsp;</li>
<li><a name="a836"></a>    <span class="src-sym">}</span></li>
<li><a name="a837"></a>    <span class="src-comm">// For Javascript to work you need:</span></li>
<li><a name="a838"></a>    <span class="src-comm">//                1. Java.</span></li>
<li><a name="a839"></a>    <span class="src-comm">//                2. PHP compiled with Java support.</span></li>
<li><a name="a840"></a>    <span class="src-comm">//                3. js.jar in your php/java directory.</span></li>
<li><a name="a841"></a>    <span class="src-comm">//                   (you can get js.jar from the Program D distribution - http://www.alicebot.org)</span></li>
<li><a name="a842"></a>    <span class="src-comm">//                4. php.ini's java.class.path to point to js.jar.</span></li>
<li><a name="a843"></a>    <span class="src-comm">// A much easier alternative is to write PHP code and embed it in &lt;php&gt;&lt;/php&gt; tags.</span></li>
<li><a name="a844"></a>    <span class="src-comm">/*</span></li>
<li><a name="a845"></a><span class="src-comm">    elseif (strtoupper($xmlnode[&quot;tag&quot;])==&quot;JAVASCRIPT&quot;){</span></li>
<li><a name="a846"></a>&nbsp;</li>
<li><a name="a847"></a><span class="src-comm">        $jscode=recursechildren(realchild($xmlnode),$inputstar,$thatstar,$topicstar);</span></li>
<li><a name="a848"></a>&nbsp;</li>
<li><a name="a849"></a><span class="src-comm">        $context = new Java(&quot;org.mozilla.javascript.Context&quot;);</span></li>
<li><a name="a850"></a><span class="src-comm">        $newContext = $context-&gt;enter();</span></li>
<li><a name="a851"></a><span class="src-comm">        $scope = $newContext-&gt;initStandardObjects(null);</span></li>
<li><a name="a852"></a><span class="src-comm">        $script = $jscode;</span></li>
<li><a name="a853"></a><span class="src-comm">        $evaluate = $newContext-&gt;evaluateString($scope, $script, &quot;&lt;cmd&gt;&quot;, 1, null);</span></li>
<li><a name="a854"></a><span class="src-comm">        $context-&gt;exit();</span></li>
<li><a name="a855"></a><span class="src-comm">        return $newContext-&gt;toString($evaluate);</span></li>
<li><a name="a856"></a>&nbsp;</li>
<li><a name="a857"></a><span class="src-comm">    }</span></li>
<li><a name="a858"></a><span class="src-comm">    */</span></li>
<li><a name="a859"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;PHP&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a860"></a>&nbsp;</li>
<li><a name="a861"></a>        <span class="src-var">$phpcode</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a862"></a>&nbsp;</li>
<li><a name="a863"></a>        <a href="http://www.php.net/ob_start">ob_start</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a864"></a>        eval<span class="src-sym">(</span><span class="src-var">$phpcode</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a865"></a>        <span class="src-var">$evaled </span>= <a href="http://www.php.net/ob_get_contents">ob_get_contents</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span></li>
<li><a name="a866"></a>        <a href="http://www.php.net/ob_end_clean">ob_end_clean</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">; </span></li>
<li><a name="a867"></a>&nbsp;</li>
<li><a name="a868"></a>        <span class="src-key">return </span><span class="src-var">$evaled</span><span class="src-sym">;</span></li>
<li><a name="a869"></a>&nbsp;</li>
<li><a name="a870"></a>    <span class="src-sym">}</span></li>
<li><a name="a871"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;JUSTBEFORETHAT&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a872"></a>&nbsp;</li>
<li><a name="a873"></a>        <span class="src-var">$indexes</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a874"></a>        <span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-num">2</span><span class="src-sym">;</span></li>
<li><a name="a875"></a>        <span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-sym">]</span>=<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a876"></a>&nbsp;</li>
<li><a name="a877"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetthat">getthat</a><span class="src-sym">(</span><span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-var">$indexes</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a878"></a>&nbsp;</li>
<li><a name="a879"></a>    <span class="src-sym">}</span></li>
<li><a name="a880"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;JUSTTHAT&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a881"></a>&nbsp;</li>
<li><a name="a882"></a>        <span class="src-var">$index</span>=<span class="src-num">2</span><span class="src-sym">;</span></li>
<li><a name="a883"></a>&nbsp;</li>
<li><a name="a884"></a>        <span class="src-var">$index</span>=<span class="src-var">$index</span>-<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a885"></a>&nbsp;</li>
<li><a name="a886"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetinput">getinput</a><span class="src-sym">(</span><span class="src-var">$index</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a887"></a>    </li>
<li><a name="a888"></a>    <span class="src-sym">}</span></li>
<li><a name="a889"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;BEFORETHAT&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a890"></a>&nbsp;</li>
<li><a name="a891"></a>        <span class="src-var">$index</span>=<span class="src-num">3</span><span class="src-sym">;</span></li>
<li><a name="a892"></a>&nbsp;</li>
<li><a name="a893"></a>        <span class="src-var">$index</span>=<span class="src-var">$index</span>-<span class="src-num">1</span><span class="src-sym">;</span></li>
<li><a name="a894"></a>&nbsp;</li>
<li><a name="a895"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetinput">getinput</a><span class="src-sym">(</span><span class="src-var">$index</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a896"></a>    </li>
<li><a name="a897"></a>    <span class="src-sym">}</span></li>
<li><a name="a898"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GET_IP&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a899"></a>&nbsp;</li>
<li><a name="a900"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetid">getid</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a901"></a>    </li>
<li><a name="a902"></a>    <span class="src-sym">}</span></li>
<li><a name="a903"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GETNAME&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a904"></a>&nbsp;</li>
<li><a name="a905"></a>        <span class="src-var">$name</span>=<span class="src-str">&quot;NAME&quot;</span><span class="src-sym">;</span></li>
<li><a name="a906"></a>&nbsp;</li>
<li><a name="a907"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a908"></a>    </li>
<li><a name="a909"></a>    <span class="src-sym">}</span></li>
<li><a name="a910"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GETSIZE&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a911"></a>&nbsp;</li>
<li><a name="a912"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functiongetsize">getsize</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a913"></a>    </li>
<li><a name="a914"></a>    <span class="src-sym">}</span></li>
<li><a name="a915"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GETTOPIC&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a916"></a>&nbsp;</li>
<li><a name="a917"></a>        <span class="src-var">$name</span>=<span class="src-str">&quot;TOPIC&quot;</span><span class="src-sym">;</span></li>
<li><a name="a918"></a>&nbsp;</li>
<li><a name="a919"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a920"></a>    </li>
<li><a name="a921"></a>    <span class="src-sym">}</span></li>
<li><a name="a922"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;GETVERSION&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a923"></a>&nbsp;</li>
<li><a name="a924"></a>        <span class="src-key">return </span><span class="src-id"><a href="../Settings/_admin_dbprefs_php.html#definePROGRAMEVERSION">PROGRAMEVERSION</a></span><span class="src-sym">;</span></li>
<li><a name="a925"></a>    </li>
<li><a name="a926"></a>    <span class="src-sym">}</span></li>
<li><a name="a927"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-num">0</span><span class="src-sym">,</span><span class="src-num">4</span><span class="src-sym">)</span>==<span class="src-str">&quot;GET_&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a928"></a>&nbsp;</li>
<li><a name="a929"></a>        <span class="src-var">$name</span>=<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a930"></a>&nbsp;</li>
<li><a name="a931"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionbget">bget</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a932"></a>&nbsp;</li>
<li><a name="a933"></a>    <span class="src-sym">}</span></li>
<li><a name="a934"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SETNAME&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a935"></a>&nbsp;</li>
<li><a name="a936"></a>        <span class="src-var">$name</span>=<span class="src-str">&quot;NAME&quot;</span><span class="src-sym">;</span></li>
<li><a name="a937"></a>&nbsp;</li>
<li><a name="a938"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a939"></a>&nbsp;</li>
<li><a name="a940"></a>        <a href="../Interpreter/_util_php.html#functionbset">bset</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a941"></a>&nbsp;</li>
<li><a name="a942"></a>        <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a943"></a>    </li>
<li><a name="a944"></a>    <span class="src-sym">}</span></li>
<li><a name="a945"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span>==<span class="src-str">&quot;SETTOPIC&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a946"></a>&nbsp;</li>
<li><a name="a947"></a>        <span class="src-var">$name</span>=<span class="src-str">&quot;TOPIC&quot;</span><span class="src-sym">;</span></li>
<li><a name="a948"></a>&nbsp;</li>
<li><a name="a949"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a950"></a>&nbsp;</li>
<li><a name="a951"></a>        <a href="../Interpreter/_util_php.html#functionbset">bset</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a952"></a>&nbsp;</li>
<li><a name="a953"></a>        <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a954"></a>    </li>
<li><a name="a955"></a>    <span class="src-sym">}</span></li>
<li><a name="a956"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-num">0</span><span class="src-sym">,</span><span class="src-num">4</span><span class="src-sym">)</span>==<span class="src-str">&quot;SET_&quot;</span><span class="src-sym">)</span><span class="src-sym">{</span></li>
<li><a name="a957"></a>&nbsp;</li>
<li><a name="a958"></a>        <span class="src-var">$name</span>=<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">,</span><span class="src-num">4</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a959"></a>        <span class="src-var">$value</span>=<a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a960"></a>        </li>
<li><a name="a961"></a>        <a href="../Interpreter/_util_php.html#functionbset">bset</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">,</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a962"></a>&nbsp;</li>
<li><a name="a963"></a>        <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a964"></a>&nbsp;</li>
<li><a name="a965"></a>    <span class="src-sym">}</span></li>
<li><a name="a966"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="../Interpreter/_util_php.html#functionisdeprecated">isdeprecated</a><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$ttag</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a967"></a>&nbsp;</li>
<li><a name="a968"></a>        <span class="src-var">$name</span>=<span class="src-var">$ttag</span><span class="src-sym">;</span></li>
<li><a name="a969"></a>&nbsp;</li>
<li><a name="a970"></a>        <span class="src-key">return </span><a href="../Interpreter/_util_php.html#functionbotget">botget</a><span class="src-sym">(</span><span class="src-var">$name</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a971"></a>&nbsp;</li>
<li><a name="a972"></a>    <span class="src-sym">}</span></li>
<li><a name="a973"></a>    <span class="src-key">elseif </span><span class="src-sym">(</span><a href="../Interpreter/_util_php.html#functioniscustomtag">iscustomtag</a><span class="src-sym">(</span><a href="http://www.php.net/strtoupper">strtoupper</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$ctfunction</span><span class="src-sym">))</span><span class="src-sym">{</span></li>
<li><a name="a974"></a>        </li>
<li><a name="a975"></a>        <span class="src-key">return </span><span class="src-var">$ctfunction</span><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">)</span><span class="src-sym">;</span></li>
<li><a name="a976"></a>&nbsp;</li>
<li><a name="a977"></a>    <span class="src-sym">}</span></li>
<li><a name="a978"></a>    <span class="src-comm">// Else we do not know how to handle this. Assume it is HTML and just output it.</span></li>
<li><a name="a979"></a>    <span class="src-comm">// This code fixed by Stefan Humnig</span></li>
<li><a name="a980"></a>    <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a981"></a>&nbsp;</li>
<li><a name="a982"></a>        <span class="src-var">$name </span>= <span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;tag&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a983"></a>&nbsp;</li>
<li><a name="a984"></a>        <span class="src-var">$atts</span>=<span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;attributes&quot;</span><span class="src-sym">]</span><span class="src-sym">;</span></li>
<li><a name="a985"></a>&nbsp;</li>
<li><a name="a986"></a>        <span class="src-var">$atttext</span>=<span class="src-str">&quot;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a987"></a>&nbsp;</li>
<li><a name="a988"></a>        <span class="src-key">if </span><span class="src-sym">(</span><span class="src-var">$atts </span>!= <span class="src-id">NULL</span><span class="src-sym">)</span></li>
<li><a name="a989"></a>        <span class="src-sym">{</span></li>
<li><a name="a990"></a>            <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-var">$atts </span><span class="src-key">as </span><span class="src-var">$key </span>=&gt; <span class="src-var">$value</span><span class="src-sym">)</span></li>
<li><a name="a991"></a>            <span class="src-sym">{</span></li>
<li><a name="a992"></a>                <span class="src-var">$atttext </span>.= <span class="src-str">&quot;</span><span class="src-str"> <span class="src-var">$key</span>=\&quot;<span class="src-var">$value</span>\&quot;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a993"></a>            <span class="src-sym">}</span></li>
<li><a name="a994"></a>        <span class="src-sym">}</span></li>
<li><a name="a995"></a>        </li>
<li><a name="a996"></a>        <span class="src-var">$value</span>=<span class="src-str">&quot;</span><span class="src-str">&lt;<span class="src-var">$name</span></span><span class="src-str">&quot; </span>. <span class="src-var">$atttext</span><span class="src-sym">;</span></li>
<li><a name="a997"></a>                </li>
<li><a name="a998"></a>        <span class="src-key">if </span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;children&quot;</span><span class="src-sym">]</span><span class="src-sym">) </span>|| <a href="http://www.php.net/strcmp">strcmp</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">[</span><span class="src-str">&quot;value&quot;</span><span class="src-sym">]</span><span class="src-sym">, </span><span class="src-str">&quot;&quot;</span><span class="src-sym">) </span>!= <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></li>
<li><a name="a999"></a>            <span class="src-var">$value </span>.= <span class="src-str">&quot;&gt;&quot; </span>. <a href="../Interpreter/_respond_php.html#functionrecursechildren">recursechildren</a><span class="src-sym">(</span><a href="../Interpreter/_respond_php.html#functionrealchild">realchild</a><span class="src-sym">(</span><span class="src-var">$xmlnode</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-var">$inputstar</span><span class="src-sym">,</span><span class="src-var">$thatstar</span><span class="src-sym">,</span><span class="src-var">$topicstar</span><span class="src-sym">) </span>. <span class="src-str">&quot;</span><span class="src-str">&lt;/<span class="src-var">$name</span>&gt;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1000"></a>        <span class="src-sym">}</span></li>
<li><a name="a1001"></a>        <span class="src-key">else </span><span class="src-sym">{</span></li>
<li><a name="a1002"></a>            <span class="src-var">$value </span>.= <span class="src-str">&quot;/&gt;&quot;</span><span class="src-sym">;</span></li>
<li><a name="a1003"></a>        <span class="src-sym">}</span></li>
<li><a name="a1004"></a>&nbsp;</li>
<li><a name="a1005"></a>        <span class="src-key">return </span><span class="src-var">$value</span><span class="src-sym">;</span></li>
<li><a name="a1006"></a>&nbsp;</li>
<li><a name="a1007"></a>    <span class="src-sym">}</span></li>
<li><a name="a1008"></a>&nbsp;</li>
<li><a name="a1009"></a><span class="src-sym">}</span></li>
<li><a name="a1010"></a>&nbsp;</li>
<li><a name="a1011"></a>&nbsp;</li>
<li><a name="a1012"></a>&nbsp;</li>
<li><a name="a1013"></a>&nbsp;</li>
<li><a name="a1014"></a><span class="src-php">?&gt;</span></li>
</ol></pre>
</div>
	<p class="notes" id="credit">
		Documentation generated on Wed, 12 Jan 2005 12:24:48 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.0RC3</a>
	</p>
	</body>
</html>
Return current item: Program E