Documentation is available at addition.php
- <?php
- /*
- Program E related AIML knowledgebase tools
- Copyright 2004, Anne Kootstra [anne@aiml.info]
- http://www.AIML.info
- Program E is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- Program E is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with Program E; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- /**
- * All files that take part in adding AIML to the database
- *
- * This is a collection of functions that deal with adding categories
- * to the Program E database system.
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @package addition
- * @uses getRequest()
- * @uses getbotnames()
- * @uses useTemplate()
- *
- */
- /**
- * Variables that are needed to
- */
- require_once "../admin/botloaderfuncs.php";
- require_once "include/common.inc.php";
- require_once "include/target.inc.php";
- require_once "include/add.inc.php";
- // HTTP_POST or HTTP_GET variables
- // used in this page. They are now accessible, as normal variables.
- // escape routine to make global variables from POST/GET variables.
- /**
- *
- * @name cat_input
- *
- */
- getRequest("cat_input", 0);
- getRequest("cat_that", 0);
- getRequest("cat_topic", 0);
- getRequest("cat_template", 0);
- getRequest("botid", 0);
- /**
- * routine to create the bot selection list.
- *
- * @see getbotnames()
- *
- */
- $botnames = getbotnames();
- while(list($key, $val) = each($botnames)) {
- if($botid == $key){
- $bots .= "<option value=\"$key\" selected>$val</option>";
- }else{
- $bots .= "<option value=\"$key\">$val</option>";
- }
- }
- // auto select a previously selected bot.
- if(!$botid) {
- $page['{{bots}}'] = $bots;
- echo useTemplate('botselect',$page);
- return;
- }
- //insert the new AIML category
- if($cat_input != '') {
- // check to see if fields are empty, then put a * in them
- if($cat_that == '') {
- $cat_that = "*";
- }
- if($cat_topic == '') {
- $cat_topic = "*";
- }
- // Make a string out of the received category that can be processed
- // by native Program E functions
- $mybigsentence=strtoupper($cat_input)." <that> ".strtoupper($cat_that)." <topic> ".strtoupper($cat_topic);
- // Last record of a category in the paterntable is used as an
- // ID-reference to the templates table
- $idused=insertAnnesentence($mybigsentence, $botid);
- // is used by insertmytemplate() in the ../admin/botloaderfuncs.php
- $selectbot = $botid;
- insertmytemplate($idused,$cat_template);
- }
- // match the placeholders in the template to
- // a specific PHP variable.
- $page['{{bots}}'] = $bots;
- $page['{{bot_id}}'] = $botid;
- // load the template and return the page.
- echo useTemplate('add',$page);
- ?>
Documentation generated on Tue, 11 Jan 2005 18:40:57 +0100 by phpDocumentor 1.3.0RC3