コード例 #1
0
ファイル: swekey_json_server.php プロジェクト: pkarecki/lms
$CONFIG['directories']['modules_dir'] = !isset($CONFIG['directories']['modules_dir']) ? $CONFIG['directories']['sys_dir'] . '/modules' : $CONFIG['directories']['modules_dir'];
define('SYS_DIR', $CONFIG['directories']['sys_dir']);
define('LIB_DIR', $CONFIG['directories']['lib_dir']);
define('MODULES_DIR', $CONFIG['directories']['modules_dir']);
// Load autloader
require_once LIB_DIR . '/autoloader.php';
// Init database
$DB = null;
try {
    $DB = LMSDB::getInstance();
} catch (Exception $ex) {
    trigger_error($ex->getMessage(), E_USER_WARNING);
    // can't working without database
    die("Fatal error: cannot connect to database!\n");
}
// Include required files
require_once LIB_DIR . '/language.php';
// Initialize Session, Auth and LMS classes
$SESSION = new Session($DB, ConfigHelper::getConfig('phpui.timeout'));
$AUTH = new Auth($DB, $SESSION);
$LMS = new LMS($DB, $AUTH);
$LMS->lang = $_language;
// Initialize Swekey class
require_once LIB_DIR . '/swekey/lms_integration.php';
if (session_id() == '') {
    session_start();
}
$JSON_SWEKEY = new LmsSwekeyIntegration($DB, $AUTH, $LMS);
$result = $JSON_SWEKEY->AjaxHandler($_POST);
echo json_encode($result);
exit;
コード例 #2
0
ファイル: index.php プロジェクト: oswida/lms
}
// Initialize Session, Auth and LMS classes
$SESSION = new Session($DB, ConfigHelper::getConfig('phpui.timeout'));
$AUTH = new Auth($DB, $SESSION, $SYSLOG);
if ($SYSLOG) {
    $SYSLOG->SetAuth($AUTH);
}
$LMS = new LMS($DB, $AUTH, $SYSLOG);
$LMS->ui_lang = $_ui_language;
$LMS->lang = $_language;
$plugin_manager = new LMSPluginManager();
$LMS->setPluginManager($plugin_manager);
// Initialize Swekey class
if (ConfigHelper::checkConfig('phpui.use_swekey')) {
    require_once LIB_DIR . '/swekey/lms_integration.php';
    $LMS_SWEKEY = new LmsSwekeyIntegration($DB, $AUTH, $LMS);
    $SMARTY->assign('lms_swekey', $LMS_SWEKEY->GetIntegrationScript($AUTH->id));
}
// Set some template and layout variables
$SMARTY->setTemplateDir(null);
$custom_templates_dir = ConfigHelper::getConfig('phpui.custom_templates_dir');
if (!empty($custom_templates_dir) && file_exists(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir) && !is_file(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir)) {
    $SMARTY->AddTemplateDir(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir);
}
$SMARTY->AddTemplateDir(array(SMARTY_TEMPLATES_DIR . '/default', SMARTY_TEMPLATES_DIR));
$SMARTY->setCompileDir(SMARTY_COMPILE_DIR);
$SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug');
$layout['logname'] = $AUTH->logname;
$layout['logid'] = $AUTH->id;
$layout['lmsdbv'] = $DB->GetVersion();
$layout['smarty_version'] = SMARTY_VERSION;