getName() public method

public getName ( ) : string
return string
Example #1
0
 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;
 }
Example #2
0
 protected function getDefaultSiteName()
 {
     $defaultAlias = new Alias($this->m_dbObject->getDefaultAliasId());
     if (!$defaultAlias->exists()) {
         return null;
     }
     $subdir = CampConfig::singleton()->getSetting('SUBDIR');
     return $defaultAlias->getName() . $subdir;
 }
Example #3
0
		$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');
$url .= "&previewLang=$selectedLanguage";
Example #4
0
        <TD>
            <A HREF="/<?php 
        echo $ADMIN;
        ?>
/issues/?Pub=<?php 
        p($pub->getPublicationId());
        ?>
"><?php 
        p(htmlspecialchars($pub->getName()));
        ?>
</A>
        </TD>
        <TD>
            <?php 
        $aliasObj = new Alias($pub->getDefaultAliasId());
        p(htmlspecialchars($aliasObj->getName()));
        ?>
&nbsp;
        </TD>
        <TD>
            <?php 
        $languageObj = new Language($pub->getDefaultLanguageId());
        p(htmlspecialchars($languageObj->getName()));
        ?>
&nbsp;
        </TD>
        <?php 
        if ($g_user->hasPermission("ManagePub")) {
            ?>
        <TD align="center">
            <?php 
Example #5
0
	}
	//getGS("This article cannot be previewed. Please make sure it has the front page template selected.");
	if ($templateId == 0) {
		$errorStr = getGS('This article cannot be previewed. Please make sure it has the article template selected.');
	}
}

$templateObj = new Template($templateId);

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() . $GLOBALS['Campsite']['SUBDIR'];

$accessParams = "LoginUserId=" . $g_user->getUserId() . "&LoginUserKey=" . $g_user->getKeyId()
				. "&AdminAccess=all";
if ($publicationObj->getUrlTypeId() == 1) {
	$templateObj = new Template($templateId);
	$url = "$websiteURL/tpl/" . $templateObj->getName() . "?IdLanguage=$f_language_id"
		. "&IdPublication=$f_publication_id&NrIssue=$f_issue_number&NrSection=$f_section_number"
		. "&NrArticle=$f_article_number&$accessParams";
} else {
	$url = ShortURL::GetURL($f_publication_id, $f_language_selected, null, null, $f_article_number);
	if (PEAR::isError($url)) {
		$errorStr = $url->getMessage();
	}
	$url .= '?' . $accessParams;
}
Example #6
0
 public function testAlias()
 {
     $alias = new Alias('test', 't');
     $this->assertEquals('test', $alias->getName());
     $this->assertEquals('t', $alias->getAlias());
 }
Example #7
0
}

$publicationObj = new Publication($f_publication_id);

$correct = true;
$errorMsgs = array();

if (empty($f_name)) {
	$correct = false;
	$errorMsgs[] = getGS('You must fill in the $1 field.', '<B>Name</B>');
}

$alias = new Alias($f_alias_id);
$aliases = 0;
if ($correct) {
	if ($alias->getName() != $f_name) {
		$aliasDups = count(Alias::GetAliases(null, null, $f_name));
		if ($aliasDups <= 0) {
			$success = $alias->setName($f_name);
			if ($success) {
				$logtext = getGS('The site alias for publication "$1" has been modified to "$2".',
								 $publicationObj->getName(), $f_name);
				Log::Message($logtext, $g_user->getUserId(), 153);
			}
		}
		else {
			$errorMsgs[] = getGS('Another alias with the same name exists already.');
			$correct = false;
		}
	}
}
Example #8
0
// 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);
?>
<P>
Example #9
0
<INPUT TYPE="hidden" NAME="f_publication_id" VALUE="<?php 
p($f_publication_id);
?>
">
<INPUT TYPE="hidden" NAME="f_alias_id" VALUE="<?php 
p($f_alias_id);
?>
">
<TR>
	<TD ALIGN="RIGHT" ><?php 
putGS("Name");
?>
:</TD>
	<TD>
	<INPUT TYPE="TEXT" NAME="f_name" VALUE="<?php 
echo htmlspecialchars($alias->getName());
?>
" SIZE="32" MAXLENGTH="255" class="input_text">
	</TD>
</TR>
<TR>
	<TD COLSPAN="2" align="center">
		<INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php 
putGS('Save');
?>
">
	</TD>
</TR>
</TABLE>
</FORM>
<P>
Example #10
0
$f_name = trim(Input::Get('f_name'));
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($f_publication_id);
$correct = true;
$errorMsgs = array();
if (empty($f_name)) {
    $correct = false;
    $errorMsgs[] = $translator->trans('You must fill in the $1 field.', array('$1' => '<B>Name</B>'));
}
$alias = new Alias($f_alias_id);
$aliases = 0;
if ($correct) {
    if ($alias->getName() != $f_name) {
        $aliasDups = count(Alias::GetAliases(null, null, $f_name));
        if ($aliasDups <= 0) {
            $success = $alias->setName($f_name);
        } else {
            $errorMsgs[] = $translator->trans('Another alias with the same name exists already.', array(), 'pub');
            $correct = false;
        }
    }
}
if ($correct) {
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('publication');
    camp_html_goto_page("/{$ADMIN}/pub/aliases.php?Pub={$f_publication_id}&Alias={$f_alias_id}");
    exit;
} else {
Example #11
0
<P>
<FORM name="edit_alias" METHOD="POST" ACTION="do_edit_alias.php">
<?php echo SecurityToken::FormParameter(); ?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="box_table">
<TR>
	<TD COLSPAN="2">
		<B><?php  putGS("Edit alias"); ?></B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<INPUT TYPE="hidden" NAME="f_publication_id" VALUE="<?php p($f_publication_id); ?>">
<INPUT TYPE="hidden" NAME="f_alias_id" VALUE="<?php p($f_alias_id); ?>">
<TR>
	<TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>
	<TD>
	<INPUT TYPE="TEXT" NAME="f_name" VALUE="<?php echo htmlspecialchars($alias->getName()); ?>" SIZE="32" MAXLENGTH="255" class="input_text">
	</TD>
</TR>
<TR>
	<TD COLSPAN="2" align="center">
		<INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php  putGS('Save'); ?>">
	</TD>
</TR>
</TABLE>
</FORM>
<P>
<script>
document.edit_alias.f_name.focus();
</script>

<?php camp_html_copyright_notice(); ?>
Example #12
0
}

$Pub = Input::Get('Pub', 'int', 0);
$Alias = Input::Get('Alias', 'int', 0);

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $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();

	if ($deleted) {
		$logtext = getGS('The alias "$1" has been deleted from publication "$2".',
						 $aliasName, $publicationObj->getName());
		Log::Message($logtext, $g_user->getUserId(), 152);
		camp_html_goto_page("/$ADMIN/pub/aliases.php?Pub=$Pub");
	} else {
		$errorMsgs[] = getGS('The alias $1 could not be deleted.','<B>'.$aliasObj->getName().'</B>');
	}
} else {
	$errorMsgs[] = getGS('$1 is the default publication alias, it can not be deleted.', '<B>'.$aliasObj->getName().'</B>');
}

$crumbs = array(getGS("Publication Aliases") => "aliases.php?Pub=$Pub");
Example #13
0
 protected function getDefaultSiteName()
 {
     $publicationService = \Zend_Registry::get('container')->getService('newscoop.publication_service');
     if ($publicationService->getPublicationAlias()) {
         if ($publicationService->getPublicationAlias()->getId() == $this->m_dbObject->getDefaultAliasId()) {
             return $publicationService->getPublicationAlias()->getName();
         }
     }
     $defaultAlias = new Alias($this->m_dbObject->getDefaultAliasId());
     if (!$defaultAlias->exists()) {
         return null;
     }
     return $defaultAlias->getName();
 }