$prefix = $focus->get_config_prefix($key); if (in_array($prefix[0], $focus->config_categories)) { if ($prefix[0] == "license") { if ($prefix[1] == "expire_date") { global $timedate; $val = $timedate->swap_formats($val, $timedate->get_date_format(), $timedate->dbDayFormat); } else { if ($prefix[1] == "key") { $val = trim($val); // bug 16860 tyoung - trim whitespace from the start and end of the licence key value } } } $focus->saveSetting($prefix[0], $prefix[1], $val); } } if (isset($_POST['license_key'])) { loadLicense(true); check_now(get_sugarbeat()); } unset($_SESSION['license_seats_needed']); unset($_SESSION['LICENSE_EXPIRES_IN']); unset($_SESSION['VALIDATION_EXPIRES_IN']); unset($_SESSION['HomeOnly']); apiLoadSystemStatus(true); // Lock down access to the application for sidecar modules until // we have a license validation available. if (!authenticateDownloadKey() && !ocLicense()) { $_SESSION['HomeOnly'] = true; } header("Location: index.php?action={$_POST['return_action']}&module={$_POST['return_module']}");
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 }