1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jirafeau_ynh.git synced 2024-09-03 19:35:53 +02:00

import jirafeau rev 3994a35

This commit is contained in:
Julien Malik 2014-01-13 13:49:21 +01:00
commit e5c43dbdcd
31 changed files with 5171 additions and 0 deletions

661
sources/COPYING Normal file
View file

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 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 Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
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 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 work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
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 AGPL, see
<http://www.gnu.org/licenses/>.

304
sources/admin.php Executable file
View file

@ -0,0 +1,304 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
require (JIRAFEAU_ROOT . 'lib/lang.php');
/* Check if installation is OK. */
if (file_exists (JIRAFEAU_ROOT . 'install.php')
&& !file_exists (JIRAFEAU_ROOT . 'lib/config.local.php'))
{
header('Location: install.php');
exit;
}
/* Check if the install.php script is still in the directory. */
if (file_exists (JIRAFEAU_ROOT . 'install.php'))
{
require (JIRAFEAU_ROOT . 'lib/template/header.php');
echo '<div class="error"><p>'.
t('Installer script still present') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
/* Disable admin interface if we have a empty admin password. */
if (!$cfg['admin_password'])
{
require (JIRAFEAU_ROOT . 'lib/template/header.php');
echo '<div class="error"><p>'.
t('Sorry, the admin interface is not enabled.') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
/* Check session. */
session_start();
/* Unlog if asked. */
if (isset ($_POST['action']) && (strcmp ($_POST['action'], 'logout') == 0))
$_SESSION['admin_auth'] = false;
/* Check password. */
if (isset ($_POST['admin_password']))
{
if (strcmp ($cfg['admin_password'], $_POST['admin_password']) == 0)
$_SESSION['admin_auth'] = true;
else
{
$_SESSION['admin_auth'] = false;
require (JIRAFEAU_ROOT . 'lib/template/header.php');
echo '<div class="error"><p>'.
t('Wrong password.') . '</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
}
/* Ask for password. */
elseif (!isset ($_SESSION['admin_auth']) || $_SESSION['admin_auth'] != true)
{
require (JIRAFEAU_ROOT . 'lib/template/header.php'); ?>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<fieldset>
<table>
<tr>
<td class = "label"><label for = "enter_password">
<?php echo t('Administration password') . ':';?></label>
</td>
<td class = "field"><input type = "password"
name = "admin_password" id = "admin_password"
size = "40" />
</td>
</tr>
<tr class = "nav">
<td></td>
<td class = "nav next">
<input type = "submit" name = "key" value =
"<?php echo t('Login'); ?>" />
</td>
</tr>
</table>
</fieldset>
</form>
<?php
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
/* Operations may take a long time.
* Be sure PHP's safe mode is off.
*/
@set_time_limit(0);
/* Remove errors. */
@error_reporting(0);
/* Admin interface. */
require (JIRAFEAU_ROOT . 'lib/template/header.php');
?><h2><?php echo t('Admin interface'); ?></h2><?php
/* Show admin interface. */
{
?><div id = "install">
<fieldset><legend><?php echo t('Actions');?></legend>
<table>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "clean"/>
<td class = "info">
<?php echo t('Clean expired files'); ?>
</td>
<td></td>
<td>
<input type = "submit" value = "<?php echo t('Clean'); ?>" />
</td>
</tr>
</form>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "clean_async"/>
<td class = "info">
<?php echo t('Clean old unfinished transferts'); ?>
</td>
<td></td>
<td>
<input type = "submit" value = "<?php echo t('Clean'); ?>" />
</td>
</tr>
</form>
<?php
if ($cfg['enable_blocks'])
{
?>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "clean_block"/>
<td class = "info">
<?php echo t('Clean unused blocks'); ?>
</td>
<td></td>
<td>
<input type = "submit" value = "<?php echo t('Clean'); ?>" />
</td>
</tr>
</form>
<?php
}
?>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "list"/>
<td class = "info">
<?php echo t('List all files'); ?>
</td>
<td></td>
<td>
<input type = "submit" value = "<?php echo t('List'); ?>" />
</td>
</tr>
</form>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "search_by_name"/>
<td class = "info">
<?php echo t('Search files by name'); ?>
</td>
<td>
<input type = "text" name = "name" id = "name"/>
</td>
<td>
<input type = "submit" value = "<?php echo t('Search'); ?>" />
</td>
</tr>
</form>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "search_by_file_hash"/>
<td class = "info">
<?php echo t('Search files by file hash'); ?>
</td>
<td>
<input type = "text" name = "hash" id = "hash"/>
</td>
<td>
<input type = "submit" value = "<?php echo t('Search'); ?>" />
</td>
</tr>
</form>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<tr>
<input type = "hidden" name = "action" value = "search_link"/>
<td class = "info">
<?php echo t('Search a specific link'); ?>
</td>
<td>
<input type = "text" name = "link" id = "link"/>
</td>
<td>
<input type = "submit" value = "<?php echo t('Search'); ?>" />
</td>
</tr>
</form>
</table>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<input type = "hidden" name = "action" value = "logout"/>
<input type = "submit" value = "<?php echo t('Logout'); ?>" />
</form>
</fieldset></div><?php
}
/* Check for actions */
if (isset ($_POST['action']))
{
if (strcmp ($_POST['action'], 'clean') == 0)
{
$total = jirafeau_admin_clean ();
echo '<div class="message">' . NL;
echo '<p>';
echo t('Number of cleaned files') . ' : ' . $total;
echo '</p></div>';
}
elseif (strcmp ($_POST['action'], 'clean_async') == 0)
{
$total = jirafeau_admin_clean_async ();
echo '<div class="message">' . NL;
echo '<p>';
echo t('Number of cleaned files') . ' : ' . $total;
echo '</p></div>';
}
elseif (strcmp ($_POST['action'], 'clean_block') == 0)
{
$total = jirafeau_admin_clean_block ();
echo '<div class="message">' . NL;
echo '<p>';
echo t('Number of cleaned files') . ' : ' . $total;
echo '</p></div>';
}
elseif (strcmp ($_POST['action'], 'list') == 0)
{
jirafeau_admin_list ("", "", "");
}
elseif (strcmp ($_POST['action'], 'search_by_name') == 0)
{
jirafeau_admin_list ($_POST['name'], "", "");
}
elseif (strcmp ($_POST['action'], 'search_by_file_hash') == 0)
{
jirafeau_admin_list ("", $_POST['hash'], "");
}
elseif (strcmp ($_POST['action'], 'search_link') == 0)
{
jirafeau_admin_list ("", "", $_POST['link']);
}
elseif (strcmp ($_POST['action'], 'delete_link') == 0)
{
jirafeau_delete_link ($_POST['link']);
echo '<div class="message">' . NL;
echo '<p>' . t('Link deleted') . '</p></div>';
}
elseif (strcmp ($_POST['action'], 'delete_file') == 0)
{
$count = jirafeau_delete_file ($_POST['md5']);
echo '<div class="message">' . NL;
echo '<p>' . t('Deleted links') . ' : ' . $count . '</p></div>';
}
elseif (strcmp ($_POST['action'], 'download') == 0)
{
$l = jirafeau_get_link ($_POST['link']);
if (!count ($l))
return;
$p = s2p ($l['md5']);
header ('Content-Length: ' . $l['file_size']);
header ('Content-Type: ' . $l['mime_type']);
header ('Content-Disposition: attachment; filename="' .
$l['file_name'] . '"');
if (file_exists(VAR_FILES . $p . $l['md5']))
readfile (VAR_FILES . $p . $l['md5']);
}
}
require (JIRAFEAU_ROOT.'lib/template/footer.php');
?>

267
sources/f.php Normal file
View file

@ -0,0 +1,267 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
* Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
require (JIRAFEAU_ROOT . 'lib/lang.php');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
if (!isset ($_GET['h']) || empty ($_GET['h']))
{
header ('Location: ' . $cfg['web_root']);
exit;
}
/* Operations may take a long time.
* Be sure PHP's safe mode is off.
*/
@set_time_limit(0);
/* Remove errors. */
@error_reporting(0);
$link_name = $_GET['h'];
if (!preg_match ('/[0-9a-zA-Z_-]+$/', $link_name))
{
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>' . t('Sorry, the requested file is not found') . '</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
$link = jirafeau_get_link ($link_name);
if (count ($link) == 0)
{
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>' . t('Sorry, the requested file is not found') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
$delete_code = '';
if (isset ($_GET['d']) && !empty ($_GET['d']))
$delete_code = $_GET['d'];
$crypt_key = '';
if (isset ($_GET['k']) && !empty ($_GET['k']))
$crypt_key = $_GET['k'];
$button_download = false;
if (isset ($_GET['bd']) && !empty ($_GET['bd']))
$button_download = true;
$button_preview = false;
if (isset ($_GET['bp']) && !empty ($_GET['bp']))
$button_preview = true;
$p = s2p ($link['md5']);
if (!file_exists (VAR_FILES . $p . $link['md5']))
{
jirafeau_delete_link ($link_name);
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>'.t('File not available.').
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
if (!empty ($delete_code) && $delete_code == $link['link_code'])
{
jirafeau_delete_link ($link_name);
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="message"><p>'.t('File has been deleted.').
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
if ($link['time'] != JIRAFEAU_INFINITY && time () > $link['time'])
{
jirafeau_delete_link ($link_name);
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>'.
t('The time limit of this file has expired.') . ' ' .
t('File has been deleted.') .
'</p></div>';
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
exit;
}
if (empty ($crypt_key) && $link['crypted'])
{
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>' . t('Sorry, the requested file is not found') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
$password_challenged = false;
if (!empty ($link['key']))
{
if (!isset ($_POST['key']))
{
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div>' .
'<form action = "';
echo $cfg['web_root'] . '/f.php';
echo '" ' .
'method = "post" id = "submit">'; ?>
<input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
echo '<fieldset>' .
'<legend>' . t('Password protection') .
'</legend><table><tr><td>' .
t('Give the password of this file') . ' : ' .
'<input type = "password" name = "key" />' .
'</td></tr>' .
'<tr><td>' .
t('By using our services, you accept of our'). ' <a href="' . $cfg['web_root'] . '/tos.php' . '">' . t('Term Of Service') . '</a>' .
'</td></tr>' .
'<tr><td>';
?><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
onclick="document.getElementById('submit').action='
<?php
echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&amp;bd=1';
if (!empty($crypt_key))
echo '&amp;k=' . urlencode($crypt_key);
?>';
document.getElementById('submit_download').submit ();"/><?php
if ($cfg['download_page'] && $cfg['preview'])
{
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit').action='
<?php
echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&amp;bp=1';
if (!empty($crypt_key))
echo '&amp;k=' . urlencode($crypt_key);
?>';
document.getElementById('submit_preview').submit ();"/><?php
}
echo '</td></tr></table></fieldset></form></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
else
{
if ($link['key'] == md5 ($_POST['key']))
$password_challenged = true;
else
{
header ("Access denied");
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div class="error"><p>' . t('Access denied') .
'</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
}
}
if ($cfg['download_page'] && !$password_challenged && !$button_download && !$button_preview)
{
require (JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div>' .
'<form action = "';
echo $cfg['web_root'] . '/f.php';
echo '" ' .
'method = "post" id = "submit">'; ?>
<input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
echo '<fieldset><legend>' . $link['file_name'] . '</legend><table>' .
'<tr><td>' .
t('You are about to download') . ' "' . $link['file_name'] . '" (' . jirafeau_human_size($link['file_size']) . ')' .
'</td></tr>' .
'<tr><td>' .
t('By using our services, you accept of our'). ' <a href="' . $cfg['web_root'] . '/tos.php' . '">' . t('Term Of Service') . '</a>';
?></td></tr><tr><td><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
onclick="document.getElementById('submit').action='
<?php
echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&amp;bd=1';
if (!empty($crypt_key))
echo '&amp;k=' . urlencode($crypt_key);
?>';
document.getElementById('submit_download').submit ();"/><?php
if ($cfg['download_page'] && $cfg['preview'])
{
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit').action='
<?php
echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&amp;bp=1';
if (!empty($crypt_key))
echo '&amp;k=' . urlencode($crypt_key);
?>';
document.getElementById('submit_preview').submit ();"/><?php
}
echo '</td></tr>';
echo '</table></fieldset></form></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
header ('HTTP/1.0 200 OK');
header ('Content-Length: ' . $link['file_size']);
if (!jirafeau_is_viewable ($link['mime_type']) || !$cfg['preview'] || $button_download)
header ('Content-Disposition: attachment; filename="' .
$link['file_name'] . '"');
else
header ('Content-Type: ' . $link['mime_type']);
/* Read encrypted file. */
if ($link['crypted'])
{
/* Init module */
$m = mcrypt_module_open('rijndael-256', '', 'ofb', '');
/* Extract key and iv. */
$md5_key = md5 ($crypt_key);
$iv = jirafeau_crypt_create_iv ($md5_key, mcrypt_enc_get_iv_size($m));
/* Init module. */
mcrypt_generic_init ($m, $md5_key, $iv);
/* Decrypt file. */
$r = fopen (VAR_FILES . $p . $link['md5'], 'r');
while (!feof ($r))
{
$dec = mdecrypt_generic($m, fread ($r, 1024));
print $dec;
ob_flush();
}
fclose ($r);
/* Cleanup. */
mcrypt_generic_deinit($m);
mcrypt_module_close($m);
}
/* Read file. */
else
{
$r = fopen (VAR_FILES . $p . $link['md5'], 'r');
while (!feof ($r))
{
print fread ($r, 1024);
ob_flush();
}
fclose ($r);
}
if ($link['onetime'] == 'O')
jirafeau_delete_link ($link_name);
exit;
?>

BIN
sources/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

191
sources/index.php Executable file
View file

@ -0,0 +1,191 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2013
* Jerome Jutteau <j.jutteau@gmail.com>
* Jimmy Beauvois <jimmy.beauvois@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
require (JIRAFEAU_ROOT . 'lib/lang.php');
require (JIRAFEAU_ROOT . 'lib/template/header.php');
check_errors ();
if (has_error ())
{
show_errors ();
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
exit;
}
/* Ask password if upload password is set. */
if (strlen ($cfg['upload_password']) > 0)
{
session_start();
/* Unlog if asked. */
if (isset ($_POST['action']) && (strcmp ($_POST['action'], 'logout') == 0))
$_SESSION['upload_auth'] = false;
/* Auth. */
if (isset ($_POST['upload_password']))
{
if (strcmp ($cfg['upload_password'], $_POST['upload_password']) == 0)
$_SESSION['upload_auth'] = true;
else
{
$_SESSION['admin_auth'] = false;
echo '<div class="error"><p>' . t('Wrong password.') . '</p></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
}
/* Show auth page. */
if (!isset ($_SESSION['upload_auth']) || $_SESSION['upload_auth'] != true)
{
?>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<fieldset>
<table>
<tr>
<td class = "label"><label for = "enter_password">
<?php echo t('Upload password') . ':';?></label>
</td>
<td class = "field"><input type = "password"
name = "upload_password" id = "upload_password"
size = "40" />
</td>
</tr>
<tr class = "nav">
<td></td>
<td class = "nav next">
<input type = "submit" name = "key" value =
"<?php echo t('Login'); ?>" />
</td>
</tr>
</table>
</fieldset>
</form>
<?php
require (JIRAFEAU_ROOT.'lib/template/footer.php');
exit;
}
}
?>
<div id="upload_finished">
<p>
<?php echo t('File uploaded! Copy the following URL to get it') ?>:
<br />
<a id="upload_link" href=""></a>
<br />
</p>
<p>
<?php echo t('Keep the following URL to delete it at any moment'); ?>:
<br />
<a id="delete_link" href=""></a>
</p>
<p id="validity">
<?php echo t('This file is valid until the following date'); ?>:
<br /><strong><div id="date"></div></strong>
</p>
</div>
<div id="uploading">
<p>
<?php echo t ('Uploading ...'); ?><div id="uploaded_percentage"></div>
</p>
</div>
<div id="upload">
<fieldset>
<legend>
<?php echo t('Select a file'); ?>
</legend>
<p>
<input type="file" id="file_select" size="30"
onchange="
document.getElementById('options').style.display = '';
document.getElementById('send').style.display = '';
"/>
</p>
<div id="options">
<table id="option_table">
<tr>
<td><?php echo t('One time download'); ?>:</td>
<td><input type="checkbox" id="one_time_download" /></td>
</tr>
<tr>
<td><label for="input_key"><?php echo t('Password') . ':'; ?></label></td>
<td><input type="text" name="key" id="input_key" /></td>
</tr>
<tr>
<td><label for="select_time"><?php echo t('Time limit') . ':'; ?></label></td>
<td><select name="time" id="select_time">
<option value="none"><?php echo t('None'); ?></option>
<option value = "minute"><?php echo t('One minute'); ?></option>
<option value = "hour"><?php echo t('One hour'); ?></option>
<option value = "day"><?php echo t('One day'); ?></option>
<option value = "week"><?php echo t('One week'); ?></option>
<option value = "month"><?php echo t('One month');?></option>
</select></td>
</tr>
<p id="max_file_size" class="config"></p>
<p>
<input type="hidden" id="upload_password" name="upload_password" value="<?php echo $cfg['upload_password']?>"/>
<input type="submit" id="send" value="<?php echo t('Send'); ?>"
onclick="
document.getElementById('upload').style.display = 'none';
document.getElementById('uploading').style.display = '';
upload ('<?php echo $cfg['web_root']; ?>', <?php echo jirafeau_get_max_upload_size_bytes (); ?>);
"/>
</p>
</table>
</div> </fieldset>
<?php
if (strlen ($cfg['upload_password']) > 0)
{
?>
<form action = "<?php echo basename(__FILE__); ?>" method = "post">
<input type = "hidden" name = "action" value = "logout"/>
<input type = "submit" value = "<?php echo t('Logout'); ?>" />
</form>
<?php
}
?>
</div>
<script lang="Javascript">
document.getElementById('uploading').style.display = 'none';
document.getElementById('upload_finished').style.display = 'none';
document.getElementById('options').style.display = 'none';
document.getElementById('send').style.display = 'none';
if (!check_html5_file_api ())
document.getElementById('max_file_size').innerHTML = '<?php
echo t('You browser may not support HTML5 so the maximum file size is ') . jirafeau_get_max_upload_size ();
?>';
</script>
<?php require (JIRAFEAU_ROOT . 'lib/template/footer.php'); ?>

361
sources/install.php Executable file
View file

@ -0,0 +1,361 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
define ('NL', "\n");
define ('QUOTE', "'");
define ('JIRAFEAU_CFG', JIRAFEAU_ROOT.'lib/config.local.php');
define ('JIRAFEAU_VAR_RAND_LENGTH', 15);
require (JIRAFEAU_ROOT . 'lib/lang.php');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
function
jirafeau_quoted ($str)
{
return QUOTE . str_replace (QUOTE, "\'", $str) . QUOTE;
}
function
jirafeau_export_cfg ($cfg)
{
$handle = fopen (JIRAFEAU_CFG, 'w');
fwrite ($handle, '<?php' . NL);
fwrite ($handle,
'/* ' .
t ('This file was generated by the install process. ' .
'You can edit it. Please see config.original.php to understand the ' .
'configuration items.') . ' */' . NL);
foreach ($cfg as $key => $item)
{
fwrite ($handle, '$cfg[' . jirafeau_quoted ($key) . '] = ');
if (is_bool ($item))
fwrite ($handle, ($item ? 'true' : 'false'));
else if (is_string ($item))
fwrite ($handle, jirafeau_quoted ($item));
else if (is_int ($item))
fwrite ($handle, $item);
else
fwrite ($handle, 'null');
fwrite ($handle, ';'.NL);
}
/* No newline at the end of the file to be able to send headers. */
fwrite ($handle, '?>');
fclose ($handle);
}
function
jirafeau_mkdir ($path)
{
if (!file_exists ($path) && !@mkdir ($path, 0755))
return false;
return true;
}
/**
* Returns true whether the path is writable or we manage to make it
* so, which essentially is the same thing.
* @param $path is the file or directory to be tested.
* @return true if $path is writable.
*/
function
jirafeau_is_writable ($path)
{
/* "@" gets rid of error messages. */
return is_writable ($path) || @chmod ($path, 0777);
}
function
jirafeau_check_var_dir ($path)
{
$mkdir_str1 = t('The following directory could not be created') . ':';
$mkdir_str2 = t('You should create this directory by hand.');
$write_str1 = t('The following directory is not writable') . ':';
$write_str2 = t('You should give the write right to the web server on ' .
'this directory.');
$solution_str = t('Here is a solution') . ':';
if (!jirafeau_mkdir ($path) || !jirafeau_is_writable ($path))
return array ('has_error' => true,
'why' => $mkdir_str1 . '<br /><code>' .
$path . '</code><br />' . $solution_str .
'<br />' . $mkdir_str2);
foreach (array ('files', 'links', 'async', 'block') as $subdir)
{
$subpath = $path.$subdir;
if (!jirafeau_mkdir ($subpath) || !jirafeau_is_writable ($subpath))
return array ('has_error' => true,
'why' => $mkdir_str1 . '<br /><code>' .
$subpath . '</code><br />' . $solution_str .
'<br />' . $mkdir_str2);
}
return array ('has_error' => false, 'why' => '');
}
function
jirafeau_add_ending_slash ($path)
{
return $path . ((substr ($path, -1) == '/') ? '' : '/');
}
if (!file_exists (JIRAFEAU_CFG))
{
/* We try to create an empty one. */
if (!@touch (JIRAFEAU_CFG))
{
require (JIRAFEAU_ROOT . 'lib/template/header.php');
echo '<div class="error"><p>' .
t('The local configuration file could not be created. Create a ' .
'<code>lib/config.local.php</code> file and give the write ' .
'right to the web server (preferred solution), or give the ' .
'write right to the web server on the <code>lib</code> ' .
'directory.') .
'</p></div>';
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
exit;
}
}
if (!is_writable (JIRAFEAU_CFG) && !@chmod (JIRAFEAU_CFG, '0666'))
{
require (JIRAFEAU_ROOT . 'lib/template/header.php');
echo '<div class="error"><p>' .
t('The local configuration is not writable by the web server. ' .
'Give the write right to the web server on the ' .
'<code>lib/config.local.php</code> file.') .
'</p></div>';
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
exit;
}
if (isset ($_POST['step']) && isset ($_POST['next']))
{
switch ($_POST['step'])
{
case 1:
$cfg['lang'] = $_POST['lang'];
jirafeau_export_cfg ($cfg);
break;
case 2:
$cfg['admin_password'] = $_POST['admin_password'];
jirafeau_export_cfg ($cfg);
break;
case 3:
$cfg['web_root'] = jirafeau_add_ending_slash ($_POST['web_root']);
$cfg['var_root'] = jirafeau_add_ending_slash ($_POST['var_root']);
jirafeau_export_cfg ($cfg);
break;
case 4:
$cfg['web_root'] = jirafeau_add_ending_slash ($_POST['web_root']);
$cfg['var_root'] = jirafeau_add_ending_slash ($_POST['var_root']);
jirafeau_export_cfg ($cfg);
break;
default: break;
}
}
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/template/header.php');
$current = 1;
if (isset ($_POST['next']))
$current = $_POST['step'] + 1;
else if (isset ($_POST['previous']))
$current = $_POST['step'] - 1;
else if (isset ($_POST['retry']))
$current = $_POST['step'];
switch ($current)
{
case 1:
default:
?><h2><?php printf (t('Installation of Jirafeau') . ' - ' . t('step') .
' %d ' . t('out of') . ' %d', 1, 4);
?></h2> <div id = "install"> <form action =
"<?php echo basename(__FILE__); ?>" method = "post"> <input type =
"hidden" name = "jirafeau" value =
"<?php echo JIRAFEAU_VERSION; ?>" /><input type = "hidden" name =
"step" value = "1" /><fieldset> <legend><?php echo t('Language');
?></legend> <table> <tr> <td class = "info" colspan =
"2"><?php echo
t
('Jirafeau is internationalised. Choose a specific langage or ' .
'choose Automatic (langage is provided by user\'s browser).');
?></td> </tr> <tr> <td class = "label"><label for = "select_lang"
><?php echo t('Choose the default language') . ':';
?></label></td>
<td class = "field">
<select name = "lang" id = "select_lang">
<?php foreach ($languages_list as $key => $item)
{
echo '<option value="'.$key.'"'.($key ==
$cfg['lang'] ? ' selected="selected"'
: '').'>'.$item.'</option>'.NL;
}
?></select>
</td>
</tr>
<tr class = "nav">
<td></td>
<td class = "nav next"><input type = "submit" name = "next" value =
"<?php echo t('Next step'); ?>" /></td> </tr> </table>
</fieldset> </form> </div> <?php
break;
case 2:
?><h2><?php printf (t('Installation of Jirafeau') . ' - ' . t('step') .
' %d ' . t('out of') . ' %d', 2, 4);
?></h2> <div id = "install"> <form action =
"<?php echo basename(__FILE__); ?>" method = "post"> <input type =
"hidden" name = "jirafeau" value =
"<?php echo JIRAFEAU_VERSION; ?>" /><input type = "hidden" name =
"step" value = "2" /><fieldset> <legend><?php
echo t('Administration password');
?></legend> <table> <tr> <td class = "info" colspan =
"2"><?php echo
t
('Jirafeau has an administration interface (through admin.php). ' .
'You can set a password to access the intercace or let it be empty ' .
'to disable the interface.');
?></td> </tr> <tr> <td class = "label"><label for = "select_password"
><?php echo t('Administration password') . ':';
?></label></td>
<td class = "field"><input type = "password" name = "admin_password"
id = "admin_password" size = "40" /></td>
</tr>
<tr class = "nav">
<td></td>
<td class = "nav next">
<input type = "submit"
class = "navleft" name = "previous" value = "<?php
echo t('Previous step'); ?>" />
<input type = "submit" name = "next" value =
"<?php echo t('Next step'); ?>" /></td> </tr> </table>
</fieldset> </form> </div> <?php
break;
case 3:
?><h2><?php printf (t('Installation of Jirafeau') . ' - ' . t('step') .
' %d ' . t('out of') . ' %d', 3, 4);
?></h2> <div id = "install"> <form action =
"<?php echo basename(__FILE__); ?>" method = "post"> <input type =
"hidden" name = "jirafeau" value =
"<?php echo JIRAFEAU_VERSION; ?>" /><input type = "hidden" name =
"step" value =
"3" /><fieldset> <legend><?php echo t('Information');
?></legend> <table> <tr> <td class = "info" colspan =
"2"><?php echo
t
('The base address of Jirafeau is the first part of the URL, until ' .
'(and including) the last slash. For example: ' .
'"http://www.example.com/". Do not forget the ending slash!');
?></td> </tr> <tr> <td class = "label"><label for = "input_web_root"
><?php echo t('Base address') . ':';
?></label></td>
<td class = "field"><input type = "text" name = "web_root"
id = "input_web_root" value = "<?php
echo (empty($cfg['web_root']) ?
'http://' . $_SERVER['HTTP_HOST'] . str_replace(basename(__FILE__),
'', $_SERVER['REQUEST_URI']) : $cfg['web_root']);
?>" size = "40" /></td>
</tr> <tr> <td class = "info" colspan = "2"><?php
echo t('The data directory is where your files and information about' .
' your files will be stored. You should put it outside your web ' .
'site, or at least restrict the access of this directory. Do not ' .
'forget the ending slash!');
?></td> </tr> <tr> <td class = "label"><label for = "input_var_root"
><?php echo t('Data directory') . ':';
?></label></td>
<td class = "field"><input type = "text" name = "var_root"
id = "input_var_root" value = "<?php
if(empty($cfg['var_root'])) {
$alphanum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
'abcdefghijklmnopqrstuvwxyz' . '0123456789';
$len_alphanum = strlen($alphanum);
$var = 'var-';
for($i = 0; $i <JIRAFEAU_VAR_RAND_LENGTH; $i++) {
$var .= substr($alphanum, mt_rand(0, $len_alphanum - 1), 1);
}
echo JIRAFEAU_ROOT . $var . '/';
}
else
echo $cfg['var_root'];
?>" size = "40" /></td>
</tr> <tr> <td colspan = "2"><input type = "submit"
class = "navleft" name = "previous" value = "<?php
echo t('Previous step'); ?>" />
<input type = "submit" class = "navright" name = "next" value = "
<?php echo t('Next step'); ?>" />
</td> </tr> </table> </fieldset>
</form> </div> <?php
break;
case 4:
?><h2><?php printf (t('Installation of Jirafeau') . ' - ' . t('step') .
' %d ' . t('out of') . ' %d', 4, 4);
?></h2> <div id = "install"> <form action =
"<?php echo basename(__FILE__); ?>" method = "post"> <input type =
"hidden" name = "jirafeau" value =
"<?php echo JIRAFEAU_VERSION; ?>" /><input type = "hidden" name =
"step" value =
"4" /><fieldset> <legend><?php echo t('Finalisation');
?></legend> <table> <tr> <td class = "info" colspan =
"2"><?php echo
t ('Jirafeau is setting the website according to the configuration ' .
'you provided.');
?></td> </tr> <tr> <td class = "nav previous"><input type =
"submit" name = "previous" value =
"
<?php
echo t('Previous step');
?>" /></td> <td></td> </tr>
</table> </fieldset> </form> </div>
<?php
$err = jirafeau_check_var_dir ($cfg['var_root']);
if ($err['has_error'])
{
echo '<div class="error"><p>'.$err['why'].'<br />'.NL;
?><form action = "<?php echo basename(__FILE__); ?>" method =
"post"> <input type = "hidden" name = "jirafeau" value =
"<?php echo JIRAFEAU_VERSION; ?>" /><input type = "hidden" name =
"step" value = "4" /><input type = "submit" name =
"retry" value =
"<?php echo t('Retry this step'); ?>" /></form>
<?php echo '</p></div>';
}
else
{
echo '<div class="message"><p>' .
t('Jirafeau is now fully operational') . ':' .
'<br /><a href="' . $cfg['web_root'] . '">' .
$cfg['web_root'].'</a></p></div>';
}
break;
}
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
?>

View file

@ -0,0 +1,64 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* default configuration
* if you want to change this, overwrite in a config.local.php file
*/
global $cfg;
/* don't forget the ending '/' */
$cfg['web_root'] = '';
$cfg['var_root'] = '';
/* Lang choice between 'auto', 'en' and 'fr'.
'auto' mode will take the user's browser informations. Will take english if
user's langage is not available.
*/
$cfg['lang'] = 'auto';
$cfg['style'] = 'modern';
$cfg['rewrite'] = false;
/* An empty admin password will disable the admin interface. */
$cfg['admin_password'] = '';
/* preview: false (will download file) or true (will preview in browser if
* possible) . */
$cfg['preview'] = true;
/* Download page:
* true: Will show a download page (with preview if permited and possible).
* false: Will directly download file or preview (if permited and possible). */
$cfg['download_page'] = false;
/* Block feature:
The scripting interface can propose to create, read, write, delete blocks
of data. */
$cfg['enable_blocks'] = false;
/* Encryption feature. disable it by default.
* By enabling it, file-level deduplication won't work. */
$cfg['enable_crypt'] = false;
/* Split lenght of link refenrece. */
$cfg['link_name_lenght'] = 8;
/* Upload password. Empty string disable the password. */
$cfg['upload_password'] = '';
if ((basename (__FILE__) != 'config.local.php')
&& file_exists (JIRAFEAU_ROOT.'lib/config.local.php'))
{
require (JIRAFEAU_ROOT.'lib/config.local.php');
}
?>

301
sources/lib/functions.js Executable file
View file

@ -0,0 +1,301 @@
/*
* Jirafeau, your web file repository
* Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function show_link (url, reference, delete_code, crypt_key, date)
{
var download_link = url + 'f.php?h=' + reference;
var download_link_href = url + 'f.php?h=' + reference;
if (crypt_key.length > 0)
{
download_link += '&amp;k=' + crypt_key;
download_link_href += '&k=' + crypt_key;
}
var delete_link = url + 'f.php?h=' + reference + '&amp;d=' + delete_code;
var delete_link_href = url + 'f.php?h=' + reference + '&d=' + delete_code;
document.getElementById('upload_link').innerHTML = download_link;
document.getElementById('upload_link').href = download_link_href;
document.getElementById('delete_link').innerHTML = delete_link;
document.getElementById('delete_link').href = delete_link_href;
if (date)
{
document.getElementById('date').innerHTML = date;
document.getElementById('validity').style.display = '';
}
else
document.getElementById('validity').style.display = 'none';
document.getElementById('uploading').style.display = 'none';
document.getElementById('upload').style.display = 'none';
document.getElementById('upload_finished').style.display = '';
document.title = 'Jirafeau - 100%';
}
function show_upload_progression (p)
{
document.getElementById('uploaded_percentage').innerHTML = p;
document.title = 'Jirafeau - ' + p;
}
function upload_progress (e)
{
if (!e.lengthComputable)
return;
/* Show the user the operation do not reach 100%, the server need time
* to give a response before providing the link.
*/
var p = Math.round (e.loaded * 100 / e.total);
if (p == 100)
show_upload_progression (' ');
else
show_upload_progression (p.toString() + '%');
}
function upload_failed (e)
{
/* Todo: Considere showing a error div. */
alert ('Sorry, upload failed');
}
function classic_upload (url, file, time, password, one_time, upload_password)
{
var req = new XMLHttpRequest ();
req.upload.addEventListener ("progress", upload_progress, false);
req.addEventListener ("error", upload_failed, false);
req.addEventListener ("abort", upload_failed, false);
req.onreadystatechange = function ()
{
if (req.readyState == 4 && req.status == 200)
{
var res = req.responseText;
if (res == "Error")
return;
res = res.split ("\n");
if (time != 'none')
{
var d = new Date();
if (time == 'minute')
d.setSeconds (d.getSeconds() + 60);
else if (time == 'hour')
d.setSeconds (d.getSeconds() + 3600);
else if (time == 'day')
d.setSeconds (d.getSeconds() + 86400);
else if (time == 'week')
d.setSeconds (d.getSeconds() + 604800);
else if (time == 'month')
d.setSeconds (d.getSeconds() + 2419200);
else
return;
show_link (url, res[0], res[1], res[2], d.toString());
}
else
show_link (url, res[0], res[1], res[2]);
}
}
req.open ("POST", url + 'script.php' , true);
var form = new FormData();
form.append ("file", file);
if (time)
form.append ("time", time);
if (password)
form.append ("key", password);
if (one_time)
form.append ("one_time_download", '1');
if (upload_password.length > 0)
form.append ("upload_password", upload_password);
req.send (form);
}
function check_html5_file_api ()
{
if (window.File && window.FileReader && window.FileList && window.Blob)
return true;
return false;
}
var async_global_transfered = 0;
var async_global_url = '';
var async_global_file;
var async_global_ref = '';
var async_global_max_size = 0;
var async_global_time;
var async_global_transfering = 0;
function async_upload_start (url, max_size, file, time, password, one_time, upload_password)
{
async_global_transfered = 0;
async_global_url = url;
async_global_file = file;
async_global_max_size = max_size;
async_global_time = time;
var req = new XMLHttpRequest ();
req.addEventListener ("error", upload_failed, false);
req.addEventListener ("abort", upload_failed, false);
req.onreadystatechange = function ()
{
if (req.readyState == 4 && req.status == 200)
{
var res = req.responseText;
if (res == "Error")
return;
res = res.split ("\n");
async_global_ref = res[0];
var code = res[1];
async_upload_push (code);
}
}
req.open ("POST", async_global_url + 'script.php?init_async' , true);
var form = new FormData();
form.append ("filename", async_global_file.name);
form.append ("type", async_global_file.type);
if (time)
form.append ("time", time);
if (password)
form.append ("key", password);
if (one_time)
form.append ("one_time_download", '1');
if (upload_password.length > 0)
form.append ("upload_password", upload_password);
req.send (form);
}
function async_upload_progress (e)
{
if (!e.lengthComputable && async_global_file.size != 0)
return;
var p = Math.round ((e.loaded + async_global_transfered) * 100 / (async_global_file.size));
if (p == 100)
show_upload_progression (' ');
else
show_upload_progression (p.toString() + '%');
}
function async_upload_push (code)
{
if (async_global_transfered == async_global_file.size)
{
async_upload_end (code);
return;
}
var req = new XMLHttpRequest ();
req.upload.addEventListener ("progress", async_upload_progress, false);
req.addEventListener ("error", upload_failed, false);
req.addEventListener ("abort", upload_failed, false);
req.onreadystatechange = function ()
{
if (req.readyState == 4 && req.status == 200)
{
var res = req.responseText;
if (res == "Error")
return;
res = res.split ("\n");
var code = res[0]
async_global_transfered = async_global_transfering;
async_upload_push (code);
}
}
req.open ("POST", async_global_url + 'script.php?push_async' , true);
var chunk_size = parseInt (async_global_max_size * 0.50);
var start = async_global_transfered;
var end = start + chunk_size;
if (end >= async_global_file.size)
end = async_global_file.size;
var blob = async_global_file.slice (start, end);
async_global_transfering = end;
var form = new FormData();
form.append ("ref", async_global_ref);
form.append ("data", blob);
form.append ("code", code);
req.send (form);
}
function async_upload_end (code)
{
var req = new XMLHttpRequest ();
req.addEventListener ("error", upload_failed, false);
req.addEventListener ("abort", upload_failed, false);
req.onreadystatechange = function ()
{
if (req.readyState == 4 && req.status == 200)
{
var res = req.responseText;
if (res == "Error")
return;
res = res.split ("\n");
if (async_global_time != 'none')
{
var d = new Date();
if (async_global_time == 'minute')
d.setSeconds (d.getSeconds() + 60);
else if (async_global_time == 'hour')
d.setSeconds (d.getSeconds() + 3600);
else if (async_global_time == 'day')
d.setSeconds (d.getSeconds() + 86400);
else if (async_global_time == 'week')
d.setSeconds (d.getSeconds() + 604800);
else if (async_global_time == 'month')
d.setSeconds (d.getSeconds() + 2419200);
else
return;
show_link (async_global_url, res[0], res[1], res[2], d.toString());
}
else
show_link (async_global_url, res[0], res[1], res[2]);
}
}
req.open ("POST", async_global_url + 'script.php?end_async' , true);
var form = new FormData();
form.append ("ref", async_global_ref);
form.append ("code", code);
req.send (form);
}
function upload (url, max_size)
{
if (check_html5_file_api ()
&& document.getElementById('file_select').files[0].size >= max_size)
{
async_upload_start (url,
max_size,
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
document.getElementById('one_time_download').checked,
document.getElementById('upload_password').value
);
}
else
{
classic_upload (url,
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
document.getElementById('one_time_download').checked,
document.getElementById('upload_password').value
);
}
}

1380
sources/lib/functions.php Executable file

File diff suppressed because it is too large Load diff

57
sources/lib/lang.php Executable file
View file

@ -0,0 +1,57 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
global $languages_list;
$languages_list = array ('auto' => 'Automatic',
'en' => 'English',
'fr' => 'Français');
/* Translation */
function t ($text)
{
$cfg = $GLOBALS['cfg'];
$languages_list = $GLOBALS['languages_list'];
/* Detect user's langage if we are in automatic mode. */
if (strcmp ($cfg['lang'], 'auto') == 0)
$l = substr ($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
else
$l = $cfg['lang'];
/* Is the langage in the list ? */
$found = false;
foreach ($languages_list as $key => $v)
if (strcmp ($l, $key) == 0)
$found = true;
/* Get translation execpt for english. */
if ($found && strcmp ($l, "en"))
{
/* $tr is defined in this requirement. */
require (JIRAFEAU_ROOT . "lib/lang/$l.php");
foreach ($tr as $o => $t)
if (strcmp ($text, $o) == 0)
return "$t";
}
/* Return original text if no translation is found or already in english. */
return ($text);
}
?>

178
sources/lib/lang/fr.php Executable file
View file

@ -0,0 +1,178 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2013
* Jerome Jutteau <j.jutteau@gmail.com>
* Jimmy Beauvois <jimmy.beauvois@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$tr = array (
/* index.php */
'Jirafeau, your web file repository' => 'Jirafeau, votre dépot de fichiers',
'Select a file' => 'Sélectionner un fichier à envoyer:',
'Send' => 'Envoyer',
'Uploading ...' => 'Envoi en cours ...',
'One time download' => 'Téléchargement unique',
'Password' => 'Mot de passe',
'Time limit' => 'Limite de temps',
'Maximum file size' => 'Taille maximale',
'powered by Open-Source project Jirafeau' => 'Propulsé par le projet Open-Source Jirafeau',
'Jirafeau Project' => 'Projet Jirafeau',
'None' => 'Aucune',
'One minute' => 'Une minute',
'One hour' => 'Une heure',
'One day' => 'Une journée',
'One week' => 'Une semaine',
'One month' => 'Un mois',
'Upload password' => 'Mot de passe',
'The file directory is not writable' => 'Le dossier \'file\' ne peut être écrit.',
'The link directory is not writable' => 'Le dossier \'link\' ne peut être écrit.',
'The async directory is not writable!' => 'Le dossier \'async\' ne peut être écrit.',
'Installer script still present' => 'Le script d\'installation est toujours présent',
'Please make sure to delete the installer script "install.php" before continuing.' => 'Merci de supprimer le fichier "install.php" avant de continuer.',
'An error occurred.' => 'Une erreur s\'est produite',
'File uploaded! Copy the following URL to get it' => 'Fichier envoyé! Le fichier sera accessible à l\'adresse suivante',
'This file is valid until the following date' => 'Ce fichier est valable jusqu\'à la date suivante',
'Keep the following URL to delete it at any moment' => 'Vous pouvez supprimer le fichier lorsque vous le désirez via l\'adresse suivante',
/* f.php */
'Download' => 'Télécharger',
'Sorry, the requested file is not found' => 'Désolé, le fichier que vous demandez n\'existe pas ou n\'existe plus',
'File not available.' => 'Fichier non disponible',
'File has been deleted.' => 'Le fichier a été supprimé.',
'The time limit of this file has expired.' => 'La limite de temps est dépassée.',
'Password protection' => 'Protection par mot de passe',
'Give the password of this file' => 'Donnez le mot de passe pour ce fichier',
'Access denied' => 'Accès interdit',
'You are about to download' => 'Vous êtes sur le point de télécharger',
'By using our services, you accept of our' => 'En utilisant nos services, vous acceptez nos',
'Term Of Service' => 'Conditions d\'utilisation',
/* functions.php */
'Internal error during file creation.' => 'Erreur interne lors la creation de fichier.',
/* install.hpp */
'This file was generated by the install process. You can edit it. Please see config.original.php to understand the configuration items.' => 'Ce fichier a été généré par le processus d\'installation. Vous pouvez l\'éditer. Merci de se référer à config.original.php pour comprendre les éléments de configuration.',
'The following directory could not be created' => 'Le dossier suivant ne peut être créé',
'You should create this directory by hand.' => 'Vous devriez creer manuelement ce dossier',
'The following directory is not writable' => 'Le dossier suivant ne peut être créé',
'You should give the write right to the web server on this directory.' => 'Vous devriez donner le droits d\'écriture à ce repertoire pour le rendre accessible par le serveur web.',
'Here is a solution' => 'Une solution possible',
'The local configuration file could not be created. Create a ' .
'<code>lib/config.local.php</code> file and give the write ' .
'right to the web server (preferred solution), or give the ' .
'write right to the web server on the <code>lib</code> ' .
'directory.' => 'Le fichier de configuration local ne peut être créé. Creez le fichier <code>lib/config.local.php</code> et donnez lui les droits d\'écriture par le serveur web (solution préférable) ou bien donnez les accès en écriture au dossier <code>lib</code>',
'The local configuration is not writable by the web server. ' .
'Give the write right to the web server on the ' .
'<code>lib/config.local.php</code> file.' => 'Le fichier de configuration local ne peut être écrit. Donnez les droits d\'écriture au fichier <code>lib/config.local.php</code> par le serveur web.',
'Installation of Jirafeau' => 'Installation de Jirafeau',
'step' => 'étape',
'out of' => 'sur',
'Administration password' => 'Mot de passe d\'administration',
'Clean unused blocks' => 'Nettoie les bloques inutilisés',
'Finalisation' => 'Finalisation',
'Jirafeau is setting the website according to the configuration you provided.' => 'Jirafeau se configure selon les paramêtres donnés',
'Previous step' => 'Etape précedente',
'Retry this step' => 'Ressayer cette étape',
'Jirafeau is now fully operational' => 'Jirafeau est maintenant utilisable',
'Information' => 'Information',
'The base address of Jirafeau is the first part of the URL, until (and including) the last slash. For example: "http://www.example.com/". Do not forget the ending slash!'
=> 'L\'adresse d\'origine de Jirafeau est la première partie de l\'URL (slash de fin inclue). Par exemple: "http://www.exemple.com/". N\'oubliez pas le slash de fin !',
'Base address' => 'Addresse d\'origine',
'The data directory is where your files and information about your files will be stored. You should put it outside your web site, or at least restrict the access of this directory. Do not forget the ending slash!'
=> 'Le dossier "data" est là où seront stoqués les fichiers ainsi que leurs informations. Ce dossier ne devrait pas être accessible directement par l\'utilisateur. N\'oubliez pas le slash de fin !',
'Data directory' => 'Dossier de stockage des données',
'Jirafeau is internationalised. Choose a specific langage or choose Automatic (langage is provided by user\'s browser).'
=> 'Jirafeau supporte plusieurs languages. Choisissez un langage spécific ou Automatic (la langue utilisée est alors fournie par le navigateur du visiteur).',
'Choose the default language' => 'Choisissez la langue par defaut',
'Next step' => 'Etape suivante',
'Jirafeau has an administration interface (through admin.php). ' .
'You can set a password to access the intercace or let it be empty ' .
'to disable the interface.' => 'Jirafeau a une interface d\'administration (accessible via admin.php). Vous pouvez saisir un mot de passe pour y acceder ou ne pas en mettre pour désactiver l\'accès à l\'interface.',
'Administration password' => 'Mot de passe d\'administration',
/* admin.php */
'Sorry, the admin interface is not enabled.' => 'Désolé, l\'interface d\'administration n\'est pas activée.',
'Login' => 'Connexion',
'Wrong password.' => 'Mot de passe invalide.',
'Admin interface' => 'Interface d\'administration',
'Clean expired files' => 'Nettoyer les fichiers périmés',
'Clean old unfinished transferts' => 'Nettoyer les anciens transferts inachevés',
'Clean' => 'Nettoyage',
'Search files by name' => 'Rechercher les fichiers par leur nom',
'Search' => 'Rechercher',
'List all files' => 'Lister tous les fichiers',
'List' => 'Lister',
'Actions' => 'Actions',
'Search files by file hash' => 'Rechercher par empreinte de fichier',
'Search a specific link' => 'Rechercher un lien particulier',
'Number of cleaned files' => 'Nombre de fichiers nettoyés',
'Logout' => 'Déconnexion',
'You are now Logout' => 'Vous êtes maintenant déconnecté',
'Link deleted' => 'Lien supprimé',
'Filename' => 'Nom',
'file' => 'fichier',
'link' => 'lien',
'Type' => 'Type',
'Size' => 'Taille',
'Expire' => 'Expiration',
'Onetime' => 'Une fois',
'Upload date' => 'Date d\'envoie',
'Origin' => 'Origine',
'Action' => 'Action',
'Del link' => 'Supprimer le lien',
'Del file and links' => 'Supprimer fichier et liens',
'Deleted links' => 'Liens supprimés',
/* script.php */
'Welcome to Jirafeau\'s query interface' => 'Bienvenue sur l\'interface programmable de Jirafeau',
'This interface permits to script your uploads and downloads.' => 'Cette interface permet de programmer vos envoie et téléversements.',
'The instructions above show how to query this interface.' => 'Les instructions ci-dessous montrent comment interroger cette interface.',
'Get server capacity' => 'Récupérer la capacité d\'envoie du serveur',
'Get Jirafeau\'s version' => 'Récupérer la version de Jirafeau',
'Send a GET query to' => 'Envoyez une requette GET à',
'Send a POST query to' => 'Envoyez une requette POST à',
'Upload a file' => 'Envoyer un fichier',
'Get a file' => 'Récupérer un ficher',
'Required' => 'Requis',
'Optional' => 'Optionel',
'Parameters' => 'Paramètres',
'This will return brut text content.' => 'Retourne un texte brut.',
'First line is the download reference and the second line the delete code.' => 'La première ligne correspond à la reference de l\'envoie et la seconde ligne correspond au code de suppréssion.',
'First line is the server capacity (in Bytes).' => 'La première ligne correspond à la capacité du serveur (en octets).',
'Example' => 'Exemple',
'If a password has been set, send a POST request with it.' => 'Si un mot de passe a été définis, envoyer une requette POST avec.',
'Delete a file' => 'Supprimer un fichier',
'This will return "Ok" if succeded, "Error" otherwhise.' => 'Retourne "OK" en cas de succès, "Error" dans le cas contraire.',
'Get a generated scripts' => 'Récupérer un script généré',
'This will return brut text content of the code.' => 'Renvoie le code sous forme the texte brut.',
'Initalize a asynchronous transfert' => 'Initialiser un transfert asynchrone',
'The goal is to permit to transfert big file, chunk by chunk.' => 'Le but est de permettre de transférer de gros fichiers, morceaux par morceaux.',
'Chunks of data must be sent in order.' => 'Chaque morceau doit être envoyé dans l\'ordre.',
'First line is the asynchronous transfert reference and the second line the code to use in the next operation.'
=> 'La première ligne correspond à la référence de transfert asynchrone, la seconde au code à utiliser dans la prochaine requette.',
'Push data during asynchronous transfert' => 'Envoyer des données pendant un transfert asynchrone',
'Returns the next code to use.' => 'Renvoie le prochain code à utiliser.',
'Finalize asynchronous transfert' => 'Finaliser un transfert asynchrone',
'Create a data block' => 'Creer un bloque de données',
'This interface permits to create a block of data filled with zeros.' => 'Cette interface permet de creer un bloque de données remplies de zeros.',
'You can read selected parts, write (using a code) and delete the block.' => 'Vous pouvez lire, écrire (en utilisant un code) et supprimer le bloque.',
'Blocks may be removed after a month of non usage.' => 'Les bloques non utilisés depuis plus d\'un mois seront probablement supprimés.',
'Get block size' => 'Récupérer la taille d\'un bloque',
'Read data in a block' => 'Lire des données dans un bloque',
'Write data in a block' => 'Ecrire des données dans un bloque',
'First line is a block id the second line the edit/delete code.' => 'La premiere ligne est l\'identifiant du bloque, la seconde est son code d\'écriture/suppression.',
'This will return asked data or "Error" string.' => 'Retourne les données ou la chaine "Error".',
'Delete a block' => 'Supprimer un bloque',
'This will return "Ok" or "Error" string.' => 'Retourn la chaine "Ok" ou "Error".',
);
?>

40
sources/lib/settings.php Normal file
View file

@ -0,0 +1,40 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Jirafeau constants */
define ('JIRAFEAU_PACKAGE', 'Jirafeau');
define ('JIRAFEAU_VERSION', '1.0');
/* Directories. */
define ('VAR_FILES', $cfg['var_root'] . 'files/');
define ('VAR_LINKS', $cfg['var_root'] . 'links/');
define ('VAR_ASYNC', $cfg['var_root'] . 'async/');
define ('VAR_BLOCK', $cfg['var_root'] . 'block/');
/* Useful constants. */
if (!defined ('NL'))
define ('NL', "\n");
define ('JIRAFEAU_INFINITY', -1);
define ('JIRAFEAU_MINUTE', 60); // 60
define ('JIRAFEAU_HOUR', 3600); // JIRAFEAU_MINUTE * 60
define ('JIRAFEAU_DAY', 86400); // JIRAFEAU_HOUR * 24
define ('JIRAFEAU_WEEK', 604800); // JIRAFEAU_DAY * 7
define ('JIRAFEAU_MONTH', 2419200); // JIRAFEAU_WEEK * 4
?>

View file

@ -0,0 +1,9 @@
<div id="copyright">
<p><a href="https://gitorious.org/jirafeau"></a><br /><a href="http://www.gnu.org/licenses/agpl.html">agplv3</a> | <a href="https://gitorious.org/jirafeau">Jirafeau Project</a> | <a href="<?php echo $cfg['web_root'] . '/tos.php'; ?>">Terms of Service</a></p>
</div>
</div>
<div id="jyraphe">
</div>
</body>
</html>

View file

@ -0,0 +1,34 @@
<?php
header("Vary: Accept");
$content_type = 'text/html; charset=utf-8';
if (stristr ($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml'))
$content_type = 'application/xhtml+xml; charset=utf-8';
header('Content-Type: ' . $content_type);
/* Avoids irritating errors with the installer (no conf file is present then). */
if (!isset ($cfg['web_root']))
$web_root = 'http://' . $_SERVER['HTTP_HOST'] . '/';
else
$web_root = $cfg['web_root'];
if (!isset ($cfg['style']))
$style = 'default';
else
$style = $cfg['style'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo t('Jirafeau, your web file repository'); ?></title>
<meta http-equiv="Content-Type" content="<?php echo $content_type; ?>" />
<link href="<?php echo $web_root . 'media/' . $style . '/style.css.php'; ?>" rel="stylesheet" type="text/css" />
</head>
<body>
<script language="Javascript" src="lib/functions.js"></script>
<div id="content">
<h1><a href="<?php echo $web_root; ?>"><?php echo t('Jirafeau, your web file repository'); ?></a></h1>

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

View file

@ -0,0 +1,178 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This stylesheet is the default stylesheet for Jirafeau.
* The content is dynamically generated for easier handling.
*/
$dark = '#8B4513';
header("Content-type: text/css");
?>
body {
text-align: center;
font-family: sans-serif;
width: 60em;
margin: 2ex auto;
border: <?php echo $dark; ?> 5px solid;
}
h1 a {
text-decoration: none;
color: black;
border-bottom: <?php echo $dark; ?> 1px dotted;
}
#content {
padding: 0 4em;
background: url('jirafeau.png') left top repeat-y;
}
#upload {
width: 25em;
margin: 5ex auto;
}
#upload table {
width: 100%;
}
#upload .config {
font-size: smaller;
}
#upload .info {
text-align: left;
font-size: smaller;
border-bottom: <?php echo $dark; ?> 1px dashed;
}
#upload .more {
cursor: pointer;
}
#upload .more:after {
content: ' ▼';
}
#upload .activation {
text-align: left;
font-style: italic;
}
#upload .label {
text-align: left;
vertical-align: top;
font-size: smaller;
}
#upload .field {
text-align: right;
vertical-align: bottom;
}
#upload p {
margin: 0.8ex 0;
}
#moreoptions p {
text-align: left;
}
#copyright {
font-size: smaller;
}
.error, .message {
width: 50em;
margin: 5ex auto;
}
.error {
padding-bottom: 1ex;
border: red 2px solid;
background-color: #FBB;
}
.error p:before {
content: url('error.png');
padding-right: 1ex;
}
.message {
padding: 1ex;
border: green 2px solid;
background-color: #BFB;
}
.message p:before {
content: url('ok.png');
padding-right: 1ex;
}
#install {
width: 40em;
margin: 5ex auto;
}
#install table {
width: 100%;
}
#install label {
font-style: italic;
}
#install .info {
text-align: justify;
padding-bottom: 1ex;
}
#install .label {
text-align: justify;
vertical-align: top;
}
#install .field {
text-align: right;
vertical-align: bottom;
}
#install .nav {
padding-top: 2em;
}
#install .next {
text-align: right;
}
#install .previous {
text-align: left;
}
#install .navright {
float: right;
}
#install .navleft {
float: left;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
sources/media/industrial/ok.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

View file

@ -0,0 +1,183 @@
<?php
/*
* Jyraphe, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This stylesheet is the default stylesheet for Jyraphe.
* The content is dynamically generated for easier handling.
*/
$dark = '#8B4513';
header("Content-type: text/css");
?>
body {
font-family: sans-serif;
text-align: center;
margin: 2ex auto;
background: white;
/* border: <?php echo $dark; ?> 5px solid; */
}
fieldset {
text-align: left;
width: 40em;
margin: auto;
background: #E2f5ff;
border: 2px solid #02233f;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
fieldset legend {
color: white;
background: #02233f;
border: 2px solid #02233f;
padding: 1px 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
h1 {
width: 100%;
text-align: center;
background: url('bandeau.png') left top repeat-x;
height: 70px;
padding-top: 30px;
}
h1 a {
text-decoration: none;
color: white;
}
fieldset p {
margin-left: 25%;
}
.jyraphe_info {
font-size: small;
margin-left: 30%;
}
label {
float: left;
width: 12em;
}
input[type=text], input[type=submit], select {
color: black;
width: 15em;
border: 1px #02233f solid;
background: white;
}
input:hover {
color: white;
background: #02233f;
}
#jyraphe {
background: url('jyraphe.png') right bottom no-repeat;
position: fixed;
bottom: 0;
right: 0;
height: 100px;
width: 100px;
clear:both;
}
#copyright {
text-align: center;
}
.error, .message {
width: 50em;
margin: 5ex auto;
}
.error {
padding-bottom: 1ex;
border: red 2px solid;
background-color: #FBB;
}
.error p:before {
content: url('error.png');
padding-right: 1ex;
}
.message {
padding: 1ex;
border: green 2px solid;
background-color: #BFB;
}
.message p:before {
content: url('ok.png');
padding-right: 1ex;
}
.info {
text-align: left;
width: 40em;
margin: auto;
background: #E2f5ff;
border: 2px solid #02233f;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.info h2 {
text-align: center;
}
.info h3 {
text-align: center;
}
.info p {
margin-left: 5%;
margin-right: 5%;
}
#upload {
text-align: center;
width: 30em;
background: #E2f5ff;
border: 2px solid #02233f;
margin: auto;
}
#uploading {
text-align: center;
width: 30em;
background: #E2f5ff;
border: 2px solid #02233f;
margin: auto;
}
#upload_finished {
text-align: center;
width: 60em;
background: #E2f5ff;
border: 2px solid #02233f;
margin: auto;
}

BIN
sources/media/modern/bandeau.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

BIN
sources/media/modern/error.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

BIN
sources/media/modern/jyraphe.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
sources/media/modern/ok.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

View file

@ -0,0 +1,216 @@
<?php
/*
* Jyraphe, your web file repository
* Copyright (C) 2013
* Jerome Jutteau <j.jutteau@gmail.com>
* Jimmy Beauvois <jimmy.beauvois@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This stylesheet is the default stylesheet for Jyraphe.
* The content is dynamically generated for easier handling.
*/
$dark = '#8B4513';
header("Content-type: text/css");
?>
body {
font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif;
font-size: 100%;
color:#333333;
margin:0;
background:#e5e5e5;
}
a, a:link, a:visited {
color: #223344;
text-decoration: underlined;
}
fieldset {
text-align: left;
font-size:90%;
width: 50em;
margin: auto;
background: white;
border: 2px solid #dbdbdb;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
fieldset legend {
color: white;
font-size:130%;
background: #cf3b19;
border: 1px solid #A52E13;
padding: 5px 20px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
h1 {
font-size: 175%;
width: 100%;
text-align: center;
height: 50px;
padding-top: 30px;
}
h1 a {
text-decoration: none;
color: #333;
}
fieldset p {
margin-left: 25%;
}
.jyraphe_info {
font-size: 120%;
margin-left: 30%;
}
label {
float: left;
width: 12em;
}
input[type=text], input[type=submit], select {
width: 15em;
font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif;
}
#jyraphe {
background: url('jyraphe.png') right bottom no-repeat;
position: fixed;
bottom: 0;
right: 0;
height: 50px;
width: 50px;
clear:both;
}
#copyright {
text-align: center;
font-size: 70%;
}
.error, .message {
width: 50em;
margin: 5ex auto;
}
.error {
text-align: center;
padding-bottom: 1ex;
border: #FB7373 2px solid;
background-color: #FBB;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.error p:before {
text-align: center;
content: url('error.png');
padding-right: 1ex;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.message {
text-align: center;
padding: 1ex;
border: #91C27C 2px solid;
background-color: #BFB;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.message p:before {
content: url('ok.png');
padding-right: 1ex;
}
.info {
text-align: left;
width: 50em;
margin: auto;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.info h2 {
text-align: left;
}
.info h3 {
text-align: center;
}
.info p {
margin-left: 5%;
margin-right: 5%;
}
#upload {
text-align: left;
font-size: 90%;
width: 50em;
background: #e5e5e5;
border: 0px solid #CCCCCC;
margin: auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#uploading {
text-align: center;
width: 50em;
background: white;
border: 2px solid #CCCCCC;
margin: auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#upload_finished {
font-size:90%;
text-align: center;
padding-top: 20px;
padding-bottom: 20px;
width: 50em;
background: #B6D7A8;
border: 2px solid #91C27C;
margin: auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}

658
sources/script.php Executable file
View file

@ -0,0 +1,658 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This file permits to easyly script file sending, receiving, deleting, ...
* If you don't want this feature, you can simply delete this file from your
* web directory.
*/
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
require (JIRAFEAU_ROOT . 'lib/lang.php');
global $script_langages;
$script_langages = array ('bash' => 'Bash');
/* Operations may take a long time.
* Be sure PHP's safe mode is off.
*/
@set_time_limit(0);
/* Remove errors. */
@error_reporting(0);
if ($_SERVER['REQUEST_METHOD'] == "GET" && count ($_GET) == 0)
{
require (JIRAFEAU_ROOT . 'lib/template/header.php');
check_errors ();
if (has_error ())
{
show_errors ();
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
exit;
}
echo '<div class="info">';
echo '<h2>' . t('Welcome to Jirafeau\'s query interface') . '</h2>';
echo '<p>';
echo t('This interface permits to script your uploads and downloads.') .
' ' . t('The instructions above show how to query this interface.');
echo '</p>';
echo '<h3>' . t('Get Jirafeau\'s version') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>get_version=</b>1<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('First line is the version number.') . '<br /></p>';
echo '<p>';
echo t('Example') . ": <a href=\"" . $web_root . "script.php?get_version=1\">" . $web_root . "script.php?get_version=1</a> ";
echo '</p>';
echo '<h3>' . t('Get server capacity') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>get_capacity=</b>1<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('First line is the server capacity (in Bytes).') . '<br /></p>';
echo '<p>';
echo t('Example') . ": <a href=\"" . $web_root . "script.php?get_capacity=1\">" . $web_root . "script.php?get_capacity=1</a> ";
echo '</p>';
echo '<h3>' . t('Upload a file') . ':</h3>';
echo '<p>';
echo t('Send a POST query to') . ': <i>' . $web_root . 'script.php</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>file=</b>C:\\your\\file\\path<i> (" . t('Required') . ")</i> <br />";
echo "<b>time=</b>[minute|hour|day|week|month|none]<i> (" . t('Optional') . ', '. t('default: none') . ")</i> <br />";
echo "<b>password=</b>your_password<i> (" . t('Optional') . ")</i> <br />";
echo "<b>one_time_download=</b>1<i> (" . t('Optional') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('First line is the download reference and the second line the delete code.') . '<br /></p>';
echo '<h3>' . t('Get a file') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>h=</b>your_download_reference<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>';
echo t('If a password has been set, send a POST request with it.');
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>password=</b>your_password<i> (" . t('Optional') . ")</i> <br />";
echo '</p>';
echo '<p>';
echo t('Example') . ": <a href=\"" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU\">" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU</a> ";
echo '</p>';
echo '<h3>' . t('Delete a file') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>h=</b>your_download_reference<i> (" . t('Required') . ")</i> <br />";
echo "<b>d=</b>yout_delete_code<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return "Ok" if succeded, "Error" otherwhise.') . '<br /></p>';
echo '<p>';
echo t('Example') . ": <a href=\"" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU&amp;d=0d210a952\">" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU&amp;d=0d210a952</a> ";
echo '</p>';
echo '<h3>' . t('Get a generated scripts') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>lang=</b>[";
foreach ($script_langages as $lang => $name)
echo $lang;
echo "]<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content of the code.') . '<br /></p>';
echo '<p>';
echo t('Example') . ": <br />";
foreach ($script_langages as $lang => $name)
echo "$name: <a href=\"" . $web_root . "script.php?lang=$lang\">" . $web_root . "script.php?lang=$lang</a> ";
echo '</p>';
echo '<h3>' . t('Initalize a asynchronous transfert') . ':</h3>';
echo '<p>';
echo t('The goal is to permit to transfert big file, chunk by chunk.') . ' ';
echo t('Chunks of data must be sent in order.');
echo '</p>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?init_async</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>filename=</b>file_name.ext<i> (" . t('Required') . ")</i> <br />";
echo "<b>type=</b>MIME_TYPE<i> (" . t('Optional') . ")</i> <br />";
echo "<b>time=</b>[minute|hour|day|week|month|none]<i> (" . t('Optional') . ', '. t('default: none') . ")</i> <br />";
echo "<b>password=</b>your_password<i> (" . t('Optional') . ")</i> <br />";
echo "<b>one_time_download=</b>1<i> (" . t('Optional') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('First line is the asynchronous transfert reference and the second line the code to use in the next operation.') . '<br /></p>';
echo '<h3>' . t('Push data during asynchronous transfert') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?push_async</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>ref=</b>async_reference<i> (" . t('Required') . ")</i> <br />";
echo "<b>data=</b>data_chunk<i> (" . t('Required') . ")</i> <br />";
echo "<b>code=</b>last_provided_code<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('Returns the next code to use.') . '<br /></p>';
echo '<h3>' . t('Finalize asynchronous transfert') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?end_async</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>ref=</b>async_reference<i> (" . t('Required') . ")</i> <br />";
echo "<b>code=</b>last_provided_code<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('First line is the download reference and the second line the delete code.') . '<br /></p>';
if ($cfg['enable_blocks'])
{
echo '<h3>' . t('Create a data block') . ':</h3>';
echo '<p>';
echo t('This interface permits to create a block of data filled with zeros.') .
' ' . t('You can read selected parts, write (using a code) and delete the block.') .
' ' . t('Blocks may be removed after a month of non usage.');
echo '</p>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?init_block</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>size=</b>size_in_bytes<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return brut text content.') . ' ' .
t('First line is a block id the second line the edit/delete code.') . '<br /></p>';
echo '<h3>' . t('Get block size') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?get_block_size</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return asked data or "Error" string.') . '<br /></p>';
echo '<h3>' . t('Read data in a block') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?read_block</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
echo "<b>start=</b>byte_position_starting_from_zero<i> (" . t('Required') . ")</i> <br />";
echo "<b>length=</b>length_to_read_in_bytes<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return asked data or "Error" string.') . '<br /></p>';
echo '<h3>' . t('Write data in a block') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?write_block</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
echo "<b>code=</b>block_code<i> (" . t('Required') . ")</i> <br />";
echo "<b>start=</b>byte_position_starting_from_zero<i> (" . t('Required') . ")</i> <br />";
echo "<b>data=</b>data_to_write<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return "Ok" or "Error" string.') . '<br /></p>';
echo '<h3>' . t('Delete a block') . ':</h3>';
echo '<p>';
echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?delete_block</i><br />';
echo '<br />';
echo t('Parameters') . ':<br />';
echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
echo "<b>code=</b>block_code<i> (" . t('Required') . ")</i> <br />";
echo '</p>';
echo '<p>' . t('This will return "Ok" or "Error" string.') . '<br /></p>';
}
echo '</div><br />';
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
exit;
}
/* Lets use interface now. */
header('Content-Type: text; charset=utf-8');
check_errors ();
if (has_error ())
{
echo "Error";
exit;
}
/* Upload file */
if (isset ($_FILES['file']) && is_writable (VAR_FILES)
&& is_writable (VAR_LINKS))
{
if (strlen ($cfg['upload_password']) > 0 && (!isset ($_POST['upload_password']) || $_POST['upload_password'] != $cfg['upload_password']))
{
echo "Error";
exit;
}
$key = '';
if (isset ($_POST['key']))
$key = $_POST['key'];
$time = time ();
if (!isset ($_POST['time']))
$time = JIRAFEAU_INFINITY;
else
switch ($_POST['time'])
{
case 'minute':
$time += JIRAFEAU_MINUTE;
break;
case 'hour':
$time += JIRAFEAU_HOUR;
break;
case 'day':
$time += JIRAFEAU_DAY;
break;
case 'week':
$time += JIRAFEAU_WEEK;
break;
case 'month':
$time += JIRAFEAU_MONTH;
break;
default:
$time = JIRAFEAU_INFINITY;
break;
}
$res = jirafeau_upload ($_FILES['file'],
isset ($_POST['one_time_download']),
$key, $time, $_SERVER['REMOTE_ADDR'],
$cfg['enable_crypt'], $cfg['link_name_lenght']);
if (empty($res) || $res['error']['has_error'])
{
echo "Error";
exit;
}
/* Print direct link. */
echo $res['link'];
/* Print delete link. */
echo NL;
echo $res['delete_link'];
/* Print decrypt key. */
echo NL;
echo urlencode($res['crypt_key']);
}
elseif (isset ($_GET['h']))
{
$link_name = $_GET['h'];
$key = '';
if (isset ($_POST['key']))
$key = $_POST['key'];
$d = '';
if (isset ($_GET['d']))
$d = $_GET['d'];
if (!preg_match ('/[0-9a-zA-Z_-]+$/', $link_name))
{
echo "Error";
exit;
}
$link = jirafeau_get_link ($link_name);
if (count ($link) == 0)
{
echo "Error";
exit;
}
if (strlen ($d) > 0 && $d == $link['link_code'])
{
jirafeau_delete_link ($link_name);
echo "Ok";
exit;
}
if ($link['time'] != JIRAFEAU_INFINITY && time () > $link['time'])
{
jirafeau_delete_link ($link_name);
echo "Error";
exit;
}
if (strlen ($link['key']) > 0 && md5 ($key) != $link['key'])
{
echo "Error";
exit;
}
$p = s2p ($link['md5']);
if (!file_exists (VAR_FILES . $p . $link['md5']))
{
echo "Error";
exit;
}
/* Read file. */
header ('Content-Length: ' . $link['file_size']);
header ('Content-Type: ' . $link['mime_type']);
header ('Content-Disposition: attachment; filename="' .
$link['file_name'] . '"');
$r = fopen (VAR_FILES . $p . $link['md5'], 'r');
while (!feof ($r))
{
print fread ($r, 1024);
ob_flush();
}
fclose ($r);
if ($link['onetime'] == 'O')
jirafeau_delete_link ($link_name);
exit;
}
elseif (isset ($_GET['get_capacity']))
{
echo min (jirafeau_ini_to_bytes (ini_get ('post_max_size')),
jirafeau_ini_to_bytes (ini_get ('upload_max_filesize')));
}
elseif (isset ($_GET['get_version']))
{
echo JIRAFEAU_VERSION;
}
elseif (isset ($_GET['lang']))
{
$l=$_GET['lang'];
if ($l == "bash")
{
?>
#!/bin/bash
# This script has been auto-generated by Jirafeau but you can still edit
# options below.
# Config
proxy='' # ex: proxy='proxysever.test.com:3128' or set JIRAFEAU_PROXY global variable
url='<?php echo $cfg['web_root'] . 'script.php'; ?>' # or set JIRAFEAU_URL ex: url='http://mysite/jirafeau/script.php'
time='none' # minute, hour, day, week, month or none. Or set JIRAFEAU_TIME.
one_time='' # ex: one_time="1" or set JIRAFEAU_ONE_TIME.
curl='' # curl path to download or set JIRAFEAU_CURL_PATH.
# End of config
if [ -n "$JIRAFEAU_PROXY" ]; then
proxy="$JIRAFEAU_PROXY"
fi
if [ -n "$JIRAFEAU_URL" ]; then
url="$JIRAFEAU_URL"
fi
if [ -z "$url" ]; then
echo "Please set url in script parameters or export JIRAFEAU_URL"
fi
if [ -n "$JIRAFEAU_TIME" ]; then
time="$JIRAFEAU_TIME"
fi
if [ -n "$JIRAFEAU_ONE_TIME" ]; then
one_time='1'
fi
if [ -z "$curl" ]; then
curl="$JIRAFEAU_CURL_PATH"
fi
if [ -z "$curl" ] && [ -e "/usr/bin/curl" ]; then
curl="/usr/bin/curl"
fi
if [ -z "$curl" ] && [ -e "/bin/curl.exe" ]; then
curl="/bin/curl.exe"
fi
if [ -z "$curl" ]; then
echo "Please set your curl binary path (by editing this script or export JIRAFEAU_CURL_PATH global variable)."
exit
fi
if [ -z "$2" ]; then
echo "man:"
echo " $0 send PATH [PASSWORD]"
echo " $0 get URL [PASSWORD]"
echo " $0 delete URL"
echo ""
echo "Global variables to export:"
echo " JIRAFEAU_PROXY : example: proxysever.test.com:3128"
echo " JIRAFEAU_URL : example: http://mysite/jirafeau/script.php"
echo " JIRAFEAU_TIME : minute, hour, day, week, month or none"
echo " JIRAFEAU_ONE_TIME : set anything or set empty"
echo " JIRAFEAU_CURL : path to your curl binary"
exit 0
fi
if [ -n "$proxy" ]; then
proxy="-x $proxy"
fi
options=''
if [ -n "$one_time" ]; then
options="$options -F one_time_download=1"
fi
password=''
if [ -n "$3" ]; then
password="$3"
options="$options -F key=$password"
fi
if [ "$1" == "send" ]; then
if [ ! -f "$2" ]; then
echo "File \"$2\" does not exists."
exit
fi
# Ret result
res=$($curl -X POST --http1.0 $proxy $options \
-F "time=$time" \
-F "file=@$2" \
$url)
if [[ "$res" == "Error" ]]; then
echo "Error while uploading."
exit
fi
# Not using head or tail to minimise command dependencies
code=$(cnt=0; echo "$res" | while read l; do
if [[ "$cnt" == "0" ]]; then
echo "$l"
fi
cnt=$(( cnt + 1 ))
done)
del_code=$(cnt=0; echo "$res" | while read l; do
if [[ "$cnt" == "1" ]]; then
echo "$l"
fi
cnt=$(( cnt + 1 ))
done)
echo "${url}?h=$code"
echo "${url}?h=$code&d=$del_code"
elif [ "$1" == "get" ]; then
if [ -z "$password" ]; then
$curl $proxy -OJ "$2"
else
$curl $proxy -OJ -X POST -F key=$password "$2"
fi
elif [ "$1" == "delete" ]; then
$curl $proxy "$2"
fi
<?php
}
else
{
echo "Error";
exit;
}
}
/* Initialize an asynchronous upload. */
elseif (isset ($_GET['init_async']))
{
if (strlen ($cfg['upload_password']) > 0 && (!isset ($_POST['upload_password']) || $_POST['upload_password'] != $cfg['upload_password']))
{
echo "Error";
exit;
}
if (!isset ($_POST['filename']))
{
echo "Error";
exit;
}
$type = '';
if (isset ($_POST['type']))
$type = $_POST['type'];
$key = '';
if (isset ($_POST['password']))
$key = $_POST['password'];
$time = time ();
if (!isset ($_POST['time']))
$time = JIRAFEAU_INFINITY;
else
switch ($_POST['time'])
{
case 'minute':
$time += JIRAFEAU_MINUTE;
break;
case 'hour':
$time += JIRAFEAU_HOUR;
break;
case 'day':
$time += JIRAFEAU_DAY;
break;
case 'week':
$time += JIRAFEAU_WEEK;
break;
case 'month':
$time += JIRAFEAU_MONTH;
break;
default:
$time = JIRAFEAU_INFINITY;
break;
}
echo jirafeau_async_init ($_POST['filename'],
$type,
isset ($_POST['one_time_download']),
$key,
$time,
$_SERVER['REMOTE_ADDR']);
}
/* Continue an asynchronous upload. */
elseif (isset ($_GET['push_async']))
{
if ((!isset ($_POST['ref']))
|| (!isset ($_FILES['data']))
|| (!isset ($_POST['code'])))
echo "Error";
else
echo jirafeau_async_push ($_POST['ref'], $_FILES['data'], $_POST['code']);
}
/* Finalize an asynchronous upload. */
elseif (isset ($_GET['end_async']))
{
if (!isset ($_POST['ref'])
|| !isset ($_POST['code']))
echo "Error";
else
echo jirafeau_async_end ($_POST['ref'], $_POST['code'], $cfg['enable_crypt'], $cfg['link_name_lenght']);
}
/* Initialize block. */
elseif (isset ($_GET['init_block']) && $cfg['enable_blocks'])
{
if (strlen ($cfg['upload_password']) > 0 && (!isset ($_POST['upload_password']) || $_POST['upload_password'] != $cfg['upload_password']))
{
echo "Error";
exit;
}
if (!isset ($_POST['size']))
echo "Error";
else
echo jirafeau_block_init ($_POST['size']);
}
/* Get block size. */
elseif (isset ($_GET['get_block_size']) && $cfg['enable_blocks'])
{
if (!isset ($_POST['id']))
echo "Error";
else
echo jirafeau_block_get_size ($_POST['id']);
}
/* Read data in block. */
elseif (isset ($_GET['read_block']) && $cfg['enable_blocks'])
{
if (!isset ($_POST['id'])
|| !isset ($_POST['start'])
|| !isset ($_POST['length']))
echo "Error";
else
jirafeau_block_read ($_POST['id'], $_POST['start'], $_POST['length']);
}
/* Write data in block. */
elseif (isset ($_GET['write_block']) && $cfg['enable_blocks'])
{
if (!isset ($_POST['id'])
|| !isset ($_POST['start'])
|| !isset ($_FILES['data'])
|| !isset ($_POST['code']))
echo "Error";
else
echo jirafeau_block_write ($_POST['id'], $_POST['start'], $_FILES['data'], $_POST['code']);
}
/* Delete block. */
elseif (isset ($_GET['delete_block']) && $cfg['enable_blocks'])
{
if (!isset ($_POST['id'])
|| !isset ($_POST['code']))
echo "Error";
else
echo jirafeau_block_delete ($_POST['id'], $_POST['code']);
}
else
echo "Error";
exit;
?>

26
sources/tos.php Executable file
View file

@ -0,0 +1,26 @@
<?php
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
require (JIRAFEAU_ROOT . 'lib/lang.php');
require (JIRAFEAU_ROOT . 'lib/template/header.php');
$url = $cfg['web_root'] . 'tos.php';
$org = "[THIS WEBSITE]";
$contact = "
By email:
contact@[THIS WEBSITE]
";
include (JIRAFEAU_ROOT . 'tos_text.php');
echo '<h2>Terms of Service</h2>';
echo '<div>';
echo '<textarea readonly="readonly" rows="210" cols="80">';
echo $tos;
echo '</textarea>';
echo '<p>This license text is under <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons - Attribution 3.0 Unported</a>.</p><p>It has been based on this work: <a href="http://opensource.org/ToS">http://opensource.org/ToS</a></p>';
echo '</div>';
require (JIRAFEAU_ROOT . 'lib/template/footer.php');
?>

63
sources/tos_text.php Executable file
View file

@ -0,0 +1,63 @@
<?php
/* This license text is under Creative Commons - Attribution 3.0 Unported.
* It has been based on this work: <a href="http://opensource.org/ToS">http://opensource.org/ToS
*/
$tos="
TERMS OF SERVICE
1. ACCEPTANCE OF TERMS
$org provides the information on this Web site as provided in these Terms of Service (\"TOS\"). $org may update the TOS at any time and without prior notice by posting a new version at $url. The information on this site and your use of it is subject to the most recent version of the TOS posted.
2. DESCRIPTION OF SERVICE
$org provides you an upload service and a variety of other services. (\"$org Service\"). Unless explicitly stated otherwise, any new features that augment or enhance the current $org Service shall be subject to the TOS.
3. CONDUCT
You understand that all information, data, text, software, graphics or other materials (\"Content\"), whether publicly posted or privately transmitted, are the sole responsibility of the person from whom such Content originated. This means that you, and not $org, are entirely responsible for all Content that you upload, post, email, transmit or otherwise make available via the $org Service. $org does not control the Content posted via the $org Service and, as such, does not guarantee the accuracy, integrity or quality of such Content. Under no circumstances will $org be liable in any way for any Content, including, but not limited to, any errors or omissions in any Content, or any loss or damage of any kind incurred as a result of the use of any Content posted, emailed, transmitted or otherwise made available via the $org Service. You agree to not use the $org Service to:
1) upload, post, email, transmit or otherwise make available any Content that is unlawful, harmful, threatening, abusive, harassing, tortuous, defamatory, vulgar, obscene, libelous, invasive of another's privacy, hateful, or racially, ethnically or otherwise objectionable or harm minors;
2) impersonate any person or entity or falsely state or otherwise misrepresent your affiliation with a person or entity;
3) forge headers or otherwise manipulate identifiers in order to disguise the origin of any Content transmitted through the $org Service;
4) upload, post, email, transmit or otherwise make available any Content that you do not have a right to make available under any law or under contractual or other relationships;
5) upload, post, email, transmit or otherwise make available any Content that infringes any patent, trademark, trade secret, copyright or other proprietary rights of any party;
6) upload, post, email, transmit or otherwise make available any unsolicited or unauthorized advertising, promotional materials, \"junk mail,\" \"spam,\" or any other form of solicitation;
7) upload, post, email, transmit or otherwise make available any material that contains software viruses or any other computer code, files or programs designed to interrupt, destroy or limit the functionality of any computer software or hardware or telecommunications equipment;
8) disrupt the normal flow of dialogue, or otherwise act in a manner that negatively affects other users' ability to engage in discussions or exchanges;
9) interfere with or disrupt the $org Service or servers or networks connected to the $org Service, or disobey any requirements, procedures, policies or regulations of networks connected to the $org Service;
10) intentionally or unintentionally violate any applicable local, state, national or international law,
11) \"stalk\" or otherwise harass another; and/or
12) collect or store personal data about other users in connection with the prohibited conduct and activities set forth in paragraphs above. You acknowledge that $org may or may not pre-screen Content, but that $org and its designees shall have the right (but not the obligation) in their sole discretion to pre-screen, refuse, move, or remove any Content that is available via the $org Service and which violates the TOS. You agree that you must evaluate, and bear all risks associated with, the use of any Content, including any reliance on the accuracy, completeness, or usefulness of such Content. You acknowledge, consent and agree that $org may access, preserve and disclose your account information and Content if required to do so by law or in a good faith belief that such access preservation or disclosure is reasonably necessary to:
(a) comply with legal process;
(b) enforce the TOS;
(c) respond to claims that any Content violates the rights of third parties;
(d) respond to your requests for customer service; or (e) protect the rights, property or personal safety of $org its users and the public.
4. CONTENT MADE AVAILABLE FOR INCLUSION ON THE $org SERVICE
$org does not claim ownership of Content you submit or make available for inclusion via the $org Service. However, with respect to Content you submit or make available for inclusion on the publicly available $org Service, you irrevocably grant $org the perpetual, worldwide, royalty-free and non-exclusive license, with the right to sublicense through multiple tiers of sublicensees, to use, distribute, reproduce, modify, adapt, publicly perform and publicly display such Content, in whole or in part, on the $org Service or other publications by $org in any media whether now existing or which come into the existence into the future and to provide that information under the license set forth on the initial page of the $url Web site. And for Content you submit for private discussions, you grant $org the worldwide, royalty-free and non-exclusive license to use, distribute, reproduce, modify, adapt, publicly perform and publicly display such Content on the associated private discussion group.
5. INDEMNITY
You agree to indemnify and hold $org and its subsidiaries, affiliates, officers, agents, employees, partners and licensors harmless from any claim or demand, including but not limited to reasonable attorneys' fees, made by any third party due to or arising out of Content you submit, post, transmit or otherwise make available through the Service, your use of the $org Service, your connection to the Service, your violation of the TOS, or your violation of any rights of another.
6. MODIFICATIONS TO $org SERVICE You acknowledge that $org may establish general practices and limits concerning use of the $org Service, including without limitation the maximum number of days that email messages, message board postings or other uploaded Content will be retained by the $org Service.. You further acknowledge that $org reserves the right to modify these general practices and limits from time to time. $org reserves the right at any time and from time to time to modify or discontinue, temporarily or permanently, the $org Service (or any part thereof) with or without notice. You agree that $org shall not be liable to you or to any third party for any modification, suspension or discontinuance of the $org Service.
7. TERMINATION
You agree that $org may terminate your access to the $org Service for violations of the TOS and/or requests by authorized law enforcement or other government agencies.
8. LINKS
The $org Service may provide, or third parties may provide, links to other World Wide Web sites or resources. Because $org has no control over such sites and resources, you acknowledge and agree that $org is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any Content, advertising, products or other materials on or available from such sites or resources. You further acknowledge and agree that $org shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such Content, goods or services available on or through any such site or resource.
9. DISCLAIMER OF WARRANTIES
You expressly understand and agree that: Your use of the $org service is at your sole risk. $org service is provided on an \"as is\" and \"as available\" basis. $org and its subsidiaries, affiliates, officers, employees and licensors expressly disclaim all warranties of any kind, whether express or implied, including, but not limited to the implied warranties of merchantability, fitness for a particular purpose and non-infringement. $org and its subsidiaries, affiliates, officers, employees and licensors make no warranty that
(i) The $org service will meet your requirements;
(ii) The $org service will be uninterrupted, timely, secure or error-free and
(iii) The results that may be obtained from the use of the $org service will be accurate or reliable. No advice or information, whether oral or written, obtained by you from $org or through or from the service shall create any warranty not expressly stated in the TOS.
10. LIMITATION OF LIABILITY
You expressly understand and agree that $org and its subsidiaries, affiliates, officers, employees, agents, partners and licensors shall not be liable to you for any direct, indirect, incidental, special, consequential or exemplary damages, including, but not limited to, damages for loss of profits, goodwill, use, data or other intangible losses (even if $org has been advised of the possibility of such damages), resulting from the use or the inability to use the $org service.
11. NOTICE AND PROCEDURE FOR MAKING CLAIMS OF COPYRIGHT INFRINGEMENT
$org respects the copyright of others, and we ask our users to do the same. $org may, in appropriate circumstances and at its discretion, disable and/or terminate the access of users who may be repeat infringers. If you believe that your work has been copied in a way that constitutes copyright infringement, please provide $org's Copyright Agent the following information: an electronic or physical signature of the person authorized to act on behalf of the owner of the copyright; a description of the copyrighted work that you claim has been infringed; a description of where the material that you claim is infringing is located on the site; your address, telephone number, and email address; a statement by you that you have a good faith belief that the disputed use is not authorized by the copyright owner, its agent, or the law; a statement by you, made under penalty of perjury, that the above information in your Notice is accurate and that you are the copyright owner or authorized to act on the copyright owner's behalf.
$org's Agent for Notice of claims of copyright infringement can be reached as follows:
$contact
";
?>