Commit Graph

1125 Commits

Author SHA1 Message Date
Aleks-Daniel Jakimenko
00e96d8e65 Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2015-05-29 22:07:03 +03:00
Aleks-Daniel Jakimenko
66be305e41 'journal' class for journal action
Otherwise if you click "More..." it will give you a page that cannot be styled
like a journal (there is just no way to tell that it is a journal from css).
2015-05-29 22:04:29 +03:00
Alex Schroeder
8808f16f8e No longer use URIs as class names
Neither the body tag nor the div created by transclusion will use an
URI as their class.
2015-05-27 18:34:26 +02:00
Aleks-Daniel Jakimenko
f782691e7e UTF-8, again! Also, new ToString sub. 2015-05-17 03:35:35 +03:00
Alex Schroeder
32ab01dae4 :encoding(UTF-8) was changed back to :utf8
This didn't work as intended. Subroutines relying on memory strings such
as PageHtml were not returning any HTML leading to all sorts of
failures (no description items in RSS feeds, for example).
2015-05-15 16:36:16 +02:00
Alex Schroeder
2902e9a872 Add forgotten $id parameter to history calls
DoHistory calls DoRawHistory or DoHtmlHistory and needs to pass $id as
a parameter. This fixes the failing tests in t/history.t and
t/namespaces.t.
2015-05-15 15:10:24 +02:00
Alex Schroeder
4388746064 Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2015-05-11 16:50:25 +02:00
Alex Schroeder
dc50e5c814 Log Deletes
File deletion will now write to a dedicated log file.
2015-05-11 16:49:37 +02:00
Aleks-Daniel Jakimenko
179e64f7c8 No double negation 2015-05-11 17:35:47 +03:00
Alex Schroeder
ad0ef6139c Typo in the comments 2015-05-11 16:31:16 +02:00
Alex Schroeder
1c950b705c Improve test in PageMarkedForDeletion
If for some reason it would be possible to not read a file and not
crash, then PageMarkedForDeletion could have marked it as marked for
deletion: $Page{text} =~ /^\s*$/ might have returned true even if
$Page{text} was undefined. Now we test for existence of the key in
addition for just whitespace.
2015-05-11 16:27:48 +02:00
Aleks-Daniel Jakimenko
1fbd097422 There is no more need to do recursive grep-ing
-r was required earlier because we used separate directories to reduce
 the number of files in each directory. That's not the case anymore.
2015-05-08 11:00:03 +03:00
Aleks-Daniel Jakimenko
0c0de3b838 Fixed warning about not defined sort behaviour in scalar context
Actually, we don't really care about these functions being called in scalar
context, but I fixed it so that the output of perlcritic is clean.
2015-05-02 00:34:07 +03:00
Aleks-Daniel Jakimenko
a57e296531 No more side effects when modifying $_ in map 2015-05-02 00:27:36 +03:00
Aleks-Daniel Jakimenko
a9d764aa94 No more variables declared in conditional statements 2015-05-02 00:22:43 +03:00
Aleks-Daniel Jakimenko
7b681bc1cd No more bareword filehandles 2015-05-02 00:04:29 +03:00
Aleks-Daniel Jakimenko
cd124f9c3a UTF-8 instead of utf8. See [[Refactoring]] for explanation. 2015-05-01 23:47:54 +03:00
Aleks-Daniel Jakimenko
636800a42c Undo the mess and uncry the tears 2015-05-01 13:32:51 +03:00
Aleks-Daniel Jakimenko
047288bb53 Splitting huge subroutines (a bit of testing is probably required) 2015-04-30 03:22:04 +02:00
Aleks-Daniel Jakimenko
85617ba255 GetHeader was split into GetHeader and GetHeaderDiv 2015-04-25 05:19:21 +03:00
Aleks-Daniel Jakimenko
9cfa86beec Increased password length limit from 50 to 64
Somehow the password form was limiting the number of characters to 50.
Private Wiki Extension relies on passwords that are 64 characters in length,
so I have increased the limit.
2015-04-25 05:00:12 +03:00
Aleks-Daniel Jakimenko
0f1486e4d7 Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2015-04-24 16:31:36 +03:00
Aleks-Daniel Jakimenko
8b36bd14cb Fixed bug with max page name length, new option $PageNameLimit
It was checking if the number of utf8 characters is <= 120, but obviously utf8
characters could be up to 4 bytes in length. 120*4 is much greater than 255
(which is a limit on lots of file systems), so it attempted to write files
with illegal filenames. This is now fixed.

Additionally $PageNameLimit option was added. Now you can choose max page
name length yourself (which is very useful for extensions like mac.pl or
private-wiki.pl)
2015-04-24 16:26:33 +03:00
Alex Schroeder
e85f3e054b Improve feedback for the password page
If you have no password set, the password page will tell you as much
(instead of saying that it doesn't match).
2015-04-24 09:19:35 +02:00
Aleks-Daniel Jakimenko
5c47b84714 Splitting AllPagesList into smaller functions
And other small modifications regarding index file
2015-04-23 14:34:13 +03:00
Aleks-Daniel Jakimenko
dbcc6d1459 "secure" and "httponly" flags for cookies (improved security)
These flags are essential for security. The problem we are trying to
solve is the following:
1) you visit a wiki using HTTPS and you set your password.
2) you accidentally visit the same website using plain HTTP
3) although you don't notice, your cookies are sent over the insecure
connection.
Even if that website has redirection, even it denies any insecure
traffic, your cookie is still leaked. That's how cookies work.

"secure" and "httponly" flags solve this. It means that these cookies
will only be sent over a secure connection. If you have set your
password using HTTPS and later you visit the same wiki using plain HTTP,
it will look like you are not logged in (because these cookies will not
be used when you access the website using a non-secure connection).

If you have HTTPS on your website -- ALWAYS make sure that you set your
password using it. Alternatively redirect all non-secure requests to
HTTPS - that's even better.

If you set your password using HTTP, the same cookie will be used for
both HTTP and HTTPS requests - this is done for compatibility with
HTTP-only wikis.

$ENV{'HTTPS'} returns 'on' or empty string. 'on' is truthy so it
should not create any problems, we can safely use it.

I've tested this, it works as expected.
2015-04-20 23:13:26 +03:00
Aleks-Daniel Jakimenko
195ed322d3 Another place where GetKeepDir should be used 2015-04-18 18:14:01 +03:00
Aleks-Daniel Jakimenko
864ba25b5b GetKeepFile chandged to use GetKeepDir (no duplicate logic) 2015-04-18 17:52:53 +03:00
Aleks-Daniel Jakimenko
6f8d281d79 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
1b9183311c GetHiddenValue no longer sets the parameter.
Why does GetHiddenValue act like SetParam? There seems to be no reason
to do it, so I'm removing this call.
2015-04-02 22:46:00 +02:00
Alex Schroeder
199dd9cd63 Edit conflict involving Preview are now fixed
We had a problem in the following situation: User A starts editing a
page at t1. This timestamp is stored in a the parameter oldtime. In the
meantime user B edits and saves the same page at t2. If user A saves,
the changes will be merged. If user A previews and saves later, the
changes would not be merged because the preview changed oldtiem from t1
to t2. This commit makes sure that the an oldtime parameter is prefered
over the actual page timestamp.
2015-04-02 22:22:40 +02:00
Aleks-Daniel Jakimenko
4991910ee8 "1 days" -> "1 day" 2015-03-19 14:04:13 +02:00
Aleks-Daniel Jakimenko
6d7892db73 Increased $SurgeProtectionViews from 10 to 20.
10 is just too low. For wikis with css page it means that you can only
fetch about 5 pages in 20 seconds.
I've seen my users complain about that limit and I've seen it myself
too many times.
Doubling the $SurgeProtectionViews should make it more sane.
2015-03-07 23:09:06 +02:00
Alex Schroeder
b55a5bc5fb Show replace only after a search 2015-03-06 13:17:40 +01:00
Alex Schroeder
7e72eaa6bd Get rid of $ReplaceForm
The old code decided whether the show the replacement field as part of
DoSearch and set $ReplaceForm. By that time, GetHeader had already
called GetSearchForm, so it was too late. I'm not sure why the
variable was necessary in the first place and so I'm removing it
entirely.

grep ReplaceForm *.pl modules/*.pl t/*.t comes up empty, now.
2015-03-06 11:24:26 +01:00
Alex Schroeder
a09eea3984 wiki.pl: updated copyright years 2015-03-06 10:08:14 +01:00
Aleks-Daniel Jakimenko
d8d37eb65c Merge branch 'refactoring-no-return-undef' 2015-03-06 02:20:47 +02:00
Alex Schroeder
fa7cf6226c $StyleSheetPage should be empty by default 2015-03-02 16:04:33 +01:00
Aleks-Daniel Jakimenko
62c7553d82 'return undef' changed to 'return'
This command was used:
find . -type f -print0 | xargs -0 sed -i 's/return undef/return/g'

The idea behind this commit is described on http://oddmuse.org/wiki/Refactoring page.
In short: 'return undef' returns (undef) in list context (a list with one element),
which is wrong.
2015-02-27 12:10:18 +02:00
Alex Schroeder
a3ee3c60ce Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2015-02-04 22:30:29 +01:00
Matt Adams
50fca72f82 Password action (login) has link back to last page. 2015-02-04 19:04:34 +01:00
Alex Schroeder
1a4e6aa527 Submit empty comment no longer wipes comment page. 2015-02-03 10:50:49 +01:00
Alex Schroeder
cdf8b561a6 Fix summary for uploaded files.
The summary for uploaded files had nested p elements; this was
removed. When no summary is provided, we now remove the "#FILE..."
stuff. In this case, no summary is better.
2015-02-01 00:26:43 +01:00
Alex Jakimenko
905d8c930e Fixed recently introduced XSS vulnerability 2015-01-31 20:50:26 +02:00
Matt Adams
0657d84769 Show latest summary when displaying uploaded files 2015-01-31 12:57:52 +01:00
Alex Schroeder
fae5f1e345 replacements: fixed recently introduced bug
The recently introduced code to prevent Perl injection broke repeated
replacements with backreferences.
2015-01-25 09:06:22 +01:00
Alex Schroeder
81b179acac search: fixed handling of missing grep
When closing the pipe to grep, check the status returned by the child
process in $? and return all pages if there was an error (which means
that grep did not filter any pages).
2015-01-25 08:40:07 +01:00
Alex Jakimenko
bc810ee0ce Fixed vulnerability (ugly, but works) 2015-01-25 08:09:07 +02:00
Alex Schroeder
b2f9a0044b ParseData: Reverting to the code from 2006.
As explained on my blog
<https://alexschroeder.ch/wiki/2015-01-13_Handwritten_Optimization>,
the current implementation is "suddenly" very slow. This is specially
noticeable when loading large pages. Without quite understanding how
this is possible, I'm reverting to the old implementation.
2015-01-13 15:32:37 +01:00
Alex Schroeder
081e8243d7 Merge branch 'ad/spans-and-divs' 2014-12-09 03:02:34 +01:00