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
/**
 * 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);
}
Example #3
0
/**
 * 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);
			}
		}
	}
}
Example #4
0
/**
 * 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);
            }
        }
    }
}
Example #5
0
    public static function StoreImageDerivates($p_object_type, $p_object_id, $p_image)
    {
        if ($p_image['error'] !== 0 || self::TestImage($p_image) !== 0) {
            return false;   
        }

        foreach (BlogImageHelper::GetImagePaths($p_object_type, $p_object_id) as $dim => $path) {
            list ($width, $height) = explode('x', $dim);
            
            $d_width = $width * 2;
            $d_height = $height * 2;

            if (!file_exists(dirname($path))) {
                $mkdir = '';
                foreach (explode('/', dirname($path)) as $k => $dir) {
                    $mkdir .= '/'.$dir;
                    @mkdir($mkdir, 0775);
                }
            }

            $cmd = "convert -resize {$d_width}x -resize 'x{$d_height}<' -resize 50% -gravity center  -crop {$width}x{$height}+0+0 +repage {$p_image['tmp_name']} $path";
            system($cmd, $return_value);
            
            $all_right = $return_value || $all_right;
            
            if ($return_value ==  0) {
                $success[] = $width.'x'.$height;       
            } else {
                $failed[] = $width.'x'.$height;   
            }
        }
        
        if (function_exists('camp_html_add_msg')) {
            if (is_array($success)) {
                camp_html_add_msg(getGS('Created image derivate(s): $1', implode(', ', $success)), 'ok');
            }
            if (is_array($failed)) {
                camp_html_add_msg(getGS('Failed to create image derivate(s): $1', implode(', ', $failed)), 'error');    
            }
        }

        return $all_right;
    }
Example #6
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 #7
0
    if ($uploadFileSpecified) {
        $attributes = array();
        $image = Image::OnImageUpload($_FILES['file'], $attributes);
        if (PEAR::isError($image)) {
            camp_html_add_msg($image->getMessage());
        } else {
            $author->setImage($image->getImageId());
        }
    }
    $aliases = Input::Get("alias", "array");
    if (!empty($aliases)) {
        $author->setAliases($aliases);
    }
    camp_html_add_msg($translator->trans("Author saved.", array(), 'users'), "ok");
} elseif ($del_id_alias < 1 && $id > -1 && !$can_save) {
    camp_html_add_msg($translator->trans("Please fill at least first name and last name.", array(), 'users'));
}
if (!$id || $id == -1) {
    $author = new Author(1);
    if ($id == -1) {
        $id = 0;
    }
}
$controller->view->headTitle($translator->trans('Authors') . ' - Newscoop Admin', 'SET');
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Authors"), "");
$breadcrumbs = camp_html_breadcrumbs($crumbs);
echo $breadcrumbs;
?>
Example #8
0
                try {
                    move_uploaded_file($file['tmp_name'], $move_dest);
                    camp_html_add_msg($translator->trans('The file $1 has been uploaded successfully.', array('$1' => $file['name']), 'home'), 'ok');
                } catch (Exception $exc) {
                    $move_failed = true;
                    camp_html_add_msg($translator->trans('The file $1 could not be moved. Check you have enough of disk space.', array('$1' => $file['name']), 'home'));
                }
                // try to remove the (partially) moved file if the move was not successful
                if ($move_failed) {
                    try {
                        unlink($move_dest);
                    } catch (Exception $exc) {
                    }
                }
            } else {
                camp_html_add_msg($translator->trans("You have tried to upload an invalid backup file.", array(), 'home'));
            }
        }
        $files = getBackupList();
        break;
}
// show breadcrumbs
$crumbs = array();
$crumbs[] = array($translator->trans("Actions"), "");
$crumbs[] = array($translator->trans("Backup/Restore", array(), 'home'), "");
$breadcrumbs = camp_html_breadcrumbs($crumbs);
echo $breadcrumbs;
// view template
?>
<script type="text/javascript" src="<?php 
echo $Campsite['WEBSITE_URL'];
Example #9
0
$imageObj = new Image($f_image_id);

if (!is_null($f_image_description) && $g_user->hasPermission('ChangeImage')) {
	$attributes = array();
	$attributes['Description'] = $f_image_description;
	$attributes['Photographer'] = $f_image_photographer;
	$attributes['Place'] = $f_image_place;
	$attributes['Date'] = $f_image_date;
	$imageObj->update($attributes);
}

if ($g_user->hasPermission('AttachImageToArticle')) {
	if (is_numeric($f_image_template_id) && ($f_image_template_id > 0)) {
		$articleImageObj = new ArticleImage($f_article_number, $f_image_id);
		$updated = $articleImageObj->setTemplateId($f_image_template_id);
		if ($updated == false) {
			camp_html_add_msg(getGS("Image number '$1' already exists", $f_image_template_id));
			camp_html_goto_page($backLink);
		}
	}
}

camp_html_add_msg(getGS("Image '$1' updated.", $imageObj->getDescription()), "ok");

?>

<script type="text/javascript">
	window.location.href='<?php echo "/$ADMIN/articles/edit.php?f_language_id=$f_language_id&f_article_number=$f_article_number"; ?>'
</script>
Example #10
0
if (!$publicationObj->exists()) {
    camp_html_display_error($translator->trans("Publication does not exist."));
    exit;
}
$created = false;
$errorMsgs = array();
if (empty($f_issue_number) || !is_numeric($f_issue_number) || $f_issue_number <= 0) {
    camp_html_add_msg($translator->trans('You must fill in the $1 field.', array('$1' => '<B>' . $translator->trans('Number') . '</B>')));
}
if (camp_html_has_msgs()) {
    camp_html_goto_page($backLink);
}
// check if the issue number already exists
$lastIssue = Issue::GetLastCreatedIssue($f_publication_id);
$existingIssues = Issue::GetIssues($f_publication_id, null, $f_issue_number, null, null, false, null, true);
if (count($existingIssues) > 0) {
    $conflictingIssue = array_pop($existingIssues);
    $conflictingIssueLink = "/{$ADMIN}/issues/edit.php?" . "Pub={$f_publication_id}" . "&Issue=" . $conflictingIssue->getIssueNumber() . "&Language=" . $conflictingIssue->getLanguageId();
    $errMsg = $translator->trans('The number must be unique for each issue in this publication of the same language.', array(), 'issues') . "<br>" . $translator->trans('The values you are trying to set conflict with issue $1$2. $3 ($4)$5.', array('$1' => "<a href='{$conflictingIssueLink}' class='error_message' style='color:#E30000;'>", '$2' => $conflictingIssue->getIssueNumber(), '$3' => $conflictingIssue->getName(), '$4' => $conflictingIssue->getLanguageName(), '$5' => '</a>'), 'issues');
    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($translator->trans("Issue created.", array(), 'issues'), "ok");
    camp_html_goto_page("/{$ADMIN}/issues/edit.php?Pub={$f_publication_id}&Issue=" . $issueCopy->getIssueNumber() . "&Language=" . $issueCopy->getLanguageId());
} else {
    camp_html_add_msg($translator->trans("The issue could not be added.", array(), 'issues'));
    camp_html_goto_page($backLink);
}
Example #11
0
    if ($f_publish_action == "P" || $f_publish_action == "U") {
        $articlePublishObj->setPublishAction($f_publish_action);
    }
    if ($f_front_page_action == "S" || $f_front_page_action == "R") {
        $articlePublishObj->setFrontPageAction($f_front_page_action);
    }
    if ($f_section_page_action == "S" || $f_section_page_action == "R") {
        $articlePublishObj->setSectionPageAction($f_section_page_action);
    }
    Log::ArticleMessage($tmpArticle, getGS('Scheduled action added'), $g_user->getUserId(), 37);
}
if ($f_mode == "multi") {
    $args = $_REQUEST;
    unset($args["f_article_code"]);
    $argsStr = camp_implode_keys_and_values($args, "=", "&");
    camp_html_add_msg(getGS("Scheduled action added."), "ok");
    camp_html_goto_page("/{$ADMIN}/articles/index.php?" . $argsStr);
} else {
    ?>
	<script type="text/javascript">
    try {
        parent.$.fancybox.reload = true;
        parent.$.fancybox.message = '<?php 
    putGS('Actions updated.');
    ?>
';
        parent.$.fancybox.close();
    } catch (e) {
    }
	</script>
	<?php 
Example #12
0
require_once $GLOBALS['g_campsiteDir'] . '/classes/User.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Log.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
$translator = \Zend_Registry::get('container')->getService('translator');
if (!SecurityToken::isValid()) {
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_number = Input::Get('f_article_number', 'int', 0);
$f_image_id = Input::Get('f_image_id', 'int', 0);
$f_image_template_id = Input::Get('f_image_template_id', 'int', 0);
// Check input
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), null, true);
    exit;
}
// This file can only be accessed if the user has the right to change articles
// or the user created this article and it hasnt been published yet.
if (!$g_user->hasPermission('AttachImageToArticle')) {
    camp_html_display_error($translator->trans("You do not have the right to attach images to articles.", array(), 'article_images'), null, true);
    exit;
}
$articleObj = new Article($f_language_selected, $f_article_number);
$imageObj = new Image($f_image_id);
$articleImage = new ArticleImage($f_article_number, $f_image_id, $f_image_template_id);
$articleImage->delete();
Zend_Registry::get('container')->getService('image.rendition')->unsetArticleImageRenditions($f_article_number, $f_image_id);
camp_html_add_msg($translator->trans('The image has been removed from the article.', array(), 'article_images'), "ok");
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'edit.php'));
Example #13
0
}
if (!$g_user->hasPermission('AddImage')) {
	camp_html_goto_page("/$ADMIN/logout.php");
}
$attributes = array();
$attributes['Description'] = $f_image_description;
$attributes['Photographer'] = $f_image_photographer;
$attributes['Place'] = $f_image_place;
$attributes['Date'] = $f_image_date;
if (!empty($f_image_url)) {
	if (camp_is_valid_url($f_image_url)) {
		$image = Image::OnAddRemoteImage($f_image_url, $attributes, $g_user->getUserId());
	} else {
		camp_html_add_msg(getGS("The URL you entered is invalid: '$1'", htmlspecialchars($f_image_url)));
		camp_html_goto_page("/$ADMIN/media-archive/add.php");
	}
} elseif (!empty($_FILES['f_image_file'])) {
	$image = Image::OnImageUpload($_FILES['f_image_file'], $attributes, $g_user->getUserId());
} else {
	camp_html_add_msg(getGS("You must select an image file to upload."));
	camp_html_goto_page("/$ADMIN/media-archive/add.php");
}

// Check if image was added successfully
if (PEAR::isError($image)) {
	camp_html_add_msg($image->getMessage());
	camp_html_goto_page("/$ADMIN/media-archive/add.php");
}

?>
Example #14
0
if (!$g_user->hasPermission('plugin_blog_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage blogs.'));
    exit;
}

$f_blog_id = Input::Get('f_blog_id', 'int');
$f_entry_id = Input::Get('f_entry_id', 'int');

if (!$f_entry_id) {
    $user_id = $g_user->getUserId();   
}

$BlogEntry = new BlogEntry($f_entry_id, $f_blog_id);

if ($BlogEntry->store($is_admin, $user_id)) {
    camp_html_add_msg(getGS('Post saved.'), 'ok');
    ?>
    <script language="javascript">
        window.opener.location.reload();
        window.close();
    </script>
    <?php
    exit();
}

?>
<head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<META HTTP-EQUIV="Expires" CONTENT="now">
	<link rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/admin-style/admin_stylesheet.css" />
	<title><?php $BlogEntry->exists() ? putGS('Edit post') : putGS('Add new post'); ?></title>
Example #15
0
					$replaceObj = new FileTextSearch();
					$replaceObj->setExtensions(array('tpl','css'));
					$replaceObj->setSearchKey($searchKey);
					$replaceObj->setReplacementKey($replacementKey);
					$replaceObj->findReplace($Campsite['TEMPLATE_DIRECTORY']);
					Template::UpdateOnChange($template->getName(),
								 $f_destination_folder
								 . '/'
								 . basename($template->getName()));
				}
			}
			// Clear compiled templates
			require_once($GLOBALS['g_campsiteDir']."/template_engine/classes/CampTemplate.php");
			CampTemplate::singleton()->clear_compiled_tpl();

			camp_html_add_msg(getGS("Template(s) moved."), "ok");
			camp_html_goto_page($url);
		}
	}
} // END perform the action

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Templates"), "/$ADMIN/templates/");
$crumbs[] = array(getGS("Move templates"), "");
echo camp_html_breadcrumbs($crumbs);

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

camp_html_display_msgs();
Example #16
0
	$fields = ArticleTypeField::FetchFields($f_src_author_field, null, 'text', false, false, false, true, true);
	if (count($fields) == 0) {
	    camp_html_add_msg(getGS("Invalid or empty field $1. You must select a valid dynamic field.", $f_src_author_field));
	}

	foreach ($fields as $field) {
		camp_set_author($field, $errors);
		if (count($errors) == 0) {
			camp_html_add_msg(getGS("The author was set successfuly for articles of type '$1' from the field '$2'.",
			                        $field->getArticleType(), $field->getPrintName()), 'ok');
		} else {
            camp_html_add_msg(getGS("There were errors setting the author for articles of type '$1' from the field '$2'.",
                                    $field->getArticleType(), $field->getPrintName()));
		}
        foreach ($errors as $error) {
            camp_html_add_msg($error);
        }
	}
    camp_html_display_msgs();
}

$availableFields = ArticleTypeField::FetchFields(null, null, 'text', false, false, false, true, true);

?>

<br/>
<form name="f_set_author" method="post">
<TABLE BORDER="0" CELLSPACING="4" CELLPADDING="2" CLASS="table_input">
<TR>
    <TD VALIGN="TOP" align="left" nowrap>
        <?php putGS("Select the field from which to generate the author"); ?>:
Example #17
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);
}
Example #18
0
if (!empty($f_message)) {
    camp_html_add_msg($f_message, "ok");
}
if (!$articleObj->userCanModify($g_user)) {
    camp_html_add_msg($translator->trans("You do not have the right to change this article.  You may only edit your own articles and once submitted an article can only be changed by authorized users.", array(), 'articles'));
    camp_html_goto_page($BackLink);
    exit;
}
// Only users with a lock on the article can change it.
if ($articleObj->isLocked() && $g_user->getUserId() != $articleObj->getLockedByUser()) {
    $diffSeconds = time() - strtotime($articleObj->getLockTime());
    $hours = floor($diffSeconds / 3600);
    $diffSeconds -= $hours * 3600;
    $minutes = floor($diffSeconds / 60);
    $lockUser = new User($articleObj->getLockedByUser());
    camp_html_add_msg($translator->trans('Could not save the article. It has been locked by $1 $2 hours and $3 minutes ago.', array('$1' => $lockUser->getRealName(), '$2' => $hours, '$3' => $minutes), 'articles'));
    camp_html_goto_page($BackLink);
    exit;
}
// Update the article author
$blogService = Zend_Registry::get('container')->getService('blog');
$blogInfo = $blogService->getBlogInfo($g_user);
if (!empty($f_article_author)) {
    $em = Zend_Registry::get('container')->getService('em');
    $dispatcher = Zend_Registry::get('container')->getService('dispatcher');
    $language = $em->getRepository('Newscoop\\Entity\\Language')->findOneById($articleObj->getLanguageId());
    $authors = $em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthors($articleObj->getArticleNumber(), $language->getCode())->getArrayResult();
    ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
    foreach ($authors as $author) {
        $dispatcher->dispatch("user.set_points", new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('authorId' => $author['fk_author_id'])));
    }
Example #19
0
if (!$g_user->hasPermission('CommentModerate')) {
	camp_html_add_msg(getGS("You do not have the right to moderate comments." ));
?>
<script type="text/javascript">
window.close();
window.opener.location.reload();
</script>
<?php
	exit;
}

if (SystemPref::Get("UseDBReplication") == 'Y') {
    $dbReplicationObj = new DbReplication();
    $connectedToOnlineServer = $dbReplicationObj->connect();
    if ($connectedToOnlineServer == false) {
        camp_html_add_msg(getGS("Comments Disabled: you are either offline or not able to reach the Online server"));
?>
<script type="text/javascript">
window.close();
window.opener.location.reload();
</script>
<?php
		exit;
    }
}

if (!isset($connectedToOnlineServer)
        || $connectedToOnlineServer == true) {
	$f_comment_id = Input::Get("f_comment_id", "int");

	$banned = false;
Example #20
0
    exit;
}
$maxId = Image::GetMaxId();
$f_publication_id = Input::Get('f_publication_id', 'int', 0);
$f_issue_number = Input::Get('f_issue_number', 'int', 0);
$f_section_number = Input::Get('f_section_number', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_number = Input::Get('f_article_number', 'int', 0);
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI'], true);
    exit;
}
if (!is_writable($Campsite['IMAGE_DIRECTORY'])) {
    camp_html_add_msg($translator->trans("Unable to add new image.", array(), 'media_archive'));
    camp_html_add_msg(camp_get_error_message(CAMP_ERROR_WRITE_DIR, $Campsite['IMAGE_DIRECTORY']));
}
$articleObj = new Article($f_language_selected, $f_article_number);
$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);
$ImageTemplateId = ArticleImage::GetUnusedTemplateId($f_article_number);
$q_now = $g_ado_db->GetOne("SELECT LEFT(NOW(), 10)");
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
camp_html_display_msgs();
?>

<form method="POST" action="/<?php 
echo $ADMIN;
?>
/media-archive/do_upload.php" enctype="multipart/form-data">
Example #21
0
    if (!SecurityToken::isValid()) {
        camp_html_display_error(getGS('Invalid security token!'));
        exit;
    }

    $f_recaptcha_enabled = Input::Get('f_recaptcha_enabled', 'string', 'N');
    $f_recaptcha_subscriptions_enabled = Input::Get('f_recaptcha_subscriptions_enabled', 'string', 'N');
    $f_recaptcha_public_key = Input::Get('f_recaptcha_public_key', 'string');
    $f_recaptcha_private_key = Input::Get('f_recaptcha_private_key', 'string');

    SystemPref::Set('PLUGIN_RECAPTCHA_ENABLED', $f_recaptcha_enabled);
    SystemPref::Set('PLUGIN_RECAPTCHA_SUBSCRIPTIONS_ENABLED', $f_recaptcha_subscriptions_enabled);
    SystemPref::Set('PLUGIN_RECAPTCHA_PUBLIC_KEY', $f_recaptcha_public_key);
    SystemPref::Set('PLUGIN_RECAPTCHA_PRIVATE_KEY', $f_recaptcha_private_key);

    camp_html_add_msg(getGS('reCAPTCHA preferences updated.'), 'ok');
}

echo camp_html_breadcrumbs(array(
    array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'),
    array(getGS('reCAPTCHA'), ''),
    array(getGS('reCAPTCHA Settings'), ''),
));

camp_html_display_msgs();
?>
<p></p>

<table border="0" width="600" cellspacing="0" cellpadding="0" class="box_table">
<tr>
  <td width="190">
Example #22
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 #23
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);
     foreach ($_REQUEST["f_article_code"] as $code) {
         $argsStr .= "&f_article_code[]={$code}";
     }
     camp_session_set($offsetVarName, 0);
     camp_html_goto_page("/{$ADMIN}/articles/duplicate.php?" . $argsStr);
 case "unlock":
     foreach ($articleCodes as $articleCode) {
         $articleObj = new Article($articleCode['language_id'], $articleCode['article_id']);
         if ($articleObj->userCanModify($g_user)) {
             $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, "=", "&");
Example #25
0
        $error = $log;
    }
    //$Plugin->enable();
}
if (Input::Get('p_uninstall')) {
    $Plugin = new CampPlugin(Input::Get('p_plugin', 'string'));
    $Plugin->uninstall();
}
if (count($infos = CampPlugin::GetPluginsInfo()) > 0) {
    // check if update was needed
    CampPlugin::GetPluginsInfo(false, true);
    if ($needsUpdate = CampPlugin::GetNeedsUpdate()) {
        camp_html_add_msg($translator->trans("Some plugins have to be updated. Please press the save button.", array(), 'plugins'));
    }
} else {
    camp_html_add_msg($translator->trans("You have no installed plugins.", array(), 'plugins'));
}
$crumbs = array();
$crumbs[] = array($translator->trans("Plugins"), "");
$crumbs[] = array($translator->trans("Manage", array(), 'plugins'), "");
echo camp_html_breadcrumbs($crumbs);
camp_html_display_msgs();
?>
<P>
<FORM name="plugin_upload" action="/<?php 
echo $ADMIN;
?>
/plugins/manage.php" method='POST' enctype='multipart/form-data'>
<?php 
echo SecurityToken::FormParameter();
?>
Example #26
0
if (!$g_user->hasPermission('plugin_blog_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage blogs.'));
    exit;
}

$f_entry_id = Input::Get('f_entry_id', 'int');
$f_comment_id = Input::Get('f_comment_id', 'int');

if (!$f_comment_id) {
    $user_id = $g_user->getUserId();   
}

$BlogComment = new BlogComment($f_comment_id, $f_entry_id);

if ($BlogComment->store($is_admin, $user_id)) {
    camp_html_add_msg(getGS('Blog comment saved.'), 'ok');
    ?>
    <script language="javascript">
        window.opener.location.reload();
        window.close();
    </script>
    <?php
    exit();
}

?>
<head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<META HTTP-EQUIV="Expires" CONTENT="now">
	<link rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/admin-style/admin_stylesheet.css" />
	<title><?php $BlogComment->exists() ? putGS('Edit comment') : putGS('Add new comment'); ?></title>
Example #27
0
     }
     ArticleIndex::RunIndexer(3, 10, true);
     camp_html_goto_page($url);
 } elseif ($f_action == "submit") {
     // Submit all the articles requested.
     $tmpArticles = array();
     foreach ($doAction as $articleNumber => $languageArray) {
         foreach ($languageArray as $languageId => $action) {
             $tmpArticle = new Article($languageId, $articleNumber);
             $tmpArticle->setTitle($articleNames[$articleNumber][$languageId]);
             // Check if the name already exists in the destination section.
             $conflictingArticles = Article::GetByName($tmpArticle->getTitle(), $f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number, null, true);
             if (count($conflictingArticles) > 0) {
                 $conflictingArticle = array_pop($conflictingArticles);
                 $conflictingArticleLink = camp_html_article_url($conflictingArticle, $conflictingArticle->getLanguageId(), "edit.php");
                 camp_html_add_msg($translator->trans("The article could not be submitted.", array(), 'articles') . " " . $translator->trans("You cannot have two articles in the same section with the same name.  The article name you specified is already in use by the article '\$1'.", array('$1' => "<a href='{$conflictingArticleLink}'>" . $conflictingArticle->getName() . "</a>"), 'articles'));
                 $args = $_REQUEST;
                 unset($args["action_button"]);
                 unset($args["f_article_code"]);
                 $argsStr = camp_implode_keys_and_values($args, "=", "&");
                 foreach ($_REQUEST["f_article_code"] as $code) {
                     $argsStr .= "&f_article_code[]={$code}";
                 }
                 $backLink = "/{$ADMIN}/articles/duplicate.php?{$argsStr}";
                 camp_html_goto_page($backLink);
             } 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;
             }
Example #28
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/");

?>
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
require_once $GLOBALS['g_campsiteDir'] . '/classes/Image.php';
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