Example #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");
?>
Example #2
0
function camp_successful_login($user, $f_login_language)
{
    global $ADMIN, $LiveUser, $LiveUserAdmin, $request, $requestId;

    $user->initLoginKey();
    $data = array('KeyId' => $user->getKeyId());
    if (is_object($LiveUser->_perm)) {
        $permUserId = $LiveUser->_perm->getProperty('perm_user_id');
        $LiveUserAdmin->updateUser($data, $permUserId);
        $LiveUser->updateProperty(true, true);
        LoginAttempts::ClearLoginAttemptsForIp();
        setcookie("LoginUserId", $user->getUserId());
        setcookie("LoginUserKey", $user->getKeyId());
        setcookie("TOL_Language", $f_login_language);
        Article::UnlockByUser($user->getUserId());

        // Try to restore request.
        if (!empty($request)) { // restore request
            camp_session_set("request_$requestId", $request);
            $request = unserialize($request);
            camp_html_goto_page($request['uri'], TRUE, array(
                'request' => $requestId,
            ));
        }

        // Go to admin index if no request is set.
        camp_html_goto_page("/$ADMIN/index.php");
    }
}
	    $issuePublishObj->setIssueNumber($Issue);
	    $issuePublishObj->setLanguageId($Language);
	    $issuePublishExists = false;
	}
    $issuePublishObj->setPublishAction($action);
    $issuePublishObj->setPublishArticlesAction($publish_articles);
    $issuePublishObj->setActionTime($publish_time);
	$created = 1;
}
if ($created) {

        $action = ($issuePublishExists) ? 'updated' : 'added';
        $issueObj = new Issue($Pub, $Language, $Issue);
        $logtext = getGS('Scheduled action $1 for issue #$2: "$3" (Publication: $4)', $action, $Issue, $issueObj->getName(), $Pub);
        Log::Message($logtext, $g_user->getUserId(), 16);
        camp_html_goto_page("/$ADMIN/issues/edit.php?Pub=$Pub&Issue=$Issue&Language=$Language");
}

$issueObj = new Issue($Pub, $Language, $Issue);
$publicationObj = new Publication($Pub);
$crumbs = array("Pub" => $publicationObj, "Issue" => $issueObj);
camp_html_content_top(getGS("Scheduling a new publish action"), $crumbs);
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" class="box_table">
	<TR>
		<TD COLSPAN="2">
			<B> <?php  putGS("Scheduling a new publish action"); ?> </B>
			<HR NOSHADE SIZE="1" COLOR="BLACK">
		</TD>
	</TR>
Example #4
0
	camp_html_display_error(getGS("You do not have the right to change subscriptions status."));
	exit;
}

$f_user_id = Input::Get('f_user_id', 'int', 0);
$f_subscription_id = Input::Get('f_subscription_id', 'int', 0);
$f_publication_id = Input::Get('f_publication_id');

$manageUser = new User($f_user_id);
$subscription = new Subscription($f_subscription_id);
$changed = $subscription->setIsActive(!$subscription->isActive());
if (!$changed) {
	$errorMsgs[] = getGS('Subscription status could not be changed.');
}
else {
	camp_html_goto_page("/$ADMIN/users/subscriptions/?f_user_id=$f_user_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("Change subscription status"), "");
echo camp_html_breadcrumbs($crumbs);

?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
Example #5
0
     if (!is_readable($file)) {
         camp_html_goto_page("/{$ADMIN}/backup.php");
     }
     set_time_limit(0);
     ob_end_flush();
     flush();
     echo str_repeat(' ', 2048);
     echo '<pre>';
     $options = array('f' => true, 'e' => true, 'b' => $file, '--keep-session');
     include CS_PATH_SITE . DIR_SEP . 'bin' . DIR_SEP . 'newscoop-restore';
     echo '</pre><script type="text/javascript">window.opener.location.reload();</script>';
     echo '<center><a href=# onclick="window.close()">' . $translator->trans('Close') . '</a></center>';
     exit(0);
 case 'download':
     if (!is_readable($file)) {
         camp_html_goto_page("/{$ADMIN}/backup.php");
     }
     header('Content-Disposition: attachment; filename=' . basename($file));
     header('Content-Length: ' . filesize($file));
     header('Content-Type: application/x-gzip');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Content-Transfer-Encoding: binary');
     set_time_limit(0);
     // it looks that a problem could happen here if the server is out of its disk space
     try {
         $fp = fopen($file, 'r');
         while (!feof($fp)) {
             print fread($fp, 8192);
             flush();
             ob_flush();
         }
Example #6
0
$created = false;
$errorMsgs = array();
if (empty($cName)) {
    $correct = false;
    $errorMsgs[] = $translator->trans('You must fill in the $1 field.', array('$1' => '<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) {
            $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
            $cacheService->clearNamespace('publication');
            camp_html_goto_page("/{$ADMIN}/pub/aliases.php?Pub={$cPub}");
        }
    } else {
        $errorMsgs[] = $translator->trans('Another alias with the same name exists already.', array(), 'pub');
    }
}
if (!$created && !$correct) {
    $errorMsgs[] = $translator->trans('The site alias $1 could not be added.', array('$1' => '<B>' . $cName . '</B>'), 'pub');
}
$crumbs = array($translator->trans("Publication Aliases", array(), 'pub') => "aliases.php?Pub={$cPub}");
camp_html_content_top($translator->trans("Adding new alias", array(), 'pub'), array("Pub" => $publicationObj), true, false, $crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
Example #7
0
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);
?>
Example #8
0
	}

	$res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
        $errMsgs[] = getGS("Merge failed.");
        $ok = false;
    }
    if ($ok) {
    	$f_delete = Input::get('f_delete', 'checkbox', 0);
        if ($f_delete) {
            // delete the source article type
            $at = new ArticleType($f_src);
            $at->delete();
        }

        camp_html_goto_page("/$ADMIN/article_types/");
        exit(0);
    }
}


//
// Otherwise, we are in preview mode, so render up a preview
//
if ($ok) {
    //
    // calculate where this article is in relation to all the articles of the src type
    //
    $articlesArray = $src->getArticlesArray();
    if (!count($articlesArray)) {
        $errMsgs[] = getGS("No articles.");
Example #9
0
$translator = \Zend_Registry::get('container')->getService('translator');
if (!SecurityToken::isValid()) {
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
if (!$g_user->hasPermission('DeleteCountries')) {
    camp_html_display_error($translator->trans("You do not have the right to delete countries.", array(), 'country'));
    exit;
}
$f_country_code = Input::Get('f_country_code');
$f_country_language = Input::Get('f_country_language');
$country = new Country($f_country_code, $f_country_language);
$language = new Language($f_country_language);
$deleted = $country->delete();
if ($deleted) {
    camp_html_goto_page("/{$ADMIN}/country");
}
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/");
$crumbs[] = array($translator->trans("Delete country", array(), 'country'), "");
echo camp_html_breadcrumbs($crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
echo $translator->trans("Delete country", array(), 'country');
?>
Example #10
0
//$Path = camp_topic_path($topicParent, $f_topic_language_id);

$errorMsgs = array();


if ($f_type_language_id <= 0) {
	$correct = false;
	$errorMsgs[] = getGS('You must choose a language for the article type.');
}

if ($correct) {
	// Translate existing type
	$type = new ArticleType($f_type_id);
	$created = $type->setName($f_type_language_id, $f_type_translation_name);
	if ($created) {
		camp_html_goto_page("/$ADMIN/article_types/index.php");
	}
	else {
		$errorMsgs[] = getGS('The translation could not be added.');
	}
}

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/$ADMIN/article_types/");
$crumbs[] = array(getGS("Adding new article type"), "");

echo camp_html_breadcrumbs($crumbs);

?>
<P>
Example #11
0
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}

$canManage = $g_user->hasPermission('ManageUserTypes');
if (!$canManage) {
	$error = getGS("You do not have the right to delete user types.");
	camp_html_display_error($error);
	exit;
}

$uTypeId = Input::Get('UType', 'string', '');
if (is_numeric($uTypeId) && $uTypeId > 0) {
	$userType = new UserType($uTypeId);
	if (!$userType->exists()) {
		camp_html_display_error(getGS('No such user type.'));
		exit;
	}
	$userType->delete();
} else {
	camp_html_display_error(getGS('No such user type.'));
	exit;
}

$msg = getGS("User Type '$1' successfully deleted", $userType->getName());
camp_html_add_msg($msg, 'ok');
camp_html_goto_page("/$ADMIN/user_types/");

?>
                $articleObj->setIsLocked(false);
            }
        }
        camp_html_add_msg(getGS("Article(s) unlocked."), "ok");
        break;
    case "context_box_update":
        camp_html_add_msg(getGS("Context Box updated"), "ok");
        break;
    case "schedule_publish":
        $args = $_REQUEST;
        unset($args[SecurityToken::SECURITY_TOKEN]);
        unset($args["f_article_code"]);
        $argsStr = camp_implode_keys_and_values($args, "=", "&");
        foreach ($_REQUEST["f_article_code"] as $code) {
            $argsStr .= "&f_article_code[]={$code}";
        }
        camp_html_goto_page("/{$ADMIN}/articles/multi_autopublish.php?" . $argsStr);
    case "translate":
        $args = $_REQUEST;
        unset($args[SecurityToken::SECURITY_TOKEN]);
        unset($args["f_article_code"]);
        $argsStr = camp_implode_keys_and_values($args, "=", "&");
        foreach ($_REQUEST["f_article_code"] as $code) {
            $argsStr .= "&f_article_code={$code}";
            break;
        }
        camp_html_goto_page("/{$ADMIN}/articles/translate.php?" . $argsStr);
}
$backUrl = "/{$ADMIN}/articles/index.php?f_publication_id={$f_publication_id}" . "&f_issue_number={$f_issue_number}&f_section_number={$f_section_number}" . "&f_language_id={$f_language_id}&f_language_selected={$f_language_selected}" . "&{$offsetVarName}={$f_article_offset}";
camp_html_goto_page($backUrl);
Example #13
0
    exit;
}
if (!$g_user->hasPermission('ManageCountries')) {
    camp_html_display_error($translator->trans("You do not have the right to change country names.", array(), 'country'));
    exit;
}
$f_country_code = Input::Get('f_country_code');
$f_country_language = Input::Get('f_country_language');
$f_country_name = trim(Input::Get('f_country_name'));
$country = new Country($f_country_code, $f_country_language);
$language = new Language($f_country_language);
if (empty($f_country_name)) {
    $errorMsgs[] = $translator->trans("You must fill in the \$1 field.", array('$1' => "<B>" . $translator->trans("Name") . "</B>"));
} else {
    if ($country->setName($f_country_name)) {
        camp_html_goto_page("/{$ADMIN}/country/index.php");
    } else {
        $errorMsgs[] = $translator->trans('The country name $1 could not be changed', array('$1' => '<B>' . htmlspecialchars($country->getName()) . '</B>'), 'country');
    }
}
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/");
$crumbs[] = array($translator->trans("Changing country name", array(), 'country'), "");
echo camp_html_breadcrumbs($crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
Example #14
0
	// save user customized rights
	$editUser->updatePermissions($permissions);

	$logtext = getGS('Permissions changed for user "$1"',$editUser->getUserName());
	Log::Message($logtext, $g_user->getUserId(), 55);
}
if ($editUser->isAdmin() && !$customizeRights && $canManage) {
	// save user rights based on existing user type
	$userTypeId = Input::Get('UserType', 'int', 0);
	if ($userTypeId != 0) {
		$editUser->setUserType($userTypeId);
	}
}

// unsubscribe
$unsubscribe = Input::Get('unsubscribe', 'bool', false);
if ($unsubscribe 
    && ($canManage || $editUser->getUserId() == $g_user->getUserId())) {
    $editUser->setPermission('MailNotify', false);
}

camp_html_add_msg(getGS("User '$1' information was changed successfully.",
	$editUser->getUserName()), "ok");
$editUser->fetch();
if ($editUser->getUserName() == $g_user->getUserName() && !$editUser->hasPermission('ManageUsers')) {
	camp_html_goto_page("/$ADMIN/");
}
camp_html_goto_page("/$ADMIN/users/edit.php?$typeParam&User=".$editUser->getUserId());

?>
Example #15
0
$commentObj = new Phorum_message();
$commentObj->create($forumId,
                    $f_comment_subject,
                    $f_comment_body,
                    $threadId,
                    $f_comment_parent_id,
                    $f_comment_nickname,
                    $g_user->getEmail(),
                    $g_user->getUserId());
$commentObj->setStatus(PHORUM_STATUS_APPROVED);

// Link the message to the article
$isFirstMessage = ($threadId == 0);
ArticleComment::Link($f_article_number, $f_language_id, $commentObj->getMessageId(), $isFirstMessage);

camp_html_goto_page(camp_html_article_url($articleObj, $f_language_selected, "edit.php")."#add_comment");


/**
 * Create the first message for an article, which is a blank message
 * with the title of the article as the subject.
 *
 * @param Article $p_article
 * @param int $p_forumId
 * @return mixed
 *      The comment created (or the one that already exists) on success,
 *      or false on error.
 */
function camp_comment_first_post($p_article, $p_forumId)
{
    // Check if the first post already exists.
Example #16
0
    $correct = false;
    $errors[] = getGS('The section number $1 was already in use.', $f_number);
}
if ($correct) {
    $newSection = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_number);
    $columns = array();
    $columns['Description'] = $f_description;
    $created = $newSection->create($f_name, $f_url_name, $columns);
    if ($created) {
	    if ($f_add_subscriptions) {
	        $numSubscriptionsAdded = Subscription::AddSectionToAllSubscriptions($f_publication_id, $f_number);
			if ($numSubscriptionsAdded == -1) {
	            $errors[] = getGS('Error updating subscriptions.');
			}
	    }
	    camp_html_goto_page("/$ADMIN/sections/edit.php?Pub=$f_publication_id&Issue=$f_issue_number&Language=$f_language_id&Section=".$newSection->getSectionNumber());
    }
}

$tmpArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top(getGS('Adding new section'), $tmpArray);
?>

<P>
<CENTER>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box" ALIGN="CENTER">
<TR>
	<TD COLSPAN="2">
		<B> <?php  putGS("Adding new section"); ?> </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
Example #17
0
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) {
	$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>
Example #18
0
require_once($GLOBALS['g_campsiteDir']. '/classes/Subscription.php');
require_once($GLOBALS['g_campsiteDir']. '/classes/SubscriptionSection.php');
require_once($GLOBALS['g_campsiteDir']. '/classes/Language.php');
require_once($GLOBALS['g_campsiteDir']. '/classes/Publication.php');
require_once($GLOBALS['g_campsiteDir']."/db_connect.php");

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

if (!$g_user->hasPermission('ManageSubscriptions')) {
	camp_html_display_error(getGS("You do not have the right to delete subscriptions."));
	exit;
}

$f_user_id = Input::Get('f_user_id', 'int', 0);
$f_publication_id = Input::Get('f_publication_id', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_subscription_id = Input::Get('f_subscription_id', 'int', 0);
$f_section_number = Input::Get('f_section_number', 'int', 0);

$publicationObj = new Publication($f_publication_id);
$languageObj = new Language($publicationObj->getDefaultLanguageId());
$manageUser = new User($f_user_id);

$subscriptionSection = new SubscriptionSection($f_subscription_id, $f_section_number, $f_language_id);
$subscriptionSection->delete();
camp_html_goto_page("/$ADMIN/users/subscriptions/sections/?f_user_id=$f_user_id&f_subscription_id=$f_subscription_id&f_publication_id=$f_publication_id");

?>
Example #19
0
        $f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
        $f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
        if ($f_section_urlname == "") {
            camp_html_add_msg(getGS('You must fill in the $1 field.', '"' . getGS('New section URL name') . '"'));
            camp_html_goto_page($backLink);
        }
        if (!camp_is_valid_url_name($f_section_urlname)) {
            camp_html_add_msg(getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('New section URL name') . '"'));
            camp_html_goto_page($backLink);
        }
        $translationSectionObj->create($f_section_name, $f_section_urlname);
        if (!$translationSectionObj->exists()) {
            camp_html_add_msg(getGS('Unable to create the section for translation $1.', $translationLanguageObj->getName()));
            camp_html_goto_page($backLink);
        }
    } else {
        $f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
        $f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
        $translationSectionObj->update(array('Name' => $f_section_name, 'ShortName' => $f_section_urlname));
    }
}
if ($articleObj->translationTitleExists($f_translation_title, $f_translation_language)) {
    camp_html_add_msg(getGS("There already is an article with the same name. Please change the name and try again."), "ok");
    camp_html_goto_page($backLink);
    exit;
}
$articleCopy = $articleObj->createTranslation($f_translation_language, $g_user->getUserId(), $f_translation_title);
camp_html_add_msg(getGS("Article translation created."), "ok");
ArticleIndex::RunIndexer(3, 10, true);
camp_html_goto_page(camp_html_article_url($articleCopy, $f_translation_language, 'edit.php'), true);
Example #20
0
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!$field->exists()) {
    $errorMsgs[] = $translator->trans('The field $1 does not exist.', array('$1' => '<B>' . urlencode($fieldName) . '</B>'), 'article_type_fields');
    $correct = false;
}
if (array_search($fieldType, $field->getConvertibleToTypes()) === false) {
    $errorMsgs[] = $translator->trans('Can not convert the field $1 from $2 to type $3.', array('$1' => $fieldName, '$2' => $field->getType(), '$3' => $fieldType), 'article_type_fields');
    $correct = false;
}
if ($correct) {
    $field->setType($fieldType);
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('article_type');
    camp_html_goto_page("/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
}
$crumbs = array();
$crumbs[] = array($translator->trans('Configure'), "");
$crumbs[] = array($translator->trans('Article Types'), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array($translator->trans("Article type fields", array(), 'article_type_fields'), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array($translator->trans("Adding new field", array(), 'article_type_fields'), "");
echo camp_html_breadcrumbs($crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
Example #21
0
	camp_html_display_error(getGS("You do not have the right to change topic name."));
	exit;
}

$f_topic_edit_id = Input::Get('f_topic_edit_id', 'int', 0);
$f_topic_language_id = Input::Get('f_topic_language_id', 'int', 0);
$f_name = trim(Input::Get('f_name', 'string', '', true));

$correct = true;
$editTopic = new Topic($f_topic_edit_id);
$path = camp_topic_path($editTopic, $f_topic_language_id);

$errorMsgs = array();
if (!empty($f_name)) {
	if ($editTopic->setName($f_topic_language_id, $f_name)) {
		camp_html_goto_page("/$ADMIN/topics/index.php");
	} else {
		$errorMsgs[] = getGS('The topic name is already in use by another topic.');
	}
} else {
	$errorMsgs[] = getGS('You must fill in the $1 field.','<B>'.getGS('Name').'</B>');
}

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Topics"), "/$ADMIN/topics/");
$crumbs[] = array(getGS("Change topic name"), "");
echo camp_html_breadcrumbs($crumbs);

?>
Example #22
0
    $errorMsgs[] = getGS('There are $1 section(s) left.', count($sectionsRemaining));
    $doDelete = false;
}
$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>
Example #23
0
<?php

/**
 * @package Newscoop
 *
 * @author Mihai Nistor <*****@*****.**>
 * @copyright 2010 Sourcefabric o.p.s.
 * @license http://www.gnu.org/licenses/gpl.txt
 * @link http://www.sourcefabric.org
 */
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Attachment.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
$translator = \Zend_Registry::get('container')->getService('translator');
if (!$g_user->hasPermission('AddFile')) {
    camp_html_goto_page("/{$ADMIN}/logout.php");
}
$q_now = $g_ado_db->GetOne("SELECT LEFT(NOW(), 10)");
$crumbs = array();
$crumbs[] = array($translator->trans('Content'), "");
$crumbs[] = array($translator->trans('Media Archive', array(), 'home'), "/{$ADMIN}/media-archive/index.php");
$crumbs[] = array($translator->trans('Add new file', array(), 'media_archive'), "");
$breadcrumbs = camp_html_breadcrumbs($crumbs);
$controller->view->headTitle($translator->trans('Add new file', array(), 'media_archive') . ' - Newscoop Admin', 'SET');
echo $breadcrumbs;
camp_html_display_msgs();
?>

  <br />
      <form method="POST" action="/<?php 
echo $ADMIN;
Example #24
0
    if (!$issuePublishObj->exists()) {
        $issuePublishObj->create();
        $issuePublishObj->setPublicationId($Pub);
        $issuePublishObj->setIssueNumber($Issue);
        $issuePublishObj->setLanguageId($Language);
        $issuePublishExists = false;
    }
    $issuePublishObj->setPublishAction($action);
    $issuePublishObj->setPublishArticlesAction($publish_articles);
    $issuePublishObj->setActionTime($publish_time);
    $created = 1;
}
if ($created) {
    $action = $issuePublishExists ? 'updated' : 'added';
    $issueObj = new Issue($Pub, $Language, $Issue);
    camp_html_goto_page("/{$ADMIN}/issues/edit.php?Pub={$Pub}&Issue={$Issue}&Language={$Language}");
}
$issueObj = new Issue($Pub, $Language, $Issue);
$publicationObj = new Publication($Pub);
$crumbs = array("Pub" => $publicationObj, "Issue" => $issueObj);
camp_html_content_top(getGS("Scheduling a new publish action"), $crumbs);
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" class="box_table">
	<TR>
		<TD COLSPAN="2">
			<B> <?php 
putGS("Scheduling a new publish action");
?>
 </B>
			<HR NOSHADE SIZE="1" COLOR="BLACK">
Example #25
0
                } else {
                    $tmpArticle->move($f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number);
                    $tmpArticle->setWorkflowStatus('S');
                    \Zend_Registry::get('container')->getService('dispatcher')->dispatch('article.submit', new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('article' => $tmpArticle)));
                    $tmpArticles[] = $tmpArticle;
                }
            }
        }
        $tmpArticle = camp_array_peek($tmpArticles);
        if ($f_mode == "single") {
            $url = camp_html_article_url($tmpArticle, $tmpArticle->getLanguageId(), "edit.php");
        } else {
            $url = $destArticleIndexUrl;
        }
        ArticleIndex::RunIndexer(3, 10, true);
        camp_html_goto_page($url);
    }
}
// END perform the action
$title = "";
if (count($doAction) > 1) {
    if ($f_action == "duplicate") {
        $title = $translator->trans("Duplicate articles", array(), 'articles');
    } elseif ($f_action == "move") {
        $title = $translator->trans("Move articles", array(), 'articles');
    } elseif ($f_action == "publish") {
        $title = $translator->trans("Publish articles", array(), 'articles');
    } elseif ($f_action == "submit") {
        $title = $translator->trans("Submit articles", array(), 'articles');
    }
} else {
Example #26
0
    $poll->setProperty('votes_per_user', $f_votes_per_user);
    $poll->setProperty('nr_of_answers', $f_nr_of_answers);
    $poll->setProperty('is_extended', $f_is_extended);
    foreach ($f_answers as $nr_answer => $text) {
        if ($text !== '__undefined__') {
            $answer = new PollAnswer($f_fk_language_id, $f_poll_nr, $nr_answer);
            if ($answer->exists()) {
                $answer->setProperty('answer', $text);
            } else {
                $answer->create($text);
            }
        }
    }
    PollAnswer::SyncNrOfAnswers($f_fk_language_id, $f_poll_nr);
} else {
    // create new poll
    $poll = new Poll($f_fk_language_id);
    $success = $poll->create($f_title, $f_question, $f_date_begin, $f_date_end, $f_nr_of_answers, $f_votes_per_user);
    if ($success) {
        $poll->setProperty('is_extended', $f_is_extended);
        foreach ($f_answers as $nr_answer => $text) {
            if ($text !== '__undefined__') {
                $answer = new PollAnswer($f_fk_language_id, $poll->getNumber(), $nr_answer);
                $success = $answer->create($text);
            }
        }
    }
}
$f_from = Input::Get('f_from', 'string', 'index.php');
camp_html_goto_page($f_from);
Example #27
0
    exit;
}

$f_path = Input::Get('f_path', 'string', '');
$f_charset = Input::Get('f_charset', 'string', '');


$baseUpload = $Campsite['TEMPLATE_DIRECTORY'] . $f_path;
$backLink = "/$ADMIN/templates/upload_templ.php?Path=" . urlencode($f_path);

$nrOfFiles = isset($_POST['uploader_count']) ? $_POST['uploader_count'] : 0;
for ($i = 0; $i < $nrOfFiles; $i++) {
    $tmpnameIdx = 'uploader_' . $i . '_tmpname';
    $nameIdx = 'uploader_' . $i . '_name';
    $statusIdx = 'uploader_' . $i . '_status';
    if ($_POST[$statusIdx] == 'done') {
        $tmpFilePath = CS_TMP_TPL_DIR . DIR_SEP . $_POST[$tmpnameIdx];
        $newFilePath = $baseUpload . DIR_SEP . $_POST[$nameIdx];
        $result = Template::ProcessFile($tmpFilePath, $newFilePath, $f_charset);
    }
}

if ($result) {
    camp_html_add_msg(getGS('"$1" files uploaded.', $nrOfFiles), "ok");
    camp_html_goto_page("/$ADMIN/templates/?Path=" . urlencode($f_path));
} else {
    camp_html_add_msg($f_path . DIR_SEP . basename($newFilePath));
    camp_html_goto_page($backLink);
}

?>
Example #28
0
require_once $GLOBALS['g_campsiteDir'] . '/classes/ImageSearch.php';
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/media-archive/editor_load_tinymce.php";
$translator = \Zend_Registry::get('container')->getService('translator');
$preferencesService = \Zend_Registry::get('container')->getService('preferences');
$captionStatus = $preferencesService->MediaRichTextCaptions;
$captionLimit = $preferencesService->MediaCaptionLength;
if (!$g_user->hasPermission('AddImage')) {
    camp_html_goto_page("/{$ADMIN}/logout.php");
}
// get all images without set date (0000-00-00)
$imageSearch = new ImageSearch('0000', 'id', 'ASC', 0, 100);
$imageSearch->run();
$imageData = $imageSearch->getImages();
if (empty($imageData)) {
    camp_html_add_msg($translator->trans('No images for multi editing.', array(), 'media_archive'), 'ok');
    camp_html_goto_page("/{$ADMIN}/media-archive/index.php");
}
$crumbs = array();
$crumbs[] = array($translator->trans('Content'), "");
$crumbs[] = array($translator->trans('Media Archive', array(), 'media_archive'), "/{$ADMIN}/media-archive/index.php");
$crumbs[] = array($translator->trans('Edit images', array(), 'media_archive'), "");
$breadcrumbs = camp_html_breadcrumbs($crumbs);
$controller->view->headTitle($translator->trans('Edit images', array(), 'media_archive') . ' - Newscoop Admin', 'SET');
echo $breadcrumbs;
camp_html_display_msgs();
?>

<div class="ui-widget-content padded-strong block-shadow">

<form name="image_multiedit" method="POST" action="/<?php 
echo $ADMIN;
Example #29
0
	if ($cSubs == "d") {
		$numSubscriptionsDeleted = Subscription::DeleteSubscriptionsInSection($Pub, $Section);
		if ($numSubscriptionsDeleted < 0) {
			$errors[] = getGS('Error updating subscriptions.');
		}
	}

	$conflictingSection = array_pop(Section::GetSections($Pub, $Issue, $Language, $cShortName, null, null, true));
	if (is_object($conflictingSection) && ($conflictingSection->getSectionNumber() != $Section)) {
		$conflictingSectionLink = "/$ADMIN/sections/edit.php?Pub=$Pub&Issue=$Issue&Language=$Language&Section=".$conflictingSection->getSectionNumber();

		$msg = getGS('The URL name must be unique for all sections in this issue.<br>The URL name you specified ("$1") conflicts with section "$2$3. $4$5"',
			$cShortName,
			"<a href='$conflictingSectionLink' class='error_message' style='color:#E30000;'>",
			$conflictingSection->getSectionNumber(),
			htmlspecialchars($conflictingSection->getName()),
			"</a>");
		camp_html_add_msg($msg);
		// placeholder for localization string - we might need this later.
		// getGS("The section could not be changed.");
	} else {
		$modified &= $sectionObj->setUrlName($cShortName);
		camp_html_add_msg(getGS("Section updated"), "ok");
	}
	$logtext = getGS('Section "$1" ($2) updated. (Publication: $3, Issue: $4)',
			 $cName, $Section, $publicationObj->getPublicationId(), $issueObj->getIssueNumber());
	Log::Message($logtext, $g_user->getUserId(), 21);
}
camp_html_goto_page($editUrl);

?>
Example #30
0
} else {
    $errMsg = $translator->trans("Could not save the changes to the issue.", array(), 'issues');
    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 {
    $issueObj->setProperty('ShortName', $f_url_name, false);
    $issueObj->setProperty('IdLanguage', $f_new_language_id, false);
    $issueObj->commit();
    //@New theme management
    if (SaaS::singleton()->hasPermission('ManageIssueTemplates')) {
        if ($newOutputSetting) {
            $outputSettingIssueService->insert($outSetIssue);
        } else {
            $outputSettingIssueService->update($outSetIssue);
        }
    }
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('issue');
    //@New theme management
    $link = "/{$ADMIN}/issues/edit.php?Pub={$f_publication_id}&Issue={$f_issue_number}&Language=" . $issueObj->getLanguageId();
    camp_html_add_msg($translator->trans('Issue updated', array(), 'issues'), "ok");
    camp_html_goto_page($link);
}