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