Ejemplo n.º 1
0
            /** If there isn't a language in the session, use the default system language*/
            require_once $path . "language/lang-" . $GLOBALS['configuration']['default_language'] . ".php.inc";
            $setLanguage = $GLOBALS['configuration']['default_language'];
        } else {
            //If there isn't neither a session language, or a default language in the configuration, use english by default
            require_once $path . "language/lang-english.php.inc";
            $setLanguage = "english";
        }
    }
}
if (G_VERSIONTYPE != 'community') {
    #cpp#ifndef COMMUNITY
    if (G_VERSIONTYPE != 'standard') {
        #cpp#ifndef STANDARD
        //Apply Ip-based check
        if (!eF_checkIP()) {
            echo EfrontSystem::printErrorMessage(_CANNOTACCESSIPBAN . ': ' . $_SERVER['REMOTE_ADDR']);
            exit;
        }
    }
    #cpp#endif
}
#cpp#endif
//Set locale settings
//Replaced setlocale(LC_x) with LC_ALL so that international filenames work correctly (since basename() depends on current locale)
//setlocale(LC_COLLATE, _HEADERLANGUAGETAG);
//setlocale(LC_CTYPE, _HEADERLANGUAGETAG);
//setlocale(LC_MONETARY, _HEADERLANGUAGETAG);
//setlocale(LC_TIME, _HEADERLANGUAGETAG);
setlocale(LC_ALL, _HEADERLANGUAGETAG);
//Don't set LC_ALL, as this will set the LC_NUMERIC as well, which will automatically convert dots to commas if in greek
Ejemplo n.º 2
0
/api2.php?token=<token>&action=buy_course&login=<user_login>&course=<course_id>
/api2.php?token=<token>&action=get_user_autologin_key&login=<user_login>&password=<user_password>
/api2.php?token=<token>&action=set_user_autologin_key&login=<user_login>
/api2.php?token=<token>&action=languages
/api2.php?token=<token>&action=user_to_branch&login=<user_login>&branch=<branch_id>&job=<job_id>&position=<position>&job_description=<job_description>
/api2.php?token=<token>&action=branch_jobs&branch=<branch_id>
/api2.php?action=create_course&token=<token>&name=<course_name>&directions_ID=<direction_id>&languages_NAME=<language_name>&active=<active>&show_catalog=<show_catalog>&recurring=<recurring>&branches_ID=<branches_ID>&duration=<duration>&max_users=<max_users>&training_hours=<training_hours>&ceu=<ceu>
 * 
API returns xml corresponding to the action argument. For actions like efrontlogin, activate_user etc it returns a status entity ("ok" or "error").
In case of error it returns also a message entity with description of the error occured.
*/
$path = "../libraries/";
require_once $path . "configuration.php";
header("content-type:application/xml");
//error_reporting(E_ALL);
if ($GLOBALS['configuration']['api'] && eF_checkIP('api')) {
    if (isset($_GET['action'])) {
        switch ($_GET['action']) {
            case 'token':
                $token = createToken(30);
                if (strlen($token) == 30) {
                    $insert['token'] = $token;
                    $insert['status'] = "unlogged";
                    $insert['expired'] = 0;
                    $insert['create_timestamp'] = time();
                    try {
                        $period = time() - 10 * 24 * 60 * 60;
                        eF_deleteTableData("tokens", "create_timestamp < " . $period);
                        //delete all old tokens
                        eF_insertTableData("tokens", $insert);
                        echo "<xml>";