| 1 |
<?php |
<?php |
| 2 |
// $Id: common.inc,v 1.611.2.23 2009/04/30 00:13:48 drumm Exp $ |
// $Id: common.inc,v 1.611.2.24 2009/05/13 17:10:36 drumm Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 427 |
// Parse the URL, and make sure we can handle the schema. |
// Parse the URL, and make sure we can handle the schema. |
| 428 |
$uri = parse_url($url); |
$uri = parse_url($url); |
| 429 |
|
|
| 430 |
|
if ($uri == FALSE) { |
| 431 |
|
$result->error = 'unable to parse URL'; |
| 432 |
|
$result->code = -1001; |
| 433 |
|
return $result; |
| 434 |
|
} |
| 435 |
|
|
| 436 |
|
if (!isset($uri['scheme'])) { |
| 437 |
|
$result->error = 'missing schema'; |
| 438 |
|
$result->code = -1002; |
| 439 |
|
return $result; |
| 440 |
|
} |
| 441 |
|
|
| 442 |
switch ($uri['scheme']) { |
switch ($uri['scheme']) { |
| 443 |
case 'http': |
case 'http': |
| 444 |
$port = isset($uri['port']) ? $uri['port'] : 80; |
$port = isset($uri['port']) ? $uri['port'] : 80; |
| 453 |
break; |
break; |
| 454 |
default: |
default: |
| 455 |
$result->error = 'invalid schema '. $uri['scheme']; |
$result->error = 'invalid schema '. $uri['scheme']; |
| 456 |
|
$result->code = -1003; |
| 457 |
return $result; |
return $result; |
| 458 |
} |
} |
| 459 |
|
|