More Ansel_Faces cleanup, PHP5 changes, try/catch etc...
authorMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 31 Jul 2009 04:18:44 +0000 (00:18 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Fri, 31 Jul 2009 04:18:44 +0000 (00:18 -0400)
22 files changed:
ansel/config/prefs.php.dist
ansel/faces/claim.php
ansel/faces/custom.php
ansel/faces/delete.php
ansel/faces/face.php
ansel/faces/gallery.php
ansel/faces/image.php
ansel/faces/img.php
ansel/faces/name.php
ansel/faces/report.php
ansel/faces/savecustom.php
ansel/faces/search/all.php
ansel/faces/search/image.php
ansel/faces/search/image_save.php
ansel/faces/search/image_search.php
ansel/faces/search/img.php
ansel/faces/search/name.php
ansel/faces/search/named.php
ansel/faces/search/owner.php
ansel/faces/search/tabs.php
ansel/lib/Ajax/Imple/EditFaces.php
ansel/lib/Block/recent_faces.php

index 701e6be..73b775b 100644 (file)
@@ -4,10 +4,6 @@
  *
  * See horde/config/prefs.php for documentation on the structure of this file.
  */
-
-// Make sure that constants are defined.
-require_once dirname(__FILE__) . '/../lib/Ansel.php';
-
 $prefGroups['display'] = array(
     'column' => _("General Options"),
     'label' => _("Display Options"),
index 97e305b..2aaf730 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Identify a person in a photo
  *
- * $Horde: ansel/faces/claim.php,v 1.9 2009/06/10 00:33:02 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  *
  * @author Duck <duck@obala.net>
  */
-define('ANSEL_BASE', dirname(__FILE__) . '/../');
-require_once ANSEL_BASE . '/lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
-
-require_once 'Horde/Form.php';
+require_once dirname(__FILE__) . '/../lib/base.php';
 
 $faces = Ansel_Faces::factory();
-
 $face_id = Horde_Util::getFormData('face');
-$face = $faces->getFaceById($face_id);
-
-if (is_a($face, 'PEAR_Error')) {
-    $notification->push($face->getMessage());
+try {
+    $face = $faces->getFaceById($face_id);
+} catch (Horde_Exception $e) {
+    $notification->push($e->getMessage());
     header('Location: ' . Horde::applicationUrl('faces/search/all.php'));
     exit;
 }
index 8d03f62..65b725b 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Explicitly add/edit a face range to an image.
  *
- * $Horde: ansel/faces/custom.php,v 1.14 2009/07/08 18:28:41 slusarz Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -44,26 +42,19 @@ $y2 = $conf['screen']['width'];
 $name = Horde_Util::getFormData('name');
 
 if ($face_id) {
-    require_once ANSEL_BASE . '/lib/Faces.php';
     $faces = Ansel_Faces::factory();
-
-    if (is_a($faces, 'PEAR_Error')) {
-        $notification->push($faces);
-        header('Location: ' . $back_url);
-        exit;
+    try {
+        $face = $faces->getFaceById($face_id, true);
+    } catch (Horde_Exception $e) {
+        $notification->push($e->getMessage());
     }
 
-    $face = $faces->getFaceById($face_id, true);
-    if (is_a($face, 'PEAR_Error')) {
-        $notification->push($face);
-    } else {
-        $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'];
-        }
+    $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'];
     }
 
 }
index 7f6e826..d2e7335 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Delete a face from an image.
  *
- * $Horde: ansel/faces/delete.php,v 1.10 2009/07/30 18:02:13 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -12,7 +10,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
 
 $image_id = (int)Horde_Util::getFormData('image');
 $face_id = (int)Horde_Util::getFormData('face');
@@ -28,11 +25,5 @@ if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
 }
 
 $faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    die($faces->getMessage());
-}
-
 $result = $faces->delete($image, $face_id);
-if (is_a($result, 'PEAR_Error')) {
-    die($result->getMessage());
-}
+
index 8f159a8..2577e15 100644 (file)
@@ -6,8 +6,6 @@
  * At least, we need to rename this to something other that image.php to
  * reflect what it's used for.
  *
- * $Horde: ansel/faces/face.php,v 1.6 2009/06/10 00:33:02 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
-
 $faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    die($faces->getMessage());
-}
-
 $face_id = Horde_Util::getFormData('face');
-$face = $faces->getFaceById($face_id);
-if (is_a($face, 'PEAR_Error')) {
+try {
+    $face = $faces->getFaceById($face_id);
+} catch (Horde_Exception $e) {
     $notification->push($face->getMessage());
     header('Location: ' . Horde::applicationUrl('faces/index.php'));
     exit;
@@ -35,7 +28,5 @@ $title = _("Face") . ' :: ' . $face['face_name'];
 
 require ANSEL_TEMPLATES . '/common-header.inc';
 require ANSEL_TEMPLATES . '/menu.inc';
-
 require_once ANSEL_TEMPLATES . '/faces/face.inc';
-
 require $registry->get('templates', 'horde') . '/common-footer.inc';
\ No newline at end of file
index 90aae33..abf85ad 100644 (file)
@@ -4,8 +4,6 @@
  *
  * TODO: Turn this into an Ansel_View::
  *
- * $Horde: ansel/faces/gallery.php,v 1.16 2009/07/13 21:33:53 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -41,7 +39,6 @@ $customimage = $registry->getImageDir('horde') . '/layout.png';
 $customurl = Horde_Util::addParameter(Horde::applicationUrl('faces/custom.php'), 'page', $page);
 $face = Ansel_Faces::factory();
 $autogenerate = $face->canAutogenerate();
-
 $vars = Horde_Variables::getDefaultVariables();
 $pager = new Horde_UI_Pager(
     'page', $vars,
index a7786d9..41628de 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Process an single image (to be called via Ajax)
  *
- * $Horde: ansel/faces/image.php,v 1.10 2009/06/10 00:33:02 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
 
 $faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    die($faces->getMessage());
-}
 
 $name = '';
 $autocreate = true;
@@ -29,19 +23,8 @@ $result = $faces->getImageFacesData($image_id);
 // or if we were asked to explicitly try again.
 if (($reload || empty($result))) {
     $image = &$ansel_storage->getImage($image_id);
-    if (is_a($image, 'PEAR_Error')) {
-        exit;
-    }
-
-    $result = $image->createView('screen');
-    if (is_a($result, 'PEAR_Error')) {
-        exit;
-    }
-
+    $image->createView('screen');
     $result = $faces->getFromPicture($image_id, $autocreate);
-    if (is_a($result, 'PEAR_Error')) {
-        exit;
-    }
 }
 
 if (!empty($result)) {
index 72767e2..cb513e3 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Fetch face image for display
  *
- * $Horde: ansel/faces/img.php,v 1.11 2009/06/10 00:33:02 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
 
 $face_id = Horde_Util::getFormData('face');
 $faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    Horde::logMessage($faces, __FILE__, __LINE__, PEAR_LOG_ERR);
-    exit;
-}
 
 // Sendfile support. Lighttpd < 1.5 only understands the X-LIGHTTPD-send-file
 // header
@@ -49,8 +42,5 @@ if ($conf['vfs']['src'] == 'sendfile') {
 
 // Run it through PHP
 $img = $faces->getFaceImageObject($face_id);
-if (is_a($img, 'PEAR_Error')) {
-    exit;
-}
 header('Content-type: image/' . $GLOBALS['conf']['image']['type']);
 echo $img->raw();
index d451845..9a5cf5e 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Set the name of a single image via Ajax
  *
- * $Horde: ansel/faces/name.php,v 1.9 2009/07/08 18:28:41 slusarz Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
 
 $image_id = (int)Horde_Util::getFormData('image');
 $face_id = (int)Horde_Util::getFormData('face');
 $name = Horde_Util::getFormData('name');
 
 $image = &$ansel_storage->getImage($image_id);
-if (is_a($image, 'PEAR_Error')) {
-    die($image->getMessage());
-}
-
 $gallery = &$ansel_storage->getGallery($image->gallery);
 if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
-    die(_("Access denied editing the photo."));
+    throw new Horde_Exception('Access denied editing the photo.');
 }
 
 $faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    die($faces->getMessage());
-}
-
-$result = $faces->setName($face_id, $name);
-if (is_a($result, 'PEAR_Error')) {
-    die($result->getDebugInfo());
-}
\ No newline at end of file
+$result = $faces->setName($face_id, $name);
\ No newline at end of file
index 36d4914..0b2f704 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Process an single image (to be called by ajax)
  *
- * $Horde: ansel/faces/report.php,v 1.9 2009/06/10 00:33:02 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
-
-require_once 'Horde/Form.php';
-
-$faces = Ansel_Faces::factory();
 
 $face_id = Horde_Util::getFormData('face');
-$face = $faces->getFaceById($face_id);
 
-if (is_a($face, 'PEAR_Error')) {
-    $notification->push($face->getMessage());
+$faces = Ansel_Faces::factory();
+try {
+    $face = $faces->getFaceById($face_id);
+} catch (Horde_Exception $e) {
+    $notification->push($e->getMessage());
     header('Location: ' . Horde::applicationUrl('faces/search/all.php'));
     exit;
 }
@@ -38,11 +33,8 @@ $form->setButtons($title);
 if ($form->validate()) {
 
     if (Horde_Util::getFormData('submitbutton') == _("Cancel")) {
-
         $notification->push(_("Action was cancelled."), 'horde.warning');
-
     } else {
-
         require ANSEL_BASE . '/lib/Report.php';
         $report = Ansel_Report::factory();
         $gallery = $ansel_storage->getGallery($face['gallery_id']);
@@ -59,14 +51,12 @@ if ($form->validate()) {
                 . _("Face") . ': ' . $face_link;
 
         $report->setTitle($title);
-        $result = $report->report($body, $gallery->get('owner'));
-        if (is_a($result, 'PEAR_Error')) {
-            $notification->push(_("Face name was not reported.") . ' ' .
-                                $result->getMessage(), 'horde.error');
-        } else {
-            $notification->push(_("The owner of the photo was notified."), 'horde.success');
+        try {
+            $result = $report->report($body, $gallery->get('owner'));
+        } catch (Horde_Exception $e) {
+            $notification->push(sprintf(_("Face name was not reported: %s"), $e->getMessage()), 'horde.error');
         }
-
+        $notification->push(_("The owner of the photo was notified."), 'horde.success');
     }
 
     header('Location: ' . Ansel_Faces::getLink($face));
index 4ac7011..d5a5214 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Process an single image (to be called by ajax)
  *
- * $Horde: ansel/faces/savecustom.php,v 1.10 2009/07/06 15:50:34 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -12,7 +10,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
 
 $image_id = (int)Horde_Util::getFormData('image_id');
 $gallery_id = (int)Horde_Util::getFormData('gallery_id');
@@ -31,28 +28,23 @@ if (Horde_Util::getPost('submit') == _("Cancel")) {
     header('Location: ' . $back_url);
     exit;
 }
-
-$faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    $notification->push($faces);
-    header('Location: ' . $back_url);
-    exit;
-}
-
-$result = $faces->saveCustomFace($face_id,
+try {
+    $faces = Ansel_Faces::factory();
+    $result = $faces->saveCustomFace(
+                           $face_id,
                            $image_id,
                            (int)Horde_Util::getFormData('x1'),
                            (int)Horde_Util::getFormData('y1'),
                            (int)Horde_Util::getFormData('x2'),
                            (int)Horde_Util::getFormData('y2'),
                            Horde_Util::getFormData('name'));
-
-if (is_a($result, 'PEAR_Error')) {
-    $notification->push($result);
-    $notification->push($result->getDebugInfo());
+} catch (Horde_Exception $e) {
+    $notification->push($e->getMessage());
     header('Location: ' . $back_url);
     exit;
-} elseif ($face_id == 0) {
+}
+
+if ($face_id == 0) {
     $notification->push(_("Face successfuly created"), 'horde.success');
 } else {
     $notification->push(_("Face successfuly updated"), 'horde.success');
index f363ab2..bf1e6b6 100644 (file)
@@ -12,7 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/UI/Pager.php';
 
 $title = _("All faces");
 $page = Horde_Util::getFormData('page', 0);
index 1a0f54c..cc54b73 100644 (file)
@@ -12,8 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/Form.php';
-require_once 'Horde/Image.php';
 
 /* Search from */
 $form = new Horde_Form($vars);
index 9c608e2..08e8e1d 100644 (file)
@@ -12,7 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/Image.php';
 
 /* Check if image exists. */
 $tmp = Horde::getTempDir();
index 262de19..52a2f74 100644 (file)
@@ -12,7 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/UI/Pager.php';
 
 $page = Horde_Util::getFormData('page', 0);
 $perpage = $prefs->getValue('facesperpage');
index b3baf08..8d6cb57 100644 (file)
@@ -12,7 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
 
 /* Face search is allowd only to  */
 if (!Horde_Auth::isauthenticated()) {
index 54bebd5..6232782 100644 (file)
@@ -12,8 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/Form.php';
-require_once 'Horde/UI/Pager.php';
 
 /* Search from */
 $form = new Horde_Form($vars);
index 2085a91..fee95b6 100644 (file)
@@ -12,7 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/UI/Pager.php';
 
 $title = _("Named faces");
 $page = Horde_Util::getFormData('page', 0);
index 86a79c8..cf3e97d 100644 (file)
@@ -12,7 +12,6 @@
  * @author Duck <duck@obala.net>
  */
 require_once 'tabs.php';
-require_once 'Horde/UI/Pager.php';
 
 $page = Horde_Util::getFormData('page', 0);
 $perpage = $prefs->getValue('facesperpage');
index 1618417..4cee56f 100644 (file)
@@ -2,8 +2,6 @@
 /**
  * Process an single photo (to be called by ajax)
  *
- * $Horde: ansel/faces/search/tabs.php,v 1.10 2009/07/22 21:08:09 mrubinsk Exp $
- *
  * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
  * @author Duck <duck@obala.net>
  */
 require_once dirname(__FILE__) . '/../../lib/base.php';
-require_once ANSEL_BASE . '/lib/Faces.php';
-require_once 'Horde/UI/Tabs.php';
 
 $faces = Ansel_Faces::factory();
-if (is_a($faces, 'PEAR_Error')) {
-    die($faces->getMessage());
-}
-
 /* Face search is allowed only to authenticated users */
 if (!Horde_Auth::isauthenticated()) {
     Horde_Auth::authenticationFailureRedirect();
index f541170..651a495 100644 (file)
@@ -43,10 +43,6 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base
             }
 
             $faces = Ansel_Faces::factory();
-            if (is_a($faces, 'PEAR_Error')) {
-                die($faces->getMessage());
-            }
-
             switch($action) {
             case 'process':
                 // process - detects all faces in the image.
@@ -57,19 +53,8 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base
                 // or if we were asked to explicitly try again.
                 if (($reload || empty($result))) {
                     $image = &$GLOBALS['ansel_storage']->getImage($image_id);
-                    if (is_a($image, 'PEAR_Error')) {
-                        exit;
-                    }
-
-                    $result = $image->createView('screen');
-                    if (is_a($result, 'PEAR_Error')) {
-                        exit;
-                    }
-
+                    $image->createView('screen');
                     $result = $faces->getFromPicture($image_id, $autocreate);
-                    if (is_a($result, 'PEAR_Error')) {
-                        exit;
-                    }
                 }
                 if (!empty($result)) {
                     $imgdir = $GLOBALS['registry']->getImageDir('horde');
@@ -90,24 +75,13 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base
                 // delete - deletes a single face from an image.
                 $face_id = (int)Horde_Util::getPost('face');
                 $image = &$GLOBALS['ansel_storage']->getImage($image_id);
-                if (is_a($image, 'PEAR_Error')) {
-                    die($image->getMessage());
-                }
-
                 $gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery);
                 if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
-                    die(_("Access denied editing the photo."));
+                    throw new Horde_Exception('Access denied editing the photo.');
                 }
 
                 $faces = Ansel_Faces::factory();
-                if (is_a($faces, 'PEAR_Error')) {
-                    die($faces->getMessage());
-                }
-
-                $result = $faces->delete($image, $face_id);
-                if (is_a($result, 'PEAR_Error')) {
-                    die($result->getMessage());
-                }
+                $faces->delete($image, $face_id);
                 break;
 
             case 'setname':
@@ -119,25 +93,13 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base
 
                 $name = Horde_Util::getPost('facename');
                 $image = &$GLOBALS['ansel_storage']->getImage($image_id);
-                if (is_a($image, 'PEAR_Error')) {
-                    die($image->getMessage());
-                }
-
                 $gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery);
                 if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {
-                    die(_("You are not allowed to edit this photo."));
+                    throw new Horde_Exception('You are not allowed to edit this photo');
                 }
 
                 $faces = Ansel_Faces::factory();
-                if (is_a($faces, 'PEAR_Error')) {
-                    die($faces->getMessage());
-                }
-
                 $result = $faces->setName($face_id, $name);
-                if (is_a($result, 'PEAR_Error')) {
-                    die($result->getDebugInfo());
-                }
-
                 return array('response' => 1,
                              'message' => Ansel_Faces::getFaceTile($face_id));
                 break;
index 521fb7b..42d2885 100644 (file)
@@ -7,8 +7,6 @@ if (!empty($GLOBALS['conf']['faces']['driver'])) {
  * This file provides a recent faces through the Horde_Blocks, by extending
  * the Horde_Blocks class.
  *
- * $Horde: ansel/lib/Block/recent_faces.php,v 1.3 2009/07/13 17:18:39 mrubinsk Exp $
- *
  * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -17,8 +15,8 @@ if (!empty($GLOBALS['conf']['faces']['driver'])) {
  * @author  Duck <Duck@obala.net>
  * @package Horde_Block
  */
-class Horde_Block_ansel_recent_faces extends Horde_Block {
-
+class Horde_Block_ansel_recent_faces extends Horde_Block
+{
     var $_app = 'ansel';
 
     function _params()
@@ -37,14 +35,8 @@ class Horde_Block_ansel_recent_faces extends Horde_Block {
     function _content()
     {
         require_once dirname(__FILE__) . '/../base.php';
-        require_once ANSEL_BASE . '/lib/Faces.php';
         $faces = Ansel_Faces::factory();
-
         $results = $faces->allFaces(0, $this->_params['limit']);
-        if (is_a($results, 'PEAR_Error')) {
-            return $results;
-        }
-
         $html = '';
         foreach ($results as $face_id => $face) {
             $facename = htmlspecialchars($face['face_name'], ENT_COMPAT, Horde_Nls::getCharset());