Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

search.cgi 863B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. c=/home/www/fsfe.org_htdig/htdig.conf
  3. l="$(printf %s "$QUERY_STRING" |sed -rn '1s;^(.*&)?l=([a-z-]+)(&.*)?$;\2;p')"
  4. q="$(printf %s "$QUERY_STRING" |sed -rn '1s;^(.*&)?q=([^&]+)(&.*)?$;\2;p')"
  5. # htdig forces default config file if reading cgi-variabled directly
  6. # this would prevent multisite usage, overriding request instead
  7. unset REQUEST_METHOD
  8. printf %s\\n\\n "Content-Type: text/html;charset=utf-8"
  9. # htdig tries to escape non ascii characters.
  10. # since it is however not utf-8 clean it tends to escape single
  11. # octets in multibyte character sequences,
  12. # hence we use xmllint and sed to unescape the characters again
  13. /usr/lib/cgi-bin/htsearch -c "$c" "restrict=${l:-en}.html&words=${q}" \
  14. | tail -n+3 \
  15. | sed -r 's;&euro\;;\xa4;g' \
  16. | xmllint --html --encode iso-8859-1 - \
  17. | sed -r '2s;charset=iso-8859-1;charset=utf-8;' \
  18. | sed "s;#LANG;${l};"