*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'HTML');
define('XAJAX_HTML_CONTROL_DOCTYPE_VERSION', '4.01');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_HTML401TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
    include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
    return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
    return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
    return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
    return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
*/
define('XAJAX_HTML_CONTROL_DOCTYPE_FORMAT', 'XHTML');
define('XAJAX_HMTL_CONTROL_DOCTYPE_VERSION', '1.0');
define('XAJAX_HTML_CONTROL_DOCTYPE_VALIDATION', 'TRANSITIONAL');
$sBaseFolder = dirname(dirname(dirname(__FILE__)));
$sCoreFolder = '/xajax_core';
$sCtrlFolder = '/xajax_controls';
include $sBaseFolder . $sCoreFolder . '/xajax.inc.php';
$xajax = new xajax();
$xajax->configure('javascript URI', '../../');
include $sBaseFolder . $sCtrlFolder . '/validate_XHTML10TRANSITIONAL.inc.php';
include $sBaseFolder . $sCoreFolder . '/xajaxControl.inc.php';
foreach (array('/document.inc.php', '/structure.inc.php', '/content.inc.php', '/form.inc.php', '/group.inc.php', '/misc.inc.php') as $sFile) {
    include $sBaseFolder . $sCtrlFolder . $sFile;
}
$objDocument = new clsDocument(array('children' => array(new clsDoctype(), new clsHtml(array('attributes' => array('xmlns' => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', 'lang' => 'en'), 'children' => array(new clsHead(array('xajax' => $xajax, 'children' => array(generateTitle(), generateStyle(), generateScript(), generateMeta(), generateLink(), generateBase()))), new clsBody(array('children' => array(generateOrderedList(), generateUnorderedList(), generateDefinitionList(), generateTable(), generateForm(), generateContent(), generateValidation(), generateIframe())))))))));
function generateTitle()
{
    return new clsTitle(array('child' => new clsLiteral('Title')));
}
function generateStyle()
{
    return new clsStyle(array('attributes' => array('type' => 'text/css'), 'child' => new clsLiteral('styleOne { background: #ffdddd; }')));
}
function generateScript()
{
    return new clsScript(array('attributes' => array('type' => 'text/javascript'), 'child' => new clsLiteral('javascriptFunction = function(a, b) { alert(a*b); };')));
}
function generateMeta()
{
    return new clsMeta(array('attributes' => array('name' => 'keywords', 'lang' => 'en-us', 'content' => 'xajax, javascript, php, ajax')));
Пример #3
0
function renderTask($sent)
{
    if (!isset($_SESSION['action']) || $_SESSION['action'] == 0) {
        $_SESSION['action'] = 1;
    } else {
        $_SESSION['action'] = $_SESSION['action'] + 1;
    }
    $words = explode(" ", $sent);
    $action = $words[0];
    if (strpos($action, "google") !== false) {
        return renderAnswer(str_replace("google ", "", $sent));
    }
    $howTo = dbMassData("SELECT * FROM actions WHERE command LIKE '%{$action}%'");
    if ($howTo == null) {
        $theResp = "I don't know how to " . $action . " yet. Can you teach me?";
        $_SESSION['isLearning'] = true;
        $_SESSION['action'] = 0;
        $_SESSION['action'] = 0;
        //session_start();
        //numbers will be used to indicate whether action is in program.
        $_SESSION['action_progress_desc'] = "seeking clarification";
        return array("status" => "kinda", "answer" => $theResp, "answerType" => "clarification", "original" => "command");
    }
    $onStep = $_SESSION['action'] - 1;
    $allSteps = explode("\r\n", $howTo[0]['how']);
    if ($onStep >= count($allSteps) - 2) {
        $_SESSION['action'] = 0;
        return array("status" => "success", "answer" => "I finished the task at hand!", "ended" => "yay", "original" => "command", "answerType" => "ended action");
    }
    $thisStep = $allSteps[$onStep];
    $script = generateScript($thisStep);
    return array("status" => "success", "answer" => "I'm about to follow this procedure to fufill your request: " . $thisStep, "actionType" => $howTo[0]['howType'], "answerType" => "steps", "original" => "command", "note" => "going to " . $thisStep . "on your next ping.", "script" => $script);
}
 function writeSchema()
 {
     if ($this->fh == null) {
         return false;
     }
     $tNames = array();
     $tables = array_merge($this->tables[0], $this->tables[1]);
     $tNames = array_unique(array_keys($tables));
     $schema = generateScript($this->options, $tNames, $this->session->targetdb, $this->session->sourcedb);
     if ($schema != "") {
         fwrite($this->fh, $schema . "\n\n\n");
         unset($schema);
     }
 }