コード例 #1
0
ファイル: admin_client.php プロジェクト: jhawcroft/jxbot
function editable_section(&$properties, $row_count)
{
    if (count($properties) == 0) {
        return;
    }
    print '<table>';
    for ($i = 0; $i < $row_count; $i++) {
        $prop = array_shift($properties);
        if ($prop === null) {
            break;
        }
        print '<tr>';
        print '<td style="width: 10em;">' . $prop[1] . '</td>';
        print '<td><input type="text" name="' . $prop[0] . '" size="20" value="' . $prop[2] . '" style="width:95%"></td>';
        print '<td style="width: 1.5em;"><a href="?del-name=' . $prop[0] . '&page=chat&subpage=defaults">';
        JxWidget::small_delete_icon();
        print '</a></td>';
        print '</tr>';
    }
    print '</table>';
}
コード例 #2
0
ファイル: admin_logs.php プロジェクト: jhawcroft/jxbot
<div class="right" id="right-nav">

<h2>Recent Conversations</h2>

<?php 
if (isset($_REQUEST['purge-old'])) {
    purge_old_logs();
}
?>
<p><button type="submit" name="purge-old" value="month">Purge Old Log Entries</button></p>


<?php 
$sessions = JxBotConverse::latest_sessions();
JxWidget::grid(array(array('id' => 0, 'visible' => false, 'key' => true), array('id' => 1, 'label' => 'Client', 'link' => '?page=chat&subpage=logs&convo=$$')), $sessions);
?>


</div>

<div id="centre-content">
<h2>Transcript</h2>

<style type="text/css">
.log
{
	line-height: 1.7em;
}
.log-cl
{
コード例 #3
0
ファイル: admin_dashboard.php プロジェクト: jhawcroft/jxbot
	<tr>
		<td>Lifetime Interactions</td>
		<td><?php 
print $metrics['interaction_count'];
?>
</td>
	</tr>
	</table>
</div>


<div class="dashboard-widget">
<h2>Active Load</h2>

<p><?php 
JxWidget::dynamic_meter(200, $metrics['active_load']);
?>
</p>

	<table class="dashboard-stats">
	<tr>
		<td>Current Clients</td>
		<td><?php 
print $metrics['active_clients'];
?>
</td>
	</tr>
	<tr>
		<td>Average Response Time</td>
		<td><?php 
if ($metrics['active_clients'] > 0) {
コード例 #4
0
ファイル: admin_chat.php プロジェクト: jhawcroft/jxbot
        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 
        JxWidget::button('Talk');
        ?>
</p>


<div class="left">
<img src="<?php 
        print JxBotConfig::bot_url();
        ?>
jxbot/core/gfx/robot-small.png" id="chat-robot">
</div>


<div class="bubble" style="max-width: 80%;">
<div class="bubble-top"><div class="bubble-corner-tl"></div><div class="bubble-corner-tr"></div></div>
<div class="bubble-left"></div>
コード例 #5
0
ファイル: admin_sys_log.php プロジェクト: jhawcroft/jxbot
	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>';
    }
    print '</div>';
}
?>
</div>
コード例 #6
0
ファイル: admin_sets.php プロジェクト: jhawcroft/jxbot
function list_items($in_set)
{
    $stmt = JxBotDB::$db->prepare('SELECT name FROM _set WHERE id=?');
    $stmt->execute(array($in_set));
    $row = $stmt->fetchAll(PDO::FETCH_NUM);
    print '<h2>' . $row[0][0] . '</h2>';
    JxWidget::hidden('subpage', 'sets');
    JxWidget::hidden('set', $in_set);
    $stmt = JxBotDB::$db->prepare('SELECT id,phrase FROM set_item WHERE id=? ORDER BY phrase');
    $stmt->execute(array($in_set));
    $items = $stmt->fetchAll(PDO::FETCH_NUM);
    JxWidget::grid(array(array('label' => 'Phrase', 'id' => 1, 'key' => true), array('label' => 'Delete', 'id' => ':delete', 'link' => '?page=database&subpage=sets&action=delete-item&item=$$')), $items);
    print '<p><input type="text" size="30" name="item-phrase"> <button type="submit" name="action" value="new-item">Add Item</button></p>';
}
コード例 #7
0
ファイル: admin_sys_opts.php プロジェクト: jhawcroft/jxbot
?>

<h2>Setup</h2>

<div class="field"><label for="bot_tz">Timezone: </label>
<?php 
JxBotConfig::widget_timezone();
?>
</div>


<h2>Language Processing</h2>

<div class="field"><label for="pre_strip_accents">Strip Accents:</label>
<?php 
JxWidget::toggle_switch('pre_strip_accents', JxBotConfig::option('pre_strip_accents'));
?>
<br><small>(strip accents during normalisation; good for English)</small></div>


<h2>Security</h2>

<div class="field"><label for="sys_cap_bot_ipm">Bot Load Maximum: </label>
<input type="text" name="sys_cap_bot_ipm" id="sys_cap_bot_ipm" size="6" value="<?php 
print JxBotConfig::option('sys_cap_bot_ipm');
?>
"><br><small>(interactions per minute; 0 = unlimited)</small></div>

<div class="field"><label for="admin_timeout">Administration Timeout: </label>
<input type="text" name="admin_timeout" id="admin_timeout" size="6" value="<?php 
print JxBotConfig::option('admin_timeout');
コード例 #8
0
ファイル: admin_bot.php プロジェクト: jhawcroft/jxbot
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.
*******************************************************************************/
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();
    }
    ?>
コード例 #9
0
ファイル: admin_database.php プロジェクト: jhawcroft/jxbot
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 
}
コード例 #10
0
ファイル: admin_system.php プロジェクト: jhawcroft/jxbot
                JxBotConfig::set_option('bot_active', $_POST['bot_active']);
                //JxBotConfig::set_option('pre_strip_accents', $_POST['pre_strip_accents']);
                //JxBotConfig::set_option('sys_cap_bot_ipm', $_POST['sys_cap_bot_ipm']);
                JxBotConfig::set_option('admin_user', $_POST['admin_user']);
                //JxBotConfig::set_option('admin_timeout', intval($_POST['admin_timeout']));
                if (isset($_POST['bot_password']) && trim($_POST['bot_password']) !== '') {
                    JxBotConfig::set_option('admin_hash', hash('sha256', $_POST['bot_password']));
                }
                JxBotConfig::save_configuration();
            }
            ?>


<div class="field"><label for="bot_active">Online:</label>
<?php 
            JxWidget::toggle_switch('bot_active', JxBotConfig::option('bot_active'));
            ?>
</div>


<div class="field"><label for="admin_user">Administration Username: </label>
<input type="text" name="admin_user" id="admin_user" size="20" value="<?php 
            print JxBotConfig::option('admin_user');
            ?>
"></div>

<div class="field"><label for="bot_password">Change Password: </label>
<input type="text" name="bot_password" id="bot_password" size="20"></div>


コード例 #11
0
ファイル: install.php プロジェクト: jhawcroft/jxbot
    private static function page_manual()
    {
        $inputs = JxBotUtil::inputs('db_host,db_name,db_prefix,db_username,db_password,bot_tz,bot_name,admin_password');
        JxWidget::hidden($inputs, 'db_host,db_name,db_prefix,db_username,db_password,admin_password');
        ?>
<h1>Manual Configuration Required</h1>

<p>Sorry, JxBot does not have permission to write the configuration file.  You will need to create the file <strong>config.php</strong> in the <strong>jxbot</strong> folder of your installation.</p>

<p>Copy and paste the database configuration settings from this window your configuration file.</p>

<blockquote>
<?php 
        print nl2br(htmlentities(JxBotInstaller::get_configuration()));
        ?>
</blockquote>

<p>When you're done, you can continue the installation.</p>
 

<p class="right"><button type="submit" name="action" value="install">Install</button></p>

<?php 
    }
コード例 #12
0
ファイル: admin_import.php プロジェクト: jhawcroft/jxbot
function show_server_files()
{
    $list = server_file_list();
    ?>
<table style="width: auto; min-width: 27em;">
<tr>
	<th>File</th>
	<th style="width: 7em;">Status</th>
	<th style="width: 1.5em;"></th>
	<th style=""></th>
</tr>
<?php 
    foreach ($list as $file) {
        print '<tr>';
        print '<td>' . basename($file[1], '.aiml') . '</td>';
        if ($file[2] == 'Loaded') {
            $color = ' class="green"';
        } else {
            if ($file[2] == 'Load Error') {
                $color = ' class="red"';
            } else {
                $color = '';
            }
        }
        print '<td' . $color . '>' . $file[2] . '</td>';
        print '<td><a href="?page=import&action=delete-file&file=' . $file[1] . '">';
        JxWidget::small_delete_icon();
        print '</a></td>';
        print '<td>';
        if (substr($file[2], 0, 7) != 'Loading') {
            print '<button type="submit" name="action" value="file-toggle-' . $file[1] . '">';
            if ($file[2] == 'Loaded') {
                print 'Unload';
            } else {
                print 'Load';
            }
            print '</button>';
        }
        print '</td>';
        print '</tr>';
    }
    ?>
</table>
<?php 
}
コード例 #13
0
ファイル: admin_maps.php プロジェクト: jhawcroft/jxbot
function list_items($in_map)
{
    $stmt = JxBotDB::$db->prepare('SELECT name FROM _map WHERE id=?');
    $stmt->execute(array($in_map));
    $row = $stmt->fetchAll(PDO::FETCH_NUM);
    print '<h2>' . $row[0][0] . '</h2>';
    JxWidget::hidden('subpage', 'maps');
    JxWidget::hidden('map', $in_map);
    $stmt = JxBotDB::$db->prepare('SELECT id,s_from,s_to FROM map_item WHERE map=? ORDER BY s_from');
    $stmt->execute(array($in_map));
    $items = $stmt->fetchAll(PDO::FETCH_NUM);
    JxWidget::grid(array(array('label' => 'ID', 'id' => 0, 'key' => true, 'visible' => false), array('label' => 'From', 'id' => 1, 'whitespace' => 'preserve'), array('label' => 'To', 'id' => 2, 'whitespace' => 'preserve'), array('label' => 'Delete', 'id' => ':delete', 'link' => '?page=database&subpage=maps&action=delete-item&item=$$')), $items);
    print '<p><input type="text" size="30" name="item-from"> : <input type="text" size="30" name="item-to"> <button type="submit" name="action" value="new-item">Add Item</button></p>';
}
コード例 #14
0
ファイル: admin.php プロジェクト: jhawcroft/jxbot
    public static function admin_page()
    {
        ?>
<h1><?php 
        print JxBotAdmin::$page[1];
        ?>
</h1>
<form method="post" action="" name="admin-form" id="admin-form" enctype="multipart/form-data">
<?php 
        JxWidget::$form_id = 'admin-form';
        ?>

<?php 
        require_once dirname(__FILE__) . '/admin_' . JxBotAdmin::$page[0] . '.php';
        ?>

</form>
<?php 
    }