Wiki2Go 1.17.5 → 1.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/bin/Wiki2Go_firewall_blacklist.rb +8 -0
  2. data/bin/Wiki2Go_make_cvs_repository.rb +1 -0
  3. data/bin/Wiki2Go_make_site.rb +1 -2
  4. data/bin/Wiki2Go_update_site.rb +1 -2
  5. data/lib/Web2Go/CGIRequest.rb +8 -2
  6. data/lib/Web2Go/CGIResponse.rb +17 -14
  7. data/lib/Web2Go/MockRequest.rb +12 -2
  8. data/lib/Web2Go/MockResponse.rb +10 -7
  9. data/lib/Web2Go/WebrickRequest.rb +106 -101
  10. data/lib/Web2Go/WebrickResponse.rb +4 -8
  11. data/lib/Wiki2Go/BlackList.rb +48 -25
  12. data/lib/Wiki2Go/DotGraphics.rb +1 -1
  13. data/lib/Wiki2Go/FileStorage.rb +266 -266
  14. data/lib/Wiki2Go/HTMLFormatter.rb +28 -0
  15. data/lib/Wiki2Go/Install/config/chonqed_blacklist.txt +418 -0
  16. data/lib/Wiki2Go/Install/config/passwords +1 -1
  17. data/lib/Wiki2Go/Install/config/url_blacklist.txt +3855 -0
  18. data/lib/Wiki2Go/Install/make_repository.rb +32 -26
  19. data/lib/Wiki2Go/Install/make_site.rb +197 -111
  20. data/lib/Wiki2Go/Install/site/error.html +1 -1
  21. data/lib/Wiki2Go/Install/site/robots.txt +10 -1
  22. data/lib/Wiki2Go/Install/site/style.css +129 -64
  23. data/lib/Wiki2Go/Install/templates/admin.htm +1 -1
  24. data/lib/Wiki2Go/Install/templates/admin_pages/edit.txt +2 -1
  25. data/lib/Wiki2Go/Install/templates/admin_pages/format_for_fck.txt +31 -0
  26. data/lib/Wiki2Go/Install/templates/admin_pages/passwords.txt +1 -1
  27. data/lib/Wiki2Go/Install/templates/edit.htm +62 -46
  28. data/lib/Wiki2Go/Install/templates/full_footer.htm +31 -33
  29. data/lib/Wiki2Go/Install/templates/header.htm +0 -1
  30. data/lib/Wiki2Go/Install/templates/menu.htm +29 -0
  31. data/lib/Wiki2Go/Install/templates/pagelist.htm +46 -43
  32. data/lib/Wiki2Go/Install/templates/simple_footer.htm +20 -16
  33. data/lib/Wiki2Go/Install/templates/versionlist.htm +52 -40
  34. data/lib/Wiki2Go/Install/templates/view.htm +46 -29
  35. data/lib/Wiki2Go/Install/templates/wikiedit.htm +63 -0
  36. data/lib/Wiki2Go/Install/wiki/delete.png +0 -0
  37. data/lib/Wiki2Go/Install/wiki/style.css +133 -63
  38. data/lib/Wiki2Go/LineFormatter.rb +345 -197
  39. data/lib/Wiki2Go/Page.rb +16 -3
  40. data/lib/Wiki2Go/PrivateWikiConfig.rb +5 -5
  41. data/lib/Wiki2Go/PublicWikiConfig.rb +83 -37
  42. data/lib/Wiki2Go/ReadWriteWikiConfig.rb +8 -8
  43. data/lib/Wiki2Go/Server.rb +6 -1
  44. data/lib/Wiki2Go/SpamFilter.rb +32 -41
  45. data/lib/Wiki2Go/Web.rb +10 -3
  46. data/lib/Wiki2Go/Wiki2Go.rb +301 -94
  47. data/lib/Wiki2Go/Wiki2GoConfig.rb +87 -6
  48. data/lib/Wiki2Go/Wiki2GoServlet.rb +66 -12
  49. data/lib/Wiki2Go/WikiFormatter.rb +60 -30
  50. data/lib/Wiki2Go/cgi/diff.rb +20 -0
  51. data/lib/Wiki2Go/cgi/secure/log_rss.rb +21 -0
  52. data/lib/Wiki2Go/cgi/sidebyside.rb +20 -0
  53. data/lib/Wiki2Go/cgi/wikiedit.rb +20 -0
  54. data/lib/Wiki2Go/firewall_blacklist.rb +88 -0
  55. data/test/All.rb +5 -2
  56. data/test/TestBlackList.rb +70 -14
  57. data/test/TestConfig.rb +5 -5
  58. data/test/TestDiff.rb +95 -0
  59. data/test/TestFormatter.rb +14 -16
  60. data/test/TestHTMLFormatter.rb +37 -0
  61. data/test/TestInstall.rb +70 -27
  62. data/test/TestLineFormatter.rb +71 -15
  63. data/test/TestRSS.rb +8 -7
  64. data/test/TestRepository.rb +50 -0
  65. data/test/TestServer.rb +3 -8
  66. data/test/TestSpamFilter.rb +33 -1
  67. data/test/TestStorage.rb +11 -0
  68. data/test/TestWeb.rb +2 -2
  69. data/test/TestWiki2Go.rb +766 -166
  70. data/test/TestWiki2GoServlet.rb +1122 -524
  71. data/test/UnitTestFiles.rb +7 -3
  72. data/test/Wiki2GoConfigForTest.rb +40 -6
  73. data/test/checksite.rb +17 -50
  74. data/test/test_firewall_blacklist.rb +131 -0
  75. data/test/test_page.rb +45 -0
  76. data/test/testdata/Registration.rbl.txt +7 -0
  77. data/test/testdata/config/url_blacklist.txt +38822 -0
  78. data/test/testdata/expected_changes.html +1 -2
  79. data/test/testdata/expected_edit.html +108 -59
  80. data/test/testdata/expected_full_rss.xml +2 -2
  81. data/test/testdata/expected_out.html +97 -61
  82. data/test/testdata/expected_put.html +88 -53
  83. data/test/testdata/expected_save.html +88 -52
  84. data/test/testdata/expected_savehtml.html +88 -52
  85. data/test/testdata/expected_search.html +68 -53
  86. data/test/testdata/expected_upload.html +88 -53
  87. data/test/testdata/expected_versions.html +97 -82
  88. data/test/testdata/expected_view.html +97 -61
  89. data/test/testdata/firewall/iptables.config +37 -0
  90. data/test/testdata/firewall/user_blacklist.txt +162 -0
  91. data/test/testdata/logs/wiki.log +652 -0
  92. data/test/testdata/logs/wiki.log.0 +113 -0
  93. data/test/testdata/logs/wiki.log.1 +113 -0
  94. data/test/testdata/logs/wiki.log.2 +113 -0
  95. data/test/testdata/logs/wiki.log.3 +115 -0
  96. data/test/testdata/logs/wiki.log.4 +5 -0
  97. data/test/testdata/logs/wiki.log.5 +7 -0
  98. data/test/testdata/logs/wiki.log.6 +5 -0
  99. data/test/testdata/logs/wiki.log.7 +118 -0
  100. data/test/testdata/logs/wiki.log.8 +12 -0
  101. data/test/testdata/site/html/Xpday/rss.xml +53 -103
  102. data/test/testdata/texts/Bugs/FrontPage.txt +6 -0
  103. data/test/testdata/texts/Bugs/NoHidden.spam +17850 -0
  104. data/test/testdata/texts/Bugs/PairProgrammingParties.spam +102 -0
  105. data/test/testdata/texts/Bugs/PairProgrammingParties.txt +99 -0
  106. metadata +53 -7
  107. data/test/TestMail.rb +0 -29
  108. data/test/gc.log +0 -2
@@ -13,7 +13,7 @@
13
13
  <TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
14
14
  <TR>
15
15
  <TD>
16
- <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="Header">
16
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="95%" class="Header">
17
17
  <TR>
18
18
  <TD><h1>Error</h1>
19
19
  </TD>
@@ -5,9 +5,18 @@ Disallow: /scripts/delete/
5
5
  Disallow: /scripts/edit.pl/
6
6
  Disallow: /scripts/edit.rb/
7
7
  Disallow: /scripts/edit/
8
+ Disallow: /scripts/wikiedit.pl/
9
+ Disallow: /scripts/wikiedit.rb/
10
+ Disallow: /scripts/wikiedit/
8
11
  Disallow: /scripts/search.pl/
9
12
  Disallow: /scripts/search.rb/
10
13
  Disallow: /scripts/search/
11
14
  Disallow: /scripts/changes.pl/
12
15
  Disallow: /scripts/changes.rb/
13
- Disallow: /scripts/changes/
16
+ Disallow: /scripts/changes/
17
+ Disallow: /scripts/diff.pl/
18
+ Disallow: /scripts/diff.rb/
19
+ Disallow: /scripts/diff/
20
+ Disallow: /scripts/sidebyside.pl/
21
+ Disallow: /scripts/sidebyside.rb/
22
+ Disallow: /scripts/sidebyside/
@@ -10,76 +10,77 @@ body
10
10
  text-align: justify;
11
11
  }
12
12
 
13
- ul
14
- {
15
- margin-left:0.5em;
16
- padding-top : 0.5em ;
17
- padding-left : 0em ;
18
- padding-right : 0em ;
19
- padding-bottom : 0.5em ;
20
- margin-right:1em
13
+ /* Main structure */
14
+ #container {
15
+ margin: 0;
16
+ margin-left: 2em;
17
+ margin-right: 2em;
18
+ background: #fff;
19
+ border-left: 1px solid #ccc;
20
+ border-right: 1px solid #ccc;
21
+ border-top: 1px solid #ccc;
22
+ border-bottom: 1px solid #ccc;
21
23
  }
22
24
 
23
- li
25
+ #menu
24
26
  {
25
- margin-left:0.5em;
26
- margin-right:1em ;
27
- padding : 0em 0em 0em 0em ;
27
+ border-right: black thin solid;
28
+ background-color: #F8F7F0;
29
+ padding-right : 0.5em ;
30
+
28
31
  }
29
32
 
30
- h1
33
+ #body
31
34
  {
32
- font-weight: bold;
33
- font-size: 28pt;
34
- color: black;
35
- margin : 0em ;
35
+ padding-left : 0.5em ;
36
+ padding-right : 0.5em ;
37
+ width: 100%;
38
+ background-color: #FFFFFF;
36
39
  }
37
40
 
38
- h2,h3,h4,h5,h6
41
+ #header
39
42
  {
40
- color:black
43
+ padding-right: 1em;
44
+ padding-left: 1em;
45
+ padding-bottom: 0.5em;
46
+ margin: 0px;
47
+ padding-top: 0px;
48
+ background-color: #B82619;
49
+ border-bottom: grey thin solid;
50
+ color : White ;
41
51
  }
42
52
 
43
- h2,h3.frontpage {
44
- text-align: center ;
45
- }
46
-
47
- table.Header
53
+ #header a:link
48
54
  {
49
- padding-right: 0.1em;
50
- padding-left: 0.5em;
51
- padding-bottom: 0.1em;
52
- padding-top: 0em;
53
- color: black;
54
- background-color: white;
55
- text-align: left;
56
- border-bottom: 1px solid #ccc;
55
+ color: White;
56
+ font-weight: bolder ;
57
+ text-decoration: none;
57
58
  }
58
59
 
59
- table.Footer
60
- {
61
-
62
- clear: both;
63
- margin: 100px 0 0 0;
64
- padding: 6px;
65
- color: #000;
66
- background: #fff;
67
- border-top: 1px solid #ccc;
60
+ #header a:visited {
61
+ color: White;
62
+ text-decoration: none;
63
+ font-weight: normal ;
68
64
  }
69
65
 
70
- hr {
71
- color: #ccc;
66
+ #header a:hover
67
+ {
68
+ color: cornsilk;
72
69
  }
73
70
 
74
- table.Body
71
+ #header h1
75
72
  {
76
- text-align: left;
73
+ color : White ;
77
74
  }
78
75
 
79
- td[class=search] {
80
- text-align: right;
76
+ #footer
77
+ {
78
+ border-top: grey thin solid;
79
+ background-color : silver;
81
80
  }
82
81
 
82
+ /* Links */
83
+
83
84
  a:link
84
85
  {
85
86
  color: #a50a11;
@@ -97,24 +98,70 @@ a:hover {
97
98
  text-decoration: underline;
98
99
  }
99
100
 
100
- #container {
101
- width: 800px;
102
- margin: 0;
103
- margin-left: auto;
104
- margin-right: auto;
105
- margin-bottom: 40px;
106
- margin-top: 5px;
107
- padding-left: 15px;
108
- padding-right: 15px;
109
- padding-top: 5px;
110
- padding-bottom: 5px;
111
- background: #fff;
112
- border-left: 1px solid #ccc;
113
- border-right: 1px solid #ccc;
114
- border-top: 1px solid #ccc;
115
- border-bottom: 1px solid #ccc;
101
+ /* Headers */
102
+
103
+ h1
104
+ {
105
+ font-weight: bold;
106
+ font-size: 28pt;
107
+ color: black;
108
+ margin : 0em ;
109
+ }
110
+
111
+ h2,h3,h4,h5,h6
112
+ {
113
+ color:black
114
+ }
115
+
116
+ h2,h3.frontpage {
117
+ text-align: center ;
118
+ }
119
+
120
+ /* Style for tables drawn with --- and | in wiki markup */
121
+
122
+ table.wikitable
123
+ {
124
+ border-collapse: collapse;
125
+ }
126
+
127
+ table.wikitable tr
128
+ {
129
+ padding-right: 0.4em;
130
+ padding-left: 0.4em;
131
+ padding-bottom: 0.4em;
132
+ margin: 0em;
133
+ padding-top: 0.4em;
116
134
  }
117
-
135
+
136
+ table.wikitable td
137
+ {
138
+ border-right: 1px solid;
139
+ padding-right: 0.5em;
140
+ border-top: 1px solid;
141
+ padding-left: 0.5em;
142
+ padding-bottom: 0.5em;
143
+ border-left: 1px solid;
144
+ padding-top: 0.5em;
145
+ border-bottom: 1px solid;
146
+ }
147
+
148
+ /* Menu items */
149
+
150
+ #menu ul
151
+ {
152
+ margin-left : 0 ;
153
+ padding-left : 0.5em ;
154
+ }
155
+
156
+ #menu li
157
+ {
158
+ list-style-type: none;
159
+ margin-left : 0 ;
160
+ padding-left : 0 ;
161
+ }
162
+
163
+ /* Style for lists of pages or versions (recent changes, search, versions */
164
+
118
165
  table.topiclist
119
166
  {
120
167
  width: 100%;
@@ -133,3 +180,21 @@ table.topiclist tr.odd
133
180
  table.topiclist tr.even
134
181
  {
135
182
  }
183
+
184
+ /* Style for the display of differences */
185
+ div.diff_kept
186
+ {
187
+ display : block ;
188
+ }
189
+
190
+ div.diff_added
191
+ {
192
+ background-color: #ffffcc;
193
+ display : block ;
194
+ }
195
+
196
+ div.diff_deleted
197
+ {
198
+ background-color: #ffcc33;
199
+ display : block ;
200
+ }
@@ -32,6 +32,7 @@
32
32
  <div class="menuheading"><%= formatter.admin_link("","Home")%></div>
33
33
  <ul>
34
34
  <li><%= formatter.admin_link("regenerate","Regenerate&nbsp;HTML")%></li>
35
+ <li><%= formatter.admin_link("format_for_fck","Prepare&nbsp;for&nbsp;FCKeditor")%></li>
35
36
  <li><%= formatter.admin_link("editfiles","Edit&nbsp;Files")%></li>
36
37
  <li><%= formatter.admin_link("passwords","Passwords")%></li>
37
38
  </ul>
@@ -44,7 +45,6 @@
44
45
  <ul>
45
46
  <li><%= formatter.admin_link("update_site","Update&nbsp;Site")%></li>
46
47
  <li><%= formatter.admin_link("commit_site","Commit&nbsp;Site")%></li>
47
- <li><%= formatter.admin_link("update_conflicts","Update&nbsp;Conflicts")%></li>
48
48
  </ul>
49
49
  <div class="menuheading">Logs</div>
50
50
  <ul>
@@ -1,5 +1,6 @@
1
1
  <%
2
2
  require 'Wiki2Go/WikiFormatter'
3
+ require 'cgi'
3
4
 
4
5
  def show_directory(dirname,label)
5
6
  "<a href=\"#{ @formatter.make_verb_url('admin','editfiles')}?dir=#{CGI::escape(dirname)}\">&gt;#{label}</a>"
@@ -37,7 +38,7 @@
37
38
  <%= show_directory(File.dirname(file),"Back to #{File.dirname(file)}") %>
38
39
  <form action="<%= @formatter.make_verb_url('admin','edit')%>" method="post">
39
40
  <input type="hidden" name="file" value="<%= file %>">
40
- <textarea name="text" rows="35" cols="96"><%= content %></textarea><br>
41
+ <textarea name="text" rows="35" cols="96"><%= CGI::escapeHTML(content) %></textarea><br>
41
42
  <button type="submit" name="update" value="update">
42
43
  Save file
43
44
  </button>&nbsp;<input type="reset" value=" Undo changes ">
@@ -0,0 +1,31 @@
1
+ <%
2
+ require 'Wiki2Go/Wiki2Go'
3
+ require 'Wiki2Go/WikiFormatter'
4
+
5
+ formatter = Wiki2Go::Formatter.new(@web,@config.storage,@config,true,@config.editable?(@web))
6
+
7
+ output = ''
8
+ subwiki = @request.params['wiki']
9
+ if !subwiki.nil? && subwiki.size > 0 then
10
+ subwiki = subwiki[0]
11
+ wiki = Wiki2Go::Wiki.new(@config)
12
+ pageweb = @web.clone
13
+ pageweb.name = subwiki
14
+ output = wiki.prepare_for_fckeditor(pageweb)
15
+ end
16
+
17
+ storage = @config.storage
18
+ if @config.multi_wiki then
19
+ subwikis = storage.wikis
20
+ else
21
+ subwikis = [ '' ]
22
+ end
23
+ %>
24
+ <ul>
25
+ <% subwikis.each do |subwiki| %>
26
+ <li><a href="<%= formatter.make_verb_url('admin','format_for_fck') %>?wiki=<%= subwiki %>">Generate FCKEditor HTML for '<%= (subwiki.empty? ? 'the whole site' : subwiki) %>'</a>
27
+ <% end %>
28
+ </ul>
29
+ <hr>
30
+ <%= output %>
31
+
@@ -64,7 +64,7 @@ end
64
64
  <form action="<%= formatter.make_verb_url('admin','passwords')%>" method="GET">
65
65
  <table>
66
66
  <tr><td>Name</td><td><input name="user" value="<%= user %>"></td></tr>
67
- <tr><td>Password</td><td><input name="password" value="<%= user_pwd %>"></td></tr>
67
+ <tr><td>Password</td><td><input type="password" name="password" value="<%= user_pwd %>"></td></tr>
68
68
  <tr><td colspan=2><input type="submit" name="add" value="Add"></td></tr>
69
69
  </table>
70
70
  </form>
@@ -4,52 +4,68 @@
4
4
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
5
  <HTML>
6
6
  <HEAD>
7
- <!-- include=header.htm -->
8
- <TITLE>Edit
9
- <%= current.web.name %>
10
- -
11
- <%= current.web.current_page %>
12
- </TITLE>
7
+ <!-- include=header.htm -->
8
+ <META name="robots" content="noindex,nofollow">
9
+ <TITLE>Edit
10
+ <%= current.web.name %>
11
+ -
12
+ <%= current.web.current_page %>
13
+ </TITLE>
14
+ <script type="text/javascript" src="/fckeditor/fckeditor.js"></script>
15
+ <script type="text/javascript">
16
+ window.onload = function()
17
+ {
18
+ var oFCKeditor = new FCKeditor( 'text','100%','400' ) ;
19
+ oFCKeditor.ReplaceTextarea() ;
20
+ }
21
+ </script>
13
22
  </HEAD>
14
23
  <BODY>
15
- <div id="container">
16
- <TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
17
- <TR>
18
- <TD>
19
- <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" class="Header">
20
- <TR>
21
- <TD><H1>Edit
22
- <%= current.format.search_link(current.web.current_page) %>
23
- </H1>
24
- </TD>
25
- <td align="right"><%= current.format.view_link(current.web.name,"FrontPage","Home") %></td>
26
- </TR>
27
- </TABLE>
28
- <table border="0" cellpadding="0" cellspacing="0" width="100%" class="Body">
29
- <tr>
30
- <td width="100%">
31
- <form action="<%= current.format.save_url %>" method="POST" id="form2" name="form2">
32
- <p align="left">Edit the page in the text area.
33
- <br>
34
- To quit without changing the page,
35
- <%= current.format.view_link(current.web.name,current.web.current_page,'click here to return to '+ current.web.current_page) %>
36
- </p>
37
- <% if current.web.secure then %>
38
- <p align="left">Page name: <input type="text" name="title" value="<%= CGI::escapeHTML(current.page.name) %>" size="64"></p>
39
- <% else %>
40
- <p align="left">Author name: <input type="text" name="author" value="<%= CGI::escapeHTML(current.web.alias) %>" size="64"><input type="checkbox" name="remember_me" value="on" checked>Remember me</p>
41
- <% end %>
42
- <p align="left"><textarea name="text" rows="35" cols="96">$TEXT$</textarea><br>
43
- <input type="submit" value=" Save " name="save"><input type="reset" value=" Undo changes "> </p>
44
- </form>
45
- <p align="left"><em>Don't forget to follow the <a href="http://wiki2go.nayima.be/Wiki2Go/TextFormattingRules.html" target="_blank">TextFormatting rules</a></em></p>
46
- </td>
47
- </tr>
48
- </table>
49
- <!-- include=simple_footer.htm -->
50
- </TD>
51
- </TR>
52
- </TABLE>
53
- </div>
54
- </BODY>
24
+ <table id="container">
25
+ <tr>
26
+ <td colspan="2" id="header">
27
+ <TABLE border="0" cellpadding="0" cellspacing="0" width="95%" class="Header">
28
+ <TR>
29
+ <TD><H1>Edit
30
+ <%= current.format.search_link(current.web.current_page) %>
31
+ </H1>
32
+ </TD>
33
+ <td align="right"><%= current.format.view_link(current.web.name,"FrontPage","Home") %></td>
34
+ </TR>
35
+ </TABLE>
36
+ </td>
37
+ </tr>
38
+ <tr>
39
+ <td id="menu" valign="top" nowrap>
40
+ <!-- include=menu.htm -->
41
+ </td>
42
+ <td id="body" width="100%" valign="top">
43
+ <form action="<%= current.format.save_url %>" method="POST" id="form2" name="form2">
44
+ <input type="hidden" name="iznorobot" value="<%= current.page.checksum(current.config.checksum_salt) %>" />
45
+ <p align="left">Edit the page in the text area.
46
+ <br>
47
+ To quit without changing the page,
48
+ <%= current.format.view_link(current.web.name,current.web.current_page,'click here to return to '+ current.web.current_page) %>
49
+ </p>
50
+ <% if current.web.secure then %>
51
+ <p align="left">Page name: <input type="text" name="title" value="<%= CGI::escapeHTML(current.page.name) %>" size="64"></p>
52
+ <% else %>
53
+ <p align="left">Author name: <input type="text" name="author" value="<%= CGI::escapeHTML(current.web.alias) %>" size="64"><input type="checkbox" name="remember_me" value="on" checked>Remember
54
+ me</p>
55
+ <% end %>
56
+ <p align="left"><textarea name="text" rows="35" cols="96">$TEXT$</textarea><br>
57
+ <input type="submit" value=" Save " name="save"> <input type="reset" value=" Undo ">
58
+ </p>
59
+ </form>
60
+ <p align="left"><em>Don't forget to follow the <a href="http://wiki2go.nayima.be/Wiki2Go/TextFormattingRules.html" target="_blank">
61
+ TextFormatting rules</a></em></p>
62
+ </td>
63
+ </tr>
64
+ <tr>
65
+ <td colspan="2" id="footer">
66
+ <!-- include=full_footer.htm -->
67
+ </td>
68
+ </tr>
69
+ </table>
70
+ </BODY>
55
71
  </HTML>