Mercurial > defr > drupal > core
comparison includes/common.inc @ 9:acef7ccb09b5 6.4
Drupal 6.4
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Tue, 23 Dec 2008 14:32:08 +0100 |
| parents | fff6d4c8c043 |
| children | 589fb7c02327 |
comparison
equal
deleted
inserted
replaced
| 8:85cbd6048071 | 9:acef7ccb09b5 |
|---|---|
| 1 <?php | 1 <?php |
| 2 // $Id: common.inc,v 1.756.2.20 2008/07/09 21:48:27 goba Exp $ | 2 // $Id: common.inc,v 1.756.2.24 2008/08/13 23:59:12 drumm Exp $ |
| 3 | 3 |
| 4 /** | 4 /** |
| 5 * @file | 5 * @file |
| 6 * Common functions that many Drupal modules will need to reference. | 6 * Common functions that many Drupal modules will need to reference. |
| 7 * | 7 * |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 // Parse the URL and make sure we can handle the schema. | 435 // Parse the URL and make sure we can handle the schema. |
| 436 $uri = parse_url($url); | 436 $uri = parse_url($url); |
| 437 | |
| 438 if ($uri == FALSE) { | |
| 439 $result->error = 'unable to parse URL'; | |
| 440 return $result; | |
| 441 } | |
| 442 | |
| 443 if (!isset($uri['scheme'])) { | |
| 444 $result->error = 'missing schema'; | |
| 445 return $result; | |
| 446 } | |
| 437 | 447 |
| 438 switch ($uri['scheme']) { | 448 switch ($uri['scheme']) { |
| 439 case 'http': | 449 case 'http': |
| 440 $port = isset($uri['port']) ? $uri['port'] : 80; | 450 $port = isset($uri['port']) ? $uri['port'] : 80; |
| 441 $host = $uri['host'] . ($port != 80 ? ':'. $port : ''); | 451 $host = $uri['host'] . ($port != 80 ? ':'. $port : ''); |
| 3232 | 3242 |
| 3233 $schema = drupal_get_schema($table); | 3243 $schema = drupal_get_schema($table); |
| 3234 if (empty($schema)) { | 3244 if (empty($schema)) { |
| 3235 return FALSE; | 3245 return FALSE; |
| 3236 } | 3246 } |
| 3237 | 3247 |
| 3238 // Convert to an object if needed. | 3248 // Convert to an object if needed. |
| 3239 if (is_array($object)) { | 3249 if (is_array($object)) { |
| 3240 $object = (object) $object; | 3250 $object = (object) $object; |
| 3241 $array = TRUE; | 3251 $array = TRUE; |
| 3242 } | 3252 } |
