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