}
 }
 if (isset($fw_dynamic['valid_duration'])) {
     $valid_duration = $fw_dynamic['valid_duration'];
 }
 $dynamic_data_has_expired = $new_timestamp > $old_timestamp + $valid_duration;
 if ($dynamic_data_has_expired) {
     $fw_dynamic['_ctrl']['timestamp'] = $new_timestamp;
     $dyn_data = get_dyn_pois($fw_dynamic);
     // obtain external dynamic data
     // Avoid garbling dynamic definitions!
     if (isset($dyn_data['fw_dynamic'])) {
         unset($dyn_data['fw_dynamic']);
     }
     // merge dynamic data to static data
     $data[$uuid] = array_merge_r($data[$uuid], $dyn_data);
     // fw_dynamic must be updated due to _ctrl.timestamp
     if (!in_array('fw_dynamic', $comps_to_update)) {
         $comps_to_update[] = 'fw_dynamic';
     }
     // Update dynamic data in the POI data
     $comps_to_update = array_merge($comps_to_update, array_keys($dyn_data));
 }
 // end if data expired
 foreach ($comps_to_update as $comp_name) {
     if (in_array($comp_name, $dyn_comp_names) || $comp_name == 'fw_dynamic') {
         if ($comp_name == "fw_core") {
             // fw_core has changed
             // However, don't update, if the place is lost
             if (isset($dyn_data['fw_core']['location'])) {
                 $location = $dyn_data['fw_core']['location'];
function &array_merge_r(array &$array1, &$array2 = null)
{
    $merged = $array1;
    if (is_array($array2)) {
        foreach ($array2 as $key => $val) {
            if (is_array($val)) {
                $merged[$key] = isset($merged[$key]) && is_array($merged[$key]) ? array_merge_r($merged[$key], $val) : $val;
            } else {
                $merged[$key] = $val;
            }
        }
    }
    return $merged;
}
Beispiel #3
0
/**
 * Recursive array merge function
 * 
 * @return array	Merged array
 */
function array_merge_r()
{
    if (func_num_args() < 2) {
        trigger_error(__FUNCTION__ . ' needs two or more array arguments', E_USER_WARNING);
        return;
    }
    $arrays = func_get_args();
    $merged = array();
    while ($arrays) {
        $array = array_shift($arrays);
        if (!is_array($array)) {
            trigger_error(__FUNCTION__ . ' encountered a non array argument', E_USER_WARNING);
            return;
        }
        if (!$array) {
            continue;
        }
        foreach ($array as $key => $value) {
            if (is_string($key)) {
                if (is_array($value) && array_key_exists($key, $merged) && is_array($merged[$key])) {
                    $merged[$key] = array_merge_r($merged[$key], $value);
                } else {
                    $merged[$key] = $value;
                }
            } else {
                $merged[] = $value;
            }
        }
    }
    return $merged;
}