示例#1
0
/**
 * Set message
 * @param string $message
 * @return void
 */
function setMessage($message, $isError = FALSE)
{
    if (empty($_REQUEST['archive'])) { // fancybox
        echo '<script type="text/javascript">';
        echo 'try {';

        if (!$isError) {
            echo 'parent.$.fancybox.reload = true;';
            echo 'parent.$.fancybox.message = "', $message, '";';
        } else {
            echo 'parent.$.fancybox.error = "', $message, '";';
        }

        echo 'parent.$.fancybox.close();';
        echo '} catch (e) {}';
        echo '</script>';
        exit;
    }

    if ($isError) {
	    camp_html_display_error($message, null, true);
        exit;
    }

    camp_html_add_msg($message);
}
示例#2
0
function verify_user_type()
{
    global $uType;
    if (!isset($uType)) {
        read_user_common_parameters();
    }
    if ($uType != "Staff" && $uType != "Subscribers") {
        camp_html_display_error(getGS('Invalid value of user type parameter'));
        exit(0);
    }
    return $uType;
}
示例#3
0
function verify_user_type()
{
    global $uType;
    $translator = \Zend_Registry::get('container')->getService('translator');
    if (!isset($uType)) {
        read_user_common_parameters();
    }
    if ($uType != "Staff" && $uType != "Subscribers") {
        camp_html_display_error($translator->trans('Invalid value of user type parameter', array(), 'users'));
        exit(0);
    }
    return $uType;
}
示例#4
0
<?php
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/issues/issue_common.php");

// Check permissions
if (!$g_user->hasPermission('ManageIssue')) {
	camp_html_display_error(getGS('You do not have the right to add issues.'));
	exit;
}

$Pub = Input::Get('Pub', 'int');
if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid Input: $1', Input::GetErrorString()));
	exit;
}
$publicationObj = new Publication($Pub);
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$newIssueId = Issue::GetUnusedIssueId($Pub);
$lastCreatedIssue = Issue::GetLastCreatedIssue($Pub);

include_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/javascript_common.php");

camp_html_content_top(getGS('Copy previous issue'), array('Pub' => $publicationObj), true, true, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));


if (is_null($lastCreatedIssue)) { ?>
    <BLOCKQUOTE>
	<LI><?php  putGS('No previous issue.'); ?></LI>
    </BLOCKQUOTE>
    <?php
} else {
	camp_html_display_msgs();
示例#5
0
if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
	exit;
}

$issueObj = new Issue($Pub, $Language, $Issue);
$publicationObj = new Publication($Pub);
$sectionObj = new Section($Pub, $Issue, $Language, $Section);

if (!$publicationObj->exists()) {
    camp_html_display_error(getGS('Publication does not exist.'));
    exit;
}
if (!$issueObj->exists()) {
	camp_html_display_error(getGS('No such issue.'));
	exit;
}

$correct = true;
$modified = false;

$errors = array();
if ($cName == "") {
	camp_html_add_msg(getGS('You must fill in the $1 field.','"'.getGS('Name').'"'));
}
if ($cShortName == "")  {
	camp_html_add_msg(getGS('You must fill in the $1 field.','"'.getGS('URL Name').'"'));
}
$isValidShortName = camp_is_valid_url_name($cShortName);
示例#6
0
<?php

camp_load_translation_strings("article_type_fields");
camp_load_translation_strings("api");
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . "/classes/Topic.php";
// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to reassign a field type."));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$articleTypeFieldName = Input::Get('f_field_name');
$articleField = new ArticleTypeField($articleTypeName, $articleTypeFieldName);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array(getGS("Article type fields"), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array(getGS("Reassign a field type"), "");
echo camp_html_breadcrumbs($crumbs);
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
$lang = camp_session_get('LoginLanguageId', 1);
$languageObj = new Language($lang);
// Verify the merge rules
$options = array();
$convertibleFromTypes = $articleField->getConvertibleToTypes();
foreach ($convertibleFromTypes as $type) {
    $options[$type] = ArticleTypeField::VerboseTypeName($type, $languageObj->getLanguageId());
}
示例#7
0
<?php
/**
 * @package Campsite
 */

require_once($GLOBALS['g_campsiteDir']. "/$ADMIN_DIR/templates/template_common.php");

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

if (!$g_user->hasPermission('ManageTempl')) {
    camp_html_display_error(getGS("You do not have the right to modify templates."));
    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];
示例#8
0
<?php

require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$request = \Zend_Registry::get('container')->get('request');
$locale = $request->getLocale();
if (!Saas::singleton()->hasPermission('ManageArticleTypes')) {
    camp_html_display_error($translator->trans("You do not have the right to manage article types.", array(), 'article_type_fields'));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$lang = Language::GetLanguageByCode($locale);
$languageObj = new Language($lang->getLanguageId());
$articleType = new ArticleType($articleTypeName);
$fields = $articleType->getUserDefinedColumns(null, true, true);
$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'), "");
echo camp_html_breadcrumbs($crumbs);
$row_rank = 0;
if ($g_user->hasPermission("ManageArticleTypes")) {
    include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
    ?>
<script>
var field_ids = new Array;
示例#9
0
文件: copy.php 项目: nidzix/Newscoop
<?php

camp_load_translation_strings("plugin_debate");
// Check permissions
if (!$g_user->hasPermission('plugin_debate_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage debates.'));
    exit;
}
$allLanguages = Language::GetLanguages();
$f_debate_nr = Input::Get('f_debate_nr', 'int');
$f_fk_language_id = Input::Get('f_fk_language_id', 'int');
$debate = new Debate($f_fk_language_id, $f_debate_nr);
if (!$debate->exists()) {
    camp_html_display_error(getGS('Debate does not exists.'));
    exit;
}
$title = $debate->getProperty('title');
$question = $debate->getProperty('question');
$date_begin = $debate->getProperty('date_begin');
$date_end = $debate->getProperty('date_end');
$fk_language_id = $debate->getProperty('fk_language_id');
$votes_per_user = $debate->getProperty('votes_per_user');
/*
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj,
                  'Section' => $sectionObj);
camp_html_content_top(getGS('Add new article'), $topArray, true, false, array(getGS("Articles") => "/$ADMIN/articles/?f_publication_id=$f_publication_id&f_issue_number=$f_issue_number&f_section_number=$f_section_number&f_language_id=$f_language_id"));
*/
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
    <TD><A HREF="index.php"><IMG SRC="<?php 
示例#10
0
<?php

$translator = \Zend_Registry::get('container')->getService('translator');
require_once CS_PATH_SITE . DIR_SEP . 'scripts' . DIR_SEP . 'file_processing.php';
// check permission
if (!$g_user->hasPermission('ManageBackup')) {
    camp_html_display_error($translator->trans("You do not have the right to manage backups.", array(), 'home'));
    exit;
}
// make backup list and define file name based on index
$files = getBackupList();
$fileIndex = Input::Get('index', 'integer', 0);
if (!empty($files[$fileIndex]['name'])) {
    $file = CS_PATH_SITE . DIR_SEP . 'backup' . DIR_SEP . $files[$fileIndex]['name'];
} else {
    $file = null;
}
// main controller
$action = Input::Get('action', 'string', null);
switch ($action) {
    case 'backup':
        set_time_limit(0);
        ob_end_flush();
        flush();
        echo str_repeat(' ', 2048);
        echo '<pre>';
        $options = array('--default-dir', '--keep-session');
        include CS_PATH_SITE . DIR_SEP . 'bin' . DIR_SEP . 'newscoop-backup';
        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);
示例#11
0
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_number = Input::Get('f_article_number', 'int', 0);
$f_attachment_id = Input::Get('f_attachment_id', 'int', 0);
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI'], true);
    exit;
}
if ($f_publication_id > 0) {
    $publicationObj = new Publication($f_publication_id);
    $issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
    $sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
}
$articleObj = new Article($f_language_selected, $f_article_number);
$attachmentObj = new Attachment($f_attachment_id);
if (!$articleObj->exists()) {
    camp_html_display_error($translator->trans("Article does not exist."), null, true);
    exit;
}
$isDisabled = '';
$isReadOnly = '';
if (!$g_user->hasPermission('ChangeFile')) {
    $isDisabled = 'disabled';
    $isReadOnly = 'readonly';
    $title = $translator->trans('File information', array(), 'article_files');
} else {
    $title = $translator->trans('Change file information', array(), 'article_files');
}
// Add extra breadcrumb for image list.
if ($f_publication_id > 0) {
    $extraCrumbs = array($translator->trans("Attachments", array(), 'article_files') => "");
    $topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj, 'Article' => $articleObj);
示例#12
0
文件: index.php 项目: nidzix/Newscoop
<?php

camp_load_translation_strings("article_type_fields");
camp_load_translation_strings("api");
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
if (!Saas::singleton()->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to manage article types."));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$lang = camp_session_get('LoginLanguageId', 1);
$languageObj = new Language($lang);
$articleType = new ArticleType($articleTypeName);
$fields = $articleType->getUserDefinedColumns(null, true, true);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, "");
$crumbs[] = array(getGS("Article type fields"), "");
echo camp_html_breadcrumbs($crumbs);
$row_rank = 0;
if ($g_user->hasPermission("ManageArticleTypes")) {
    include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
    ?>
<script>
var field_ids = new Array;
var allShown = 0;
示例#13
0
$f_image_photographer = trim(Input::Get('f_image_photographer', 'string', null, true));
$f_image_place = trim(Input::Get('f_image_place', 'string', null, true));
$f_image_date = Input::Get('f_image_date', 'string', null, true);

$backLink = "/$ADMIN/articles/images/edit.php?"
		. "f_publication_id=" . $f_publication_id
		. "&f_issue_number=" . $f_issue_number
		. "&f_section_number=" . $f_section_number
		. "&f_article_number=" . $f_article_number
		. "&f_image_id=" . $f_image_id
		. "&f_language_id=" . $f_language_id
		. "&f_language_selected=" . $f_language_selected
		. "&f_image_template_id=" . $f_orig_image_template_id;

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), null, true);
	exit;
}

$articleObj = new Article($f_language_selected, $f_article_number);

if (!$g_user->hasPermission('ChangeImage') && !$g_user->hasPermission('AttachImageToArticle')) {
	camp_html_add_msg(getGS("You do not have the right to change image information."));
	camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'edit.php'));
}

$imageObj = new Image($f_image_id);

if (!is_null($f_image_description) && $g_user->hasPermission('ChangeImage')) {
	$attributes = array();
	$attributes['Description'] = $f_image_description;
示例#14
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/issues/issue_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
$translator = \Zend_Registry::get('container')->getService('translator');
// Check permissions
if (!$g_user->hasPermission('DeleteIssue')) {
    camp_html_display_error($translator->trans('You do not have the right to delete issues.', array(), 'issues'));
    exit;
}
$f_publication_id = Input::Get('f_publication_id', 'int');
$f_issue_number = Input::Get('f_issue_number', 'int');
$f_language_id = Input::Get('f_language_id', 'int');
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid Input: $1', array('$1' => Input::GetErrorString()), 'issues'));
    exit;
}
$numArticles = count(Article::GetArticles($f_publication_id, $f_issue_number, null, $f_language_id));
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
camp_html_content_top($translator->trans('Delete issue', array(), 'issues'), array('Pub' => $publicationObj, 'Issue' => $issueObj));
?>
<P>
<FORM METHOD="POST" ACTION="/<?php 
echo $ADMIN;
?>
/issues/do_del.php">
<?php 
echo SecurityToken::FormParameter();
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
示例#15
0
<?php

camp_load_translation_strings("article_type_fields");
camp_load_translation_strings("api");
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Log.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to reassign article type fields."));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$fieldName = trim(Input::Get('f_field_name'));
$fieldType = trim(Input::Get('f_article_field_type'));
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!$field->exists()) {
    $errorMsgs[] = getGS('The field $1 does not exist.', '<B>' . urlencode($fieldName) . '</B>');
    $correct = false;
}
if (array_search($fieldType, $field->getConvertibleToTypes()) === false) {
    $errorMsgs[] = getGS('Can not convert the field $1 from $2 to type $3.', $fieldName, $field->getType(), $fieldType);
    $correct = false;
}
if ($correct) {
示例#16
0
}
if ($errorStr == "") {
	$publicationObj = new Publication($Pub);
	if (!$publicationObj->exists())
		$errorStr = getGS('There was an error reading the publication parameter.');
}
if ($errorStr == "") {
	$issueObj = new Issue($Pub, $Language, $Issue);
	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);
示例#17
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/country/country_common.php";
$translator = \Zend_Registry::get('container')->getService('translator');
if (!$g_user->hasPermission('ManageCountries')) {
    camp_html_display_error($translator->trans("You do not have the right to add countries.", array(), 'country'));
    exit;
}
$languages = Language::GetLanguages(null, null, null, array(), array(), true);
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/");
$crumbs[] = array($translator->trans("Add new country"), "");
echo camp_html_breadcrumbs($crumbs);
$controller->view->headTitle($translator->trans('Add new country') . ' - Newscoop Admin', 'SET');
?>

<P>
<FORM NAME="dialog" METHOD="POST" ACTION="/<?php 
echo $ADMIN;
?>
/country/do_add.php">
<?php 
echo SecurityToken::FormParameter();
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="box_table">
<TR>
	<TD COLSPAN="2">
		<B><?php 
echo $translator->trans("Add new country");
?>
示例#18
0
    case 'article':
        foreach ($f_poll_exists as $poll_nr => $val) {
            $PollArticle = new PollArticle($poll_nr, $f_language_id, $f_article_nr);

            if (array_key_exists($poll_nr, $f_poll_checked) && !$PollArticle->exists()) {
                $PollArticle->create();
                $p_a++;
            } elseif (!array_key_exists($poll_nr, $f_poll_checked) && $PollArticle->exists()) {
                $PollArticle->delete();
                $p_u++;
            }
        }
        ?>
        <script>
        try {
        //window.opener.document.forms['article_edit'].f_message.value = "<?php putGS("$1/$2 polls assigned/unassigned.", $p_a, $p_u); ?>";
        window.opener.document.forms['article_edit'].onsubmit();
        window.opener.document.forms['article_edit'].submit();
        } catch (e) {}
        window.close();
        </script>
        <?php
    break;

    default:
	   camp_html_display_error(getGS('Invalid input'), 'javascript: window.close()');
	   exit;
    break;
}
?>
示例#19
0
            }
        }
    }
}
//
// This section is executed when the user finally hits the action button.
//
if (isset($_REQUEST["action_button"])) {
    $srcArticleIndexUrl = "/{$ADMIN}/articles/" . "?f_publication_id={$f_publication_id}" . "&f_issue_number={$f_issue_number}" . "&f_section_number={$f_section_number}" . "&f_language_id={$f_language_id}";
    $destArticleIndexUrl = "/{$ADMIN}/articles/" . "?f_publication_id={$f_destination_publication_id}" . "&f_issue_number={$f_destination_issue_number}" . "&f_section_number={$f_destination_section_number}" . "&f_language_id={$f_language_id}";
    // If no actions were selected, dont do anything.
    if ($f_action != "move" && count($doAction) == 0) {
        camp_html_goto_page($srcArticleIndexUrl);
    }
    if (!empty($f_action) && !SecurityToken::isValid()) {
        camp_html_display_error($translator->trans('Invalid security token!'));
        exit;
    }
    if ($f_action == "duplicate") {
        global $controller;
        $em = Zend_Registry::get('container')->getService('em');
        $ArticleDatetimeRepository = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\ArticleDatetime');
        foreach ($doAction as $articleNumber => $languageArray) {
            $events = $ArticleDatetimeRepository->findBy(array('articleId' => $articleNumber));
            $languageArray = array_keys($languageArray);
            $tmpLanguageId = camp_array_peek($languageArray);
            // Error checking
            if (!isset($articles[$articleNumber][$tmpLanguageId])) {
                continue;
            }
            // Grab the first article - it doesnt matter which one.
示例#20
0
         camp_html_goto_page($backLink);
     }
     $translationIssueObj->create($f_issue_urlname);
     if (!$translationIssueObj->exists()) {
         camp_html_add_msg(getGS('Unable to create the issue for translation $1.', $translationLanguageObj->getName()));
         camp_html_goto_page($backLink);
     }
 } else {
     $f_issue_name = Input::Get('f_issue_name', 'string', $issueObj->getName());
     $f_issue_urlname = Input::Get('f_issue_urlname', 'string', $issueObj->getUrlName());
     $translationIssueObj->update(array('Name' => $f_issue_name, 'ShortName' => $f_issue_urlname));
 }
 $f_section_number = $articleObj->getSectionNumber();
 $sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
 if (!$sectionObj->exists()) {
     camp_html_display_error(getGS('No such section.'), $backLink);
     exit;
 }
 $translationSectionObj = new Section($f_publication_id, $f_issue_number, $f_translation_language, $f_section_number);
 if (!$translationSectionObj->exists()) {
     if (!$g_user->hasPermission("ManageSection")) {
         camp_html_add_msg(getGS('A section must be created for the selected language but you do not have the right to create a section.'));
         camp_html_goto_page($backLink);
     }
     foreach ($sectionObj->getData() as $field => $fieldValue) {
         if ($field != 'IdLanguage') {
             $translationSectionObj->setProperty($field, $fieldValue, false);
         }
     }
     $f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
     $f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
示例#21
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/conf/configuration.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/Input.php";
camp_load_translation_strings("localizer");
require_once dirname(__FILE__) . '/Localizer.php';
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('ManageLocalizer')) {
    camp_html_display_error(getGS("You do not have the right to manage the localizer."));
    exit;
}
$prefix = Input::Get('prefix', 'string', '', true);
$newPrefix = Input::Get('new_prefix');
$moveStr = Input::Get('string');
Localizer::ChangeStringPrefix($prefix, $newPrefix, $moveStr);
header("Location: /{$ADMIN}/localizer/index.php");
exit;
示例#22
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/sections/section_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/SimplePager.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$Pub = Input::Get('Pub', 'int', 0);
$Issue = Input::Get('Issue', 'int', 0);
$Language = Input::Get('Language', 'int', 0);
$SectOffs = camp_session_get("SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, 0);
if ($SectOffs < 0) {
    $SectOffs = 0;
}
$ItemsPerPage = 15;
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($Pub);
$issueObj = new Issue($Pub, $Language, $Issue);
$allSections = Section::GetSections($Pub, $Issue, $Language, null, null, array('ORDER BY' => 'Number', 'LIMIT' => array('START' => $SectOffs, 'MAX_ROWS' => $ItemsPerPage)), true);
$totalSections = Section::GetTotalSections($Pub, $Issue, $Language);
$pager = new SimplePager($totalSections, $ItemsPerPage, "SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, "index.php?Pub={$Pub}&Issue={$Issue}&Language={$Language}&");
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top($translator->trans('Section List'), $topArray);
$controller->view->headTitle($translator->trans('Section List') . ' - Newscoop Admin', 'SET');
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
	<TD><A HREF="/<?php 
echo $ADMIN;
?>
示例#23
0
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;
}

$cPub = Input::Get('cPub', 'int');
$cName = trim(Input::Get('cName'));

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

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

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

$aliases = 0;
示例#24
0
<?php
camp_load_translation_strings("logs");
camp_load_translation_strings("api");
require_once($GLOBALS['g_campsiteDir']."/classes/Language.php");
require_once($GLOBALS['g_campsiteDir']."/classes/User.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Input.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Log.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Event.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/SimplePager.php');

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

$f_event_search_id = Input::Get('f_event_search_id', 'int', null, true);
$f_log_page_offset = camp_session_get('f_log_page_offset', 0);
if ($f_event_search_id == 0) {
	$f_event_search_id = null;
}

$events = Event::GetEvents();
if ($f_log_page_offset < 0) {
	$f_log_page_offset = 0;
}
$ItemsPerPage = 15;

$logs = Log::GetLogs($f_event_search_id,
	array('LIMIT' => array('MAX_ROWS' => $ItemsPerPage, 'START' => $f_log_page_offset)));
$numLogLines = Log::GetNumLogs($f_event_search_id);
示例#25
0
<?php

camp_load_translation_strings("plugin_debate");
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('plugin_debate_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage debates.'));
    exit;
}
$f_debate_nr = Input::Get('f_debate_nr', 'int');
$f_fk_language_id = Input::Get('f_fk_language_id', 'int');
$f_answers = Input::Get('f_answer', 'array');
$f_copy_statistics = Input::Get('f_copy_statistics', 'boolean');
$data = array('title' => Input::Get('f_title', 'string'), 'question' => Input::Get('f_question', 'string'), 'date_begin' => Input::Get('f_date_begin', 'string'), 'date_end' => Input::Get('f_date_end', 'string'), 'votes_per_user' => Input::Get('f_votes_per_user', 'int'));
foreach ($f_answers as $answer) {
    if (isset($answer['number']) && !empty($answer['number']) && strlen($answer['text'])) {
        $DebateAnswer = new DebateAnswer($f_fk_language_id, $f_debate_nr, $answer['number']);
        $answers[] = array('number' => $answer['number'], 'text' => $answer['text'], 'nr_of_votes' => $f_copy_statistics ? $DebateAnswer->getProperty('nr_of_votes') : 0, 'value' => $f_copy_statistics ? $DebateAnswer->getProperty('value') : 0);
    }
}
$source = new Debate($f_fk_language_id, $f_debate_nr);
$copy = $source->createCopy($data, $answers);
/*
foreach($translation->getAnswers() as $answer) {
    $answer->setProperty('answer', $f_answers[$answer->getNumber()]);
}
*/
header("Location: index.php");
示例#26
0
	$srcATF = new ArticleTypeField($f_src, $srcColumn);

	if (!$destATF->isConvertibleFrom($srcATF)) {
        $errMsgs[] = getGS('Cannot merge a $1 field ($2) into a $3 field ($4).',
                            getGS($srcATF->getType()), $srcATF->getDisplayName(),
                            getGS($destATF->getType()), $destATF->getDisplayName());
        $ok = false;
	}
}

//
// if f_action is Merge, do the merge and return them to article_types/ screen (or an error)
//
if ($ok && $f_action == 'Merge') {
	if (!SecurityToken::isValid()) {
		camp_html_display_error(getGS('Invalid security token!'));
		exit;
	}

	$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();
        }
示例#27
0
compute_user_rights($g_user, $canManage, $canDelete);
if (!$canManage) {
	$error = getGS("You do not have the right to change user account permissions.");
	camp_html_display_error($error);
	exit;
}

$userId = Input::Get('User', 'int', 0);
if ($userId > 0) {
	$editUser = new User($userId);
	if ($editUser->getUserName() == '') {
		camp_html_display_error(getGS('No such user account.'));
		exit;
	}
} else {
	camp_html_display_error(getGS('No such user account.'));
	exit;
}

$rights = camp_get_permission_list();
?>
<script type="text/javascript" src="<?php echo $Campsite['WEBSITE_URL']; ?>/js/campsite-checkbox.js"></script>
<table border="0" cellspacing="0" cellpadding="3" align="left">
<?php
$rightsList = array();
$checkboxPrefix = 'checkbox_';
$counter = 0;
$no_rights = 0;
foreach ($rights as $group_name => $group) {
    $no_rights += sizeof($group);
    foreach ($group as $right_name => $right_text) {
示例#28
0
 * @package Newscoop
 */
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Image.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ImageSearch.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Log.php';
$translator = \Zend_Registry::get('container')->getService('translator');
// TODO: permissions
if (!is_writable($Campsite['IMAGE_DIRECTORY'])) {
    camp_html_add_msg($translator->trans('Unable to add new image, target directory is not writable.', array(), 'users'));
    camp_html_add_msg(camp_get_error_message(CAMP_ERROR_WRITE_DIR, $Campsite['IMAGE_DIRECTORY']));
    camp_html_goto_page("/{$ADMIN}/");
    exit;
}
if (!$g_user->hasPermission('EditAuthors')) {
    camp_html_display_error($translator->trans('You do not have the permission to change authors.', array(), 'users'));
    exit;
}
$id = Input::Get('id', 'int', -1);
// Delete author
$del_id = Input::Get('del_id', 'int', -1);
if ($del_id > -1) {
    $author = new Author($del_id);
    if ($author->delete()) {
        camp_html_add_msg($translator->trans('Author deleted.', array(), 'users'), 'ok');
    }
}
// Add new author type
$add_author_type = Input::Get('add_author', 'string', null);
if ($add_author_type !== null) {
    $authorTypeObj = new AuthorType();
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())));
    exit;
}
$srcPublicationObj = new Publication($f_src_publication_id);
if (!$srcPublicationObj->exists()) {
    camp_html_display_error($translator->trans('Publication does not exist.'));
    exit;
}
$srcIssueObj = new Issue($f_src_publication_id, $f_language_id, $f_src_issue_number);
if (!$srcIssueObj->exists()) {
    camp_html_display_error($translator->trans('Issue does not exist.'));
    exit;
}
$srcSectionObj = new Section($f_src_publication_id, $f_src_issue_number, $f_language_id, $f_src_section_number);
if (!$srcSectionObj->exists()) {
    camp_html_display_error($translator->trans('Section does not exist.'));
    exit;
}
$dstPublicationObj = new Publication($f_dest_publication_id);
$dstIssueObj = new Issue($f_dest_publication_id, $f_language_id, $f_dest_issue_number);
$dstSectionObj = new Section($f_dest_publication_id, $f_dest_issue_number, $f_language_id, $f_dest_section_number);
$topArray = array('Pub' => $srcPublicationObj, 'Issue' => $srcIssueObj, 'Section' => $srcSectionObj);
camp_html_content_top($translator->trans('Duplicating section', array(), 'sections'), $topArray);
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
echo $translator->trans("Duplicating section", array(), 'sections');
?>
示例#30
0
<?php
require_once($GLOBALS['g_campsiteDir']. "/$ADMIN_DIR/topics/topics_common.php");

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

if (!$g_user->hasPermission('ManageTopics')) {
	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>');
}