1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<?php
/**
* $Horde: imp/saveimage.php,v 1.1.2.8 2008/01/02 11:31:08 jan Exp $
*
* Copyright 2005-2008 The Horde Project (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
*
* @author Michael Slusarz <slusarz@horde.org>
*/
@define('IMP_BASE', dirname(__FILE__));
require_once IMP_BASE . '/lib/base.php';
require_once IMP_BASE . '/lib/Template.php';
$id = Util::getFormData('id');
$index = Util::getFormData('index');
/* Run through the action handlers. */
$actionID = Util::getFormData('actionID');
switch ($actionID) {
case 'save_image':
require_once IMP_BASE . '/lib/MIME/Contents.php';
$contents = &IMP_Contents::singleton($index);
$mime_part = $contents->getDecodedMIMEPart($id);
$image_data = array(
'filename' => $mime_part->getName(true, true),
'description' => $mime_part->getDescription(true),
'data' => $mime_part->getContents(),
'type' => $mime_part->getType()
);
$res = $registry->call('images/saveImage', array(null, Util::getFormData('gallery'), $image_data));
if (is_a($res, 'PEAR_Error')) {
$notification->push($res, 'horde.error');
break;
}
Util::closeWindowJS();
exit;
}
/* Build the template. */
$t = new IMP_Template();
$t->setOption('gettext', true);
$t->set('action', Horde::applicationUrl('saveimage.php'));
$t->set('id', htmlspecialchars($id));
$t->set('index', htmlspecialchars($index));
$t->set('image_img', Horde::img('mime/image.png', _("Image"), null, $registry->getImageDir('horde')));
/* Build the list of galleries. */
$t->set('gallerylist', $registry->call('images/selectGalleries', array(null, PERMS_EDIT)));
$title = _("Save Image");
require IMP_TEMPLATES . '/common-header.inc';
IMP::status();
echo $t->fetch(IMP_TEMPLATES . '/saveimage/saveimage.html');
require $registry->get('templates', 'horde') . '/common-footer.inc';
|