forked from github/kensanata.oddmuse
Compare commits
103 Commits
as/encode_
...
2.3.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88b384c2b4 | ||
|
|
92e231b10c | ||
|
|
e9ce006444 | ||
|
|
bc5ee74ffd | ||
|
|
688cf9eea5 | ||
|
|
ad9a19d551 | ||
|
|
7595e6db36 | ||
|
|
74fd5c569c | ||
|
|
e4376c178b | ||
|
|
9e46438534 | ||
|
|
4dd29bd4a7 | ||
|
|
90af54b7ba | ||
|
|
cadcdde5f8 | ||
|
|
4c77bc11de | ||
|
|
05988eb899 | ||
|
|
040bd05333 | ||
|
|
5f03238f60 | ||
|
|
4c6d91a101 | ||
|
|
71b93887dc | ||
|
|
391049ef77 | ||
|
|
3d5aec5651 | ||
|
|
d976184e24 | ||
|
|
5a45c1191a | ||
|
|
07f315ca12 | ||
|
|
be1cf0e876 | ||
|
|
d4d0ed728f | ||
|
|
0f0f20b21c | ||
|
|
abdb9c973b | ||
|
|
4e0b287890 | ||
|
|
00308f9ed6 | ||
|
|
2488ccdb8c | ||
|
|
cec2f3cc1b | ||
|
|
5a19773dfa | ||
|
|
7c3bb0a0af | ||
|
|
90d44bf863 | ||
|
|
9d0ff86a44 | ||
|
|
d03bc9f40b | ||
|
|
863bda76dc | ||
|
|
fcbe01bbfd | ||
|
|
6178c46aec | ||
|
|
87110eef08 | ||
|
|
1bfeac5035 | ||
|
|
ef257b566f | ||
|
|
0fce2edcf8 | ||
|
|
152188503e | ||
|
|
d804c16a1c | ||
|
|
cb7f2e4634 | ||
|
|
b90695c7c8 | ||
|
|
e67c8bfda6 | ||
|
|
90eb428787 | ||
|
|
e3cacaa89f | ||
|
|
6167428ecf | ||
|
|
367f76b6f4 | ||
|
|
733b6dabb1 | ||
|
|
72cd669bf0 | ||
|
|
84f630af4a | ||
|
|
05df700140 | ||
|
|
f230a64e7d | ||
|
|
1855c84cec | ||
|
|
3c982a6cd4 | ||
|
|
7053561f89 | ||
|
|
02fcabfdbc | ||
|
|
0c0efdd2c8 | ||
|
|
9a93601a03 | ||
|
|
b68f2b6cd6 | ||
|
|
80d95e9225 | ||
|
|
04288eda8c | ||
|
|
3a7f75cf30 | ||
|
|
0ca64b2db0 | ||
|
|
81aaf49463 | ||
|
|
5c93616690 | ||
|
|
c1823bc59c | ||
|
|
1634859659 | ||
|
|
684781423d | ||
|
|
1f2507fc00 | ||
|
|
0644b63b67 | ||
|
|
64f6b267d9 | ||
|
|
528e9d8868 | ||
|
|
f618822f34 | ||
|
|
e9a5fcdc7c | ||
|
|
2a33e91167 | ||
|
|
77327ec06f | ||
|
|
f530b25d74 | ||
|
|
8db81914b1 | ||
|
|
5fce7f4b63 | ||
|
|
1ee235c949 | ||
|
|
be7d8d4460 | ||
|
|
f134283bae | ||
|
|
38d5d01ea1 | ||
|
|
8e3e186fab | ||
|
|
4b33b3afeb | ||
|
|
9beca5895a | ||
|
|
1afc03eee1 | ||
|
|
331b03f894 | ||
|
|
1c9b180b3a | ||
|
|
57a16e85f8 | ||
|
|
c7cd5bcc36 | ||
|
|
f571007516 | ||
|
|
fac3f03f7b | ||
|
|
7d85dd6570 | ||
|
|
a91ef8602f | ||
|
|
1bc670617e | ||
|
|
74288ba3f3 |
8
Makefile
8
Makefile
@@ -22,10 +22,10 @@ clean:
|
|||||||
prove t/setup.pl
|
prove t/setup.pl
|
||||||
|
|
||||||
release:
|
release:
|
||||||
perl stuff/release ~/oddmuse.org
|
perl stuff/release ~/oddmuse.org/releases 2.3.3
|
||||||
|
|
||||||
build/wiki.pl: wiki.pl
|
build/wiki.pl: wiki.pl
|
||||||
perl -lne "s/(\\\$$q->a\(\{-href=>'http:\/\/www.oddmuse.org\/'\}, 'Oddmuse'\))/\\\$$q->a({-href=>'http:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tag\/?id=$(VERSION_NO)'}, 'wiki.pl') . ' ($(VERSION_NO)), see ' . \$$1/; print" < $< > $@
|
perl -lne "s/(\\\$$q->a\(\{-href=>'https:\/\/www.oddmuse.org\/'\}, 'Oddmuse'\))/\\\$$q->a({-href=>'https:\/\/git.savannah.gnu.org\/cgit\/oddmuse.git\/tag\/?id=$(VERSION_NO)'}, 'wiki.pl') . ' ($(VERSION_NO)), see ' . \$$1/; print" < $< > $@
|
||||||
|
|
||||||
build/%-utf8.pl: modules/translations/%-utf8.pl
|
build/%-utf8.pl: modules/translations/%-utf8.pl
|
||||||
perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
|
perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
|
||||||
@@ -36,8 +36,8 @@ build/national-%.pl: modules/translations/national-%.pl
|
|||||||
build/month-names-%.pl: modules/translations/month-names-%.pl
|
build/month-names-%.pl: modules/translations/month-names-%.pl
|
||||||
perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
|
perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, 'translations\/', '$(VERSION_NO)')/; print" < $< > $@
|
||||||
|
|
||||||
# from: http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl
|
# from: https://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl
|
||||||
# to: http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl?id=2.1-11-gd4f1e27
|
# to: https://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/namespaces.pl?id=2.1-11-gd4f1e27
|
||||||
|
|
||||||
build/%.pl: modules/%.pl
|
build/%.pl: modules/%.pl
|
||||||
perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, undef, '$(VERSION_NO)')/; print" < $< > $@
|
perl -lne "s/(AddModuleDescription\('[^']+', '[^']+')\)/\$$1, undef, '$(VERSION_NO)')/; print" < $< > $@
|
||||||
|
|||||||
@@ -23,12 +23,21 @@ usermod -a -G sudo alex
|
|||||||
Now you can login as {{{alex}}} and do everything else using {{{sudo}}}.
|
Now you can login as {{{alex}}} and do everything else using {{{sudo}}}.
|
||||||
|
|
||||||
You need to copy wiki.pl into your cgi-bin directory, and you need to
|
You need to copy wiki.pl into your cgi-bin directory, and you need to
|
||||||
make the script executable.
|
make the script executable. You might also have to change its owner to
|
||||||
|
an appropriate user on your system.
|
||||||
|
|
||||||
{{{
|
{{{
|
||||||
sudo wget -O /usr/lib/cgi-bin/wiki.pl \
|
sudo wget -O /usr/lib/cgi-bin/wiki.pl \
|
||||||
http://git.savannah.gnu.org/cgit/oddmuse.git/plain/wiki.pl
|
http://git.savannah.gnu.org/cgit/oddmuse.git/plain/wiki.pl
|
||||||
sudo chmod +x /usr/lib/cgi-bin/wiki.pl
|
sudo chmod +x /usr/lib/cgi-bin/wiki.pl
|
||||||
|
sudo chown www-data.www-data /usr/lib/cgi-bin/wiki.pl
|
||||||
|
}}}
|
||||||
|
|
||||||
|
If you're on SUSE, the user might not be {{{www-data}}} but
|
||||||
|
{{{wwwrun}}} without appropriate group:
|
||||||
|
|
||||||
|
{{{
|
||||||
|
sudo chown wwwrun.root /usr/lib/cgi-bin/wiki.pl
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
You should be able to test it right now! Visit
|
You should be able to test it right now! Visit
|
||||||
@@ -85,7 +94,7 @@ Enjoy your wiki experience.
|
|||||||
Visit https://www.oddmuse.org/ to learn more about the translation
|
Visit https://www.oddmuse.org/ to learn more about the translation
|
||||||
files and modules that are part of this package.
|
files and modules that are part of this package.
|
||||||
|
|
||||||
== Apache
|
== Checking the Apache Setup
|
||||||
|
|
||||||
If you think this information doesn't work for you, here are some things
|
If you think this information doesn't work for you, here are some things
|
||||||
to check.
|
to check.
|
||||||
@@ -119,7 +128,7 @@ The default site is configured in
|
|||||||
sudo a2ensite default
|
sudo a2ensite default
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
This file also lists the directories we've used in out instructions
|
This file also lists the directories we've used in our instructions
|
||||||
above.
|
above.
|
||||||
|
|
||||||
{{{
|
{{{
|
||||||
@@ -136,6 +145,32 @@ simply restart it all:
|
|||||||
sudo service apache2 graceful
|
sudo service apache2 graceful
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
== Using just Perl
|
||||||
|
|
||||||
|
You can use Mojolicious as your web server. There is a simple
|
||||||
|
##server.pl## which you can use. Here's how you might start it:
|
||||||
|
|
||||||
|
{{{
|
||||||
|
mkdir ~/oddmuse
|
||||||
|
WikiDataDir=$HOME/oddmuse perl server.pl daemon
|
||||||
|
}}}
|
||||||
|
|
||||||
|
This makes the server available on {{{http://localhost:3000/wiki}}}.
|
||||||
|
|
||||||
|
If it works for you, feel free to upgrade to Hypnotoad.
|
||||||
|
|
||||||
|
{{{
|
||||||
|
WikiDataDir=$HOME/oddmuse hypnotoad server.pl
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Note: Hypnotoad uses a different default port. The above makes the
|
||||||
|
server available on {{{http://localhost:8080/wiki}}}. Hypnotoad will
|
||||||
|
keep forking new processes. To stop it, use the {{{-s}}} flag.
|
||||||
|
|
||||||
|
{{{
|
||||||
|
hypnotoad -s server.pl
|
||||||
|
}}}
|
||||||
|
|
||||||
== License
|
== License
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fi
|
|||||||
username=$1
|
username=$1
|
||||||
wiki=$2
|
wiki=$2
|
||||||
|
|
||||||
for p in $(curl "https://campaignwiki.org/wiki/$wiki?action=index;raw=1"); do
|
for p in $(curl --silent "https://campaignwiki.org/wiki/$wiki?action=index;raw=1"); do
|
||||||
echo "Deleting: $p"
|
echo "Deleting: $p"
|
||||||
curl -F frodo=1 -F "title=$p" -F text=DeletedPage -F summary=Deleted -F username="$username" "https://campaignwiki.org/wiki/$wiki"
|
curl -F frodo=1 -F "title=$p" -F text=DeletedPage -F summary=Deleted -F username="$username" "https://campaignwiki.org/wiki/$wiki"
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
use CGI::Carp qw(fatalsToBrowser);
|
use CGI::Carp qw(fatalsToBrowser);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,165 +0,0 @@
|
|||||||
;;; vc-oddmuse.el -- add VC support to oddmuse-curl
|
|
||||||
;;
|
|
||||||
;; Copyright (C) 2014 Alex Schroeder <alex@gnu.org>
|
|
||||||
;;
|
|
||||||
;; Latest version:
|
|
||||||
;; http://git.savannah.gnu.org/cgit/oddmuse.git/plain/contrib/vc-oddmuse.el
|
|
||||||
;; Discussion, feedback:
|
|
||||||
;; http://www.emacswiki.org/cgi-bin/wiki/OddmuseCurl
|
|
||||||
;;
|
|
||||||
;; This program is free software: you can redistribute it and/or modify it
|
|
||||||
;; under the terms of the GNU General Public License as published by the Free
|
|
||||||
;; Software Foundation, either version 3 of the License, or (at your option)
|
|
||||||
;; any later version.
|
|
||||||
;;
|
|
||||||
;; This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
;; more details.
|
|
||||||
;;
|
|
||||||
;; You should have received a copy of the GNU General Public License along
|
|
||||||
;; with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
;;
|
|
||||||
;; Add the following to your init file:
|
|
||||||
;;
|
|
||||||
;; (add-to-list 'vc-handled-backends 'oddmuse)
|
|
||||||
|
|
||||||
(add-to-list 'vc-handled-backends 'oddmuse)
|
|
||||||
|
|
||||||
(require 'oddmuse-curl)
|
|
||||||
(require 'diff)
|
|
||||||
|
|
||||||
(defun vc-oddmuse-revision-granularity () 'file)
|
|
||||||
|
|
||||||
(defun vc-oddmuse-registered (file)
|
|
||||||
"Handle files in `oddmuse-directory'."
|
|
||||||
(string-match (concat "^" (expand-file-name oddmuse-directory))
|
|
||||||
(file-name-directory file)))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-state (file)
|
|
||||||
"Return the current version control state of FILE.
|
|
||||||
For a list of possible values, see `vc-state'."
|
|
||||||
;; Avoid downloading the current version from the wiki and comparing
|
|
||||||
;; the text: Too much traffic!
|
|
||||||
'edited)
|
|
||||||
|
|
||||||
(defun vc-oddmuse-working-revision (file)
|
|
||||||
"The current revision based on `oddmuse-revisions'."
|
|
||||||
(with-oddmuse-file
|
|
||||||
(oddmuse-get-latest-revision wiki pagename)))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-checkout-model (files)
|
|
||||||
"No locking."
|
|
||||||
'implicit)
|
|
||||||
|
|
||||||
(defun vc-oddmuse-create-repo (file)
|
|
||||||
(error "You cannot create Oddmuse wikis using Emacs."))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-register (files &optional rev comment)
|
|
||||||
"This always works.")
|
|
||||||
|
|
||||||
(defvar vc-oddmuse-log-command
|
|
||||||
(concat "curl --silent %w"
|
|
||||||
" --form action=rc"
|
|
||||||
" --form showedit=1"
|
|
||||||
" --form all=1"
|
|
||||||
" --form from=1"
|
|
||||||
" --form raw=1"
|
|
||||||
" --form match='%r'")
|
|
||||||
"Command to use for publishing index pages.
|
|
||||||
It must print the page to stdout.
|
|
||||||
|
|
||||||
See `oddmuse-format-command' for the formatting options.")
|
|
||||||
|
|
||||||
(defun vc-oddmuse-print-log (files buffer &optional shortlog start-revision limit)
|
|
||||||
"Load complete recent changes for the files."
|
|
||||||
;; Derive `oddmuse-wiki' from the first file
|
|
||||||
(with-oddmuse-file (car files)
|
|
||||||
;; The wiki expects a Perl regular expression!
|
|
||||||
(let ((regexp (concat "^(" (mapconcat 'file-name-nondirectory files "|") ")$")))
|
|
||||||
(oddmuse-run "Getting recent changes" vc-oddmuse-log-command nil nil buffer)))
|
|
||||||
(with-current-buffer buffer
|
|
||||||
(oddmuse-render-rss3))
|
|
||||||
'limit-unsupported)
|
|
||||||
|
|
||||||
(defun vc-oddmuse-log-outgoing ()
|
|
||||||
(error "This is not supported."))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-log-incoming ()
|
|
||||||
(error "This is not supported."))
|
|
||||||
|
|
||||||
(defvar vc-oddmuse-get-revision-command
|
|
||||||
(concat "curl --silent"
|
|
||||||
" --form action=browse"
|
|
||||||
" --form id=%t"
|
|
||||||
" --form revision=%v"
|
|
||||||
" --form raw=1"
|
|
||||||
" '%w'")
|
|
||||||
"Command to use to get older revisions of a page.
|
|
||||||
It must print the page to stdout.
|
|
||||||
|
|
||||||
%? '?' character
|
|
||||||
%w URL of the wiki as provided by `oddmuse-wikis'
|
|
||||||
%t Page title as provided by `oddmuse-page-name'
|
|
||||||
%v Revision to retrieve as provided by `oddmuse-revision'")
|
|
||||||
|
|
||||||
(defun oddmuse-revision-filename (rev)
|
|
||||||
"Return filename for revision REV.
|
|
||||||
This uses `oddmuse-directory', `wiki' and `pagename' as bound by
|
|
||||||
`with-oddmuse-file'."
|
|
||||||
(concat oddmuse-directory
|
|
||||||
"/" wiki
|
|
||||||
"/" pagename
|
|
||||||
".~" rev "~"))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-diff (files &optional rev1 rev2 buffer)
|
|
||||||
"Report the differences for FILES."
|
|
||||||
(setq buffer (or buffer (get-buffer-create "*vc-diff*")))
|
|
||||||
(dolist (file files)
|
|
||||||
(with-oddmuse-file file
|
|
||||||
(setq rev1 (or rev1 (oddmuse-get-latest-revision wiki pagename)))
|
|
||||||
(dolist (rev (list rev1 rev2))
|
|
||||||
(when (and rev (not (file-readable-p (oddmuse-revision-filename rev))))
|
|
||||||
(let* ((oddmuse-revision rev)
|
|
||||||
(command vc-oddmuse-get-revision-command)
|
|
||||||
(filename (oddmuse-revision-filename rev)))
|
|
||||||
(with-temp-buffer
|
|
||||||
(oddmuse-run
|
|
||||||
(concat "Downloading revision " rev)
|
|
||||||
command wiki pagename)
|
|
||||||
(write-file filename)))))
|
|
||||||
(diff-no-select
|
|
||||||
(if rev1 (oddmuse-revision-filename rev1) file)
|
|
||||||
(if rev2 (oddmuse-revision-filename rev2) file)
|
|
||||||
nil
|
|
||||||
(vc-switches 'oddmuse 'diff)
|
|
||||||
buffer))))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-revert (file &optional contents-done)
|
|
||||||
"Revert FILE back to the wiki revision.
|
|
||||||
If optional arg CONTENTS-DONE is non-nil, then nothing needs to
|
|
||||||
be done, as the contents of FILE have already been reverted from
|
|
||||||
a version backup."
|
|
||||||
(unless contents-done
|
|
||||||
(with-oddmuse-file file
|
|
||||||
(let ((command (oddmuse-format-command vc-oddmuse-get-revision-command)))
|
|
||||||
(with-temp-buffer
|
|
||||||
(oddmuse-run "Loading" command wiki pagename)
|
|
||||||
(write-file file))))))
|
|
||||||
|
|
||||||
(defun vc-oddmuse-checkin (files rev comment)
|
|
||||||
"Commit changes in FILES to this backend.
|
|
||||||
REV is a historical artifact and should be ignored. COMMENT is
|
|
||||||
used as a check-in comment."
|
|
||||||
(dolist (file files)
|
|
||||||
(with-oddmuse-file file
|
|
||||||
(let* ((summary comment)
|
|
||||||
(command (oddmuse-format-command oddmuse-post-command))
|
|
||||||
(buf (get-buffer-create " *oddmuse-response*")))
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert-file-contents file)
|
|
||||||
(oddmuse-run "Posting" command wiki pagename buf t 302))))))
|
|
||||||
|
|
||||||
(provide 'vc-oddmuse)
|
|
||||||
@@ -27,6 +27,10 @@ textarea, pre, code, tt {
|
|||||||
font-family: Times, serif;
|
font-family: Times, serif;
|
||||||
font-size:10pt;
|
font-size:10pt;
|
||||||
}
|
}
|
||||||
|
/* Printing from Firefox */
|
||||||
|
svg {
|
||||||
|
transform: translate(-1.5cm, -1cm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iPhone */
|
/* iPhone */
|
||||||
@@ -49,7 +53,8 @@ textarea, pre, code, tt {
|
|||||||
/* hide the buttons but don't use display:none because of
|
/* hide the buttons but don't use display:none because of
|
||||||
http://stackoverflow.com/questions/5665203/getting-iphone-go-button-to-submit-form
|
http://stackoverflow.com/questions/5665203/getting-iphone-go-button-to-submit-form
|
||||||
.header input[type="submit"] { position: absolute; visibility: hidden; } */
|
.header input[type="submit"] { position: absolute; visibility: hidden; } */
|
||||||
.header input { width: 5em; font-size: 80%; }
|
.header input { width: 6em; font-size: 80%; }
|
||||||
|
.header input[type="checkbox"] { width: 1em; }
|
||||||
.footer { clear:both; font-size: 90%; }
|
.footer { clear:both; font-size: 90%; }
|
||||||
.content input { font-size: 80%; line-height: 125%; }
|
.content input { font-size: 80%; line-height: 125%; }
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
package OddMuse;
|
package OddMuse;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -68,13 +65,13 @@ sub AdminPowerRename {
|
|||||||
Unlink($IndexFile);
|
Unlink($IndexFile);
|
||||||
# page file
|
# page file
|
||||||
CreateDir($PageDir); # It might not exist yet
|
CreateDir($PageDir); # It might not exist yet
|
||||||
rename($fname, $newfname)
|
Rename($fname, $newfname)
|
||||||
or ReportError(Tss('Cannot rename %1 to %2', $fname, $newfname) . ": $!", '500 INTERNAL SERVER ERROR');
|
or ReportError(Tss('Cannot rename %1 to %2', $fname, $newfname) . ": $!", '500 INTERNAL SERVER ERROR');
|
||||||
# keep directory
|
# keep directory
|
||||||
my $kdir = GetKeepDir($id);
|
my $kdir = GetKeepDir($id);
|
||||||
my $newkdir = GetKeepDir($new);
|
my $newkdir = GetKeepDir($new);
|
||||||
CreateDir($KeepDir); # It might not exist yet (only the parent directory!)
|
CreateDir($KeepDir); # It might not exist yet (only the parent directory!)
|
||||||
rename($kdir, $newkdir)
|
Rename($kdir, $newkdir)
|
||||||
or ReportError(Tss('Cannot rename %1 to %2', $kdir, $newkdir) . ": $!", '500 INTERNAL SERVER ERROR')
|
or ReportError(Tss('Cannot rename %1 to %2', $kdir, $newkdir) . ": $!", '500 INTERNAL SERVER ERROR')
|
||||||
if IsDir($kdir);
|
if IsDir($kdir);
|
||||||
# refer file
|
# refer file
|
||||||
@@ -82,7 +79,7 @@ sub AdminPowerRename {
|
|||||||
my $rdir = GetRefererFile($id);
|
my $rdir = GetRefererFile($id);
|
||||||
my $newrdir = GetRefererFile($new);
|
my $newrdir = GetRefererFile($new);
|
||||||
CreateDir($RefererDir); # It might not exist yet
|
CreateDir($RefererDir); # It might not exist yet
|
||||||
rename($rdir, $newrdir)
|
Rename($rdir, $newrdir)
|
||||||
or ReportError(Tss('Cannot rename %1 to %2', $rdir, $newrdir) . ": $!", '500 INTERNAL SERVER ERROR')
|
or ReportError(Tss('Cannot rename %1 to %2', $rdir, $newrdir) . ": $!", '500 INTERNAL SERVER ERROR')
|
||||||
if IsDir($rdir);
|
if IsDir($rdir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ $NewQuestion = 'Write your question here:';
|
|||||||
|
|
||||||
sub IncrementInFile {
|
sub IncrementInFile {
|
||||||
my $filename = shift;
|
my $filename = shift;
|
||||||
utf8::encode($filename);
|
sysopen my $fh, encode_utf8($filename), O_RDWR|O_CREAT or die "can't open $filename: $!";
|
||||||
sysopen my $fh, $filename, O_RDWR|O_CREAT or die "can't open $filename: $!";
|
|
||||||
flock $fh, LOCK_EX or die "can't flock $filename: $!";
|
flock $fh, LOCK_EX or die "can't flock $filename: $!";
|
||||||
my $num = <$fh> || 1;
|
my $num = <$fh> || 1;
|
||||||
seek $fh, 0, 0 or die "can't rewind $filename: $!";
|
seek $fh, 0, 0 or die "can't rewind $filename: $!";
|
||||||
|
|||||||
@@ -206,18 +206,17 @@ except where noted.
|
|||||||
|
|
||||||
Copyleft 2008 by B.w.Curry <http://www.raiazome.com>.
|
Copyleft 2008 by B.w.Curry <http://www.raiazome.com>.
|
||||||
|
|
||||||
This file is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU General Public License
|
it under the terms of the GNU General Public License as published by
|
||||||
as published by the Free Software Foundation; either version 2
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This file is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this file; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# Grab MLDBM at http://search.cpan.org/dist/MLDBM/lib/MLDBM.pm
|
# Grab MLDBM at http://search.cpan.org/dist/MLDBM/lib/MLDBM.pm
|
||||||
# ie: http://search.cpan.org/CPAN/authors/id/C/CH/CHAMAS/MLDBM-2.01.tar.gz
|
# ie: http://search.cpan.org/CPAN/authors/id/C/CH/CHAMAS/MLDBM-2.01.tar.gz
|
||||||
@@ -44,10 +41,8 @@ sub BacklinksMenu {
|
|||||||
$Action{buildback} = \&BuildBacklinkDatabase;
|
$Action{buildback} = \&BuildBacklinkDatabase;
|
||||||
sub BuildBacklinkDatabase {
|
sub BuildBacklinkDatabase {
|
||||||
print GetHttpHeader('text/plain');
|
print GetHttpHeader('text/plain');
|
||||||
my $file = $backfile;
|
Unlink($backfile); # Remove old database
|
||||||
utf8::encode($file); # bytes
|
tie my %backhash, 'MLDBM', encode_utf8($backfile) or die "Cannot open file $backfile $!\n";
|
||||||
unlink($file); # Remove old database
|
|
||||||
tie my %backhash, 'MLDBM', $file or die "Cannot open file $backfile $!\n";
|
|
||||||
log1("Starting Database Store Process ... please wait\n\n");
|
log1("Starting Database Store Process ... please wait\n\n");
|
||||||
|
|
||||||
foreach my $name (AllPagesList()) {
|
foreach my $name (AllPagesList()) {
|
||||||
@@ -103,9 +98,7 @@ sub GetBackLink {
|
|||||||
|
|
||||||
our ($BacklinkBanned);
|
our ($BacklinkBanned);
|
||||||
$BacklinkBanned = "HomePage|ScratchPad" if !$BacklinkBanned;
|
$BacklinkBanned = "HomePage|ScratchPad" if !$BacklinkBanned;
|
||||||
my $file = $backfile;
|
tie my %backhash, 'MLDBM', encode_utf8($backfile), O_CREAT|O_RDWR, oct(644) or die "Cannot open file $backfile $!\n";
|
||||||
utf8::encode($file);
|
|
||||||
tie my %backhash, 'MLDBM', $file, O_CREAT|O_RDWR, oct(644) or die "Cannot open file $backfile $!\n";
|
|
||||||
|
|
||||||
# Search database for matches
|
# Search database for matches
|
||||||
while ( my ($source, $hashes) = each %backhash ) {
|
while ( my ($source, $hashes) = each %backhash ) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
|
# Copyright (C) 2013-2016 Alex Schroeder <alex@gnu.org>
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify it under
|
# This program is free software: you can redistribute it and/or modify it under
|
||||||
# the terms of the GNU General Public License as published by the Free Software
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
@@ -21,11 +21,12 @@ compared to the list of regular expressions on the C<BannedHosts> page
|
|||||||
(see C<$BannedHosts>). If the contributor is already banned, this is
|
(see C<$BannedHosts>). If the contributor is already banned, this is
|
||||||
mentioned. If the contributor is not banned, you'll see a button
|
mentioned. If the contributor is not banned, you'll see a button
|
||||||
allowing you to ban him or her immediately. If you click the button,
|
allowing you to ban him or her immediately. If you click the button,
|
||||||
the IP or hostname will be added to the C<BannedHosts> page for you.
|
the IP will be added to the C<BannedHosts> page for you.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|
||||||
our ($q, $Now, %Page, $OpenPageName, %Action, $UrlPattern, $BannedContent, $BannedHosts, @MyAdminCode);
|
our ($q, $Now, %Page, $OpenPageName, %Action, $UrlPattern, $BannedContent, $BannedHosts, @MyAdminCode);
|
||||||
|
|
||||||
AddModuleDescription('ban-contributors.pl', 'Ban Contributors Extension');
|
AddModuleDescription('ban-contributors.pl', 'Ban Contributors Extension');
|
||||||
@@ -56,17 +57,18 @@ sub IsItBanned {
|
|||||||
sub DoBanHosts {
|
sub DoBanHosts {
|
||||||
my $id = shift;
|
my $id = shift;
|
||||||
my $content = GetParam('content', '');
|
my $content = GetParam('content', '');
|
||||||
my $host = GetParam('host', '');
|
my $range = GetParam('range', '');
|
||||||
|
my $regexp = GetParam('regexp', '');
|
||||||
if ($content) {
|
if ($content) {
|
||||||
SetParam('text', GetPageContent($BannedContent)
|
SetParam('text', GetPageContent($BannedContent)
|
||||||
. $content . " # " . CalcDay($Now) . " "
|
. $content . " # " . CalcDay($Now) . " "
|
||||||
. NormalToFree($id) . "\n");
|
. NormalToFree($id) . "\n");
|
||||||
SetParam('summary', NormalToFree($id));
|
SetParam('summary', NormalToFree($id));
|
||||||
DoPost($BannedContent);
|
DoPost($BannedContent);
|
||||||
} elsif ($host) {
|
} elsif ($regexp) {
|
||||||
$host =~ s/\./\\./g;
|
|
||||||
SetParam('text', GetPageContent($BannedHosts)
|
SetParam('text', GetPageContent($BannedHosts)
|
||||||
. "^" . $host . " # " . CalcDay($Now) . " "
|
. $regexp . " # " . CalcDay($Now)
|
||||||
|
. " $range "
|
||||||
. NormalToFree($id) . "\n");
|
. NormalToFree($id) . "\n");
|
||||||
SetParam('summary', NormalToFree($id));
|
SetParam('summary', NormalToFree($id));
|
||||||
DoPost($BannedHosts);
|
DoPost($BannedHosts);
|
||||||
@@ -94,10 +96,14 @@ sub DoBanHosts {
|
|||||||
if (IsItBanned($_, \@regexps)) {
|
if (IsItBanned($_, \@regexps)) {
|
||||||
print $q->p(Ts("%s is banned", $name));
|
print $q->p(Ts("%s is banned", $name));
|
||||||
} else {
|
} else {
|
||||||
|
my ($start, $end) = BanContributors::get_range($_);
|
||||||
|
$range = "[$start - $end]";
|
||||||
|
$name .= " " . $range;
|
||||||
print GetFormStart(undef, 'get', 'ban'),
|
print GetFormStart(undef, 'get', 'ban'),
|
||||||
GetHiddenValue('action', 'ban'),
|
GetHiddenValue('action', 'ban'),
|
||||||
GetHiddenValue('id', $id),
|
GetHiddenValue('id', $id),
|
||||||
GetHiddenValue('host', $_),
|
GetHiddenValue('range', $range),
|
||||||
|
GetHiddenValue('regexp', BanContributors::get_regexp_ip($start, $end)),
|
||||||
GetHiddenValue('recent_edit', 'on'),
|
GetHiddenValue('recent_edit', 'on'),
|
||||||
$q->p($name, $q->submit(T('Ban!'))), $q->end_form();
|
$q->p($name, $q->submit(T('Ban!'))), $q->end_form();
|
||||||
}
|
}
|
||||||
@@ -158,3 +164,95 @@ sub NewBanContributorsWriteRcLog {
|
|||||||
};
|
};
|
||||||
return OldBanContributorsWriteRcLog(@_);
|
return OldBanContributorsWriteRcLog(@_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package BanContributors;
|
||||||
|
use Net::Whois::Parser qw/parse_whois/;
|
||||||
|
|
||||||
|
sub get_range {
|
||||||
|
my $ip = shift;
|
||||||
|
my $response = parse_whois(domain => $ip);
|
||||||
|
my ($start, $end);
|
||||||
|
my $re = '(?:[0-9]{1,3}\.){3}[0-9]{1,3}';
|
||||||
|
my ($start, $end) = $response->{inetnum} =~ /($re) *- *($re)/;
|
||||||
|
return $start, $end;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_groups {
|
||||||
|
my ($from, $to) = @_;
|
||||||
|
my @groups;
|
||||||
|
if ($from < 10) {
|
||||||
|
my $to = $to >= 10 ? 9 : $to;
|
||||||
|
push(@groups, [$from, $to]);
|
||||||
|
$from = $to + 1;
|
||||||
|
}
|
||||||
|
while ($from < $to) {
|
||||||
|
my $to = int($from/100) < int($to/100) ? $from + 99 - $from % 100 : $to;
|
||||||
|
if ($from % 10) {
|
||||||
|
push(@groups, [$from, $from + 9 - $from % 10]);
|
||||||
|
$from += 10 - $from % 10;
|
||||||
|
}
|
||||||
|
if (int($from/10) < int($to/10)) {
|
||||||
|
if ($to % 10 == 9) {
|
||||||
|
push(@groups, [$from, $to]);
|
||||||
|
$from = 1 + $to;
|
||||||
|
} else {
|
||||||
|
push(@groups, [$from, $to - 1 - $to % 10]);
|
||||||
|
$from = $to - $to % 10;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
push(@groups, [$from - $from % 10, $to]);
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
if ($to % 10 != 9) {
|
||||||
|
push(@groups, [$from, $to]);
|
||||||
|
$from = 1 + $to; # jump from 99 to 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return \@groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_regexp_range {
|
||||||
|
my @chars;
|
||||||
|
for my $group (@{get_groups(@_)}) {
|
||||||
|
my ($from, $to) = @$group;
|
||||||
|
my $char;
|
||||||
|
for (my $i = length($from); $i >= 1; $i--) {
|
||||||
|
if (substr($from, - $i, 1) eq substr($to, - $i, 1)) {
|
||||||
|
$char .= substr($from, - $i, 1);
|
||||||
|
} else {
|
||||||
|
$char .= '[' . substr($from, - $i, 1) . '-' . substr($to, - $i, 1). ']';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
push(@chars, $char);
|
||||||
|
}
|
||||||
|
return join('|', @chars);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_regexp_ip {
|
||||||
|
my ($from, $to) = @_;
|
||||||
|
my @start = split(/\./, $from);
|
||||||
|
my @end = split(/\./, $to);
|
||||||
|
my $regexp = "^";
|
||||||
|
for my $i (0 .. 3) {
|
||||||
|
if ($start[$i] eq $end[$i]) {
|
||||||
|
$regexp .= $start[$i];
|
||||||
|
} elsif ($start[$i] eq '0' and $end[$i] eq '255') {
|
||||||
|
last;
|
||||||
|
} elsif ($start[$i + 1] > 0) {
|
||||||
|
$regexp .= '(' . $start[$i] . '\.('
|
||||||
|
. get_regexp_range($start[$i + 1], '255') . ')|'
|
||||||
|
. get_regexp_range($start[$i] + 1, $end[$i + 1]) . ')';
|
||||||
|
$regexp .= '\.';
|
||||||
|
last;
|
||||||
|
} else {
|
||||||
|
$regexp .= '(' . get_regexp_range($start[$i], $end[$i]) . ')$';
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
$regexp .= '\.' if $i < 3;
|
||||||
|
}
|
||||||
|
return $regexp;
|
||||||
|
}
|
||||||
|
|
||||||
|
# this is required in case we concatenate other modules to this one
|
||||||
|
package OddMuse;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ This extension works with logbannedcontent.pl.
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
our (%AdminPages, %LockOnCreation, @MyInitVariables, %PlainTextPages, $BannedContent, $BannedFile);
|
our (%AdminPages, %LockOnCreation, @MyInitVariables, %PlainTextPages, $BannedContent, $BannedFile,
|
||||||
|
$FullUrlPattern);
|
||||||
our ($BannedRegexps);
|
our ($BannedRegexps);
|
||||||
|
|
||||||
$BannedRegexps = 'BannedRegexps';
|
$BannedRegexps = 'BannedRegexps';
|
||||||
@@ -61,6 +62,8 @@ push(@MyInitVariables, sub {
|
|||||||
|
|
||||||
sub RegexpNewBannedContent {
|
sub RegexpNewBannedContent {
|
||||||
my $str = shift;
|
my $str = shift;
|
||||||
|
# remove URLs as they are controlled by $BannedContent
|
||||||
|
$str =~ s/$FullUrlPattern//g;
|
||||||
my $rule = RegexpOldBannedContent($str, @_);
|
my $rule = RegexpOldBannedContent($str, @_);
|
||||||
if (not $rule) {
|
if (not $rule) {
|
||||||
foreach (split(/\n/, GetPageContent($BannedRegexps))) {
|
foreach (split(/\n/, GetPageContent($BannedRegexps))) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -26,6 +23,7 @@ our ($q, %Page, %Action, $Now, $OpenPageName, $CollectingJournal, $FreeLinkPatte
|
|||||||
our ($CalendarOnEveryPage, $CalAsTable, $CalStartMonday);
|
our ($CalendarOnEveryPage, $CalAsTable, $CalStartMonday);
|
||||||
|
|
||||||
$CalendarOnEveryPage = 0; # 1=on every page is a month-div situated in the header, use css to control
|
$CalendarOnEveryPage = 0; # 1=on every page is a month-div situated in the header, use css to control
|
||||||
|
# 2=this month and the previous month; 3=this, previous and next month
|
||||||
$CalAsTable = 0; # 0=every month-div is "free", 1=every month-div is caught in a table, use css to control
|
$CalAsTable = 0; # 0=every month-div is "free", 1=every month-div is caught in a table, use css to control
|
||||||
$CalStartMonday = 0; # 0=week starts with Su, 1=week starts with Mo
|
$CalStartMonday = 0; # 0=week starts with Su, 1=week starts with Mo
|
||||||
|
|
||||||
@@ -37,8 +35,22 @@ sub NewCalendarGetHeader {
|
|||||||
return $header unless $CalendarOnEveryPage;
|
return $header unless $CalendarOnEveryPage;
|
||||||
my $action = GetParam('action', 'browse');
|
my $action = GetParam('action', 'browse');
|
||||||
return $header if grep(/^$action$/, ('calendar', 'edit'));
|
return $header if grep(/^$action$/, ('calendar', 'edit'));
|
||||||
my $cal = Cal();
|
my $cal;
|
||||||
$header =~ s/<div class="header">/$cal<div class="header">/;
|
my ($sec, $min, $hour, $mday, $mon, $year) = localtime($Now);
|
||||||
|
$year += 1900;
|
||||||
|
# $mon is 0 based and thus good for previous month
|
||||||
|
if ($mon < 1) { $year -= 1; $mon += 12; };
|
||||||
|
$cal .= Cal($year, $mon) if $CalendarOnEveryPage > 1;
|
||||||
|
# the current month
|
||||||
|
$mon += 1;
|
||||||
|
if ($mon > 12) { $year += 1; $mon -= 12; };
|
||||||
|
$cal .= Cal($year, $mon) if $CalendarOnEveryPage;
|
||||||
|
# the next month
|
||||||
|
$mon += 1;
|
||||||
|
if ($mon > 12) { $year += 1; $mon -= 12; };
|
||||||
|
$cal .= Cal($year, $mon) if $CalendarOnEveryPage > 2;
|
||||||
|
# insert calendars before header div
|
||||||
|
$header =~ s!<div class="header">!<div class="cal">$cal</div><div class="header">!;
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +100,7 @@ sub Cal {
|
|||||||
$year_text, 'local collection year'));
|
$year_text, 'local collection year'));
|
||||||
}
|
}
|
||||||
}}e;
|
}}e;
|
||||||
return "<div class=\"cal month\"><pre>$cal</pre></div>";
|
return "<div class=\"month\"><pre>$cal</pre></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$Action{collect} = \&DoCollect;
|
$Action{collect} = \&DoCollect;
|
||||||
@@ -129,7 +141,7 @@ sub CalendarRule {
|
|||||||
my $oldpos = pos;
|
my $oldpos = pos;
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
print Cal($2, $3);
|
print $q->div({-class => 'cal'}, Cal($2, $3));
|
||||||
pos = $oldpos;
|
pos = $oldpos;
|
||||||
return AddHtmlEnvironment('p');
|
return AddHtmlEnvironment('p');
|
||||||
} elsif (/\G(month:([+-]\d\d?))/cg
|
} elsif (/\G(month:([+-]\d\d?))/cg
|
||||||
@@ -144,7 +156,7 @@ sub CalendarRule {
|
|||||||
$mon += 1 + $delta;
|
$mon += 1 + $delta;
|
||||||
while ($mon < 1) { $year -= 1; $mon += 12; };
|
while ($mon < 1) { $year -= 1; $mon += 12; };
|
||||||
while ($mon > 12) { $year += 1; $mon -= 12; };
|
while ($mon > 12) { $year += 1; $mon -= 12; };
|
||||||
print Cal($year, $mon, undef, $id);
|
print $q->div({-class => 'cal'}, Cal($year, $mon, undef, $id));
|
||||||
pos = $oldpos;
|
pos = $oldpos;
|
||||||
return AddHtmlEnvironment('p');
|
return AddHtmlEnvironment('p');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,8 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
use utf8;
|
use utf8;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
|||||||
@@ -1,34 +1,35 @@
|
|||||||
# Copyright (C) 2005 Fletcher T. Penney <fletcher@freeshell.org>
|
# Copyright (C) 2005 Fletcher T. Penney <fletcher@freeshell.org>
|
||||||
|
# Copyright (C) 2016 Alex Schroeder <alex@gnu.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify it under
|
||||||
# it under the terms of the GNU General Public License as published by
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# Foundation; either version 3 of the License, or (at your option) any later
|
||||||
# (at your option) any later version.
|
# version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License along with
|
||||||
# along with this program; if not, write to the
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
=head1 Creation Date Extension
|
||||||
#
|
|
||||||
# This module stores additional information about a page when it is
|
This module stores additional information about a page when it is first created:
|
||||||
# first created:
|
|
||||||
# created = the date the page is FIRST saved
|
=over
|
||||||
# originalAuthor = the username that first created a page
|
=item C<created> is the date the page is first saved
|
||||||
#
|
=item C<originalAuthor> is the username that first created a page
|
||||||
# Of course, you can customize this to store more information
|
=back
|
||||||
|
=cut
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|
||||||
AddModuleDescription('creationdate.pl', 'CreationDate Module');
|
AddModuleDescription('creationdate.pl', 'CreationDate Module');
|
||||||
|
|
||||||
our (%Page, $Now);
|
our (%Page, $Now, @MyAdminCode, %Action, $q, $FS, $RcOldFile, $RcFile);
|
||||||
|
|
||||||
*CreationDateOldOpenPage = \&OpenPage;
|
*CreationDateOldOpenPage = \&OpenPage;
|
||||||
*OpenPage = \&CreationDateOpenPage;
|
*OpenPage = \&CreationDateOpenPage;
|
||||||
@@ -39,3 +40,45 @@ sub CreationDateOpenPage{
|
|||||||
$Page{originalAuthor} = GetParam('username','') unless $Page{originalAuthor}
|
$Page{originalAuthor} = GetParam('username','') unless $Page{originalAuthor}
|
||||||
or $Page{revision};
|
or $Page{revision};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Allow administrators to add the 'created' item to page files, based on rc log
|
||||||
|
# files.
|
||||||
|
|
||||||
|
push(@MyAdminCode, \&CreationDateMenu);
|
||||||
|
|
||||||
|
sub CreationDateMenu {
|
||||||
|
my ($id, $menuref, $restref) = @_;
|
||||||
|
push(@$menuref,
|
||||||
|
ScriptLink('action=add-creation-date',
|
||||||
|
T('Add creation date to page files'),
|
||||||
|
'creationdate')) if UserIsAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
$Action{'add-creation-date'} = \&AddCreationDate;
|
||||||
|
|
||||||
|
sub AddCreationDate {
|
||||||
|
print GetHeader('', T('Add creation date to page files'));
|
||||||
|
print $q->start_div({-class=>'creationdate'});
|
||||||
|
print '<ul>';
|
||||||
|
RequestLockOrError();
|
||||||
|
for my $file ($RcOldFile, $RcFile) {
|
||||||
|
open(my $F, '<:encoding(UTF-8)', encode_utf8($file)) or next;
|
||||||
|
while (my $line = <$F>) {
|
||||||
|
chomp($line);
|
||||||
|
my ($ts, $id, $minor, $summary, $host, $username, $revision)
|
||||||
|
= split(/$FS/, $line);
|
||||||
|
next unless $revision == 1;
|
||||||
|
print $q->li(NormalToFree($id));
|
||||||
|
OpenPage($id);
|
||||||
|
next unless $Page{revision}; # skip if page no longer exists
|
||||||
|
next if $Page{created} and $Page{originalAuthor};
|
||||||
|
$Page{created} = $ts unless $Page{created};
|
||||||
|
$Page{originalAuthor} = $username unless $Page{originalAuthor};
|
||||||
|
SavePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReleaseLock();
|
||||||
|
print '</ul>';
|
||||||
|
print $q->end_div();
|
||||||
|
PrintFooter();
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -77,8 +77,7 @@ sub DoUnifiedDiff { # copied from DoDiff
|
|||||||
RequestLockDir('diff') or return '';
|
RequestLockDir('diff') or return '';
|
||||||
WriteStringToFile($oldName, $_[0]);
|
WriteStringToFile($oldName, $_[0]);
|
||||||
WriteStringToFile($newName, $_[1]);
|
WriteStringToFile($newName, $_[1]);
|
||||||
my $diff_out = `diff -U 99999 -- \Q$oldName\E \Q$newName\E | tail -n +7`; # should be +4, but we always add extra line # TODO that workaround is ugly, fix it!
|
my $diff_out = decode_utf8(`diff -U 99999 -- \Q$oldName\E \Q$newName\E | tail -n +7`); # should be +4, but we always add extra line # TODO that workaround is ugly, fix it!
|
||||||
utf8::decode($diff_out); # needs decoding
|
|
||||||
$diff_out =~ s/\n\K\\ No newline.*\n//g; # Get rid of common complaint.
|
$diff_out =~ s/\n\K\\ No newline.*\n//g; # Get rid of common complaint.
|
||||||
ReleaseLockDir('diff');
|
ReleaseLockDir('diff');
|
||||||
# No need to unlink temp files--next diff will just overwrite.
|
# No need to unlink temp files--next diff will just overwrite.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# This module offers the user the additional possibility to
|
# This module offers the user the additional possibility to
|
||||||
# edit a page by double-clicking on it. The user must have
|
# edit a page by double-clicking on it. The user must have
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -76,10 +76,7 @@ push(@MyMaintenance, \&DraftCleanup);
|
|||||||
|
|
||||||
sub DraftFiles {
|
sub DraftFiles {
|
||||||
return map {
|
return map {
|
||||||
my $x = $_;
|
substr($_, length($DraftDir) + 1);
|
||||||
$x = substr($x, length($DraftDir) + 1);
|
|
||||||
utf8::decode($x);
|
|
||||||
$x;
|
|
||||||
} Glob("$DraftDir/*"), Glob("$DraftDir/.*");
|
} Glob("$DraftDir/*"), Glob("$DraftDir/.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# Makes the wiki logo depend on the current date.
|
# Makes the wiki logo depend on the current date.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -9,10 +9,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# This module creates a list of all questions on the page, e.g.
|
# This module creates a list of all questions on the page, e.g.
|
||||||
# for a faq. It does so by recognizing all lines that begin with
|
# for a faq. It does so by recognizing all lines that begin with
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA,
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ sub FixEncoding {
|
|||||||
ValidIdOrDie($id);
|
ValidIdOrDie($id);
|
||||||
RequestLockOrError();
|
RequestLockOrError();
|
||||||
OpenPage($id);
|
OpenPage($id);
|
||||||
my $text = $Page{text};
|
my $text = decode_utf8($Page{text});
|
||||||
utf8::decode($text);
|
|
||||||
Save($id, $text, T('Fix character encoding'), 1) if $text ne $Page{text};
|
Save($id, $text, T('Fix character encoding'), 1) if $text ne $Page{text};
|
||||||
ReleaseLock();
|
ReleaseLock();
|
||||||
ReBrowsePage($id);
|
ReBrowsePage($id);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -163,9 +163,7 @@ sub GdSecurityImageGenerate {
|
|||||||
my ($imgData) = $img->out(force => 'png');
|
my ($imgData) = $img->out(force => 'png');
|
||||||
my $ticketId = Digest::MD5::md5_hex(rand());
|
my $ticketId = Digest::MD5::md5_hex(rand());
|
||||||
CreateDir($GdSecurityImageDir);
|
CreateDir($GdSecurityImageDir);
|
||||||
my $file = GdSecurityImageGetImageFile($ticketId);
|
open my $fh, ">:raw", encode_utf8(GdSecurityImageGetImageFile($ticketId))
|
||||||
utf8::encode($file);
|
|
||||||
open my $fh, ">:raw", $file
|
|
||||||
or ReportError(Ts('Image storing failed. (%s)', $!), '500 INTERNAL SERVER ERROR');
|
or ReportError(Ts('Image storing failed. (%s)', $!), '500 INTERNAL SERVER ERROR');
|
||||||
print $fh $imgData;
|
print $fh $imgData;
|
||||||
#print $fh $png; ### experimental ###
|
#print $fh $png; ### experimental ###
|
||||||
@@ -188,9 +186,7 @@ sub GdSecurityImageIsValidId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub GdSecurityImageReadImageFile {
|
sub GdSecurityImageReadImageFile {
|
||||||
my $file = shift;
|
if (open(my $IN, '<:raw', encode_utf8(shift))) {
|
||||||
utf8::encode($file); # filenames are bytes!
|
|
||||||
if (open(my $IN, '<:raw', $file)) {
|
|
||||||
local $/ = undef; # Read complete files
|
local $/ = undef; # Read complete files
|
||||||
my $data=<$IN>;
|
my $data=<$IN>;
|
||||||
close $IN;
|
close $IN;
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ sub GitCommit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub GitInitRepository {
|
sub GitInitRepository {
|
||||||
return if -d "$DataDir/page/.git";
|
return if IsDir("$DataDir/page/.git");
|
||||||
capture {
|
capture {
|
||||||
system($GitBinary, qw(init -q --), "$DataDir/page");
|
system($GitBinary, qw(init -q --), encode_utf8("$DataDir/page"));
|
||||||
};
|
};
|
||||||
GitCommit('Initial import', 'Oddmuse');
|
GitCommit('Initial import', 'Oddmuse');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,15 +191,12 @@ sub GitCleanup {
|
|||||||
print $q->p('Git cleanup starting');
|
print $q->p('Git cleanup starting');
|
||||||
AllPagesList();
|
AllPagesList();
|
||||||
# delete all the files including all the files starting with a dot
|
# delete all the files including all the files starting with a dot
|
||||||
my $dir = $GitRepo;
|
opendir(DIR, encode_utf8($GitRepo)) or ReportError("cannot open directory $GitRepo: $!");
|
||||||
utf8::encode($dir);
|
|
||||||
opendir(DIR, $dir) or ReportError("cannot open directory $GitRepo: $!");
|
|
||||||
foreach my $file (readdir(DIR)) {
|
foreach my $file (readdir(DIR)) {
|
||||||
my $name = $file;
|
my $name = decode_utf8($file);
|
||||||
utf8::decode($name); # filenames are bytes
|
|
||||||
next if $file eq '.git' or $file eq '.' or $file eq '..' or $IndexHash{$name};
|
next if $file eq '.git' or $file eq '.' or $file eq '..' or $IndexHash{$name};
|
||||||
print $q->p("Deleting left over file $name");
|
print $q->p("Deleting left over file $name");
|
||||||
Unlink("$GitRepo/$file") or ReportError("cannot delete $GitRepo/$name: $!");
|
Unlink("$GitRepo/$file") or print $q->p("Cannot delete $GitRepo/$name: $!");
|
||||||
}
|
}
|
||||||
closedir DIR;
|
closedir DIR;
|
||||||
# write all the files again, just to be sure
|
# write all the files again, just to be sure
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Copyright (C) 2006-2014 Alex Schroeder <alex@gnu.org>
|
# Copyright (C) 2006-2014 Alex Schroeder <alex@gnu.org>
|
||||||
|
# Copyright (C) 2016 Ingo Belka
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it under
|
# This program is free software: you can redistribute it and/or modify it under
|
||||||
# the terms of the GNU General Public License as published by the Free Software
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
@@ -25,6 +26,9 @@ our ($GotobarName);
|
|||||||
|
|
||||||
$GotobarName = 'GotoBar';
|
$GotobarName = 'GotoBar';
|
||||||
|
|
||||||
|
our ($GotobarSetHome, $GotobarSetRC);
|
||||||
|
# 0 does set home-link and/or rc-link automatically, 1 doesn't
|
||||||
|
|
||||||
# do this later so that the user can customize $GotobarName
|
# do this later so that the user can customize $GotobarName
|
||||||
push(@MyInitVariables, \&GotobarInit);
|
push(@MyInitVariables, \&GotobarInit);
|
||||||
|
|
||||||
@@ -53,10 +57,10 @@ sub GotobarInit {
|
|||||||
# is the list of recent changes.
|
# is the list of recent changes.
|
||||||
$count++;
|
$count++;
|
||||||
if ($count == 1) {
|
if ($count == 1) {
|
||||||
$HomePage = FreeToNormal($page);
|
unless ($GotobarSetHome) {$HomePage = FreeToNormal($page)};
|
||||||
} elsif ($count == 2) {
|
} elsif ($count == 2) {
|
||||||
$RCName = FreeToNormal($page);
|
unless ($GotobarSetRC) {$RCName = FreeToNormal($page);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -43,7 +40,7 @@ sub HtmlTemplate {
|
|||||||
my $type = shift;
|
my $type = shift;
|
||||||
# return header.de.html, or header.html, or error.html, or report an error...
|
# return header.de.html, or header.html, or error.html, or report an error...
|
||||||
foreach my $f ((map { "$type.$_" } HtmlTemplateLanguage()), $type, "error") {
|
foreach my $f ((map { "$type.$_" } HtmlTemplateLanguage()), $type, "error") {
|
||||||
return "$HtmlTemplateDir/$f.html" if -r "$HtmlTemplateDir/$f.html";
|
return "$HtmlTemplateDir/$f.html" if IsFile("$HtmlTemplateDir/$f.html");
|
||||||
}
|
}
|
||||||
ReportError(Tss('Could not find %1.html template in %2', $type, $HtmlTemplateDir),
|
ReportError(Tss('Could not find %1.html template in %2', $type, $HtmlTemplateDir),
|
||||||
'500 INTERNAL SERVER ERROR');
|
'500 INTERNAL SERVER ERROR');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -14,10 +14,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# This module offers the possibility to restrict viewing of "hidden"
|
# This module offers the possibility to restrict viewing of "hidden"
|
||||||
# pages to only editors or admins. The restriction may be based
|
# pages to only editors or admins. The restriction may be based
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -87,7 +84,7 @@ sub GetActionHtmlTemplate {
|
|||||||
my $action = GetParam('action', 'browse');
|
my $action = GetParam('action', 'browse');
|
||||||
# return browse.de.html, or browse.html, or error.html, or report an error...
|
# return browse.de.html, or browse.html, or error.html, or report an error...
|
||||||
foreach my $f ((map { "$action.$_" } HtmlTemplateLanguage()), $action, "error") {
|
foreach my $f ((map { "$action.$_" } HtmlTemplateLanguage()), $action, "error") {
|
||||||
return "$HtmlTemplateDir/$f.html" if -r "$HtmlTemplateDir/$f.html";
|
return "$HtmlTemplateDir/$f.html" if IsFile("$HtmlTemplateDir/$f.html");
|
||||||
}
|
}
|
||||||
ReportError(Tss('Could not find %1.html template in %2', $action, $HtmlTemplateDir),
|
ReportError(Tss('Could not find %1.html template in %2', $action, $HtmlTemplateDir),
|
||||||
'500 INTERNAL SERVER ERROR');
|
'500 INTERNAL SERVER ERROR');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# In your CSS file, use something like this, for example:
|
# In your CSS file, use something like this, for example:
|
||||||
|
|
||||||
|
|||||||
@@ -161,9 +161,7 @@ sub MakeLaTeX {
|
|||||||
# read template and replace <math>
|
# read template and replace <math>
|
||||||
CreateDir($LatexDir);
|
CreateDir($LatexDir);
|
||||||
if (not IsFile($LatexDefaultTemplateName)) {
|
if (not IsFile($LatexDefaultTemplateName)) {
|
||||||
my $file = $LatexDefaultTemplateName;
|
open (my $F, '>', encode_utf8($LatexDefaultTemplateName)) or return '[Unable to write template]';
|
||||||
utf8::encode($file);
|
|
||||||
open (my $F, '>', $file) or return '[Unable to write template]';
|
|
||||||
print $F $LatexDefaultTemplate;
|
print $F $LatexDefaultTemplate;
|
||||||
close $F;
|
close $F;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,13 +11,8 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
# Based on code of tagmap.pl module by Fletcher T. Penney
|
|
||||||
# and searchtags.pl module by Brock Wilcox
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
|
# Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ sub LoadLanguage {
|
|||||||
my $file = $TranslationsLibrary{$Lang{$_}};
|
my $file = $TranslationsLibrary{$Lang{$_}};
|
||||||
next unless $file; # file is not listed, eg. there is no file for "de-ch"
|
next unless $file; # file is not listed, eg. there is no file for "de-ch"
|
||||||
$file = "$LoadLanguageDir/$file" if defined $LoadLanguageDir;
|
$file = "$LoadLanguageDir/$file" if defined $LoadLanguageDir;
|
||||||
if (-r $file) {
|
if (IsFile($file)) {
|
||||||
do $file;
|
do $file;
|
||||||
do "$ConfigFile-$Lang{$_}" if -r "$ConfigFile-$Lang{$_}";
|
do "$ConfigFile-$Lang{$_}" if IsFile("$ConfigFile-$Lang{$_}");
|
||||||
$CurrentLanguage = $Lang{$_};
|
$CurrentLanguage = $Lang{$_};
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,9 @@ You can change this expiry time by setting C<$LnCacheHours>.
|
|||||||
push (@MyMaintenance, \&LnMaintenance);
|
push (@MyMaintenance, \&LnMaintenance);
|
||||||
|
|
||||||
sub LnMaintenance {
|
sub LnMaintenance {
|
||||||
my $dir = $RssDir;
|
if (opendir(DIR, encode_utf8($RssDir))) { # cleanup if they should expire anyway
|
||||||
utf8::encode($dir);
|
|
||||||
if (opendir(DIR, $dir)) { # cleanup if they should expire anyway
|
|
||||||
foreach my $file (readdir(DIR)) {
|
foreach my $file (readdir(DIR)) {
|
||||||
unlink("$RssDir/$file") if -M $file > $LnCacheHours * 3600;
|
Unlink("$RssDir/$file") if $Now - Modified($file) > $LnCacheHours * 3600;
|
||||||
}
|
}
|
||||||
closedir DIR;
|
closedir DIR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -328,9 +325,7 @@ sub DoProcessLogout {
|
|||||||
|
|
||||||
sub UserExists {
|
sub UserExists {
|
||||||
my $username = shift;
|
my $username = shift;
|
||||||
my $file = $PasswordFile;
|
if (open (my $PASSWD, '<', encode_utf8($PasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open (my $PASSWD, '<', $file)) {
|
|
||||||
while ( <$PASSWD> ) {
|
while ( <$PASSWD> ) {
|
||||||
if ($_ =~ /^$username:/) {
|
if ($_ =~ /^$username:/) {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -340,9 +335,7 @@ sub UserExists {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($RegistrationsMustBeApproved) {
|
if ($RegistrationsMustBeApproved) {
|
||||||
$file = $PendingPasswordFile;
|
if (open (my $PASSWD, '<', encode_utf8($PendingPasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open (my $PASSWD, '<', $file)) {
|
|
||||||
while ( <$PASSWD> ) {
|
while ( <$PASSWD> ) {
|
||||||
if ($_ =~ /^$username:/) {
|
if ($_ =~ /^$username:/) {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -353,9 +346,7 @@ sub UserExists {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($ConfirmEmailAddress) {
|
if ($ConfirmEmailAddress) {
|
||||||
$file = $UnconfirmedPasswordFile;
|
if (open (my $PASSWD, '<', encode_utf8($UnconfirmedPasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open (my $PASSWD, '<', $UnconfirmedPasswordFile)) {
|
|
||||||
while ( <$PASSWD> ) {
|
while ( <$PASSWD> ) {
|
||||||
if ($_ =~ /^$username:/) {
|
if ($_ =~ /^$username:/) {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -496,9 +487,7 @@ sub ConfirmUser {
|
|||||||
my ($username, $key) = @_;
|
my ($username, $key) = @_;
|
||||||
my $FileToUse = $RegistrationsMustBeApproved
|
my $FileToUse = $RegistrationsMustBeApproved
|
||||||
? $PendingPasswordFile : $PasswordFileToUse;
|
? $PendingPasswordFile : $PasswordFileToUse;
|
||||||
my $file = $UnconfirmedPasswordFile;
|
if (open(my $PASSWD, '<', encode_utf8($UnconfirmedPasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open(my $PASSWD, '<', $file)) {
|
|
||||||
while (<$PASSWD>) {
|
while (<$PASSWD>) {
|
||||||
if ($_ =~ /^$username:(.*):(.*)/) {
|
if ($_ =~ /^$username:(.*):(.*)/) {
|
||||||
if (crypt($1,$key) eq $key) {
|
if (crypt($1,$key) eq $key) {
|
||||||
@@ -522,8 +511,7 @@ sub RemoveUser {
|
|||||||
|
|
||||||
my %passwords = ();
|
my %passwords = ();
|
||||||
my %emails = ();
|
my %emails = ();
|
||||||
utf8::encode($FileToUse);
|
if (open (my $PASSWD, '<', encode_utf8($FileToUse))) {
|
||||||
if (open (my $PASSWD, '<', $FileToUse)) {
|
|
||||||
while ( <$PASSWD> ) {
|
while ( <$PASSWD> ) {
|
||||||
if ($_ =~ /^(.*):(.*):(.*)$/) {
|
if ($_ =~ /^(.*):(.*):(.*)$/) {
|
||||||
next if ($1 eq $username);
|
next if ($1 eq $username);
|
||||||
@@ -606,9 +594,7 @@ sub ChangePassword {
|
|||||||
|
|
||||||
my %passwords = ();
|
my %passwords = ();
|
||||||
my %emails = ();
|
my %emails = ();
|
||||||
my $file = $PasswordFile;
|
if (open (my $PASSWD, '<', encode_utf8($PasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open (my $PASSWD, '<', $file)) {
|
|
||||||
while ( <$PASSWD> ) {
|
while ( <$PASSWD> ) {
|
||||||
if ($_ =~ /^(.*):(.*):(.*)$/) {
|
if ($_ =~ /^(.*):(.*):(.*)$/) {
|
||||||
$passwords{$1}=$2;
|
$passwords{$1}=$2;
|
||||||
@@ -620,7 +606,7 @@ sub ChangePassword {
|
|||||||
|
|
||||||
$passwords{$user} = $hash;
|
$passwords{$user} = $hash;
|
||||||
|
|
||||||
open (my $PASSWD, '>', $file);
|
open (my $PASSWD, '>', encode_utf8($PasswordFile));
|
||||||
foreach my $key ( sort keys(%passwords)) {
|
foreach my $key ( sort keys(%passwords)) {
|
||||||
print $PASSWD "$key:$passwords{$key}:$emails{$key}\n";
|
print $PASSWD "$key:$passwords{$key}:$emails{$key}\n";
|
||||||
}
|
}
|
||||||
@@ -727,9 +713,7 @@ sub DoApprovePending {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<ul>';
|
print '<ul>';
|
||||||
my $file = $PendingPasswordFile;
|
if (open(my $PASSWD, '<', encode_utf8($PendingPasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open(my $PASSWD, '<', $file)) {
|
|
||||||
while (<$PASSWD>) {
|
while (<$PASSWD>) {
|
||||||
if ($_ =~ /^(.*):(.*):(.*)$/) {
|
if ($_ =~ /^(.*):(.*):(.*)$/) {
|
||||||
print '<li>' . ScriptLink("action=approve_pending;user=$1;",$1) . ' - ' . $3 . '</li>';
|
print '<li>' . ScriptLink("action=approve_pending;user=$1;",$1) . ' - ' . $3 . '</li>';
|
||||||
@@ -750,9 +734,7 @@ sub DoApprovePending {
|
|||||||
|
|
||||||
sub ApproveUser {
|
sub ApproveUser {
|
||||||
my ($username) = @_;
|
my ($username) = @_;
|
||||||
my $file = $PendingPasswordFile;
|
if (open(my $PASSWD, '<', encode_utf8($PendingPasswordFile))) {
|
||||||
utf8::encode($file);
|
|
||||||
if (open(my $PASSWD, '<', $file)) {
|
|
||||||
while (<$PASSWD>) {
|
while (<$PASSWD>) {
|
||||||
if ($_ =~ /^$username:(.*):(.*)/) {
|
if ($_ =~ /^$username:(.*):(.*)/) {
|
||||||
AddUser($username,$1,$2,$PasswordFile);
|
AddUser($username,$1,$2,$PasswordFile);
|
||||||
|
|||||||
@@ -266,18 +266,17 @@ except where noted.
|
|||||||
|
|
||||||
Copyleft 2008 by B.w.Curry <http://www.raiazome.com>.
|
Copyleft 2008 by B.w.Curry <http://www.raiazome.com>.
|
||||||
|
|
||||||
This file is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or modify
|
||||||
modify it under the terms of the GNU General Public License
|
it under the terms of the GNU General Public License as published by
|
||||||
as published by the Free Software Foundation; either version 2
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
of the License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This file is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this file; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
@@ -56,14 +56,12 @@ sub MacFixEncoding {
|
|||||||
return unless %Namespaces;
|
return unless %Namespaces;
|
||||||
my %hash = ();
|
my %hash = ();
|
||||||
for my $key (keys %Namespaces) {
|
for my $key (keys %Namespaces) {
|
||||||
utf8::decode($key);
|
|
||||||
$key = NFC($key);
|
$key = NFC($key);
|
||||||
$hash{$key} = $NamespaceRoot . '/' . $key . '/';
|
$hash{$key} = $NamespaceRoot . '/' . $key . '/';
|
||||||
}
|
}
|
||||||
%Namespaces = %hash;
|
%Namespaces = %hash;
|
||||||
%hash = ();
|
%hash = ();
|
||||||
for my $key (keys %InterSite) {
|
for my $key (keys %InterSite) {
|
||||||
utf8::decode($key);
|
|
||||||
$key = NFC($key);
|
$key = NFC($key);
|
||||||
$hash{$key} = $Namespaces{$key} if $Namespaces{$key};
|
$hash{$key} = $Namespaces{$key} if $Namespaces{$key};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,8 +120,7 @@ sub MailIsSubscribed {
|
|||||||
return 0 unless $mail;
|
return 0 unless $mail;
|
||||||
# open the DB file
|
# open the DB file
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
my %subscribers = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($id)}));
|
my %subscribers = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($id)}));
|
||||||
untie %h;
|
untie %h;
|
||||||
return $subscribers{$mail};
|
return $subscribers{$mail};
|
||||||
@@ -198,8 +197,7 @@ sub NewMailDeletePage {
|
|||||||
sub MailDeletePage {
|
sub MailDeletePage {
|
||||||
my $id = shift;
|
my $id = shift;
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
foreach my $mail (split(/$FS/, UrlDecode(delete $h{UrlEncode($id)}))) {
|
foreach my $mail (split(/$FS/, UrlDecode(delete $h{UrlEncode($id)}))) {
|
||||||
my %subscriptions = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
my %subscriptions = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
||||||
delete $subscriptions{$id};
|
delete $subscriptions{$id};
|
||||||
@@ -276,8 +274,7 @@ sub MailSubscription {
|
|||||||
my $mail = shift;
|
my $mail = shift;
|
||||||
return unless $mail;
|
return unless $mail;
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
my @result = split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
my @result = split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
||||||
untie %h;
|
untie %h;
|
||||||
@result = sort @result;
|
@result = sort @result;
|
||||||
@@ -306,8 +303,7 @@ sub DoMailSubscriptionList {
|
|||||||
'<ul>';
|
'<ul>';
|
||||||
}
|
}
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
foreach my $encodedkey (sort keys %h) {
|
foreach my $encodedkey (sort keys %h) {
|
||||||
my @values = sort split(/$FS/, UrlDecode($h{$encodedkey}));
|
my @values = sort split(/$FS/, UrlDecode($h{$encodedkey}));
|
||||||
my $key = UrlDecode($encodedkey);
|
my $key = UrlDecode($encodedkey);
|
||||||
@@ -386,8 +382,7 @@ sub MailSubscribe {
|
|||||||
return unless $mail and @pages;
|
return unless $mail and @pages;
|
||||||
# open the DB file
|
# open the DB file
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
# add to the mail entry
|
# add to the mail entry
|
||||||
my %subscriptions = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
my %subscriptions = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
||||||
for my $id (@pages) {
|
for my $id (@pages) {
|
||||||
@@ -446,8 +441,7 @@ sub MailUnsubscribe {
|
|||||||
my ($mail, @pages) = @_;
|
my ($mail, @pages) = @_;
|
||||||
return unless $mail and @pages;
|
return unless $mail and @pages;
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
my %subscriptions = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
my %subscriptions = map {$_=>1} split(/$FS/, UrlDecode($h{UrlEncode($mail)}));
|
||||||
foreach my $id (@pages) {
|
foreach my $id (@pages) {
|
||||||
delete $subscriptions{$id};
|
delete $subscriptions{$id};
|
||||||
@@ -486,8 +480,7 @@ sub DoMailMigration {
|
|||||||
$q->start_div({-class=>'content mailmigrate'});
|
$q->start_div({-class=>'content mailmigrate'});
|
||||||
|
|
||||||
require DB_File;
|
require DB_File;
|
||||||
utf8::encode($MailFile);
|
tie my %h, "DB_File", encode_utf8($MailFile);
|
||||||
tie my %h, "DB_File", $MailFile;
|
|
||||||
my $found = 0;
|
my $found = 0;
|
||||||
foreach my $key (keys %h) {
|
foreach my $key (keys %h) {
|
||||||
if (index($key, '@') != -1) {
|
if (index($key, '@') != -1) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#! /usr/bin/perl
|
#! /usr/bin/perl
|
||||||
# Copyright (C) 2014 Alex Schroeder <alex@gnu.org>
|
# Copyright (C) 2014–2017 Alex Schroeder <alex@gnu.org>
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify it under
|
# This program is free software: you can redistribute it and/or modify it under
|
||||||
# the terms of the GNU General Public License as published by the Free Software
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
@@ -18,7 +18,7 @@ use v5.10;
|
|||||||
|
|
||||||
AddModuleDescription('markdown-rule.pl', 'Markdown Rule Extension');
|
AddModuleDescription('markdown-rule.pl', 'Markdown Rule Extension');
|
||||||
|
|
||||||
our ($q, $bol, %RuleOrder, @MyRules, $UrlProtocols, $FullUrlPattern);
|
our ($q, $bol, %RuleOrder, @MyRules, $UrlProtocols, $FullUrlPattern, @HtmlStack);
|
||||||
|
|
||||||
push(@MyRules, \&MarkdownRule);
|
push(@MyRules, \&MarkdownRule);
|
||||||
# Since we want this package to be a simple add-on, we try and avoid
|
# Since we want this package to be a simple add-on, we try and avoid
|
||||||
@@ -31,16 +31,20 @@ $RuleOrder{\&MarkdownRule} = 200;
|
|||||||
# https://help.github.com/articles/github-flavored-markdown
|
# https://help.github.com/articles/github-flavored-markdown
|
||||||
|
|
||||||
sub MarkdownRule {
|
sub MarkdownRule {
|
||||||
|
# \escape
|
||||||
|
if (m/\G\\([-#>*`=])/cg) {
|
||||||
|
return $1;
|
||||||
|
}
|
||||||
# atx headers
|
# atx headers
|
||||||
if ($bol and m~\G(\s*\n)*(#{1,6})[ \t]*~cg) {
|
elsif ($bol and m~\G(\s*\n)*(#{1,6})[ \t]*~cg) {
|
||||||
my $header_depth = length($2);
|
my $header_depth = length($2);
|
||||||
return CloseHtmlEnvironments()
|
return CloseHtmlEnvironments()
|
||||||
. AddHtmlEnvironment("h" . $header_depth);
|
. AddHtmlEnvironment("h" . $header_depth);
|
||||||
}
|
}
|
||||||
# end atx header at a newline
|
# end atx header at a newline
|
||||||
elsif ((InElement('h1') or InElement('h2') or InElement('h3') or
|
elsif ((InElement('h1') or InElement('h2') or InElement('h3') or
|
||||||
InElement('h4') or InElement('h5') or InElement('h6'))
|
InElement('h4') or InElement('h5') or InElement('h6'))
|
||||||
and m/\G\n/cg) {
|
and m/\G\n/cg) {
|
||||||
return CloseHtmlEnvironments()
|
return CloseHtmlEnvironments()
|
||||||
. AddHtmlEnvironment("p");
|
. AddHtmlEnvironment("p");
|
||||||
}
|
}
|
||||||
@@ -56,33 +60,71 @@ sub MarkdownRule {
|
|||||||
return CloseHtmlEnvironments()
|
return CloseHtmlEnvironments()
|
||||||
. AddHtmlEnvironment('blockquote');
|
. AddHtmlEnvironment('blockquote');
|
||||||
}
|
}
|
||||||
|
# ``` = code
|
||||||
|
elsif ($bol and m/\G```[ \t]*\n(.*?)\n```[ \t]*(\n|$)/cgs) {
|
||||||
|
return CloseHtmlEnvironments() . $q->pre($1)
|
||||||
|
. AddHtmlEnvironment("p");
|
||||||
|
}
|
||||||
|
# ` = code
|
||||||
|
elsif (m/\G`([^`].*?)`/cg) {
|
||||||
|
return $q->code($1);
|
||||||
|
}
|
||||||
# ***bold and italic***
|
# ***bold and italic***
|
||||||
elsif (not InElement('strong') and not InElement('em') and m/\G\*\*\*/cg) {
|
elsif (not InElement('strong') and not InElement('em') and m/\G\*\*\*/cg) {
|
||||||
return AddHtmlEnvironment('em') . AddHtmlEnvironment('strong');
|
return AddHtmlEnvironment('em') . AddHtmlEnvironment('strong');
|
||||||
}
|
}
|
||||||
|
elsif (InElement('strong') and InElement('em') and m/\G\*\*\*/cg) {
|
||||||
|
return CloseHtmlEnvironment('strong') . CloseHtmlEnvironment('em');
|
||||||
|
}
|
||||||
# **bold**
|
# **bold**
|
||||||
elsif (m/\G\*\*/cg) {
|
elsif (m/\G\*\*/cg) {
|
||||||
return AddOrCloseHtmlEnvironment('strong');
|
return AddOrCloseHtmlEnvironment('strong');
|
||||||
}
|
}
|
||||||
# *italic*
|
# *italic*
|
||||||
elsif (m/\G\*/cg) {
|
elsif ($bol and m/\G\*/cg or m/\G(?<=\P{Word})\*/cg) {
|
||||||
return AddOrCloseHtmlEnvironment('em');
|
return AddHtmlEnvironment('em');
|
||||||
|
}
|
||||||
|
elsif (InElement('em') and m/\G\*/cg) {
|
||||||
|
return CloseHtmlEnvironment('em');
|
||||||
}
|
}
|
||||||
# ~~strikethrough~~ (deleted)
|
# ~~strikethrough~~ (deleted)
|
||||||
elsif (m/\G~~/cg) {
|
elsif (m/\G~~/cg) {
|
||||||
return AddOrCloseHtmlEnvironment('del');
|
return AddOrCloseHtmlEnvironment('del');
|
||||||
}
|
}
|
||||||
# - bullet list
|
# indented lists = nested lists
|
||||||
elsif ($bol and m/\G(\s*\n)*-[ \t]*/cg
|
elsif ($bol and m/\G(\s*\n)*()([*-]|\d+\.)[ \t]*/cg
|
||||||
or InElement('li') and m/\G(\s*\n)+-[ \t]*/cg) {
|
or InElement('li') && m/\G(\s*\n)+( *)([*-]|\d+\.)[ \t]*/cg) {
|
||||||
return CloseHtmlEnvironment('li')
|
my $nesting_goal = int(length($2)/4) + 1;
|
||||||
. OpenHtmlEnvironment('ul',1) . AddHtmlEnvironment('li');
|
my $tag = ($3 eq '*' or $3 eq '-') ? 'ul' : 'ol';
|
||||||
}
|
my $nesting_current = 0;
|
||||||
# 1. numbered list
|
my @nesting = grep(/^[uo]l$/, @HtmlStack);
|
||||||
elsif ($bol and m/\G(\s*\n)*\d+\.[ \t]*/cg
|
my $html = CloseHtmlEnvironmentUntil('li'); # but don't close li element
|
||||||
or InElement('li') and m/\G(\s*\n)+\d+\.[ \t]*/cg) {
|
# warn "\@nesting is (@nesting)\n";
|
||||||
return CloseHtmlEnvironment('li')
|
# warn " goal is $nesting_goal\n";
|
||||||
. OpenHtmlEnvironment('ol',1) . AddHtmlEnvironment('li');
|
# warn " tag is $3 > $tag\n";
|
||||||
|
while (@nesting > $nesting_goal) {
|
||||||
|
$html .= CloseHtmlEnvironment(pop(@nesting));
|
||||||
|
# warn " pop\n";
|
||||||
|
}
|
||||||
|
# if have the correct nesting level, but the wrong type, close it
|
||||||
|
if (@nesting == $nesting_goal
|
||||||
|
and $nesting[$#nesting] ne $tag) {
|
||||||
|
$html .= CloseHtmlEnvironment(pop(@nesting));
|
||||||
|
# warn " switch\n";
|
||||||
|
}
|
||||||
|
# now add a list of the appropriate type
|
||||||
|
if (@nesting < $nesting_goal) {
|
||||||
|
$html .= AddHtmlEnvironment($tag);
|
||||||
|
# warn " add $tag\n";
|
||||||
|
}
|
||||||
|
# and a new list item
|
||||||
|
if (InElement('li')) {
|
||||||
|
$html .= CloseHtmlEnvironmentUntil($nesting[$#nesting]);
|
||||||
|
# warn " close li\n";
|
||||||
|
}
|
||||||
|
$html .= AddHtmlEnvironment('li');
|
||||||
|
# warn " add li\n";
|
||||||
|
return $html;
|
||||||
}
|
}
|
||||||
# beginning of a table
|
# beginning of a table
|
||||||
elsif ($bol and !InElement('table') and m/\G\|/cg) {
|
elsif ($bol and !InElement('table') and m/\G\|/cg) {
|
||||||
@@ -124,11 +166,6 @@ sub MarkdownRule {
|
|||||||
}
|
}
|
||||||
return OpenHtmlEnvironment('pre',1) . $str; # always level 1
|
return OpenHtmlEnvironment('pre',1) . $str; # always level 1
|
||||||
}
|
}
|
||||||
# ``` = code
|
|
||||||
elsif ($bol and m/\G```[ \t]*\n(.*?)\n```[ \t]*(\n|$)/cgs) {
|
|
||||||
return CloseHtmlEnvironments() . $q->pre($1)
|
|
||||||
. AddHtmlEnvironment("p");
|
|
||||||
}
|
|
||||||
# [an example](http://example.com/ "Title")
|
# [an example](http://example.com/ "Title")
|
||||||
elsif (m/\G\[(.+?)\]\($FullUrlPattern(\s+"(.+?)")?\)/cg) {
|
elsif (m/\G\[(.+?)\]\($FullUrlPattern(\s+"(.+?)")?\)/cg) {
|
||||||
my ($text, $url, $title) = ($1, $2, $4);
|
my ($text, $url, $title) = ($1, $2, $4);
|
||||||
@@ -141,3 +178,31 @@ sub MarkdownRule {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
push(@MyRules, \&MarkdownExtraRule);
|
||||||
|
|
||||||
|
sub MarkdownExtraRule {
|
||||||
|
# __italic underline__
|
||||||
|
if (m/\G__/cg) {
|
||||||
|
return AddOrCloseHtmlEnvironment('em', 'style="font-style: normal; text-decoration: underline"');
|
||||||
|
}
|
||||||
|
# _underline_
|
||||||
|
elsif ($bol and m/\G_/cg or m/\G(?<=\P{Word})_/cg) {
|
||||||
|
return AddHtmlEnvironment('em', 'style="font-style: normal; text-decoration: underline"');
|
||||||
|
}
|
||||||
|
elsif (InElement('em', 'style="font-style: normal; text-decoration: underline"') and m/\G_/cg) {
|
||||||
|
return CloseHtmlEnvironment('em');
|
||||||
|
}
|
||||||
|
# //italic//
|
||||||
|
elsif (m/\G\/\//cg) {
|
||||||
|
return AddOrCloseHtmlEnvironment('em');
|
||||||
|
}
|
||||||
|
# /italic/
|
||||||
|
elsif ($bol and m/\G\//cg or m/\G(?<=\P{Word})\//cg) {
|
||||||
|
return AddHtmlEnvironment('em');
|
||||||
|
}
|
||||||
|
elsif (InElement('em') and m/\G\//cg) {
|
||||||
|
return CloseHtmlEnvironment('em');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,10 +81,7 @@ sub ProcessModule {
|
|||||||
. ' If this is your own module, please contribute it to Oddmuse!'), $q->br();
|
. ' If this is your own module, please contribute it to Oddmuse!'), $q->br();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $file = "$TempDir/$module";
|
open my $fh, ">:utf8", encode_utf8("$TempDir/$module") or die("Could not open file $TempDir/$module: $!");
|
||||||
utf8::encode($file);
|
|
||||||
open my $fh, ">", $file or die("Could not open file $TempDir/$module: $!");
|
|
||||||
utf8::encode($moduleData);
|
|
||||||
print $fh $moduleData;
|
print $fh $moduleData;
|
||||||
close $fh;
|
close $fh;
|
||||||
|
|
||||||
@@ -111,7 +108,5 @@ sub ProcessModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub DoModuleDiff {
|
sub DoModuleDiff {
|
||||||
my $diff = `diff -U 3 -- \Q$_[0]\E \Q$_[1]\E`;
|
decode_utf8(`diff -U 3 -- \Q$_[0]\E \Q$_[1]\E`);
|
||||||
utf8::decode($diff); # needs decoding
|
|
||||||
return $diff;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -80,13 +80,27 @@ $NamespaceSlashing = 0; # affects : decoding NamespaceRcLines
|
|||||||
# variables (eg. localnames.pl)
|
# variables (eg. localnames.pl)
|
||||||
unshift(@MyInitVariables, \&NamespacesInitVariables);
|
unshift(@MyInitVariables, \&NamespacesInitVariables);
|
||||||
|
|
||||||
|
sub GetNamespace {
|
||||||
|
my $ns = GetParam('ns', '');
|
||||||
|
if (not $ns and $UsePathInfo) {
|
||||||
|
my $path_info = decode_utf8($q->path_info());
|
||||||
|
# make sure ordinary page names are not matched!
|
||||||
|
if ($path_info =~ m|^/($InterSitePattern)(/.*)?|
|
||||||
|
and ($2 or $q->keywords or NamespaceRequiredByParameter())) {
|
||||||
|
$ns = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ReportError(Ts('%s is not a legal name for a namespace', $ns))
|
||||||
|
if $ns and $ns !~ m/^($InterSitePattern)$/;
|
||||||
|
return $ns;
|
||||||
|
}
|
||||||
|
|
||||||
sub NamespacesInitVariables {
|
sub NamespacesInitVariables {
|
||||||
%Namespaces = ();
|
%Namespaces = ();
|
||||||
# Do this before changing the $DataDir and $ScriptName
|
# Do this before changing the $DataDir and $ScriptName
|
||||||
if ($UsePathInfo) {
|
if ($UsePathInfo) {
|
||||||
$Namespaces{$NamespacesMain} = $ScriptName . '/';
|
$Namespaces{$NamespacesMain} = $ScriptName . '/';
|
||||||
foreach my $name (Glob("$DataDir/*")) {
|
foreach my $name (Glob("$DataDir/*")) {
|
||||||
utf8::decode($name);
|
|
||||||
if (IsDir($name)
|
if (IsDir($name)
|
||||||
and $name =~ m|/($InterSitePattern)$|
|
and $name =~ m|/($InterSitePattern)$|
|
||||||
and $name ne $NamespacesMain
|
and $name ne $NamespacesMain
|
||||||
@@ -97,21 +111,7 @@ sub NamespacesInitVariables {
|
|||||||
}
|
}
|
||||||
$NamespaceRoot = $ScriptName; # $ScriptName may be changed below
|
$NamespaceRoot = $ScriptName; # $ScriptName may be changed below
|
||||||
$NamespaceCurrent = '';
|
$NamespaceCurrent = '';
|
||||||
my $ns = GetParam('ns', '');
|
my $ns = GetNamespace();
|
||||||
if ($ns) {
|
|
||||||
# GetParam quotes HTML but we don't care
|
|
||||||
utf8::decode($ns); # don't forget non-ASCII
|
|
||||||
} elsif (not $ns and $UsePathInfo) {
|
|
||||||
my $path_info = $q->path_info();
|
|
||||||
utf8::decode($path_info);
|
|
||||||
# make sure ordinary page names are not matched!
|
|
||||||
if ($path_info =~ m|^/($InterSitePattern)(/.*)?|
|
|
||||||
and ($2 or $q->keywords or NamespaceRequiredByParameter())) {
|
|
||||||
$ns = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ReportError(Ts('%s is not a legal name for a namespace', $ns))
|
|
||||||
if $ns and $ns !~ m/^($InterSitePattern)$/;
|
|
||||||
if ($ns
|
if ($ns
|
||||||
and $ns ne $NamespacesMain
|
and $ns ne $NamespacesMain
|
||||||
and $ns ne $NamespacesSelf) {
|
and $ns ne $NamespacesSelf) {
|
||||||
@@ -223,9 +223,7 @@ sub NewNamespaceGetRcLines { # starttime, hash of seen pages to use as a second
|
|||||||
# starttime. If any rcfile exists with no timestamp before the
|
# starttime. If any rcfile exists with no timestamp before the
|
||||||
# starttime, we need to open its rcoldfile.
|
# starttime, we need to open its rcoldfile.
|
||||||
foreach my $rcfile (@rcfiles) {
|
foreach my $rcfile (@rcfiles) {
|
||||||
my $file = $rcfile;
|
open(my $F, '<:encoding(UTF-8)', encode_utf8($rcfile));
|
||||||
utf8::encode($file);
|
|
||||||
open(my $F, '<:encoding(UTF-8)', $file);
|
|
||||||
my $line = <$F>;
|
my $line = <$F>;
|
||||||
my ($ts) = split(/$FS/, $line); # the first timestamp in the regular rc file
|
my ($ts) = split(/$FS/, $line); # the first timestamp in the regular rc file
|
||||||
my @new;
|
my @new;
|
||||||
@@ -441,8 +439,6 @@ sub NamespacesNewGetId {
|
|||||||
# In this case GetId() will have set the parameter Test to 1.
|
# In this case GetId() will have set the parameter Test to 1.
|
||||||
# http://example.org/cgi-bin/wiki.pl/Test?rollback-1234=foo
|
# http://example.org/cgi-bin/wiki.pl/Test?rollback-1234=foo
|
||||||
# This doesn't set the Test parameter.
|
# This doesn't set the Test parameter.
|
||||||
if ($UsePathInfo and $id eq $NamespaceCurrent and not GetParam($id) and not GetParam('ns')) {
|
return if $id and $UsePathInfo and $id eq $NamespaceCurrent and not GetParam($id) and not GetParam('ns');
|
||||||
$id = undef;
|
|
||||||
}
|
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use CGI qw/:standard/;
|
use CGI qw/:standard/;
|
||||||
use CGI::Carp qw(fatalsToBrowser);
|
use CGI::Carp qw(fatalsToBrowser);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use CGI qw/:standard/;
|
use CGI qw/:standard/;
|
||||||
use CGI::Carp qw(fatalsToBrowser);
|
use CGI::Carp qw(fatalsToBrowser);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use CGI qw/:standard/;
|
use CGI qw/:standard/;
|
||||||
use CGI::Carp qw(fatalsToBrowser);
|
use CGI::Carp qw(fatalsToBrowser);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# This module adds an action and a link in the UserGotoBar to build
|
# This module adds an action and a link in the UserGotoBar to build
|
||||||
# a Local Site Map starting from the current page. The map is a sort
|
# a Local Site Map starting from the current page. The map is a sort
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -12,10 +12,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -4,20 +4,18 @@
|
|||||||
|
|
||||||
# Author: Jorgen Schaefer <forcer@forcix.cx>
|
# Author: Jorgen Schaefer <forcer@forcix.cx>
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# modify it under the terms of the GNU General Public License
|
# it under the terms of the GNU General Public License as published by
|
||||||
# as published by the Free Software Foundation; either version 2
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# of the License, or (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
# 02111-1307, USA.
|
|
||||||
|
|
||||||
# This module will show ALL orphaned pages, even whole orphaned
|
# This module will show ALL orphaned pages, even whole orphaned
|
||||||
# subgraphs on this wiki.
|
# subgraphs on this wiki.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
230
modules/paste-image.pl
Normal file
230
modules/paste-image.pl
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
#! /usr/bin/perl
|
||||||
|
# Copyright (C) 2017 Alex Schroeder <alex@gnu.org>
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify it under
|
||||||
|
# the terms of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along with
|
||||||
|
# this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
|
AddModuleDescription('paste-image.pl', 'Paste Files to Upload');
|
||||||
|
|
||||||
|
our (@MyInitVariables, $ScriptName, $HtmlHeaders, $MaxPost, $CommentsPattern,
|
||||||
|
$QuestionaskerSecretKey);
|
||||||
|
|
||||||
|
our ($PasteImageOnBrowse);
|
||||||
|
|
||||||
|
$PasteImageOnBrowse = 0;
|
||||||
|
|
||||||
|
push(@MyInitVariables, \&PasteImageScript);
|
||||||
|
|
||||||
|
# Resampling based on the following:
|
||||||
|
# https://stackoverflow.com/a/19223362/534893
|
||||||
|
# https://github.com/viliusle/Hermite-resize
|
||||||
|
|
||||||
|
sub PasteImageScript {
|
||||||
|
my $id = GetId();
|
||||||
|
return unless $id;
|
||||||
|
OpenPage($id);
|
||||||
|
my $username = GetParam('username', '');
|
||||||
|
my $templatePage = "Image_{n}_for_$id";
|
||||||
|
my $templateText = "Image {n}";
|
||||||
|
my $question = $QuestionaskerSecretKey || 'question';
|
||||||
|
if ((GetParam('action', 'browse') eq 'edit'
|
||||||
|
or GetParam('action', 'browse') eq 'new'
|
||||||
|
or $CommentsPattern and $id =~ /$CommentsPattern/
|
||||||
|
or $PasteImageOnBrowse and GetParam('action', 'browse') eq 'browse')
|
||||||
|
and $HtmlHeaders !~ /PasteImage/) {
|
||||||
|
$HtmlHeaders .= << "EOT";
|
||||||
|
<script type="text/javascript">
|
||||||
|
if (!HTMLTextAreaElement.prototype.insertAtCaret) {
|
||||||
|
HTMLTextAreaElement.prototype.insertAtPoint = function (text) {
|
||||||
|
text = text || '';
|
||||||
|
if (this.selectionStart || this.selectionStart === 0) {
|
||||||
|
// Others
|
||||||
|
var startPos = this.selectionStart;
|
||||||
|
var endPos = this.selectionEnd;
|
||||||
|
this.value = this.value.substring(0, startPos) +
|
||||||
|
text +
|
||||||
|
this.value.substring(endPos, this.value.length);
|
||||||
|
this.selectionStart = startPos + text.length;
|
||||||
|
this.selectionEnd = startPos + text.length;
|
||||||
|
} else {
|
||||||
|
this.value += text;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var PasteImage = {
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
let e = document.getElementById('text') || document.getElementById('aftertext');
|
||||||
|
if (e)
|
||||||
|
e.addEventListener('paste', PasteImage.handler);
|
||||||
|
},
|
||||||
|
|
||||||
|
handler: function(e) {
|
||||||
|
// Chrome
|
||||||
|
if (e.clipboardData) {
|
||||||
|
let items = e.clipboardData.items;
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
if (items[i].type.indexOf("image") !== -1) {
|
||||||
|
let blob = items[i].getAsFile();
|
||||||
|
let reader = new window.FileReader();
|
||||||
|
reader.onloadend = function() {
|
||||||
|
let dataUrl = reader.result;
|
||||||
|
let n = 1;
|
||||||
|
while (n++ < 4 && $MaxPost > 0 && dataUrl.length > $MaxPost)
|
||||||
|
dataUrl = PasteImage.shrink(dataUrl);
|
||||||
|
PasteImage.process(dataUrl, "$templatePage", "$templateText", 1);
|
||||||
|
}
|
||||||
|
reader.readAsDataURL(blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
shrink: function(dataUrl) {
|
||||||
|
let image = new Image;
|
||||||
|
image.src = dataUrl;
|
||||||
|
|
||||||
|
let canvas = document.createElement("canvas");
|
||||||
|
canvas.width = image.width;
|
||||||
|
canvas.height = image.height;
|
||||||
|
|
||||||
|
let ctx = canvas.getContext("2d");
|
||||||
|
ctx.drawImage(image, 0, 0);
|
||||||
|
|
||||||
|
let width_source = canvas.width;
|
||||||
|
let height_source = canvas.height;
|
||||||
|
let width = Math.round(width_source * 0.5);
|
||||||
|
let height = Math.round(height_source * 0.5);
|
||||||
|
|
||||||
|
let ratio_w = width_source / width;
|
||||||
|
let ratio_h = height_source / height;
|
||||||
|
let ratio_w_half = Math.ceil(ratio_w / 2);
|
||||||
|
let ratio_h_half = Math.ceil(ratio_h / 2);
|
||||||
|
|
||||||
|
let img = ctx.getImageData(0, 0, width_source, height_source);
|
||||||
|
let img2 = ctx.createImageData(width, height);
|
||||||
|
let data = img.data;
|
||||||
|
let data2 = img2.data;
|
||||||
|
|
||||||
|
for (let j = 0; j < height; j++) {
|
||||||
|
for (let i = 0; i < width; i++) {
|
||||||
|
let x2 = (i + j * width) * 4;
|
||||||
|
let weight = 0;
|
||||||
|
let weights = 0;
|
||||||
|
let weights_alpha = 0;
|
||||||
|
let gx_r = 0;
|
||||||
|
let gx_g = 0;
|
||||||
|
let gx_b = 0;
|
||||||
|
let gx_a = 0;
|
||||||
|
let center_y = (j + 0.5) * ratio_h;
|
||||||
|
let yy_start = Math.floor(j * ratio_h);
|
||||||
|
let yy_stop = Math.ceil((j + 1) * ratio_h);
|
||||||
|
for (let yy = yy_start; yy < yy_stop; yy++) {
|
||||||
|
let dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half;
|
||||||
|
let center_x = (i + 0.5) * ratio_w;
|
||||||
|
let w0 = dy * dy; //pre-calc part of w
|
||||||
|
let xx_start = Math.floor(i * ratio_w);
|
||||||
|
let xx_stop = Math.ceil((i + 1) * ratio_w);
|
||||||
|
for (let xx = xx_start; xx < xx_stop; xx++) {
|
||||||
|
let dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half;
|
||||||
|
let w = Math.sqrt(w0 + dx * dx);
|
||||||
|
if (w >= 1) {
|
||||||
|
//pixel too far
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//hermite filter
|
||||||
|
weight = 2 * w * w * w - 3 * w * w + 1;
|
||||||
|
let pos_x = 4 * (xx + yy * width_source);
|
||||||
|
//alpha
|
||||||
|
gx_a += weight * data[pos_x + 3];
|
||||||
|
weights_alpha += weight;
|
||||||
|
//colors
|
||||||
|
if (data[pos_x + 3] < 255)
|
||||||
|
weight = weight * data[pos_x + 3] / 250;
|
||||||
|
gx_r += weight * data[pos_x];
|
||||||
|
gx_g += weight * data[pos_x + 1];
|
||||||
|
gx_b += weight * data[pos_x + 2];
|
||||||
|
weights += weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data2[x2] = gx_r / weights;
|
||||||
|
data2[x2 + 1] = gx_g / weights;
|
||||||
|
data2[x2 + 2] = gx_b / weights;
|
||||||
|
data2[x2 + 3] = gx_a / weights_alpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
canvas.width = width;
|
||||||
|
canvas.height = height;
|
||||||
|
ctx.putImageData(img2, 0, 0);
|
||||||
|
let png = canvas.toDataURL();
|
||||||
|
let jpg = canvas.toDataURL('image/jpeg');
|
||||||
|
return png <= jpg ? png : jpg;
|
||||||
|
},
|
||||||
|
|
||||||
|
process: function(dataUrl, templatePage, templateText, n) {
|
||||||
|
let name = templatePage.replace('{n}', n);
|
||||||
|
let text = templateText.replace('{n}', n);
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("HEAD", "$ScriptName/" + name, true);
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState == 4) {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
PasteImage.process(dataUrl, templatePage, templateText, n+1);
|
||||||
|
} else if (xhr.status == 404) {
|
||||||
|
PasteImage.post(dataUrl, name, text);
|
||||||
|
} else {
|
||||||
|
let re = /<h1>(.*)<\\/h1>/g;
|
||||||
|
let match = re.exec(xhr.responseText);
|
||||||
|
alert(match[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send(null);
|
||||||
|
},
|
||||||
|
|
||||||
|
post: function(dataUrl, name, text) {
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", "$ScriptName", true);
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if (xhr.readyState == 4) {
|
||||||
|
if (xhr.status == 200) {
|
||||||
|
let e = document.getElementById('text') || document.getElementById('aftertext');
|
||||||
|
e.insertAtPoint("[[image:" + name + "|" + text + "]]");
|
||||||
|
} else {
|
||||||
|
let re = /<h1>(.*)<\\/h1>/g;
|
||||||
|
let match = re.exec(xhr.responseText);
|
||||||
|
alert(match[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mimeType = dataUrl.split(',')[0].split(':')[1].split(';')[0];
|
||||||
|
let content = encodeURIComponent(dataUrl.split(',')[1]);
|
||||||
|
let params = "title=" + encodeURIComponent(name);
|
||||||
|
params += "&summary=" + encodeURIComponent(name);
|
||||||
|
params += "&username=" + encodeURIComponent("$username");
|
||||||
|
params += "&recent_edit=on";
|
||||||
|
params += "&$question=1";
|
||||||
|
params += "&text=#FILE " + mimeType + "%0A" + content;
|
||||||
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
|
xhr.send(params);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
window.addEventListener('load', PasteImage.init);
|
||||||
|
</script>
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,17 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
# History / Notes
|
|
||||||
# 2004.03.19
|
|
||||||
# - Created
|
|
||||||
# - Works!
|
|
||||||
# - Tried to get rid of LWP but failed :(
|
|
||||||
# - We have to capture the script before CGI.pm starts to get STDIN
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ sub PrivateWikiInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub PadTo16Bytes { # use this only on UTF-X strings (after utf8::encode)
|
sub PadTo16Bytes { # use this only on bytes (after encode_utf8)
|
||||||
my ($data, $minLength) = @_;
|
my ($data, $minLength) = @_;
|
||||||
my $endBytes = length($data) % 16;
|
my $endBytes = length($data) % 16;
|
||||||
$data .= "\0" x (16 - $endBytes) if $endBytes != 0;
|
$data .= "\0" x (16 - $endBytes) if $endBytes != 0;
|
||||||
@@ -62,8 +62,7 @@ sub NewPrivateWikiReadFile {
|
|||||||
$q->p($errorMessage)) if not UserIsEditor();
|
$q->p($errorMessage)) if not UserIsEditor();
|
||||||
PrivateWikiInit();
|
PrivateWikiInit();
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
utf8::encode($file); # filenames are bytes!
|
if (open(my $IN, '<', encode_utf8($file))) {
|
||||||
if (open(my $IN, '<', $file)) {
|
|
||||||
local $/ = undef; # Read complete files
|
local $/ = undef; # Read complete files
|
||||||
my $data = <$IN>;
|
my $data = <$IN>;
|
||||||
close $IN;
|
close $IN;
|
||||||
@@ -72,8 +71,7 @@ sub NewPrivateWikiReadFile {
|
|||||||
$data = $cipher->decrypt(substr $data, 16);
|
$data = $cipher->decrypt(substr $data, 16);
|
||||||
my $copy = $data; # copying is required, see https://github.com/briandfoy/crypt-rijndael/issues/5
|
my $copy = $data; # copying is required, see https://github.com/briandfoy/crypt-rijndael/issues/5
|
||||||
$copy =~ s/\0+$//;
|
$copy =~ s/\0+$//;
|
||||||
utf8::decode($copy);
|
return (1, decode_utf8($copy));
|
||||||
return (1, $copy);
|
|
||||||
}
|
}
|
||||||
return (0, '');
|
return (0, '');
|
||||||
}
|
}
|
||||||
@@ -86,13 +84,12 @@ sub NewPrivateWikiWriteStringToFile {
|
|||||||
$q->p($errorMessage)) if not UserIsEditor();
|
$q->p($errorMessage)) if not UserIsEditor();
|
||||||
PrivateWikiInit();
|
PrivateWikiInit();
|
||||||
my ($file, $string) = @_;
|
my ($file, $string) = @_;
|
||||||
utf8::encode($file);
|
open(my $OUT, '>', encode_utf8($file))
|
||||||
open(my $OUT, '>', $file) or ReportError(Ts('Cannot write %s', $file) . ": $!", '500 INTERNAL SERVER ERROR');
|
or ReportError(Ts('Cannot write %s', $file) . ": $!", '500 INTERNAL SERVER ERROR');
|
||||||
utf8::encode($string);
|
|
||||||
my $iv = $random->random_bytes(16);
|
my $iv = $random->random_bytes(16);
|
||||||
$cipher->set_iv($iv);
|
$cipher->set_iv($iv);
|
||||||
print $OUT $iv;
|
print $OUT $iv;
|
||||||
print $OUT $cipher->encrypt(PadTo16Bytes $string);
|
print $OUT $cipher->encrypt(PadTo16Bytes(encode_utf8($string)));
|
||||||
close($OUT);
|
close($OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,9 +108,7 @@ sub AppendStringToFile {
|
|||||||
sub NewPrivateWikiRefreshIndex {
|
sub NewPrivateWikiRefreshIndex {
|
||||||
if (not IsFile($IndexFile)) { # Index file does not exist yet, this is a new wiki
|
if (not IsFile($IndexFile)) { # Index file does not exist yet, this is a new wiki
|
||||||
my $fh;
|
my $fh;
|
||||||
my $file = $IndexFile;
|
open($fh, '>', encode_utf8($IndexFile)) or die "Unable to open file $IndexFile : $!"; # 'touch' equivalent
|
||||||
utf8::encode($file);
|
|
||||||
open($fh, '>', $file) or die "Unable to open file $IndexFile : $!"; # 'touch' equivalent
|
|
||||||
close($fh) or die "Unable to close file : $IndexFile $!";
|
close($fh) or die "Unable to close file : $IndexFile $!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -165,8 +160,7 @@ sub GetPrivatePageFile {
|
|||||||
}
|
}
|
||||||
$cipher->set_iv($iv);
|
$cipher->set_iv($iv);
|
||||||
# We cannot use full byte range because of the filesystem limits
|
# We cannot use full byte range because of the filesystem limits
|
||||||
utf8::encode($id);
|
my $returnName = unpack "H*", $iv . $cipher->encrypt(PadTo16Bytes(encode_utf8($id), 96)); # to hex string
|
||||||
my $returnName = unpack "H*", $iv . $cipher->encrypt(PadTo16Bytes $id, 96); # to hex string
|
|
||||||
return $returnName;
|
return $returnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,8 +215,7 @@ sub DoDiff { # Actualy call the diff program
|
|||||||
$LockCleaners{'diff'} = sub { Unlink($oldName) if IsFile($oldName); Unlink($newName) if IsFile($newName); };
|
$LockCleaners{'diff'} = sub { Unlink($oldName) if IsFile($oldName); Unlink($newName) if IsFile($newName); };
|
||||||
OldPrivateWikiWriteStringToFile($oldName, $_[0]); # CHANGED Here we use the old sub!
|
OldPrivateWikiWriteStringToFile($oldName, $_[0]); # CHANGED Here we use the old sub!
|
||||||
OldPrivateWikiWriteStringToFile($newName, $_[1]); # CHANGED
|
OldPrivateWikiWriteStringToFile($newName, $_[1]); # CHANGED
|
||||||
my $diff_out = `diff -- \Q$oldName\E \Q$newName\E`;
|
my $diff_out = decode_utf8(`diff -- \Q$oldName\E \Q$newName\E`);
|
||||||
utf8::decode($diff_out); # needs decoding
|
|
||||||
$diff_out =~ s/\n\K\\ No newline.*\n//g; # Get rid of common complaint.
|
$diff_out =~ s/\n\K\\ No newline.*\n//g; # Get rid of common complaint.
|
||||||
# CHANGED We have to unlink the files because we don't want to store them in plaintext!
|
# CHANGED We have to unlink the files because we don't want to store them in plaintext!
|
||||||
Unlink($oldName, $newName); # CHANGED
|
Unlink($oldName, $newName); # CHANGED
|
||||||
@@ -245,8 +238,7 @@ sub MergeRevisions { # merge change from file2 to file3 into file1
|
|||||||
OldPrivateWikiWriteStringToFile($name2, $file2); # CHANGED
|
OldPrivateWikiWriteStringToFile($name2, $file2); # CHANGED
|
||||||
OldPrivateWikiWriteStringToFile($name3, $file3); # CHANGED
|
OldPrivateWikiWriteStringToFile($name3, $file3); # CHANGED
|
||||||
my ($you, $ancestor, $other) = (T('you'), T('ancestor'), T('other'));
|
my ($you, $ancestor, $other) = (T('you'), T('ancestor'), T('other'));
|
||||||
my $output = `diff3 -m -L \Q$you\E -L \Q$ancestor\E -L \Q$other\E -- \Q$name1\E \Q$name2\E \Q$name3\E`;
|
my $output = decode_utf8(`diff3 -m -L \Q$you\E -L \Q$ancestor\E -L \Q$other\E -- \Q$name1\E \Q$name2\E \Q$name3\E`);
|
||||||
utf8::decode($output); # needs decoding
|
|
||||||
Unlink($name1, $name2, $name3); # CHANGED unlink temp files -- we don't want to store them in plaintext!
|
Unlink($name1, $name2, $name3); # CHANGED unlink temp files -- we don't want to store them in plaintext!
|
||||||
ReleaseLockDir('merge');
|
ReleaseLockDir('merge');
|
||||||
return $output;
|
return $output;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -52,11 +52,9 @@ sub DoPygmentize {
|
|||||||
|
|
||||||
RequestLockDir('pygmentize') or return '';
|
RequestLockDir('pygmentize') or return '';
|
||||||
WriteStringToFile("$TempDir/pygmentize", $contents);
|
WriteStringToFile("$TempDir/pygmentize", $contents);
|
||||||
my $output = `pygmentize $lexer -f html -O encoding=utf8 $args -- \Q$TempDir/pygmentize\E 2>&1`;
|
my $output = decode_utf8(`pygmentize $lexer -f html -O encoding=utf8 $args -- \Q$TempDir/pygmentize\E 2>&1`);
|
||||||
ReleaseLockDir('pygmentize');
|
ReleaseLockDir('pygmentize');
|
||||||
|
|
||||||
utf8::decode($output);
|
|
||||||
|
|
||||||
if ($?) {
|
if ($?) {
|
||||||
$output = $q->p($q->strong($output)) # "sh: pygmentize: command not found"
|
$output = $q->p($q->strong($output)) # "sh: pygmentize: command not found"
|
||||||
. $q->pre($contents);
|
. $q->pre($contents);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
# TODO referers and refeRrers
|
# TODO referers and refeRrers
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -32,9 +29,7 @@ my $dummy = RelationRead();
|
|||||||
|
|
||||||
sub RelationRead {
|
sub RelationRead {
|
||||||
# return scalar(@RelationLinking) if (scalar(@RelationLinking));
|
# return scalar(@RelationLinking) if (scalar(@RelationLinking));
|
||||||
my $file = "$DataDir/$referencefile";
|
open (my $RRR, '<', encode_utf8("$DataDir/$referencefile")) || return(0);
|
||||||
utf8::encode($file);
|
|
||||||
open (my $RRR, '<', $file) || return(0);
|
|
||||||
while (<$RRR>) {
|
while (<$RRR>) {
|
||||||
chomp;
|
chomp;
|
||||||
my ($a,$b,$c) = split(';');
|
my ($a,$b,$c) = split(';');
|
||||||
@@ -174,9 +169,7 @@ $Action{'updaterelates'} = sub {
|
|||||||
else {
|
else {
|
||||||
print "no new source<br />\n";
|
print "no new source<br />\n";
|
||||||
}
|
}
|
||||||
my $file = "$DataDir/$referencefile";
|
open (my $RRR, '>', encode_utf8("$DataDir/$referencefile"));
|
||||||
utf8::encode($file);
|
|
||||||
open (my $RRR, '>', $file);
|
|
||||||
print "<br />\n";
|
print "<br />\n";
|
||||||
foreach my $t (@RelationLinking) {
|
foreach my $t (@RelationLinking) {
|
||||||
next unless (defined($t));
|
next unless (defined($t));
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
@@ -11,10 +11,7 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# Free Software Foundation, Inc.
|
|
||||||
# 59 Temple Place, Suite 330
|
|
||||||
# Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use v5.10;
|
use v5.10;
|
||||||
@@ -26,20 +23,29 @@ our ($q, $bol, %Action, %Page, $OpenPageName, @MyRules);
|
|||||||
push(@MyRules, \&SearchListRule);
|
push(@MyRules, \&SearchListRule);
|
||||||
|
|
||||||
sub SearchListRule {
|
sub SearchListRule {
|
||||||
if ($bol && /\G(<list (.*?)>)/cgis) {
|
if ($bol && /\G(<(list|titlelist) (.*?)>)/cgis) {
|
||||||
# <list regexp>
|
# <list regexp> (search page titles and page bodies)
|
||||||
|
# <titlelist regexp> (search page titles only)
|
||||||
Clean(CloseHtmlEnvironments());
|
Clean(CloseHtmlEnvironments());
|
||||||
Dirty($1);
|
Dirty($1);
|
||||||
my ($oldpos, $old_) = (pos, $_);
|
my ($oldpos, $old_) = (pos, $_);
|
||||||
my $original = $OpenPageName;
|
my $original = $OpenPageName;
|
||||||
my $term = $2;
|
my $variation = $2;
|
||||||
|
my $term = $3;
|
||||||
if ($term eq "") {
|
if ($term eq "") {
|
||||||
$term = GetId();
|
$term = GetId();
|
||||||
}
|
}
|
||||||
local ($OpenPageName, %Page);
|
local ($OpenPageName, %Page);
|
||||||
my %hash = ();
|
my %hash = ();
|
||||||
foreach my $id (SearchTitleAndBody($term)) {
|
if ($variation eq 'list') {
|
||||||
$hash{$id} = 1 unless $id eq $original; # skip the page with the query
|
foreach my $id (SearchTitleAndBody($term)) {
|
||||||
|
$hash{$id} = 1 unless $id eq $original; # skip the page with the query
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($variation eq 'titlelist') {
|
||||||
|
foreach my $id (grep(/$term/, AllPagesList())) {
|
||||||
|
$hash{$id} = 1 unless $id eq $original; # skip the page with the query
|
||||||
|
}
|
||||||
}
|
}
|
||||||
my @found = keys %hash;
|
my @found = keys %hash;
|
||||||
if (defined &PageSort) {
|
if (defined &PageSort) {
|
||||||
@@ -48,7 +54,7 @@ sub SearchListRule {
|
|||||||
@found = sort(@found);
|
@found = sort(@found);
|
||||||
}
|
}
|
||||||
@found = map { $q->li(GetPageLink($_)) } @found;
|
@found = map { $q->li(GetPageLink($_)) } @found;
|
||||||
print $q->start_div({-class=>'search list'}),
|
print $q->start_div({-class=>"search $variation"}),
|
||||||
$q->ul(@found), $q->end_div;
|
$q->ul(@found), $q->end_div;
|
||||||
Clean(AddHtmlEnvironment('p')); # if dirty block is looked at later, this will disappear
|
Clean(AddHtmlEnvironment('p')); # if dirty block is looked at later, this will disappear
|
||||||
($_, pos) = ($old_, $oldpos); # restore \G (assignment order matters!)
|
($_, pos) = ($old_, $oldpos); # restore \G (assignment order matters!)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user