From: Jérôme Jutteau Date: Wed, 5 Dec 2012 12:51:29 +0000 (+0100) Subject: Initial commit: Jiraph 0.5 (stable) project X-Git-Tag: 1.0~34 X-Git-Url: https://git.p6c8.net/jirafeau.git/commitdiff_plain/6550c22fe503f109fc5e30ffee0d8445f51862bc Initial commit: Jiraph 0.5 (stable) project --- 6550c22fe503f109fc5e30ffee0d8445f51862bc diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..cb4932b --- /dev/null +++ b/clean.sh @@ -0,0 +1,19 @@ +# Jyraphe, your web file repository +# Copyright (C) 2008 Julien "axolotl" BERNARD +# +# 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 . + +WD="`dirname $0`" + +rm -f ${WD}/files/* ${WD}/links/* ${WD}/pub/* diff --git a/doc/COPYING b/doc/COPYING new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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 +. diff --git a/doc/README b/doc/README new file mode 100644 index 0000000..505431c --- /dev/null +++ b/doc/README @@ -0,0 +1,48 @@ +Jyraphe, your web file repository +================================= + +Jyraphe is a web application of file repository, easy to install and easy to +use. Jyraphe is an entirely free application, it is distributed under the +terms of the GNU Affero General Public License, version 3 or later. See the +COPYING file in this directory. + +For more information, see: +http://home.gna.org/jyraphe/ + +Jyraphe 0.4 (20 april 2009) +--------------------------- + + - SECURITY: possible path traversal by uploading a file R0...0 (32 zeroes) + and calling file.php?h=../files/R0..0 + - BUG: possibility to download a protected file without a key + - FEATURE: better form (without tables) + + +Jyraphe 0.3 (28 may 2008) +------------------------- + - SECURITY: a forged link file could be uploaded and accessed with + get.php?h=../files/forgedfile so that any readable file could be accessed + - FEATURE: install.php script with randomised name of the var/ directory + - FEATURE: password protection + - FEATURE: time limit + - FEATURE: Javascript to show the extended options + - FEATURE: support for multiple CSS and better handling of images in the css + - FEATURE: better Content-Type handling and XHTML validation + - SECURITY: now prevent .php from upload, rename it in .phps + - FEATURE: renamed get.php in file.php (in prevision of thumb.php) + + +Jyrahe 0.2 (22 april 2008) +-------------------------- + - SECURITY: .htaccess could be uploaded and change the access of var/ + - BUG: infinite loop when renaming a file in case of a collision + - BUG: warning of the substr_compare when null mime-type + - BUG: substr_compare not defined for old PHP4 + + +Jyraphe 0.1 (12 april 2008) +--------------------------- + - First release of Jyraphe + - KNOWN BUG: when not defining $cgf['web_root'] in config.local.php, and + having $cfg['use_redirect'] = true, the CSS does not appear in case of 404 + error. Workaround: define $cgf['web_root'] in your config.local.php diff --git a/doc/TODO b/doc/TODO new file mode 100644 index 0000000..d98140f --- /dev/null +++ b/doc/TODO @@ -0,0 +1,25 @@ +for next release + +- [feature] refactoring +- [feature] help links near the features that redirect on the documentation +- [feature] $cfg['trash']: put in trash/ or really delete +- [bug] in case of password, the true name is not sent (due to the HTTP POST request?) + see phpmyadmin and the dump function to see how it works for them - Cannot reproduce +- [bug] true name even in case of viewable files + + +if I have time + +- [doc] split the doc -> index(about)/user/hacker/developper +- [doc] add a note on the version number +- [doc] update and improve developper doc + + +later, much later (if people ask for it) + +- [feature] upload progress + http://www.haughin.com/2007/10/23/php-upload-progress-with-php-52-apc/ +- [feature] mail to the uploader +- [feature] mini images and icons (Entilope aka thumb.php) +- [feature] a list of the present files and possibility to purge them +- [feature] an XML-RPC interface diff --git a/doc/var.htaccess b/doc/var.htaccess new file mode 100644 index 0000000..babdb06 --- /dev/null +++ b/doc/var.htaccess @@ -0,0 +1,23 @@ +# Jyraphe, your web file repository +# Copyright (C) 2008 Julien "axolotl" BERNARD +# +# 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 . + +# This file prevents people to explore this directory +# For Apache httpd, you need to have the following line in yo configuration: +# AllowOverride Limit +# If you can, uncomment the following lines: + +# Order deny,allow +# Deny from all diff --git a/l10n/Jyraphe.pot b/l10n/Jyraphe.pot new file mode 100644 index 0000000..856a6a6 --- /dev/null +++ b/l10n/Jyraphe.pot @@ -0,0 +1,244 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-04-14 13:02+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: pub/file.php:54 +msgid "The time limit of this file has expired. It has been deleted." +msgstr "" + +#: pub/file.php:69 +msgid "Key protection" +msgstr "" + +#: pub/file.php:72 +msgid "Give the key of this file:" +msgstr "" + +#: pub/file.php:75 +msgid "I have the right to download this file" +msgstr "" + +#: pub/index.php:63 +msgid "An error occurred." +msgstr "" + +#: pub/index.php:72 +msgid "File uploaded! Copy the following URL to get it:" +msgstr "" + +#: pub/index.php:76 +msgid "This file is valid until the following date:" +msgstr "" + +#: pub/index.php:86 +msgid "The file directory is not writable!" +msgstr "" + +#: pub/index.php:90 +msgid "The link directory is not writable!" +msgstr "" + +#: pub/index.php:94 +msgid "The trash directory is not writable!" +msgstr "" + +#: pub/index.php:104 +msgid "Upload a file" +msgstr "" + +#: pub/index.php:106 +#, php-format +msgid "Maximum file size: %dMB" +msgstr "" + +#: pub/index.php:107 +msgid "Send in the binary chaos" +msgstr "" + +#: pub/index.php:112 +msgid "One time download" +msgstr "" + +#: pub/index.php:113 +msgid "File key:" +msgstr "" + +#: pub/index.php:114 +msgid "Time limit:" +msgstr "" + +#: pub/index.php:116 +msgid "None" +msgstr "" + +#: pub/index.php:117 +msgid "One minute" +msgstr "" + +#: pub/index.php:118 +msgid "One hour" +msgstr "" + +#: pub/index.php:119 +msgid "One day" +msgstr "" + +#: pub/index.php:120 +msgid "One week" +msgstr "" + +#: pub/index.php:121 +msgid "One month" +msgstr "" + +#: pub/install.php:36 +msgid "" +"This file was generated by the install process. You can edit it. Please see " +"config.php to understand the configuration items." +msgstr "" + +#: pub/install.php:66 +msgid "The following directory could not be created:" +msgstr "" + +#: pub/install.php:67 +msgid "You should create this directory by hand." +msgstr "" + +#: pub/install.php:68 +msgid "The following directory is not writable:" +msgstr "" + +#: pub/install.php:69 +msgid "You should give the write right to the web server on this directory." +msgstr "" + +#: pub/install.php:70 +msgid "Here is a solution:" +msgstr "" + +#: pub/install.php:116 +msgid "" +"The local configuration file could not be created. Create a lib/config." +"local.php file and give the write right to the web server (preferred " +"solution), or give the write right to the web server on the lib " +"directory." +msgstr "" + +#: pub/install.php:124 +msgid "" +"The local configuration is not writable by the web server. Give the write " +"right to the web server on the lib/config.local.php file." +msgstr "" + +#: pub/install.php:163 pub/install.php:202 pub/install.php:258 +#, php-format +msgid "Installation of Jyraphe - step %d out of %d" +msgstr "" + +#: pub/install.php:169 +msgid "Finalisation" +msgstr "" + +#: pub/install.php:172 +msgid "" +"Jyraphe is setting the website according to the configuration you provided." +msgstr "" + +#: pub/install.php:175 pub/install.php:241 +msgid "Previous step" +msgstr "" + +#: pub/install.php:191 +msgid "Retry this step" +msgstr "" + +#: pub/install.php:196 +msgid "Your website is now fully operational:" +msgstr "" + +#: pub/install.php:208 +msgid "Information" +msgstr "" + +#: pub/install.php:211 +msgid "" +"The base address of Jyraphe 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!" +msgstr "" + +#: pub/install.php:214 +msgid "Base address:" +msgstr "" + +#: pub/install.php:222 +msgid "" +"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!" +msgstr "" + +#: pub/install.php:225 +msgid "Data directory:" +msgstr "" + +#: pub/install.php:242 pub/install.php:283 +msgid "Next step" +msgstr "" + +#: pub/install.php:264 +msgid "Language" +msgstr "" + +#: pub/install.php:267 +msgid "" +"The installation of Jyraphe is internationalised, so you can have it in your " +"own language if the translation is available." +msgstr "" + +#: pub/install.php:270 +msgid "Choose your language:" +msgstr "" + +#: pub/lib/functions.php:86 +msgid "Your file exceeds the maximum authorized file size." +msgstr "" + +#: pub/lib/functions.php:91 +msgid "Your file was not uploaded correctly. You may succeed in retrying." +msgstr "" + +#: pub/lib/functions.php:97 +msgid "Internal error. You may not succeed in retrying." +msgstr "" + +#: pub/lib/functions.php:103 +msgid "Unknown error." +msgstr "" + +#: pub/lib/functions.php:125 +msgid "This file is forbidden for security reasons." +msgstr "" + +#: pub/lib/template/footer.php:2 +msgid "powered by Jyraphe" +msgstr "" + +#: pub/lib/template/header.php:15 pub/lib/template/header.php:22 +msgid "Jyraphe, your web file repository" +msgstr "" diff --git a/l10n/po/fr_FR.UTF-8.po b/l10n/po/fr_FR.UTF-8.po new file mode 100644 index 0000000..0fa9c87 --- /dev/null +++ b/l10n/po/fr_FR.UTF-8.po @@ -0,0 +1,285 @@ +# Jyraphe translation file +# Copyright (C) 2008 Jyraphe Project +# This file is distributed under the same license as the Jyraphe package. +# Julien "axolotl" BERNARD , 2008. +# +msgid "" +msgstr "" +"Project-Id-Version: Jyraphe 0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-04-14 13:02+0200\n" +"PO-Revision-Date: 2008-04-08 10:50+0200\n" +"Last-Translator: Julien Bernard \n" +"Language-Team: French\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: pub/file.php:54 +msgid "The time limit of this file has expired. It has been deleted." +msgstr "La durée limite de ce fichier a expiré. Il a été supprimé." + +#: pub/file.php:69 +msgid "Key protection" +msgstr "Protection par clef" + +#: pub/file.php:72 +msgid "Give the key of this file:" +msgstr "Donnez la clef de ce fichier :" + +#: pub/file.php:75 +msgid "I have the right to download this file" +msgstr "J'ai le droit de télécharger ce fichier" + +#: pub/index.php:63 +msgid "An error occurred." +msgstr "Une erreur s'est produite" + +#: pub/index.php:72 +msgid "File uploaded! Copy the following URL to get it:" +msgstr "Fichier chargé ! Copiez l'URL suivante pour l'obtenir :" + +#: pub/index.php:76 +msgid "This file is valid until the following date:" +msgstr "Ce fichier est valide juqu'à la date suivante :" + +#: pub/index.php:86 +msgid "The file directory is not writable!" +msgstr "Le répertoire des fichiers n'est pas accessible en écriture !" + +#: pub/index.php:90 +msgid "The link directory is not writable!" +msgstr "Le répertoire des liens n'est pas accessible en écriture !" + +#: pub/index.php:94 +msgid "The trash directory is not writable!" +msgstr "Le répertoire de corbeille n'est pas accessible en écriture !" + +#: pub/index.php:104 +msgid "Upload a file" +msgstr "Déposer un fichier" + +#: pub/index.php:106 +#, php-format +msgid "Maximum file size: %dMB" +msgstr "Taille de fichier maximale : %dMo" + +#: pub/index.php:107 +msgid "Send in the binary chaos" +msgstr "Envoyer dans le chaos binaire" + +#: pub/index.php:112 +msgid "One time download" +msgstr "Téléchargement à usage unique" + +#: pub/index.php:113 +msgid "File key:" +msgstr "Clef du fichier :" + +#: pub/index.php:114 +msgid "Time limit:" +msgstr "Durée limite :" + +#: pub/index.php:116 +msgid "None" +msgstr "Aucune" + +#: pub/index.php:117 +msgid "One minute" +msgstr "Une minute" + +#: pub/index.php:118 +msgid "One hour" +msgstr "Une heure" + +#: pub/index.php:119 +msgid "One day" +msgstr "Un jour" + +#: pub/index.php:120 +msgid "One week" +msgstr "Une semaine" + +#: pub/index.php:121 +msgid "One month" +msgstr "Un mois" + +#: pub/install.php:36 +msgid "" +"This file was generated by the install process. You can edit it. Please see " +"config.php to understand the configuration items." +msgstr "" +"Ce fichier a été généré par le processus d'installation. Vous pouvez " +"l'éditer. Veuillez regarder config.php pour comprendre les éléments de " +"configuration." + +#: pub/install.php:66 +msgid "The following directory could not be created:" +msgstr "Le répertoire suivant n'a pas pu être créé :" + +#: pub/install.php:67 +msgid "You should create this directory by hand." +msgstr "Vous devriez créer ce répertoire à la main." + +#: pub/install.php:68 +msgid "The following directory is not writable:" +msgstr "Le répertoire suivant n'est pas accessible en écriture :" + +#: pub/install.php:69 +msgid "You should give the write right to the web server on this directory." +msgstr "" +"Vous devriez donner les droits en écriture au serveur web sur ce répertoire." + +#: pub/install.php:70 +msgid "Here is a solution:" +msgstr "Voici une solution :" + +#: pub/install.php:116 +msgid "" +"The local configuration file could not be created. Create a lib/config." +"local.php file and give the write right to the web server (preferred " +"solution), or give the write right to the web server on the lib " +"directory." +msgstr "" +"La configuration locale n'a pas pu être créée. Créez un fichier lib/" +"config.local.php et donnez les droits d'écriture au serveur web " +"(solution préférée), ou donnez les droits d'écriture au serveur web sur le " +"répertoire lib." + +#: pub/install.php:124 +msgid "" +"The local configuration is not writable by the web server. Give the write " +"right to the web server on the lib/config.local.php file." +msgstr "" +"Le serveur web n'a pas les droits d'écriture sur la configuration locale. " +"Donnez les droits d'écriture au serveur web sur le fichier lib/config." +"local.php." + +#: pub/install.php:163 pub/install.php:202 pub/install.php:258 +#, php-format +msgid "Installation of Jyraphe - step %d out of %d" +msgstr "Installation de Jyraphe - étape %d sur %d" + +#: pub/install.php:169 +msgid "Finalisation" +msgstr "Finalisation" + +#: pub/install.php:172 +msgid "" +"Jyraphe is setting the website according to the configuration you provided." +msgstr "" +"Jyraphe est en train de mettre en place le site web en fonction de la " +"configuration que vous avez fournie." + +#: pub/install.php:175 pub/install.php:241 +msgid "Previous step" +msgstr "Étape précédente" + +#: pub/install.php:191 +msgid "Retry this step" +msgstr "Répéter cette étape" + +#: pub/install.php:196 +msgid "Your website is now fully operational:" +msgstr "Votre site web est maintenant pleinement opérationnel :" + +#: pub/install.php:208 +msgid "Information" +msgstr "Information" + +#: pub/install.php:211 +msgid "" +"The base address of Jyraphe 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!" +msgstr "" +"L'adresse de base de Jyraphe est la première partie de l'URL, jusqu'au slash " +"final (inclus). Par exemple : «http://www.exemple.fr/». N'oubliez pas le " +"slash final !" + +#: pub/install.php:214 +msgid "Base address:" +msgstr "Adresse de base :" + +#: pub/install.php:222 +msgid "" +"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!" +msgstr "" +"Le répertoire de données est le répertoire où vos fichiers et les " +"informations à propos de vos fichiers seront sauvegardées. Vous devriez le " +"placer en dehors de votre site web, ou au moins restreindre l'accès de ce " +"répertoire. N'oubliez pas le slash final !" + +#: pub/install.php:225 +msgid "Data directory:" +msgstr "Répertoire de données :" + +#: pub/install.php:242 pub/install.php:283 +msgid "Next step" +msgstr "Étape suivante" + +#: pub/install.php:264 +msgid "Language" +msgstr "Langue" + +#: pub/install.php:267 +msgid "" +"The installation of Jyraphe is internationalised, so you can have it in your " +"own language if the translation is available." +msgstr "" +"L'installation de Jyraphe est internationalisée, vous pouvez donc l'avoir " +"dans votre propre langue si la traduction est disponible." + +#: pub/install.php:270 +msgid "Choose your language:" +msgstr "Choisissez votre langue :" + +#: pub/lib/functions.php:86 +msgid "Your file exceeds the maximum authorized file size." +msgstr "Votre fichier excède la taille de fichier maximale autorisée." + +#: pub/lib/functions.php:91 +msgid "Your file was not uploaded correctly. You may succeed in retrying." +msgstr "" +"Votre fichier n'a pas été déposé correctement. Vous pouvez recommencer." + +#: pub/lib/functions.php:97 +msgid "Internal error. You may not succeed in retrying." +msgstr "Erreur interne." + +#: pub/lib/functions.php:103 +msgid "Unknown error." +msgstr "Erreur inconnue." + +#: pub/lib/functions.php:125 +msgid "This file is forbidden for security reasons." +msgstr "Ce fichier est interdit pour des raisons de sécurité." + +#: pub/lib/template/footer.php:2 +msgid "powered by Jyraphe" +msgstr "propulsé par Jyraphe" + +#: pub/lib/template/header.php:15 pub/lib/template/header.php:22 +msgid "Jyraphe, your web file repository" +msgstr "Jyraphe, votre dépôt de fichier en ligne" + +#~ msgid "Passwords are not the same. Try again." +#~ msgstr "Les mots de passe ne sont pas identiques. Essayez à nouveau." + +#~ msgid "More options:" +#~ msgstr "Plus d'options :" + +#~ msgid "activate password protection of the file" +#~ msgstr "activer la protection par mot de passe du fichier" + +#~ msgid "file password:" +#~ msgstr "mot de passe du fichier :" + +#~ msgid "file password again:" +#~ msgstr "mot de passe du fichier à nouveau :" + +#~ msgid "activate time limit of the file" +#~ msgstr "activer la durée limite du fichier" diff --git a/pub/.htaccess b/pub/.htaccess new file mode 100644 index 0000000..7071cd0 --- /dev/null +++ b/pub/.htaccess @@ -0,0 +1,26 @@ +# Jyraphe, your web file repository +# Copyright (C) 2008 Julien "axolotl" BERNARD +# +# 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 . + +# This file allows you to have nice redirect URLs +# For Apache httpd, you need to have the following line in yo configuration: +# AllowOverride FileInfo +# If you can, uncomment the following lines: + + + RewriteEngine On + RewriteRule file.php - [L] + RewriteRule ^file-(.*)$ file.php?h=$1 + diff --git a/pub/file.php b/pub/file.php new file mode 100644 index 0000000..1abbec5 --- /dev/null +++ b/pub/file.php @@ -0,0 +1,122 @@ + + * + * 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 . + */ + +define('JYRAPHE_ROOT', dirname(__FILE__) . '/'); + +require(JYRAPHE_ROOT . 'lib/config.php'); +require(JYRAPHE_ROOT . 'lib/settings.php'); +require(JYRAPHE_ROOT . 'lib/functions.php'); + +if(isset($_GET['h']) && !empty($_GET['h'])) { + $link_name = $_GET['h']; + + if(!ereg('^[OR][0-9a-f]{32}$', $link_name)) { + header("HTTP/1.0 404 Not Found"); + + require(JYRAPHE_ROOT . 'lib/template/header.php'); + echo '

Error 404: Not Found

'; + require(JYRAPHE_ROOT . 'lib/template/footer.php'); + exit; + } + + $link_file = VAR_LINKS . $link_name; + if(file_exists($link_file)) { + $content = file($link_file); + $file_name = trim($content[0]); + $mime_type = trim($content[1]); + $file_size = trim($content[2]); + $key = trim($content[3], NL); + $time = trim($content[4]); + + if($time != JYRAPHE_INFINITY) { + if(time() > $time) { + unlink($link_file); + $new_name = jyraphe_detect_collision($file_name, VAR_TRASH); + rename(VAR_FILES . $file_name, VAR_TRASH . $new_name); + + require(JYRAPHE_ROOT . 'lib/template/header.php'); + echo '

' . _('The time limit of this file has expired. It has been deleted.') . '

'; + require(JYRAPHE_ROOT . 'lib/template/footer.php'); + exit; + + } + } + + if(!empty($key)) { + if(!isset($_POST['key'])) { + require(JYRAPHE_ROOT . 'lib/template/header.php'); +?> +
+
+ +
+ + + + + + + + +
+
+
+
+

Error 403: Forbidden

'; + require(JYRAPHE_ROOT . 'lib/template/footer.php'); + exit; + } + } + } + + header('Content-Length: ' . $file_size); + header('Content-Type: ' . $mime_type); + if(!jyraphe_is_viewable($mime_type)) { + header('Content-Disposition: attachment; filename="' . $file_name . '"'); + } + readfile(VAR_FILES . $file_name); + + if($link_name[0] == 'O') { + unlink($link_file); + $new_name = jyraphe_detect_collision($file_name, VAR_TRASH); + rename(VAR_FILES . $file_name, VAR_TRASH . $new_name); + } + exit; + } else { + header("HTTP/1.0 404 Not Found"); + + require(JYRAPHE_ROOT . 'lib/template/header.php'); + echo '

Error 404: Not Found

'; + require(JYRAPHE_ROOT . 'lib/template/footer.php'); + exit; + } +} else { + header('Location: ' . $cfg['web_root']); + exit; +} + +?> diff --git a/pub/index.php b/pub/index.php new file mode 100644 index 0000000..80a5230 --- /dev/null +++ b/pub/index.php @@ -0,0 +1,143 @@ + + * + * 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 . + */ + +define('JYRAPHE_ROOT', dirname(__FILE__) . '/'); +define('DEBUG', true); + +require(JYRAPHE_ROOT . 'lib/config.php'); +require(JYRAPHE_ROOT . 'lib/settings.php'); +require(JYRAPHE_ROOT . 'lib/functions.php'); + +/* check if the destination dirs are writable */ +$writable = is_writable(VAR_FILES) && is_writable(VAR_LINKS) && is_writable(VAR_TRASH); + +$res = array(); +if($writable && isset($_POST['jyraphe'])) { + + $key = $_POST['key']; + + $time = time(); + switch($_POST['time']) { + case 'minute': + $time += JYRAPHE_MINUTE; + break; + case 'hour': + $time += JYRAPHE_HOUR; + break; + case 'day': + $time += JYRAPHE_DAY; + break; + case 'week': + $time += JYRAPHE_WEEK; + break; + case 'month': + $time += JYRAPHE_MONTH; + break; + default: + $time = JYRAPHE_INFINITY; + break; + } + + $res = jyraphe_upload($_FILES['file'], isset($_POST['one_time_download']), $key, $time, $cfg); +} + +require(JYRAPHE_ROOT . 'lib/template/header.php'); + +/* Checking for errors. */ +if(!is_writable(VAR_FILES)) { + add_error (_('The file directory is not writable!'), VAR_FILES); +} + +if(!is_writable(VAR_LINKS)) { + add_error (_('The link directory is not writable!'), VAR_LINKS); +} + +if(!is_writable(VAR_TRASH)) { + add_error (_('The trash directory is not writable!'), VAR_TRASH); +} + +/* Check if the install.php script is still in the directory. */ +if (file_exists(JYRAPHE_ROOT . 'install.php')) { + add_error (_('Installer script still present'), + _('Please make sure to delete the installer script "install.php" before continuing.')); +} + +if(!has_error() && !empty($res)) { + if($res['error']['has_error']) { + add_error (_('An error occurred.'), $res['error']['why']); + } else { + $link = $cfg['web_root']; + if($cfg['rewrite']) { + $link .= 'file-' . $res['link']; + } else { + $link .= 'file.php?h=' . $res['link']; // h because 'h' looks like a jyraphe ;) + } + echo '
' . NL; + echo '

' . _('File uploaded! Copy the following URL to get it:') . '
' . NL; + echo '' . $link . '' . NL; + + if($time != JYRAPHE_INFINITY) { + echo '
' . _('This file is valid until the following date:') . '
' . strftime('%c' ,$time) . ''; + } + + echo '

'; + } +} + +if(has_error ()) { + show_errors (); +} + +if(!has_error () && $writable) { +?> + +
+
+
+
+ +

+

+

+ +
+ +
+

+

+

+ +

+
+
+
+
+ + diff --git a/pub/install.php b/pub/install.php new file mode 100644 index 0000000..faf7911 --- /dev/null +++ b/pub/install.php @@ -0,0 +1,316 @@ + + * + * 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 . + */ + +define('JYRAPHE_ROOT', dirname(__FILE__) . '/'); +define('NL', "\n"); +define('QUOTE', "'"); + +define('JYRAPHE_CFG', JYRAPHE_ROOT . 'lib/config.local.php'); +define('JYRAPHE_VAR_RAND_LENGTH', 15); + +require(JYRAPHE_ROOT . 'lib/config.php'); + +function jyraphe_quoted($str) { + return QUOTE . str_replace(QUOTE, "\'", $str) . QUOTE; +} + +function jyraphe_export_cfg($cfg) { + $handle = fopen(JYRAPHE_CFG, 'w'); + fwrite($handle, ' $item) { + fwrite($handle, '$cfg[' . jyraphe_quoted($key) . '] = '); + if(is_bool($item)) { + fwrite($handle, ($item ? 'true' : 'false')); + } else if(is_string($item)) { + fwrite($handle, jyraphe_quoted($item)); + } else { + fwrite($handle, 'null'); + } + fwrite($handle, ';' . NL); + } + fwrite($handle, '?>'); // no newline at the end of the file to be able to send headers + fclose($handle); +} + +function jyraphe_mkdir($path) { + if(!file_exists($path)) { + if(!@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 jyraphe_is_writable($path) { + return is_writable($path) || @chmod($path, 0777); // "@" gets rid of error messages. +} + +function jyraphe_check_var_dir($path) { + $mkdir_str1 = _('The following directory could not be created:'); + $mkdir_str2 = _('You should create this directory by hand.'); + $write_str1 = _('The following directory is not writable:'); + $write_str2 = _('You should give the write right to the web server on this directory.'); + $solution_str = _('Here is a solution:'); + + if(!jyraphe_mkdir($path)) { + return array( + 'has_error' => true, + 'why' => $mkdir_str1 . '
' . $path . '
' . $solution_str . '
' . $mkdir_str2 + ); + } + + if(!jyraphe_is_writable($path)) { + return array( + 'has_error' => true, + 'why' => $write_str1 . '
' . $path . '
' . $solution_str . '
' . $write_str2 + ); + } + + foreach(array('files', 'links', 'trash') as $subdir) { + $subpath = $path . $subdir; + + if(!jyraphe_mkdir($subpath)) { + return array( + 'has_error' => true, + 'why' => $mkdir_str1 . '
' . $subpath . '
' . $solution_str . '
' . $mkdir_str2 + ); + } + + if(!jyraphe_is_writable($subpath)) { + return array( + 'has_error' => true, + 'why' => $write_str1 . '
' . $subpath . '
' . $solution_str . '
' . $write_str2 + ); + } + + } + + return array('has_error' => false, 'why' => ''); +} + +function jyraphe_add_ending_slash($path) { + return $path . ((substr($path, -1) == '/') ? '' : '/'); +} + +if(!file_exists(JYRAPHE_CFG)) { + // we try to create an empty one + if(!@touch(JYRAPHE_CFG)) { + require(JYRAPHE_ROOT . 'lib/template/header.php'); + echo '

' . _('The local configuration file could not be created. Create a lib/config.local.php file and give the write right to the web server (preferred solution), or give the write right to the web server on the lib directory.') . '

'; + require(JYRAPHE_ROOT . 'lib/template/footer.php'); + exit; + } +} + +if (!is_writable(JYRAPHE_CFG) && !@chmod(JYRAPHE_CFG, '0666')) { + require(JYRAPHE_ROOT . 'lib/template/header.php'); + echo '

' . _('The local configuration is not writable by the web server. Give the write right to the web server on the lib/config.local.php file.') . '

'; + require(JYRAPHE_ROOT . 'lib/template/footer.php'); + exit; +} + +if(isset($_POST['step']) && isset($_POST['next'])) { + switch($_POST['step']) { + case 1: + $cfg['lang'] = $_POST['lang']; + jyraphe_export_cfg($cfg); + break; + + case 2: + $cfg['web_root'] = jyraphe_add_ending_slash($_POST['web_root']); + $cfg['var_root'] = jyraphe_add_ending_slash($_POST['var_root']); + jyraphe_export_cfg($cfg); + break; + + default: + // nothing to do + } + +} + +require(JYRAPHE_ROOT . 'lib/settings.php'); +require(JYRAPHE_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 3: +?> +

+
+
+ + +
+ + + + + + + + + +
+
+
+
+ +

' . $err['why'] . '
' . NL; +?> +

+ + + +
+'; + } else { + echo '

' . _('Your website is now fully operational:') . '
' . $cfg['web_root'] . '

'; + } + break; + + case 2: +?> +

+
+
+ + +
+ + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+
+ 'English', + 'fr_FR.UTF-8' => 'Français' + ); +?> +

+
+
+ + +
+ + + + + + + + + + + + + +
+ +
+
+
+
+ diff --git a/pub/jyraphe.js b/pub/jyraphe.js new file mode 100644 index 0000000..246256e --- /dev/null +++ b/pub/jyraphe.js @@ -0,0 +1,25 @@ +/* + * Jyraphe, your web file repository + * Copyright (C) 2008 Julien "axolotl" BERNARD + * + * 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 . + */ + +function jyraphe_toggle(id) { + if(document.getElementById(id).style.display == 'block') { + document.getElementById(id).style.display = 'none'; + } else { + document.getElementById(id).style.display = 'block'; + } +} diff --git a/pub/lib/config.php b/pub/lib/config.php new file mode 100644 index 0000000..33211ea --- /dev/null +++ b/pub/lib/config.php @@ -0,0 +1,42 @@ + + * + * 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 . + */ + +/* + * default configuration + * if you want to change this, overwrite in a config.local.php file + */ + +// don't forget the ending '/' +$cfg['web_root'] = ''; + +$cfg['var_root'] = ''; + +$cfg['lang'] = ''; + +$cfg['style'] = 'default'; + +$cfg['rewrite'] = false; + +$cfg['password'] = ''; + +if((basename(__FILE__) != 'config.local.php') && file_exists(JYRAPHE_ROOT . 'lib/config.local.php')) { + require(JYRAPHE_ROOT . 'lib/config.local.php'); +} + +?> \ No newline at end of file diff --git a/pub/lib/functions.php b/pub/lib/functions.php new file mode 100644 index 0000000..76bd1cc --- /dev/null +++ b/pub/lib/functions.php @@ -0,0 +1,221 @@ + + * + * 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 . + */ + +/** + * transforms a php.ini string representing a value in an integer + * @param $value the value from php.ini + * @returns an integer for this value + */ +function jyraphe_ini_to_bytes($value) { + $modifier = substr($value, -1); + $bytes = substr($value, 0, -1); + switch(strtoupper($modifier)) { + case 'P': + $bytes *= 1024; + case 'T': + $bytes *= 1024; + case 'G': + $bytes *= 1024; + case 'M': + $bytes *= 1024; + case 'K': + $bytes *= 1024; + default: + break; + } + return $bytes; +} + +/** + * gets the maximum upload size according to php.ini + * @returns the maximum upload size + */ +function jyraphe_get_max_upload_size() { + return min(jyraphe_ini_to_bytes(ini_get('post_max_size')), jyraphe_ini_to_bytes(ini_get('upload_max_filesize'))); +} + +/** + * detects if a given filename is present in a directory and find an alternate filename + * @param $name the initial filename + * @param $dir the directory to explore (finishing with a '/') + * @returns an alternate filename, possibly the initial filename + */ +function jyraphe_detect_collision($name, $dir) { + if(!file_exists($dir . $name)) { + return $name; + } + + $dot = strpos($name, '.'); + $dot = ($dot === false) ? strlen($name) : $dot; + $first = substr($name, 0, $dot); + $second = substr($name, $dot); + $i = 1; + do { + $new_name = $first . '-' . $i . $second; + $i++; + } while(file_exists($dir . $new_name)); + + return $new_name; +} + +/** + * gets a string explaining the error + * @param $code the error code + * @returns a string explaining the error + */ +function jyraphe_upload_errstr($code) { + switch($code) { + case UPLOAD_ERR_INI_SIZE: + case UPLOAD_ERR_FORM_SIZE: + return _('Your file exceeds the maximum authorized file size.'); + break; + + case UPLOAD_ERR_PARTIAL: + case UPLOAD_ERR_NO_FILE: + return _('Your file was not uploaded correctly. You may succeed in retrying.'); + break; + + case UPLOAD_ERR_NO_TMP_DIR: + case UPLOAD_ERR_CANT_WRITE: + case UPLOAD_ERR_EXTENSION: + return _('Internal error. You may not succeed in retrying.'); + break; + + default: + break; + } + return _('Unknown error.'); +} + +/** + * handles an uploaded file + * @param $file the file struct given by $_FILE[] + * @param $one_time_download is the file a one time download ? + * @param $key if not empty, protect the file with this key + * @param $time the time of validity of the file + * @param $cfg the current configuration + * @returns an array containing some information + * 'error' => information on possible errors + * 'link' => the link name of the uploaded file + */ +function jyraphe_upload($file, $one_time_download, $key, $time, $cfg) { + if(!empty($file['tmp_name'])) { + + if($file['name'] == '.htaccess') { + return(array( + 'error' => array( + 'has_error' => true, + 'why' => _('This file is forbidden for security reasons.')), + 'link' => '') + ); + } + + + if(is_uploaded_file($file['tmp_name'])) { + + /* array representing no error */ + $noerr = array('has_error' => false, 'why' => ''); + + /* we check if this file is already here */ + $md5 = md5_file($file['tmp_name']); + $link_name = ($one_time_download ? 'O' : 'R') . $md5; + if(file_exists(VAR_LINKS . $link_name)) { + return(array('error' => $noerr, 'link' => $link_name)); + } + + $mime_type = $file['type']; + $final_name = trim($file['name']); + + /* we prevent .php and make it a .phps for security reasons */ + if((strlen($final_name) >= 4) && (substr($final_name, -4) == '.php')) { + $final_name .= 's'; + $mime_type = 'application/x-httpd-php-source'; + } + + /* we check if there is a file with that name */ + $final_name = jyraphe_detect_collision($final_name, VAR_FILES); + + /* we move it to the right place and create the link */ + if(move_uploaded_file($file['tmp_name'], VAR_FILES . $final_name)) { + $handle = fopen(VAR_LINKS . $link_name, 'w'); + fwrite($handle, $final_name . NL . $mime_type . NL . $file['size'] . NL . $key . NL . $time . NL); + fclose($handle); + + return(array('error' => $noerr, 'link' => $link_name)); + } + } + } + + return(array('error' => array('has_error' => true, 'why' => jyraphe_upload_errstr($file['error'])), 'link' => '')); +} + +/** + * tells if a mime-type is viewable in a browser + * @param $mime the mime type + * @returns a boolean telling if a mime type is viewable + */ +function jyraphe_is_viewable($mime) { + if(!empty($mime)) { + // actually, verify if mime-type is an image or a text + $viewable = array('image', 'text'); + $decomposed = explode('/', $mime); + return in_array($decomposed[0], $viewable); + } + return false; +} + + +// Error handling functions. +//! Global array that contains all registered errors. +$error_list = array (); + +/** + * Adds an error to the list of errors. + * @param $title the error's title + * @param $description is a human-friendly description of the problem. + */ +function add_error ($title, $description) { + global $error_list; + $error_list[] = '

' . $title . '
' . $description . '

'; +} + +/** + * Informs whether any error has been registered yet. + * @return true if there are errors. + */ +function has_error () { + global $error_list; + return !empty ($error_list); +} + +/** + * Displays all the errors. + */ +function show_errors () { + if (has_error ()) { + global $error_list; + echo '
'; + foreach ($error_list as $error) { + echo $error; + } + echo '
'; + } +} + +?> diff --git a/pub/lib/settings.php b/pub/lib/settings.php new file mode 100644 index 0000000..409235f --- /dev/null +++ b/pub/lib/settings.php @@ -0,0 +1,52 @@ + + * + * 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 . + */ + +// Jyraphe constants + +define('JYRAPHE_PACKAGE', 'Jyraphe'); +define('JYRAPHE_VERSION', '0.4'); + +// directories + +define('VAR_FILES', $cfg['var_root'] . 'files/'); +define('VAR_LINKS', $cfg['var_root'] . 'links/'); +define('VAR_TRASH', $cfg['var_root'] . 'trash/'); + +// i18n + +setlocale(LC_ALL, $cfg['lang']); + +bindtextdomain(JYRAPHE_PACKAGE, JYRAPHE_ROOT . 'lib/locale'); +textdomain(JYRAPHE_PACKAGE); + + +// useful constants + +if(!defined('NL')) { + define('NL', "\n"); +} + +define('JYRAPHE_INFINITY', -1); +define('JYRAPHE_MINUTE', 60); // 60 +define('JYRAPHE_HOUR', 3600); // JYRAPHE_MINUTE * 60 +define('JYRAPHE_DAY', 86400); // JYRAPHE_HOUR * 24 +define('JYRAPHE_WEEK', 604800); // JYRAPHE_DAY * 7 +define('JYRAPHE_MONTH', 2419200); // JYRAPHE_WEEK * 4 + +?> \ No newline at end of file diff --git a/pub/lib/template/footer.php b/pub/lib/template/footer.php new file mode 100644 index 0000000..da59fcb --- /dev/null +++ b/pub/lib/template/footer.php @@ -0,0 +1,7 @@ + + + + + diff --git a/pub/lib/template/header.php b/pub/lib/template/header.php new file mode 100644 index 0000000..551281d --- /dev/null +++ b/pub/lib/template/header.php @@ -0,0 +1,22 @@ + + + + + <?php echo _('Jyraphe, your web file repository'); ?> + + + + + +
+

diff --git a/pub/media/default/error.png b/pub/media/default/error.png new file mode 100644 index 0000000..4990130 Binary files /dev/null and b/pub/media/default/error.png differ diff --git a/pub/media/default/jyraphe.png b/pub/media/default/jyraphe.png new file mode 100644 index 0000000..e141069 Binary files /dev/null and b/pub/media/default/jyraphe.png differ diff --git a/pub/media/default/ok.png b/pub/media/default/ok.png new file mode 100644 index 0000000..c1ce846 Binary files /dev/null and b/pub/media/default/ok.png differ diff --git a/pub/media/default/style.css.php b/pub/media/default/style.css.php new file mode 100644 index 0000000..2342914 --- /dev/null +++ b/pub/media/default/style.css.php @@ -0,0 +1,178 @@ + + * + * 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 . + */ + +/* + * This stylesheet is the default stylesheet for Jyraphe. + * 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: 5px solid; +} + +h1 a { + text-decoration: none; + color: black; + border-bottom: 1px dotted; +} + +#content { + padding: 0 4em; + background: url('jyraphe.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: 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; +} \ No newline at end of file diff --git a/update-mo.sh b/update-mo.sh new file mode 100755 index 0000000..00d4d17 --- /dev/null +++ b/update-mo.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Jyraphe, your web file repository +# Copyright (C) 2008 Julien "axolotl" BERNARD +# +# 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 . +# + +WD="`dirname $0`" + +PACKAGE=Jyraphe +POT="${WD}/l10n/${PACKAGE}.pot" + +for PO in `ls ${WD}/l10n/po/*.po` +do + LANG=`basename "${PO}" | sed 's/.po//'` + mkdir -p "${WD}/pub/lib/locale/${LANG}/LC_MESSAGES/" + msgfmt -o "${WD}/pub/lib/locale/${LANG}/LC_MESSAGES/${PACKAGE}.mo" "${PO}" +done diff --git a/update-po.sh b/update-po.sh new file mode 100755 index 0000000..b8d36e8 --- /dev/null +++ b/update-po.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# +# Jyraphe, your web file repository +# Copyright (C) 2008 Julien "axolotl" BERNARD +# +# 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 . +# + +WD="`dirname $0`" + +PACKAGE=Jyraphe +POTFILES=`ls ${WD}/pub/*.php ${WD}/pub/lib/*.php ${WD}/pub/lib/template/*.php` +POT="${WD}/l10n/${PACKAGE}.pot" + +xgettext --language=PHP --output "${WD}/${PACKAGE}.po" ${POTFILES} + +if cmp -s "${WD}/${PACKAGE}.po" "${POT}" +then + rm -f "${WD}/${PACKAGE}.po" +else + mv -f "${WD}/${PACKAGE}.po" "${WD}/l10n/${PACKAGE}.pot" +fi + +for PO in `ls ${WD}/l10n/po/*.po` +do + LANG=`basename "${PO}" | sed 's/.po//'` + if msgmerge "${PO}" "${POT}" > "${WD}/${LANG}.pot" + then + mv -f "${WD}/${LANG}.pot" "${PO}" + echo "msgmerge of ${LANG} succeeded" + else + echo "msgmerge of ${LANG} failed" + rm -f "${WD}/${LANG}.pot" + fi +done