<?php include '../util.php'; include '../solver.php'; include '../reader.php'; include '../formatter.php'; if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+\\.xml$/i', $_GET['kb'])) { die('Doe eens niet!'); } $reader = new KnowledgeBaseReader(); $state = $reader->parse(first_found_path(array('./' . $_GET['kb'], '../knowledgebases/' . $_GET['kb']))); class FactStatistics { public $name; public $values; public function __construct($name) { $this->name = $name; $this->values = new Map(function () { return new FactValueStatistics(); }); } } class FactValueStatistics { public $inferringRules; public $dependingRules; public $inferringQuestions; public function __construct() { $this->inferringRules = new Set();
// to be solved. foreach ($goal->answers as $answer) { if (KnowledgeState::is_variable($answer->value)) { $state->goalStack->push(substr($answer->value, 1)); } } } } return $state; } private function readState($file) { $reader = new KnowledgeBaseReader(); $state = $reader->parse($file); return $state; } private function getLog() { if (isset($_POST['log'])) { return _decode($_POST['log']); } else { return new WebLogger(); } } } if (!isset($_GET['kb']) || !preg_match('/^[a-zA-Z0-9_\\-\\.]+\\.xml$/i', $_GET['kb'])) { redirect('index.php'); } header('Content-Type: text/html; charset=UTF-8'); $frontend = new WebFrontend(first_found_path(array('./' . $_GET['kb'], '../knowledgebases/' . $_GET['kb']))); $frontend->main();
<?php include '../util.php'; include '../reader.php'; if (!preg_match('/^[a-zA-Z0-9_\\-\\.]+\\.xml$/i', $_GET['kb'])) { die('Doe eens niet!'); } $file = first_found_path(array('./' . $_GET['kb'], '../knowledgebases/' . $_GET['kb'])); if (!$file) { die('File not found'); } $doc = new DOMDocument(); $doc->load($file, LIBXML_NOCDATA & LIBXML_NOBLANKS); $template = new Template('templates/view.phtml'); $template->document = $doc; $template->file = $file; echo $template->render();