View source
<?php
function expire_get_domains(&$node) {
$domains = array();
if ($node->nid) {
$result = db_query("SELECT gid FROM {domain_access} WHERE nid = :nid", array(
':nid' => $node->nid,
));
foreach ($result as $row) {
$domains[$gid] = $row->gid;
}
}
elseif ($node->mail && $node->name) {
$result = db_query("SELECT domain_id FROM {domain_editor} WHERE uid = :uid", array(
':uid' => $node->uid,
));
foreach ($result as $row) {
$domains[$gid] = $row->domain_id;
}
}
return $domains;
}
function expire_get_base_urls($node) {
global $base_url, $base_path;
$base_urls = array();
$domains = array();
foreach ($node->domains as $key => $domain_id) {
if ($key != $domain_id) {
continue;
}
$domains[$domain_id] = $domain_id;
}
foreach (expire_get_domains($node) as $domain_id) {
$domains[$domain_id] = $domain_id;
}
foreach ($domains as $domain_id) {
$domain = domain_lookup($domain_id);
if ($domain['valid'] == 1) {
if (isset($domain['path'])) {
$base_urls[$domain_id][] = $domain['path'];
}
if (is_array($domain['aliases'])) {
foreach ($domain['aliases'] as $alias) {
if ($alias['redirect'] != 1) {
$temp_domain = array(
'scheme' => $domain['scheme'],
'subdomain' => $alias['pattern'],
);
$base_urls[$domain_id][] = domain_get_path($temp_domain);
}
}
}
}
}
return $base_urls;
}