Example #1
0
$articleObj = new Article($f_language_selected, $f_article_number);
if (!$articleObj->exists()) {
	camp_html_display_error(getGS('Article does not exist.'), null, true);
	exit;
}

$imageObj = new Image($f_image_id);
if (!$imageObj->exists()) {
	camp_html_display_error(getGS('Image 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 (!$g_user->hasPermission('AttachImageToArticle')) {
	camp_html_display_error(getGS("You do not have the right to attach images to articles."), null, true);
	exit;
}

ArticleImage::AddImageToArticle($f_image_id, $f_article_number);

?>
<script>
try {
    parent.$.fancybox.reload = true;
    parent.$.fancybox.message = "<?php putGS("Image '$1' added.", addslashes($imageObj->getDescription())); ?>";
    parent.$.fancybox.close();
} catch (e) {}
</script>
Example #2
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 #3
0
?>
<p></p>
<table cellpadding="0" cellspacing="0" class="action_buttons">
<tr>
<?php if ($g_user->hasPermission('AddImage')) { ?>
    <td>
    	<A HREF="add.php"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0" alt="<?php  putGS('Add new image'); ?>"></A>
    </TD>
    <TD style="padding-left: 3px;">
    	<A HREF="add.php"><B><?php  putGS('Add new image'); ?></B></A>
    </TD>
<?php } ?>
<?php if ($g_user->hasPermission('DeleteImage') && !$imageObj->inUse()) { ?>
    <td style="padding-left: 15px;">
		<A HREF="do_del.php?f_image_id=<?php echo $f_image_id; ?>&<?php echo SecurityToken::URLParameter();?>" onclick="return confirm('<?php putGS("Are you sure you want to delete the image \\'$1\\'?", camp_javascriptspecialchars($imageObj->getDescription())); ?>');"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/delete.png" BORDER="0" ALT="<?php putGS('Delete image $1',htmlspecialchars($imageObj->getDescription())); ?>"></A>
    </TD>
    <TD style="padding-left: 3px;">
    	<A HREF="do_del.php?f_image_id=<?php echo $f_image_id; ?>&<?php echo SecurityToken::URLParameter();?>" onclick="return confirm('<?php putGS("Are you sure you want to delete the image \\'$1\\'?", camp_javascriptspecialchars($imageObj->getDescription())); ?>');"><b><?php putGS('Delete'); ?></b></a>
    </TD>
<?php } ?>
</tr>
</table>

<?php camp_html_display_msgs(); ?>
<p></p>
<IMG SRC="<?php echo $imageObj->getImageUrl(); ?>" BORDER="0" ALT="<?php echo htmlspecialchars($imageObj->getDescription()); ?>" style="padding-left:15px">
<P>
<?php if ($g_user->hasPermission('ChangeImage')) { ?>
<FORM NAME="image_edit" METHOD="POST" ACTION="do_edit.php" ENCTYPE="multipart/form-data">
<?php echo SecurityToken::FormParameter(); ?>
Example #4
0
<?php
camp_load_translation_strings("article_images");
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/articles/article_common.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Image.php');

$f_backlink = Input::Get('Back', 'string', '');
$f_image_id = Input::Get('f_image_id', 'int', 0);

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

$imageObj = new Image($f_image_id);

// Add extra breadcrumb for image list.
?>
<P>
<div class="indent">
<a href="<?php p($f_backlink); ?>"><?php putGS("Back"); ?>
<p>
<IMG SRC="<?php echo $imageObj->getImageUrl(); ?>" BORDER="0" ALT="<?php echo htmlspecialchars($imageObj->getDescription()); ?>">
</a>
</div>
<p>
Example #5
0
require_once $GLOBALS['g_campsiteDir'] . '/classes/Image.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$f_backlink = Input::Get('Back', 'string', '');
$f_image_id = Input::Get('f_image_id', 'int', 0);
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI'], true);
    exit;
}
$imageObj = new Image($f_image_id);
// Add extra breadcrumb for image list.
?>
<P>
<div class="indent">
<a href="<?php 
p($f_backlink);
?>
"><?php 
echo $translator->trans("Back");
?>
<p>
<IMG SRC="<?php 
echo $imageObj->getImageUrl();
?>
" BORDER="0" ALT="<?php 
echo htmlspecialchars($imageObj->getDescription());
?>
">
</a>
</div>
<p>
Example #6
0
<?php 
}
if ($g_user->hasPermission('DeleteImage') && !$imageObj->inUse()) {
    ?>
    <td style="padding-left: 15px;">
        <A HREF="/<?php 
    echo $ADMIN;
    ?>
/media-archive/do_del.php?f_image_id=<?php 
    echo $f_image_id;
    ?>
&<?php 
    echo SecurityToken::URLParameter();
    ?>
" onclick="return confirm('<?php 
    echo $translator->trans("Are you sure you want to delete the image \$1?", array('$1' => camp_javascriptspecialchars($imageObj->getDescription())));
    ?>
');"><IMG SRC="<?php 
    echo $Campsite["ADMIN_IMAGE_BASE_URL"];
    ?>
/delete.png" BORDER="0" ALT="<?php 
    echo $translator->trans('Delete image $1', array('$1' => htmlspecialchars($imageObj->getDescription())), 'media_archive');
    ?>
"></A>
    </TD>
    <TD style="padding-left: 3px;">
        <A HREF="/<?php 
    echo $ADMIN;
    ?>
/media-archive/do_del.php?f_image_id=<?php 
    echo $f_image_id;
Example #7
0
    exit;
}
$articleObj = new Article($f_language_selected, $f_article_number);
if (!$articleObj->exists()) {
    camp_html_display_error($translator->trans('Article does not exist.'), null, true);
    exit;
}
$imageObj = new Image($f_image_id);
if (!$imageObj->exists()) {
    camp_html_display_error($translator->trans('Image 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 (!$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;
}
ArticleImage::AddImageToArticle($f_image_id, $f_article_number);
?>
<script>
try {
    parent.$.fancybox.reload = true;
    parent.$.fancybox.message = "<?php 
echo $translator->trans("Image \$1 added.", array('$1' => addslashes($imageObj->getDescription())), 'article_images');
?>
";
    parent.$.fancybox.close();
} catch (e) {}
</script>
Example #8
0
}

$f_image_id = Input::Get('f_image_id', 'int', 0);

if (!Input::IsValid() || ($f_image_id <= 0)) {
	camp_html_goto_page("/$ADMIN/media-archive/index.php");
}

$imageObj = new Image($f_image_id);

// This file can only be accessed if the user has the right to delete images.
if (!$g_user->hasPermission('DeleteImage')) {
	camp_html_goto_page("/$ADMIN/logout.php");
}
if ($imageObj->inUse()) {
	camp_html_add_msg(getGS("Image is in use, it cannot be deleted."));
	camp_html_goto_page("/$ADMIN/media-archive/index.php");
}

$imageDescription = $imageObj->getDescription();
$result = $imageObj->delete();
if (PEAR::isError($result)) {
	camp_html_add_msg($result->getMessage());
} else {
	// Go back to article image list.
	camp_html_add_msg(getGS("Image '$1' deleted.", $imageDescription), "ok");
}
camp_html_goto_page("/$ADMIN/media-archive/index.php");

?>
Example #9
0
    private function getFormMask()
    {
        global $Campsite;

        $data = $this->m_data;
        $exists = $this->exists();

        if (!empty($data['fk_image_id'])) {
            $Image = new Image($data['fk_image_id']);
            $image_description = $Image->getDescription();
        }

        $mask = array(
            array(
                'element'   => 'action',
                'type'      => 'hidden',
                'constant'  => 'interview_edit'
            ),
            SecurityToken::SECURITY_TOKEN => array(
            	'element'   => SecurityToken::SECURITY_TOKEN,
            	'type'      => 'hidden',
            	'constant'  => SecurityToken::GetToken()
            ),
            $exists ? array(
                    'element'   => 'f_interview_id',
                    'type'      => 'hidden',
                    'constant'  => $data['interview_id']
            ) : null,
            array(
                'element'   => 'f_language_id',
                'type'      => 'select',
                'label'     => getGS('Language'),
                'default'   => $data['fk_language_id'],
                'options'   => self::GetCampLanguagesList(),
                'required'  => true,
            ),
            array(
                'element'   => 'f_moderator_user_id',
                'type'      => 'select',
                'label'     => getGS('Moderator'),
                'default'   => $data['fk_moderator_user_id'],
                'options'   => self::getUsersHavePermission('plugin_interview_moderator'),
                'required'  => true,
                'attributes' => array('onChange' => 'activate_fields("moderator")')
            ),
            /*
            array(
                'element'   => 'f_moderator_new_user_login',
                'type'      => 'text',
                'label'     => getGS('Create new Moderator'),
                'default'   => $data['f_moderator_new_user_login'],
                'attributes' => $_REQUEST['f_moderator_user_id'] == '__new__' ? null : array('disabled'),
            ),
            array(
                'element'   => 'f_moderator_new_user_email',
                'type'      => 'text',
                'label'     => getGS('New Moderator Email'),
                'default'   => $data['f_moderator_new_user_email'],
                'attributes' => $_REQUEST['f_moderator_user_id'] == '__new__' ? null : array('disabled'),
            ),
            */
            array(
                'element'   => 'f_guest_user_id',
                'type'      => 'select',
                'label'     => getGS('Guest'),
                'default'   => $data['fk_guest_user_id'],
                'options'   =>  array('' => getGS('Please select:'))
                                + self::getUsersHavePermission('plugin_interview_guest')
                                + array('__new__' => getGS('Create new one...')),
                'required'  => true,
                'attributes' => array('onChange' => 'activate_fields("guest")')
            ),
            array(
                'element'   => 'f_guest_new_user_login',
                'type'      => 'text',
                'label'     => getGS('Guest Login'),
                'default'   => $data['f_guest_new_user_login'],
                'attributes' => $_REQUEST['f_guest_user_id'] == '__new__' ? null : array('disabled'),
            ),
            array(
                'element'   => 'f_guest_new_user_email',
                'type'      => 'text',
                'label'     => getGS('Guest Email'),
                'default'   => $data['f_guest_new_user_email'],
                'attributes' => $_REQUEST['f_guest_user_id'] == '__new__' ? null : array('disabled'),
            ),
            array(
                'element'   => 'f_title',
                'type'      => 'text',
                'label'     => getGS('Title'),
                'default'   => $data['title'],
                'required'  => true,
            ),
            array(
                'element'   => 'f_image',
                'type'      => 'file',
                'label'     => getGS('Image')
            ),
            array(
                'element'   => 'f_image_description',
                'type'      => 'text',
                'label'     => getGS('Image Description'),
                'default'   => $image_description
            ),
            array(
                'element'   => 'f_image_delete',
                'type'      => 'checkbox',
                'label'     => getGS('Delete Image')
            ),
            array(
                'element'   => 'f_description_short',
                'type'      => 'text',
                'label'     => getGS('Short Description'),
                'default'   => $data['description_short'],
                'required'  => true,
            ),
            array(
                'element'   => 'f_description',
                'type'      => 'textarea',
                'label'     => getGS('Description'),
                'default'   => $data['description'],
                'required'  => true,
                'attributes'=> array('cols' => 40, 'rows' => 5)
            ),
            array(
                'element'   => 'f_interview_begin',
                'type'      => 'text',
                'label'     => getGS('Interview Begin'),
                'default'   => substr($data['interview_begin'], 0, 16),
                'required'  => true,
                'attributes' => array(
                    'id' => 'f_interview_begin',
                    'size' => 17,
                    'maxlength' => 20,
                    'class' => 'datetime',
                ),
            ),
            array(
                'element'   => 'f_interview_end',
                'type'      => 'text',
                'label'     => getGS('Interview End'),
                'default'   => substr($data['interview_end'], 0, 16),
                'required'  => true,
                'attributes' => array(
                    'id' => 'f_interview_end',
                    'size' => 17,
                    'maxlength' => 20,
                    'class' => 'datetime',
                ),
            ),
            array(
                'element'   => 'f_questions_begin',
                'type'      => 'text',
                'label'     => getGS('Questions Begin'),
                'default'   => substr($data['questions_begin'], 0, 16),
                'required'  => true,
                'attributes' => array(
                    'id' => 'f_questions_begin',
                    'size' => 17,
                    'maxlength' => 20,
                    'class' => 'datetime',
                ),
            ),
            array(
                'element'   => 'f_questions_end',
                'type'      => 'text',
                'label'     => getGS('Questions End'),
                'default'   => substr($data['questions_end'], 0, 16),
                'required'  => true,
                'attributes' => array(
                    'id' => 'f_questions_end',
                    'size' => 17,
                    'maxlength' => 20,
                    'class' => 'datetime',
                ),
            ),
            array(
                'element'   => 'f_questions_limit',
                'type'      => 'text',
                'label'     => getGS('Questions Limit'),
                'default'   => $data['questions_limit']
            ),
            array(
                'element'   => 'f_status',
                'type'      => 'select',
                'options'   => array(
                    'draft'     => getGS('draft'),
                    'pending'   => getGS('pending'),
                    'published' => getGS('published'),
                    'rejected'   => getGS('rejected')
                ),
                'label'     => getGS('Status'),
                'default'   => $data['status']
            ),
            array(
                'element'   => 'f_reset',
                'type'      => 'reset',
                'label'     => getGS('Reset'),
                'groupit'   => true
            ),
            array(
                'element'   => 'f_submit',
                'type'      => 'submit',
                'label'     => getGS('Save'),
                'groupit'   => true
            ),
            array(
                'element'   => 'f_cancel',
                'type'      => 'button',
                'label'     => getGS('Cancel'),
                'attributes' => array('onClick' => 'window.close()'),
                'groupit'   => true
            ),
            array(
                'group'     => array('f_reset', 'f_cancel', 'f_submit')
            )
        );

        return $mask;
    }
Example #10
0
<?php 
}
if ($g_user->hasPermission('DeleteImage') && !$imageObj->inUse()) {
    ?>
    <td style="padding-left: 15px;">
        <A HREF="/<?php 
    echo $ADMIN;
    ?>
/media-archive/do_del.php?f_image_id=<?php 
    echo $f_image_id;
    ?>
&<?php 
    echo SecurityToken::URLParameter();
    ?>
" onclick="return confirm('<?php 
    putGS("Are you sure you want to delete the image \\'\$1\\'?", camp_javascriptspecialchars($imageObj->getDescription()));
    ?>
');"><IMG SRC="<?php 
    echo $Campsite["ADMIN_IMAGE_BASE_URL"];
    ?>
/delete.png" BORDER="0" ALT="<?php 
    putGS('Delete image $1', htmlspecialchars($imageObj->getDescription()));
    ?>
"></A>
    </TD>
    <TD style="padding-left: 3px;">
        <A HREF="/<?php 
    echo $ADMIN;
    ?>
/media-archive/do_del.php?f_image_id=<?php 
    echo $f_image_id;
Example #11
0
	$crumbs[] = array(getGS("Images"), "");
	$crumbs[] = array($title, "");
	echo camp_html_breadcrumbs($crumbs);
}
?>
<table cellpadding="1" cellspacing="0" class="action_buttons" style="padding-top: 10px;">
<tr>
	<td><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/left_arrow.png" BORDER="0"></td>
	<td><a href="<?php echo camp_html_article_url($articleObj, $f_language_id, "edit.php"); ?>"><b><?php putGS("Back to Edit Article"); ?></b></a></td>
</table>

<?php camp_html_display_msgs("0.25em", "0.25em"); ?>

<P>
<div class="indent">
<IMG SRC="<?php echo $imageObj->getImageUrl(); ?>" BORDER="0" ALT="<?php echo htmlspecialchars($imageObj->getDescription()); ?>">
</div>
<p>
<FORM NAME="dialog" METHOD="POST" ACTION="do_edit.php" >
<?php echo SecurityToken::FormParameter(); ?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" class="box_table">
<TR>
	<TD COLSPAN="2">
		<B><?php  p($title); ?></B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
</TR>
<TR>
	<TD ALIGN="RIGHT" ><?php  putGS('Number'); ?>:</TD>
	<TD>
		<?php if ($g_user->hasPermission('AttachImageToArticle')) { ?>