36aa80b93175944ad883bf147d578b146ecfdd91
[project/luci.git] / applications / luci-splash / luasrc / view / splash / splash.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12 -%>
13 <%
14 local fs = require "luci.fs"
15 local has_custom_splash = fs.access("/usr/lib/luci-splash/splashtext.html")
16 local has_custom_splashinclude = fs.access("/usr/lib/luci-splash/splashtextinclude.html")
17
18 function expand (e, R)        
19         return (string.gsub(e, "###([A-Z_]+)###", R))
20 end
21
22 local community, homepage, leasetime, limit_up, limit_down
23
24 local contacturl = luci.dispatcher.build_url("freifunk", "contact")
25
26 local c = luci.model.uci.cursor():get_all("freifunk", "community")
27 if c and c.name then
28         name = luci.model.uci.cursor():get('profile_' .. c.name, 'profile', 'name')
29         if name then
30                 community = name
31         else
32                 community = c.name
33         end
34 else
35         community = "Freifunk"
36 end
37
38 if c and c.homepage then
39         homepage = c.homepage
40 else
41         homepage = "http://freifunk.net"
42 end
43
44 local s = luci.model.uci.cursor():get_all("luci_splash", "general")
45 if s then
46         leasetime = s.leasetime or ""
47         limit_up = s.limit_up or nil
48         limit_down = s.limit_down or nil
49 end
50
51 local limit_text = ""
52 if limit_up and limit_down then
53         limit_text = "<p>" .. translate("Your bandwidth is limited to") .. " " .. limit_down .. "/" .. limit_up ..
54         " " .. translate("KB/s (Download/Upload). You may be able to remove this limit by actively contributing " ..
55         "to this project.") .. "</p>"
56 end
57
58 contact = translatef('Get in %s with the operator of this access point.' % ('<a href="' .. contacturl .. '">' .. translatef('Contact') .. '</a>'))
59 accepttext = translatef('By accepting these rules you can use this network for %s hour(s). After this time you need to accept these rules again.' % leasetime)
60
61
62 if has_custom_splash then
63         local R = {
64                 COMMUNITY = community,
65                 COMMUNITY_URL = homepage,
66                 LEASETIME = leasetime,
67                 ACCEPT = tostring(translate("Accept")),
68                 LIMIT = limit_text,
69                 CONTACTURL = contacturl
70         }
71         local splashtext = expand(fs.readfile("/usr/lib/luci-splash/splashtext.html"), R)
72         %>
73         <%=splashtext%>
74
75 <% else %>
76
77         <h2><a id="content" name="content"><%:Welcome%></a></h2>
78
79         <p><%:You are now connected to the free wireless mesh network%> <a href="<%=homepage%>"><%=community%></a>.
80         <%:Please note that we are not an internet service provider but an experimental community network.%></p>
81         <p><%:Access to the internet might be possible nevertheless, because some activists of this project share their
82         private internet connections. These few connections are shared between all users. That means available bandwidth
83         is limited and because of this we ask you not to do any of the following:%></p>
84         <ul>
85                 <li><%:use filesharing applications on this network%></li>
86                 <li><%:waste bandwidth with unneccesary downloads or streams%></li>
87                 <li><%:perform any kind of illegal activities%></li>
88         </ul>
89         <br />
90
91         <% if limit_up and limit_down then %>
92                 <%=limit_text%>
93         <% end %>
94         
95         <p><%:If you use this network on a regular basis we ask for your support:%></p>
96         <ul>
97                 <li><a href="<%=homepage%>"><%:Become an active member of this community and help by operating your own node%></a></li>
98                 <li><%=contact%></li>
99                 <li><%:Donate some money to help us keep this project alive.%></li>
100                 <li><%:If you operate your own wifi equipment use channels different from ours.%></li>
101         </ul>
102
103         <%
104         if has_custom_splashinclude then
105                 local splashtextinclude = fs.readfile("/usr/lib/luci-splash/splashtextinclude.html")
106         %>
107                 <%=splashtextinclude%>
108         <% end %>
109
110         <h2><%:Usage Agreement%></h2>
111         <p>
112         <%:The open and free wireless network of volunteers ("Operators") provides the necessary equipment and Internet connections ("Infrastructure") at their own expense.%>
113         <%:These Terms of Use govern the use of the network by its participants' computer, PDA, or similar device ("Devices") within the network.%>
114         <%:Access to the network is not guaranteed. It can be interrupted at any time without notice for any reason, for certain devices, and/or may be blocked for certain users.%>
115         </p>
116
117         <h3><%:Legally Prohibited Activities%></h3>
118         <p><%:The participant agrees to not perform any action and refrain from acts which may violate the law or infringe upon the rights of third parties.%></p>
119  
120         <h3><%:Legally Prohibited content%></h3>
121         <p><%:The participant agrees to not transfer content over the network which violates the law.%></p>
122  
123         <h3><%:Fair Use Policy%></h3>
124         <p><%:The participant agrees to not use the network in any way which will harm the infrastructure, the network itself, its operators or other participants.%></p>
125  
126         <h3><%:Safety%></h3>
127         <p>The network, like the Internet, is unencrypted and open. Each participant is responsible for the safety of their own connections and devices.</p>
128  
129         <h3>Disclaimer</h3>
130         <p><%:The operator claims no liability for loss of data, unauthorized access/damage to devices, or financial losses that participants may suffer from the use of the network.%></p>
131
132         <br /><p><b><%=accepttext%></b></p>
133 <% end %>
134
135
136