setContentDisposition() public méthode

Set the "content-disposition" HTTP header.
public setContentDisposition ( mixed $p_value ) : boolean
$p_value mixed
Résultat boolean
Exemple #1
0
$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);

if (!$articleObj->exists()) {
	camp_html_display_error(getGS("Article does not exist."), 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 (!$articleObj->userCanModify($g_user)) {
	camp_html_display_error(getGS('You do not have the right to change the article.'), null, true);
	exit;
}

$attachmentObj = new Attachment($f_attachment_id);
$attachmentObj->setDescription($f_language_selected, $f_description);
if ($f_language_specific == "yes") {
	$attachmentObj->setLanguageId($f_language_selected);
} else {
	$attachmentObj->setLanguageId(null);
}
if ($f_content_disposition == "attachment" || empty($f_content_disposition)) {
	$attachmentObj->setContentDisposition($f_content_disposition);
}

// Go back to article.
camp_html_add_msg(getGS("File '$1' updated.", $attachmentObj->getFileName()), "ok");
camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, 'edit.php'));

?>
<?php
camp_load_translation_strings("media_archive");
require_once($GLOBALS['g_campsiteDir'].'/classes/Input.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Attachment.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Log.php');

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

// check input
$f_attachment_id = Input::Get('f_attachment_id', 'int', 0);
$f_description = Input::Get('f_description', 'string', '');
$f_content_disposition = Input::Get('f_content_disposition', 'string', '');
if (!Input::IsValid() || ($f_attachment_id <= 0)) {
	camp_html_goto_page("/$ADMIN/media-archive/index.php#files");
}

$object = new Attachment($f_attachment_id);
$object->setDescription($object->getLanguageId(), $f_description);
$object->setContentDisposition($f_content_disposition);

camp_html_add_msg(getGS('Attachment updated.'), 'ok');
camp_html_goto_page("/$ADMIN/media-archive/edit-attachment.php?f_attachment_id=".$object->getAttachmentId());