public static function GetURL($p_publicationId, $p_languageId = null, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = NULL, $p_port = null)
{
global $g_ado_db;
global $_SERVER;
if (is_null($p_port)) {
if (!isset($_SERVER['SERVER_PORT'])) {
$_SERVER['SERVER_PORT'] = 80;
}
$p_port = $_SERVER['SERVER_PORT'];
}
$publicationObj = new Publication($p_publicationId);
if (!$publicationObj->exists()) {
return new PEAR_Error(getGS('Publication does not exist.'));
}
if (!isset($p_languageId)) {
$p_languageId = $publicationObj->getDefaultLanguageId();
}
$scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
$defaultAlias = new Alias($publicationObj->getDefaultAliasId());
$uri = ShortURL::GetURI($p_publicationId, $p_languageId, $p_issueNo, $p_sectionNo, $p_articleNo);
if (!is_string($uri) && PEAR::isError($uri)) {
return $uri;
}
return $scheme . $defaultAlias->getName() . $uri;
}