From: Michael J. Rubinsky Date: Mon, 31 May 2010 19:20:22 +0000 (-0400) Subject: some faces cleanup. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=17429190a9f9a8bf80779b35978cac02ebb1e50b;p=horde.git some faces cleanup. this code is still a complete mess and needs to be completely rewritten for H4 --- diff --git a/ansel/faces/face.php b/ansel/faces/face.php index f30640850..38856daa6 100644 --- a/ansel/faces/face.php +++ b/ansel/faces/face.php @@ -1,6 +1,6 @@ */ - require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('ansel'); @@ -28,7 +27,7 @@ try { } $title = _("Face") . ' :: ' . $face['face_name']; - +$facename = htmlspecialchars($face['face_name']); require ANSEL_TEMPLATES . '/common-header.inc'; require ANSEL_TEMPLATES . '/menu.inc'; require_once ANSEL_TEMPLATES . '/faces/face.inc'; diff --git a/ansel/faces/image.php b/ansel/faces/image.php index 873a6a7aa..3ba044eef 100644 --- a/ansel/faces/image.php +++ b/ansel/faces/image.php @@ -24,7 +24,7 @@ $result = $faces->getImageFacesData($image_id); // Attempt to get faces from the picture if we don't already have results, // or if we were asked to explicitly try again. if (($reload || empty($result))) { - $image = &$ansel_storage->getImage($image_id); + $image = $ansel_storage->getImage($image_id); try { $image->createView('screen'); $result = $faces->getFromPicture($image_id, $autocreate); diff --git a/ansel/lib/Ajax/Imple/EditFaces.php b/ansel/lib/Ajax/Imple/EditFaces.php index 44d0d0dbf..2e1d0cb36 100644 --- a/ansel/lib/Ajax/Imple/EditFaces.php +++ b/ansel/lib/Ajax/Imple/EditFaces.php @@ -49,16 +49,15 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base // Attempt to get faces from the picture if we don't already have results, // or if we were asked to explicitly try again. if (($reload || empty($result))) { - $image = &$GLOBALS['ansel_storage']->getImage($image_id); + $image = $GLOBALS['ansel_storage']->getImage($image_id); $image->createView('screen'); $result = $faces->getFromPicture($image_id, $autocreate); } if (!empty($result)) { - $imgdir = Horde_Themes::img(null, 'horde'); $customurl = Horde::applicationUrl('faces/custom.php'); $url = (!empty($args['url']) ? urldecode($args['url']) : ''); Horde::startBuffer(); - require_once ANSEL_TEMPLATES . '/faces/image.inc'; + include ANSEL_TEMPLATES . '/faces/image.inc'; $html = Horde::endBuffer(); return array('response' => 1, 'message' => $html); @@ -71,14 +70,13 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base case 'delete': // delete - deletes a single face from an image. $face_id = (int)$post['face']; - $image = &$GLOBALS['ansel_storage']->getImage($image_id); - $gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery); + $image = $GLOBALS['ansel_storage']->getImage($image_id); + $gallery = $GLOBALS['ansel_storage']->getGallery($image->gallery); if (!$gallery->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT)) { throw new Horde_Exception('Access denied editing the photo.'); } - $faces = $GLOBALS['injector']->getInstance('Ansel_Faces'); - $faces->delete($image, $face_id); + Ansel_Faces::delete($image, $face_id); break; case 'setname': diff --git a/ansel/templates/faces/face.inc b/ansel/templates/faces/face.inc index b064deabe..774cf9379 100755 --- a/ansel/templates/faces/face.inc +++ b/ansel/templates/faces/face.inc @@ -2,18 +2,14 @@ @@ -21,13 +17,12 @@ getValue('default_gallerystyle')); $style = $styleDef['name']; - foreach (array_keys($face['galleries']) as $gallery_id) { foreach ($face['galleries'][$gallery_id] as $imageId) { echo '
' . $imageId . '
'; echo '' . _("Photo") . ' / '; echo '' . _("Gallery") . '
'; } } - ?> diff --git a/ansel/templates/faces/gallery.inc b/ansel/templates/faces/gallery.inc index dbdcb2634..5e0746aa0 100644 --- a/ansel/templates/faces/gallery.inc +++ b/ansel/templates/faces/gallery.inc @@ -11,22 +11,22 @@ foreach ($images as $image): $imageids[$image->id] = $image->id; ?> - - - - - + + + + +
-
+
<?php echo $facename?>

">
- ' . _("Similar faces") . ''; + + ' . _("Similar faces") . ''; } ?>
- filename; ?>

- - -
- - - -
-
- - <?php echo htmlspecialchars($image->filename)?>
+ filename; ?>

+ + +
+ + add(array('image' => $image->id, 'gallery' => $image->gallery))->link()?> +
+
+ + <?php echo htmlspecialchars($image->filename)?> +
render() ?> diff --git a/ansel/templates/faces/image.inc b/ansel/templates/faces/image.inc index 272ca2102..c21ee04a6 100755 --- a/ansel/templates/faces/image.inc +++ b/ansel/templates/faces/image.inc @@ -1,12 +1,9 @@ $face_name):?>
- <?php echo $face_id ?> - - "> - [icon] - "> - [icon] - "> - [icon] + <?php echo $face_id ?> + + ' . Horde::img('save.png')?> + ' . Horde::img('delete.png')?> + add(array('face' => $face_id, 'image' => $image_id, 'url' => (!empty($url) ? $url : '')))->link(array('title' => _("Edit face region"))) . Horde::img('edit.png')?>