-
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
This codeblock makes little sense if "ADMIN_CAN_POWER_SEARCH=1" is set:
<?php if(!$admin_user) { ?>
<a href="search.php">Search</a>
<?php } ?>
Can we please change that to:
<?php if(!$admin_user || ADMIN_CAN_POWER_SEARCH) { ?>
<a href="search.php">Search</a>
<?php } ?>
Reason:
If ADMIN_CAN_POWER_SEARCH=1, you expect as admin to enter/access somehow the search.php site. Otherwise you have to bookmark the link, which is counter productive.
i made for myself a small script to fix it until this is merged (if someone needs it):
content of /root/fix_piler_menu.sh:
#!/bin/bash
#
# fix_piler_menu.sh - Restore admin search button when ADMIN_CAN_POWER_SEARCH=1
# Run after container creation: docker exec piler /fix_piler_menu.sh
#
# In 1.4.8, the Search button was hidden for all admins.
# In 1.4.4, it was shown when ADMIN_CAN_POWER_SEARCH was enabled.
# This fix restores the 1.4.4 behavior.
#
set -e
MENU_FILE="/var/piler/www/templates/common/menu.tpl"
echo "=== Piler Menu Fix: Admin Search Button ==="
# Check if already fixed
if grep -q 'ADMIN_CAN_POWER_SEARCH' "$MENU_FILE" 2>/dev/null; then
echo "[OK] menu.tpl: ADMIN_CAN_POWER_SEARCH check already present"
exit 0
fi
# Check if the pattern to fix exists
if grep -q '<?php if(!$admin_user) { ?>' "$MENU_FILE" 2>/dev/null; then
# Replace: <?php if(!$admin_user) { ?>
# With: <?php if(!$admin_user || ADMIN_CAN_POWER_SEARCH) { ?>
sed -i 's/<?php if(!$admin_user) { ?>/<?php if(!$admin_user || ADMIN_CAN_POWER_SEARCH) { ?>/g' "$MENU_FILE"
echo "[FIXED] menu.tpl: Admin search button now visible when ADMIN_CAN_POWER_SEARCH=1"
else
echo "[SKIP] menu.tpl: Pattern not found (different version?)"
fi
echo "=== Done ==="
You need to execute afterwards:
docker cp /root/fix_piler_menu.sh piler:/fix_piler_menu.sh && docker exec piler /fix_piler_menu.sh
Cheers :-)
Metadata
Metadata
Assignees
Labels
No labels