<?php /* check if the bot is actually online and not down for maintenance */ if (JxBotClient::is_available()) { ?> <form method="post" action=""> <!-- BOT OUTPUT: --> <div id="bot-output"><?php /* generate the bot response to the user-input; or an appropriate greeting if the page has just loaded */ if (isset($_REQUEST['input'])) { print JxBotClient::respond($_REQUEST['input']); } else { print JxBotClient::respond(null); } ?> </div> <!-- USER INPUT: --> <p><input type="text" name="input" id="user-input" size="100" autofocus></p> <p><input type="submit" id="user-submit" value="Say"></p> </form> <?php } else { /* the bot is offline for maintenance: */
May all beings rejoice in the happiness of others. May all beings abide in equanimity; free of attachment and delusion. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice, preamble and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *******************************************************************************/ require_once dirname(__FILE__) . '/core/client.php'; JxBotClient::init(); JxBotClient::resume_conversation(); $output = ''; if (!JxBotClient::is_available()) { $output = 'Sorry, the bot is down for maintenance. Please try again later.'; } else { $output = JxBotClient::respond(urldecode($_SERVER['QUERY_STRING'])); } header("Content-type: text/plain; charset=utf-8"); print $output;