don't show "find similar" link if we don't have the libpuzzle extension loaded.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 31 May 2010 19:48:49 +0000 (15:48 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 2 Jun 2010 14:23:17 +0000 (10:23 -0400)
ansel/lib/Faces.php
ansel/templates/faces/face.inc
ansel/templates/tile/face.inc

index a557384..2616716 100644 (file)
@@ -106,7 +106,7 @@ class Ansel_Faces
 
         $face_id = $face['face_id'];
         $claim_url = Horde::applicationUrl('faces/claim.php');
-        $search_url = Horde::applicationUrl('faces/search/image_search.php');
+       
 
         // The HTML to display the face image.
         $imghtml = sprintf("<img src=\"%s\" class=\"bordered-facethumb\" id=\"%s\" alt=\"%s\" />",
@@ -124,18 +124,19 @@ class Ansel_Faces
         $html = '<div id="face' . $face_id . '"><table><tr><td>'
                 . ' <a href="' . $img_view_url . '">' . $imghtml . '</a></td><td>';
         if (!empty($face['face_name'])) {
-            $html .= Horde::link(Horde_Util::addParameter(Horde::applicationUrl('faces/face.php'), 'face', $face['face_id'], false)) . $face['face_name'] . '</a><br />';
+            $html .= Horde::applicationUrl('faces/face.php')->add('face', $face['face_id'])->link() . $face['face_name'] . '</a><br />';
         }
 
         // Display the face name or a link to claim the face.
         if (empty($face['face_name']) && $GLOBALS['conf']['report_content']['driver']) {
-            $html .= ' <a href="' . Horde_Util::addParameter($claim_url, 'face', $face_id)
-                . '" title="' . _("Do you know someone in this photo?") . '">'
-                . _("Claim") . '</a>';
+            $html .= ' <a href="' . $claim_url->add('face', $face_id)->link(array('title' => _("Do you know someone in this photo?"))) . _("Claim") . '</a>';
         }
 
         // Link for searching for similar faces.
-        $html .= ' <a href="' . Horde_Util::addParameter($search_url, 'face_id', $face_id) . '">' . _("Find similar") . '</a>';
+        if (Horde_Util::loadExtension('libpuzzle') !== false) {
+            $search_url = Horde::applicationUrl('faces/search/image_search.php');
+        $html .= $search_url->add('face_id', $face_id)-link() . _("Find similar") . '</a>';
+        }
         $html .= '</div></td></tr></table>';
 
         return $html;
index 774cf93..787067c 100755 (executable)
@@ -8,10 +8,9 @@
    <?php if ($GLOBALS['conf']['report_content']['driver']): ?>
    <a href="<?php echo Horde_Util::addParameter(Horde::applicationUrl('faces/report.php'), 'face', $face_id) ?>" class="small" title="<?php echo _("Report abuse or submit a removal request") ?>"><?php echo _("Report") ?></a><br />
    <?php endif; ?>
-   <?php if ($conf['faces']['search']) {
-        echo '<a href="' . Horde_Util::addParameter(Horde::applicationUrl('faces/search/image_search.php'), 'face_id', $face_id) . '" title="' . _("Find similar") . '">' . _("Similar faces") . '</a>';
-    }
-    ?>
+   <?php if ($conf['faces']['search'] && Horde_Util::loadExtension('libpuzzle')) {
+        echo Horde::applicationUrl('faces/search/image_search.php')->add('face_id', $face_id)->link(array('title' => _("Find similar"))) . _("Similar faces") . '</a>';
+    } ?>
   </td>
   <td>
    <?php
index cdcaf2f..a0b8a6c 100755 (executable)
@@ -30,9 +30,8 @@ if ($face['face_name']) {
     echo '<a href="' . Horde_Util::addParameter(Horde::applicationUrl('faces/report.php'), 'face', $face_id)
                 . '" title="' . _("Report abuse or submit a removal request") . '">' . _("Report") . '</a><br />';
 }
-if ($conf['faces']['search']) {
-    echo '<a href="' . Horde_Util::addParameter(Horde::applicationUrl('faces/search/image_search.php'), 'face_id', $face_id)
-        . '" title="' . _("Find similar") . '">' . _("Similar faces") . '</a>';
+if ($conf['faces']['search'] && Horde_Util::loadExtension('libpuzzle') !== false) {
+    echo Horde::applicationUrl('faces/search/image_search.php')->add('face_id', $face_id)->link(array('title' => _("Find similar"))) . _("Similar faces") . '</a>';
 }
 ?>
 </div>