Commit be86d02e authored by Karl's avatar Karl
Browse files

URL-Erkennung funktioniert besser

parent 1ae37563
...@@ -287,18 +287,26 @@ class Result ...@@ -287,18 +287,26 @@ class Result
/* Liest aus einer URL alle Informationen aus /* Liest aus einer URL alle Informationen aus
* https://max:muster@www.example.site.page.com:8080/index/indexer/list.html?p1=A&p2=B#ressource * https://max:muster@www.example.site.page.com:8080/index/indexer/list.html?p1=A&p2=B#ressource
* (?:((?:http)|(?:https))(?::\/\/))? - https:// => [1] = http / https * (?:((?:http)|(?:https))(?::\/\/))?
* (?:(\w+):(\w+)@)? - username:password@ => [2] = username, [3] = password * https:// => [1] = http / https
* (?:(www)(?:\.))? - www. => [4] = www * (?:([a-z0-9.\-_~]+):([a-z0-9.\-_~]+)@)?
* ((?:(?:\w+\.)+)?(\w+\.\w+)) - example.site.page.com => [5] = example.site.page.com, [6] = page.com * username:password@ => [2] = username, [3] = password
* (?:(?::)(\d+))? - :8080 => [7] = 8080 * (?:(www)(?:\.))?
* ((?:(?:\/\w+)+)(?:\.\w+)?)? - /index/indexer/list.html => [8] = /index/indexer/list.html * www. => [4] = www
* (\?\w+=\w+(?:&\w+=\w+)*)? - ?p1=A&p2=B => [9] = ?p1=A&p2=B * ((?:(?:[a-z0-9.\-_~]+\.)+)?([a-z0-9.\-_~]+\.[a-z0-9.\-_~]+))
* (?:(?:#)(\w+))? - #ressource => [10] = ressource * example.site.page.com => [5] = example.site.page.com, [6] = page.com
* (?:(?::)(\d+))?
* :8080 => [7] = 8080
* ((?:(?:\/[a-z0-9.\-_~]+)+)(?:\.[a-z0-9.\-_~]+)?)?
* /index/indexer/list.html => [8] = /index/indexer/list.html
* (\?[a-z0-9.\-_~]+=[a-z0-9.\-_~]+(?:&[a-z0-9.\-_~]+=[a-z0-9.\-_~]+)*)?
* ?p1=A&p2=B => [9] = ?p1=A&p2=B
* (?:(?:#)([a-z0-9.\-_~]+))?
* #ressource => [10] = ressource
*/ */
public function getUrlElements($url) public function getUrlElements($url)
{ {
if (!preg_match("/(?:((?:http)|(?:https))(?::\/\/))?(?:(\w+):(\w+)@)?(?:(www)(?:\.))?((?:(?:\w+\.)+)?(\w+\.\w+))(?:(?::)(\d+))?((?:(?:\/\w+)+)(?:\.\w+)?)?(\?\w+=\w+(?:&\w+=\w+)*)?(?:(?:#)(\w+))?/", $url, $match)) { if (!preg_match("/(?:((?:http)|(?:https))(?::\/\/))?(?:([a-z0-9.\-_~]+):([a-z0-9.\-_~]+)@)?(?:(www)(?:\.))?((?:(?:[a-z0-9.\-_~]+\.)+)?([a-z0-9.\-_~]+\.[a-z0-9.\-_~]+))(?:(?::)(\d+))?((?:(?:\/[a-z0-9.\-_~]+)+)(?:\.[a-z0-9.\-_~]+)?)?(\?[a-z0-9.\-_~]+=[a-z0-9.\-_~]+(?:&[a-z0-9.\-_~]+=[a-z0-9.\-_~]+)*)?(?:(?:#)([a-z0-9.\-_~]+))?/i", $url, $match)) {
return; return;
} else { } else {
$re = []; $re = [];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment