/usr/share/horde/ansel/faces/custom.php is in php-horde-ansel 3.0.5+debian0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | <?php
/**
* Explicitly add/edit a face range to an image.
*
* Copyright 2008-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Duck <duck@obala.net>
*/
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('ansel');
$image_id = (int)Horde_Util::getFormData('image');
$face_id = (int)Horde_Util::getFormData('face');
$page = Horde_Util::getFormData('page', 0);
$url = Horde_Util::getFormData('url');
$urlparams = array('page' => $page);
if (!empty($url)) {
$urlparams['url'] = $url;
}
$form_post = Horde::url('faces/savecustom.php')->add($urlparams);
try {
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage($image_id);
} catch (Ansel_Exception $e) {
$notification->push($image);
Horde::url('list.php')->redirect();
exit;
}
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($image->gallery);
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
$notification->push(_("Access denied editing the photo."));
Ansel::getUrlFor('view', array('gallery' => $image->gallery))->redirect();
exit;
}
$x1 = 0;
$y1 = 0;
$x2 = $conf['screen']['width'];
$y2 = $conf['screen']['width'];
$name = Horde_Util::getFormData('name');
if ($face_id) {
$faces = $injector->getInstance('Ansel_Faces');
try {
$face = $faces->getFaceById($face_id, true);
$x1 = $face['face_x1'];
$y1 = $face['face_y1'];
$x2 = $face['face_x2'];
$y2 = $face['face_y2'];
if (!empty($face['face_name'])) {
$name = $face['face_name'];
}
} catch (Ansel_Exception $e) {
$notification->push($e->getMessage());
Horde::url('list.php')->redirect();
}
}
$height = $x2 - $x1;
$width = $y2 - $y1;
$page_output->addScriptFile('scriptaculous/builder.js', 'horde');
$page_output->addScriptFile('scriptaculous/effects.js', 'horde');
$page_output->addScriptFile('scriptaculous/controls.js', 'horde');
$page_output->addScriptFile('scriptaculous/dragdrop.js', 'horde');
$page_output->addScriptFile('cropper.js');
$page_output->addScriptFile('stripe.js', 'horde');
$script = <<<EOT
function onEndCrop(coords, dimensions) {
$('x1').value = coords.x1;
$('y1').value = coords.y1;
$('x2').value = coords.x2;
$('y2').value = coords.y2;
}
new Cropper.ImgWithPreview(
'faceImage',
{
minWidth: 50,
minHeight: 50,
ratioDim: {
x: 50,
y: 50
},
onEndCrop: onEndCrop,
previewWrap: 'previewArea'
EOT;
if ($x1) {
$script .= ', onloadCoords: { x1: ' . $x1 . ', y1: ' . $y1 . ', x2: ' . $x2 . ', y2: ' . $y2 . ' }';
}
$script .= '});';
$page_output->addInlineScript($script, 'dom');
$page_output->addThemeStylesheet('cropper.css');
$page_output->header(array(
'title' => _("Create a new face")
));
$notification->notify(array('listeners' => 'status'));
require ANSEL_TEMPLATES . '/faces/custom.inc';
$page_output->footer();
|