Beispiel #1
0
function getVersionedPath($path, $additional_attrs = '', $time_modified = false)
{
    if (empty($GLOBALS['sugar_config']['js_custom_version'])) {
        $GLOBALS['sugar_config']['js_custom_version'] = 1;
    }
    if (!isset($GLOBALS['js_version_key'])) {
        $GLOBALS['js_version_key'] = get_js_version_key();
    }
    if (inDeveloperMode() || $time_modified) {
        if (file_exists($path)) {
            $timestamp = filemtime($path);
        } else {
            // if the file doesn't exists, it means it was deleted during cache rebuild
            // and will be regenerated in future.
            // we need to invalidate client side cache in order to make the client request the resource from server
            $timestamp = create_guid();
        }
        $dev = md5($timestamp);
    } else {
        $dev = '';
    }
    if (is_array($additional_attrs)) {
        $additional_attrs = join("|", $additional_attrs);
    }
    // cutting 2 last chars here because since md5 is 32 chars, it's always ==
    $str = substr(base64_encode(md5("{$GLOBALS['js_version_key']}|{$GLOBALS['sugar_config']['js_custom_version']}|{$dev}|{$additional_attrs}", true)), 0, -2);
    // remove / - it confuses some parsers
    $str = strtr($str, '/+', '-_');
    if (empty($path)) {
        return $str;
    }
    return $path . "?v={$str}";
}
Beispiel #2
0
     if (!empty($_COOKIE['PHPSESSID']) && strcmp($_GET['PHPSESSID'], $_COOKIE['PHPSESSID']) == 0) {
         session_id($_REQUEST['PHPSESSID']);
     } else {
         unset($_GET['PHPSESSID']);
     }
 }
 LogicHook::initialize()->call_custom_logic('', 'entry_point_variables_setting');
 if (!empty($sugar_config['session_dir'])) {
     session_save_path($sugar_config['session_dir']);
 }
 if (class_exists('SessionHandler')) {
     session_set_save_handler(new SugarSessionHandler());
 }
 $GLOBALS['sugar_version'] = $sugar_version;
 $GLOBALS['sugar_flavor'] = $sugar_flavor;
 $GLOBALS['js_version_key'] = get_js_version_key();
 SugarApplication::preLoadLanguages();
 $timedate = TimeDate::getInstance();
 $GLOBALS['timedate'] = $timedate;
 $db = DBManagerFactory::getInstance();
 $db->resetQueryCount();
 $locale = Localization::getObject();
 // Emails uses the REQUEST_URI later to construct dynamic URLs.
 // IIS does not pass this field to prevent an error, if it is not set, we will assign it to ''.
 if (!isset($_SERVER['REQUEST_URI'])) {
     $_SERVER['REQUEST_URI'] = '';
 }
 $current_user = BeanFactory::getBean('Users');
 $current_entity = null;
 $system_config = Administration::getSettings();
 LogicHook::initialize()->call_custom_logic('', 'after_entry_point');