示例#1
0
文件: index.php 项目: jhawcroft/jxbot
/*******************************************************************************
JxBot - conversational agent for the web
Copyright (c) 2015 Joshua Hawcroft

    May all beings have happiness and the cause of happiness.
    May all beings be free of suffering and the cause of suffering.
    May all beings rejoice in the happiness of others.
    May all beings abide in equanimity; free of attachment and delusion.

Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), to deal in 
the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so, 
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.
*******************************************************************************/
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once dirname(__FILE__) . '/core/jxbot.php';
JxBot::run_admin();
示例#2
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'));
 }
示例#3
0
 public static function init()
 {
     JxBot::init_client();
 }