| @@ 1229-1263 (lines=35) @@ | ||
| 1226 | $pos1 + 1, |
|
| 1227 | $pos2 - ($pos1 + 1) |
|
| 1228 | ); |
|
| 1229 | if (strpos( |
|
| 1230 | $second_part, |
|
| 1231 | api_get_path( |
|
| 1232 | WEB_PATH |
|
| 1233 | ) |
|
| 1234 | ) !== false |
|
| 1235 | ) { |
|
| 1236 | // We found the current portal url. |
|
| 1237 | $files_list[] = array( |
|
| 1238 | $second_part, |
|
| 1239 | 'local', |
|
| 1240 | 'url' |
|
| 1241 | ); |
|
| 1242 | $in_files_list[] = learnpathItem::get_resources_from_source( |
|
| 1243 | TOOL_DOCUMENT, |
|
| 1244 | $second_part, |
|
| 1245 | $recursivity + 1 |
|
| 1246 | ); |
|
| 1247 | if (count( |
|
| 1248 | $in_files_list |
|
| 1249 | ) > 0 |
|
| 1250 | ) { |
|
| 1251 | $files_list = array_merge( |
|
| 1252 | $files_list, |
|
| 1253 | $in_files_list |
|
| 1254 | ); |
|
| 1255 | } |
|
| 1256 | } else { |
|
| 1257 | // We didn't find any trace of current portal. |
|
| 1258 | $files_list[] = array( |
|
| 1259 | $second_part, |
|
| 1260 | 'remote', |
|
| 1261 | 'url' |
|
| 1262 | ); |
|
| 1263 | } |
|
| 1264 | } elseif (strpos( |
|
| 1265 | $second_part, |
|
| 1266 | '=' |
|
| @@ 1377-1411 (lines=35) @@ | ||
| 1374 | '://' |
|
| 1375 | ) > 0 |
|
| 1376 | ) { |
|
| 1377 | if (strpos( |
|
| 1378 | $source, |
|
| 1379 | api_get_path( |
|
| 1380 | WEB_PATH |
|
| 1381 | ) |
|
| 1382 | ) !== false |
|
| 1383 | ) { |
|
| 1384 | // We found the current portal url. |
|
| 1385 | $files_list[] = array( |
|
| 1386 | $source, |
|
| 1387 | 'local', |
|
| 1388 | 'url' |
|
| 1389 | ); |
|
| 1390 | $in_files_list[] = learnpathItem::get_resources_from_source( |
|
| 1391 | TOOL_DOCUMENT, |
|
| 1392 | $source, |
|
| 1393 | $recursivity + 1 |
|
| 1394 | ); |
|
| 1395 | if (count( |
|
| 1396 | $in_files_list |
|
| 1397 | ) > 0 |
|
| 1398 | ) { |
|
| 1399 | $files_list = array_merge( |
|
| 1400 | $files_list, |
|
| 1401 | $in_files_list |
|
| 1402 | ); |
|
| 1403 | } |
|
| 1404 | } else { |
|
| 1405 | // We didn't find any trace of current portal. |
|
| 1406 | $files_list[] = array( |
|
| 1407 | $source, |
|
| 1408 | 'remote', |
|
| 1409 | 'url' |
|
| 1410 | ); |
|
| 1411 | } |
|
| 1412 | } else { |
|
| 1413 | // No protocol found, make link local. |
|
| 1414 | if (substr( |
|
| @@ 1514-1543 (lines=30) @@ | ||
| 1511 | } |
|
| 1512 | ||
| 1513 | // Found some protocol there. |
|
| 1514 | if (strpos( |
|
| 1515 | $source, |
|
| 1516 | api_get_path(WEB_PATH) |
|
| 1517 | ) !== false |
|
| 1518 | ) { |
|
| 1519 | // We found the current portal url. |
|
| 1520 | $files_list[] = array( |
|
| 1521 | $source, |
|
| 1522 | 'local', |
|
| 1523 | 'url' |
|
| 1524 | ); |
|
| 1525 | $in_files_list[] = learnpathItem::get_resources_from_source( |
|
| 1526 | TOOL_DOCUMENT, |
|
| 1527 | $source, |
|
| 1528 | $recursivity + 1 |
|
| 1529 | ); |
|
| 1530 | if (count($in_files_list) > 0) { |
|
| 1531 | $files_list = array_merge( |
|
| 1532 | $files_list, |
|
| 1533 | $in_files_list |
|
| 1534 | ); |
|
| 1535 | } |
|
| 1536 | } else { |
|
| 1537 | // We didn't find any trace of current portal. |
|
| 1538 | $files_list[] = array( |
|
| 1539 | $source, |
|
| 1540 | 'remote', |
|
| 1541 | 'url' |
|
| 1542 | ); |
|
| 1543 | } |
|
| 1544 | } else { |
|
| 1545 | // No protocol found, make link local. |
|
| 1546 | if (substr($source, 0, 1) === '/') { |
|
| @@ 2201-2211 (lines=11) @@ | ||
| 2198 | $pos1 = strpos($second_part, '='); |
|
| 2199 | $pos2 = strpos($second_part, '&'); |
|
| 2200 | $second_part = substr($second_part, $pos1 + 1, $pos2 - ($pos1 + 1)); |
|
| 2201 | if (strpos($second_part, api_get_path(WEB_PATH)) !== false) { |
|
| 2202 | //we found the current portal url |
|
| 2203 | $files_list[] = array($second_part, 'local', 'url'); |
|
| 2204 | $in_files_list[] = self::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, $recursivity + 1); |
|
| 2205 | if (count($in_files_list) > 0) { |
|
| 2206 | $files_list = array_merge($files_list, $in_files_list); |
|
| 2207 | } |
|
| 2208 | } else { |
|
| 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) |
|
| @@ 2254-2264 (lines=11) @@ | ||
| 2251 | //leave that second part behind now |
|
| 2252 | $source = substr($source, 0, strpos($source, '?')); |
|
| 2253 | if (strpos($source, '://') > 0) { |
|
| 2254 | if (strpos($source, api_get_path(WEB_PATH)) !== false) { |
|
| 2255 | //we found the current portal url |
|
| 2256 | $files_list[] = array($source, 'local', 'url'); |
|
| 2257 | $in_files_list[] = self::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1); |
|
| 2258 | if (count($in_files_list) > 0) { |
|
| 2259 | $files_list = array_merge($files_list, $in_files_list); |
|
| 2260 | } |
|
| 2261 | } else { |
|
| 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) === '/') { |
|
| @@ 2304-2314 (lines=11) @@ | ||
| 2301 | } |
|
| 2302 | } |
|
| 2303 | //found some protocol there |
|
| 2304 | if (strpos($source, api_get_path(WEB_PATH)) !== false) { |
|
| 2305 | //we found the current portal url |
|
| 2306 | $files_list[] = array($source, 'local', 'url'); |
|
| 2307 | $in_files_list[] = self::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity + 1); |
|
| 2308 | if (count($in_files_list) > 0) { |
|
| 2309 | $files_list = array_merge($files_list, $in_files_list); |
|
| 2310 | } |
|
| 2311 | } else { |
|
| 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) === '/') { |
|