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; }
if (!$issueObj->exists()) $errorStr = getGS('There was an error reading the issue parameter.'); } if ($errorStr == "" && ($templateId = $issueObj->getIssueTemplateId()) == 0) $errorStr = 'This issue cannot be previewed. Please make sure it has the front page template selected.'; if ($errorStr != "") { camp_html_display_error($errorStr, null, true); } if (!isset($_SERVER['SERVER_PORT'])) { $_SERVER['SERVER_PORT'] = 80; } $scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://'; $siteAlias = new Alias($publicationObj->getDefaultAliasId()); $websiteURL = $scheme.$siteAlias->getName(); $accessParams = "LoginUserId=" . $g_user->getUserId() . "&LoginUserKey=" . $g_user->getKeyId() . "&AdminAccess=all"; $urlType = $publicationObj->getProperty('IdURLType'); if ($urlType == 1) { $templateObj = new Template($templateId); $url = "$websiteURL" . $Campsite['SUBDIR'] . "/tpl/" . $templateObj->getName() . "?IdLanguage=$Language&IdPublication=$Pub&NrIssue=$Issue&$accessParams"; } else { $url = "$websiteURL" . $Campsite['SUBDIR'] . '/' . $languageObj->getCode() . "/" . $issueObj->getUrlName() . "?$accessParams"; } $selectedLanguage = (int)CampRequest::GetVar('Language');
?> <TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list"> <TR class="table_list_header"> <TD ALIGN="LEFT" VALIGN="TOP" ><B><?php putGS("Alias (click to edit)"); ?></B></TD> <?php if ($g_user->hasPermission("ManagePub")) { ?> <TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Delete"); ?></B></TD> <?php } ?> </TR> <?php foreach ($aliases as $alias) { ?> <TR <?php if ($color) { $color=0; ?>class="list_row_even"<?php } else { $color=1; ?>class="list_row_odd"<?php } ?>> <TD> <?php if ($g_user->hasPermission("ManagePub")) { ?><A HREF="/<?php p($ADMIN); ?>/pub/edit_alias.php?Pub=<?php p($Pub); ?>&Alias=<?php p($alias->getId()); ?>"><?php } ?><?php p(htmlspecialchars($alias->getName())); ?><?php if ($g_user->hasPermission("ManagePub")) { ?></A><?php } ?> </TD> <?php if ($g_user->hasPermission("ManagePub")) { ?> <TD ALIGN="CENTER"> <?php if ($publicationObj->getDefaultAliasId() != $alias->getId()) { ?> <A HREF="/<?php p($ADMIN); ?>/pub/do_del_alias.php?Pub=<?php p($Pub); ?>&Alias=<?php p($alias->getId()); ?>&<?php echo SecurityToken::URLParameter(); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the alias $1?', $alias->getName()); ?>');"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/delete.png" BORDER="0" ALT="<?php putGS('Delete alias $1', htmlspecialchars($alias->getName())); ?>" TITLE="<?php putGS('Delete alias $1', htmlspecialchars($alias->getName())); ?>" ></A> <?php } ?> </TD> <?php } ?> </TR> <?php } ?> </TABLE> <?php camp_html_copyright_notice(); ?>
} // Check permissions if (!$g_user->hasPermission('ManagePub')) { camp_html_display_error($translator->trans("You do not have the right to manage publications.", array(), 'pub')); exit; } $Pub = Input::Get('Pub', 'int', 0); $Alias = Input::Get('Alias', 'int', 0); if (!Input::IsValid()) { camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']); exit; } $publicationObj = new Publication($Pub); $aliasObj = new Alias($Alias); $errorMsgs = array(); if ($publicationObj->getDefaultAliasId() != $Alias) { $aliasName = $aliasObj->getName(); $deleted = $aliasObj->delete(); $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache'); $cacheService->clearNamespace('publication'); if ($deleted) { camp_html_goto_page("/{$ADMIN}/pub/aliases.php?Pub={$Pub}"); } else { $errorMsgs[] = $translator->trans('The alias $1 could not be deleted.', array('$1' => '<B>' . $aliasObj->getName() . '</B>'), 'pub'); } } else { $errorMsgs[] = $translator->trans('$1 is the default publication alias, it can not be deleted.', array('$1' => '<B>' . $aliasObj->getName() . '</B>'), 'pub'); } $crumbs = array($translator->trans("Publication Aliases", array(), 'pub') => "aliases.php?Pub={$Pub}"); camp_html_content_top($translator->trans("Deleting alias", array(), 'pub'), array("Pub" => $publicationObj), true, false, $crumbs); ?>
exit; } $backLink = "/{$ADMIN}/pub/edit.php?Pub={$f_publication_id}"; $errorMsgs = array(); $updated = false; if (empty($f_name)) { camp_html_add_msg(getGS('You must fill in the $1 field.', '<B>' . getGS('Name') . '</B>')); } if (empty($f_default_alias)) { camp_html_add_msg(getGS('You must fill in the $1 field.', '<B>' . getGS('Site') . '</B>')); } $publicationObj = new Publication($f_publication_id); if (!$publicationObj->exists()) { camp_html_add_msg(getGS('Publication does not exist.')); } if ($f_default_alias != $publicationObj->getDefaultAliasId()) { camp_is_alias_conflicting($f_default_alias); } if ($f_name != $publicationObj->getName()) { camp_is_publication_conflicting($f_name); } if (camp_html_has_msgs()) { camp_html_goto_page($backLink); } //$publicationObj->setPublicComments($f_comments_public_enabled); $columns = array('Name' => $f_name, 'IdDefaultAlias' => $f_default_alias, 'IdDefaultLanguage' => $f_language, 'IdURLType' => $f_url_type, 'TimeUnit' => $f_time_unit, 'PaidTime' => $f_paid, 'TrialTime' => $f_trial, 'UnitCost' => $f_unit_cost, 'UnitCostAllLang' => $f_unit_cost_all_lang, 'Currency' => $f_currency, 'comments_enabled' => $f_comments_enabled, 'comments_article_default_enabled' => $f_comments_article_default, 'comments_subscribers_moderated' => $f_comments_subscribers_moderated, 'comments_public_moderated' => $f_comments_public_moderated, 'comments_public_enabled' => $f_comments_public_enabled, 'comments_captcha_enabled' => $f_comments_captcha_enabled, 'comments_spam_blocking_enabled' => $f_comments_spam_blocking_enabled, 'comments_moderator_to' => $f_comments_moderator_to, 'comments_moderator_from' => $f_comments_moderator_from, 'seo' => serialize($f_seo)); $updated = $publicationObj->update($columns); if ($updated) { camp_html_add_msg(getGS("Publication updated"), "ok"); } else { $errorMsg = getGS('The publication information could not be updated.');