init import

This commit is contained in:
Sun, Chaoyang 2019-04-25 17:12:02 +08:00
commit 669feea915
47 changed files with 5187 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build

168
CMakeLists.txt Normal file
View file

@ -0,0 +1,168 @@
cmake_minimum_required(VERSION 2.6)
project(wikipp)
macro (set_rpath target)
if(UNIX)
set_target_properties(${target} PROPERTIES
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib;$ORIGIN/.."
)
endif()
endmacro()
include(CPack)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
option(USE_STATIC_VIEW "Compile view statically into wikipp" OFF)
if(WIN32 OR CYGWIN)
add_definitions(-DDLL_EXPORT)
endif()
find_library(CPPCMS cppcms)
find_library(BOOSTER booster)
find_library(CPPDB cppdb)
find_library(DISCOUNT markdown)
find_path(CPPCMS_INC cppcms/application.h)
find_path(BOOSTER_INC booster/shared_ptr.h)
find_path(CPPDB_INC cppdb/frontend.h)
find_path(DISCOUNT_INC mkdio.h)
if(NOT DISCOUNT_INC OR NOT DISCOUNT)
message(FATAL "-- Discount markdown library was not found, please download it from \n"
" http://www.pell.portland.or.us/~orc/Code/discount/ and install it\n"
" By extracting it and running ./configure.sh && make CFLAGS=-O2\n")
endif()
include_directories(${CPPCMS_INC})
include_directories(${BOOSTER_INC})
include_directories(${CPPDB_INC})
include_directories(${DISCOUNT_INC})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
find_program(TMPLCC cppcms_tmpl_cc)
find_program(XGETTEXT xgettext)
find_program(MSGFMT msgfmt)
find_program(MSGMERGE msgmerge)
if(WIN32)
add_definitions(-DDLL_EXPORT)
endif()
set(TEMPLATES
${CMAKE_CURRENT_SOURCE_DIR}/templates/main.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/templates/page.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/templates/hist.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/templates/admin.tmpl
${CMAKE_CURRENT_SOURCE_DIR}/templates/toc.tmpl
)
set(SRC
src/index.cpp
src/main.cpp
src/master.cpp
src/options.cpp
src/page.cpp
src/users.cpp
src/wiki.cpp
src/markdown.cpp
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/view.cpp
COMMAND ${TMPLCC}
-d wikipp
-o ${CMAKE_CURRENT_BINARY_DIR}/view.cpp
${TEMPLATES}
DEPENDS ${TEMPLATES})
if(USE_STATIC_VIEW)
add_executable(wikipp ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/view.cpp)
else()
add_executable(wikipp ${SRC})
add_library(view SHARED ${CMAKE_CURRENT_BINARY_DIR}/view.cpp)
set_rpath(view)
target_link_libraries(view ${BOOSTER} ${CPPCMS})
endif()
set_rpath(wikipp)
target_link_libraries(wikipp ${BOOSTER} ${CPPCMS} ${CPPDB} ${DISCOUNT})
# Localization
set(LOCALES he ru pl)
set(MO_FILES)
set(UPDATE_PO_LIST)
set(POT_TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/po/wikipp.pot")
add_custom_command(
OUTPUT ${POT_TEMPLATE}
COMMAND
${XGETTEXT}
--keyword=translate:1,1t
--keyword=translate:1,2,3t
--keyword=_
--keyword=N_
${SRC}
${CMAKE_CURRENT_BINARY_DIR}/view.cpp
--output=${POT_TEMPLATE}
DEPENDS ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/view.cpp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(update-po)
foreach(LOCALE ${LOCALES})
set(MODIR "${CMAKE_CURRENT_BINARY_DIR}/locale/${LOCALE}/LC_MESSAGES")
file(MAKE_DIRECTORY "${MODIR}")
set(MOFILE "${MODIR}/wikipp.mo")
set(POFILE "${CMAKE_CURRENT_SOURCE_DIR}/po/${LOCALE}.po")
add_custom_command(
OUTPUT ${MOFILE}
COMMAND ${MSGFMT} ${POFILE} -o ${MOFILE}
DEPENDS ${POFILE})
add_custom_target(update-po-${LOCALE}
COMMAND ${MSGMERGE} -U ${POFILE} ${CMAKE_CURRENT_SOURCE_DIR}/po/wikipp.pot
DEPENDS ${POT_TEMPLATE}
)
add_dependencies(update-po update-po-${LOCALE})
set(MO_FILES ${MO_FILES} ${MOFILE})
set(UPDATE_PO_LIST ${UPDATE_PO_LIST} update-po-${LOCALE})
endforeach()
add_custom_target(create-po ALL DEPENDS ${MO_FILES})
add_executable(wikipp_migrate src/migrate.cpp)
set_rpath(wikipp_migrate)
target_link_libraries(wikipp_migrate ${CPPDB})
install(TARGETS wikipp wikipp_migrate view
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/wikipp
ARCHIVE DESTINATION lib/wikipp)
foreach(STYLE style style-ltr style-rtl)
install(FILES media/${STYLE}.css DESTINATION share/wikipp/media)
endforeach()
foreach(LOCALE ${LOCALES})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/locale/${LOCALE}/LC_MESSAGES/wikipp.mo
DESTINATION share/locale/${LOCALE}/LC_MESSAGES/)
endforeach()
install(FILES sample_config.js DESTINATION share/wikipp)

674
GPL.TXT Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

101
config.js Normal file
View file

@ -0,0 +1,101 @@
{
"wikipp" : {
"script" : "/wikipp",
"media" :"/media",
//"syntax_highlighter" : "/media/sh",
"disable_registration" : false,
"languages" : {
"en" : "en_US.UTF-8" ,
"he" : "he_IL.UTF-8" ,
"ru" : "ru_RU.UTF-8" ,
"pl" : "pl_PL.UTF-8"
},
// Sqlite3 Sample Connection String
"connection_string" : "sqlite3:db=./db/wikipp.db;@pool_size=16",
//
// PostgreSQL Sample Connection String
// "connection_string" : "postgresql:dbname=wikipp;@pool_size=16",
//
// MySQL Sample Connection String
//
// "connection_string" : "mysql:database=wikipp;user=root;password=root;@pool_size=16",
//
// In Some cases mysql works faster without prepared statements as it uses query cache, so you
// may change this string to:
//
// "connection_string" : "mysql:database=wikipp;user=root;password=root;@pool_size=16;@use_prepared=off",
//
},
"service" : {
"api" : "http",
"port" : 8080,
// "api" : "fastcgi",
// "socket" : "/tmp/wikipp.sock"
// "socket" : "stdin"
},
"session" : {
"expire" : "renew",
"location" : "client",
"timeout" : 2592000, // One month 24*3600*30
"cookies" : {
"prefix" : "wikipp"
},
"server" : {
"storage" : "files"
},
"client" : {
"encryptor" : "aes",
"key" : "9bc6dbda707cb72ea1205dd5b1c90464"
}
},
"views" : {
"paths" : [ "./build"] ,
"skins" : [ "view" ] ,
//"auto_reload" : true
},
"file_server" : {
"enable": true,
"doument_root" : "."
},
"localization" : {
// "backend" : "std", you may switch if for performance enhanecements
"messages" : {
"paths" : [ "./build/locale"],
"domains" : [ "wikipp" ]
},
"locales" : [ "he_IL.UTF-8" , "en_US.UTF-8", "ru_RU.UTF-8", "pl_PL.UTF-8" ]
},
"http" : {
"script_names" : [ "/wikipp" ]
},
"logging" : {
"level" : "info",
"syslog" : {
"enable": true,
"id" : "WikiPP"
},
"file" : {
"name" : "./wikipp.log",
"append" : true
}
},
"cache" : {
"backend" : "thread_shared",
"limit" : 100, // items - thread cache
},
"security" : {
"csrf" : { "enable" : true }
// "multipart_form_data_limit" : 65536, // KB
// "content_length_limit" : 1024, // KB
// "uploads_path" : "" // temporary directory
//
// You may change to true for debugging only
// "display_error_message" : false
}
}

21
copyright.txt Normal file
View file

@ -0,0 +1,21 @@
Wikipp - C++ Wiki Engine
Copyright (C) 2009-2012 Artyom Beilis <artyomtnk@yahoo.com>
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/>.
------------------------------------------------------------------
Additional exemptions compiling, linking, and/or using
OpenSSL and discount markdown library is allowed.

BIN
db/wikipp.db Normal file

Binary file not shown.

81
media/style-ltr.css Normal file
View file

@ -0,0 +1,81 @@
*{
padding:0;
margin:0;
}
h1, h2, h3, h4, h5, h6, p, pre, blockquote, label, ul, ol, dl,
fieldset, address, pre { margin:0.75em 0;}
li, dd {
margin-left:2em;
}
blockquote, pre {
margin-left:20px;
margin-right:20px;
padding-left:5px;
border-left: #999999 solid thin;
}
#sidecontent {
padding:10px 10px 20px 10px;
margin:0px 0px 10px 0px;
float:right;
}
#maincontent {
padding:0px 5px 5px 0px;
float:left;
}
#copyrightdesign {
padding:5px 20px 5px 0px;
float:left;
}
#footercontact {
padding:5px 0px 5px 0px;
float:right;
}
.published{
text-align:left;
}
.nextpage{
text-align:right;
}
#slogan {
padding:10px 20px 0px 0px;
margin:0px 0px 0px 0px;
float:left;
}
#nav li {
float: right;
}
#title {
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
float:left;
}
#navall { float:right; }
#nav {
text-align: right;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
#header{
padding:5px 0px 10px 0px;
margin:0px 0px 0px 0px;
}
#langlist {
text-align: right;
}

82
media/style-rtl.css Normal file
View file

@ -0,0 +1,82 @@
body {direction:rtl}
h1, h2, h3, h4, h5, h6, p, pre, blockquote, label, ul, ol, dl,
fieldset, address, pre { margin-right:0.0em;}
ul, ol, dl { padding-right:2.5em; }
blockquote, pre {
margin-left:20px;
margin-right:20px;
padding-right:5px;
border-right: #999999 solid thin;
}
.dp-highlighter { direction:ltr; }
#sidecontent {
padding:10px 10px 20px 10px;
margin:0px 0px 10px 0px;
float:left;
}
#maincontent {
padding:5px 0px 5px 0px;
float:right;
}
#copyrightdesign {
padding:5px 0px 5px 0px;
float:right;
}
#footercontact {
padding:5px 0px 5px 0px;
float:left;
}
.published {
text-align:right;
}
.nextpage{
text-align:left;
}
#slogan {
padding:10px 0px 0px 0px;
margin:0px 0px 0px 0px;
float:right;
}
#nav li {
float: left;
margin-right:1em;
}
#title {
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
float:right;
}
#navall { float:left; }
#nav {
text-align: left;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
#header{
padding:5px 0px 10px 0px;
margin:0px 0px 0px 0px;
}
#langlist {
text-align: left;
}

240
media/style.css Normal file
View file

@ -0,0 +1,240 @@
/***************************************************************************
* *
* contented5 - An open source xhtml/css website template by Contented *
* Designs. You're free to modify it and use it for any purpose without *
* cost or obligation. We'd prefer that you leave the link to our website *
* in the footer but it's not required. *
* *
* If you have comments or questions, please contact us at *
* http://www.ContentedDesigns.com. Thanks! *
* *
* Version: 1.01 (May 17, 2006) *
***************************************************************************/
#page {
color: #222222;
background-color:#FFFFFF;
font-family: Arial, sans-serif;
font-size:83%;
margin:20px auto;
width:760px;
padding-left:10px;
padding-right:10px;
}
h1 {font-size:167%; border-bottom: #999999 solid thin;}
h2 {font-size:139%;}
h3 {font-size:120%;}
h4 {font-size:100%;}
#title { border:none; }
a {
color: #CC0000;
background-color: #FFFFFF;
font-weight: normal;
text-decoration: none;
}
a:hover {
color: #CC0000;
background-color: #FFFFFF;
font-weight: normal;
text-decoration: underline;
}
#contact {
padding:0px 0px 0px 0px;
float:right;
}
#contact a {
color: #CC0000;
background-color:#FFFFFF;
font-weight:bold;
text-decoration:none;
}
#contact a:hover {
color: #CC0000;
background-color:#FFFFFF;
text-decoration:underline;
}
#header {
clear:both;
color: #CC0000;
background-color:#FFFFFF;
}
#title {
color: #CC0000;
background-color:#FFFFFF;
font-size:200%;
font-weight:bold;
width:90%;
}
#slogan {
color:#222222;
background-color:#FFFFFF;
font-size:83%;
font-weight:normal;
font-style:normal;
width:90%;
}
#navall {width:40%;}
#nav {
line-height:125%;
height:3em;
list-style: none;
text-align: left;
}
#nav ul {list-style: none; }
#nav li a {
display: block;
font-size: small;
color: #CC0000;
background-color:#FFFFFF;
font-weight: normal;
text-decoration: none;
}
#nav li a:hover {
border-bottom:3px solid #CC0000;
}
#nav a.selected {
border-bottom:3px solid #CC0000;
}
#path {
width:760px;
clear:both;
float:left;
font-size:75%;
font-weight:normal;
margin:4px 0px 5px 0px;
border-top:5px solid #222222;
}
#path a {
font-weight:normal;
}
#sidecontent a {
color: #CC0000;
background-color:#FFFFFF;
}
#sidecontent h2 { margin:0.75em 0.25em 0.25em 0em;}
#sidecontent ul { margin:0.25em 0.25em 0.25em 0.25em;}
#footer {
height:40px;
color:#222222;
background-color:#FFFFFF;
border-top:5px solid #222222;
font-size:75%;
line-height:1.5em;
width: 760px;
clear:both;
}
#footer a {
color:#CC0000;
background-color:#FFFFFF;
text-decoration: none;
}
#footer a:hover {
color:#CC0000;
background-color:#FFFFFF;
font-weight: normal;
text-decoration: underline;
}
.published, .nextpage, .rsslink {
font-size:80%;
font-style:italic;
margin-top:-10px;
padding-top:0px;
}
#comments {
border-top: #999999 solid thin;
}
#comments dd {
margin-left:25px;
padding-left:5px;
margin-right:25px;
padding-right:5px;
}
#comments textarea {
width:100%
}
#footercontact {
color:#CC0000;
background-color:#FFFFFF;
}
#copyrightdesign {
color:#222222;
background-color:#FFFFFF;
width: 580px;
}
#maincontent {
font-size:100%;
margin:0px 0px 0px 0px;
width:540px;
text-align:justify;
}
#sidecontent {
font-family:Arial, sans-serif;
color: #222222;
background-color:#FFFFFF;
font-size:75%;
width:180px;
border: #999999 solid thin;
}
#copyright {
margin-top:15px;
}
/*#toc_table {
text-padding : 5px 5px 5px 5px;
}*/
h1.categorytitle {
text-align:center;
text-decoration:none;
border-bottom:none;
}
tr.d_del{background:red;}
tr.d_add{background:green;}

62
misk/discount.patch Normal file
View file

@ -0,0 +1,62 @@
Common subdirectories: discount-2.0.3/Plan9 and discount-2.0.3-side/Plan9
Common subdirectories: discount-2.0.3/tests and discount-2.0.3-side/tests
diff -u discount-2.0.3/toc.c discount-2.0.3-side/toc.c
--- discount-2.0.3/toc.c 2010-11-27 08:44:44.000000000 +0200
+++ discount-2.0.3-side/toc.c 2010-12-31 18:25:17.000000000 +0200
@@ -21,6 +21,7 @@
{
Paragraph *tp, *srcp;
int last_hnumber = 0;
+ int last_limit = 6;
Cstring res;
*doc = 0;
@@ -31,6 +32,26 @@
CREATE(res);
RESERVE(res, 100);
+ /*
+ * Find the minimal heading level, useful in cases
+ * when h1 is already in use (like article title and
+ * in markdown only h2, h3 or even higher are used
+ *
+ * So list nesting would be done from min_header
+ */
+ for ( tp = p->code; tp ; tp = tp->next ) {
+ if ( tp->typ == SOURCE ) {
+ for ( srcp = tp->down; srcp; srcp = srcp->next ) {
+ if ( srcp->typ == HDR && srcp->text ) {
+ if(srcp->hnumber < last_limit + 1)
+ last_limit = srcp->hnumber - 1;
+ }
+ }
+ }
+ }
+
+ last_hnumber = last_limit;
+
for ( tp = p->code; tp ; tp = tp->next ) {
if ( tp->typ == SOURCE ) {
for ( srcp = tp->down; srcp; srcp = srcp->next ) {
@@ -45,7 +66,7 @@
while ( srcp->hnumber > last_hnumber ) {
Csprintf(&res, "%*s%s<ul>\n", last_hnumber, "",
- last_hnumber ? "<li>" : "");
+ ( last_hnumber != last_limit )? "<li>" : "");
++last_hnumber;
}
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
@@ -61,9 +82,9 @@
}
}
- while ( last_hnumber > 0 ) {
+ while ( last_hnumber > last_limit ) {
--last_hnumber;
- Csprintf(&res, last_hnumber ? "%*s</ul></li>\n" : "%*s</ul>\n", last_hnumber, "");
+ Csprintf(&res, (last_hnumber != last_limit ) ? "%*s</ul></li>\n" : "%*s</ul>\n", last_hnumber, "");
}
/* HACK ALERT! HACK ALERT! HACK ALERT! */
*doc = T(res); /* we know that a T(Cstring) is a character pointer */
Common subdirectories: discount-2.0.3/tools and discount-2.0.3-side/tools

305
po/he.po Normal file
View file

@ -0,0 +1,305 @@
# translation of he.po to Hebrew
# translation of he.po to
# translation of wikipp.po to
# Hebrew Translation.
# Copyright (C) YEAR Artyom Tonkikh
# This file is distributed under the same license as the wikipp package.
#
# Artyom Tonkikg <artyomtnk@yahoo.com>, 2008.
# artik <artyomtnk@yahoo.com>, 2008, 2009, 2010, 2012.
msgid ""
msgstr ""
"Project-Id-Version: he\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-02-01 13:06+0200\n"
"PO-Revision-Date: 2012-02-01 13:08+0200\n"
"Last-Translator: Artyom <artyomtnk@yahoo.com>\n"
"Language-Team: Hebrew <>\n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.2\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: master.cpp:110
msgid "LANG"
msgstr "עברית"
#: options.cpp:14
msgid "Users Only"
msgstr "משתמשים בלבד"
#: options.cpp:15
msgid "Contact e-mail"
msgstr "דוא\"ל ליצירת־קשר"
#: options.cpp:16
msgid "Wiki Title"
msgstr "כותרת הויקי"
#: options.cpp:17
msgid "About Wiki"
msgstr "אודות ויקי"
#: options.cpp:18
msgid "Copyright String"
msgstr "זכויות היוצרים"
#: options.cpp:19 users.cpp:45
msgid "Submit"
msgstr "שלח"
#: options.cpp:32
msgid "Disable creation of new articles by visitors"
msgstr "בטל יצירת מאמרים חדשים ע\" מבקרים"
#: options.cpp:110
msgid "Wiki++ - CppCMS Wiki"
msgstr "ויקי++ - ויקי על CppCMS"
#: options.cpp:113
msgid ""
"## About\n"
"\n"
"Wiki++ is a wiki engine powered by\n"
"[CppCMS](http://cppcms.sf.net/) web development framework.\n"
msgstr ""
"## אודות\n"
"\n"
"ויקי++ זה מנוע ויקי מבוסס על תשתית פיתוח אינטרנט [CppCMS](http://cppcms.sf."
"net/)\n"
#: options.cpp:118
msgid "(C) All Rights Reserved"
msgstr "‏(C) ‏ כל הזכויות שמורות"
#: page.cpp:17
msgid "Title"
msgstr "כותרת"
#: page.cpp:18 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:111
msgid "Content"
msgstr "תוכן"
#: page.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:115
msgid "Sidebar"
msgstr "סרגל־צד"
#: page.cpp:20
msgid "Save"
msgstr "שמור"
#: page.cpp:21
msgid "Save and Continue"
msgstr "שמור והמשך"
#: page.cpp:22
msgid "Preview"
msgstr "תצוגה מקדימה"
#: page.cpp:32
msgid "Disable editing by visitors"
msgstr "בטל עריכה למבקרים"
#: page.cpp:33
msgid "Please Login"
msgstr "אנא התחבר"
#: users.cpp:17 users.cpp:41
msgid "Username"
msgstr "שם משתמש"
#: users.cpp:18 users.cpp:42
msgid "Password"
msgstr "ססמה"
#: users.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:65
msgid "Login"
msgstr "התחברות"
#: users.cpp:43
msgid "Confirm"
msgstr "אמת"
#: users.cpp:44
msgid "Solve"
msgstr "פתור"
#: users.cpp:79
msgid "This user exists"
msgstr "המשתמש קיים"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:5
msgid "Wellcome to WikiPP"
msgstr "ברוכים הבאים ל־ויקי++"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:9
msgid " Users Area"
msgstr "אזור משתמשים"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:14
msgid "Navigation"
msgstr "ניווט"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:16
msgid "Index"
msgstr "אינדקס"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:17
msgid "Changes"
msgstr "שינויים"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:20
msgid "Main Page"
msgstr "עמוד ראשי"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:42
msgid "LTR"
msgstr "RTL"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:68
msgid "Logout "
msgstr "יציאה"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:78
msgid "Main"
msgstr "ראשי"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:90
msgid "Valid CSS"
msgstr "‏css תקני"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:91
msgid "Valid XHTML 1.0"
msgstr "‏XHTML 1.0 תקני"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:96
msgid ""
"Template design based on <a href=\"http://ContentedDesigns.com\">Contented "
"Designs</a>"
msgstr ""
"התבנית מבוססת על עיצוב <a href=\"http://ContentedDesigns.com\">Contented "
"Designs</a>"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:99
msgid "Contact"
msgstr "צור קשר"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:14
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "Edit"
msgstr "עריכה"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:16
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:31
msgid "History"
msgstr "היסטוריה"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "New Article"
msgstr "מאמר חדש"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:29
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:5
msgid "Back to page"
msgstr "חזרה מאמר"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:68
msgid "Edit this version (rollback)"
msgstr "ערוך גרסה זו (שחזור)"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:73
msgid "(version {1,num}, from {2,dt=s})"
msgstr "(גרסה {1}, ב־{2,dt=s})"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:78
msgid "Difference \"{1}\" ver. {2} versus ver. {3}"
msgstr "השוואה של \"{1}\", גרסה {2}, גרסה {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:80
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:82
msgid "Edit version {1,num}"
msgstr "ערוך גרסה {1,num}"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:99
msgid "No such page or version exist"
msgstr "עמוד או גרסאות כאלה לא קיימים"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:101
msgid "No difference between these versions"
msgstr "אין הבדל בין הגרסאות"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:104
msgid "Titles"
msgstr "כותרות"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:106
msgid "Version {1}"
msgstr "גרסה {1}"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:3
msgid "WikiPP :: History"
msgstr "ויקי++ :: היסטוריה"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:14
msgid "Version {1,num}, changed at {2,dt=s}, by {3}"
msgstr "גרסה {,num1}, עודכנה ב־{2,dt=s} ע\"י {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:15
msgid "Show"
msgstr "הצג"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:16
msgid "Edit (rollback)"
msgstr "עריכה (שחזור)"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:17
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:33
msgid "Diff to previous"
msgstr "השוואה עם גרסה קודמת"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:23
msgid "History is empty"
msgstr "היסטוריה ריקה"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:25
msgid "Next page"
msgstr "עמוד הבא"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:3
msgid "WikiPP :: Login"
msgstr "ויקי++ :: כניסה"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:11
msgid "Register as new user"
msgstr "הרשם כמשתמש חדש"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:16
msgid "WikiPP :: Register"
msgstr "ויקי :: הרשמה"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:38
msgid "WikiPP :: Edit Options"
msgstr "ויקי :: עריכת הגדרות"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:4
msgid "Index of Articles"
msgstr "אינדקס מאמרים"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:26
msgid "Recent Changes"
msgstr "שינויים אחרונים"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:32
msgid "version {1,num}, at {2,dt=s}, by {3}"
msgstr "גרסה {1}, ב־{2,dt=s}, ע\"י {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:38
msgid "Next Page"
msgstr "עמוד הבא"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:40
msgid "No more changes"
msgstr "אין יותר שינויים"

303
po/pl.po Normal file
View file

@ -0,0 +1,303 @@
# translation of pl.po to Hebrew
# Translation of Wiki++ to Polish.
# Copyright (C) 2010 Michał Fita
# This file is distributed under the same license as the Wiki++ package.
#
# Michal Fita <michal.fita@gmail.com>, 2010.
# artik <artyomtnk@yahoo.com>, 2010, 2012.
msgid ""
msgstr ""
"Project-Id-Version: pl\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-02-01 13:06+0200\n"
"PO-Revision-Date: 2012-02-01 13:10+0200\n"
"Last-Translator: Artyom <artyomtnk@yahoo.com>\n"
"Language-Team: Hebrew <>\n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.2\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: master.cpp:110
msgid "LANG"
msgstr "Polski"
#: options.cpp:14
msgid "Users Only"
msgstr ""
#: options.cpp:15
msgid "Contact e-mail"
msgstr "Adres kontaktowy"
#: options.cpp:16
msgid "Wiki Title"
msgstr "Tytuł wiki"
#: options.cpp:17
msgid "About Wiki"
msgstr "O wiki"
#: options.cpp:18
msgid "Copyright String"
msgstr ""
#: options.cpp:19 users.cpp:45
msgid "Submit"
msgstr "Wyślij"
#: options.cpp:32
msgid "Disable creation of new articles by visitors"
msgstr "Wyłącza tworzenie nowych artykułów przez gości"
#: options.cpp:110
msgid "Wiki++ - CppCMS Wiki"
msgstr ""
#: options.cpp:113
msgid ""
"## About\n"
"\n"
"Wiki++ is a wiki engine powered by\n"
"[CppCMS](http://cppcms.sf.net/) web development framework.\n"
msgstr ""
"## O\n"
"\n"
"Wiki++ jest silnikiem wiki napędzanym\n"
"szkieletem [CppCMS](http://cppcms.sf.net/) dla aplikacji web.\n"
#: options.cpp:118
msgid "(C) All Rights Reserved"
msgstr "(C) Wszelkie prawa zastrzeżone"
#: page.cpp:17
msgid "Title"
msgstr "Tytuł"
#: page.cpp:18 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:111
msgid "Content"
msgstr "Zawartość"
#: page.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:115
msgid "Sidebar"
msgstr ""
#: page.cpp:20
msgid "Save"
msgstr "Zapisz"
#: page.cpp:21
msgid "Save and Continue"
msgstr "Zapisz i kontynuuj"
#: page.cpp:22
msgid "Preview"
msgstr "Podgląd"
#: page.cpp:32
msgid "Disable editing by visitors"
msgstr "Wyłącz edycję przez gości"
#: page.cpp:33
msgid "Please Login"
msgstr "Proszę się zalogować"
#: users.cpp:17 users.cpp:41
msgid "Username"
msgstr "Nazwa użytkownika"
#: users.cpp:18 users.cpp:42
msgid "Password"
msgstr "Hasło"
#: users.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:65
msgid "Login"
msgstr "Logowanie"
#: users.cpp:43
msgid "Confirm"
msgstr "Potwierdź"
#: users.cpp:44
msgid "Solve"
msgstr ""
#: users.cpp:79
msgid "This user exists"
msgstr "Taki użytkownik istnieje"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:5
msgid "Wellcome to WikiPP"
msgstr "Zapraszamy do WikiPP"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:9
msgid " Users Area"
msgstr " Obszar użytkownika"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:14
msgid "Navigation"
msgstr "Nawigacja"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:16
msgid "Index"
msgstr "Indeks"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:17
msgid "Changes"
msgstr "Zmiany"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:20
msgid "Main Page"
msgstr "Strona główna"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:42
msgid "LTR"
msgstr "LTR"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:68
msgid "Logout "
msgstr "Wyloguj "
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:78
msgid "Main"
msgstr "Główna"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:90
msgid "Valid CSS"
msgstr "Poprawny CSS"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:91
msgid "Valid XHTML 1.0"
msgstr "Poprawny XTML 1.0"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:96
msgid ""
"Template design based on <a href=\"http://ContentedDesigns.com\">Contented "
"Designs</a>"
msgstr ""
"Projekt wzorca bazuja na <a href=\"http://ContentedDesigns.com\">Contented "
"Designs</a>"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:99
msgid "Contact"
msgstr "Kontakt"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:14
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "Edit"
msgstr "Edycja"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:16
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:31
msgid "History"
msgstr "Histora"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "New Article"
msgstr "Nowy artykuł"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:29
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:5
msgid "Back to page"
msgstr "Powrót do strony"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:68
msgid "Edit this version (rollback)"
msgstr "Edycja tej wersji (przywrócenie)"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:73
msgid "(version {1,num}, from {2,dt=s})"
msgstr "(wersja {1,ord}, z {2,dt=s})"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:78
msgid "Difference \"{1}\" ver. {2} versus ver. {3}"
msgstr "Różnica \"{1}\" w. {2} w stosunku do w. {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:80
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:82
msgid "Edit version {1,num}"
msgstr "Edycja wersji {1,num}"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:99
msgid "No such page or version exist"
msgstr "Wybrana strona lub wersja nie istnieje"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:101
msgid "No difference between these versions"
msgstr "Brak różnic między tymi wersjami"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:104
msgid "Titles"
msgstr "Tytuły"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:106
msgid "Version {1}"
msgstr "Wersja {1}"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:3
msgid "WikiPP :: History"
msgstr "WikiPP :: Historia"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:14
msgid "Version {1,num}, changed at {2,dt=s}, by {3}"
msgstr "Wersja {1,num}, zmieniona {2,dt=s}, przez {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:15
msgid "Show"
msgstr "Pokaż"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:16
msgid "Edit (rollback)"
msgstr "Edytuj (przywróć)"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:17
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:33
msgid "Diff to previous"
msgstr "Różnice z poprzednią"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:23
msgid "History is empty"
msgstr "Historia jest pusta"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:25
msgid "Next page"
msgstr "Następna strona"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:3
msgid "WikiPP :: Login"
msgstr "WikiPP :: Logowanie"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:11
msgid "Register as new user"
msgstr "Rejestracja jako nowy użytkownik"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:16
msgid "WikiPP :: Register"
msgstr "WikiPP :: Rejestracja"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:38
msgid "WikiPP :: Edit Options"
msgstr "WikiPP :: Edycja opcji"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:4
msgid "Index of Articles"
msgstr "Index artykułów"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:26
msgid "Recent Changes"
msgstr "Ostatnie zmiany"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:32
msgid "version {1,num}, at {2,dt=s}, by {3}"
msgstr "wersja {1,num}, z {2,dt=s}, przez {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:38
msgid "Next Page"
msgstr "Następna strona"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:40
msgid "No more changes"
msgstr "Nie ma więcej zmian"

307
po/ru.po Normal file
View file

@ -0,0 +1,307 @@
# translation of ru.po to Hebrew
# translation of he.po to
# translation of wikipp.po to
# Hebrew Translation.
# Copyright (C) YEAR Artyom Tonkikh
# This file is distributed under the same license as the wikipp package.
#
# Artyom Tonkikg <artyomtnk@yahoo.com>, 2008.
# artik <artyomtnk@yahoo.com>, 2008, 2009, 2010, 2012.
msgid ""
msgstr ""
"Project-Id-Version: ru\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-02-01 13:06+0200\n"
"PO-Revision-Date: 2012-02-01 13:09+0200\n"
"Last-Translator: Artyom <artyomtnk@yahoo.com>\n"
"Language-Team: Hebrew <>\n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.2\n"
"X-Poedit-Language: Russian\n"
"X-Poedit-Country: RUSSIAN FEDERATION\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: master.cpp:110
msgid "LANG"
msgstr "Русский"
#: options.cpp:14
msgid "Users Only"
msgstr "Только для пользователей"
#: options.cpp:15
msgid "Contact e-mail"
msgstr "Контактный e-mail"
#: options.cpp:16
msgid "Wiki Title"
msgstr "Wiki Заголовок"
#: options.cpp:17
msgid "About Wiki"
msgstr "О Wiki"
#: options.cpp:18
msgid "Copyright String"
msgstr "Строка копирайта"
#: options.cpp:19 users.cpp:45
msgid "Submit"
msgstr "Отправить"
#: options.cpp:32
msgid "Disable creation of new articles by visitors"
msgstr "Отключить создание новых статей посетителями"
#: options.cpp:110
msgid "Wiki++ - CppCMS Wiki"
msgstr "Wiki++ - CppCMS Вики"
#: options.cpp:113
msgid ""
"## About\n"
"\n"
"Wiki++ is a wiki engine powered by\n"
"[CppCMS](http://cppcms.sf.net/) web development framework.\n"
msgstr ""
"## Обшие сведения\n"
"\n"
"Wiki++ - это wiki-движок, основанный на\n"
"[CppCMS](http://cppcms.sf.net/) фрэймворке веб-разработки.\n"
#: options.cpp:118
msgid "(C) All Rights Reserved"
msgstr "(C) Все права защищены"
#: page.cpp:17
msgid "Title"
msgstr "Заголовок"
#: page.cpp:18 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:111
msgid "Content"
msgstr "Содержимое"
#: page.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:115
msgid "Sidebar"
msgstr "Панель"
#: page.cpp:20
msgid "Save"
msgstr "Сохранить"
#: page.cpp:21
msgid "Save and Continue"
msgstr "Сохранить и продолжить"
#: page.cpp:22
msgid "Preview"
msgstr "Просмотр"
#: page.cpp:32
msgid "Disable editing by visitors"
msgstr "Отключить правку посетителями"
#: page.cpp:33
msgid "Please Login"
msgstr "Войдите пожалуйста"
#: users.cpp:17 users.cpp:41
msgid "Username"
msgstr "Имя пользователя"
#: users.cpp:18 users.cpp:42
msgid "Password"
msgstr "Пароль"
#: users.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:65
msgid "Login"
msgstr "Логин"
#: users.cpp:43
msgid "Confirm"
msgstr "Подтвердить"
#: users.cpp:44
msgid "Solve"
msgstr "Решить"
#: users.cpp:79
msgid "This user exists"
msgstr "Такой пользователь существует"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:5
msgid "Wellcome to WikiPP"
msgstr "Добро пожаловать в WikiPP"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:9
msgid " Users Area"
msgstr "Область пользователей"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:14
msgid "Navigation"
msgstr "Навигация"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:16
msgid "Index"
msgstr "Список"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:17
msgid "Changes"
msgstr "Изменения"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:20
msgid "Main Page"
msgstr "Главная страница"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:42
msgid "LTR"
msgstr "LTR"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:68
msgid "Logout "
msgstr "Выйти "
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:78
msgid "Main"
msgstr "Главная"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:90
msgid "Valid CSS"
msgstr "Валидация CSS"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:91
msgid "Valid XHTML 1.0"
msgstr "Валидация XHTML 1.0"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:96
msgid ""
"Template design based on <a href=\"http://ContentedDesigns.com\">Contented "
"Designs</a>"
msgstr ""
"Дизайн шаблонов основан на <a href=\"http://ContentedDesigns.com\"> "
"Contented Designs</a>"
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:99
msgid "Contact"
msgstr "Контакты"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:14
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "Edit"
msgstr "Правка"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:16
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:31
msgid "History"
msgstr "История"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "New Article"
msgstr "Новая статья"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:29
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:5
msgid "Back to page"
msgstr "Вернуться к странице"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:68
msgid "Edit this version (rollback)"
msgstr "Редактировать это версию (откат)"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:73
msgid "(version {1,num}, from {2,dt=s})"
msgstr "(версия {1,num}, от {2,dt=s})"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:78
msgid "Difference \"{1}\" ver. {2} versus ver. {3}"
msgstr "Отличия \"{1}\" вер. {2} сравн. вер. {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:80
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:82
msgid "Edit version {1,num}"
msgstr "Правка версии {1,num}"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:99
msgid "No such page or version exist"
msgstr "Такой страницы или версии не существует"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:101
msgid "No difference between these versions"
msgstr "Нет различий между этими версиями"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:104
msgid "Titles"
msgstr "Заголовки"
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:106
msgid "Version {1}"
msgstr "Версия {1}"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:3
msgid "WikiPP :: History"
msgstr "WikiPP :: История"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:14
msgid "Version {1,num}, changed at {2,dt=s}, by {3}"
msgstr "Версия {1,num}, изменена {2,dt=s}, {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:15
msgid "Show"
msgstr "Показать"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:16
msgid "Edit (rollback)"
msgstr "Правка (откат)"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:17
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:33
msgid "Diff to previous"
msgstr "Различия с прежним"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:23
msgid "History is empty"
msgstr "История пуста"
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:25
msgid "Next page"
msgstr "Следующая страница"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:3
msgid "WikiPP :: Login"
msgstr "WikiPP :: Вход"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:11
msgid "Register as new user"
msgstr "Зарегистрируйтесь как новый пользователь"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:16
msgid "WikiPP :: Register"
msgstr "WikiPP :: Регистрация"
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:38
msgid "WikiPP :: Edit Options"
msgstr "WikiPP :: Редактировать опции"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:4
msgid "Index of Articles"
msgstr "Список статей"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:26
msgid "Recent Changes"
msgstr "Последние Изменения"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:32
msgid "version {1,num}, at {2,dt=s}, by {3}"
msgstr "версия {1,num}, от {2,dt=s}, {3}"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:38
msgid "Next Page"
msgstr "Следующая страница"
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:40
msgid "No more changes"
msgstr "Больше нет изменений"

293
po/wikipp.pot Normal file
View file

@ -0,0 +1,293 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-02-01 13:06+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: master.cpp:110
msgid "LANG"
msgstr ""
#: options.cpp:14
msgid "Users Only"
msgstr ""
#: options.cpp:15
msgid "Contact e-mail"
msgstr ""
#: options.cpp:16
msgid "Wiki Title"
msgstr ""
#: options.cpp:17
msgid "About Wiki"
msgstr ""
#: options.cpp:18
msgid "Copyright String"
msgstr ""
#: options.cpp:19 users.cpp:45
msgid "Submit"
msgstr ""
#: options.cpp:32
msgid "Disable creation of new articles by visitors"
msgstr ""
#: options.cpp:110
msgid "Wiki++ - CppCMS Wiki"
msgstr ""
#: options.cpp:113
msgid ""
"## About\n"
"\n"
"Wiki++ is a wiki engine powered by\n"
"[CppCMS](http://cppcms.sf.net/) web development framework.\n"
msgstr ""
#: options.cpp:118
msgid "(C) All Rights Reserved"
msgstr ""
#: page.cpp:17
msgid "Title"
msgstr ""
#: page.cpp:18 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:111
msgid "Content"
msgstr ""
#: page.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:115
msgid "Sidebar"
msgstr ""
#: page.cpp:20
msgid "Save"
msgstr ""
#: page.cpp:21
msgid "Save and Continue"
msgstr ""
#: page.cpp:22
msgid "Preview"
msgstr ""
#: page.cpp:32
msgid "Disable editing by visitors"
msgstr ""
#: page.cpp:33
msgid "Please Login"
msgstr ""
#: users.cpp:17 users.cpp:41
msgid "Username"
msgstr ""
#: users.cpp:18 users.cpp:42
msgid "Password"
msgstr ""
#: users.cpp:19 /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:65
msgid "Login"
msgstr ""
#: users.cpp:43
msgid "Confirm"
msgstr ""
#: users.cpp:44
msgid "Solve"
msgstr ""
#: users.cpp:79
msgid "This user exists"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:5
msgid "Wellcome to WikiPP"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:9
msgid " Users Area"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:14
msgid "Navigation"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:16
msgid "Index"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:17
msgid "Changes"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:20
msgid "Main Page"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:42
msgid "LTR"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:68
msgid "Logout "
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:78
msgid "Main"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:90
msgid "Valid CSS"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:91
msgid "Valid XHTML 1.0"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:96
msgid ""
"Template design based on <a href=\"http://ContentedDesigns.com\">Contented "
"Designs</a>"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/main.tmpl:99
msgid "Contact"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:14
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "Edit"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:16
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:31
msgid "History"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:26
msgid "New Article"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:29
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:5
msgid "Back to page"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:68
msgid "Edit this version (rollback)"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:73
msgid "(version {1,num}, from {2,dt=s})"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:78
msgid "Difference \"{1}\" ver. {2} versus ver. {3}"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:80
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:82
msgid "Edit version {1,num}"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:99
msgid "No such page or version exist"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:101
msgid "No difference between these versions"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:104
msgid "Titles"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/page.tmpl:106
msgid "Version {1}"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:3
msgid "WikiPP :: History"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:14
msgid "Version {1,num}, changed at {2,dt=s}, by {3}"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:15
msgid "Show"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:16
msgid "Edit (rollback)"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:17
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:33
msgid "Diff to previous"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:23
msgid "History is empty"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/hist.tmpl:25
msgid "Next page"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:3
msgid "WikiPP :: Login"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:11
msgid "Register as new user"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:16
msgid "WikiPP :: Register"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/admin.tmpl:38
msgid "WikiPP :: Edit Options"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:4
msgid "Index of Articles"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:26
msgid "Recent Changes"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:32
msgid "version {1,num}, at {2,dt=s}, by {3}"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:38
msgid "Next Page"
msgstr ""
#: /home/artik/Projects/cppcms/wikipp/templates/toc.tmpl:40
msgid "No more changes"
msgstr ""

103
sample_config.js Normal file
View file

@ -0,0 +1,103 @@
{
"wikipp" : {
"script" : "/wikipp",
"media" :"/media/",
//
// Set a path to hightligher to enable it
//
// "syntax_highlighter" : "/media/sh",
//
"disable_registration" : false,
"languages" : {
"en" : "en_US.UTF-8" ,
"he" : "he_IL.UTF-8" ,
"ru" : "ru_RU.UTF-8" ,
"pl" : "pl_PL.UTF-8"
},
//
// Setup connection string for DB
//
// Sqlite3 Sample Connection String
//"connection_string" : "sqlite3:db=/var/wikipp/db/wikipp.db;@pool_size=16",
//
// PostgreSQL Sample Connection String
// "connection_string" : "postgresql:dbname=wikipp;@pool_size=16",
//
// MySQL Sample Connection String
//
// "connection_string" : "mysql:database=wikipp;user=root;password=root;@pool_size=16",
//
// In Some cases mysql works faster without prepared statements as it uses query cache, so you
// may change this string to:
//
// "connection_string" : "mysql:database=wikipp;user=root;password=root;@pool_size=16;@use_prepared=off",
//
},
"service" : {
"api" : "fastcgi",
"socket" : "stdin"
},
"session" : {
"expire" : "renew",
"location" : "client",
"timeout" : 2592000, // One month 24*3600*30
"cookies" : {
"prefix" : "wikipp"
},
"client" : {
"cbc" : "aes",
"hmac" : "sha1",
// setup these values using
//
// cppcms_make_key --hmac sha1 --cbc aes
//
// "cbc_key" : "Generate your own!",
// "hmac_key" : "Generate your own"
}
},
"views" : {
"paths" : [ "/usr/lib/wikipp"] ,
"skins" : [ "view" ] ,
},
"localization" : {
"messages" : {
"paths" : [ "/usr/share/locale"],
"domains" : [ "wikipp" ]
},
"locales" : [
"he_IL.UTF-8" ,
"en_US.UTF-8",
"ru_RU.UTF-8",
"pl_PL.UTF-8"
]
},
"logging" : {
"level" : "info",
//"syslog" : {
// "enable": true,
// "id" : "WikiPP"
//},
//"file" : {
// "name" : "/var/log/wikipp/wikipp.log",
// "append" : true
//}
},
"cache" : {
"backend" : "thread_shared",
"limit" : 100, // items - thread cache
},
"security" : {
"csrf" : { "enable" : true }
}
}

46
sql/mysql.sql Normal file
View file

@ -0,0 +1,46 @@
drop table if exists history;
drop table if exists pages;
drop table if exists connections;
drop table if exists users;
drop table if exists options;
create table options (
lang varchar(16) not null,
name varchar(32) not null,
value text not null,
constraint unique(lang,name)
) Engine = InnoDB;
create table users (
id integer auto_increment primary key not null,
username varchar(32) unique not null,
password varchar(32) not null
) Engine = InnoDB;
create table pages (
id integer auto_increment primary key not null,
lang varchar(16) not null,
slug varchar(128) not null,
title varchar(256) not null,
content text not null,
sidebar text not null,
users_only integer not null,
constraint unique (lang,slug)
) Engine = InnoDB;
create table history (
id integer not null,
version integer not null,
created datetime not null,
author varchar(32) not null,
title varchar(256) not null,
content text not null,
sidebar text not null,
constraint unique(id,version),
foreign key(id) references pages(id),
primary key(id,version)
) Engine = InnoDB;
create index history_timeline on history(created);

50
sql/postgresql.sql Normal file
View file

@ -0,0 +1,50 @@
begin;
drop table if exists history;
drop table if exists pages;
drop table if exists users;
drop table if exists options;
create table options (
lang varchar(16) not null,
name varchar(32) not null,
value text not null,
unique(lang,name)
);
create table users (
id serial primary key not null,
username varchar(32) unique not null,
password varchar(32) not null
) ;
create table pages (
id serial primary key not null,
lang varchar(16) not null,
slug varchar(128) not null,
title varchar(256) not null,
content text not null,
sidebar text not null,
users_only integer not null,
unique (lang,slug)
);
create table history (
id integer not null,
version integer not null,
created timestamp not null,
author varchar(32) not null,
title varchar(256) not null,
content text not null,
sidebar text not null,
unique(id,version),
foreign key(id) references pages(id),
primary key(id,version)
);
create index history_timeline on history(created);
commit;

46
sql/sqlite3.sql Normal file
View file

@ -0,0 +1,46 @@
begin;
drop table if exists history;
drop table if exists pages;
drop table if exists users;
drop table if exists options;
create table options (
lang varchar(16) not null,
name varchar(32) not null,
value text not null,
unique(lang,name)
);
create table users (
id integer primary key autoincrement not null,
username varchar(32) unique not null,
password varchar(32) not null
) ;
create table pages (
id integer primary key autoincrement not null,
lang varchar(16) not null,
slug varchar(128) not null,
title varchar(256) not null,
content text not null,
sidebar text not null,
users_only integer not null,
unique (lang,slug)
);
create table history (
id integer not null,
version integer not null,
created datetime not null,
author varchar(32) not null,
title varchar(256) not null,
content text not null,
sidebar text not null,
unique(id,version),
primary key(id,version)
);
create index history_timeline on history(created);
commit;

11
src/content.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef CONTENT_H
#define CONTENT_H
#include <cstring>
#include "master_content.h"
#include "users_content.h"
#include "page_content.h"
#include "index_content.h"
#include "options_content.h"
#endif

73
src/diff.h Normal file
View file

@ -0,0 +1,73 @@
#ifndef DIFF_H
#define DIFF_H
#include <vector>
#include <string>
namespace diff {
typedef std::vector<std::vector<int> > diff_matrix;
template<typename element>
diff_matrix lcs_length(std::vector<element> const &X,std::vector<element> const &Y)
{
int m=X.size();
int n=Y.size();
diff_matrix C(m+1,std::vector<int>(n+1,0));
int i,j;
for(i=1;i<=m;i++) {
for(j=1;j<=n;j++) {
if(X[i-1]==Y[j-1]) {
C[i][j]=C[i-1][j-1]+1;
}
else {
C[i][j]=std::max(C[i][j-1],C[i-1][j]);
}
}
}
return C;
}
template<typename element,typename CNT>
void print_diff(diff_matrix const &C,std::vector<element> const &X,std::vector<element> const &Y,int i,int j,CNT &out)
{
if(i>0 && j>0 && X[i-1]==Y[j-1]){
print_diff(C,X,Y,i-1,j-1,out);
out.push_back(make_pair(0,X[i-1]));
}
else {
if(j>0 && (i==0 || C[i][j-1] >= C[i-1][j])){
print_diff(C,X,Y,i,j-1,out);
out.push_back(make_pair(1,Y[j-1]));
}
else if(i > 0 && (j == 0 || C[i][j-1] < C[i-1][j])) {
print_diff(C,X,Y,i-1,j,out);
out.push_back(make_pair(-1,X[i-1]));
}
}
}
template<typename element,typename CNT>
void diff(std::vector<element> const &X,std::vector<element> const &Y,CNT &out)
{
diff_matrix C=diff::lcs_length(X,Y);
print_diff(C,X,Y,X.size(),Y.size(),out);
}
} // namespace diff
std::vector<std::string> split(std::string const &s)
{
std::vector<std::string> res;
size_t pos=0,pos2=0;
while((pos2=s.find('\n',pos))!=std::string::npos) {
res.push_back(s.substr(pos,pos2-pos));
pos=pos2+1;
}
res.push_back(s.substr(pos));
return res;
}
#endif

114
src/index.cpp Normal file
View file

@ -0,0 +1,114 @@
#include "index.h"
#include "index_content.h"
#include "wiki.h"
#include <cppcms/cache_interface.h>
#include <cppcms/url_dispatcher.h>
namespace apps {
index::index(wiki &w):
master(w)
{
wi.dispatcher().assign("^/index/?",&index::display_index,this);
wi.dispatcher().assign("^/changes(/?|/(\\d+))$",&index::changes,this,2);
}
std::string index::index_url()
{
return wi.root()+"/index/";
}
std::string index::changes_url(int p)
{
if(p==0)
return wi.root()+"/changes/";
return wi.root()+(booster::locale::format("/changes/{1}") % p).str();
}
void index::changes(std::string page_no)
{
std::string key=locale_name+"_changes_"+page_no;
if(cache().fetch_page(key))
return;
int p;
const unsigned window=30;
if(page_no.empty())
p=0;
else
p=atoi(page_no.c_str());
cppdb::result rs;
cppdb::session sql(conn);
rs = sql<<
"SELECT history.title,history.version,history.created,"
" history.author,pages.lang,pages.slug "
"FROM history "
"JOIN pages ON history.id=pages.id "
"ORDER BY created DESC "
"LIMIT ? "
"OFFSET ?"
<< window << p*window;
content::recent_changes c;
c.content;
int n;
for(n=0;rs.next();n++) {
c.content.push_back(content::recent_changes::element());
content::recent_changes::element &d=c.content.back();
std::string lang,slug;
std::tm created;
rs>>d.title>>d.version>>created>>d.author>>lang>>slug;
d.created = mktime(&created);
d.url=wi.page.page_version_url(d.version,lang,slug);
if(d.version>1)
d.diff_url=wi.page.diff_url(d.version-1,d.version,lang,slug);
}
if(c.content.size()==window)
c.next=changes_url(p+1);
ini(c);
render("recent_changes",c);
cache().store_page(key,60);
// Cache changes for at most 30 sec
// Generally -- prevent cache drop with frequent updates
}
void index::display_index()
{
std::string key=locale_name+"_toc_index";
if(cache().fetch_page(key))
return;
content::toc c;
ini(c);
cppdb::result r;
cppdb::session sql(conn);
r=sql<< "SELECT slug,title FROM pages "
"WHERE lang=? "
"ORDER BY title ASC" << locale_name;
std::string letter="";
typedef std::multimap<std::string,std::string,std::locale> mapping_type;
mapping_type mapping(context().locale());
while(r.next()) {
std::string slug,t;
r >> slug >> t;
mapping.insert(std::pair<std::string,std::string>(t,slug));
}
unsigned items=mapping.size();
unsigned items_left=items/3;
unsigned items_mid=items*2/3;
mapping_type::iterator p=mapping.begin();
int rows_no = (mapping.size() +2)/3;
c.table.resize(rows_no,std::vector<content::toc::element>(3));
for(unsigned i=0;p!=mapping.end();i++,++p) {
int col = i / rows_no;
int row = i % rows_no;
content::toc::element &e = c.table.at(row).at(col);
e.title = p->first;
e.url=wi.page.page_url(locale_name,p->second);
}
render("toc",c);
cache().store_page(key,30);
// Cache TOC for at most 30 seconds
}
}

22
src/index.h Normal file
View file

@ -0,0 +1,22 @@
#ifndef INDEX_H
#define INDEX_H
#include "master.h"
namespace apps {
class wiki;
class index : public master {
void changes(std::string);
void display_index();
public:
index(wiki &);
std::string index_url();
std::string changes_url(int n=0);
};
}
#endif

34
src/index_content.h Normal file
View file

@ -0,0 +1,34 @@
#ifndef INDEX_CONTENT_H
#define INDEX_CONTENT_H
#include "master_content.h"
namespace content {
struct toc : public master {
struct element {
std::string title;
std::string url;
};
typedef std::vector<std::vector<element> > table_type;
table_type table;
};
struct recent_changes : public master {
struct element {
std::string title;
int version;
time_t created;
std::string author;
std::string url;
std::string diff_url;
};
std::vector<element> content;
std::string next;
};
} // namespace content
#endif

19
src/main.cpp Normal file
View file

@ -0,0 +1,19 @@
#include <cppcms/service.h>
#include <cppcms/applications_pool.h>
#include <booster/log.h>
#include "wiki.h"
int main(int argc,char **argv)
{
try {
cppcms::service app(argc,argv);
app.applications_pool().mount(cppcms::applications_factory<apps::wiki>());
app.run();
}
catch(std::exception const &e) {
BOOSTER_ERROR("wikipp") << e.what() ;
std::cerr<<e.what()<<std::endl;
return 1;
}
return 0;
}

72
src/markdown.cpp Normal file
View file

@ -0,0 +1,72 @@
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <stdexcept>
#include "markdown.h"
extern "C" {
#include <mkdio.h>
}
std::string markdown_to_html(char const *str,int len,int flags)
{
/// It is safe to const cast as mkd_string does not
/// alter original string
MMIOT *doc = mkd_string(const_cast<char *>(str),len,flags);
if(!doc) {
throw std::runtime_error("Failed to read document");
}
mkd_compile(doc,flags);
std::string result;
result.reserve(len);
char *content_ptr = 0;
int content_size = 0;
char *toc_ptr = 0;
int toc_size = 0;
content_size = mkd_document(doc,&content_ptr);
if(flags & mkd::toc) {
toc_size = mkd_toc(doc,&toc_ptr);
result.assign(toc_ptr,toc_size);
}
result.append(content_ptr,content_size);
free(toc_ptr);
mkd_cleanup(doc);
return result;
}
std::string markdown_format_for_highlighting(std::string const &input,std::string const &html_class)
{
enum { part_a , part_b } state = part_a;
std::string repla = "<pre name=\"code\" class=\"" + html_class + "\">";
std::string replb = "</pre>";
std::string origa="<pre><code>";
std::string origb="</code></pre>";
std::string result;
result.reserve(input.size());
size_t pos = 0;
while(pos < input.size()) {
std::string const &orig = state == part_a ? origa : origb;
std::string const &repl = state == part_a ? repla : replb;
size_t next = input.find(orig,pos);
if(next == std::string::npos)
next = input.size();
result.append(input.data() + pos, next - pos);
if(next < input.size()) {
result.append(repl);
pos = next + orig.size();
if(state == part_a)
state = part_b;
else
state = part_a;
}
else {
pos = next;
}
}
return result;
}

33
src/markdown.h Normal file
View file

@ -0,0 +1,33 @@
#ifndef WIKIPP_MARKDOWN_H
#define WIKIPP_MARKDOWN_H
#include <string>
namespace mkd {
static const int no_links = 0x0001; // don't do link processing, block <a> tags
static const int no_image = 0x0002; // don't do image processing, block <img>
static const int no_pants = 0x0004; // don't run smartypants()
static const int no_html = 0x0008; // don't allow raw html through at all
static const int strict = 0x0010; // disable superscript, relaxed_emphasis
static const int tagtext = 0x0020; // process text inside an html tag; no
// <em>, no <bold>, no html or [] expansion
static const int no_ext = 0x0040; // don't allow pseudo-protocols
static const int cdata = 0x0080; // generate code for xml ![cdata[...]]
static const int no_tables = 0x0400; // disallow tables
static const int toc = 0x1000; // do table-of-contents processing
static const int compat = 0x2000; // compatability with markdowntest_1.0
static const int autolink = 0x4000; // make http://foo.com link even without <>s
static const int safelink = 0x8000; // paranoid check for link protocol
static const int embed = no_links|no_image|tagtext;
static const int no_header = 0x0100; // don't process header blocks
static const int tabstop = 0x0200; // expand tabs to 4 spaces
};
std::string markdown_to_html(char const *str,int len,int flags);
std::string markdown_format_for_highlighting(std::string const &,std::string const &html_class);
#endif

143
src/master.cpp Normal file
View file

@ -0,0 +1,143 @@
#include "wiki.h"
#include "master.h"
#include "master_content.h"
#include "markdown.h"
#include <cppcms/localization.h>
#include <cppcms/service.h>
#include <cppcms/xss.h>
#define _(X) ::cppcms::locale::translate(X)
#define N_(S,P,N) ::cppcms::locale::translate(S,P,N)
namespace {
cppcms::xss::rules const &xss_filter()
{
static cppcms::xss::rules r;
static bool initialized = false;
if(initialized)
return r;
using namespace cppcms::xss;
r.html(rules::xhtml_input);
r.add_tag("ol",rules::opening_and_closing);
r.add_tag("ul",rules::opening_and_closing);
r.add_tag("li",rules::opening_and_closing);
r.add_tag("p",rules::opening_and_closing);
r.add_property("p","style",booster::regex("\\s*text-align\\s*:\\s*(center|left|right)\\s*;?"));
r.add_tag("b",rules::opening_and_closing);
r.add_tag("i",rules::opening_and_closing);
r.add_tag("tt",rules::opening_and_closing);
r.add_tag("sub",rules::opening_and_closing);
r.add_tag("sup",rules::opening_and_closing);
r.add_tag("blockquote",rules::opening_and_closing);
r.add_tag("strong",rules::opening_and_closing);
r.add_tag("em",rules::opening_and_closing);
r.add_tag("h1",rules::opening_and_closing);
r.add_tag("h2",rules::opening_and_closing);
r.add_tag("h3",rules::opening_and_closing);
r.add_tag("h4",rules::opening_and_closing);
r.add_tag("h5",rules::opening_and_closing);
r.add_tag("h6",rules::opening_and_closing);
booster::regex cl_id(".*");
r.add_property("h1","id",cl_id);
r.add_property("h2","id",cl_id);
r.add_property("h3","id",cl_id);
r.add_property("h4","id",cl_id);
r.add_property("h5","id",cl_id);
r.add_property("h6","id",cl_id);
r.add_tag("span",rules::opening_and_closing);
r.add_property("span","id",cl_id);
r.add_tag("code",rules::opening_and_closing);
r.add_tag("pre",rules::opening_and_closing);
r.add_property("pre","name",booster::regex("\\w+"));
r.add_property("pre","class",booster::regex("\\w+"));
r.add_tag("a",rules::opening_and_closing);
r.add_uri_property("a","href");
r.add_tag("hr",rules::stand_alone);
r.add_tag("br",rules::stand_alone);
r.add_tag("img",rules::stand_alone);
r.add_uri_property("img","src");
r.add_integer_property("img","width");
r.add_integer_property("img","height");
r.add_integer_property("img","border");
r.add_property("img","alt",booster::regex(".*"));
r.add_tag("table",rules::opening_and_closing);
r.add_tag("tr",rules::opening_and_closing);
r.add_tag("th",rules::opening_and_closing);
r.add_tag("td",rules::opening_and_closing);
r.add_integer_property("table","cellpadding");
r.add_integer_property("table","cellspacing");
r.add_integer_property("table","border");
r.add_tag("center",rules::opening_and_closing);
r.add_entity("nbsp");
r.encoding("UTF-8");
r.comments_allowed(true);
initialized = true;
return r;
}
struct init_it { init_it() { xss_filter(); } } instance;
}
std::string mymarkdown(std::string const &s)
{
int flags = mkd::no_pants;
if(s.compare(0,10,"<!--toc-->")==0) {
flags |= mkd::toc;
}
std::string html = markdown_format_for_highlighting(markdown_to_html(s.c_str(),s.size(),flags),"cpp");
return cppcms::xss::filter(html,xss_filter(),cppcms::xss::escape_invalid);
}
namespace apps {
master::master(wiki &_w) :
application(_w.service()),
wi(_w),
locale_name(wi.locale_name)
{
conn = wi.conn;
cppcms::json::object langs=settings().get("wikipp.languages",cppcms::json::object());
for(cppcms::json::object::const_iterator p=langs.begin(),e=langs.end();p!=e;++p) {
std::string lname;
if(p->first=="en")
lname="English";
else {
/// Translate as the target language
/// for fr gettext("LANG")="Francis"
lname=_("LANG").str(service().generator().generate(p->second.str()));
if(lname=="LANG") {
lname=p->first;
}
}
languages[lname]=settings().get<std::string>("wikipp.script") +"/"+ p->first.str();
}
media=settings().get<std::string>("wikipp.media");
syntax_highlighter=settings().get("wikipp.syntax_highlighter","");
cookie_prefix=settings().get("session.cookies.prefix","cppcms_session")+"_";
}
void master::ini(content::master &c)
{
wi.options.load();
c.markdown = mymarkdown;
c.media=media;
c.syntax_highlighter=syntax_highlighter;
c.cookie_prefix=cookie_prefix;
c.main_link=wi.page.default_page_url();
c.main_local=wi.page.default_page_url(locale_name);
c.toc=wi.index.index_url();
c.changes=wi.index.changes_url();
c.login_link=wi.users.login_url();
c.wiki_title=wi.options.local.title;
c.about=wi.options.local.about;
c.copyright=wi.options.local.copyright;
c.contact=wi.options.global.contact;
c.edit_options=wi.options.edit_url();
c.languages=languages;
}
}

33
src/master.h Normal file
View file

@ -0,0 +1,33 @@
#ifndef MASTER_H
#define MASTER_H
#include <cppcms/application.h>
#include <map>
namespace content { class master; }
namespace cppdb { class session; }
namespace apps {
class wiki;
class master : public cppcms::application {
protected:
wiki &wi;
std::string conn;
std::string &locale_name;
std::map<std::string,std::string> languages;
public:
master(wiki &w);
void ini(content::master &);
private:
std::string media;
std::string syntax_highlighter;
std::string cookie_prefix;
};
} // namespace wiki
#endif

31
src/master_content.h Normal file
View file

@ -0,0 +1,31 @@
#ifndef MASTER_DATA_H
#define MASTER_DATA_H
#include <cppcms/view.h>
#include <cppcms/form.h>
#include <booster/function.h>
#include <string>
namespace apps { class wiki; }
namespace content {
struct master : public cppcms::base_content {
std::string media;
std::string syntax_highlighter;
std::string cookie_prefix;
std::string main_link;
std::string main_local;
std::string login_link;
std::string toc;
std::string changes;
std::string edit_options;
std::string contact;
std::string wiki_title,about,copyright;
std::map<std::string,std::string> languages;
booster::function<std::string(std::string const &)> markdown;
};
}
#endif

83
src/migrate.cpp Normal file
View file

@ -0,0 +1,83 @@
#include <cppdb/frontend.h>
#include <iostream>
int main(int argc,char **argv)
{
if(argc!=3) {
std::cerr << "Wikipp database migration utility - allows to convert database from one\n"
"engine to another. It supports: postgresql, mysql, sqlite3\n"
"\n"
"To use, create a new database using provided sql scripts and then run\n"
"$ wikipp_migrate source_connection_string target_connection_string\n"
<< std::endl;
return 1;
}
std::string cs_src = argv[1];
std::string cs_tgt = argv[2];
try {
using namespace cppdb;
session src(cs_src);
session tgt(cs_tgt);
transaction tr_src(src);
transaction tr_tgt(tgt);
result r;
statement st;
r = src << "SELECT lang,name,value FROM options";
st = tgt<<"INSERT into options(lang,name,value) values(?,?,?)";
while(r.next()) {
std::string l,n,v;
r>>l>>n>>v;
st << l << n << v;
st.exec();
st.reset();
}
r = src << "SELECT id, username, password FROM users";
st = tgt << "INSERT into users(id,username,password) values(?,?,?)";
while(r.next()) {
std::string id,user,pass;
r >> id >> user >> pass;
st << id << user << pass;
st.exec();
st.reset();
}
r = src << "SELECT id, lang, slug, title, content, sidebar, users_only FROM pages";
st = tgt << "INSERT into pages(id, lang, slug, title, content, sidebar, users_only) values(?,?,?,?,?,?,?)";
while(r.next()) {
long long id;
int users_only;
std::string lang, slug, title, content, sidebar;
r >> id >> lang >> slug >> title >> content >> sidebar >> users_only;
st << id << lang << slug << title << content << sidebar << users_only;
st.exec();
st.reset();
}
r = src << "SELECT id, version, created, author, title, content, sidebar FROM history ";
st = tgt << "INSERT INTO history(id, version, created, author, title, content, sidebar) VALUES(?,?,?,?,?,?,?)";
while(r.next()) {
long long id,version;
std::tm created;
std::string a,t,c,side;
r >> id >> version >> created >> a >> t >> c >> side;
st << id << version << created << a << t << c << side;
st.exec();
st.reset();
}
if(tgt.engine()=="postgresql") {
tgt<<"SELECT setval('users_id_seq',(SELECT max(id) FROM users))" << row;
tgt<<"SELECT setval('pages_id_seq',(SELECT max(id) FROM pages))" << row;
}
tr_src.commit();
tr_tgt.commit();
}
catch(std::exception const &e) {
std::cerr <<"Failed " << e.what() << std::endl;
return 1;
}
return 0;
}

180
src/options.cpp Normal file
View file

@ -0,0 +1,180 @@
#include "options.h"
#include "wiki.h"
#include "options_content.h"
#include <cppcms/localization.h>
#include <cppcms/url_dispatcher.h>
#include <cppcms/cache_interface.h>
#include <cppcms/serialization.h>
#define _(X) ::cppcms::locale::translate(X)
namespace content {
options_form::options_form()
{
users_only.message(_("Users Only"));
contact_mail.message(_("Contact e-mail"));
wiki_title.message(_("Wiki Title"));
about.message(_("About Wiki"));
copyright.message(_("Copyright String"));
submit.value(_("Submit"));
add(users_only);
add(contact_mail);
add(wiki_title);
add(copyright);
add(about);
add(submit);
wiki_title.non_empty();
copyright.non_empty();
contact_mail.non_empty();
about.non_empty();
about.rows(10);
about.cols(40);
users_only.help(_("Disable creation of new articles by visitors"));
}
} // namespace content
namespace apps {
void global_options::serialize(cppcms::archive &a)
{
a & users_only_edit & contact;
}
void locale_options::serialize(cppcms::archive &a)
{
a & title & about & copyright ;
}
options::options(wiki &w):
master(w)
{
wi.dispatcher().assign("^/options/?$",&options::edit,this);
reset();
}
void options::reset()
{
loaded=false;
}
std::string options::edit_url()
{
return wi.root()+"/options/";
}
void options::load()
{
cppdb::session sql(conn);
if(loaded)
return;
global.users_only_edit=0;
global.contact.clear();
local.about.clear();
local.title.clear();
local.copyright.clear();
if(!cache().fetch_data("global_ops",global))
{
cppdb::result r;
r=sql<< "SELECT name,value FROM options "
"WHERE lang='global' ";
while(r.next()) {
std::string n,v;
r >> n >> v;
if(n=="users_only_edit")
global.users_only_edit=atoi(v.c_str());
else if(n=="contact")
global.contact=v;
}
if(global.contact.empty())
global.contact="no@mail";
cache().store_data("global_ops",global);
}
if(cache().fetch_data("local_ops:"+locale_name,local))
return;
cppdb::result r;
r=sql<< "SELECT value,name FROM options "
"WHERE lang=?" << locale_name;
while(r.next()) {
std::string v,n;
r>>v>>n;
if(n=="title")
local.title=v;
else if(n=="about")
local.about=v;
else if(n=="copyright")
local.copyright=v;
}
if(local.title.empty())
local.title=cppcms::locale::gettext("Wiki++ - CppCMS Wiki",context().locale());
if(local.about.empty())
local.about=
cppcms::locale::gettext("## About\n"
"\n"
"Wiki++ is a wiki engine powered by\n"
"[CppCMS](http://cppcms.sf.net/) web development framework.\n",context().locale());
if(local.copyright.empty())
local.copyright=cppcms::locale::gettext("(C) All Rights Reserved",context().locale());
cache().store_data("local_ops:"+locale_name,local);
loaded=true;
}
void options::save()
{
cppdb::session sql(conn);
cppdb::transaction guard(sql);
sql<< "DELETE FROM options "
"WHERE lang='global' OR lang=?"
<< locale_name << cppdb::exec;
sql<< "INSERT INTO options(value,name,lang) "
"VALUES(?,'users_only_edit','global')" << global.users_only_edit << cppdb::exec;
sql<< "INSERT INTO options(value,name,lang) "
"VALUES(?,'contact','global')" << global.contact << cppdb::exec;
sql<< "INSERT INTO options(value,name,lang) "
"VALUES(?,'title',?)" << local.title << locale_name << cppdb::exec;
sql<< "INSERT INTO options(value,name,lang) "
"VALUES(?,'about',?)" << local.about << locale_name << cppdb::exec;
sql<< "INSERT INTO options(value,name,lang) "
"VALUES(?,'copyright',?)" << local.copyright << locale_name << cppdb::exec;
cache().rise("global_ops");
cache().rise("local_ops:"+locale_name);
guard.commit();
reset();
}
void options::edit()
{
if(!wi.users.auth()) {
wi.users.error_forbidden();
return;
}
content::edit_options c;
if(request().request_method()=="POST") {
c.form.load(context());
if(c.form.validate()) {
global.users_only_edit=c.form.users_only.value();
global.contact=c.form.contact_mail.value();
local.title=c.form.wiki_title.value();
local.copyright=c.form.copyright.value();
local.about=c.form.about.value();
save();
}
}
else {
load();
c.form.users_only.value(global.users_only_edit);
c.form.wiki_title.value(local.title);
c.form.copyright.value(local.copyright);
c.form.about.value(local.about);
c.form.contact_mail.value(global.contact);
}
ini(c);
render("edit_options",c);
}
}

41
src/options.h Normal file
View file

@ -0,0 +1,41 @@
#ifndef OPTIONS_H
#define OPTIONS_H
#include "master.h"
#include <cppcms/json.h>
#include <cppcms/serialization_classes.h>
namespace apps {
struct global_options : public cppcms::serializable {
int users_only_edit;
std::string contact;
void serialize(cppcms::archive &a);
};
struct locale_options : public cppcms::serializable{
std::string title;
std::string about;
std::string copyright;
void serialize(cppcms::archive &a);
};
class options : public master {
bool loaded;
protected:
void edit();
public:
void reset();
options(apps::wiki &);
void load();
void save();
std::string edit_url();
global_options global;
locale_options local;
};
} // apps;
#endif

27
src/options_content.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef OPTIONS_CONTENT_H
#define OPTIONS_CONTENT_H
#include "master_content.h"
namespace content {
struct options_form : cppcms::form {
cppcms::widgets::checkbox users_only;
cppcms::widgets::text contact_mail;
cppcms::widgets::text wiki_title;
cppcms::widgets::textarea about;
cppcms::widgets::text copyright;
cppcms::widgets::submit submit;
options_form();
};
struct edit_options: public master {
options_form form;
};
} // namespace content
#endif

432
src/page.cpp Normal file
View file

@ -0,0 +1,432 @@
#include "page.h"
#include "page_content.h"
#include "wiki.h"
#include "diff.h"
#include <booster/posix_time.h>
#include <cppcms/url_dispatcher.h>
#include <cppcms/cache_interface.h>
#define _(X) ::cppcms::locale::translate(X)
namespace content {
// Page content
page_form::page_form(apps::wiki *_w):
w(_w)
{
title.message(_("Title"));
content.message(_("Content"));
sidebar.message(_("Sidebar"));
save.value(_("Save"));
save_cont.value(_("Save and Continue"));
preview.value(_("Preview"));
fields.add(title);
fields.add(content);
fields.add(sidebar);
buttons.add(save);
buttons.add(save_cont);
buttons.add(preview);
buttons.add(users_only);
add(fields);
add(buttons);
users_only.help(_("Disable editing by visitors"));
users_only.error_message(_("Please Login"));
title.non_empty();
content.non_empty();
content.rows(25);
content.cols(60);
sidebar.rows(10);
sidebar.cols(60);
}
bool page_form::validate()
{
bool res=form::validate();
if(users_only.value() && !w->users.auth()) {
users_only.valid(false);
users_only.value(false);
return false;
}
return res;
}
} // namespace content
namespace apps {
page::page(wiki &w):
master(w)
{
wi.dispatcher().assign("^/page/(\\w+)/version/(\\d+)$",&page::display_ver,this,1,2);
wi.dispatcher().assign("^/page/(\\w+)/?$",&page::display,this,1);
wi.dispatcher().assign("^/page/(\\w+)/edit(/version/(\\d+))?$",&page::edit,this,1,3);
wi.dispatcher().assign("^/page/(\\w+)/history(/|/(\\d+))?$",&page::history,this,1,3);
wi.dispatcher().assign("^/page/(\\w+)/diff/(\\d+)vs(\\d+)/?$",&page::diff,this,1,2,3);
}
std::string page::diff_url(int v1,int v2,std::string l,std::string s)
{
if(l.empty()) l=locale_name;
if(s.empty()) s=slug;
return wi.root(l) +
(booster::locale::format("/page/{1}/diff/{2}vs{3}") % s % v1 % v2).str();
}
std::string page::page_url(std::string l,std::string s)
{
if(l.empty()) l=locale_name;
if(s.empty()) s=slug;
return wi.root(l)+"/page/"+s;
}
std::string page::page_version_url(int ver,std::string l,std::string s)
{
if(l.empty()) l=locale_name;
if(s.empty()) s=slug;
return wi.root(l)+
(booster::locale::format("/page/{1}/version/{2}") % s % ver).str();
}
std::string page::edit_url()
{
return wi.root()+"/page/"+slug+"/edit";
}
std::string page::edit_version_url(int ver)
{
return (booster::locale::format(edit_url()+"/version/{1}") % ver).str();
}
std::string page::history_url(int n)
{
std::string u=wi.root()+"/page/"+slug+"/history/";
if(n)
u+=(booster::locale::format("{1}") % n).str();
return u;
}
void page::diff(std::string slug,std::string sv1,std::string sv2)
{
int v1=atoi(sv1.c_str()), v2=atoi(sv2.c_str());
this->slug=slug;
cppdb::session sql(conn);
cppdb::result r;
content::diff c;
c.v1=v1;
c.v2=v2;
c.edit_v1=edit_version_url(v1);
c.edit_v2=edit_version_url(v2);
r=sql<< "SELECT version,history.title,history.content,history.sidebar,pages.title FROM pages "
"JOIN history ON pages.id=history.id "
"WHERE lang=? AND slug=? AND version IN (?,?) " << locale_name << slug << v1 << v2;
std::string t1,c1,s1,t2,c2,s2;
int count=0;
while(r.next()) {
int ver;
r>>ver;
if(ver==v1) {
r>>t1>>c1>>s1>>c.title;
}
else {
r>>t2>>c2>>s2;
}
count++;
}
if(count != 2) {
c.no_versions=true;
master::ini(c);
render("diff",c);
return;
}
if(t1!=t2) {
c.title_diff=true;
c.title_1=t1;
c.title_2=t2;
}
else {
c.title=t1;
}
if(c1!=c2) {
c.content_diff=true;
std::vector<std::string> X=split(c1);
std::vector<std::string> Y=split(c2);
diff::diff(X,Y,c.content_diff_content);
}
if(s1!=s2) {
c.sidebar_diff=true;
std::vector<std::string> X=split(s1);
std::vector<std::string> Y=split(s2);
diff::diff(X,Y,c.sidebar_diff_content);
}
if(t1==t2 && c1==c2 && s1==s2)
c.no_diff=true;
master::ini(c);
render("diff",c);
}
void page::history(std::string slug,std::string page)
{
this->slug=slug;
unsigned const vers=10;
int offset;
content::history c;
master::ini(c);
if(page.empty())
offset=0;
else
offset=atoi(page.c_str());
cppdb::session sql(conn);
cppdb::result r;
r=sql<< "SELECT title,id FROM pages "
"WHERE pages.lang=? AND pages.slug=? " << locale_name << slug << cppdb::row;
if(r.empty()) {
redirect(locale_name);
return;
}
int id;
r>>c.title>>id;
r=sql<< "SELECT created,version,author FROM history "
"WHERE id=? "
"ORDER BY version DESC "
"LIMIT ? "
"OFFSET ?"
<<id << vers+1 << offset*vers;
c.hist.reserve(vers);
for(unsigned i=0;r.next() && i<vers;i++) {
int ver;
c.hist.resize(i+1);
std::tm update = std::tm();
r>> update >> ver >> c.hist[i].author ;
c.hist[i].update = mktime(&update);
c.hist[i].version=ver;
c.hist[i].show_url=page_version_url(ver);
c.hist[i].edit_url=edit_version_url(ver);
if(ver>1)
c.hist[i].diff_url=diff_url(ver-1,ver);
}
if(r.next()) {
c.page=history_url(offset+1);
}
c.page_link=page_url();
render("history",c);
}
void page::display(std::string slug)
{
this->slug=slug;
std::string key="article_"+locale_name+":"+slug;
if(cache().fetch_page(key))
return;
content::page c;
cppdb::session sql(conn);
cppdb::result r;
r=sql<< "SELECT title,content,sidebar FROM pages WHERE lang=? AND slug=?"
<<locale_name << slug << cppdb::row;
if(r.empty()) {
std::string redirect=edit_url();
std::cerr << " Page " << redirect << std::endl;
response().set_redirect_header(redirect);
return;
}
ini(c);
r >> c.title >> c.content >> c.sidebar;
render("page",c);
cache().store_page(key);
}
void page::ini(content::page &c)
{
master::ini(c);
c.edit_link=edit_url();
c.history_link=history_url();
}
void page::edit(std::string slug,std::string version)
{
this->slug=slug;
content::edit_page c(&wi);
if(request().request_method()=="POST") {
if(!edit_on_post(c))
return;
}
else {
if(version.empty()) {
c.new_page=!load(c.form);
if(c.new_page) {
wi.options.load();
c.form.users_only.value(wi.options.global.users_only_edit);
}
}
else {
int ver=atoi(version.c_str());
if(!load_history(ver,c.form)) {
redirect(locale_name,slug);
return;
}
}
if(c.form.users_only.value() && !wi.users.auth()) {
wi.users.error_forbidden();
}
}
ini(c);
c.back=page_url();
c.submit=edit_url();
render("edit_page",c);
}
bool page::load(content::page_form &form)
{
cppdb::session sql(conn);
cppdb::result r;
r=sql<< "SELECT title,content,sidebar,users_only "
"FROM pages WHERE lang=? AND slug=?" << locale_name << slug << cppdb::row;
if(!r.empty()) {
std::string title,content,sidebar;
int users_only;
r >> title >> content >> sidebar >> users_only;
form.title.value(title);
form.content.value(content);
form.sidebar.value(sidebar);
form.users_only.value(users_only);
return true;
}
wi.options.load();
form.users_only.set(wi.options.global.users_only_edit);
return false;
}
void page::redirect(std::string loc,std::string slug)
{
std::string redirect=page_url(loc,slug);
response().set_redirect_header(redirect);
}
void page::save(int id,content::page_form &form,cppdb::session &sql)
{
std::tm t = booster::ptime::local_time(booster::ptime::now());
wi.users.auth();
if(id!=-1) {
sql<< "UPDATE pages SET content=?,title=?,sidebar=?,users_only=? "
"WHERE lang=? AND slug=?"
<< form.content.value() << form.title.value()
<< form.sidebar.value() << form.users_only.value()
<< locale_name << slug << cppdb::exec;
}
else {
cppdb::statement s;
s=sql<< "INSERT INTO pages(lang,slug,title,content,sidebar,users_only) "
"VALUES(?,?,?,?,?,?)"
<< locale_name << slug
<< form.title.value()
<< form.content.value()
<< form.sidebar.value()
<< form.users_only.value();
s.exec();
id=s.sequence_last("pages_id_seq");
}
sql<< "INSERT INTO history(id,version,created,title,content,sidebar,author) "
"SELECT ?,"
" (SELECT COALESCE(MAX(version),0)+1 FROM history WHERE id=?),"
" ?,?,?,?,?"
<< id << id << t
<< form.title.value()
<< form.content.value()
<< form.sidebar.value()
<< wi.users.username
<< cppdb::exec;
}
bool page::edit_on_post(content::edit_page &c)
{
wi.options.load();
cppdb::session sql(conn);
cppdb::transaction tr(sql);
cppdb::result r;
r=sql<< "SELECT id,users_only FROM pages WHERE lang=? and slug=?" << locale_name << slug << cppdb::row;
int id=-1,users_only=wi.options.global.users_only_edit;
if(!r.empty()) {
r>>id>>users_only;
}
r.clear();
if(users_only && !wi.users.auth()) {
wi.users.error_forbidden();
return false;
}
c.form.load(context());
if(c.form.validate()) {
if(c.form.save.value() || c.form.save_cont.value()) {
save(id,c.form,sql);
cache().rise("article_"+locale_name+":"+slug);
}
if(c.form.save.value()) {
redirect(locale_name,slug);
tr.commit();
return false;
}
if(c.form.preview.value()) {
c.title=c.form.title.value();
c.content=c.form.content.value();
c.sidebar=c.form.sidebar.value();
}
}
tr.commit();
return true;
}
bool page::load_history(int ver,content::page_form &form)
{
cppdb::session sql(conn);
cppdb::result r;
r=sql<< "SELECT history.title,history.content,history.sidebar,pages.users_only "
"FROM pages "
"JOIN history ON pages.id=history.id "
"WHERE pages.lang=? AND pages.slug=? AND history.version=?"
<<locale_name<<slug<<ver<<cppdb::row;
if(!r.empty()) {
std::string title,content,sidebar;
int uonly;
r >> title >> content >> sidebar >> uonly;
form.title.value(title);
form.content.value(content);
form.sidebar.value(sidebar);
form.users_only.value(uonly);
return true;
}
return false;
}
void page::display_ver(std::string slug,std::string sid)
{
this->slug=slug;
content::page_hist c;
int id=atoi(sid.c_str());
cppdb::result r;
cppdb::session sql(conn);
r=sql<< "SELECT history.title,history.content,history.sidebar,history.created "
"FROM pages "
"JOIN history ON pages.id=history.id "
"WHERE pages.lang=? AND pages.slug=? AND history.version=?"
<<locale_name << slug << id << cppdb::row;
if(!r.empty()) {
redirect(locale_name,slug);
return;
}
std::tm date;
r>>c.title>>c.content>>c.sidebar>>date;
c.date = mktime(&date);
c.version=id;
c.rollback=edit_version_url(id);
ini(c);
render("page_hist",c);
}
}

45
src/page.h Normal file
View file

@ -0,0 +1,45 @@
#ifndef PAGE_H
#define PAGE_H
#include "master.h"
#include <string>
namespace content {
class page;
class edit_page;
class page_form;
}
namespace apps {
class page : public master {
void save(int id,content::page_form &,cppdb::session &sql);
bool load(content::page_form &);
bool edit_on_post(content::edit_page &);
bool load_history(int,content::page_form &);
protected:
std::string slug;
void ini(content::page &);
void display(std::string slug);
void history(std::string slug,std::string page);
void display_ver(std::string slug,std::string sid);
void edit(std::string slug,std::string version);
void diff(std::string slug,std::string v1,std::string v2);
std::string edit_url();
std::string edit_version_url(int ver);
std::string history_url(int n=0);
public:
page(wiki &w);
std::string diff_url(int v1,int v2,std::string lang="",std::string s="");
std::string page_url(std::string l="",std::string s="");
std::string page_version_url(int ver,std::string l="",std::string s="");
std::string default_page_url(std::string l="en",std::string s="main")
{ return page_url(l,s); }
void redirect(std::string locale="en",std::string slug="main");
};
}
#endif

79
src/page_content.h Normal file
View file

@ -0,0 +1,79 @@
#ifndef PAGE_CONTENT_H
#define PAGE_CONTENT_H
#include "master_content.h"
namespace content {
typedef std::list<std::pair<int,std::string> > diff_t;
struct page_form : public cppcms::form {
apps::wiki *w;
cppcms::widgets::text title;
cppcms::widgets::textarea content;
cppcms::widgets::textarea sidebar;
cppcms::widgets::submit save;
cppcms::widgets::submit save_cont;
cppcms::widgets::submit preview;
cppcms::widgets::checkbox users_only;
cppcms::form fields;
cppcms::form buttons;
page_form(apps::wiki *w);
bool virtual validate();
};
struct page : public master {
std::string title,content;
std::string sidebar;
std::string edit_link;
std::string history_link;
};
struct page_hist: public page {
int version;
std::string rollback;
time_t date;
};
struct edit_page: public page {
page_form form;
bool new_page;
std::string back;
std::string submit;
edit_page(apps::wiki *w) : form(w),new_page(false) {}
};
struct history : public master {
struct item {
time_t update;
std::string show_url;
std::string edit_url;
std::string diff_url;
int version;
std::string author;
};
std::vector<item> hist;
std::string page;
std::string title;
std::string page_link;
};
struct diff: public master {
std::string edit_v1,edit_v2;
int v1,v2;
diff_t content_diff_content;
diff_t sidebar_diff_content;
std::string title,title_1,title_2;
bool title_diff,content_diff,sidebar_diff,no_versions,no_diff;
diff() :
title_diff(false),content_diff(false),
sidebar_diff(false),no_versions(false),
no_diff(false)
{
}
};
} // namespace content
#endif

226
src/users.cpp Normal file
View file

@ -0,0 +1,226 @@
#include "users.h"
#include "wiki.h"
#include "users_content.h"
#include <sys/time.h>
#include <time.h>
#include <cppcms/url_dispatcher.h>
#include <cppcms/cache_interface.h>
#include <cppcms/session_interface.h>
#define _(X) ::cppcms::locale::translate(X)
namespace content {
login_form::login_form(apps::wiki *_w) :
w(_w)
{
username.message(_("Username"));
password.message(_("Password"));
login.value(_("Login"));
add(username);
add(password);
add(login);
username.non_empty();
password.non_empty();
}
bool login_form::validate()
{
if(!form::validate())
return false;
if(w->users.check_login(username.value(),password.value()))
return true;
password.valid(false);
return false;
}
new_user_form::new_user_form(apps::wiki *_w):
w(_w)
{
username.message(_("Username"));
password1.message(_("Password"));
password2.message(_("Confirm"));
captcha.message(_("Solve"));
submit.value(_("Submit"));
add(username);
add(password1);
add(password2);
add(captcha);
add(submit);
username.non_empty();
password1.non_empty();
password2.check_equal(password1);
}
void new_user_form::generate_captcha()
{
struct timeval tv;
gettimeofday(&tv,NULL);
unsigned seed=tv.tv_usec / 1000 % 100;
int num1=rand_r(&seed) % 10+1;
int num2=rand_r(&seed) % 10+1;
int sol=num1+num2;
captcha.help((booster::locale::format("{1} + {2}") % num1 % num2).str());
w->session().set("captcha",sol);
w->session().age(5*60); // at most 5 minutes
}
bool new_user_form::validate()
{
if(!form::validate())
return false;
if(!w->session().is_set("captcha") || captcha.value()!=w->session()["captcha"]) {
w->session().erase("captcha");
return false;
}
if(w->users.user_exists(username.value())) {
username.error_message(_("This user exists"));
username.valid(false);
return false;
}
return true;
}
}
namespace apps {
users::users(wiki &w) : master(w)
{
wi.dispatcher().assign("^/login/?$",&users::login,this);
disable_reg=settings().get("wikipp.disable_registration",true);
if(!disable_reg){
wi.dispatcher().assign("^/register/?$",&users::new_user,this);
}
reset();
}
void users::new_user()
{
content::new_user c(&wi);
if(request().request_method()=="POST") {
c.form.load(context());
cppdb::session sql(conn);
cppdb::transaction tr(sql);
if(c.form.validate()) {
sql<< "INSERT INTO users(username,password) "
"VALUES(?,?)"
<< c.form.username.value()
<< c.form.password1.value()
<< cppdb::exec;
tr.commit();
wi.page.redirect(locale_name);
session()["username"]=c.form.username.value();
session().expose("username");
session().default_age(); // return to default
return;
}
tr.commit();
}
c.form.generate_captcha();
ini(c);
render("new_user",c);
}
void users::reset()
{
auth_done=auth_ok=false;
}
std::string users::login_url()
{
return wi.root()+"/login/";
}
bool users::user_exists(std::string u)
{
std::string key="user_exists_"+u;
std::string tmp;
if(cache().fetch_frame(key,tmp,true)) { // No triggers
return true;
}
cppdb::result r;
cppdb::session sql(conn);
r=sql<<"SELECT id FROM users WHERE username=?" << u << cppdb::row;
if(!r.empty()) {
cache().store_frame(key,tmp);
return true;
}
return false;
}
void users::login()
{
content::login c(&wi);
if(request().request_method()=="POST") {
c.form.load(context());
if(c.form.validate()) {
wi.page.redirect(locale_name);
session()["username"]=c.form.username.value();
session().expose("username");
return;
}
}
else {
if(auth()) {
response().set_redirect_header(request().http_referer());
session().clear();
return;
}
}
ini(c);
if(!disable_reg)
c.new_user=wi.root()+"/register/";
render("login",c);
}
bool users::check_login(std::string u,std::string p)
{
if(u.empty() || p.empty())
return false;
cppdb::result r;
cppdb::session sql(conn);
r=sql<< "SELECT password FROM users "
"WHERE username=?" << u << cppdb::row;
if(r.empty()) {
return false;
}
std::string pass;
r>>pass;
if(p!=pass)
return false;
return true;
}
bool users::auth()
{
if(!auth_done)
do_auth();
return auth_ok;
}
void users::do_auth()
{
if(session().is_set("username") && user_exists(session()["username"])) {
auth_ok=true;
}
else {
auth_ok=false;
}
if(auth_ok)
username=session()["username"];
else
username=request().remote_addr();
auth_done=true;
}
void users::error_forbidden()
{
response().set_redirect_header(login_url());
}
}

32
src/users.h Normal file
View file

@ -0,0 +1,32 @@
#ifndef USERS_H
#define USERS_H
#include "master.h"
namespace apps {
class users : public master {
bool auth_done;
bool auth_ok;
bool disable_reg;
void login();
void do_auth();
void new_user();
public:
void reset();
bool user_exists(std::string);
bool check_login(std::string,std::string);
bool auth();
void error_forbidden();
std::string username;
std::string login_url();
users(wiki &);
};
}
#endif

42
src/users_content.h Normal file
View file

@ -0,0 +1,42 @@
#ifndef USERS_CONTENT_H
#define USERS_CONTENT_H
#include "master_content.h"
namespace content {
struct login_form : public cppcms::form {
apps::wiki *w;
cppcms::widgets::text username;
cppcms::widgets::password password;
cppcms::widgets::submit login;
login_form(apps::wiki *);
virtual bool validate();
};
struct new_user_form : public cppcms::form {
apps::wiki *w;
cppcms::widgets::text username;
cppcms::widgets::password password1;
cppcms::widgets::password password2;
cppcms::widgets::text captcha;
cppcms::widgets::submit submit;
new_user_form(apps::wiki *w);
void generate_captcha();
bool virtual validate();
};
struct new_user : public master {
new_user_form form;
new_user(apps::wiki *w) : form(w){};
};
struct login : public master {
login_form form;
std::string new_user;
login(apps::wiki *w) : form(w){};
};
} // namespace content
#endif

58
src/wiki.cpp Normal file
View file

@ -0,0 +1,58 @@
#include "wiki.h"
#include <booster/regex.h>
#include <cppcms/url_dispatcher.h>
#include <cppcms/http_context.h>
namespace apps {
wiki::wiki(cppcms::service &srv) :
cppcms::application(srv),
conn(settings().get<std::string>("wikipp.connection_string")),
page(*this),
options(*this),
users(*this),
index(*this)
{
add(page);
add(options);
add(users);
add(index);
script=settings().get<std::string>("wikipp.script");
cppcms::json::object langs = settings().at("wikipp.languages").object();
for(cppcms::json::object::const_iterator p=langs.begin();p!=langs.end();++p) {
lang_map[p->first]=p->second.str();
}
}
std::string wiki::root(std::string l)
{
if(l.empty()) l=locale_name;
return script+"/"+l;
}
static const booster::regex lang_regex("^/(\\w+)(/.*)?$");
void wiki::main(std::string url)
{
booster::smatch res;
options.reset();
users.reset();
if(booster::regex_match(url,res,lang_regex)) {
std::map<std::string,std::string>::const_iterator p = lang_map.find(std::string(res[1]));
if(p==lang_map.end()) {
page.redirect();
}
else {
locale_name = p->first;
context().locale(p->second);
if(!dispatcher().dispatch(res[2]))
page.redirect(locale_name);
}
}
else
page.redirect();
}
} // apps

48
src/wiki.h Normal file
View file

@ -0,0 +1,48 @@
#ifndef WIKI_H
#define WIKI_H
#include <cppcms/application.h>
#include <cppdb/frontend.h>
#include "page.h"
#include "users.h"
#include "index.h"
#include "options.h"
namespace apps {
class wiki : public cppcms::application {
friend class apps::page;
friend class apps::options;
friend class apps::users;
friend class apps::index;
friend class apps::master;
std::string script;
public:
std::string conn;
// Data
std::string locale_name;
// Applications
apps::page page;
apps::options options;
apps::users users;
apps::index index;
std::string root(std::string locale_name="");
bool set_locale(std::string);
void run(std::string lang,std::string url);
//virtual void on_404();
virtual void main(std::string url);
wiki(cppcms::service &s);
private:
std::map<std::string,std::string> lang_map;
};
}
#endif

47
templates/admin.tmpl Normal file
View file

@ -0,0 +1,47 @@
<% skin view %>
<% view login uses content::login extends master %>
<% template title() %><% gt "WikiPP :: Login" %><% end %>
<% template main() %>
<form action="" method="post"><% csrf %>
<table>
<% form as_table form %>
</table>
</form>
<% if not empty new_user %>
<p><strong><a href="<%= new_user %>"><% gt "Register as new user" %></a></strong></p>
<% end %>
<% end template %>
<% end view %>
<% view new_user uses content::new_user extends master %>
<% template title() %><% gt "WikiPP :: Register" %><% end %>
<% template main() %>
<script type="text/javascript"><!--
document.write('<fo')
document.write('rm act')
document.write('ion="" m')
document.write('ethod="po')
document.write('st">')
-->
</script>
<% csrf %>
<table>
<% form as_table form %>
</table>
<script type="text/javascript"><!--
document.write('</fo')
document.write('rm>')
-->
</script>
<% end template %>
<% end view %>
<% view edit_options uses content::edit_options extends master %>
<% template title() %><% gt "WikiPP :: Edit Options" %><% end %>
<% template main() %>
<form action="" method="post"><% csrf %>
<table style="width:100%" >
<% form as_table form %>
</table>
</form>
<% end template %>
<% end view %>
<% end skin %>

28
templates/hist.tmpl Normal file
View file

@ -0,0 +1,28 @@
<% skin view %>
<% view history uses content::history extends master %>
<% template title() %><% gt "WikiPP :: History" %> :: <%= title %><% end %>
<% template navigation() %>
<a href="<%= page_link %>"><% gt "Back to page" %></a>
&nbsp;/&nbsp;
<% include master::navigation() %>
<% end template %>
<% template main() %>
<% foreach row in hist %>
<ul>
<% item %>
<li>
<% gt "Version {1,num}, changed at {2,dt=s}, by {3}" using row.version, row.update, row.author %>,
<a href="<%= row.show_url %>"><% gt "Show" %></a>,
<a href="<%= row.edit_url %>"><% gt "Edit (rollback)" %></a><% if not empty row.diff_url %>,
<a href="<%= row.diff_url %>"><% gt "Diff to previous" %></a>
<% end %>
</li>
<% end %>
</ul>
<% empty %>
<h2><% gt "History is empty" %></h2>
<% end %>
<% if not empty page %><p><a href="<%= page %>"><% gt "Next page" %></a></p><% end %>
<% end template %>
<% end view %>
<% end skin %>

114
templates/main.tmpl Normal file
View file

@ -0,0 +1,114 @@
<% c++ #include "content.h" %>
<% xhtml %>
<% skin view %>
<% view master uses content::master %>
<% template title() %><% gt "Wellcome to WikiPP" %><% end %>
<% template navigation() %>
<a href="<%= login_link %>"><span id="loginout"></span></a>
&nbsp;/&nbsp;
<a href="<%= edit_options %>"><% gt" Users Area" %></a>
<% end template %>
<% template navbar() %>
<%= about | ext markdown %>
<hr/>
<h2><% gt "Navigation" %></h2>
<ul>
<li><a href="<%= toc %>"><% gt "Index" %></a></li>
<li><a href="<%= changes %>"><% gt "Changes" %></a></li>
</ul>
<% foreach l in languages %>
<h2><% gt "Main Page" %></h2>
<ul>
<% item %><li><a href="<%= l.second %>"><%= l.first %></a></li><% end %>
</ul>
<% end %>
<% end template %>
<% template main() %><% end %>
<% template wiki_title() %><%= wiki_title %><% end %>
<% template sidebar() %><% end %>
<% template render() %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><% include title() %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%= media %>/style.css" rel="stylesheet" type="text/css" />
<% if not empty syntax_highlighter %>
<script language="javascript" src="<%= media %>/sh/Scripts/shCore.js"></script>
<script language="javascript" src="<%= media %>/sh/Scripts/shBrushCpp.js"></script>
<link href="<%= media %>/sh/Styles/SyntaxHighlighter.css" rel="stylesheet" type="text/css" />
<% end %>
<link href="<%= media %>/style-<% if rtl %>rtl<% else %>ltr<%end%>.css" rel="stylesheet" type="text/css" />
</head>
<body onload="loginout()">
<script type="text/javascript">
<!--
function get_cookie(c_name)
{
c_name='<%= cookie_prefix %>' + c_name;
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return decodeURIComponent(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function loginout(){
var element=document.getElementById('loginout');
var username=get_cookie('username');
if(username=='') {
element.innerHTML='<% gt "Login" %>';
}
else {
element.innerHTML='<% gt "Logout " %>('+username+')';
}
}
-->
</script>
<div id="page" >
<div id="header">
<h1 id="title"><% include wiki_title() %></h1>
</div>
<div id="path">
<a href="<%= main_local %>"><% gt "Main" %></a>
&nbsp;/&nbsp;
<% include navigation()%>
</div>
<div id="maincontent">
<h1><% include title() %></h1>
<% include main() %>
</div>
<div id="sidecontent">
<% include navbar() %>
<% include sidebar() %>
<hr/>
<p><a href="http://jigsaw.w3.org/css-validator/check/referer"><% gt "Valid CSS" %></a>
| <a href="http://validator.w3.org/check?uri=referer"><% gt "Valid XHTML 1.0" %></a>
</p>
</div>
<div id="footer">
<div id="copyrightdesign">
<%= copyright %> | <% gt "Template design based on <a href=\"http://ContentedDesigns.com\">Contented Designs</a>" %>
</div>
<div id="footercontact">
<a href="<%= contact %>"><% gt "Contact" %></a>
</div>
</div>
</div>
<% if not empty syntax_highlighter %>
<script language="javascript" >
<!--
dp.SyntaxHighlighter.HighlightAll('code');
-->
</script>
<% end %>
</body>
</html>
<% end template %>
<% end view %>
<% end skin %>

122
templates/page.tmpl Normal file
View file

@ -0,0 +1,122 @@
<% skin view %>
<% view page uses content::page extends master %>
<% template sidebar() %>
<% if not empty sidebar %>
<hr/>
<div id="navbar_links" >
<%= sidebar | ext markdown %>
</div>
<% end %>
<% end %>
<% template title() %><%= title %><% end %>
<% template navigation() %>
<% if not empty edit_link %>
<a href="<%= edit_link %>"><% gt "Edit" %></a>
&nbsp;/&nbsp;
<a href="<%= history_link %>"><% gt "History" %></a>
&nbsp;/&nbsp;
<% end %>
<% include master::navigation() %>
<% end template %>
<% template main() %>
<%= content | ext markdown %>
<% end %>
<% end view %>
<% view edit_page uses content::edit_page extends page %>
<% template title() %><% if new_page %><% gt "New Article" %><% else %><% gt "Edit" %><% if not empty title %>:<%= title %><% end %><% end %><% end %>
<% template navigation() %>
<% if not empty edit_link %>
<a href="<%= back %>"><% gt "Back to page" %></a>
&nbsp;/&nbsp;
<a href="<%= history_link %>"><% gt "History" %></a>
&nbsp;/&nbsp;
<% end %>
<% include master::navigation() %>
<% end template %>
<% template main() %>
<% if not empty title %>
<% include page::main() %>
<% end %>
<script type="text/javascript">
<!--
document.write('<for')
document.write('m actio')
document.write('n="')
document.write('<%= submit %>" me')
document.write('thod="po')
document.write('st">')
-->
</script>
<% csrf %>
<table>
<% form as_table form.fields %>
</table>
<p><% form as_space form.buttons %></p>
<script type="text/javascript">
<!--
document.write('</fo')
document.write('rm>')
-->
</script>
<% end template %>
<% end view %>
<% view page_hist uses content::page_hist extends page %>
<% template title() %>
<% include page::title() %>
<% end template %>
<% template navigation() %>
<a href="<%= rollback %>"><% gt "Edit this version (rollback)" %></a>
&nbsp;/&nbsp;
<% include page::navigation() %>
<% end template %>
<% template main() %>
<div class="published"><% gt "(version {1,num}, from {2,dt=s})" using version, date %></div>
<% include page::main() %>
<% end template %>
<% end view %>
<% view diff uses content::diff extends master %>
<% template title() %><% gt "Difference \"{1}\" ver. {2} versus ver. {3}" using title,v1,v2 %><% end template %>
<% template navigation() %>
<a href="<%= edit_v1 %>"><% gt "Edit version {1,num}" using v1 %></a>
&nbsp;/&nbsp;
<a href="<%= edit_v2 %>"><% gt "Edit version {1,num}" using v2 %></a>
&nbsp;/&nbsp;
<% include master::navigation() %>
<% end template %>
<% template show_diff(content::diff_t &content) %>
<table style="width:100%" >
<% foreach r in content %>
<% item %>
<tr class="<% if (r.first<0) %>d_del<% elif (r.first>0) %>d_add<% else %>d_no<% end %>" >
<td><code><%= r.second %></code></td>
</tr>
<% end %>
<% end %>
</table>
<% end template %>
<% template main() %>
<% if no_versions %>
<h2><% gt "No such page or version exist" %></h2>
<% elif no_diff %>
<h2><% gt "No difference between these versions" %></h2>
<% else %>
<% if title_diff %>
<h2><% gt "Titles" %>:</h2>
<table style="width:100%">
<tr><th><% gt "Version {1}" using v1 %></th><th><% gt "Version {1}" using v2 %></th>
<tr><td><%= title_1 %></td><td><%= title_2 %></td></tr>
</table>
<% end %>
<% if content_diff %>
<h2><% gt "Content" %>:</h2>
<% include show_diff(content_diff_content) %>
<% end %>
<% if sidebar_diff %>
<h2><% gt "Sidebar" %>:</h2>
<% include show_diff(sidebar_diff_content) %>
<% end %>
</table>
<% end %>
<% end template %>
<% end view %>
<% end skin %>

44
templates/toc.tmpl Normal file
View file

@ -0,0 +1,44 @@
<% c++ #include "content.h" %>
<% skin view %>
<% view toc uses content::toc extends master %>
<% template title() %><% gt "Index of Articles" %><% end %>
<% template main() %>
<% foreach row in table %>
<table id="toc_table">
<% item %>
<tr>
<% foreach cell in row %>
<% item %>
<% if not empty cell.title %>
<td><a href="<%= cell.url %>"><%= cell.title %></a>
<% else %>
<td>&nbsp;</td>
<% end %>
<% end item %>
<% end %>
</tr>
<% end item %>
</table>
<% end foreach %>
<% end template %>
<% end view %>
<% view recent_changes uses content::recent_changes extends master %>
<% template title() %><% gt "Recent Changes" %><% end %>
<% template main() %>
<% foreach c in content %>
<ul>
<% item %>
<li><a href="<%= c.url %>"><%= c.title %></a> &mdash;
<% gt "version {1,num}, at {2,dt=s}, by {3}" using c.version,c.created,c.author %><% if not empty c.diff_url %>,
<a href="<%= c.diff_url %>"><% gt "Diff to previous" %></a><% end %>
</li>
<% end item %>
</ul>
<% if not empty next %><p><a href="<%= next %>"><% gt "Next Page" %></a></p><% end %>
<% empty %>
<h2><% gt "No more changes" %></h2>
<% end %>
<% end template %>
<% end view %>
<% end skin %>

71
wikipp.log Normal file
View file

@ -0,0 +1,71 @@
2012-02-01 13:43:32; cppcms_http, info: GET /wikipp (http_api.cpp:247)
2012-02-01 13:43:32; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:43:32; cppcms_http, info: GET /wikipp/en/page/main/edit (http_api.cpp:247)
2012-02-01 13:43:32; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:32; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:42; cppcms_http, info: POST /wikipp/en/page/main/edit (http_api.cpp:247)
2012-02-01 13:43:42; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:43:42; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:42; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:44; cppcms_http, info: GET /wikipp/en/login/ (http_api.cpp:247)
2012-02-01 13:43:44; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:44; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:46; cppcms_http, info: GET /wikipp/en/register/ (http_api.cpp:247)
2012-02-01 13:43:46; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:46; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:53; cppcms_http, info: POST /wikipp/en/register/ (http_api.cpp:247)
2012-02-01 13:43:54; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:43:54; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:54; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:56; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:43:56; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:56; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:57; cppcms_http, info: GET /wikipp/pl (http_api.cpp:247)
2012-02-01 13:43:57; cppcms_http, info: GET /wikipp/pl/page/main (http_api.cpp:247)
2012-02-01 13:43:57; cppcms_http, info: GET /wikipp/pl/page/main/edit (http_api.cpp:247)
2012-02-01 13:43:57; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:57; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:58; cppcms_http, info: GET /wikipp/en (http_api.cpp:247)
2012-02-01 13:43:58; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:43:58; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:43:58; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:43:59; cppcms_http, info: GET /wikipp/ru (http_api.cpp:247)
2012-02-01 13:43:59; cppcms_http, info: GET /wikipp/ru/page/main (http_api.cpp:247)
2012-02-01 13:43:59; cppcms_http, info: GET /wikipp/ru/page/main/edit (http_api.cpp:247)
2012-02-01 13:44:00; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:00; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:44:00; cppcms_http, info: GET /wikipp/he (http_api.cpp:247)
2012-02-01 13:44:00; cppcms_http, info: GET /wikipp/he/page/main (http_api.cpp:247)
2012-02-01 13:44:00; cppcms_http, info: GET /wikipp/he/page/main/edit (http_api.cpp:247)
2012-02-01 13:44:01; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:01; cppcms_http, info: GET /media/style-rtl.css (http_api.cpp:247)
2012-02-01 13:44:04; cppcms_http, info: GET /wikipp/he/page/main (http_api.cpp:247)
2012-02-01 13:44:04; cppcms_http, info: GET /wikipp/he/page/main/edit (http_api.cpp:247)
2012-02-01 13:44:04; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:04; cppcms_http, info: GET /media/style-rtl.css (http_api.cpp:247)
2012-02-01 13:44:05; cppcms_http, info: GET /wikipp/en (http_api.cpp:247)
2012-02-01 13:44:05; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:44:05; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:05; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:44:06; cppcms_http, info: GET /wikipp/pl (http_api.cpp:247)
2012-02-01 13:44:06; cppcms_http, info: GET /wikipp/pl/page/main (http_api.cpp:247)
2012-02-01 13:44:06; cppcms_http, info: GET /wikipp/pl/page/main/edit (http_api.cpp:247)
2012-02-01 13:44:06; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:06; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:44:11; cppcms_http, info: GET /wikipp/ru (http_api.cpp:247)
2012-02-01 13:44:11; cppcms_http, info: GET /wikipp/ru/page/main (http_api.cpp:247)
2012-02-01 13:44:11; cppcms_http, info: GET /wikipp/ru/page/main/edit (http_api.cpp:247)
2012-02-01 13:44:11; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:11; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:44:13; cppcms_http, info: GET /wikipp/he (http_api.cpp:247)
2012-02-01 13:44:13; cppcms_http, info: GET /wikipp/he/page/main (http_api.cpp:247)
2012-02-01 13:44:13; cppcms_http, info: GET /wikipp/he/page/main/edit (http_api.cpp:247)
2012-02-01 13:44:13; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:13; cppcms_http, info: GET /media/style-rtl.css (http_api.cpp:247)
2012-02-01 13:44:15; cppcms_http, info: GET /wikipp/en (http_api.cpp:247)
2012-02-01 13:44:15; cppcms_http, info: GET /wikipp/en/page/main (http_api.cpp:247)
2012-02-01 13:44:15; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:15; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)
2012-02-01 13:44:24; cppcms_http, info: GET /wikipp/en/changes/ (http_api.cpp:247)
2012-02-01 13:44:24; cppcms_http, info: GET /media/style.css (http_api.cpp:247)
2012-02-01 13:44:24; cppcms_http, info: GET /media/style-ltr.css (http_api.cpp:247)