Example #1
0
function loginLicense()
{
    global $current_user, $license, $authLevel;
    loadLicense(true);
    $authLevel = 0;
    if (shouldCheckSugar()) {
        $last_check_date = get_last_check_date_config_setting();
        $current_date_time = time();
        $time_period = 3 * 23 * 3600;
        if ($current_date_time - $last_check_date > $time_period) {
            $version = check_now(get_sugarbeat());
            unset($_SESSION['license_seats_needed']);
            loadLicense();
            set_last_check_date_config_setting("{$current_date_time}");
            include 'sugar_version.php';
            if (!empty($version) && count($version) == 1 && $version[0]['version'] > $sugar_version && is_admin($current_user)) {
                //set session variables.
                $_SESSION['available_version'] = $version[0]['version'];
                $_SESSION['available_version_description'] = $version[0]['description'];
                set_last_check_version_config_setting($version[0]['version']);
            }
        }
    }
}
Example #2
0
function loginLicense()
{
    global $current_user, $license;
    loadLicense(true);
    if (isset($_SESSION['EXCEEDS_MAX_USERS']) && $_SESSION['EXCEEDS_MAX_USERS'] == 1 || empty($license->settings['license_key']) || !empty($license->settings['license_last_validation']) && $license->settings['license_last_validation'] == 'failed' && !empty($license->settings['license_last_validation_fail']) && (empty($license->settings['license_last_validation_success']) || $license->settings['license_last_validation_fail'] > $license->settings['license_last_validation_success'])) {
        if (!is_admin($current_user)) {
            $GLOBALS['login_error'] = $GLOBALS['app_strings']['ERROR_LICENSE_VALIDATION'];
            $_SESSION['login_error'] = $GLOBALS['login_error'];
        } else {
            if (empty($license->settings['license_key'])) {
                $_SESSION['VALIDATION_EXPIRES_IN'] = 'REQUIRED';
            } else {
                $_SESSION['COULD_NOT_CONNECT'] = $license->settings['license_last_validation_fail'];
            }
        }
    }
    if (shouldCheckSugar()) {
        $last_check_date = get_last_check_date_config_setting();
        $current_date_time = time();
        $time_period = 3 * 23 * 3600;
        if ($current_date_time - $last_check_date > $time_period || empty($license->settings['license_last_validation_success'])) {
            $version = check_now(get_sugarbeat());
            unset($_SESSION['license_seats_needed']);
            unset($_SESSION['LICENSE_EXPIRES_IN']);
            unset($_SESSION['VALIDATION_EXPIRES_IN']);
            unset($_SESSION['HomeOnly']);
            loadLicense();
            set_last_check_date_config_setting("{$current_date_time}");
            include 'sugar_version.php';
            $newVersion = '';
            if (!empty($version) && count($version) == 1) {
                $newVersion = $version[0]['version'];
            }
            if (version_compare($newVersion, $sugar_version, '>') && is_admin($current_user)) {
                //set session variables.
                $_SESSION['available_version'] = $version[0]['version'];
                $_SESSION['available_version_description'] = $version[0]['description'];
                set_last_check_version_config_setting($version[0]['version']);
            }
        }
    }
    // This section of code is a portion of the code referred
    // to as Critical Control Software under the End User
    // License Agreement.  Neither the Company nor the Users
    // may modify any portion of the Critical Control Software.
    if (!authenticateDownloadKey() && !ocLicense()) {
        if (is_admin($current_user)) {
            $_SESSION['HomeOnly'] = true;
        } else {
            $_SESSION['login_error'] = $GLOBALS['app_strings']['ERROR_LICENSE_VALIDATION'];
            $GLOBALS['login_error'] = $GLOBALS['app_strings']['ERROR_LICENSE_VALIDATION'];
        }
    }
    //END REQUIRED CODE DO NOT MODIFY
}