getName() public method

Get the name of this publication.
public getName ( ) : string
return string
コード例 #1
1
require_once($GLOBALS['g_campsiteDir']."/classes/Country.php");

if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}

// Check permissions
if (!$g_user->hasPermission('ManagePub')) {
	camp_html_display_error(getGS("You do not have the right to manage publications."));
	exit;
}

$Pub = Input::Get('Pub', 'int', 0);
$Language = Input::Get('Language', 'int', 1, true);
$CountryCode = Input::Get('CountryCode');

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
	exit;
}

$publicationObj = new Publication($Pub);
$defaultTime = new SubscriptionDefaultTime($CountryCode, $Pub);
$defaultTime->delete();

$logtext = getGS('Subscription default time for "$1":$2 deleted', $publicationObj->getName(), $CountryCode);
Log::Message($logtext, $g_user->getUserId(), 5);
camp_html_add_msg(getGS("Country subscription settings deleted."), "ok");
camp_html_goto_page("/$ADMIN/pub/deftime.php?Pub=$Pub&Language=$Language");
?>
コード例 #2
0
ファイル: pub_common.php プロジェクト: sourcefabric/newscoop
/**
 * Check if the alias given is already in use.  If so, a user error message
 * is created.
 *
 * @param mixed $p_alias
 * 		Can be a string or an int.
 * @return void
 */
function camp_is_alias_conflicting($p_alias)
{
    global $ADMIN;
    $translator = \Zend_Registry::get('container')->getService('translator');
    if (!is_numeric($p_alias)) {
        // The alias given is a name, which means it doesnt exist yet.
        // Check if the name conflicts with any existing alias names.
        $aliases = Alias::GetAliases(null, null, $p_alias);
        $alias = array_pop($aliases);
        if ($alias) {
            $pubId = $alias->getPublicationId();
            $pubObj = new Publication($pubId);
            $pubLink = "<A HREF=\"/{$ADMIN}/pub/edit.php?Pub={$pubId}\">" . $pubObj->getName() . "</A>";
            $msg = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
            camp_html_add_msg($msg);
        }
    } else {
        // The alias given is a number, which means it already exists.
        // Check if the alias ID is already in use by another publication.
        $aliases = Alias::GetAliases($p_alias);
        $alias = array_pop($aliases);
        if ($alias) {
            $pubs = Publication::GetPublications(null, $alias->getId());
            if (count($pubs) > 0) {
                $pubObj = array_pop($pubs);
                $pubLink = "<A HREF=\"/{$ADMIN}/pub/edit.php?Pub=" . $pubObj->getPublicationId() . '">' . $pubObj->getName() . "</A>";
                $msg = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
                camp_html_add_msg($msg);
            }
        }
    }
}
コード例 #3
0
ファイル: pub_common.php プロジェクト: nistormihai/Newscoop
/**
 * Check if the alias given is already in use.  If so, a user error message
 * is created.
 *
 * @param mixed $p_alias
 * 		Can be a string or an int.
 * @return void
 */
function camp_is_alias_conflicting($p_alias)
{
	global $ADMIN;

	if (!is_numeric($p_alias)) {
		// The alias given is a name, which means it doesnt exist yet.
		// Check if the name conflicts with any existing alias names.
		$aliases = Alias::GetAliases(null, null, $p_alias);
		$alias = array_pop($aliases);
		if ($alias) {
			$pubId = $alias->getPublicationId();
			$pubObj = new Publication($pubId);
			$pubLink = "<A HREF=\"/$ADMIN/pub/edit.php?Pub=$pubId\">". $pubObj->getName() ."</A>";
			$msg = getGS("The publication alias you specified conflicts with publication '$1'.", $pubLink);
			camp_html_add_msg($msg);
		}
	} else {
		// The alias given is a number, which means it already exists.
		// Check if the alias ID is already in use by another publication.
		$aliases = Alias::GetAliases($p_alias);
		$alias = array_pop($aliases);
		if ($alias) {
			$pubs = Publication::GetPublications(null, $alias->getId());
			if (count($pubs) > 0) {
				$pubObj = array_pop($pubs);
				$pubLink = "<A HREF=\"/$ADMIN/pub/edit.php?Pub=".$pubObj->getPublicationId().'">'. $pubObj->getName() ."</A>";
				$msg = getGS("The publication alias you specified conflicts with publication '$1'.", $pubLink);
				camp_html_add_msg($msg);
			}
		}
	}
}
コード例 #4
0
    /**
     * Performs the action; returns true on success, false on error.
     *
     * @param $p_context - the current context object
     * @return bool
     */
    public function takeAction(CampContext &$p_context)
    {
        $p_context->default_url->reset_parameter('f_'.$this->m_name);
        $p_context->url->reset_parameter('f_'.$this->m_name);

        if (!is_null($this->m_error)) {
            return false;
        }

        // Check that the article exists.
        $articleMetaObj = $p_context->default_article;
        if (!$articleMetaObj->defined) {
            $this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.',
            ACTION_PREVIEW_COMMENT_ERR_NO_ARTICLE);
            return false;
        }
        if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked)  {
            $this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.',
            ACTION_PREVIEW_COMMENT_ERR_NOT_ENABLED);
            return false;
        }

        // Get the publication.
        $publicationObj = new Publication($articleMetaObj->publication->identifier);
        $forum = new Phorum_forum($publicationObj->getForumId());
        if (!$forum->exists()) {
            $forum->create();
            $forum->setName($publicationObj->getName());
            $publicationObj->setForumId($forum->getForumId());
        }
        $forumId = $forum->getForumId();

        $user = $p_context->user;
        if ($user->defined) {
            $this->m_properties['reader_email'] = $user->email;
        } else {
            if ($forum->getPublicPermissions() & (PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY)) {
                if (!isset($this->m_properties['reader_email'])) {
                    $this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.',
                    ACTION_PREVIEW_COMMENT_ERR_NO_EMAIL);
                    return false;
                }
            } else {
                $this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.',
                ACTION_PREVIEW_COMMENT_ERR_NO_PUBLIC);
                return false;
            }
        }

        // Check if the reader was banned from posting comments.
        if (Phorum_user::IsBanned($userRealName, $userEmail)) {
            $this->m_error = new PEAR_Error('You are banned from submitting comments.',
            ACTION_PREVIEW_COMMENT_ERR_BANNED);
            return false;
        }

        $this->m_error = ACTION_OK;
        return true;
    }
コード例 #5
0
  	/**
  	 * @param array $p_values
  	 * @return boolean
  	 */
  	public function create($p_values = null)
  	{
  		$success = parent::create($p_values);
  		$publicationObj = new Publication($this->m_data['IdPublication']);
		if (function_exists("camp_load_translation_strings")) {
			camp_load_translation_strings("api");
		}
		$logtext = getGS('The default subscription time for ($1 "$2":$3) has been added.', getGS("Publication"), $publicationObj->getName(), $this->m_data['CountryCode']);
		Log::Message($logtext, null, 4);
		return $success;
  	} // fn create
コード例 #6
0
ファイル: index.php プロジェクト: sourcefabric/newscoop
</A>
			</TD>
		</TR>
		</TABLE>
	</TD>
</TR>
</TABLE>

<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table">
<TR>
	<TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title">&nbsp;<?php 
echo $translator->trans("Publication");
?>
:</TD>
	<TD VALIGN="TOP" class="current_location_content"><?php 
echo htmlspecialchars($publicationObj->getName());
?>
</TD>

	<TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title">&nbsp;<?php 
echo $translator->trans("Issue");
?>
:</TD>
	<TD VALIGN="TOP" class="current_location_content"><?php 
echo $issueObj->getIssueNumber();
?>
. <?php 
echo htmlspecialchars($issueObj->getName());
?>
 (<?php 
echo htmlspecialchars($issueLanguage->getName());
コード例 #7
0
ファイル: index.php プロジェクト: nistormihai/Newscoop
				<A HREF="/<?php echo $ADMIN; ?>/issues/?Pub=<?php p($Pub); ?>" class="breadcrumb" ><?php putGS("Issues");  ?></A>
			</TD>
			<td class="breadcrumb_separator">&nbsp;</td>
			<TD>
				<A HREF="/<?php echo $ADMIN; ?>/pub/" class="breadcrumb"><?php putGS("Publications");  ?></A>
			</TD>
		</TR>
		</TABLE>
	</TD>
</TR>
</TABLE>

<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="1" WIDTH="100%" class="current_location_table">
<TR>
	<TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title">&nbsp;<?php putGS("Publication"); ?>:</TD>
	<TD VALIGN="TOP" class="current_location_content"><?php echo htmlspecialchars($publicationObj->getName()); ?></TD>

	<TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title">&nbsp;<?php putGS("Issue"); ?>:</TD>
	<TD VALIGN="TOP" class="current_location_content"><?php echo $issueObj->getIssueNumber(); ?>. <?php echo htmlspecialchars($issueObj->getName()); ?> (<?php echo htmlspecialchars($issueLanguage->getName()); ?>)</TD>

	<TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title">&nbsp;<?php putGS("Section"); ?>:</TD>
	<TD VALIGN="TOP" class="current_location_content"><?php echo $sectionObj->getSectionNumber(); ?>. <?php echo htmlspecialchars($sectionObj->getName()); ?></TD>

	<TD ALIGN="RIGHT" WIDTH="1%" NOWRAP VALIGN="TOP" class="current_location_title">&nbsp;<?php putGS("Article"); ?>:</TD>
	<TD VALIGN="TOP" class="current_location_content"><?php echo htmlspecialchars($articleObj->getTitle()); ?> (<?php echo htmlspecialchars($articleLanguage->getName()); ?>)</TD>
</TR>
</TABLE>

<table width="100%" border="0">
<tr>
	<td style="padding:20px;" align="center">
コード例 #8
0
ファイル: deftime.php プロジェクト: nistormihai/Newscoop
</TR>
<tr class="table_list_header">
	<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("trial subscription"); ?></B></TD>
	<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("paid subscription"); ?></B></TD>
</tr>
<?php
$color = 0;
foreach ($defaultTimes as $time) {
	$country = new Country($time->getCountryCode(), $Language);
	?>
	<TR <?php  if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>
		<TD>
    	<A HREF="/<?php p($ADMIN); ?>/pub/editdeftime.php?Pub=<?php p($Pub); ?>&CountryCode=<?php  p($time->getCountryCode()); ?>&Language=<?php p($Language); ?>"><?php p(htmlspecialchars($country->getName())); ?> (<?php p(htmlspecialchars($country->getCode())); ?>)</A>
		</TD>
		<TD ALIGN="center">
			<?php p(htmlspecialchars($time->getTrialTime())); ?>
		</TD>
		<TD ALIGN="center">
			<?php p(htmlspecialchars($time->getPaidTime())); ?>
		</TD>
		<TD ALIGN="CENTER">
			<A HREF="/<?php p($ADMIN); ?>/pub/do_deldeftime.php?Pub=<?php p($Pub); ?>&CountryCode=<?php  p($time->getCountryCode()); ?>&Language=<?php p($Language); ?>&<?php echo SecurityToken::URLParameter(); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the subscription settings for $1?', "&quot;".htmlspecialchars($publicationObj->getName()).':'.htmlspecialchars($time->getCountryCode())."&quot;"); ?>');"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/delete.png" BORDER="0" ALT="<?php  putGS('Delete'); ?>" TITLE="<?php  putGS('Delete'); ?>" ></A>
		</TD>
	</TR>
<?php
}
?>	<TR><TD COLSPAN="2" NOWRAP>
</TABLE>

<?php camp_html_copyright_notice(); ?>
コード例 #9
0
ファイル: deftime.php プロジェクト: nidzix/Newscoop
    p($ADMIN);
    ?>
/pub/do_deldeftime.php?Pub=<?php 
    p($Pub);
    ?>
&CountryCode=<?php 
    p($time->getCountryCode());
    ?>
&Language=<?php 
    p($Language);
    ?>
&<?php 
    echo SecurityToken::URLParameter();
    ?>
" onclick="return confirm('<?php 
    putGS('Are you sure you want to delete the subscription settings for $1?', "&quot;" . htmlspecialchars($publicationObj->getName()) . ':' . htmlspecialchars($time->getCountryCode()) . "&quot;");
    ?>
');"><IMG SRC="<?php 
    echo $Campsite["ADMIN_IMAGE_BASE_URL"];
    ?>
/delete.png" BORDER="0" ALT="<?php 
    putGS('Delete');
    ?>
" TITLE="<?php 
    putGS('Delete');
    ?>
" ></A>
		</TD>
	</TR>
<?php 
}
コード例 #10
0
ファイル: do_duplicate.php プロジェクト: nistormihai/Newscoop
$correct = ($f_dest_publication_id > 0) && ($f_dest_issue_number > 0) && ($f_dest_section_number > 0);
$created = false;

if ($correct) {
    $dstSectionObj = $srcSectionObj->copy($f_dest_publication_id, $f_dest_issue_number,
    									  $f_language_id, $f_dest_section_number);
    if (($radioButton == "new_section") && ($f_dest_section_name != "")) {
        $dstSectionObj->setName($f_dest_section_name);
    }
	$dstPublicationObj = new Publication($f_dest_publication_id);
	$dstIssueObj = new Issue($f_dest_publication_id, $f_language_id, $f_dest_issue_number);
	$created = true;
	// Record the event in the log.
    $logtext = getGS('Section "$1" has been duplicated to $2. "$3" of "$4"',
                     $dstSectionObj->getName(), $f_dest_issue_number, $dstIssueObj->getName(),
                     $dstPublicationObj->getName());
    Log::Message($logtext, $g_user->getUserId(), 154);
	camp_html_goto_page("/$ADMIN/sections/duplicate_complete.php?"
		   ."f_src_publication_id=$f_src_publication_id"
		   ."&f_src_issue_number=$f_src_issue_number"
		   ."&f_src_section_number=$f_src_section_number"
		   ."&f_language_id=$f_language_id"
		   ."&f_dest_publication_id=$f_dest_publication_id"
		   ."&f_dest_issue_number=$f_dest_issue_number"
		   ."&f_dest_section_number=$f_dest_section_number");
} else {
	$topArray = array('Pub' => $srcPublicationObj, 'Issue' => $srcIssueObj, 'Section' => $srcSectionObj);
	camp_html_content_top(getGS('Duplicating section'), $topArray);
}

?>
コード例 #11
0
ファイル: do_edit.php プロジェクト: nistormihai/Newscoop
}
if (camp_html_has_msgs()) {
	camp_html_goto_page($backLink);
}

$changed = true;
$changed &= $issueObj->setName($f_issue_name);
if ($issueObj->getWorkflowStatus() == 'Y') {
	$changed &= $issueObj->setPublicationDate($f_publication_date);
}
$changed &= $issueObj->setIssueTemplateId($f_issue_template_id);
$changed &= $issueObj->setSectionTemplateId($f_section_template_id);
$changed &= $issueObj->setArticleTemplateId($f_article_template_id);

if ($changed) {
        $logtext = getGS('Issue "$1" ($2) updated in publication "$3"', $f_issue_name, $f_issue_number, $publicationObj->getName());
	Log::Message($logtext, $g_user->getUserId(), 11);
} else {
	$errMsg = getGS("Could not save the changes to the issue.");
	camp_html_add_msg($errMsg);
	exit;
}

// The tricky part - language ID and URL name must be unique.
$conflictingIssues = Issue::GetIssues($f_publication_id, $f_new_language_id, null, $f_url_name, null, false, null, true);
$conflictingIssue = array_pop($conflictingIssues);
// If it conflicts with another issue
if ($errorMsg = camp_is_issue_conflicting($f_publication_id, $f_issue_number, $f_new_language_id, $f_url_name, true)) {
	camp_html_add_msg($errorMsg);
	camp_html_goto_page($backLink);
} else {
コード例 #12
0
ファイル: index.php プロジェクト: nistormihai/Newscoop
$f_subscription_id = Input::Get('f_subscription_id', 'int', 0);

$publicationObj = new Publication($f_publication_id);
$languageObj = new Language($publicationObj->getDefaultLanguageId());
$subscription = new Subscription($f_subscription_id);

$manageUser = new User($f_user_id);
$sections = SubscriptionSection::GetSubscriptionSections($f_subscription_id);

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");
$crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",
"/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");
$crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");
$crumbs[] = array(getGS("Subscribed sections").": ".$publicationObj->getName(), "");
echo camp_html_breadcrumbs($crumbs);

$subscription_num_sections = SubscriptionSection::GetNumSections($f_subscription_id);
$publication_num_sections = Section::GetNumUniqueSections($f_publication_id);

$subscription_num_sections_nolang = SubscriptionSection::GetNumSections($f_subscription_id, null, 0);
$publication_num_sections_nolang = Section::GetNumUniqueSections($f_publication_id, false);

?>
<P>
<table cellpadding="0" cellspacing="0" class="action_buttons">
<tr>
	<td valign=top>
		<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">
<?php
コード例 #13
0
ファイル: edit.php プロジェクト: nidzix/Newscoop
    putGS("Add new publication");
    ?>
</B></A>
	</TD>
<?php 
}
if ($g_user->hasPermission("DeletePub")) {
    ?>
    <TD style="padding-left: 10px;"><A HREF="/<?php 
    echo $ADMIN;
    ?>
/pub/do_del.php?Pub=<?php 
    p($f_publication_id);
    ?>
" onclick="return confirm('<?php 
    putGS('Are you sure you want to delete the publication $1?', htmlspecialchars($publicationObj->getName()));
    ?>
');"><IMG SRC="<?php 
    echo $Campsite["ADMIN_IMAGE_BASE_URL"];
    ?>
/delete.png" BORDER="0"></A></TD>
    <TD><A HREF="/<?php 
    echo $ADMIN;
    ?>
/pub/do_del.php?Pub=<?php 
    p($f_publication_id);
    ?>
&<?php 
    echo SecurityToken::URLParameter();
    ?>
" onclick="return confirm('<?php 
コード例 #14
0
ファイル: edit.php プロジェクト: nistormihai/Newscoop
	<TD ><A HREF="/<?php echo $ADMIN; ?>/issues/?Pub=<?php  p($f_publication_id); ?>"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/go_to.png" BORDER="0"></A></TD>
</TR>
</TABLE>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-bottom: 1em;">
<TR>
<?php  if ($g_user->hasPermission("ManagePub")) { ?>    <P>
	<TD>
		<A HREF="/<?php echo $ADMIN; ?>/pub/add.php?Back=<?php p(urlencode($_SERVER['REQUEST_URI'])); ?>"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A>
	</TD>
	<TD>
		<A HREF="/<?php echo $ADMIN; ?>/pub/add.php?Back=<?php p(urlencode($_SERVER['REQUEST_URI'])); ?>"><B><?php  putGS("Add new publication"); ?></B></A>
	</TD>
<?php  } ?>
<?php
if ($g_user->hasPermission("DeletePub")) {
?>
	<TD style="padding-left: 10px;"><A HREF="do_del.php?Pub=<?php p($f_publication_id); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the publication $1?', htmlspecialchars($publicationObj->getName())); ?>');"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/delete.png" BORDER="0"></A></TD>
	<TD><A HREF="do_del.php?Pub=<?php p($f_publication_id); ?>&<?php echo SecurityToken::URLParameter(); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the publication $1?', htmlspecialchars($publicationObj->getName())); ?>');"><B><?php  putGS("Delete"); ?></B></A></TD>
<?php } ?>
</TR>
</TABLE>

<?php camp_html_display_msgs(0); ?>

<FORM METHOD="POST" ACTION="do_edit.php" onsubmit="return <?php camp_html_fvalidate(); ?>;">
<?php echo SecurityToken::FormParameter(); ?>
<?php include("pub_form.php"); ?>
</FORM>
<P>
<?php camp_html_copyright_notice(); ?>
コード例 #15
0
$cPaidTime = Input::Get('cPaidTime', 'int', 0);

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
	exit;
}

$backLink = "/$ADMIN/pub/countryadd.php?Pub=$cPub&Language=$Language";
$publicationObj = new Publication($cPub);

if (empty($cCountryCode)) {
	camp_html_add_msg(getGS('You must select a country.'));
	camp_html_goto_page($backLink);
}

$values = array('TrialTime' => $cTrialTime,
				'PaidTime' => $cPaidTime);
$defaultTime = new SubscriptionDefaultTime($cCountryCode, $cPub);
if ($defaultTime->exists()) {
	$defaultTime->update($values);
} else {
	$created = $defaultTime->create($values);
	if (!$created) {
    	camp_html_add_msg(getGS("The subscription settings for '$1' could not be added.", $publicationObj->getName().':'.$cCountryCode));
    	camp_html_goto_page($backLink);
	}
}
camp_html_add_msg(getGS("Country subscription settings updated."), "ok");
camp_html_goto_page("/$ADMIN/pub/deftime.php?Pub=$cPub&Language=$Language");

?>
コード例 #16
0
ファイル: do_edit.php プロジェクト: nidzix/Newscoop
$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.');
    camp_html_add_msg($errorMsg);
}
camp_html_goto_page($backLink);
コード例 #17
0
ファイル: do_add_prev.php プロジェクト: nistormihai/Newscoop
if (count($existingIssues) > 0) {
	$conflictingIssue = array_pop($existingIssues);
	$conflictingIssueLink = "/$ADMIN/issues/edit.php?"
		."Pub=$f_publication_id"
		."&Issue=".$conflictingIssue->getIssueNumber()
		."&Language=".$conflictingIssue->getLanguageId();

	$errMsg = getGS('The number must be unique for each issue in this publication of the same language.')."<br>".getGS('The values you are trying to set conflict with issue "$1$2. $3 ($4)$5".',
		"<a href='$conflictingIssueLink' class='error_message' style='color:#E30000;'>",
		$conflictingIssue->getIssueNumber(),
		$conflictingIssue->getName(),
		$conflictingIssue->getLanguageName(),
		'</a>');
	camp_html_add_msg($errMsg);
	camp_html_goto_page($backLink);
}

$issueCopies = $lastIssue->copy(null, $f_issue_number);
if (!is_null($issueCopies)) {
	$issueCopy = $issueCopies[0];
	camp_html_add_msg(getGS("Issue created."), "ok");
	$logtext = getGS('New issue $1 from $2 in publication $3', $f_issue_number,
					 $lastIssue->getIssueNumber(), $publicationObj->getName());
	Log::Message($logtext, $g_user->getUserId(), 11);
	camp_html_goto_page("/$ADMIN/issues/edit.php?Pub=$f_publication_id&Issue=".$issueCopy->getIssueNumber()
		   ."&Language=".$issueCopy->getLanguageId());
} else {
	camp_html_add_msg(getGS("The issue could not be added."));
	camp_html_goto_page($backLink);
}
?>
コード例 #18
0
$topArray = array('Pub' => $srcPublicationObj, 'Issue' => $srcIssueObj, 'Section' => $srcSectionObj);
camp_html_content_top(getGS('Duplicating section'), $topArray);

?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php  putGS("Duplicating section"); ?> </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<TR>
	<TD COLSPAN="2">
		<BLOCKQUOTE>
 	  <?php  putGS('Section $1 has been duplicated to $2. $3 of $4', '<B>'.$srcSectionObj->getName().'</B>', '<B>'.$dstSectionObj->getIssueNumber().'</B>', '<B>'.$dstIssueObj->getName().' ('.$dstIssueObj->getLanguageName().')</B>', '<B>'.$dstPublicationObj->getName().'</B>'); ?>
		</BLOCKQUOTE>
	</TD>
</TR>
<TR>
	<TD COLSPAN="2">
		<DIV ALIGN="CENTER">
            <table>
            <tr>
                <td>
                   <b><a href="<?php echo "/$ADMIN/sections/edit.php?Pub=$f_dest_publication_id&Issue=$f_dest_issue_number&Section=$f_dest_section_number&Language=$f_language_id"; ?>"><?php putGS("Go to new section"); ?></a></b>
                </td>
                <td style="padding-left: 50px;">
    	           <b><a href="<?php echo "/$ADMIN/sections/edit.php?Pub=$f_src_publication_id&Issue=$f_src_issue_number&Section=$f_src_section_number&Language=$f_language_id"; ?>"><?php putGS("Go to source section"); ?></a></b>
    	        </td>
    	    </tr>
コード例 #19
0
    /**
     * Performs the action; returns true on success, false on error.
     *
     * @param $p_context - the current context object
     * @return bool
     */
    public function takeAction(CampContext &$p_context)
    {
        $p_context->default_url->reset_parameter('f_'.$this->m_name);
        $p_context->url->reset_parameter('f_'.$this->m_name);

        if (!is_null($this->m_error)) {
            return false;
        }

        // Check that the article exists.
        $articleMetaObj = $p_context->default_article;
        if (!$articleMetaObj->defined) {
            $this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.',
            ACTION_SUBMIT_COMMENT_ERR_NO_ARTICLE);
            return false;
        }
        if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked)  {
            $this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.',
            ACTION_SUBMIT_COMMENT_ERR_NOT_ENABLED);
            return false;
        }

        // Get the publication.
        $publicationObj = new Publication($articleMetaObj->publication->identifier);
        $forum = new Phorum_forum($publicationObj->getForumId());
        if (!$forum->exists()) {
            $forum->create();
            $forum->setName($publicationObj->getName());
            $publicationObj->setForumId($forum->getForumId());
        }
        $forumId = $forum->getForumId();

        $user = $p_context->user;
        if ($user->defined) {
            $phorumUser = Phorum_user::GetByUserName($user->uname);
            if (is_null($phorumUser)) {
                $phorumUser = new Phorum_user();
            }
            $userId = $user->identifier;
            $userEmail = $user->email;
            $userRealName = $user->name;
            $userPasswd = $user->password_encrypted;
            // Check if the phorum user existed or was created successfuly.
            // If not, set the error code to 'internal error' and exit.
            if (!Phorum_user::CampUserExists($userId)
            && !$phorumUser->create($user->uname, $userPasswd, $userEmail, $userId)) {
                $this->m_error = new PEAR_Error('There was an internal error when submitting the comment (code 1).',
                ACTION_SUBMIT_COMMENT_ERR_INTERNAL);
                return false;
            }
        } else {
            if ($forum->getPublicPermissions() & (PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY)) {
                if (!isset($this->m_properties['reader_email'])) {
                    $this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.',
                    ACTION_SUBMIT_COMMENT_ERR_NO_EMAIL);
                    return false;
                }
                $userId = null;
                $userEmail = $this->m_properties['reader_email'];
                $userRealName = $userEmail;
            } else {
                $this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.',
                ACTION_SUBMIT_COMMENT_ERR_NO_PUBLIC);
                return false;
            }
        }

        // Validate the CAPTCHA code if it was enabled for the current publication.
        if ($publicationObj->isCaptchaEnabled()) {
            if ($this->_processCaptcha() === FALSE) {
                return FALSE;
            }
        }

        // Check if the reader was banned from posting comments.
        if (Phorum_user::IsBanned($userRealName, $userEmail)) {
            $this->m_error = new PEAR_Error('You are banned from submitting comments.',
            ACTION_SUBMIT_COMMENT_ERR_BANNED);
            return false;
        }

        // Create the first post message (if needed)
        $articleObj = new Article($articleMetaObj->language->number, $articleMetaObj->number);
        $firstPost = $this->CreateFirstComment($articleObj, $forumId);
        if (is_null($firstPost)) {
            $this->m_error = new PEAR_Error('There was an internal error when submitting the comment (code 2).',
            ACTION_SUBMIT_COMMENT_ERR_INTERNAL);
            return false;
        }

        // Set the parent to the currently viewed comment if a certain existing
        // comment was selected. Otherwise, set the parent identifier to the root message.
        $parentMessage = new Phorum_message($p_context->comment->identifier);
        if (!$parentMessage->exists()) {
            $parentMessage = $firstPost;
        }

        // Create the comment. If there was an error creating the comment set the
        // error code to 'internal error' and exit.
        $commentObj = new Phorum_message();
        if (!$commentObj->create($forumId, $this->m_properties['subject'],
        $this->m_properties['content'], $firstPost->getThreadId(),
        $parentMessage->getMessageId(), $this->m_properties['nickname'], $userEmail,
        is_null($userId) ? 0 : $userId)) {
            $this->m_error = new PEAR_Error('There was an internal error when submitting the comment (code 3).',
            ACTION_SUBMIT_COMMENT_ERR_INTERNAL);
            return false;
        }

        // If the user was unknown (public comment) and public comments were moderated
        // or the user was known (subscriber comment) and subscriber comments were moderated
        // set the comment status to 'hold'. Otherwise, set the status to 'approved'.
        if ((!is_null($userId) && $publicationObj->commentsSubscribersModerated())
        || (is_null($userId) && $publicationObj->commentsPublicModerated())) {
            $commentObj->setStatus(PHORUM_STATUS_HOLD);
        } else {
            $commentObj->setStatus(PHORUM_STATUS_APPROVED);
        }

        // Link the message to the current article.
        $isFirstMessage = ($firstPost->getThreadId() == 0);
        ArticleComment::Link($articleMetaObj->number, $articleMetaObj->language->number,
        $commentObj->getMessageId(), $isFirstMessage);

        $p_context->comment = new MetaComment($commentObj->getMessageId());

        $p_context->default_url->reset_parameter('f_comment_reader_email');
        $p_context->default_url->reset_parameter('f_comment_subject');
        $p_context->default_url->reset_parameter('f_comment_content');
        $p_context->default_url->reset_parameter('f_submit_comment');
        $p_context->default_url->reset_parameter('f_captcha_code');
        $p_context->url->reset_parameter('f_comment_reader_email');
        $p_context->url->reset_parameter('f_comment_subject');
        $p_context->url->reset_parameter('f_comment_content');
        $p_context->url->reset_parameter('f_submit_comment');
        $p_context->url->reset_parameter('f_captcha_code');

        $this->m_properties['rejected'] = false;

        $this->m_error = ACTION_OK;
        return true;
    }
コード例 #20
0
ファイル: do_add_alias.php プロジェクト: nistormihai/Newscoop
$created = false;
$errorMsgs = array();
if (empty($cName)) {
	$correct = false;
	$errorMsgs[] = getGS('You must fill in the $1 field.', '<B>Name</B>');
}

$aliases = 0;
if ($correct) {
	$aliasDups = count(Alias::GetAliases(null, null, $cName));
	if ($aliasDups <= 0) {
		$newAlias = new Alias();
		$created = $newAlias->create(array('Name' => "$cName", "IdPublication" => "$cPub"));
		if ($created) {
			$logtext = getGS('The site alias "$1" has been added to publication "$2".',
						$cName, $publicationObj->getName());
			Log::Message($logtext, $g_user->getUserId(), 151);
			camp_html_goto_page("/$ADMIN/pub/aliases.php?Pub=$cPub");
		}
	}
	else {
		$errorMsgs[] = getGS('Another alias with the same name exists already.');
	}
}

if (!$created && !$correct) {
	$errorMsgs[] = getGS('The site alias $1 could not be added.', '<B>'.$cName.'</B>');
}

$crumbs = array(getGS("Publication Aliases") => "aliases.php?Pub=$cPub");
camp_html_content_top(getGS("Adding new alias"), array("Pub" => $publicationObj), true, false, $crumbs);
コード例 #21
0
if (count($subscriptions) > 0) {
	$color=0;
	?>
	<TR class="table_list_header">
		<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Publication"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Left to pay"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Type"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="1%" ><B><?php  putGS("Active"); ?></B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="1%" ><B><?php  putGS("Delete"); ?></B></TD>
	</TR>
<?php
	foreach ($subscriptions as $subscription) {
		$publicationObj = new Publication($subscription->getPublicationId());
?>	<TR <?php  if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>
		<TD>
		<A HREF="/<?php echo $ADMIN; ?>/users/subscriptions/sections/?f_subscription_id=<?php p($subscription->getSubscriptionId()); ?>&f_publication_id=<?php p($subscription->getPublicationId()); ?>&f_user_id=<?php echo $editUser->getUserId(); ?>"><?php p(htmlspecialchars($publicationObj->getName())); ?></A>&nbsp;
		</TD>
		<TD >
			<A HREF="/<?php echo $ADMIN; ?>/users/subscriptions/topay.php?f_user_id=<?php echo $editUser->getUserId(); ?>&f_subscription_id=<?php p($subscription->getSubscriptionId()); ?>">
			<?php  p(htmlspecialchars($subscription->getToPay())).' '.p(htmlspecialchars($subscription->getCurrency())); ?></A>
		</TD>
		<TD >
			<?php
			$sType = $subscription->getType();
			if ($sType == 'T') {
				putGS("Trial");
			} else {
				putGS("Paid");
			}
			?>
		</TD>
コード例 #22
0
ファイル: do_del_alias.php プロジェクト: nistormihai/Newscoop
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");
camp_html_content_top(getGS("Deleting alias"), array("Pub" => $publicationObj), true, false, $crumbs);

?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
コード例 #23
0
ファイル: do_del.php プロジェクト: nistormihai/Newscoop
}

$subscriptionsRemaining = Subscription::GetNumSubscriptions($Pub);
if ($subscriptionsRemaining > 0) {
	$errorMsgs[] = getGS('There are $1 subscription(s) left.', $subscriptionsRemaining);
	$doDelete = false;
}

if ($doDelete) {
	$forum = new Phorum_forum($publicationObj->getForumId());
	$forum->delete();
	$publicationObj->delete();
	camp_html_goto_page("/$ADMIN/pub");
} else {
	$errorMsgs[] = getGS('The publication $1 could not be deleted.',
						 '<B>'.htmlspecialchars($publicationObj->getName()).'</B>');
}
echo camp_html_content_top(getGS("Deleting publication"), array("Pub" => $publicationObj));


?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php  putGS("Deleting publication"); ?> </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<TR>
	<TD COLSPAN="2">
コード例 #24
0
ファイル: do_change.php プロジェクト: nistormihai/Newscoop
foreach ($subscriptionSections as $section) {
	$section->setStartDate($f_subscription_start_date);
	$section->setDays($f_subscription_days);
	$section->setPaidDays($f_subscription_paid_days);
}

camp_html_goto_page("/$ADMIN/users/subscriptions/sections/?f_publication_id=$f_publication_id&f_user_id=$f_user_id&f_subscription_id=$f_subscription_id");
exit;

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");
$crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",
			"/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");
$crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");
$crumbs[] = array(getGS("Subscribed sections").": ".$publicationObj->getName(), "/$ADMIN/users/subscriptions/sections/?f_user_id=$f_user_id&f_subscription_id=$f_subscription_id&f_publication_id=$f_publication_id");
$crumbs[] = array(getGS("Updating subscription"), "");
echo camp_html_breadcrumbs($crumbs);

?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php  putGS("Changing subscription"); ?> </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<TR>
	<TD COLSPAN="2"><BLOCKQUOTE><LI><?php  putGS('The subscription could not be updated.'); ?></LI></BLOCKQUOTE></TD>
</TR>
コード例 #25
0
ファイル: do_del.php プロジェクト: nidzix/Newscoop
}
$articlesRemaining = Article::GetNumUniqueArticles($Pub);
if ($articlesRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 article(s) left.', $articlesRemaining);
    $doDelete = false;
}
$subscriptionsRemaining = Subscription::GetNumSubscriptions($Pub);
if ($subscriptionsRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 subscription(s) left.', $subscriptionsRemaining);
    $doDelete = false;
}
if ($doDelete) {
    $publicationObj->delete();
    camp_html_goto_page("/{$ADMIN}/pub");
} else {
    $errorMsgs[] = getGS('The publication $1 could not be deleted.', '<B>' . htmlspecialchars($publicationObj->getName()) . '</B>');
}
echo camp_html_content_top(getGS("Deleting publication"), array("Pub" => $publicationObj));
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
putGS("Deleting publication");
?>
 </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<TR>
コード例 #26
0
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}

// Check permissions
if (!$g_user->hasPermission('ManagePub')) {
	camp_html_display_error(getGS("You do not have the right to change publication information."));
	exit;
}

$Pub = Input::Get('Pub', 'int', 0);
$Language = Input::Get('Language', 'int', 1, true);
$CountryCode = Input::Get('CountryCode');
$cPaidTime = Input::Get('cPaidTime', 'int', 0);
$cTrialTime = Input::Get('cTrialTime', 'int', 0);

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
	exit;
}

$publicationObj = new Publication($Pub);
$defaultTime = new SubscriptionDefaultTime($CountryCode, $Pub);

$defaultTime->setTrialTime($cTrialTime);
$defaultTime->setPaidTime($cPaidTime);
camp_html_add_msg(getGS("Country subscription settings updated."), "ok");
$logtext = getGS('Default subscription time for "$1":$2 changed', $publicationObj->getName(), $CountryCode);
Log::Message($logtext, $g_user->getUserId(), 6);
camp_html_goto_page("/$ADMIN/pub/deftime.php?Pub=$Pub&Language=$Language");
?>
コード例 #27
0
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
echo $translator->trans("Duplicating section", array(), 'sections');
?>
 </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<TR>
	<TD COLSPAN="2">
		<BLOCKQUOTE>
 	  <?php 
echo $translator->trans('Section $1 has been duplicated to $2. $3 of $4', array('$1' => '<B>' . $srcSectionObj->getName() . '</B>', '$2' => '<B>' . $dstSectionObj->getIssueNumber() . '</B>', '$3' => '<B>' . $dstIssueObj->getName() . ' (' . $dstIssueObj->getLanguageName() . ')</B>', '$4' => '<B>' . $dstPublicationObj->getName() . '</B>'), 'sections');
?>
		</BLOCKQUOTE>
	</TD>
</TR>
<TR>
	<TD COLSPAN="2">
		<DIV ALIGN="CENTER">
            <table>
            <tr>
                <td>
                   <b><a href="<?php 
echo "/{$ADMIN}/sections/edit.php?Pub={$f_dest_publication_id}&Issue={$f_dest_issue_number}&Section={$f_dest_section_number}&Language={$f_language_id}";
?>
"><?php 
echo $translator->trans("Go to new section", array(), 'sections');
コード例 #28
0
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;
		}
	}
}

if ($correct) {
	camp_html_goto_page("/$ADMIN/pub/aliases.php?Pub=$f_publication_id&Alias=$f_alias_id");
	exit;
} else {
	$errorMsgs[] = getGS('The site alias $1 could not be modified.', '<B>'.$alias->getName().'</B>');