slitaz-base-files view rootfs/var/www/cgi-bin/index.cgi @ rev 219

libtaz.sh: add (and use) short gettext aliases: _ and _n
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Aug 09 15:38:43 2013 +0300 (2013-08-09)
parents bffd6c0e7c5b
children 0a476090cd09
line source
1 #!/bin/sh
2 . /lib/libtaz.sh
4 # Internationalization.
5 TEXTDOMAIN='slitaz-base'
6 . /etc/locale.conf
7 export TEXTDOMAIN LANG
9 if [ ! -d ..$QUERY_STRING ]; then
10 echo "HTTP/1.1 404 Not Found";
11 else
12 title=$(_ 'Index of $QUERY_STRING')
13 cat << EOT
14 Content-type: text/html
16 <!DOCTYPE html>
17 <html xmlns="http://www.w3.org/1999/xhtml">
18 <head>
19 <title>$title</title>
20 <meta charset="utf-8" />
21 <link rel="stylesheet" type="text/css" href="/style.css" />
22 </head>
24 <!-- Header -->
25 <div id="header">
26 <h1>$title</h1>
27 </div>
29 <!-- Content -->
30 <div id="content">
31 <body>
32 <ul>
33 $({ [ "$QUERY_STRING" != "/" ] && echo "../"; ls -p ..$QUERY_STRING; } | \
34 sed 's|.*| <li><a href="&">&</a></li>|')
35 </ul>
36 </div>
38 <!-- Footer -->
39 <div id="footer">
40 Copyright &copy; $(date +%Y) <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
41 </div>
43 </body>
44 </html>
45 EOT
46 fi