tazbug rev 30
login page: we alrady have content
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Mon May 07 09:26:25 2012 +0200 (2012-05-07) |
parents | bc985f3f94f0 |
children | c5da10e6e749 |
files | web/bugs.cgi |
line diff
1.1 --- a/web/bugs.cgi Wed Apr 11 17:42:48 2012 +0200 1.2 +++ b/web/bugs.cgi Mon May 07 09:26:25 2012 +0200 1.3 @@ -12,21 +12,29 @@ 1.4 bugdir="bug" 1.5 plugins="plugins" 1.6 sessions="/tmp/tazbug/sessions" 1.7 +po="" 1.8 1.9 # Content negotiation for Gettext 1.10 IFS="," 1.11 for lang in $HTTP_ACCEPT_LANGUAGE 1.12 do 1.13 lang=${lang%;*} lang=${lang# } lang=${lang%-*} 1.14 - [ -d "$lang" ] && break 1.15 case "$lang" in 1.16 - en) lang="C" ;; 1.17 - fr) lang="fr_FR" ;; 1.18 - ru) lang="ru_RU" ;; 1.19 + en) LANG="C" ;; 1.20 + de) LANG="de_DE" ;; 1.21 + es) LANG="es_ES" ;; 1.22 + fr) LANG="fr_FR" ;; 1.23 + it) LANG="it_IT" ;; 1.24 + pt) LANG="pt_BR" ;; 1.25 + ru) LANG="ru_RU" ;; 1.26 + zh) LANG="zh_TW" ;; 1.27 esac 1.28 + if echo "$po" | fgrep -q "$lang"; then 1.29 + break 1.30 + fi 1.31 done 1.32 unset IFS 1.33 -export LANG=$lang LC_ALL=$lang 1.34 +export LANG LC_ALL=$LANG 1.35 1.36 # Internationalization: $(gettext "") 1.37 . /usr/bin/gettext.sh 1.38 @@ -106,9 +114,6 @@ 1.39 # Login page 1.40 login_page() { 1.41 cat << EOT 1.42 -<!-- Content --> 1.43 -<div id="content"> 1.44 - 1.45 <h2>$(gettext "Login")</h2> 1.46 1.47 <div id="account-info"> 1.48 @@ -207,7 +212,7 @@ 1.49 EOT 1.50 if check_auth; then 1.51 if [ "$STATUS" == "OPEN" ]; then 1.52 - cat << EOT 1.53 + cat << EOT 1.54 <a href="?id=$id&close">$(gettext "Close bug")</a> 1.55 <a href="?edit=$id">$(gettext "Edit bug")</a> 1.56 EOT 1.57 @@ -245,7 +250,7 @@ 1.58 cat << EOT 1.59 <div> 1.60 <h3>$(gettext "New message")</h3> 1.61 - 1.62 + 1.63 <input type="hidden" name="id" value="$id" /> 1.64 <textarea name="msg" rows="8"></textarea> 1.65 <p><input type="submit" value="$(gettext "Send message")" /></p> 1.66 @@ -358,7 +363,7 @@ 1.67 save_bug() { 1.68 bug="$(GET bug)" 1.69 content="$(GET bugconf)" 1.70 - sed "s/$(echo -en '\r') /\n/g" > $bugdir/$bug/bug.conf << EOT 1.71 + sed s'/"/\'/' | sed "s/$(echo -en '\r') /\n/g" > $bugdir/$bug/bug.conf << EOT 1.72 $content 1.73 EOT 1.74 } 1.75 @@ -452,7 +457,7 @@ 1.76 echo '<h2>README</h2>' 1.77 echo '<pre>' 1.78 cat /usr/share/doc/tazbug/README 1.79 - echo '</pre>' 1.80 + echo '</pre>' 1.81 html_footer ;; 1.82 *\ closed\ *) 1.83 # Show all closed bugs. 1.84 @@ -465,10 +470,10 @@ 1.85 # The login page 1.86 [ "$(GET error)" ] && \ 1.87 error="<span class="error">$(gettext "Bad login or pass")</span>" 1.88 - header 1.89 + header 1.90 html_header 1.91 user_box 1.92 - login_page 1.93 + login_page 1.94 html_footer ;; 1.95 *\ logout\ *) 1.96 # Set a Cookie in the past to logout. 1.97 @@ -528,9 +533,9 @@ 1.98 [ "$(GET delmsg)" ] && rm -f $bugdir/$id/msg.$(GET delmsg) && \ 1.99 touch $bugdir/$id/msg.$(GET delmsg) 1.100 msgs=$(fgrep MSG= $bugdir/$id/msg.* | wc -l) 1.101 - header 1.102 + header 1.103 html_header 1.104 - user_box 1.105 + user_box 1.106 . $bugdir/$id/bug.conf 1.107 bug_page 1.108 html_footer ;; 1.109 @@ -543,7 +548,7 @@ 1.110 echo "ERROR: User already exists" && exit 1 1.111 else 1.112 echo "Creating account for : $(GET name)" 1.113 - new_user_config 1.114 + new_user_config 1.115 fi ;; 1.116 *\ key\ *) 1.117 # Let user post new bug or message with crypted key (no gettext) 1.118 @@ -553,7 +558,7 @@ 1.119 key="$(GET key)" 1.120 id="$(GET bug)" 1.121 header "Content-type: text/plain;" 1.122 - echo "Checking secure key..." 1.123 + echo "Checking secure key..." 1.124 if fgrep -qH $key $PEOPLE/*/account.conf; then 1.125 conf=$(fgrep -H $key $PEOPLE/*/account.conf | cut -d ":" -f 1) 1.126 . $conf 1.127 @@ -565,10 +570,10 @@ 1.128 echo "Message: $(GET msg)" 1.129 new_msg ;; 1.130 *\ bug\ *) 1.131 - echo "Adding new bug: $(GET bug)" 1.132 - echo "Description: $(GET desc)" 1.133 + echo "Adding new bug: $(GET bug)" 1.134 + echo "Description: $(GET desc)" 1.135 new_bug ;; 1.136 - esac 1.137 + esac 1.138 else 1.139 echo "Not a valid SliTaz user key" 1.140 exit 0 1.141 @@ -585,7 +590,7 @@ 1.142 </form> 1.143 <div> 1.144 EOT 1.145 - 1.146 + 1.147 #found=0 JS to notify or write results nb under the search box. 1.148 for bug in $bugdir/* 1.149 do 1.150 @@ -628,9 +633,9 @@ 1.151 </div> 1.152 1.153 <p> 1.154 - Please read the <a href="?README">README</a> for help and more 1.155 + Please read the <a href="?README">README</a> for help and more 1.156 information. You may also be interested by the SliTaz 1.157 - <a href="http://roadmap.slitaz.org/">Roadmap</a> and the packages 1.158 + <a href="http://roadmap.slitaz.org/">Roadmap</a> and the packages 1.159 <a href="http://cook.slitaz.org/">Cooker</a>. To perform a search 1.160 enter your term and press ENTER. 1.161 </p>