File: saveimage.php

package info (click to toggle)
imp4 4.1.3-4
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 14,988 kB
  • ctags: 3,720
  • sloc: xml: 17,038; php: 16,350; makefile: 64
file content (46 lines) | stat: -rw-r--r-- 1,545 bytes parent folder | download
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
<?php
/**
 * $Horde: imp/saveimage.php,v 1.1.2.5 2006/07/04 17:52:29 mrubinsk Exp $
 *
 * Copyright 2005-2006 Michael Slusarz <slusarz@bigworm.curecanti.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.
 */

@define('IMP_BASE', dirname(__FILE__));
require_once IMP_BASE . '/lib/base.php';
require_once IMP_BASE . '/lib/MIME/Contents.php';

$id = Util::getFormData('id');
$index = Util::getFormData('index');

/* Run through the action handlers. */
$actionID = Util::getFormData('actionID');
switch ($actionID) {
case 'save_image':
    $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 list of galleries. */
$gallerylist = $registry->call('images/selectGalleries', array(null, PERMS_EDIT));

$title = _("Save Image");
require IMP_TEMPLATES . '/common-header.inc';
IMP::status();
require IMP_TEMPLATES . '/saveimage/saveimage.inc';
require $registry->get('templates', 'horde') . '/common-footer.inc';