]> projects.mako.cc - scuttle/blobdiff - search.inc.php
initial patch to cause scuttle to work with PHP 8.2
[scuttle] / search.inc.php
index 1c2cbc33f2e84fd98a5a38b3578c750a9eb8e5c6..1121db1310b867bc1bc4b7d0656fdd9713551b44 100644 (file)
@@ -2,42 +2,40 @@
     <table>
     <tr>
         <?php
-        $logged_on = false;
+        $logged_on = FALSE;
         if ($userservice->isLoggedOn()) {
-            $currentUser = $userservice->getCurrentUser();
-            $currentUsername = $currentUser[$userservice->getFieldName('username')];
-            $logged_on = true;
+          $currentUser = $userservice->getCurrentUser();
+          $currentUsername = $currentUser[$userservice->getFieldName('username')];
+          $logged_on = TRUE;
         }
-        if ($logged_on || isset($user)) {
+        if (!$logged_on && !isset($user)) {
+        ?>
+        <td><input type="hidden" name="range" value="all" /></td>
+        <?php
+        } else {
         ?>
         <td><?php echo T_('Search' /* Search ... for */); ?></td>
         <td>
             <select name="range">
+                <?php if (isset($currentUsername) && $user != $currentUsername): ?>
+                <option value="<?php echo $user ?>"><?php echo T_("this user's bookmarks"); ?></option>
                 <?php
-                if (!in_array($range, array($currentUsername, 'all', 'watchlist'))) {
-                ?>
-                <option value="<?php echo $user ?>"<?php echo $selectUser; ?>><?php echo T_("this user's bookmarks"); ?></option>
-                <?php
-                }
+                endif;
                 if ($logged_on) {
                 ?>
-                <option value="<?php echo $currentUsername; ?>"<?php echo $selectMy; ?>><?php echo T_('my bookmarks'); ?></option>
-                <option value="watchlist"<?php echo $select_watchlist; ?>><?php echo T_('my watchlist'); ?></option>
+                <option value="<?php echo $currentUsername; ?>"><?php echo T_('my bookmarks'); ?></option>
+                <option value="watchlist"<?php if (isset($select_watchlist)) { echo $select_watchlist; } ?>><?php echo T_('my watchlist'); ?></option>
                 <?php
                 }
                 ?>
-                <option value="all"<?php echo $select_all; ?>><?php echo T_('all bookmarks'); ?></option>
+                <option value="all"<?php if (isset($select_all)) { echo $select_all; } ?>><?php echo T_('all bookmarks'); ?></option>
             </select>
         </td>
         <td><?php echo T_('for' /* Search ... for */); ?></td>
         <?php
-        } else {
-        ?>
-        <td><input type="hidden" name="range" value="all" /></td>
-        <?php
         }
         ?>
-        <td><input type="text" name="terms" size="50" value="<?php echo filter($terms); ?>" /></td>
+        <td><input type="text" name="terms" size="50" value="<?php if (isset($terms)) { echo filter($terms); } ?>" /></td>
         <td><input type="submit" value="<?php echo T_('Search' /* Submit button */); ?>" /></td>
     </tr>
     </table>

Benjamin Mako Hill || Want to submit a patch?