Пример #1
0
function do_delete_file()
{
    $inputs = JxBotUtil::inputs('file');
    $file = JxBotConfig::aiml_dir() . str_replace(array('/', './', '../'), '', $inputs['file']);
    $stmt = JxBotDB::$db->prepare('DELETE FROM file WHERE name=?');
    $stmt->execute(array($inputs['file']));
    @unlink($file);
}
Пример #2
0
function do_new_map()
{
    $inputs = JxBotUtil::inputs('map-name');
    $map_name = trim($inputs['map-name']);
    $stmt = JxBotDB::$db->prepare('INSERT INTO _map (name) VALUES (?)');
    $stmt->execute(array($map_name));
    list_items(JxBotDB::$db->lastInsertId());
}
Пример #3
0
 public static function setup_environment()
 {
     mb_internal_encoding('UTF-8');
     JxBotConfig::$config['bot_url'] = JxBotUtil::request_url();
     $config_file = dirname(dirname(__FILE__)) . '/config.php';
     if (!is_readable($config_file)) {
         return JxBotConfig::run_installer();
     }
     if (!JxBotConfig::load_config()) {
         JxBot::fatal_error("Couldn't load database configuration.");
     }
     /*$jxbot = array();
     		require_once($config_file);
     		JxBotConfig::$config = $jxbot;
     		
     		if (!isset($jxbot['bot_url']))
     			JxBot::fatal_error("Bot configuraton is missing bot_url.");*/
     /*if (isset($jxbot['debug']) && $jxbot['debug']) 
     		{
     			// PHP debugging for the program; distinct from AIML debugging
     			error_reporting(E_ALL);
     			ini_set('display_errors', 1);
     		}*/
     /*if (!isset($jxbot['db_host']))
     			JxBot::fatal_error("JxBot database not configured.");
     		if (!isset($jxbot['db_name']))
     			JxBot::fatal_error("JxBot database not configured.");
     		if (!isset($jxbot['db_prefix']))
     			$jxbot['db_prefix'] = '';
     		if (!isset($jxbot['db_username']))
     			JxBot::fatal_error("JxBot database not configured.");
     		if (!isset($jxbot['db_password']))
     			JxBot::fatal_error("JxBot database not configured.");
     		
     		JxBotDB::connect($jxbot['db_host'], $jxbot['db_name'], $jxbot['db_prefix'],
     			$jxbot['db_username'], $jxbot['db_password']);*/
     if (!JxBotConfig::try_connect_db()) {
         JxBot::fatal_error("Couldn't connect to database.");
     }
     JxBotConfig::load_configuration();
     JxBotConfig::$is_installed = true;
     date_default_timezone_set(JxBotConfig::option('bot_tz'));
 }
Пример #4
0
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.
*******************************************************************************/
if (!defined('JXBOT_ADMIN')) {
    die('Direct script access not permitted.');
}
?>
<p>A light-weight natural-language chat system based upon <a href="http://www.alicebot.org/aiml.html">Alice and AIML</a><br>
by <a href="http://joshhawcroft.org/">Joshua Hawcroft</a></p>

<p><strong>version <?php 
print JxBot::VERSION;
?>
</strong></p>

<h2>Acknowledgements</h2>

<p>The author would like to gratefully acknowledge the presence of and contributors to 
<a href="https://openclipart.org/">Open Clipart</a> - a public domain clipart library - without which the JxBot administration 
interface would have been extraordinarily dull.</p>

<p>My thanks to the authors of the two fonts used in the administration panel, Christian Robertson and Vernon Adams for making their fonts available under permissive open-source licenses.</p>

<p>Finally, no work of human ingenuity is built in isolation; I'd also like to thank everyone involved in the development of AIML to date, without which this project may not have come about.</p>


<div style="height: 10px;"></div>

<?php 
JxBotUtil::phpinfo();
Пример #5
0
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.
*******************************************************************************/
if (!defined('JXBOT_ADMIN')) {
    die('Direct script access not permitted.');
}
JxWidget::tabs(array(array('Talk', '?page=chat', 'subpage', ''), array('Defaults', '?page=chat&subpage=defaults', 'subpage', 'defaults'), array('Logs', '?page=chat&subpage=logs', 'subpage', 'logs')));
$subpage = JxBotUtil::inputs('subpage');
if ($subpage['subpage'] == 'defaults') {
    require_once 'admin_client.php';
} else {
    if ($subpage['subpage'] == 'logs') {
        require_once 'admin_logs.php';
    } else {
        $inputs = JxBotUtil::inputs('input');
        if (trim($inputs['input']) != '') {
            JxBotConverse::resume_conversation('admin');
            $response = JxBotConverse::get_response($inputs['input']);
        } else {
            $response = JxBotConverse::get_greeting();
        }
        ?>


<?php 
        JxWidget::textfield(array('name' => 'input', 'label' => 'Administrator', 'max' => 150, 'autofocus' => true));
        ?>


<p><?php 
Пример #6
0
}
.log-bl
{
	display: inline-block;
	width: 5em;
}
</style>


<div id="centre-content" style="float: left; max-width: 85%; margin-right: 2 em;">

<h2>Security Log</h2>


<?php 
$inputs = JxBotUtil::inputs('action');
if ($inputs['action'] == 'purge-log') {
    JxBotDB::$db->exec('TRUNCATE login');
}
JxWidget::hidden('subpage', 'logs');
$stmt = JxBotDB::$db->prepare('SELECT note,username,stamp FROM login ORDER BY id DESC');
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_NUM);
if (count($rows) == 0) {
    print '<p>No data to display.</p>';
} else {
    print '<div class="log">';
    foreach ($rows as $row) {
        print $row[0] . ' ' . $row[1];
        print '<br>';
    }
Пример #7
0
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.
*******************************************************************************/
if (!defined('JXBOT_ADMIN')) {
    die('Direct script access not permitted.');
}
JxWidget::tabs(array(array('General', '?page=bot', 'subpage', ''), array('Predicates', '?page=bot&subpage=pred', 'subpage', 'pred')));
$subpage = JxBotUtil::inputs('subpage');
if ($subpage['subpage'] == 'pred') {
    require_once 'admin_bot_pred.php';
} else {
    if (isset($_POST['bot_name'])) {
        //JxBotConfig::set_option('bot_name', $_POST['bot_name']);
        foreach ($_POST as $key => $value) {
            if (substr($key, 0, 4) == 'bot_') {
                JxBotConfig::set_option($key, $value);
            }
        }
        JxBotConfig::save_configuration();
    }
    ?>

<p><div class="field"><label for="bot_name">Bot Name: </label>
Пример #8
0
function page_edit_tmpl()
{
    $inputs = JxBotUtil::inputs('template');
    $template = JxBotNLData::template_fetch($inputs['template']);
    ?>

<?php 
    JxWidget::hidden('category', $template['category']);
    JxWidget::hidden('tmpl-id', $template['id']);
    ?>

<h2>Edit Template</h2>

<p><?php 
    JxWidget::memofield('template', 'Template', $template['template'], 5, true);
    ?>
</p>


<p><?php 
    JxWidget::button('Cancel', 'action', 'edit');
    ?>
 <?php 
    JxWidget::button('Save Template', 'action', 'save-tmpl');
    ?>
</p>

<?php 
}
Пример #9
0
 public static function generate()
 {
     $inputs = JxBotUtil::inputs('page,action');
     $page = $inputs['page'];
     if ($page == '') {
         $page = 'welcome';
     }
     $msgs = '';
     if ($inputs['action'] == 'install') {
         $page = JxBotInstaller::do_install($msgs);
     }
     JxBotInstaller::installer_head();
     if ($page == 'welcome') {
         JxBotInstaller::page_welcome($msgs);
     } else {
         if ($page == 'configure') {
             JxBotInstaller::page_configure();
         } else {
             if ($page == 'error') {
                 JxBotInstaller::page_error($msgs);
             } else {
                 if ($page == 'manual') {
                     JxBotInstaller::page_manual();
                 } else {
                     if ($page == 'complete') {
                         JxBotInstaller::page_complete();
                     }
                 }
             }
         }
     }
     JxBotInstaller::installer_foot();
 }
Пример #10
0
    public static function check_and_login()
    {
        $inputs = JxBotUtil::inputs('username,password');
        /* check the user hasn't logged in too often recently */
        $stmt = JxBotDB::$db->prepare('SELECT COUNT(*) FROM login
			WHERE stamp > DATE_SUB(NOW(), INTERVAL 1 MINUTE)
				AND username=?');
        $stmt->execute(array($inputs['username']));
        $recent_logins = intval($stmt->fetchAll(PDO::FETCH_NUM)[0][0]);
        if ($recent_logins > 5) {
            return false;
        }
        /* are credentials wrong? */
        if (JxBotConfig::option('admin_user') != $inputs['username'] || JxBotConfig::option('admin_hash') != hash('sha256', $inputs['password'])) {
            $stmt = JxBotDB::$db->prepare('INSERT INTO login
				(username, note) VALUES (?, ?)');
            $stmt->execute(array($inputs['username'], 'failure'));
            return false;
        }
        /* do the login */
        $_SESSION['jxbot-admin'] = 1;
        $stmt = JxBotDB::$db->prepare('INSERT INTO login
			(username, note) VALUES (?, ?)');
        $stmt->execute(array($inputs['username'], 'success'));
        $_SESSION['jxbot-last'] = time();
        /* generate the admin page */
        JxBotAdmin::admin_generate();
        return true;
    }