/** * Login to the depot * * @return true if successful, false otherwise */ function login($terms_checked = true) { if (empty($_SESSION['SugarDepotSessionID'])) { global $license; $GLOBALS['log']->debug("Begin SugarDepot Login"); PackageManagerComm::initialize(false); require 'sugar_version.php'; require 'config.php'; $credentials = PackageManager::getCredentials(); if (empty($license)) { loadLicense(); } $info = sugarEncode('2813', serialize(getSystemInfo(true))); $pm = new PackageManager(); $installed = $pm->buildInstalledReleases(); $installed = base64_encode(serialize($installed)); $params = array('installed_modules' => $installed, 'terms_checked' => $terms_checked, 'system_name' => $credentials['system_name']); $terms_version = !empty($_SESSION['SugarDepot_TermsVersion']) ? $_SESSION['SugarDepot_TermsVersion'] : ''; if (!empty($terms_version)) { $params['terms_version'] = $terms_version; } $result = $GLOBALS['SugarDepot']->call('depotLogin', array(array('user_name' => $credentials['username'], 'password' => $credentials['password']), 'info' => $info, 'params' => $params)); PackageManagerComm::errorCheck(); if (!is_array($result)) { $_SESSION['SugarDepotSessionID'] = $result; } $GLOBALS['log']->debug("End SugarDepot Login"); return $result; } else { return $_SESSION['SugarDepotSessionID']; } }
function loadLicense() { loadLicense(); global $user_unique_key, $server_unique_key; $user_unique_key = isset($_SESSION['unique_key']) ? $_SESSION['unique_key'] : ''; $server_unique_key = isset($sugar_config['unique_key']) ? $sugar_config['unique_key'] : ''; }
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']); } } } }
$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 }
$beat = true; } if ($beat != get_sugarbeat()) { set_sugarbeat($beat); } } echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", $mod_strings['LBL_SUGAR_UPDATE_TITLE']), false); if (get_sugarbeat()) { $xtpl->assign("SEND_STAT_CHECKED", "checked"); } if (get_CheckUpdates_config_setting() == 'automatic') { $xtpl->assign("AUTOMATIC_CHECKED", "checked"); } if (isset($_REQUEST['useraction']) && $_REQUEST['useraction'] == 'CheckNow') { check_now(get_sugarbeat()); loadLicense(); } /* $xtpl->parse('main.stats'); */ $has_updates = false; if (!empty($license->settings['license_latest_versions'])) { $encodedVersions = $license->settings['license_latest_versions']; $versions = unserialize(base64_decode($encodedVersions)); include 'sugar_version.php'; if (!empty($versions)) { foreach ($versions as $version) { if (compareVersions($version['version'], $sugar_version)) { $has_updates = true; $xtpl->assign("VERSION", $version);