$admin_option_defs['Administration']['password_management'] = array('Password', 'LBL_MANAGE_PASSWORD_TITLE', 'LBL_MANAGE_PASSWORD', './index.php?module=Administration&action=PasswordManager');
$admin_group_header[] = array('LBL_USERS_TITLE', '', false, $admin_option_defs, 'LBL_USERS_DESC');
//Sugar Connect
$admin_option_defs = array();
$license_key = 'no_key';
$admin_option_defs['Administration']['support'] = array('Support', 'LBL_SUPPORT_TITLE', 'LBL_SUPPORT', './index.php?module=Administration&action=SupportPortal&view=support_portal');
//$admin_option_defs['documentation']= array('OnlineDocumentation','LBL_DOCUMENTATION_TITLE','LBL_DOCUMENTATION','./index.php?module=Administration&action=SupportPortal&view=documentation&help_module=Administration&edition='.$sugar_flavor.'&key='.$server_unique_key.'&language='.$current_language);
$admin_option_defs['Administration']['update'] = array('sugarupdate', 'LBL_SUGAR_UPDATE_TITLE', 'LBL_SUGAR_UPDATE', './index.php?module=Administration&action=Updater');
$admin_option_defs['Administration']['documentation'] = array('OnlineDocumentation', 'LBL_DOCUMENTATION_TITLE', 'LBL_DOCUMENTATION', 'javascript:void window.open("index.php?module=Administration&action=SupportPortal&view=documentation&help_module=Administration&edition=' . $sugar_flavor . '&key=' . $server_unique_key . '&language=' . $current_language . '", "helpwin","width=600,height=600,status=0,resizable=1,scrollbars=1,toolbar=0,location=0")');
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)) {
                $admin_option_defs['Administration']['update'][] = 'red';
                if (!isset($admin_option_defs['Administration']['update']['additional_label'])) {
                    $admin_option_defs['Administration']['update']['additional_label'] = '(' . $version['version'] . ')';
                }
            }
        }
    }
}
$admin_group_header[] = array('LBL_SUGAR_NETWORK_TITLE', '', false, $admin_option_defs, 'LBL_SUGAR_NETWORK_DESC');
//system.
$admin_option_defs = array();
$admin_option_defs['Administration']['configphp_settings'] = array('Administration', 'LBL_CONFIGURE_SETTINGS_TITLE', 'LBL_CONFIGURE_SETTINGS', './index.php?module=Configurator&action=EditView');
$admin_option_defs['Administration']['import'] = array('Import', 'LBL_IMPORT_WIZARD', 'LBL_IMPORT_WIZARD_DESC', './index.php?module=Import&action=step1&import_module=Administration');
$admin_option_defs['Administration']['locale'] = array('Currencies', 'LBL_MANAGE_LOCALE', 'LBL_LOCALE', './index.php?module=Administration&action=Locale&view=default');
if (!defined('TEMPLATE_URL')) {
示例#2
0
function matchPackageVersion($version, $versions)
{
    // Make sure everything is lowercase and clean of spaces and unpleasant history.
    $version = str_replace(array(' ', '2.0rc1-1'), array('', '2.0rc1.1'), strtolower($version));
    $versions = explode(',', str_replace(array(' ', '2.0rc1-1'), array('', '2.0rc1.1'), strtolower($versions)));
    // Perhaps we do accept anything?
    if (in_array('all', $versions)) {
        return true;
    }
    // Loop through each version.
    foreach ($versions as $for) {
        // Wild card spotted?
        if (strpos($for, '*') !== false) {
            $for = str_replace('*', '0dev0', $for) . '-' . str_replace('*', '999', $for);
        }
        // Do we have a range?
        if (strpos($for, '-') !== false) {
            list($lower, $upper) = explode('-', $for);
            // Compare the version against lower and upper bounds.
            if (compareVersions($version, $lower) > -1 && compareVersions($version, $upper) < 1) {
                return true;
            }
        } elseif (compareVersions($version, $for) === 0) {
            return true;
        }
    }
    return false;
}
 /**
  * @dataProvider versionProvider
  * @group 46317
  */
 function testCompareVersions($last_version, $current_version, $expectedResult)
 {
     $this->assertEquals($expectedResult, compareVersions($last_version, $current_version), "Current version: {$current_version}, last available version: {$last_version}");
 }
示例#4
0
function check_now($send_usage_info = true, $get_request_data = false, $response_data = false, $from_install = false)
{
    global $sugar_config, $timedate;
    global $db, $license;
    include 'sugar_version.php';
    $return_array = array();
    if (!$from_install && empty($license)) {
        loadLicense(true);
    }
    if (!$response_data) {
        if ($from_install) {
            $info = getBaseSystemInfo(false);
        } else {
            $info = getSystemInfo($send_usage_info);
        }
        require_once 'include/nusoap/nusoap.php';
        $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
        $sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
        $ping = $sclient->call('sugarPing', array());
        if (empty($ping) || $sclient->getError()) {
            if (!$get_request_data) {
                return array(array('version' => $sugar_version, 'description' => "You have the latest version."));
            }
        }
        $key = '4829482749329';
        $encoded = sugarEncode($key, serialize($info));
        if ($get_request_data) {
            $request_data = array('key' => $key, 'data' => $encoded);
            return serialize($request_data);
        }
        $encodedResult = $sclient->call('sugarHome', array('key' => $key, 'data' => $encoded));
    } else {
        $encodedResult = $response_data['data'];
        $key = $response_data['key'];
    }
    if ($response_data || !$sclient->getError()) {
        $serializedResultData = sugarDecode($key, $encodedResult);
        $resultData = unserialize($serializedResultData);
        if ($response_data && empty($resultData)) {
            $resultData = array();
            $resultData['validation'] = 'invalid validation key';
        }
    } else {
        $resultData = array();
        $resultData['versions'] = array();
    }
    if ($response_data || !$sclient->getError()) {
        if (!empty($resultData['msg'])) {
            if (!empty($resultData['msg']['admin'])) {
                $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
            } else {
                $license->saveSetting('license', 'msg_admin', '');
            }
            if (!empty($resultData['msg']['all'])) {
                $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
            } else {
                $license->saveSetting('license', 'msg_all', '');
            }
        } else {
            $license->saveSetting('license', 'msg_admin', '');
            $license->saveSetting('license', 'msg_all', '');
        }
        $license->saveSetting('license', 'last_validation', 'success');
        unset($_SESSION['COULD_NOT_CONNECT']);
    } else {
        $resultData = array();
        $resultData['versions'] = array();
        $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
        $license->saveSetting('license', 'last_validation', 'no_connection');
        if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) {
            $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
            $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified' => false))));
        }
        $_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb();
    }
    if (!empty($resultData['versions'])) {
        $license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions'])));
    } else {
        $resultData['versions'] = array();
        $license->saveSetting('license', 'latest_versions', '');
    }
    if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) && compareVersions($sugar_version, $resultData['versions'][0]['version'])) {
        $resultData['versions'][0]['version'] = $sugar_version;
        $resultData['versions'][0]['description'] = "You have the latest version.";
    }
    return $resultData['versions'];
}
示例#5
0
function check_now($send_usage_info = true, $get_request_data = false, $response_data = false, $from_install = false)
{
    global $sugar_config, $timedate;
    global $db, $license;
    // 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 (ocLicense()) {
        return array();
    }
    // END REQUIRED CODE
    $return_array = array();
    if (!$from_install && empty($license)) {
        loadLicense(true);
    }
    if (!$response_data) {
        $systemInfo = SugarSystemInfo::getInstance();
        SugarAutoLoader::requireWithCustom('include/SugarHeartbeat/SugarHeartbeatClient.php', true);
        $sclientClass = SugarAutoLoader::customClass('SugarHeartbeatClient');
        $sclient = new $sclientClass();
        if ($from_install) {
            $info = $systemInfo->getBaseInfo();
        } else {
            $info = $systemInfo->getInfo();
        }
        // 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 (!empty($license->settings['license_key'])) {
            $key = $license->settings['license_key'];
        } else {
            //END REQUIRED CODE
            $key = '4829482749329';
        }
        $encoded = sugarEncode($key, serialize($info));
        if ($get_request_data) {
            $request_data = array('key' => $key, 'data' => $encoded);
            return serialize($request_data);
        }
        $encodedResult = $sclient->sugarHome($key, $info);
    } else {
        $encodedResult = $response_data['data'];
        $key = $response_data['key'];
    }
    if ($response_data || !$sclient->getError()) {
        $serializedResultData = sugarDecode($key, $encodedResult);
        $resultData = unserialize($serializedResultData);
        if ($response_data && empty($resultData)) {
            $resultData = array();
            $resultData['validation'] = 'invalid validation key';
        }
    } else {
        $resultData = array();
        $resultData['versions'] = array();
    }
    if (!isset($resultData['validation'])) {
        $resultData['validation'] = 'invalid';
    }
    if ($response_data || !$sclient->getError()) {
        // 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.
        checkDownloadKey($resultData['validation']);
        //END REQUIRED CODE
        if (!empty($resultData['msg'])) {
            if (!empty($resultData['msg']['admin'])) {
                $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
            } else {
                $license->saveSetting('license', 'msg_admin', '');
            }
            if (!empty($resultData['msg']['all'])) {
                $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
            } else {
                $license->saveSetting('license', 'msg_all', '');
            }
        } else {
            $license->saveSetting('license', 'msg_admin', '');
            $license->saveSetting('license', 'msg_all', '');
        }
        $license->saveSetting('license', 'last_validation', 'success');
        unset($_SESSION['COULD_NOT_CONNECT']);
    } else {
        $resultData = array();
        $resultData['versions'] = array();
        $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
        $license->saveSetting('license', 'last_validation', 'no_connection');
        if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) {
            $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
            $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified' => false))));
        }
        $_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb();
    }
    if (!empty($resultData['versions'])) {
        $license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions'])));
    } else {
        $resultData['versions'] = array();
        $license->saveSetting('license', 'latest_versions', '');
    }
    include 'sugar_version.php';
    if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) && compareVersions($sugar_version, $resultData['versions'][0]['version'])) {
        $resultData['versions'][0]['version'] = $sugar_version;
        $resultData['versions'][0]['description'] = "You have the latest version.";
    }
    return $resultData['versions'];
}
<?php

require '../lib/util.php';
$update = "%%VERSION%%";
$clientVersion = $_GET['version'];
$compVal = compareVersions($update, $clientVersion);
if ($compVal == 1) {
    print "update";
} else {
    if ($compVal == -1) {
        print "you're ahead of the curve!";
    } else {
        print "you're up-to-date";
    }
}
示例#7
0
<?php

require '../lib/util.php';
print "{";
$crowdloggerVersion = array_key_exists('v', $_GET) ? $_GET['v'] : "2.0.1";
$first = true;
foreach (glob("*/metadata.json") as $filename) {
    $rawJSON = "";
    $f = fopen($filename, "r");
    while ($line = fgets($f)) {
        $rawJSON .= $line;
    }
    fclose($f);
    $parsedJSON = json_decode($rawJSON, true);
    $minCLVersion = array_key_exists('minCLVersion', $parsedJSON) ? $parsedJSON['minCLVersion'] : "0";
    // Check if the CLRM is okay for the given CrowdLogger version.
    if (compareVersions($crowdloggerVersion, $minCLVersion) < 0) {
        continue;
    }
    if ($first) {
        $first = false;
    } else {
        print ",";
    }
    print "\"{$parsedJSON["clrmid"]}\": {$rawJSON}";
}
print "}";