@@ 2212-2250 (lines=39) @@ | ||
2209 | //we didn't find any trace of current portal |
|
2210 | $files_list[] = array($second_part, 'remote', 'url'); |
|
2211 | } |
|
2212 | } elseif (strpos($second_part, '=') > 0) { |
|
2213 | if (substr($second_part, 0, 1) === '/') { |
|
2214 | //link starts with a /, making it absolute (relative to DocumentRoot) |
|
2215 | $files_list[] = array($second_part, 'local', 'abs'); |
|
2216 | $in_files_list[] = self::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2217 | if (count($in_files_list) > 0) { |
|
2218 | $files_list = array_merge($files_list, $in_files_list); |
|
2219 | } |
|
2220 | } elseif (strstr($second_part, '..') === 0) { |
|
2221 | //link is relative but going back in the hierarchy |
|
2222 | $files_list[] = array($second_part, 'local', 'rel'); |
|
2223 | //$dir = api_get_path(SYS_CODE_PATH);//dirname($abs_path); |
|
2224 | //$new_abs_path = realpath($dir.'/'.$second_part); |
|
2225 | $dir = ''; |
|
2226 | if (!empty($abs_path)) { |
|
2227 | $dir = dirname($abs_path) . '/'; |
|
2228 | } |
|
2229 | $new_abs_path = realpath($dir . $second_part); |
|
2230 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2231 | if (count($in_files_list) > 0) { |
|
2232 | $files_list = array_merge($files_list, $in_files_list); |
|
2233 | } |
|
2234 | } else { |
|
2235 | //no starting '/', making it relative to current document's path |
|
2236 | if (substr($second_part, 0, 2) == './') { |
|
2237 | $second_part = substr($second_part, 2); |
|
2238 | } |
|
2239 | $files_list[] = array($second_part, 'local', 'rel'); |
|
2240 | $dir = ''; |
|
2241 | if (!empty($abs_path)) { |
|
2242 | $dir = dirname($abs_path) . '/'; |
|
2243 | } |
|
2244 | $new_abs_path = realpath($dir . $second_part); |
|
2245 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2246 | if (count($in_files_list) > 0) { |
|
2247 | $files_list = array_merge($files_list, $in_files_list); |
|
2248 | } |
|
2249 | } |
|
2250 | } |
|
2251 | //leave that second part behind now |
|
2252 | $source = substr($source, 0, strpos($source, '?')); |
|
2253 | if (strpos($source, '://') > 0) { |
|
@@ 2265-2301 (lines=37) @@ | ||
2262 | //we didn't find any trace of current portal |
|
2263 | $files_list[] = array($source, 'remote', 'url'); |
|
2264 | } |
|
2265 | } else { |
|
2266 | //no protocol found, make link local |
|
2267 | if (substr($source, 0, 1) === '/') { |
|
2268 | //link starts with a /, making it absolute (relative to DocumentRoot) |
|
2269 | $files_list[] = array($source, 'local', 'abs'); |
|
2270 | $in_files_list[] = self::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2271 | if (count($in_files_list) > 0) { |
|
2272 | $files_list = array_merge($files_list, $in_files_list); |
|
2273 | } |
|
2274 | } elseif (strstr($source, '..') === 0) { //link is relative but going back in the hierarchy |
|
2275 | $files_list[] = array($source, 'local', 'rel'); |
|
2276 | $dir = ''; |
|
2277 | if (!empty($abs_path)) { |
|
2278 | $dir = dirname($abs_path) . '/'; |
|
2279 | } |
|
2280 | $new_abs_path = realpath($dir . $source); |
|
2281 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2282 | if (count($in_files_list) > 0) { |
|
2283 | $files_list = array_merge($files_list, $in_files_list); |
|
2284 | } |
|
2285 | } else { |
|
2286 | //no starting '/', making it relative to current document's path |
|
2287 | if (substr($source, 0, 2) == './') { |
|
2288 | $source = substr($source, 2); |
|
2289 | } |
|
2290 | $files_list[] = array($source, 'local', 'rel'); |
|
2291 | $dir = ''; |
|
2292 | if (!empty($abs_path)) { |
|
2293 | $dir = dirname($abs_path) . '/'; |
|
2294 | } |
|
2295 | $new_abs_path = realpath($dir . $source); |
|
2296 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2297 | if (count($in_files_list) > 0) { |
|
2298 | $files_list = array_merge($files_list, $in_files_list); |
|
2299 | } |
|
2300 | } |
|
2301 | } |
|
2302 | } |
|
2303 | //found some protocol there |
|
2304 | if (strpos($source, api_get_path(WEB_PATH)) !== false) { |
|
@@ 2315-2352 (lines=38) @@ | ||
2312 | //we didn't find any trace of current portal |
|
2313 | $files_list[] = array($source, 'remote', 'url'); |
|
2314 | } |
|
2315 | } else { |
|
2316 | //no protocol found, make link local |
|
2317 | if (substr($source, 0, 1) === '/') { |
|
2318 | //link starts with a /, making it absolute (relative to DocumentRoot) |
|
2319 | $files_list[] = array($source, 'local', 'abs'); |
|
2320 | $in_files_list[] = self::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2321 | if (count($in_files_list) > 0) { |
|
2322 | $files_list = array_merge($files_list, $in_files_list); |
|
2323 | } |
|
2324 | } elseif (strpos($source, '..') === 0) { |
|
2325 | //link is relative but going back in the hierarchy |
|
2326 | $files_list[] = array($source, 'local', 'rel'); |
|
2327 | $dir = ''; |
|
2328 | if (!empty($abs_path)) { |
|
2329 | $dir = dirname($abs_path) . '/'; |
|
2330 | } |
|
2331 | $new_abs_path = realpath($dir . $source); |
|
2332 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2333 | if (count($in_files_list) > 0) { |
|
2334 | $files_list = array_merge($files_list, $in_files_list); |
|
2335 | } |
|
2336 | } else { |
|
2337 | //no starting '/', making it relative to current document's path |
|
2338 | if (substr($source, 0, 2) == './') { |
|
2339 | $source = substr($source, 2); |
|
2340 | } |
|
2341 | $files_list[] = array($source, 'local', 'rel'); |
|
2342 | $dir = ''; |
|
2343 | if (!empty($abs_path)) { |
|
2344 | $dir = dirname($abs_path) . '/'; |
|
2345 | } |
|
2346 | $new_abs_path = realpath($dir . $source); |
|
2347 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
|
2348 | if (count($in_files_list) > 0) { |
|
2349 | $files_list = array_merge($files_list, $in_files_list); |
|
2350 | } |
|
2351 | } |
|
2352 | } |
|
2353 | } |
|
2354 | } |
|
2355 | } |